157 lines
2.8 KiB
PHP
157 lines
2.8 KiB
PHP
<?php /*ini_set('display_errors', FALSE);*/header('Content-type: application/json');
|
|
|
|
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/');
|
|
|
|
include_once(PATHTOINCLUDES."bebop/regular.php");
|
|
|
|
date_default_timezone_set('UTC'); // don't know
|
|
|
|
$em="";
|
|
|
|
$offset=0;
|
|
|
|
$varhour = date('H');
|
|
|
|
if($varhour > 4){$offset=1;}
|
|
|
|
if($varhour > 8){$offset=0;}
|
|
|
|
if($varhour > 12){$offset=2;}
|
|
|
|
if($varhour > 18){$offset=3;}
|
|
|
|
$sql="SELECT
|
|
|
|
`se_videos`.`video_id`,
|
|
|
|
`se_videos`.`video_user_id`,
|
|
|
|
`se_videos`.`video_datecreated`,
|
|
|
|
`se_videos`.`video_title`,
|
|
|
|
`se_videos`.`video_views`,
|
|
|
|
`se_videos`.`video_desc`,
|
|
|
|
`se_videos`.`video_privacy`,
|
|
|
|
`se_videos`.`video_cache_rating`,
|
|
|
|
`se_videos`.`video_totalcomments`,
|
|
|
|
`se_users`.`user_username`,
|
|
|
|
`se_videos`.`video_privacy`,
|
|
|
|
`se_videos`.`video_search`,
|
|
|
|
`se_videos`.`video_cache_rating_weighted`,
|
|
|
|
`se_videos`.`video_cache_rating_total`,
|
|
|
|
`se_videos`.`video_duration_in_sec`,
|
|
|
|
`se_videos`.`video_type`,
|
|
|
|
`se_users`.`user_id`,
|
|
|
|
`se_users`.`user_username`,
|
|
|
|
`se_users`.`user_displayname`,
|
|
|
|
`se_users`.`user_blocklist`
|
|
|
|
FROM
|
|
|
|
`se_videos`
|
|
|
|
Left Outer Join `se_users` ON `se_users`.`user_id` = `se_videos`.`video_user_id`
|
|
|
|
WHERE
|
|
|
|
`se_videos`.`video_datecreated` > UNIX_TIMESTAMP()-(60*60*24*7) AND `se_videos`.`video_privacy` = 31 AND `se_videos`.`video_search` = 1
|
|
|
|
AND
|
|
|
|
`se_videos`.`video_is_converted` = 1
|
|
|
|
AND
|
|
|
|
`se_videos`.`video_admin_approved` = 1
|
|
|
|
AND
|
|
|
|
`se_users`.`user_wh_privacy` = 'N'
|
|
|
|
AND
|
|
|
|
`se_users`.`user_enabled` = 1
|
|
|
|
ORDER BY
|
|
|
|
`se_videos`.`video_cache_rating_weighted` DESC,
|
|
|
|
`se_videos`.`video_totalcomments` DESC,
|
|
|
|
`se_videos`.`video_views` DESC
|
|
|
|
LIMIT 6 OFFSET ".$offset;
|
|
|
|
|
|
|
|
$result=$database->database_query($sql) or $em.=$database->database_error();
|
|
|
|
while ($row = $database->database_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
$blocklist = explode(",", $row["user_blocklist"]);
|
|
|
|
if(!isset($_GET["uid"])){$_GET["uid"]=-1;}
|
|
|
|
$key = array_search($_GET["uid"], $blocklist);//array search will only evaluate to false or not false;
|
|
|
|
if($key!==false){continue;}
|
|
|
|
$viewerbl=explode(",", $_GET["ubl"]);
|
|
|
|
$vkey = array_search($row["user_id"], $viewerbl);//array search will only evaluate to false or not false;
|
|
|
|
if($vkey!==false){continue;}
|
|
|
|
|
|
|
|
$weirdnumber = (((int)($row['video_user_id']/1000))*1000)+1000;
|
|
|
|
$mediapath="/uploads_video/".$weirdnumber."/".$row['video_user_id']."/".$row['video_id'];
|
|
|
|
$thumb="_thumb.jpg";
|
|
|
|
$vmp4=".mp4";
|
|
|
|
$vflv=".flv";
|
|
|
|
$profile="/profile.php?user=".$row["user_username"];
|
|
|
|
$vun=$row["user_username"];
|
|
|
|
$vv=$row["video_views"];
|
|
|
|
$vc=$row["video_totalcomments"];
|
|
|
|
$vsr=round($row["video_cache_rating_weighted"],2);
|
|
|
|
$vtitle=$row["video_title"];
|
|
|
|
$vid=$row["video_id"];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$arr = array ('error'=>$em, 'thevid'=>$mediapath, 'vun' => $vun, 'profile'=> $profile, 'vc' => $vc, 'vv' => $vv, 'vsr' => $vsr, 'vtitle' => $vtitle, 'vid' => $vid);
|
|
|
|
echo json_encode($arr);
|
|
|
|
?>
|