1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
daniel 2019-05-08 13:25:07 -03:00
parent fd10d1e830
commit 3a9ff3fb66
119 changed files with 510 additions and 159 deletions

View file

@ -3,13 +3,15 @@ header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Content-Type");
header('Content-Type: application/json');
global $global, $config;
if(!empty($_GET) && empty($_POST)){
$_POST = $_GET;
}
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once 'comment.php';
require_once 'subscribe.php';
// gettig the mobile submited value
$inputJSON = url_get_contents('php://input');
$input = json_decode($inputJSON, TRUE); //convert JSON into array
@ -18,9 +20,6 @@ if(!empty($input) && empty($_POST)){
$_POST[$key]=$value;
}
}
if(!empty($_GET) && empty($_POST)){
$_POST = $_GET;
}
if(!empty($_POST['user']) && !empty($_POST['pass'])){
$user = new User(0, $_POST['user'], $_POST['pass']);
$user->login(false, true);
@ -31,12 +30,16 @@ if(empty($_POST['playlists_id'])){
require_once './playlist.php';
$videos = PlayList::getVideosFromPlaylist($_POST['playlists_id']);
$objMob = YouPHPTubePlugin::getObjectData("MobileManager");
foreach ($videos as $key => $value) {
unset($videos[$key]['password']);
unset($videos[$key]['recoverPass']);
$videos[$key]['Poster'] = "{$global['webSiteRootURL']}videos/".$videos[$key]['filename'].".jpg";
$videos[$key]['Thumbnail'] = "{$global['webSiteRootURL']}videos/".$videos[$key]['filename']."_thumbs.jpg";
$images = Video::getImageFromFilename($videos[$key]['filename'], $videos[$key]['type']);
$videos[$key]['images'] = $images;
$videos[$key]['Poster'] = !empty($objMob->portraitImage)?$images->posterPortrait:$images->poster;
$videos[$key]['Thumbnail'] = !empty($objMob->portraitImage)?$images->posterPortraitThumbs:$images->thumbsJpg;
$videos[$key]['imageClass'] = !empty($objMob->portraitImage)?"portrait":"landscape";
$videos[$key]['VideoUrl'] = getVideosURL($videos[$key]['filename']);
$videos[$key]['createdHumanTiming'] = humanTiming(strtotime($videos[$key]['created']));
$videos[$key]['pageUrl'] = "{$global['webSiteRootURL']}video/".$videos[$key]['clean_title'];