示例#1
0
function gallery_similar($tagids = array(), $count = 5, $start = 0, $template = 'similar')
{
    global $set, $db, $apx, $user;
    $count = (int) $count;
    $start = (int) $start;
    if (!is_array($tagids)) {
        $tagids = getTagIds(strval($tagids));
    }
    $ids = gallery_search_tags($tagids);
    $ids[] = -1;
    $tagfilter = " AND id IN (" . implode(', ', $ids) . ") ";
    $data = $db->fetch("SELECT * FROM " . PRE . "_gallery WHERE ( ( '" . time() . "' BETWEEN starttime AND endtime ) " . $tagfilter . " " . section_filter() . " ) ORDER BY starttime DESC LIMIT " . iif($start, $start . ',') . $count);
    gallery_print($data, 'functions/' . $template);
}
示例#2
0
function products_similar($tagids = array(), $count = 5, $start = 0, $type = '', $template = 'similar')
{
    global $set, $db, $apx, $user;
    $count = (int) $count;
    $start = (int) $start;
    if (!is_array($tagids)) {
        $tagids = getTagIds(strval($tagids));
    }
    $ids = products_search_tags($tagids);
    $ids[] = -1;
    $tagfilter = " AND id IN (" . implode(', ', $ids) . ") ";
    $alltypes = array('normal', 'game', 'software', 'hardware', 'music', 'movie', 'book');
    if (!in_array($type, $alltypes)) {
        $type = '';
    }
    //Releases auslesen
    $data = $db->fetch("SELECT * FROM " . PRE . "_products WHERE active='1' " . iif($type, " AND type='" . $type . "'") . " " . $tagfilter . " ORDER BY addtime DESC LIMIT " . $start . "," . $count);
    products_print($data, 'functions/' . $template);
}
示例#3
0
function calendar_events_similar($tagids = array(), $count = 5, $start = 0, $catid = false, $mode = false, $template = 'similar')
{
    global $set, $db, $apx, $user;
    $count = (int) $count;
    $start = (int) $start;
    $catid = (int) $catid;
    if (in_array($type, array('public', 'private'))) {
        $type = '';
    }
    if (!is_array($tagids)) {
        $tagids = getTagIds(strval($tagids));
    }
    $ids = calendar_search_tags($tagids);
    $ids[] = -1;
    $tagfilter = " AND a.id IN (" . implode(', ', $ids) . ") ";
    //Filter
    $catfilter = '';
    $modefilter = '';
    if ($catid) {
        $cattree = calendar_tree($catid);
        if (count($cattree)) {
            $catfilter = " AND a.catid IN (" . implode(',', $cattree) . ") ";
        }
    }
    if ($mode === 'private') {
        $modefilter = " AND a.private='1' AND a.userid='" . $user->info['userid'] . "' ";
    } elseif ($mode === 'public') {
        $modefilter = " AND a.private='0' ";
    } else {
        $modefilter = " AND ( a.private='0' OR ( a.private='1' AND a.userid='" . $user->info['userid'] . "' ) ) ";
    }
    $todaystamp = date('Ymd', time() - TIMEDIFF);
    $data = $db->fetch("SELECT a.*,b.username,b.email,b.pub_hidemail FROM " . PRE . "_calendar_events AS a LEFT JOIN " . PRE . "_user AS b USING(userid) WHERE a.active!=0 AND endday>='" . $todaystamp . "' " . $tagfilter . " " . section_filter(true, 'a.secid') . " " . $catfilter . $modefilter . " ORDER BY startday ASC,starttime ASC, title ASC LIMIT " . $start . ',' . $count);
    calendar_print($data, 'functions/' . $template);
}
示例#4
0
function downloads_similar($tagids = array(), $count = 5, $start = 0, $catid = false, $template = 'similar')
{
    global $set, $db, $apx, $user;
    $count = (int) $count;
    $start = (int) $start;
    $catid = (int) $catid;
    if (!is_array($tagids)) {
        $tagids = getTagIds(strval($tagids));
    }
    $ids = downloads_search_tags($tagids);
    $ids[] = -1;
    $tagfilter = " AND id IN (" . implode(', ', $ids) . ") ";
    $cattree = downloads_tree($catid);
    $data = $db->fetch("SELECT * FROM " . PRE . "_downloads WHERE ( ( '" . time() . "' BETWEEN starttime AND endtime ) " . iif(count($cattree), " AND catid IN (" . @implode(',', $cattree) . ") ") . " " . $tagfilter . " " . section_filter() . " ) ORDER BY addtime DESC LIMIT " . iif($start, $start . ',') . $count);
    downloads_print($data, 'functions/' . $template);
}
示例#5
0
function news_similar($tagids = array(), $count = 5, $start = 0, $catid = false, $template = 'similar')
{
    global $set, $db, $apx, $user;
    $count = (int) $count;
    $start = (int) $start;
    $catid = (int) $catid;
    if (!is_array($tagids)) {
        $tagids = getTagIds(strval($tagids));
    }
    $ids = news_search_tags($tagids);
    $ids[] = -1;
    $tagfilter = " AND a.id IN (" . implode(', ', $ids) . ") ";
    $cattree = news_tree($catid);
    $data = $db->fetch("SELECT a.*,b.userid,b.username,b.email,b.pub_hidemail FROM " . PRE . "_news AS a LEFT JOIN " . PRE . "_user AS b USING(userid) WHERE ( " . time() . " BETWEEN starttime AND endtime " . iif(count($cattree), ' AND catid IN (' . @implode(',', $cattree) . ') ') . " " . $tagfilter . " " . section_filter() . " ) ORDER BY starttime DESC LIMIT " . iif($start, $start . ',') . $count);
    news_print($data, 'functions/' . $template);
}
示例#6
0
function glossar_similar($tagids = array(), $count = 5, $start = 0, $catid = false, $letter = false, $template = 'similar')
{
    global $set, $db, $apx, $user;
    $count = (int) $count;
    $start = (int) $start;
    if (!is_array($tagids)) {
        $tagids = getTagIds(strval($tagids));
    }
    $ids = glossar_search_tags($tagids);
    $ids[] = -1;
    $tagfilter = " AND id IN (" . implode(', ', $ids) . ") ";
    //Buchstaben-Filter
    if ($letter) {
        $letter = glossar_letter($letter);
        if ($letter == '#') {
            $letterfilter = " AND title NOT REGEXP(\"^[a-zA-Z]\")";
        } elseif ($letter == 'A') {
            $letterfilter = "( title LIKE 'A%' OR title LIKE 'Ä%' )";
        } elseif ($letter == 'O') {
            $letterfilter = "( title LIKE 'O%' OR title LIKE 'Ö%' )";
        } elseif ($letter == 'U') {
            $letterfilter = "( title LIKE 'U%' OR title LIKE 'Ü%' )";
        } else {
            $letterfilter = "title LIKE '" . $letter . "'%";
        }
    }
    $data = $db->fetch("SELECT * FROM " . PRE . "_glossar WHERE ( starttime!='0' " . iif($catid, " AND catid='" . $catid . "'") . " " . iif($letterfilter, " AND " . $letterfilter) . " " . $tagfilter . " ) ORDER BY starttime DESC LIMIT " . iif($start, $start . ',') . $count);
    glossar_print($data, 'functions/' . $template);
}
示例#7
0
function poll_similar($tagids = array(), $count = 5, $start = 0, $template = 'similar')
{
    global $set, $db, $apx, $user;
    $count = (int) $count;
    $start = (int) $start;
    $tmpl = new tengine();
    //Verwendete Variablen auslesen
    $parse = $apx->tmpl->used_vars('functions/' . $template, 'poll');
    if (!is_array($tagids)) {
        $tagids = getTagIds(strval($tagids));
    }
    $ids = poll_search_tags($tagids);
    $ids[] = -1;
    $tagfilter = " AND id IN (" . implode(', ', $ids) . ") ";
    $data = $db->fetch("SELECT id,question,addtime,starttime,days,allowcoms FROM " . PRE . "_poll WHERE ( '" . time() . "' BETWEEN starttime AND endtime " . $tagfilter . " " . section_filter() . " ) ORDER BY starttime DESC LIMIT " . $count);
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Tags
            if (in_array('POLL.TAG', $parse) || in_array('POLL.TAG_IDS', $parse) || in_array('POLL.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = poll_tags($res['id']);
            }
            $tabledata[$i]['QUESTION'] = $res['question'];
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['STARTTIME'] = $res['starttime'];
            $tabledata[$i]['ENDTIME'] = $res['starttime'] + $res['days'] * 24 * 3600;
            //Tags
            $tabledata[$i]['TAG'] = $tagdata;
            $tabledata[$i]['TAG_IDS'] = $tagids;
            $tabledata[$i]['KEYWORDS'] = $keywords;
            $tabledata[$i]['LINK'] = mklink('poll.php?id=' . $res['id'], 'poll,' . $res['id'] . urlformat($res['question']) . '.html');
            //Kommentare
            if ($apx->is_module('comments') && $set['poll']['coms'] && $res['allowcoms']) {
                require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
                if (!isset($coms)) {
                    $coms = new comments('poll', $res['id']);
                } else {
                    $coms->mid = $res['id'];
                }
                $link = mklink('poll.php?id=' . $res['id'], 'poll,' . $res['id'] . urlformat($res['question']) . '.html');
                $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
                $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
                $tabledata[$i]['DISPLAY_COMMENTS'] = 1;
                if (in_template(array('POLL.COMMENT_LAST_USERID', 'POLL.COMMENT_LAST_NAME', 'POLL.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('POLL', $tabledata);
    $tmpl->parse('functions/' . $template, 'poll');
}