function misc_videofile() { global $set, $db, $apx, $user; $_REQUEST['id'] = (int) $_REQUEST['id']; if (!$_REQUEST['id']) { die('missing ID!'); } if ($set['videos']['regonly'] && !$user->info['userid']) { die('video only for registered users!'); } $apx->lang->drop('detail', 'videos'); //Secure Check $res = $db->first("SELECT id,title,file,regonly,`limit`,password,source FROM " . PRE . "_videos WHERE ( id='" . $_REQUEST['id'] . "' " . iif(!$user->is_team_member(), "AND ( '" . time() . "' BETWEEN starttime AND endtime )") . " " . section_filter() . " ) LIMIT 1"); if (!$res['id']) { die('file not found!'); } if ($res['regonly'] && !$user->info['userid']) { die('video only for registered users!'); } if (videos_limit_is_reached($res['id'], $res['limit'])) { message($apx->lang->get('MSG_LIMITREACHED'), 'back'); } if ($res['password'] && $_POST['password'] != $res['password']) { tmessage('pwdrequired', array('ID' => $_REQUEST['id'], 'SECHASH' => $_REQUEST['sechash']), 'videos'); } $checkhash = md5($_SERVER['HTTP_HOST'] . $res['file'] . date('Y/m/d', time() - TIMEDIFF)); if ($checkhash != $_REQUEST['sechash']) { header("HTTP/1.1 301 Moved Permanently"); header('location:' . str_replace('&', '&', mklink('videos.php?id=' . $_REQUEST['id'], 'videos,id' . $_REQUEST['id'] . urlformat($res['title']) . '.html'))); exit; } //Datei downloadbar? if (!in_array($res['source'], array('apexx', 'external'))) { header("HTTP/1.1 404 Not Found"); exit; } //Statistik $thefsize = videos_filesize($res); videos_insert_stats($res['id'], $thefsize, $res['source'] == 'apexx'); //Datei senden if ($res['source'] == 'external') { header("HTTP/1.1 301 Moved Permanently"); header('location:' . $res['file']); exit; } else { header("HTTP/1.1 301 Moved Permanently"); header('location:' . HTTPDIR . getpath('uploads') . $res['file']); exit; } }
$catinfo = array(); if (count($catids) && in_template(array('VIDEO.CATTITLE', 'VIDEO.CATTEXT', 'VIDEO.CATICON'), $parse)) { $catinfo = videos_catinfo($catids); } 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&id=' . $res['id'] . '&sechash=' . $sechash . iif($apx->section_id(), '&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;
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&id=' . $res['id'] . '&sechash=' . $sechash . iif($apx->section_id(), '&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'); }