예제 #1
0
function calendar_print($data, $template)
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $parse = $tmpl->used_vars($template, 'calendar');
    //Kategorie-Info
    $catids = get_ids($data, 'catid');
    $catdata = array();
    if (count($catids)) {
        $catdata = $db->fetch_index("SELECT * FROM " . PRE . "_calendar_cat WHERE id IN (" . implode(',', $catids) . ")", 'id');
    }
    //Termine auflisten
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            $event = array();
            //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 = '';
            if (in_template(array('EVENT.PICTURE', 'EVENT.PICTURE_POPUP', '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('EVENT.STARTDAY', '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('EVENT.ENDDAY', '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('EVENT.TEXT', $parse)) {
                $eventtext = mediamanager_inline($res['text']);
                if ($apx->is_module('glossar')) {
                    $eventtext = glossar_highlight($eventtext);
                }
            }
            //Datehead
            if ($laststamp != $res['startday']) {
                $event['DATEHEAD'] = $startday;
            }
            //Tags
            if (in_array('EVENT.TAG', $parse) || in_array('EVENT.TAG_IDS', $parse) || in_array('EVENT.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = calendar_tags($res['id']);
            }
            $event['ID'] = $res['id'];
            $event['TITLE'] = $res['title'];
            $event['TEXT'] = $eventtext;
            $event['LINK'] = $link;
            $event['LOCATION'] = compatible_hsc($res['location']);
            $event['LOCATION_LINK'] = compatible_hsc($res['location_link']);
            $event['PRIORITY'] = $res['priority'];
            $event['RESTRICTED'] = $res['restricted'];
            $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;
            //Galerie
            if ($apx->is_module('gallery') && $res['galid'] && !$res['private'] && in_template(array('EVENT.GALLERY_ID', 'EVENT.GALLERY_TITLE', 'EVENT.GALLERY_LINK'), $parse)) {
                $galinfo = gallery_info($res['galid']);
                $event['GALLERY_ID'] = $galinfo['id'];
                $event['GALLERY_TITLE'] = $galinfo['title'];
                $event['GALLERY_LINK'] = mklink('gallery.php?id=' . $galinfo['id'], 'gallery,list' . $galinfo['id'] . ',1' . urlformat($galinfo['title']) . '.html');
            }
            //Kommentare
            if ($apx->is_module('comments') && $set['calendar']['coms'] && $res['allowcoms']) {
                require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
                if (!isset($coms)) {
                    $coms = new comments('calendar', $res['id']);
                } else {
                    $coms->mid = $res['id'];
                }
                $link = mklink('events.php?id=' . $res['id'], 'events,id' . $res['id'] . urlformat($res['title']) . '.html');
                $event['COMMENT_COUNT'] = $coms->count();
                $event['COMMENT_LINK'] = $coms->link($link);
                $event['DISPLAY_COMMENTS'] = 1;
                if (in_template(array('EVENT.COMMENT_LAST_USERID', 'EVENT.COMMENT_LAST_NAME', 'EVENT.COMMENT_LAST_TIME'), $parse)) {
                    $event['COMMENT_LAST_USERID'] = $coms->last_userid();
                    $event['COMMENT_LAST_NAME'] = $coms->last_name();
                    $event['COMMENT_LAST_TIME'] = $coms->last_time();
                }
            }
            $eventdata[$i] = $event;
            $laststamp = $res['startday'];
        }
    }
    $tmpl->assign('EVENT', $eventdata);
    $tmpl->parse($template, 'calendar');
}
예제 #2
0
 $tabledata[$i]['TOP'] = $res['top'];
 $tabledata[$i]['RESTRICTED'] = $res['restricted'];
 //Tags
 $tabledata[$i]['TAG'] = $tagdata;
 $tabledata[$i]['TAG_IDS'] = $tagids;
 $tabledata[$i]['KEYWORDS'] = $keywords;
 //Kategorie
 $tabledata[$i]['CATID'] = $res['catid'];
 $tabledata[$i]['CATTITLE'] = $catinfo[$res['catid']]['title'];
 $tabledata[$i]['CATICON'] = $catinfo[$res['catid']]['icon'];
 $tabledata[$i]['CATLINK'] = $catinfo[$res['catid']]['link'];
 //Produkt
 $tabledata[$i]['PRODUCT_ID'] = $res['prodid'];
 //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['news']['coms'] && $res['allowcoms']) {
     require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
     if (!isset($coms)) {
         $coms = new comments('news', $res['id']);
     } else {
         $coms->mid = $res['id'];
     }
     $link = mklink('news.php?id=' . $res['id'], 'news,id' . $res['id'] . urlformat($res['title']) . '.html');
     $tabledata[$i]['COMMENT_COUNT'] = $coms->count();
     $tabledata[$i]['COMMENT_LINK'] = $coms->link($link);
예제 #3
0
function downloads_print($data, $template)
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $apx->lang->drop('global', 'downloads');
    //Verwendete Variablen auslesen
    $parse = $apx->tmpl->used_vars($template, 'downloads');
    //Kategorien auslesen
    if (in_array('DOWNLOAD.CATTITLE', $parse) || in_array('DOWNLOAD.CATTEXT', $parse) || in_array('DOWNLOAD.CATICON', $parse) || in_array('DOWNLOAD.CATLINK', $parse)) {
        $catids = get_ids($data, 'catid');
        if (count($catids)) {
            $catdata = $db->fetch("SELECT id,title,text,icon FROM " . PRE . "_downloads_cat WHERE id IN (" . implode(',', $catids) . ")");
            if (count($catdata)) {
                foreach ($catdata as $catres) {
                    $catinfo[$catres['id']] = $catres;
                }
            }
        }
    }
    //User auslesen
    $userinfo = array();
    if (in_template(array('DOWNLOAD.UPLOADER', 'DOWNLOAD.UPLOADER_EMAIL', 'DOWNLOAD.UPLOADER_EMAIL_ENCRYPTED'), $parse)) {
        $userids = get_ids($data, 'userid');
        if ($userids) {
            $userinfo = $db->fetch_index("\n\t\t\t\tSELECT userid, username, email, pub_hidemail\n\t\t\t\tFROM " . PRE . "_user\n\t\t\t\tWHERE userid IN (" . implode(',', $userids) . ")\n\t\t\t", 'userid');
        }
    }
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Link
            $link = mklink('downloads.php?id=' . $res['id'], 'downloads,id' . $res['id'] . urlformat($res['title']) . '.html');
            //Teaserbild
            if (in_array('DOWNLOAD.TEASERPIC', $parse) || in_array('DOWNLOAD.TEASERPIC_POPUP', $parse) || in_array('DOWNLOAD.TEASERPIC_POPUPPATH', $parse)) {
                list($picture, $picture_popup, $picture_popuppath) = downloads_teaserpic($res['teaserpic']);
            }
            //Dateigröße auslesen
            if (in_array('DOWNLOAD.SIZE', $parse)) {
                $thefsize = downloads_filesize($res);
            }
            //Download-Link
            if (!$set['downloads']['regonly'] && !$res['regonly'] || $user->info['userid']) {
                $sechash = md5($_SERVER['HTTP_HOST'] . $res['file'] . date('Y/m/d', time() - TIMEDIFF));
                $dllink = 'misc.php?action=downloadfile&id=' . $res['id'] . '&sechash=' . $sechash . iif($apx->section_id(), '&sec=' . $apx->section_id());
            } else {
                $dllink = mklink('user.php', 'user.html');
            }
            //Bilder
            if (in_array('DOWNLOAD.PICTURE', $parse)) {
                $picdata = downloads_pictures($res['pictures']);
            }
            //Neu?
            if ($res['addtime'] + $set['downloads']['new'] * 24 * 3600 >= time()) {
                $new = 1;
            } else {
                $new = 0;
            }
            //Username + eMail
            if ($res['userid']) {
                $userdata = $userinfo[$res['userid']];
                $uploader = $userdata['username'];
                $uploader_email = iif(!$userdata['pub_hidemail'], $userdata['email']);
            } else {
                $uploader = $res['send_username'];
                $uploader_email = $res['send_email'];
            }
            //Datehead
            if ($laststamp != date('Y/m/d', $res['starttime'] - TIMEDIFF)) {
                $tabledata[$i]['DATEHEAD'] = $res['starttime'];
            }
            //Text
            $text = '';
            if (in_array('DOWNLOAD.TEXT', $parse)) {
                $text = mediamanager_inline($res['text']);
                if ($apx->is_module('glossar')) {
                    $text = glossar_highlight($text);
                }
            }
            //Tags
            if (in_array('DOWNLOAD.TAG', $parse) || in_array('DOWNLOAD.TAG_IDS', $parse) || in_array('DOWNLOAD.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = downloads_tags($res['id']);
            }
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['SECID'] = $res['secid'];
            $tabledata[$i]['TITLE'] = $res['title'];
            $tabledata[$i]['TEXT'] = $text;
            $tabledata[$i]['LINK'] = $link;
            $tabledata[$i]['TEASERPIC'] = $picture;
            $tabledata[$i]['TEASERPIC_POPUP'] = $picture_popup;
            $tabledata[$i]['TEASERPIC_POPUPPATH'] = $picture_popuppath;
            $tabledata[$i]['SIZE'] = downloads_getsize($thefsize);
            $tabledata[$i]['FORMAT'] = downloads_getformat($res);
            $tabledata[$i]['HITS'] = number_format($res['hits'], 0, '', '.');
            $tabledata[$i]['TIME'] = $res['starttime'];
            $tabledata[$i]['PICTURE'] = $picdata;
            $tabledata[$i]['TOP'] = $res['top'];
            $tabledata[$i]['RESTRICTED'] = $res['restricted'];
            $tabledata[$i]['NEW'] = $new;
            $tabledata[$i]['DOWNLOADLINK'] = $dllink;
            //Tags
            $tabledata[$i]['TAG'] = $tagdata;
            $tabledata[$i]['TAG_IDS'] = $tagids;
            $tabledata[$i]['KEYWORDS'] = $keywords;
            //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('downloads.php?catid=' . $res['catid'], 'downloads,' . $res['catid'] . ',1' . urlformat($catinfo[$res['catid']]['title']) . '.html');
            //Produkt
            $tabledata[$i]['PRODUCT_ID'] = $res['prodid'];
            //Uploader
            $tabledata[$i]['UPLOADER_ID'] = $res['userid'];
            $tabledata[$i]['UPLOADER'] = replace($uploader);
            $tabledata[$i]['UPLOADER_EMAIL'] = replace($uploader_email);
            $tabledata[$i]['UPLOADER_EMAIL_ENCRYPTED'] = replace(cryptMail($uploader_email));
            //Autor
            $tabledata[$i]['AUTHOR'] = replace($res['author']);
            $tabledata[$i]['AUTHOR_LINK'] = replace($res['author_link']);
            //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['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']) . ',1.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();
                $tabledata[$i]['DISPLAY_RATING'] = 1;
            }
            $laststamp = date('Y/m/d', $res['starttime'] - TIMEDIFF);
        }
    }
    $tmpl->assign('DOWNLOAD', $tabledata);
    $tmpl->parse($template, 'downloads');
}
예제 #4
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');
}
예제 #5
0
function news_print($data, $template)
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $apx->lang->drop('func', 'news');
    //Verwendete Variablen auslesen
    $parse = $apx->tmpl->used_vars($template, 'news');
    //Kategorien auslesen
    if (in_array('NEWS.CATID', $parse) || in_array('NEWS.CATTITLE', $parse) || in_array('NEWS.CATICON', $parse) || in_array('NEWS.CATLINK', $parse)) {
        $catinfo = news_catinfo(get_ids($data, 'catid'));
    }
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Link
            $link = mklink('news.php?id=' . $res['id'], 'news,id' . $res['id'] . urlformat($res['title']) . '.html');
            //Newspic
            if (in_array('NEWS.PICTURE', $parse) || in_array('NEWS.PICTURE_POPUP', $parse) || in_array('NEWS.PICTURE_POPUPPATH', $parse)) {
                list($picture, $picture_popup, $picture_popuppath) = news_newspic($res['newspic']);
            }
            //Username + eMail
            if ($res['userid']) {
                $username = $res['username'];
                $email = iif(!$res['pub_hidemail'], $res['email']);
            } else {
                $username = $res['send_username'];
                $email = $res['send_email'];
            }
            //Datehead
            if ($laststamp != date('Y/m/d', $res['starttime'] - TIMEDIFF)) {
                $tabledata[$i]['DATEHEAD'] = $res['starttime'];
            }
            //Links
            if (in_array('NEWS.RELATED', $parse)) {
                $tabledata[$i]['RELATED'] = news_links($res['links']);
            }
            //Text
            $text = '';
            if (in_array('NEWS.TEXT', $parse)) {
                $text = mediamanager_inline($res['text']);
                if ($apx->is_module('glossar')) {
                    $text = glossar_highlight($text);
                }
            }
            //Teaser
            $teaser = '';
            if (in_array('NEWS.TEASER', $parse) && $set['news']['teaser']) {
                $teaser = mediamanager_inline($res['teaser']);
                if ($apx->is_module('glossar')) {
                    $teaser = glossar_highlight($teaser);
                }
            }
            //Tags
            if (in_array('NEWS.TAG', $parse) || in_array('NEWS.TAG_IDS', $parse) || in_array('NEWS.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = news_tags($res['id']);
            }
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['SECID'] = $res['secid'];
            $tabledata[$i]['TITLE'] = $res['title'];
            $tabledata[$i]['SUBTITLE'] = $res['subtitle'];
            $tabledata[$i]['LINK'] = $link;
            $tabledata[$i]['TEASER'] = $teaser;
            $tabledata[$i]['TEXT'] = $text;
            $tabledata[$i]['TIME'] = $res['starttime'];
            $tabledata[$i]['PICTURE'] = $picture;
            $tabledata[$i]['PICTURE_POPUP'] = $picture_popup;
            $tabledata[$i]['PICTURE_POPUPPATH'] = $picture_popuppath;
            $tabledata[$i]['USERID'] = $res['userid'];
            $tabledata[$i]['USERNAME'] = replace($username);
            $tabledata[$i]['EMAIL'] = replace($email);
            $tabledata[$i]['EMAIL_ENCRYPTED'] = replace(cryptMail($email));
            $tabledata[$i]['HITS'] = number_format($res['hits'], 0, '', '.');
            $tabledata[$i]['TOP'] = $res['top'];
            $tabledata[$i]['RESTRICTED'] = $res['restricted'];
            //Tags
            $tabledata[$i]['TAG'] = $tagdata;
            $tabledata[$i]['TAG_IDS'] = $tagids;
            $tabledata[$i]['KEYWORDS'] = $keywords;
            //Kategorie
            $tabledata[$i]['CATID'] = $res['catid'];
            $tabledata[$i]['CATTITLE'] = $catinfo[$res['catid']]['title'];
            $tabledata[$i]['CATICON'] = $catinfo[$res['catid']]['icon'];
            $tabledata[$i]['CATLINK'] = $catinfo[$res['catid']]['link'];
            //Produkt
            $tabledata[$i]['PRODUCT_ID'] = $res['prodid'];
            //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['news']['coms'] && $res['allowcoms']) {
                require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
                if (!isset($coms)) {
                    $coms = new comments('news', $res['id']);
                } else {
                    $coms->mid = $res['id'];
                }
                $link = mklink('news.php?id=' . $res['id'], 'news,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('NEWS.COMMENT_LAST_USERID', 'NEWS.COMMENT_LAST_NAME', 'NEWS.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['news']['ratings'] && $res['allowrating']) {
                require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php';
                if (!isset($rate)) {
                    $rate = new ratings('news', $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('NEWS', $tabledata);
    $tmpl->parse($template, 'news');
}
예제 #6
0
function articles_print($data, $template, $bestreviews = false)
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $apx->lang->drop('global', 'articles');
    //Verwendete Variablen auslesen
    $parse = $apx->tmpl->used_vars($template, 'articles');
    //Datensatz erweitern durch Preview/Review-Daten, nur wenn keine Reviewbestenliste
    if (!$bestreviews) {
        $data = articles_extend_data($data, $parse);
    }
    //Kategorien auslesen
    if (in_array('ARTICLE.CATID', $parse) || in_array('ARTICLE.CATTITLE', $parse) || in_array('ARTICLE.CATICON', $parse) || in_array('ARTICLE.CATLINK', $parse)) {
        $catinfo = articles_catinfo(get_ids($data, 'catid'));
    }
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Wohin soll verlinkt werden?
            if ($res['type'] == 'normal') {
                $link2file = 'articles';
            } else {
                $link2file = $res['type'] . 's';
            }
            //Link
            $link = mklink($link2file . '.php?id=' . $res['id'], $link2file . ',id' . $res['id'] . ',0' . urlformat($res['title']) . '.html');
            //Artikelpic
            if (in_array('ARTICLE.PICTURE', $parse) || in_array('ARTICLE.PICTURE_POPUP', $parse) || in_array('ARTICLE.PICTURE_POPUPPATH', $parse)) {
                list($picture, $picture_popup, $picture_popuppath) = articles_artpic($res['artpic']);
            }
            //Artikeltext
            if (in_array('ARTICLE.TEXT', $parse)) {
                list($page1text) = $db->first("SELECT text FROM " . PRE . "_articles_pages WHERE artid='" . $res['id'] . "' ORDER BY ord ASC LIMIT 1");
                $page1text = mediamanager_inline($page1text);
                if ($apx->is_module('glossar')) {
                    $page1text = glossar_highlight($page1text);
                }
            }
            //Datehead
            if ($laststamp != date('Y/m/d', $res['starttime'] - TIMEDIFF)) {
                $tabledata[$i]['DATEHEAD'] = $res['starttime'];
            }
            //Links
            if (in_array('ARTICLE.RELATED', $parse)) {
                $tabledata[$i]['RELATED'] = articles_links($res['links']);
            }
            //Bilderserie
            if (in_array('ARTICLE.PICSERIES', $parse)) {
                $tabledata[$i]['PICSERIES'] = articles_picseries($res['pictures'], $res['id'], $link2file);
            }
            //Teaser
            $teaser = '';
            if (in_array('ARTICLE.TEASER', $parse)) {
                $teaser = mediamanager_inline($res['teaser']);
                if ($apx->is_module('glossar')) {
                    $teaser = glossar_highlight($teaser);
                }
            }
            //Tags
            if (in_array('ARTICLE.TAG', $parse) || in_array('ARTICLE.TAG_IDS', $parse) || in_array('ARTICLE.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = articles_tags($res['id']);
            }
            //Index
            $pageIndex = array();
            if (in_array('ARTICLE.INDEX', $parse)) {
                $pageIndex = articles_index($res['id'], $res['title'], $link2file);
            }
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['SECID'] = $res['secid'];
            $tabledata[$i]['TYPE'] = $res['type'];
            $tabledata[$i]['TITLE'] = $res['title'];
            $tabledata[$i]['SUBTITLE'] = $res['subtitle'];
            $tabledata[$i]['TEASER'] = $teaser;
            $tabledata[$i]['TEXT'] = $page1text;
            $tabledata[$i]['LINK'] = $link;
            $tabledata[$i]['TIME'] = $res['starttime'];
            $tabledata[$i]['INDEX'] = $pageIndex;
            $tabledata[$i]['PICTURE'] = $picture;
            $tabledata[$i]['PICTURE_POPUP'] = $picture_popup;
            $tabledata[$i]['PICTURE_POPUPPATH'] = $picture_popuppath;
            $tabledata[$i]['USERID'] = $res['userid'];
            $tabledata[$i]['USERNAME'] = replace($res['username']);
            $tabledata[$i]['EMAIL'] = replace(iif(!$res['pub_hidemail'], $res['email']));
            $tabledata[$i]['EMAIL_ENCRYPTED'] = replace(iif(!$res['pub_hidemail'], cryptMail($res['email'])));
            $tabledata[$i]['HITS'] = number_format($res['hits'], 0, '', '.');
            $tabledata[$i]['TOP'] = $res['top'];
            $tabledata[$i]['RESTRICTED'] = $res['restricted'];
            //Tags
            $tabledata[$i]['TAG'] = $tagdata;
            $tabledata[$i]['TAG_IDS'] = $tagids;
            $tabledata[$i]['KEYWORDS'] = $keywords;
            //Kategorie
            $tabledata[$i]['CATID'] = $res['catid'];
            $tabledata[$i]['CATTITLE'] = $catinfo[$res['catid']]['title'];
            $tabledata[$i]['CATICON'] = $catinfo[$res['catid']]['icon'];
            $tabledata[$i]['CATLINK'] = $catinfo[$res['catid']]['link'];
            //Produkt
            $tabledata[$i]['PRODUCT_ID'] = $res['prodid'];
            //Zusätzliche Felder: PREVIEWS
            if ($res['type'] == 'preview') {
                for ($ii = 1; $ii <= 10; $ii++) {
                    if (!$set['articles']['custom_preview'][$ii - 1]) {
                        continue;
                    }
                    $tabledata[$i]['CUSTOM' . $ii . '_TITLE'] = $set['articles']['custom_preview'][$ii - 1];
                    $tabledata[$i]['CUSTOM' . $ii] = $res['custom' . $ii];
                }
                $tabledata[$i]['IMPRESSION'] = $res['impression'];
            } elseif ($res['type'] == 'review') {
                for ($ii = 1; $ii <= 10; $ii++) {
                    if (!$set['articles']['custom_review'][$ii - 1]) {
                        continue;
                    }
                    $tabledata[$i]['CUSTOM' . $ii . '_TITLE'] = $set['articles']['custom_review'][$ii - 1];
                    $tabledata[$i]['CUSTOM' . $ii] = $res['custom' . $ii];
                }
                $tabledata[$i]['FINAL_RATING'] = $res['final_rate'];
                $tabledata[$i]['POSITIVE'] = $res['positive'];
                $tabledata[$i]['NEGATIVE'] = $res['negative'];
                $tabledata[$i]['AWARD'] = $res['award'];
            }
            //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['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();
                $tabledata[$i]['DISPLAY_RATING'] = 1;
            }
            $laststamp = date('Y/m/d', $res['starttime'] - TIMEDIFF);
        }
    }
    $tmpl->assign('ARTICLE', $tabledata);
    $tmpl->parse($template, 'articles');
}