Beispiel #1
0
function products_print($data, $template)
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $apx->lang->drop('fields', 'products');
    //Verwendet Variablen auslesen
    $parse = $apx->tmpl->used_vars($template, 'products');
    $ids = get_ids($data, 'id');
    $types = get_ids($data, 'type');
    if (count($data)) {
        $unitvars = array('PRODUCT.DEVELOPER', 'PRODUCT.DEVELOPER_WEBSITE', 'PRODUCT.DEVELOPER_LINK', 'PRODUCT.PUBLISHER', 'PRODUCT.PUBLISHER_WEBSITE', 'PRODUCT.PUBLISHER_LINK', 'PRODUCT.MANUFACTURER', 'PRODUCT.MANUFACTURER_WEBSITE', 'PRODUCT.MANUFACTURER_LINK', 'PRODUCT.STUDIO', 'PRODUCT.STUDIO_WEBSITE', 'PRODUCT.STUDIO_LINK', 'PRODUCT.LABEL', 'PRODUCT.LABEL_WEBSITE', 'PRODUCT.LABEL_LINK', 'PRODUCT.ARTIST', 'PRODUCT.ARTIST_WEBSITE', 'PRODUCT.ARTIST_LINK', 'PRODUCT.AUTHOR', 'PRODUCT.AUTHOR_WEBSITE', 'PRODUCT.AUTHOR_LINK');
        //Einheiten auslesen
        $unitinfo = array();
        if (in_template($unitvars, $parse)) {
            $unitids = array_merge(get_ids($data, 'manufacturer'), get_ids($data, 'publisher'));
            $unitinfo = $db->fetch_index("SELECT id,title,website FROM " . PRE . "_products_units WHERE id IN (" . implode(',', $unitids) . ")", 'id');
        }
        //Gruppen auslesen
        $groupinfo = array();
        $groups = array();
        /*if ( in_template(array('PRODUCT.MEDIA'),$parse) ) $groups = array_merge($groups,get_ids($data,'media'));
        		if ( in_array('PRODUCT.GENRE',$parse) ) $groups = array_merge($groups,get_ids($data,'genre'));
        		if ( in_array('game',$types) && in_template(array('PRODUCT.RELEASE.SYSTEM','PRODUCT.RELEASE.SYSTEM_ICON','PRODUCT.SYSTEM'),$parse) ) {
        			if ( count($groups)==0 ) $groups = array(0);
        			$groupinfo = $db->fetch_index("SELECT id,title,icon FROM ".PRE."_products_groups WHERE id IN (".implode(',',$groups).") OR grouptype='system'",'id');
        		}
        		elseif ( in_array('movie',$types) && in_template(array('PRODUCT.RELEASE.MEDIA','PRODUCT.RELEASE.MEDIA_ICON','PRODUCT.MEDIA'),$parse) ) {
        			if ( count($groups)==0 ) $groups = array(0);
        			$groupinfo = $db->fetch_index("SELECT id,title,icon FROM ".PRE."_products_groups WHERE id IN (".implode(',',$groups).") OR grouptype='media'",'id');
        		}
        		elseif ( count($groups) ) {
        			$groupinfo = $db->fetch_index("SELECT id,title,icon FROM ".PRE."_products_groups WHERE id IN (".implode(',',$groups).")",'id');
        		}*/
        $groupinfo = $db->fetch_index("SELECT id,title,icon FROM " . PRE . "_products_groups", 'id');
        //Veröffentlichungs-Daten auslesen
        $releaseinfo = array();
        if (in_array('PRODUCT.RELEASE', $parse)) {
            $releasedata = $db->fetch("SELECT prodid,system,data,stamp FROM " . PRE . "_products_releases WHERE prodid IN (" . implode(',', $ids) . ") ORDER BY stamp ASC");
            if (count($releasedata)) {
                foreach ($releasedata as $relres) {
                    $info = unserialize($relres['data']);
                    $releasedate = products_format_release($info);
                    $relentry = array('stamp' => $relres['stamp'], 'DATE' => $releasedate, 'SYSTEM' => $groupinfo[$relres['system']]['title'], 'SYSTEM_ICON' => $groupinfo[$relres['system']]['icon'], 'MEDIA' => $groupinfo[$relres['system']]['title'], 'MEDIA_ICON' => $groupinfo[$relres['system']]['icon']);
                    $releaseinfo[$relres['prodid']][] = $relentry;
                }
            }
        }
        //Produkte auflisten
        foreach ($data as $res) {
            ++$i;
            //Link
            $link = mklink('products.php?id=' . $res['id'], 'products,id' . $res['id'] . urlformat($res['title']) . '.html');
            //Produktbild
            if (in_array('PRODUCT.PICTURE', $parse) || in_array('PRODUCT.PICTURE_POPUP', $parse) || in_array('PRODUCT.PICTURE_POPUPPATH', $parse)) {
                list($picture, $picture_popup, $picture_popuppath) = products_pic($res['picture']);
            }
            //Teaserbild
            if (in_array('PRODUCT.TEASERPIC', $parse) || in_array('PRODUCT.TEASERPIC_POPUP', $parse) || in_array('PRODUCT.TEASERPIC_POPUPPATH', $parse)) {
                list($teaserpic, $teaserpic_popup, $teaserpic_popuppath) = products_pic($res['teaserpic']);
            }
            //Text
            $text = '';
            if (in_array('PRODUCT.TEXT', $parse)) {
                $text = mediamanager_inline($res['text']);
                if ($apx->is_module('glossar')) {
                    $text = glossar_highlight($text);
                }
            }
            //Datehead
            if ($laststamp != date('Y/m/d', $res['addtime'] - TIMEDIFF)) {
                $tabledata[$i]['DATEHEAD'] = $res['addtime'];
            }
            //Tags
            if (in_array('PRODUCT.TAG', $parse) || in_array('PRODUCT.TAG_IDS', $parse) || in_array('PRODUCT.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = products_tags($res['id']);
            }
            //Standard-Platzhalter
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['TYPE'] = $res['type'];
            $tabledata[$i]['LINK'] = $link;
            $tabledata[$i]['TITLE'] = $res['title'];
            $tabledata[$i]['TEXT'] = $text;
            $tabledata[$i]['TIME'] = $res['addtime'];
            $tabledata[$i]['WEBSITE'] = $res['website'];
            $tabledata[$i]['BUYLINK'] = $res['buylink'];
            $tabledata[$i]['PRICE'] = $res['price'];
            $tabledata[$i]['HITS'] = $res['hits'];
            $tabledata[$i]['PICTURE'] = $picture;
            $tabledata[$i]['PICTURE_POPUP'] = $picture_popup;
            $tabledata[$i]['PICTURE_POPUPPATH'] = $picture_popuppath;
            $tabledata[$i]['TEASERPIC'] = $teaserpic;
            $tabledata[$i]['TEASERPIC_POPUP'] = $teaserpic_popup;
            $tabledata[$i]['TEASERPIC_POPUPPATH'] = $teaserpic_popuppath;
            $tabledata[$i]['PRODUCT_ID'] = $res['prodid'];
            $tabledata[$i]['RECOMMENDED_PRICE'] = $res['recprice'];
            $tabledata[$i]['GUARANTEE'] = $res['guarantee'];
            //Sammlung
            if ($user->info['userid']) {
                if (!products_in_coll($res['id'])) {
                    $tabledata[$i]['LINK_COLLECTION_ADD'] = mklink('products.php?id=' . $res['id'] . '&addcoll=1', 'products,id' . $res['id'] . urlformat($res['title']) . '.html?addcoll=1');
                } else {
                    $tabledata[$i]['LINK_COLLECTION_REMOVE'] = mklink('products.php?id=' . $res['id'] . '&removecoll=1', 'products,id' . $res['id'] . urlformat($res['title']) . '.html?removecoll=1');
                }
            }
            //Tags
            $tabledata[$i]['TAG'] = $tagdata;
            $tabledata[$i]['TAG_IDS'] = $tagids;
            $tabledata[$i]['KEYWORDS'] = $keywords;
            //NORMAL
            if ($res['type'] == 'normal') {
                $manulink = mklink('manufacturers.php?id=' . $res['manufacturer'], 'manufacturers,id' . $res['manufacturer'] . urlformat($unitinfo[$res['manufacturer']]['title']) . '.html');
                $tabledata[$i]['MANUFACTURER'] = $unitinfo[$res['manufacturer']]['title'];
                $tabledata[$i]['MANUFACTURER_WEBSITE'] = $unitinfo[$res['manufacturer']]['website'];
                $tabledata[$i]['MANUFACTURER_LINK'] = $manulink;
            } elseif ($res['type'] == 'game') {
                //System-Liste
                $systemdata = array();
                if (in_array('PRODUCT.SYSTEM', $parse)) {
                    $systems = dash_unserialize($res['systems']);
                    if (!is_array($systems)) {
                        $systems = array();
                    }
                    foreach ($systems as $sysid) {
                        ++$ii;
                        $systemdata[$ii]['TITLE'] = $groupinfo[$sysid]['title'];
                        $systemdata[$ii]['ICON'] = $groupinfo[$sysid]['icon'];
                    }
                }
                //Media-Liste
                $media = dash_unserialize($res['media']);
                if (!is_array($media)) {
                    $media = array();
                }
                $mediadata = array();
                foreach ($media as $medid) {
                    ++$ii;
                    $mediadata[$ii]['TITLE'] = $groupinfo[$medid]['title'];
                    $mediadata[$ii]['ICON'] = $groupinfo[$medid]['icon'];
                }
                $manulink = mklink('manufacturers.php?id=' . $res['manufacturer'], 'manufacturers,id' . $res['manufacturer'] . urlformat($unitinfo[$res['manufacturer']]['title']) . '.html');
                $publink = mklink('manufacturers.php?id=' . $res['publisher'], 'manufacturers,id' . $res['publisher'] . urlformat($unitinfo[$res['publisher']]['title']) . '.html');
                $tabledata[$i]['DEVELOPER'] = $unitinfo[$res['manufacturer']]['title'];
                $tabledata[$i]['DEVELOPER_WEBSITE'] = $unitinfo[$res['manufacturer']]['website'];
                $tabledata[$i]['DEVELOPER_LINK'] = $manulink;
                $tabledata[$i]['PUBLISHER'] = $unitinfo[$res['publisher']]['title'];
                $tabledata[$i]['PUBLISHER_WEBSITE'] = $unitinfo[$res['publisher']]['website'];
                $tabledata[$i]['PUBLISHER_LINK'] = $publink;
                $tabledata[$i]['USK'] = $res['sk'];
                $tabledata[$i]['GENRE'] = $groupinfo[$res['genre']]['title'];
                $tabledata[$i]['MEDIA'] = $mediadata;
                $tabledata[$i]['SYSTEM'] = $systemdata;
                $tabledata[$i]['REQUIREMENTS'] = $res['requirements'];
            } elseif ($res['type'] == 'hardware') {
                $manulink = mklink('manufacturers.php?id=' . $res['manufacturer'], 'manufacturers,id' . $res['manufacturer'] . urlformat($unitinfo[$res['manufacturer']]['title']) . '.html');
                $tabledata[$i]['MANUFACTURER'] = $unitinfo[$res['manufacturer']]['title'];
                $tabledata[$i]['MANUFACTURER_WEBSITE'] = $unitinfo[$res['manufacturer']]['website'];
                $tabledata[$i]['MANUFACTURER_LINK'] = $manulink;
                $tabledata[$i]['EQUIPMENT'] = $res['equipment'];
            } elseif ($res['type'] == 'software') {
                //Media-Liste
                $media = dash_unserialize($res['media']);
                if (!is_array($media)) {
                    $media = array();
                }
                $mediadata = array();
                foreach ($media as $medid) {
                    ++$ii;
                    $mediadata[$ii]['TITLE'] = $groupinfo[$medid]['title'];
                    $mediadata[$ii]['ICON'] = $groupinfo[$medid]['icon'];
                }
                $manulink = mklink('manufacturers.php?id=' . $res['manufacturer'], 'manufacturers,id' . $res['manufacturer'] . urlformat($unitinfo[$res['manufacturer']]['title']) . '.html');
                $tabledata[$i]['MANUFACTURER'] = $unitinfo[$res['manufacturer']]['title'];
                $tabledata[$i]['MANUFACTURER_WEBSITE'] = $unitinfo[$res['manufacturer']]['website'];
                $tabledata[$i]['MANUFACTURER_LINK'] = $manulink;
                $tabledata[$i]['OS'] = $res['os'];
                $tabledata[$i]['LANGUAGES'] = $res['languages'];
                $tabledata[$i]['REQUIREMENTS'] = $res['requirements'];
                $tabledata[$i]['LICENSE'] = $res['license'];
                $tabledata[$i]['VERSION'] = $res['version'];
                $tabledata[$i]['MEDIA'] = $mediadata;
            } elseif ($res['type'] == 'music') {
                //Media-Liste
                $media = dash_unserialize($res['media']);
                if (!is_array($media)) {
                    $media = array();
                }
                $mediadata = array();
                foreach ($media as $medid) {
                    ++$ii;
                    $mediadata[$ii]['TITLE'] = $groupinfo[$medid]['title'];
                    $mediadata[$ii]['ICON'] = $groupinfo[$medid]['icon'];
                }
                $manulink = mklink('manufacturers.php?id=' . $res['manufacturer'], 'manufacturers,id' . $res['manufacturer'] . urlformat($unitinfo[$res['manufacturer']]['title']) . '.html');
                $publink = mklink('manufacturers.php?id=' . $res['publisher'], 'manufacturers,id' . $res['publisher'] . urlformat($unitinfo[$res['publisher']]['title']) . '.html');
                $tabledata[$i]['ARTIST'] = $unitinfo[$res['manufacturer']]['title'];
                $tabledata[$i]['ARTIST_WEBSITE'] = $unitinfo[$res['manufacturer']]['website'];
                $tabledata[$i]['ARTIST_LINK'] = $manulink;
                $tabledata[$i]['LABEL'] = $unitinfo[$res['publisher']]['title'];
                $tabledata[$i]['LABEL_WEBSITE'] = $unitinfo[$res['publisher']]['website'];
                $tabledata[$i]['LABEL_LINK'] = $publink;
                $tabledata[$i]['FSK'] = $res['sk'];
                $tabledata[$i]['GENRE'] = $groupinfo[$res['genre']]['title'];
                $tabledata[$i]['MEDIA'] = $mediadata;
            } elseif ($res['type'] == 'movie') {
                //Media-Liste
                $media = dash_unserialize($res['media']);
                if (!is_array($media)) {
                    $media = array();
                }
                $mediadata = array();
                foreach ($media as $medid) {
                    ++$ii;
                    $mediadata[$ii]['TITLE'] = $groupinfo[$medid]['title'];
                    $mediadata[$ii]['ICON'] = $groupinfo[$medid]['icon'];
                }
                $publink = mklink('manufacturers.php?id=' . $res['publisher'], 'manufacturers,id' . $res['publisher'] . urlformat($unitinfo[$res['publisher']]['title']) . '.html');
                $tabledata[$i]['STUDIO'] = $unitinfo[$res['publisher']]['title'];
                $tabledata[$i]['STUDIO_WEBSITE'] = $unitinfo[$res['publisher']]['website'];
                $tabledata[$i]['STUDIO_LINK'] = $publink;
                $tabledata[$i]['REGISSEUR'] = $res['regisseur'];
                $tabledata[$i]['ACTORS'] = $res['actors'];
                $tabledata[$i]['LENGTH'] = $res['length'];
                $tabledata[$i]['FSK'] = $res['sk'];
                $tabledata[$i]['GENRE'] = $groupinfo[$res['genre']]['title'];
                $tabledata[$i]['MEDIA'] = $mediadata;
            } elseif ($res['type'] == 'book') {
                //Media-Liste
                $media = dash_unserialize($res['media']);
                if (!is_array($media)) {
                    $media = array();
                }
                $mediadata = array();
                foreach ($media as $medid) {
                    ++$ii;
                    $mediadata[$ii]['TITLE'] = $groupinfo[$medid]['title'];
                    $mediadata[$ii]['ICON'] = $groupinfo[$medid]['icon'];
                }
                $manulink = mklink('manufacturers.php?id=' . $res['manufacturer'], 'manufacturers,id' . $res['manufacturer'] . urlformat($unitinfo[$res['manufacturer']]['title']) . '.html');
                $publink = mklink('manufacturers.php?id=' . $res['publisher'], 'manufacturers,id' . $res['publisher'] . urlformat($unitinfo[$res['publisher']]['title']) . '.html');
                $tabledata[$i]['AUTHOR'] = $unitinfo[$res['manufacturer']]['title'];
                $tabledata[$i]['AUTHOR_WEBSITE'] = $unitinfo[$res['manufacturer']]['website'];
                $tabledata[$i]['AUTHOR_LINK'] = $manulink;
                $tabledata[$i]['PUBLISHER'] = $unitinfo[$res['publisher']]['title'];
                $tabledata[$i]['PUBLISHER_WEBSITE'] = $unitinfo[$res['publisher']]['website'];
                $tabledata[$i]['PUBLISHER_LINK'] = $publink;
                $tabledata[$i]['GENRE'] = $groupinfo[$res['genre']]['title'];
                $tabledata[$i]['MEDIA'] = $mediadata;
                $tabledata[$i]['ISBN'] = $res['isbn'];
            }
            //Benutzerdefinierte Felder
            for ($ii = 1; $ii <= 10; $ii++) {
                $tabledata[$i]['CUSTOM' . $ii . '_NAME'] = replace($set['products']['custom_' . $res['type']][$ii - 1]);
                $tabledata[$i]['CUSTOM' . $ii] = $res['custom' . $ii];
            }
            //Veröffentlichung
            if (in_array('PRODUCT.RELEASE', $parse)) {
                if ($res['releasestamp']) {
                    $temprel = $releaseinfo[$res['id']];
                    foreach ($temprel as $rel) {
                        if ($rel['stamp'] != $res['releasestamp']) {
                            continue;
                        }
                        ++$ii;
                        $tabledata[$i]['RELEASE'][$ii] = $rel;
                    }
                } else {
                    $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();
                $tabledata[$i]['DISPLAY_RATING'] = 1;
            }
            $laststamp = date('Y/m/d', $res['addtime'] - TIMEDIFF);
        }
    }
    $tmpl->assign('PRODUCT', $tabledata);
    $tmpl->parse($template, 'products');
}
Beispiel #2
0
     $new = 1;
 } else {
     $new = 0;
 }
 //Username + eMail
 if ($res['userid']) {
     $uploader = $res['username'];
     $uploader_email = iif(!$res['pub_hidemail'], $res['email']);
 } else {
     $uploader = $res['send_username'];
     $uploader_email = $res['send_email'];
 }
 //Text
 $text = '';
 if (in_array('VIDEO.TEXT', $parse)) {
     $text = mediamanager_inline($res['text']);
     if ($apx->is_module('glossar')) {
         $text = glossar_highlight($text);
     }
 }
 //Tags
 if (in_array('VIDEO.TAG', $parse) || in_array('VIDEO.TAG_IDS', $parse) || in_array('VIDEO.KEYWORDS', $parse)) {
     list($tagdata, $tagids, $keywords) = videos_tags($res['id']);
 }
 //Embeded?
 if ($res['source'] != 'apexx' && $res['source'] != 'external') {
     $embedcode = videos_embedcode($res['source'], $res['flvfile']);
     $file = '';
     $flvfile = '';
     $dllink = '';
 } elseif ($res['source'] == 'external') {
Beispiel #3
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');
}
Beispiel #4
0
    foreach ($data as $res) {
        ++$i;
        if (!$first) {
            $first = $res;
        }
        //Link
        $link = mklink('faq.php?id=' . $res['id'], 'faq,' . $res['id'] . urlformat($res['question']) . '.html');
        //Nummer
        $prefixstring = '';
        ++$prefix[$res['level']];
        for ($pi = $res['level'] + 1; isset($prefix[$pi]); $pi++) {
            unset($prefix[$pi]);
        }
        $prefixstring = implode('.', $prefix) . '.';
        //Antwort
        $answer = mediamanager_inline($res['answer']);
        if ($apx->is_module('glossar')) {
            $answer = glossar_highlight($answer);
        }
        $faqdata[$i]['ID'] = $res['id'];
        $faqdata[$i]['NUMBER'] = $prefixstring;
        $faqdata[$i]['QUESTION'] = $res['question'];
        $faqdata[$i]['ANSWER'] = $answer;
        $faqdata[$i]['LINK'] = $link;
        $faqdata[$i]['TIME'] = $res['starttime'];
        $faqdata[$i]['HITS'] = number_format($res['hits'], 0, '', '.');
        $faqdata[$i]['LEVEL'] = $res['level'] + ($_REQUEST['id'] ? 1 : 0);
    }
}
if ($_REQUEST['id']) {
    $apx->tmpl->assign('DISPLAY', 1);
Beispiel #5
0
 //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;
Beispiel #6
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&amp;id=' . $res['id'] . '&amp;sechash=' . $sechash . iif($apx->section_id(), '&amp;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');
}
Beispiel #7
0
 $apx->tmpl->assign('USERID', $res['userid']);
 $apx->tmpl->assign('USERNAME', replace($res['username']));
 $apx->tmpl->assign('EMAIL', replace(iif(!$res['pub_hidemail'], $res['email'])));
 $apx->tmpl->assign('EMAIL_ENCRYPTED', replace(iif(!$res['pub_hidemail'], cryptMail($res['email']))));
 //Autor
 $apx->tmpl->assign('AUTHOR_USERID', $res['userid']);
 $apx->tmpl->assign('AUTHOR_USERNAME', replace($res['username']));
 $apx->tmpl->assign('AUTHOR_EMAIL', replace(iif(!$res['pub_hidemail'], $res['email'])));
 $apx->tmpl->assign('AUTHOR_EMAIL_ENCRYPTED', replace(iif(!$res['pub_hidemail'], cryptMail($res['email']))));
 //Letzte Änderung
 $apx->tmpl->assign('LASTCHANGE_TIME', $res['lastchange']);
 $apx->tmpl->assign('LASTCHANGE_USERID', $res['lastchange_userid']);
 $apx->tmpl->assign('LASTCHANGE_USERNAME', replace($res['lc_username']));
 $apx->tmpl->assign('LASTCHANGE_EMAIL_ENCRYPTED', replace(iif(!$res['lc_pub_hidemail'], cryptMail($res['email']))));
 //Content
 $content = mediamanager_inline($res['text']);
 if ($apx->is_module('glossar')) {
     $content = glossar_highlight($content);
 }
 $apx->tmpl->assign('ID', $res['id']);
 $apx->tmpl->assign('HEADLINE', $headline);
 $apx->tmpl->assign('TITLE', $last);
 $apx->tmpl->assign('CONTENT', $content);
 $apx->tmpl->assign_static('META_DESCRIPTION', replace($res['meta_description']));
 $apx->tmpl->assign('HITS', number_format($res['hits'], 0, '', '.'));
 //Kategorie
 $apx->tmpl->assign('CATID', $res['catid']);
 $apx->tmpl->assign('CATTITLE', $set['content']['groups'][$res['catid']]);
 //Kommentare
 if ($apx->is_module('comments') && $set['content']['coms'] && $res['allowcoms']) {
     require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
Beispiel #8
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');
}
Beispiel #9
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&amp;id=' . $res['id'] . iif($apx->section_id(), '&amp;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');
}
Beispiel #10
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;
}
     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]['TYPE'] = $res['type'];
 $tabledata[$i]['TITLE'] = $res['title'];
 $tabledata[$i]['SUBTITLE'] = $res['subtitle'];
 if (in_array('ARTICLE.TEASER', $parse)) {
     $tabledata[$i]['TEASER'] = mediamanager_inline($res['teaser']);
 }
 if (in_array('ARTICLE.TEXT', $parse)) {
     $tabledata[$i]['TEXT'] = mediamanager_inline($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
Beispiel #12
0
function videos_print($data, $template)
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $apx->lang->drop('globalwohl', 'videos');
    //Verwendete Variablen auslesen
    $parse = $apx->tmpl->used_vars($template, 'videos');
    //Kategorien auslesen
    if (in_array('VIDEO.CATTITLE', $parse) || in_array('VIDEO.CATTEXT', $parse) || in_array('VIDEO.CATICON', $parse) || in_array('VIDEO.CATLINK', $parse)) {
        $catids = get_ids($data, 'catid');
        if (count($catids)) {
            $catdata = $db->fetch("SELECT id,title,text,icon FROM " . PRE . "_videos_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;
            //Link
            $link = mklink('videos.php?id=' . $res['id'], 'videos,id' . $res['id'] . urlformat($res['title']) . '.html');
            //Teaserbild
            if (in_array('VIDEO.PICTURE', $parse) || in_array('VIDEO.PICTURE_POPUP', $parse) || in_array('VIDEO.PICTURE_POPUPPATH', $parse)) {
                list($picture, $picture_popup, $picture_popuppath) = videos_teaserpic($res['teaserpic']);
            }
            //Dateigröße auslesen
            if (in_array('VIDEO.SIZE', $parse)) {
                $thefsize = videos_filesize($res);
            }
            //Download-Link
            if (!$set['videos']['regonly'] && !$res['regonly'] || $user->info['userid']) {
                $sechash = md5($_SERVER['HTTP_HOST'] . $res['file'] . date('Y/m/d', time() - TIMEDIFF));
                $dllink = 'misc.php?action=videofile&amp;id=' . $res['id'] . '&amp;sechash=' . $sechash . iif($apx->section_id(), '&amp;sec=' . $apx->section_id());
            } else {
                $dllink = mklink('user.php', 'user.html');
            }
            //Bilder
            if (in_array('VIDEO.SCREENSHOT', $parse)) {
                $picdata = videos_screenshots($res['id']);
            }
            //Neu?
            if ($res['addtime'] + $set['videos']['new'] * 24 * 3600 >= time()) {
                $new = 1;
            } else {
                $new = 0;
            }
            //Username + eMail
            if ($res['userid']) {
                $uploader = $res['username'];
                $uploader_email = iif(!$res['pub_hidemail'], $res['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('VIDEO.TEXT', $parse)) {
                $text = mediamanager_inline($res['text']);
                if ($apx->is_module('glossar')) {
                    $text = glossar_highlight($text);
                }
            }
            //Tags
            if (in_array('VIDEO.TAG', $parse) || in_array('VIDEO.TAG_IDS', $parse) || in_array('VIDEO.KEYWORDS', $parse)) {
                list($tagdata, $tagids, $keywords) = videos_tags($res['id']);
            }
            //Embeded?
            if ($res['source'] != 'apexx' && $res['source'] != 'external') {
                $embedcode = videos_embedcode($res['source'], $res['flvfile']);
                $file = '';
                $flvfile = '';
                $dllink = '';
            } elseif ($res['source'] == 'external') {
                $embedcode = '';
                $flvfile = $res['flvfile'];
                if ($res['file']) {
                    $file = $res['file'];
                } else {
                    $dllink = '';
                }
            } else {
                $embedcode = '';
                $flvfile = HTTPDIR . getpath('uploads') . $res['flvfile'];
                if ($res['file']) {
                    $file = HTTP_HOST . HTTPDIR . getpath('uploads') . $res['file'];
                } else {
                    $dllink = '';
                }
            }
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['SECID'] = $res['secid'];
            $tabledata[$i]['USERID'] = $res['userid'];
            $tabledata[$i]['USERNAME'] = replace($uploader);
            $tabledata[$i]['EMAIL'] = replace($uploader_email);
            $tabledata[$i]['EMAIL_ENCRYPTED'] = replace(cryptMail($uploader_email));
            $tabledata[$i]['TITLE'] = $res['title'];
            $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]['SIZE'] = videos_getsize($thefsize);
            $tabledata[$i]['HITS'] = number_format($res['hits'], 0, '', '.');
            $tabledata[$i]['TIME'] = $res['starttime'];
            $tabledata[$i]['SCREENSHOT'] = $picdata;
            $tabledata[$i]['SOURCE'] = $res['source'] == 'external' ? 'apexx' : $res['source'];
            $tabledata[$i]['VIDEOFILE'] = $flvfile;
            $tabledata[$i]['EMBEDCODE'] = $embedcode;
            $tabledata[$i]['LOCAL'] = $res['source'] == 'apexx';
            $tabledata[$i]['TOP'] = $res['top'];
            $tabledata[$i]['RESTRICTED'] = $res['restricted'];
            $tabledata[$i]['NEW'] = $new;
            $tabledata[$i]['DOWNLOADLINK'] = $dllink;
            $tabledata[$i]['DOWNLOADFILE'] = $file;
            $tabledata[$i]['DOWNLOADS'] = number_format($res['downloads'], 0, '', '.');
            //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]['CATTEXT'] = $catinfo[$res['catid']]['text'];
            $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();
                $tabledata[$i]['DISPLAY_RATING'] = 1;
            }
            $laststamp = date('Y/m/d', $res['starttime'] - TIMEDIFF);
        }
    }
    $tmpl->assign('VIDEO', $tabledata);
    $tmpl->parse($template, 'videos');
}
Beispiel #13
0
     $tabledata[$i]['RELATED'] = news_links($res['links']);
 }
 //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;
 if (in_array('NEWS.TEASER', $parse) && $set['news']['teaser']) {
     $tabledata[$i]['TEASER'] = mediamanager_inline($res['teaser']);
 }
 if (in_array('NEWS.TEXT', $parse)) {
     $tabledata[$i]['TEXT'] = mediamanager_inline($res['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;
Beispiel #14
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');
}