function comments_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'comments'); $apx->lang->drop('func_stats', 'comments'); if (in_array('COUNT_COMMENTS', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(id) FROM " . PRE . "_comments\n\t\t\tWHERE active=1\n\t\t"); $tmpl->assign('COUNT_COMMENTS', $count); } $tmpl->parse('functions/' . $template, 'comments'); }
function faq_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'faq'); $apx->lang->drop('func_stats', 'faq'); if (in_template(array('COUNT_ARTICLES', 'AVG_HITS'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_faq\n\t\t\tWHERE starttime!=0\n\t\t"); $tmpl->assign('COUNT_FAQ', $count); $tmpl->assign('AVG_HITS', round($hits)); } $tmpl->parse('functions/' . $template, 'faq'); }
function content_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'content'); $apx->lang->drop('func_stats', 'content'); if (in_template(array('COUNT', 'AVG_HITS'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_content\n\t\t\tWHERE active=1\n\t\t"); $tmpl->assign('COUNT', $count); $tmpl->assign('AVG_HITS', round($hits)); } $tmpl->parse('functions/' . $template, 'content'); }
function products_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'products'); $apx->lang->drop('func_stats', 'products'); if (in_template(array('COUNT_PRODUCTS', 'AVG_HITS'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_products\n\t\t\tWHERE active=1\n\t\t"); $tmpl->assign('COUNT_PRODUCTS', $count); $tmpl->assign('AVG_HITS', round($hits)); } $types = array('normal', 'game', 'music', 'movie', 'book', 'software', 'hardware'); foreach ($types as $type) { $varname = 'COUNT_PRODUCTS_' . strtoupper($type); if (in_array($varname, $parse)) { list($count) = $db->first("\n\t\t\t\tSELECT count(id) FROM " . PRE . "_products\n\t\t\t\tWHERE active=1 AND type='" . $type . "'\n\t\t\t"); $tmpl->assign($varname, $count); } } $tmpl->parse('functions/' . $template, 'products'); }
function calendar_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'calendar'); $apx->lang->drop('func_stats', 'calendar'); if (in_array('COUNT_CATGEORIES', $parse)) { list($count) = $db->first("SELECT count(id) FROM " . PRE . "_calendar_cat"); $tmpl->assign('COUNT_CATGEORIES', $count); } if (in_template(array('COUNT_EVENTS', 'AVG_HITS'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_calendar_events\n\t\t\tWHERE active!=0\n\t\t"); $tmpl->assign('COUNT_EVENTS', $count); $tmpl->assign('AVG_HITS', round($hits)); } $tmpl->parse('functions/' . $template, 'calendar'); }
function downloads_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'downloads'); $apx->lang->drop('func_stats', 'downloads'); if (in_array('COUNT_CATEGORIES', $parse)) { list($count) = $db->first("SELECT count(id) FROM " . PRE . "_downloads_cat"); $tmpl->assign('COUNT_CATEGORIES', $count); } if (in_template(array('COUNT_DOWNLOADS', 'AVG_HITS'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_downloads\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime\n\t\t"); $tmpl->assign('COUNT_DOWNLOADS', $count); $tmpl->assign('AVG_HITS', round($hits)); } $tmpl->parse('functions/' . $template, 'downloads'); }
function forum_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'forum'); $apx->lang->drop('func_stats', 'forum'); if (in_array('COUNT_POSTS', $parse)) { list($count) = $db->first("SELECT count(postid) FROM " . PRE . "_forum_posts WHERE del=0"); $tmpl->assign('COUNT_POSTS', $count); } if (in_template(array('COUNT_THREADS', 'AVG_HITS'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(threadid), avg(views) FROM " . PRE . "_forum_threads\n\t\t\tWHERE del=0 AND moved=0\n\t\t"); $tmpl->assign('COUNT_THREADS', $count); $tmpl->assign('AVG_HITS', round($hits)); } $tmpl->parse('functions/' . $template, 'forum'); }
function user_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'user'); $apx->lang->drop('func_stats', 'user'); //User if (in_array('COUNT_USERS', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(userid) FROM " . PRE . "_user\n\t\t\tWHERE active='1' " . iif($set['user']['listactiveonly'], " AND reg_key='' ") . "\n\t\t"); $tmpl->assign('COUNT_USERS', $count); } if (in_array('COUNT_USERS_MALE', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(userid) FROM " . PRE . "_user\n\t\t\tWHERE active='1' AND gender=1 " . iif($set['user']['listactiveonly'], " AND reg_key='' ") . "\n\t\t"); $tmpl->assign('COUNT_USERS_MALE', $count); } if (in_array('COUNT_USERS_FEMALE', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(userid) FROM " . PRE . "_user\n\t\t\tWHERE active='1' AND gender=2 " . iif($set['user']['listactiveonly'], " AND reg_key='' ") . "\n\t\t"); $tmpl->assign('COUNT_USERS_FEMALE', $count); } //Blogs if (in_array('COUNT_BLOGS', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(id) FROM " . PRE . "_user_blog\n\t\t"); $tmpl->assign('COUNT_BLOGS', $count); } //Galerien if (in_array('COUNT_GALLERIES', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(id) FROM " . PRE . "_user_gallery\n\t\t"); $tmpl->assign('COUNT_GALLERIES', $count); } if (in_array('COUNT_PICTURES', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(id) FROM " . PRE . "_user_pictures\n\t\t"); $tmpl->assign('COUNT_PICTURES', $count); } $tmpl->parse('functions/' . $template, 'user'); }
function gallery_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'gallery'); $apx->lang->drop('func_stats', 'gallery'); if (in_array('COUNT_GALLERIES', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(id) FROM " . PRE . "_gallery\n\t\t\tWHERE '" . time() . "' BETWEEN starttime AND endtime\n\t\t"); $tmpl->assign('COUNT_GALLERIES', $count); } if (in_template(array('COUNT_PICTURES', 'AVG_HITS'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(p.id), avg(p.hits) FROM " . PRE . "_gallery_pics AS p\n\t\t\tLEFT JOIN " . PRE . "_gallery AS g ON p.galid=g.id\n\t\t\tWHERE '" . time() . "' BETWEEN g.starttime AND g.endtime AND p.active=1\n\t\t"); $tmpl->assign('COUNT_PICTURES', $count); $tmpl->assign('AVG_HITS', round($hits)); } $tmpl->parse('functions/' . $template, 'gallery'); }
function poll_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'poll'); $apx->lang->drop('func_stats', 'poll'); if (in_template(array('COUNT_POLLS', 'AVG_VOTES'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(id), avg(a1_c+a2_c+a3_c+a4_c+a5_c+a6_c+a7_c+a8_c+a9_c+a10_c+a11_c+a12_c+a13_c+a14_c+a15_c+a16_c+a17_c+a18_c+a19_c+a20_c) FROM " . PRE . "_poll\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime\n\t\t"); $tmpl->assign('COUNT_POLLS', $count); $tmpl->assign('AVG_VOTES', round($hits)); } $tmpl->parse('functions/' . $template, 'poll'); }
function articles_stats($template = 'stats') { global $set, $db, $apx, $user; $tmpl = new tengine(); $parse = $tmpl->used_vars('functions/' . $template, 'articles'); $apx->lang->drop('func_stats', 'articles'); if (in_array('COUNT_CATGEORIES', $parse)) { list($count) = $db->first("SELECT count(id) FROM " . PRE . "_articles_cat"); $tmpl->assign('COUNT_CATGEORIES', $count); } if (in_template(array('COUNT_ARTICLES', 'AVG_HITS'), $parse)) { list($count, $hits) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_articles\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime\n\t\t"); $tmpl->assign('COUNT_ARTICLES', $count); $tmpl->assign('AVG_HITS', round($hits)); } if (in_array('COUNT_NORMAL', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_articles\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND type='normal'\n\t\t"); $tmpl->assign('COUNT_NORMAL', $count); } if (in_array('COUNT_REVIEWS', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_articles\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND type='review'\n\t\t"); $tmpl->assign('COUNT_REVIEWS', $count); } if (in_array('COUNT_PREVIEWS', $parse)) { list($count) = $db->first("\n\t\t\tSELECT count(id), avg(hits) FROM " . PRE . "_articles\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND type='preview'\n\t\t"); $tmpl->assign('COUNT_PREVIEWS', $count); } $tmpl->parse('functions/' . $template, 'articles'); }