示例#1
0
function links_print($data, $template)
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $apx->lang->drop('global', 'links');
    //Verwendete Variablen auslesen
    $parse = $apx->tmpl->used_vars($template, 'links');
    //Kategorien auslesen
    if (in_array('LINK.CATTITLE', $parse) || in_array('LINK.CATTEXT', $parse) || in_array('LINK.CATICON', $parse) || in_array('LINK.CATLINK', $parse)) {
        $catids = get_ids($data, 'catid');
        if (count($catids)) {
            $catdata = $db->fetch("SELECT id,title,text,icon FROM " . PRE . "_links_cat WHERE id IN (" . implode(',', $catids) . ")");
            if (count($catdata)) {
                foreach ($catdata as $catres) {
                    $catinfo[$catres['id']] = $catres;
                }
            }
        }
    }
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Dateillink
            $link = mklink('links.php?id=' . $res['id'], 'links,id' . $res['id'] . urlformat($res['title']) . '.html');
            //Neu?
            if ($res['starttime'] + $set['links']['new'] * 24 * 3600 >= time()) {
                $new = 1;
            } else {
                $new = 0;
            }
            //Goto-Link
            $gotolink = 'misc.php?action=gotolink&id=' . $res['id'] . iif($apx->section_id(), '&sec=' . $apx->section_id());
            //Linkpic
            if (in_array('LINK.PICTURE', $parse) || in_array('LINK.PICTURE_POPUP', $parse) || in_array('LINK.PICTURE_POPUPPATH', $parse)) {
                list($picture, $picture_popup, $picture_popuppath) = links_linkpic($res['linkpic']);
            }
            //Username + eMail
            if ($res['userid']) {
                $author = $res['username'];
                $author_email = iif(!$res['pub_hidemail'], $res['email']);
            } else {
                $author = $res['send_username'];
                $author_email = $res['send_email'];
            }
            //Text
            $text = '';
            if (in_array('LINK.TEXT', $parse)) {
                $text = mediamanager_inline($res['text']);
                if ($apx->is_module('glossar')) {
                    $text = glossar_highlight($text);
                }
            }
            //Datehead
            if ($laststamp != date('Y/m/d', $res['starttime'] - TIMEDIFF)) {
                $tabledata[$i]['DATEHEAD'] = $res['starttime'];
            }
            //Tags
            if (in_array('LINK.TAG', $parse) || in_array('LINK.TAG_IDS', $parse) || in_array('LINK.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = links_tags($res['id']);
            }
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['TITLE'] = $res['title'];
            $tabledata[$i]['URL'] = $res['url'];
            $tabledata[$i]['TEXT'] = $text;
            $tabledata[$i]['LINK'] = $link;
            $tabledata[$i]['PICTURE'] = $picture;
            $tabledata[$i]['PICTURE_POPUP'] = $picture_popup;
            $tabledata[$i]['PICTURE_POPUPPATH'] = $picture_popuppath;
            $tabledata[$i]['HITS'] = number_format($res['hits'], 0, '', '.');
            $tabledata[$i]['TIME'] = $res['starttime'];
            $tabledata[$i]['TOP'] = $res['top'];
            $tabledata[$i]['RESTRICTED'] = $res['restricted'];
            $tabledata[$i]['NEW'] = $new;
            $tabledata[$i]['GOTO'] = $gotolink;
            //Tags
            $tabledata[$i]['TAG'] = $tagdata;
            $tabledata[$i]['TAG_IDS'] = $tagids;
            $tabledata[$i]['KEYWORDS'] = $keywords;
            //Autor
            $tabledata[$i]['USERID'] = $res['userid'];
            $tabledata[$i]['USERNAME'] = replace($author);
            $tabledata[$i]['EMAIL'] = replace($author_email);
            $tabledata[$i]['EMAIL_ENCRYPTED'] = replace(cryptMail($author_email));
            //Kategorien
            $tabledata[$i]['CATID'] = $res['catid'];
            $tabledata[$i]['CATTITLE'] = $catinfo[$res['catid']]['title'];
            $tabledata[$i]['CATTEXT'] = $catinfo[$res['catid']]['text'];
            $tabledata[$i]['CATICON'] = $catinfo[$res['catid']]['icon'];
            $tabledata[$i]['CATLINK'] = mklink('links.php?catid=' . $res['catid'], 'links,' . $res['catid'] . ',1' . urlformat($catinfo[$res['catid']]['title']) . '.html');
            //Galerie
            if ($apx->is_module('gallery') && $res['galid']) {
                $galinfo = gallery_info($res['galid']);
                $tabledata[$i]['GALLERY_ID'] = $galinfo['id'];
                $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['links']['coms'] && $res['allowcoms']) {
                require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
                if (!isset($coms)) {
                    $coms = new comments('links', $res['id']);
                } else {
                    $coms->mid = $res['id'];
                }
                $link = mklink('links.php?id=' . $res['id'], 'links,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('LINK.COMMENT_LAST_USERID', 'LINK.COMMENT_LAST_NAME', 'LINK.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['links']['ratings'] && $res['allowrating']) {
                require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php';
                if (!isset($rate)) {
                    $rate = new ratings('links', $res['id']);
                } else {
                    $rate->mid = $res['id'];
                }
                $tabledata[$i]['RATING'] = $rate->display();
                $tabledata[$i]['RATING_VOTES'] = $rate->count();
                $tabledata[$i]['DISPLAY_RATING'] = 1;
            }
            $laststamp = date('Y/m/d', $res['starttime'] - TIMEDIFF);
        }
    }
    $tmpl->assign('LINK', $tabledata);
    $tmpl->parse($template, 'links');
}
示例#2
0
if (count($data)) {
    foreach ($data as $res) {
        ++$i;
        //Dateillink
        $link = mklink('links.php?id=' . $res['id'], 'links,id' . $res['id'] . urlformat($res['title']) . '.html');
        //Neu?
        if ($res['addtime'] + $set['links']['new'] * 24 * 3600 >= time()) {
            $new = 1;
        } else {
            $new = 0;
        }
        //Goto-Link
        $gotolink = 'misc.php?action=gotolink&id=' . $res['id'] . iif($apx->section_id(), '&sec=' . $apx->section_id());
        //Linkpic
        if (in_array('LINK.PICTURE', $parse) || in_array('LINK.PICTURE_POPUP', $parse) || in_array('LINK.PICTURE_POPUPPATH', $parse)) {
            list($picture, $picture_popup, $picture_popuppath) = links_linkpic($res['linkpic']);
        }
        //Username + eMail
        if ($res['userid']) {
            $author = $res['username'];
            $author_email = iif(!$res['pub_hidemail'], $res['email']);
        } else {
            $author = $res['send_username'];
            $author_email = $res['send_email'];
        }
        //Text
        $text = '';
        if (in_array('LINK.TEXT', $parse)) {
            $text = mediamanager_inline($res['text']);
            if ($apx->is_module('glossar')) {
                $text = glossar_highlight($text);