Ejemplo n.º 1
0
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');
}
Ejemplo n.º 2
0
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');
}
Ejemplo n.º 3
0
 $tabledata[$i]['CATICON'] = $catinfo[$res['catid']]['icon'];
 //Produkt
 $tabledata[$i]['PRODUCT_ID'] = $res['prodid'];
 //Kommentare
 if ($apx->is_module('comments') && $set['videos']['coms'] && $res['allowcoms']) {
     require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
     if (!isset($coms)) {
         $coms = new comments('videos', $res['id']);
     } else {
         $coms->mid = $res['id'];
     }
     $link = mklink('videos.php?id=' . $res['id'], 'videos,id' . $res['id'] . urlformat($res['title']) . '.html');
     $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
     $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
     $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
     if (in_template(array('VIDEO.COMMENT_LAST_USERID', 'VIDEO.COMMENT_LAST_NAME', 'VIDEO.COMMENT_LAST_TIME'), $parse)) {
         $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid();
         $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name();
         $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time();
     }
 }
 //Bewertungen
 if ($apx->is_module('ratings') && $set['videos']['ratings'] && $res['allowrating']) {
     require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php';
     if (!isset($rate)) {
         $rate = new ratings('videos', $res['id']);
     } else {
         $rate->mid = $res['id'];
     }
     $tabledata[$i]['RATING'] = $rate->display();
     $tabledata[$i]['RATING_VOTES'] = $rate->count();
Ejemplo n.º 4
0
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');
}
Ejemplo n.º 5
0
 if (in_array('PRODUCT.RELEASE', $parse)) {
     $tabledata[$i]['RELEASE'] = $releaseinfo[$res['id']];
 }
 //Kommentare
 if ($apx->is_module('comments') && $set['products']['coms'] && $res['allowcoms']) {
     require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
     if (!isset($coms)) {
         $coms = new comments('products', $res['id']);
     } else {
         $coms->mid = $res['id'];
     }
     $link = mklink('products.php?id=' . $res['id'], 'products,id' . $res['id'] . urlformat($res['title']) . '.html');
     $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
     $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
     $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
     if (in_template(array('PRODUCT.COMMENT_LAST_USERID', 'PRODUCT.COMMENT_LAST_NAME', 'PRODUCT.COMMENT_LAST_TIME'), $parse)) {
         $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid();
         $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name();
         $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time();
     }
 }
 //Bewertungen
 if ($apx->is_module('ratings') && $set['products']['ratings'] && $res['allowrating']) {
     require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php';
     if (!isset($rate)) {
         $rate = new ratings('products', $res['id']);
     } else {
         $rate->mid = $res['id'];
     }
     $tabledata[$i]['RATING'] = $rate->display();
     $tabledata[$i]['RATING_VOTES'] = $rate->count();
Ejemplo n.º 6
0
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');
}
Ejemplo n.º 7
0
        //Tags
        $tabledata[$i]['TAG'] = $tagdata;
        $tabledata[$i]['TAG_IDS'] = $tagids;
        $tabledata[$i]['KEYWORDS'] = $keywords;
        //Kommentare
        if ($apx->is_module('comments') && $set['gallery']['galcoms'] && $res['allowcoms']) {
            require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
            if (!isset($coms)) {
                $coms = new comments('galleryself', $res['id']);
            } else {
                $coms->mid = $res['id'];
            }
            $link = mklink('gallery.php?id=' . $res['id'], 'gallery,list' . $res['id'] . ',1' . urlformat($res['title']) . '.html');
            $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
            $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
            $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
            if (in_template(array('GALLERY.COMMENT_LAST_USERID', 'GALLERY.COMMENT_LAST_NAME', 'GALLERY.COMMENT_LAST_TIME'), $parse)) {
                $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid();
                $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name();
                $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time();
            }
        }
        $laststamp = date('Y/m/d', $res['starttime'] - TIMEDIFF);
    }
}
$apx->tmpl->assign('GALLERY', $tabledata);
$apx->tmpl->parse('index');
////////////////////////////////////////////////////////////////////////////////////////////////////////
require 'lib/_end.php';
/////////////////////////////////////////////////////////// SCRIPT BEENDEN ///
////////////////////////////////////////////////////////////////////////////////////////////////////////
Ejemplo n.º 8
0
     $tabledata[$i]['GALLERY_TITLE'] = $galinfo['title'];
     $tabledata[$i]['GALLERY_LINK'] = mklink('gallery.php?id=' . $galinfo['id'], 'gallery,list' . $galinfo['id'] . ',1' . urlformat($galinfo['title']) . '.html');
 }
 //Kommentare
 if ($apx->is_module('comments') && $set['downloads']['coms'] && $res['allowcoms']) {
     require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
     if (!isset($coms)) {
         $coms = new comments('downloads', $res['id']);
     } else {
         $coms->mid = $res['id'];
     }
     $link = mklink('downloads.php?id=' . $res['id'], 'downloads,id' . $res['id'] . urlformat($res['title']) . '.html');
     $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
     $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
     $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
     if (in_template(array('DOWNLOAD.COMMENT_LAST_USERID', 'DOWNLOAD.COMMENT_LAST_NAME', 'DOWNLOAD.COMMENT_LAST_TIME'), $parse)) {
         $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid();
         $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name();
         $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time();
     }
 }
 //Bewertungen
 if ($apx->is_module('ratings') && $set['downloads']['ratings'] && $res['allowrating']) {
     require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php';
     if (!isset($rate)) {
         $rate = new ratings('downloads', $res['id']);
     } else {
         $rate->mid = $res['id'];
     }
     $tabledata[$i]['RATING'] = $rate->display();
     $tabledata[$i]['RATING_VOTES'] = $rate->count();
Ejemplo n.º 9
0
     $tabledata[$i]['GALLERY_TITLE'] = $galinfo['title'];
     $tabledata[$i]['GALLERY_LINK'] = mklink('gallery.php?id=' . $galinfo['id'], 'gallery,list' . $galinfo['id'] . ',1' . urlformat($galinfo['title']) . '.html');
 }
 //Kommentare
 if ($apx->is_module('comments') && $set['articles']['coms'] && $res['allowcoms']) {
     require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
     if (!isset($coms)) {
         $coms = new comments('articles', $res['id']);
     } else {
         $coms->mid = $res['id'];
     }
     $link = mklink($link2file . '.php?id=' . $res['id'], $link2file . ',id' . $res['id'] . ',1' . urlformat($res['title']) . '.html');
     $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
     $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
     $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
     if (in_template(array('ARTICLE.COMMENT_LAST_USERID', 'ARTICLE.COMMENT_LAST_NAME', 'ARTICLE.COMMENT_LAST_TIME'), $parse)) {
         $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid();
         $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name();
         $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time();
     }
 }
 //Bewertungen
 if ($apx->is_module('ratings') && $set['articles']['ratings'] && $res['allowrating']) {
     require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php';
     if (!isset($rate)) {
         $rate = new ratings('articles', $res['id']);
     } else {
         $rate->mid = $res['id'];
     }
     $tabledata[$i]['RATING'] = $rate->display();
     $tabledata[$i]['RATING_VOTES'] = $rate->count();
Ejemplo n.º 10
0
 $tabledata[$i]['TAG'] = $tagdata;
 $tabledata[$i]['TAG_IDS'] = $tagids;
 $tabledata[$i]['KEYWORDS'] = $keywords;
 //Kommentare
 if ($apx->is_module('comments') && $set['glossar']['coms'] && $res['allowcoms']) {
     require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
     if (!isset($coms)) {
         $coms = new comments('glossar', $res['id']);
     } else {
         $coms->mid = $res['id'];
     }
     $link = mklink('glossar.php?id=' . $res['id'], 'glossar,id' . $res['id'] . urlformat($res['title']) . '.html');
     $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
     $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
     $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
     if (in_template(array('INDEX.COMMENT_LAST_USERID', 'INDEX.COMMENT_LAST_NAME', 'INDEX.COMMENT_LAST_TIME'), $parse)) {
         $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid();
         $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name();
         $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time();
     }
 }
 //Bewertungen
 if ($apx->is_module('ratings') && $set['glossar']['ratings'] && $res['allowrating']) {
     require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php';
     if (!isset($rate)) {
         $rate = new ratings('glossar', $res['id']);
     } else {
         $rate->mid = $res['id'];
     }
     $tabledata[$i]['RATING'] = $rate->display();
     $tabledata[$i]['RATING_VOTES'] = $rate->count();
Ejemplo n.º 11
0
function user_blogs_last($count = 5, $start = 0, $friendsonly = false, $userid = 0, $template = 'lastblogs')
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $count = (int) $count;
    $start = (int) $start;
    $userid = (int) $userid;
    //Verwendete Variablen auslesen
    $parse = $apx->tmpl->used_vars('functions/' . $template, 'user');
    //Nach Freunde filtern
    $friendfilter = '';
    if ($friendsonly) {
        $friends = $user->get_buddies();
        $friends[] = -1;
        $friendfilter = " AND userid IN (" . implode(',', $friends) . ") ";
    }
    //Nach Benutzer filtern
    $userfilter = '';
    if ($userid) {
        $userfilter = " AND userid='" . $userid . "'";
    }
    $data = $db->fetch("SELECT * FROM " . PRE . "_user_blog WHERE 1 " . $userfilter . $friendfilter . " ORDER BY time DESC LIMIT " . iif($start, $start . ',') . $count);
    if (count($data)) {
        //Benutzer-Infos auslesen
        $userdata = array();
        if (in_template(array('BLOG.USERNAME', 'BLOG.REALNAME', 'BLOG.AVATAR', 'BLOG.AVATER_TITLE'), $parse)) {
            $userids = get_ids($data, 'userid');
            $userdata = $user->get_info_multi($userids, 'username,realname,avatar,avatar_title');
        }
        //Blogs auflisten
        $tabledata = array();
        foreach ($data as $res) {
            ++$i;
            $link = mklink('user.php?action=blog&id=' . $res['userid'] . '&blogid=' . $res['id'], 'user,blog,' . $res['userid'] . ',id' . $res['id'] . urlformat($res['title']) . '.html');
            //Text
            $text = '';
            if (in_array('BLOG.TEXT', $parse)) {
                $text = $res['text'];
                $text = badwords($text);
                $text = replace($text, 1);
                $text = dbsmilies($text);
                $text = dbcodes($text);
            }
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['TITLE'] = replace($res['title']);
            $tabledata[$i]['TEXT'] = $res['text'];
            $tabledata[$i]['LINK'] = $link;
            $tabledata[$i]['TIME'] = $res['time'];
            //Userinfo
            $userinfo = $userdata[$res['userid']];
            $tabledata[$i]['USERID'] = $res['userid'];
            $tabledata[$i]['USERNAME'] = replace($userinfo['username']);
            $tabledata[$i]['REALNAME'] = replace($userinfo['realname']);
            $tabledata[$i]['AVATAR'] = $user->mkavatar($userinfo);
            $tabledata[$i]['AVATAR_TITLE'] = $user->mkavtitle($userinfo);
            //Kommentare
            if ($apx->is_module('comments') && $res['allowcoms']) {
                require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
                if (!isset($coms)) {
                    $coms = new comments('userblog', $res['id']);
                } else {
                    $coms->mid = $res['id'];
                }
                $link = mklink('user.php?action=blog&id=' . $res['userid'] . '&blogid=' . $res['id'], 'user,blog,' . $res['userid'] . ',id' . $res['id'] . urlformat($res['title']) . '.html');
                $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
                $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
                $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
                if (in_template(array('BLOG.COMMENT_LAST_USERID', 'BLOG.COMMENT_LAST_NAME', 'BLOG.COMMENT_LAST_TIME'), $parse)) {
                    $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid();
                    $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name();
                    $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time();
                }
            }
        }
    }
    $tmpl->assign('BLOG', $tabledata);
    //Template ausgeben
    $tmpl->parse('functions/' . $template, 'user');
}
Ejemplo n.º 12
0
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');
}
Ejemplo n.º 13
0
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');
}
Ejemplo n.º 14
0
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');
}
Ejemplo n.º 15
0
function calendar_events_from_day($thisdaystamp, $parse, $parseprefix = 'DAY.')
{
    global $set, $apx, $db, $user;
    static $eventcache, $catdata;
    if (!isset($eventcache)) {
        $eventcache = array();
    }
    //Termin-Kategorien auslesen
    if (!isset($catdata)) {
        $catdata = array();
        if (in_template(array($parseprefix . 'EVENT.CATTITLE', $parseprefix . 'EVENT.CATICON'), $parse)) {
            $catdata = $db->fetch_index("SELECT * FROM " . PRE . "_calendar_cat", 'id');
        }
    }
    //Modefilter
    if ($_REQUEST['mode'] == 'private') {
        $modefilter = " AND a.private='1' AND a.userid='" . $user->info['userid'] . "' ";
    } else {
        $modefilter = " AND a.private='0' ";
    }
    //Sortby
    if ($set['calendar']['sortby'] == 2) {
        $sortby = " title ASC ";
    } else {
        $sortby = " startday DESC, starttime ASC ";
    }
    //Termine auslesen
    $edata = $db->fetch("SELECT a.*,b.username FROM " . PRE . "_calendar_events AS a LEFT JOIN " . PRE . "_user AS b USING(userid) WHERE '" . $thisdaystamp . "' BETWEEN startday AND endday AND a.active!=0 " . section_filter(true, 'a.secid') . " " . $modefilter . " ORDER BY " . $sortby);
    $eventdata = array();
    if (count($edata)) {
        foreach ($edata as $res) {
            ++$i;
            //Termin wurde schon verarbeitet => Übernehmen und fertig
            if (isset($eventcache[$res['id']])) {
                $eventdata[$i] = $eventcache[$res['id']];
                continue;
            }
            //Kategorie-Info
            $catinfo = $catdata[$res['catid']];
            //Link zum Termin
            $link = mklink('events.php?id=' . $res['id'], 'events,id' . $res['id'] . urlformat($res['title']) . '.html');
            //Aufmacher
            $picture = $picture_popup = $picture_popuppath = '';
            if (in_template(array($parseprefix . 'EVENT.PICTURE', $parseprefix . 'EVENT.PICTURE_POPUP', $parseprefix . 'EVENT.PICTURE_POPUPPATH'), $parse)) {
                list($picture, $picture_popup, $picture_popuppath) = calendar_pic($res['picture']);
            }
            //Start berechnen
            $startday = $starttime = $endday = $endtime = 0;
            if (in_template(array($parseprefix . 'EVENT.STARTDAY', $parseprefix . 'EVENT.STARTTIME'), $parse)) {
                $startday = calendar_stamp2time($res['startday']);
                if ($res['starttime'] != -1) {
                    $time_comp = calendar_explode_stamp($res['startday']);
                    $tmpstamp = sprintf('%04d', $res['starttime']);
                    $time_comp['hour'] = substr($tmpstamp, 0, 2);
                    $time_comp['minute'] = substr($tmpstamp, 2, 2);
                    $starttime = mktime($time_comp['hour'], $time_comp['minute'], 0, $time_comp['month'], $time_comp['day'], $time_comp['year']) + TIMEDIFF;
                }
            }
            //Ende berechnen (falls nötig)
            if (in_template(array($parseprefix . 'EVENT.ENDDAY', $parseprefix . 'EVENT.ENDTIME'), $parse)) {
                if ($res['endday'] != $res['startday'] || $res['endtime'] != -1) {
                    $endday = calendar_stamp2time($res['endday']);
                    if ($res['endtime'] != -1) {
                        $time_comp = calendar_explode_stamp($res['endday']);
                        $tmpstamp = sprintf('%04d', $res['endtime']);
                        $time_comp['hour'] = substr($tmpstamp, 0, 2);
                        $time_comp['minute'] = substr($tmpstamp, 2, 2);
                        $endtime = mktime($time_comp['hour'], $time_comp['minute'], 0, $time_comp['month'], $time_comp['day'], $time_comp['year']) + TIMEDIFF;
                    }
                }
            }
            //Username + eMail
            if ($res['userid']) {
                $username = $res['username'];
                $email = iif(!$res['pub_hidemail'], $res['email']);
            } else {
                $username = $res['send_username'];
                $email = $res['send_email'];
            }
            //Text
            $eventtext = '';
            if (in_array($parseprefix . 'EVENT.TEXT', $parse)) {
                $eventtext = mediamanager_inline($res['text']);
            }
            //Tags
            if (in_array($parseprefix . 'EVENT.TAG', $parse) || in_array($parseprefix . 'EVENT.TAG_IDS', $parse) || in_array($parseprefix . 'EVENT.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = calendar_tags($res['id']);
            }
            $event = array();
            $event['ID'] = $res['id'];
            $event['TITLE'] = $res['title'];
            $event['TEXT'] = $eventtext;
            $event['LINK'] = $link;
            $event['PRIORITY'] = $res['priority'];
            $event['RESTRICTED'] = $res['restricted'];
            $event['LOCATION'] = compatible_hsc($res['location']);
            $event['LOCATION_LINK'] = compatible_hsc($res['location_link']);
            $event['PRIVATE'] = $res['private'];
            $event['HITS'] = $res['hits'];
            $event['RELATED'] = calendar_links($res['links']);
            $event['PICTURE'] = $picture;
            $event['PICTURE_POPUP'] = $picture_popup;
            $event['PICTURE_POPUPPATH'] = $picture_popuppath;
            $event['STARTDAY'] = $startday;
            $event['STARTTIME'] = $starttime;
            $event['ENDDAY'] = $endday;
            $event['ENDTIME'] = $endtime;
            $event['USERID'] = $res['userid'];
            $event['USERNAME'] = replace($username);
            $event['EMAIL'] = replace($email);
            $event['EMAIL_ENCRYPTED'] = replace(cryptMail($email));
            $event['CATID'] = $res['catid'];
            $event['CATTITLE'] = $catinfo['title'];
            $event['CATICON'] = $catinfo['icon'];
            //Tags
            $event['TAG'] = $tagdata;
            $event['TAG_IDS'] = $tagids;
            $event['KEYWORDS'] = $keywords;
            $eventcache[$res['id']] = $event;
            $eventdata[$i] = $event;
        }
    }
    return $eventdata;
}
Ejemplo n.º 16
0
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');
}
Ejemplo n.º 17
0
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');
}