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'); }
$uploader_email = iif(!$res['pub_hidemail'], $res['email']); } else { $uploader = $res['send_username']; $uploader_email = $res['send_email']; } //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'];