Beispiel #1
0
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;
    }
}
Beispiel #2
0
 $apx->tmpl->assign('DOWNLOADFILE', $file);
 $apx->tmpl->assign('DOWNLOADS', number_format($res['downloads'], 0, '', '.'));
 $apx->tmpl->assign('BROKEN', $blink);
 $apx->tmpl->assign('REGONLY', $res['regonly'] || $set['videos']['regonly']);
 //Video-Zeit
 $apx->tmpl->assign('TIME_MODEM', videos_gettime($thefsize, 56));
 $apx->tmpl->assign('TIME_ISDN', videos_gettime($thefsize, 64));
 $apx->tmpl->assign('TIME_ISDN2', videos_gettime($thefsize, 128));
 $apx->tmpl->assign('TIME_DSL1000', videos_gettime($thefsize, 1024));
 $apx->tmpl->assign('TIME_DSL2000', videos_gettime($thefsize, 1024 * 2));
 $apx->tmpl->assign('TIME_DSL6000', videos_gettime($thefsize, 1024 * 6));
 $apx->tmpl->assign('TIME_DSL10000', videos_gettime($thefsize, 1024 * 10));
 $apx->tmpl->assign('TIME_DSL12000', videos_gettime($thefsize, 1024 * 12));
 $apx->tmpl->assign('TIME_DSL16000', videos_gettime($thefsize, 1024 * 16));
 //Video-Limit
 if (videos_limit_is_reached($res['id'], $res['limit'])) {
     $apx->tmpl->assign('LIMIT', 1);
 }
 //Kategorie
 $apx->tmpl->assign('CATID', $res['catid']);
 $apx->tmpl->assign('CATTITLE', $catinfo['title']);
 $apx->tmpl->assign('CATTEXT', $catinfo['text']);
 $apx->tmpl->assign('CATICON', $catinfo['icon']);
 $apx->tmpl->assign('CATCOUNT', $catcount);
 $apx->tmpl->assign('CATLINK', mklink('videos.php?catid=' . $catinfo['catid'], 'videos,' . $catinfo['catid'] . ',1' . urlformat($catinfo['title']) . '.html'));
 //Pfad
 if (in_array('PATH', $parse)) {
     $apx->tmpl->assign('PATH', videos_path($res['catid']));
 }
 //Kommentare
 if ($apx->is_module('comments') && $set['videos']['coms'] && $res['allowcoms']) {