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 Neto 2023-06-23 12:08:57 -03:00
parent 4a3c059174
commit 20a971ae4f
34 changed files with 1162 additions and 861 deletions

View file

@ -133,7 +133,7 @@ Options All -Indexes
RewriteRule ^videoOnly/?$ view/?type=video [NC,L] RewriteRule ^videoOnly/?$ view/?type=video [NC,L]
RewriteRule ^audioOnly/?$ view/?type=audio [NC,L] RewriteRule ^audioOnly/?$ view/?type=audio [NC,L]
RewriteRule ^download$ view/downloadExternalVideo.php [NC,L] RewriteRule ^download$ view/downloadExternalVideo.php [NC,L]
RewriteRule ^info$ view/info.php [NC,L] RewriteRule ^info$ view/info.php [QSA,L]
RewriteRule ^version$ view/info.php?version=1 [NC,L] RewriteRule ^version$ view/info.php?version=1 [NC,L]
RewriteRule ^downloadNow$ objects/downloadVideo.php [NC,L] RewriteRule ^downloadNow$ objects/downloadVideo.php [NC,L]
RewriteRule ^getDownloadProgress$ objects/downloadVideoProgress.php [NC,L] RewriteRule ^getDownloadProgress$ objects/downloadVideoProgress.php [NC,L]

BIN
install/assets/Arial.ttf Normal file

Binary file not shown.

View file

View file

@ -0,0 +1,2 @@
WEBVTT

BIN
install/assets/testMP3.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

194
install/populateForTest.php Normal file
View file

@ -0,0 +1,194 @@
<?php
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
error_reporting(E_ALL);
ini_set('display_errors', 1);
$_SESSION['user'] = array();
$_SESSION['user']['id'] = 1;
ob_end_flush();
$videoFile = 'assets/testVideo.mp4';
$audioFile = 'assets/testMP3.mp3';
$spritFile = 'assets/thumbsSprit.jpg';
$subtitleSRT = 'assets/subtitle.srt';
$subtitleVTT = 'assets/subtitle.vtt';
$totalVideos = 50;
$totalPlaylists = 10;
$totalVideosPerPlaylist = 30;
$totalCategories = 10;
$totalSubCategories = 5;
/*
for ($i = 0; $i < $totalCategories; $i++) {
$date = date('Y/m/d H:i:s');
$catTitle = "$i Auto Category $date";
$catCleanTitle = "{$i}-Auto-Category-".date('YmdHis');
$cat = new Category(0);
$cat->setName($catTitle);
$cat->setClean_name($catCleanTitle);
$parentId = $cat->save(true);
echo "pupulating [$totalVideos/$i] category saved [id=$parentId]" . PHP_EOL;
for ($j = 0; $j < $totalSubCategories; $j++) {
$catTitle = "$i Auto SubCategory $date";
$catCleanTitle = "{$i}-Auto-SubCategory-".date('YmdHis');
$cat = new Category(0);
$cat->setName($catTitle);
$cat->setClean_name($catCleanTitle);
$cat->setParentId($parentId);
$id = $cat->save(true);
echo "pupulating [$totalVideos/$i] subcategory saved [id=$id]" . PHP_EOL;
}
}
echo "pupulating ... ";
$cats = Category::getAllCategories();
echo "pupulating ... ".__LINE__;
$videos = Video::getAllVideosLight('');
echo "pupulating ... ".__LINE__;
$total = count($videos);
echo "[{$total}/{$key}] pupulating video start ";
foreach ($videos as $key => $value) {
$video = new Video('', '', $value['id']);
$index = array_rand($cats);
$video->setCategories_id($cats[$index]['id']);
$id = $video->save(false, true);
echo "[{$total}/{$key}] pupulating video category saved [id=$id catId={$cats[$index]['id']}]" . PHP_EOL;
}
exit;
$newVideosIds = array();
// create videos
for ($i = 0; $i < $totalVideos; $i++) {
$date = date('Y/m/d H:i:s');
$title = "[$i] Auto {$date}";
$filename = "testvideo{$i}_" . uniqid();
$video = new Video($title, $filename);
$video->setDuration("00:00:45");
$video->setType('video');
$video->setDuration_in_seconds(45);
$video->setDescription($title);
$video->setUsers_id(1);
$index = array_rand($cats);
$video->setCategories_id($cats[$index]['id']);
$video->setStatus(Video::$statusActive);
$video->setFilesize(2858747);
$video->setLikes(rand(0, 1000));
$video->setDislikes(rand(0, 1000));
$path = Video::getPathToFile($filename, true);
$mp4Filename = "{$path}_480.mp4";
$mp3Filename = "{$path}.mp3";
$jpgFilename = "{$path}.jpg";
$spritFilename = "{$path}_thumbsSprit.jpg";
$subtitleSRTFilename = "{$path}.srt";
$subtitleVTTFilename = "{$path}.vtt";
createImageWithText("[$i] Auto Pupulated", $date, $jpgFilename);
copy($videoFile, $mp4Filename);
copy($audioFile, $mp3Filename);
copy($spritFile, $spritFilename);
copy($subtitleSRT, $subtitleSRTFilename);
copy($subtitleVTT, $subtitleVTTFilename);
$id = $video->save(false, true);
$newVideosIds[] = $id;
echo "pupulating [$totalVideos/$i] Video saved [id=$id]" . PHP_EOL;
}
AVideoPlugin::loadPlugin('PlayLists');
for ($i = 0; $i < $totalPlaylists; $i++) {
$name = "Playlist test autogenerated $i " . date('Y/m/d H:i:s');
$playlist = new PlayList(0);
$playlist->setName($name);
$playlist->setStatus('a');
$id = $playlist->save();
echo "pupulating [$totalPlaylists/$i] Playlist saved [id=$id]" . PHP_EOL;
for ($j = 0; $j < $totalVideosPerPlaylist; $j++) {
$playList = new PlayList($id);
$playList->addVideo($newVideosIds[array_rand($newVideosIds)], 1);
echo "pupulating [$totalVideosPerPlaylist/$j] Video added in a Playlist" . PHP_EOL;
}
}
die();
function createImageWithText($text1, $text2, $filename)
{
// Create a blank image
$width = 640;
$height = 360;
$image = imagecreatetruecolor($width, $height);
// Allocate a color for the background and fill the background
$red = rand(0, 255);
$green = rand(0, 255);
$blue = rand(0, 255);
$backgroundColor = imagecolorallocate($image, $red, $green, $blue);
imagefilledrectangle($image, 0, 0, $width, $height, $backgroundColor);
// Calculate the luminance of the background color
$luminance = (0.299 * $red + 0.587 * $green + 0.114 * $blue) / 255;
// Allocate a color for the text
if ($luminance > 0.5) {
$textColor = imagecolorallocate($image, 0, 0, 0); // Use black text for a light background
} else {
$textColor = imagecolorallocate($image, 255, 255, 255); // Use white text for a dark background
}
// Font size and path
$fontSize = 48;
$fontPath = 'assets/Arial.ttf';
// Calculate x position of the first line of text
$box1 = imagettfbbox($fontSize, 0, $fontPath, $text1);
$textWidth1 = $box1[2] - $box1[0];
$x1 = ($width - $textWidth1) / 2;
// Calculate x position of the second line of text
$box2 = imagettfbbox($fontSize, 0, $fontPath, $text2);
$textWidth2 = $box2[2] - $box2[0];
$x2 = ($width - $textWidth2) / 2;
// Y positions for each line of text
$y1 = ceil($height / 3);
$y2 = $y1 * 2;
// Add the text to the image
imagettftext($image, $fontSize, 0, $x1, $y1, $textColor, $fontPath, $text1);
imagettftext($image, $fontSize, 0, $x2, $y2, $textColor, $fontPath, $text2);
// Save the image
imagejpeg($image, $filename);
// Free up memory
imagedestroy($image);
}
*/
/*
AVideoPlugin::loadPlugin('PlayLists');
$pls = PlayList::getAll();
$videos = Video::getAllVideosLight('');
$total = count($videos);
foreach ($pls as $key => $value) {
echo "[{$total}/{$key}] playlists_id={$value['id']} pupulating video start " . PHP_EOL;
for ($j = 0; $j < 50; $j++) {
$playlist = new PlayList($value['id']);
$index = array_rand($videos);
$videos_id = $videos[$index]['id'];
echo "[{$total}/{$key}/{$j}] pupulating [$videos_id] type={$videos[$index]['type']} Video added in a Playlist start" . PHP_EOL;
$playlist->addVideo($videos[$index]['id'], 1, 0, false);
echo "[{$total}/{$key}/{$j}] pupulating done [$videos_id] Video added in a Playlist" . PHP_EOL;
}
}
*/

View file

@ -73,7 +73,6 @@ class Category {
public function setClean_name($clean_name) { public function setClean_name($clean_name) {
$clean_name = preg_replace('/\W+/', '-', strtolower(cleanString($clean_name))); $clean_name = preg_replace('/\W+/', '-', strtolower(cleanString($clean_name)));
$this->clean_name = _substr($clean_name, 0, 45); $this->clean_name = _substr($clean_name, 0, 45);
;
} }
public function setNextVideoOrder($nextVideoOrder) { public function setNextVideoOrder($nextVideoOrder) {
@ -471,7 +470,7 @@ class Category {
//_error_log("getAllCategories id={$row['id']} line=".__LINE__); //_error_log("getAllCategories id={$row['id']} line=".__LINE__);
$row['hierarchyAndName'] = $row['hierarchy'] . __($row['name']); $row['hierarchyAndName'] = $row['hierarchy'] . __($row['name']);
//_error_log("getAllCategories id={$row['id']} line=".__LINE__); //_error_log("getAllCategories id={$row['id']} line=".__LINE__);
$row['description_html'] = textToLink(htmlentities($row['description'])); $row['description_html'] = textToLink(htmlentities("{$row['description']}"));
$category[] = $row; $category[] = $row;
} }

View file

@ -388,6 +388,9 @@ function getRealIpAddr()
function cleanString($text) function cleanString($text)
{ {
if(empty($text)){
return '';
}
$utf8 = [ $utf8 = [
'/[áaâaaäą]/u' => 'a', '/[áaâaaäą]/u' => 'a',
'/[ÁAÂAÄĄ]/u' => 'A', '/[ÁAÂAÄĄ]/u' => 'A',
@ -1674,6 +1677,9 @@ function getResolutionFromFilename($filename)
return $getResolutionFromFilenameArray[$filename]; return $getResolutionFromFilenameArray[$filename];
} }
if(empty($filename)){
return 0;
}
if (!preg_match('/^http/i', $filename) && !file_exists($filename)) { if (!preg_match('/^http/i', $filename) && !file_exists($filename)) {
return 0; return 0;
} }
@ -10132,7 +10138,7 @@ function forbiddenPageIfCannotEmbed($videos_id)
$reason[] = __('Admin block video sharing'); $reason[] = __('Admin block video sharing');
} }
if (!CustomizeUser::canShareVideosFromVideo($videos_id)) { if (!CustomizeUser::canShareVideosFromVideo($videos_id)) {
error_log("forbiddenPageIfCannotEmbed: Embed is forbidden: !CustomizeUser::canShareVideosFromVideo({$video['id']})"); error_log("forbiddenPageIfCannotEmbed: Embed is forbidden: !CustomizeUser::canShareVideosFromVideo({$videos_id})");
$reason[] = __('User block video sharing'); $reason[] = __('User block video sharing');
} }
forbiddenPage("Embed is forbidden " . implode('<br>', $reason)); forbiddenPage("Embed is forbidden " . implode('<br>', $reason));
@ -11199,3 +11205,33 @@ function getImageOrientation($imagePath) {
} }
} }
function canSearchUsers(){
global $advancedCustomUser;
if(canAdminUsers()){
return true;
}
if(AVideoPlugin::isEnabledByName('PlayLists')){
if(PlayLists::canManageAllPlaylists()){
return true;
}
}
if (empty($advancedCustomUser)) {
$advancedCustomUser = AVideoPlugin::getObjectDataIfEnabled('CustomizeUser');
}
if($advancedCustomUser->userCanChangeVideoOwner){
return true;
}
return false;
}
function canAdminUsers(){
if(Permissions::canAdminUsers()){
return true;
}
if(AVideoPlugin::isEnabledByName('PayPerView')){
if(PayPerView::canSeePPVManagementInfo()){
return true;
}
}
return false;
}

View file

@ -469,7 +469,7 @@ class PlayList extends ObjectYPT {
$row['humancreate'] = humanTiming(strtotime($row['cre'])); $row['humancreate'] = humanTiming(strtotime($row['cre']));
} }
$images = Video::getImageFromFilename($row['filename'], $row['type']); $images = Video::getImageFromFilename($row['filename'], $row['type']);
if (!file_exists($images->posterLandscapePath) && !empty($row['serie_playlists_id'])) { if (is_object($images) && !empty($images->posterLandscapePath) && !file_exists($images->posterLandscapePath) && !empty($row['serie_playlists_id'])) {
$images = self::getRandomImageFromPlayList($row['serie_playlists_id']); $images = self::getRandomImageFromPlayList($row['serie_playlists_id']);
} }
$row['images'] = $images; $row['images'] = $images;
@ -729,6 +729,7 @@ class PlayList extends ObjectYPT {
if (!empty($playlists_id)) { if (!empty($playlists_id)) {
self::deleteCacheDir($playlists_id); self::deleteCacheDir($playlists_id);
} }
$this->id = $playlists_id;
return $playlists_id; return $playlists_id;
} }

View file

@ -10,20 +10,16 @@ if (!User::isLogged()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');
} }
if (empty($_POST['playlist_id']) && !empty($_GET['playlist_id'])) { if (!PlayLists::canManagePlaylist($_REQUEST['playlist_id'])) {
$_POST['playlist_id'] = intval($_GET['playlist_id']);
}
$obj = new PlayList($_POST['playlist_id']);
if (User::getId() !== $obj->getUsers_id()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');
} }
$obj = new PlayList($_REQUEST['playlist_id']);
$count = 1; $count = 1;
if (empty($_POST['list'])) { if (empty($_POST['list'])) {
// get all videos from playlist // get all videos from playlist
$videosArrayId = PlayList::getVideosIdFromPlaylist($_POST['playlist_id']); $videosArrayId = PlayList::getVideosIdFromPlaylist($_REQUEST['playlist_id']);
$videos = []; $videos = [];
foreach ($videosArrayId as $value) { foreach ($videosArrayId as $value) {
$videos[] = Video::getVideoLight($value); $videos[] = Video::getVideoLight($value);

View file

@ -341,7 +341,7 @@ if (typeof gtag !== \"function\") {
public static function _recommendChannelName($name = "", $try = 0, $unknown = "", $users_id = 0) { public static function _recommendChannelName($name = "", $try = 0, $unknown = "", $users_id = 0) {
$name = preg_replace('/\s+/', '', $name); $name = preg_replace('/\s+/', '', "{$name}");
if (empty($users_id)) { if (empty($users_id)) {
if (!empty(User::getId())) { if (!empty(User::getId())) {
$users_id = User::getId(); $users_id = User::getId();
@ -694,7 +694,7 @@ if (typeof gtag !== \"function\") {
$password = ($this->password); $password = ($this->password);
$name = ($this->name); $name = ($this->name);
$status = ($this->status); $status = ($this->status);
$this->about = preg_replace("/(\\\)+n/", "\n", $this->about); $this->about = preg_replace("/(\\\)+n/", "\n", "{$this->about}");
$this->channelName = self::_recommendChannelName($this->channelName, 0, $this->user, $this->id); $this->channelName = self::_recommendChannelName($this->channelName, 0, $this->user, $this->id);
$channelName = ($this->channelName); $channelName = ($this->channelName);
if (filter_var($this->donationLink, FILTER_VALIDATE_URL) === false) { if (filter_var($this->donationLink, FILTER_VALIDATE_URL) === false) {
@ -749,6 +749,8 @@ if (typeof gtag !== \"function\") {
. " status,photoURL,recoverPass, created, modified, channelName, analyticsCode, externalOptions, phone, is_company,emailVerified) " . " status,photoURL,recoverPass, created, modified, channelName, analyticsCode, externalOptions, phone, is_company,emailVerified) "
. " VALUES (?,?,?,?,?,?,?,?, false, " . " VALUES (?,?,?,?,?,?,?,?, false, "
. "?,?,?, now(), now(),?,?,?,?," . (empty($this->is_company) ? 'NULL' : intval($this->is_company)) . ",?)"; . "?,?,?, now(), now(),?,?,?,?," . (empty($this->is_company) ? 'NULL' : intval($this->is_company)) . ",?)";
_error_log("Insert new user user=$user, email={$this->email}, name=$name ". json_encode(debug_backtrace()));
} }
$insert_row = sqlDAL::writeSql($sql, $formats, $values); $insert_row = sqlDAL::writeSql($sql, $formats, $values);
@ -771,6 +773,7 @@ if (typeof gtag !== \"function\") {
// update the user groups // update the user groups
UserGroups::updateUserGroups($id, $this->userGroups); UserGroups::updateUserGroups($id, $this->userGroups);
} }
$this->id = $id;
return $id; return $id;
} else { } else {
_error_log(' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error . " $sql"); _error_log(' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error . " $sql");
@ -1188,7 +1191,7 @@ if (typeof gtag !== \"function\") {
return !empty($_SESSION['user']['emailVerified']); return !empty($_SESSION['user']['emailVerified']);
} }
public static function isAdmin($users_id = 0) { public static function isAdmin($users_id = 0) : bool {
if (!empty($users_id)) { if (!empty($users_id)) {
$user = new User($users_id); $user = new User($users_id);
return !empty($user->getIsAdmin()); return !empty($user->getIsAdmin());

View file

@ -16,6 +16,15 @@ $obj->status = 0;
if (!Permissions::canAdminUsers()) { if (!Permissions::canAdminUsers()) {
forbiddenPage(); forbiddenPage();
} }
if(empty($_REQUEST['securityToken'])){
forbiddenPage('Security token is empty');
}
if(!isTokenValid($_REQUEST['securityToken'])){
forbiddenPage('Security token is invalid');
}
session_write_close(); session_write_close();
if (!empty($advancedCustomUser->forceLoginToBeTheEmail)) { if (!empty($advancedCustomUser->forceLoginToBeTheEmail)) {
$_POST['email'] = $_POST['user']; $_POST['email'] = $_POST['user'];
@ -34,7 +43,7 @@ $user->setEmail($_POST['email']);
$user->setName($_POST['name']); $user->setName($_POST['name']);
$user->setIsAdmin($_POST['isAdmin']); $user->setIsAdmin($_POST['isAdmin']);
$user->setCanStream($_POST['canStream']); $user->setCanStream($_POST['canStream']);
$user->setIs_company($_POST['is_company']); $user->setIs_company(@$_POST['is_company']);
$user->setCanUpload($_POST['canUpload']); $user->setCanUpload($_POST['canUpload']);
$user->setCanViewChart($_POST['canViewChart']); $user->setCanViewChart($_POST['canViewChart']);
$user->setCanCreateMeet($_POST['canCreateMeet']); $user->setCanCreateMeet($_POST['canCreateMeet']);

View file

@ -54,9 +54,6 @@ class UserGroups{
public function save() public function save()
{ {
global $global; global $global;
if (empty($this->isAdmin)) {
$this->isAdmin = "false";
}
$formats = ''; $formats = '';
$values = []; $values = [];
$this->group_name = _substr($this->group_name, 0, 255); $this->group_name = _substr($this->group_name, 0, 255);

View file

@ -8,7 +8,7 @@ require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
$canAdminUsers = Permissions::canAdminUsers(); $canAdminUsers = canAdminUsers();
if (empty($_POST['current'])) { if (empty($_POST['current'])) {
$_POST['current'] = 1; $_POST['current'] = 1;
} }
@ -29,7 +29,7 @@ if (!empty($_REQUEST['users_id'])) {
//echo __LINE__, PHP_EOL; //echo __LINE__, PHP_EOL;
$isAdmin = null; $isAdmin = null;
$isCompany = null; $isCompany = null;
$ignoreAdmin = $advancedCustomUser->userCanChangeVideoOwner ? true : false; $ignoreAdmin = canSearchUsers() ? true : false;
if (isset($_REQUEST['isAdmin'])) { if (isset($_REQUEST['isAdmin'])) {
$isAdmin = 1; $isAdmin = 1;
} }
@ -48,8 +48,8 @@ if (!empty($_REQUEST['users_id'])) {
$total = User::getTotalUsers($ignoreAdmin, @$_GET['status'], $isAdmin, $isCompany); $total = User::getTotalUsers($ignoreAdmin, @$_GET['status'], $isAdmin, $isCompany);
} else { } else {
//echo __LINE__, PHP_EOL; //echo __LINE__, PHP_EOL;
$users = User::getAllUsersFromUsergroup($_REQUEST['user_groups_id'], $advancedCustomUser->userCanChangeVideoOwner ? true : false, ['name', 'email', 'user', 'channelName', 'about'], @$_GET['status']); $users = User::getAllUsersFromUsergroup($_REQUEST['user_groups_id'], canSearchUsers() ? true : false, ['name', 'email', 'user', 'channelName', 'about'], @$_GET['status']);
$total = User::getTotalUsersFromUsergroup($_REQUEST['user_groups_id'], $advancedCustomUser->userCanChangeVideoOwner ? true : false, @$_GET['status']); $total = User::getTotalUsersFromUsergroup($_REQUEST['user_groups_id'], canSearchUsers() ? true : false, @$_GET['status']);
} }
//echo examineJSONError($users);exit; //echo examineJSONError($users);exit;

View file

@ -645,9 +645,9 @@ if (!class_exists('Video')) {
public function setDuration($duration) { public function setDuration($duration) {
if (!self::isValidDuration($this->duration) || self::isValidDuration($duration)) { if (!self::isValidDuration($this->duration) || self::isValidDuration($duration)) {
_error_log("setDuration before {$duration}"); //_error_log("setDuration before {$duration}");
AVideoPlugin::onVideoSetDuration($this->id, $this->duration, $duration); AVideoPlugin::onVideoSetDuration($this->id, $this->duration, $duration);
_error_log("setDuration after {$duration}"); //_error_log("setDuration after {$duration}");
$this->duration = $duration; $this->duration = $duration;
} else { } else {
_error_log("setDuration error is not a valid {$duration}, old duration = {$this->duration}"); _error_log("setDuration error is not a valid {$duration}, old duration = {$this->duration}");
@ -1669,7 +1669,7 @@ if (!class_exists('Video')) {
$timeLogName = TimeLogStart("video::getInfo getStatistcs"); $timeLogName = TimeLogStart("video::getInfo getStatistcs");
$name = "_getVideoInfo_{$row['id']}"; $name = "_getVideoInfo_{$row['id']}";
$OneHour = 3600; $OneHour = 3600;
$cache = ObjectYPT::getCache($name, $OneHour); $cache = ObjectYPT::getCacheGlobal($name, $OneHour);
if (!empty($cache)) { if (!empty($cache)) {
$externalOptions = $cache->externalOptions; $externalOptions = $cache->externalOptions;
$obj = object_to_array($cache); $obj = object_to_array($cache);
@ -1733,7 +1733,7 @@ if (!class_exists('Video')) {
} }
TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit); TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
$otherInfocachename = "otherInfo{$row['id']}"; $otherInfocachename = "otherInfo{$row['id']}";
$otherInfo = object_to_array(ObjectYPT::getCache($otherInfocachename, 600)); $otherInfo = object_to_array(ObjectYPT::getCacheGlobal($otherInfocachename, 600));
TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit); TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
if (empty($otherInfo)) { if (empty($otherInfo)) {
$otherInfo = []; $otherInfo = [];
@ -1743,7 +1743,7 @@ if (!class_exists('Video')) {
//TimeLogEnd("video::otherInfo", __LINE__, 0.05); //TimeLogEnd("video::otherInfo", __LINE__, 0.05);
$otherInfo['tags'] = self::getTags($row['id']); $otherInfo['tags'] = self::getTags($row['id']);
//TimeLogEnd("video::otherInfo", __LINE__, 0.05); //TimeLogEnd("video::otherInfo", __LINE__, 0.05);
$cached = ObjectYPT::setCache($otherInfocachename, $otherInfo); $cached = ObjectYPT::setCacheGlobal($otherInfocachename, $otherInfo);
//TimeLogEnd("video::otherInfo", __LINE__, 0.05); //TimeLogEnd("video::otherInfo", __LINE__, 0.05);
//_error_log("video::getInfo cache " . json_encode($cached)); //_error_log("video::getInfo cache " . json_encode($cached));
} }
@ -1786,7 +1786,7 @@ if (!class_exists('Video')) {
//var_dump($row['userExternalOptions']);exit; //var_dump($row['userExternalOptions']);exit;
$row = array_merge($row, AVideoPlugin::getAllVideosArray($row['id'])); $row = array_merge($row, AVideoPlugin::getAllVideosArray($row['id']));
TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit); TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
ObjectYPT::setCache($name, $row); ObjectYPT::setCacheGlobal($name, $row);
TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit); TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
if (self::forceAudio()) { if (self::forceAudio()) {
@ -5344,7 +5344,7 @@ if (!class_exists('Video')) {
} else { } else {
if (self::userGroupAndVideoGroupMatch($users_id, $videos_id)) { if (self::userGroupAndVideoGroupMatch($users_id, $videos_id)) {
$videosug = self::getVideoGroups($videos_id); $videosug = self::getVideoGroups($videos_id);
$categoriessug = self::getCategoriesGroups($videos_id); $categoriessug = UserGroups::getCategoriesGroups($videos_id);
$rowsUser = UserGroups::getUserGroups(User::getId()); $rowsUser = UserGroups::getUserGroups(User::getId());
// what group the user needs // what group the user needs
} }
@ -5355,12 +5355,12 @@ if (!class_exists('Video')) {
if ($p = AVideoPlugin::loadPluginIfEnabled($name)) { if ($p = AVideoPlugin::loadPluginIfEnabled($name)) {
$obj = $p->getDataObject(); $obj = $p->getDataObject();
if ($obj->ifExceedQuotaDoNotPlayVideos) { if ($obj->ifExceedQuotaDoNotPlayVideos) {
if ($this->videoOwnerExceedsQuota($videos_id)) { if ($p->videoOwnerExceedsQuota($videos_id)) {
$response->canWatch = false; $response->canWatch = false;
$response->why[] = 'DiskUploadQuota videoOwnerExceedsQuota and ifExceedQuotaDoNotPlayVideos'; $response->why[] = 'DiskUploadQuota videoOwnerExceedsQuota and ifExceedQuotaDoNotPlayVideos';
} }
} else { } else {
if ($this->videoOwnerExceedsQuota($videos_id)) { if ($p->videoOwnerExceedsQuota($videos_id)) {
$response->why[] = 'DiskUploadQuota is active but the owner still have quota'; $response->why[] = 'DiskUploadQuota is active but the owner still have quota';
} else { } else {
$response->why[] = 'DiskUploadQuota is active but the owner quota os gone but ifExceedQuotaDoNotPlayVideos is deactivated'; $response->why[] = 'DiskUploadQuota is active but the owner quota os gone but ifExceedQuotaDoNotPlayVideos is deactivated';

View file

@ -327,15 +327,21 @@ class AVideoPlugin
public static function getHTMLMenuRight() public static function getHTMLMenuRight()
{ {
$plugins = Plugin::getAllEnabled(); $name = "getHTMLMenuRight" . User::getId();
$str = ""; $str = ObjectYPT::getCache($name, 3600);
foreach ($plugins as $value) { if (empty($str)) {
self::YPTstart(); $plugins = Plugin::getAllEnabled();
$p = static::loadPlugin($value['dirName']); $str = "";
if (is_object($p)) { foreach ($plugins as $value) {
$str .= $p->getHTMLMenuRight(); self::YPTstart();
$p = static::loadPlugin($value['dirName']);
if (is_object($p)) {
$str .= $p->getHTMLMenuRight();
}
self::YPTend("{$value['dirName']}::" . __FUNCTION__);
} }
self::YPTend("{$value['dirName']}::" . __FUNCTION__);
ObjectYPT::setCache($name, $str);
} }
return $str; return $str;
} }
@ -1379,7 +1385,7 @@ class AVideoPlugin
public static function compareVersion($name, $version) public static function compareVersion($name, $version)
{ {
$currentVersion = self::getCurrentVersion($name); $currentVersion = self::getCurrentVersion($name);
if(empty($currentVersion)){ if (empty($currentVersion)) {
return -1; return -1;
} }
return version_compare($currentVersion, $version); return version_compare($currentVersion, $version);

View file

@ -575,7 +575,7 @@ class Layout extends PluginAbstract
return $content; return $content;
} }
static function getUserAutocomplete($default_users_id = 0, $id = '', $parameters = array()) static function getUserAutocomplete($default_users_id = 0, $id = '', $parameters = array(), $jsFunctionForSelectCallback = '')
{ {
global $global; global $global;
$default_users_id = intval($default_users_id); $default_users_id = intval($default_users_id);

View file

@ -95,6 +95,11 @@ if (empty($name)) {
photoURL = ui.item.photo; photoURL = ui.item.photo;
} }
$("#user-img<?php echo $id; ?>").attr("src", photoURL); $("#user-img<?php echo $id; ?>").attr("src", photoURL);
<?php
if(!empty($jsFunctionForSelectCallback)){
echo $jsFunctionForSelectCallback.';';
}
?>
return false; return false;
} }
}).autocomplete("instance")._renderItem = function (ul, item) { }).autocomplete("instance")._renderItem = function (ul, item) {

View file

@ -129,6 +129,7 @@ Passcode: {password}
"sub" => "meet.jitsi", "sub" => "meet.jitsi",
"room" => $room, "room" => $room,
"exp" => strtotime("+30 hours"), "exp" => strtotime("+30 hours"),
"nbf" => strtotime("-24 hours"),
"moderator" => $isModerator, "moderator" => $isModerator,
]; ];
return $jitsiPayload; // HS256 return $jitsiPayload; // HS256

View file

@ -30,7 +30,9 @@ if (empty($obj->key) || strlen($obj->key) < 50) {
if (empty($server)) { if (empty($server)) {
$obj->msg = "The server URL is empty"; $obj->msg = "The server URL is empty";
} else { } else {
$obj->key = url_get_contents("http://key.ypt.me?server=" . urlencode($server)); $url = "http://key.ypt.me?server=" . urlencode($server);
//$obj->url = $url;
$obj->key = url_get_contents($url);
$obj->length = strlen($obj->key); // 1 day $obj->length = strlen($obj->key); // 1 day
if (!empty($obj->key) && $obj->length > 50) { if (!empty($obj->key) && $obj->length > 50) {
$obj->error = false; $obj->error = false;

View file

@ -17,7 +17,8 @@ class MobileYPT extends PluginAbstract {
} }
public function getDescription() { public function getDescription() {
$desc = "Manage the Mobile YPTApp"; $desc = "Your Media Companion: YPT Mobile App";
$desc .= "<p>YPT Media is a dynamic mobile app for streaming high-quality videos, audios, managing playlists, supporting PPV, and live streaming. Enjoy an ad-free experience with our server hosting. <a href=\"https://github.com/WWBN/AVideo/wiki/YPT-Media-Mobile-app\">Learn more</a>.</p>";
$desc .= $this->isReadyLabel(['API']); $desc .= $this->isReadyLabel(['API']);
return $desc; return $desc;
} }

View file

@ -2,7 +2,7 @@
class PlayListElement { class PlayListElement {
public $name, $description, $duration, $sources, $thumbnail, $poster, $videoStartSeconds, $created, $likes, $views, $videos_id; public $name, $description, $duration, $sources, $thumbnail, $poster, $videoStartSeconds, $created, $likes, $views, $videos_id, $className, $tracks;
function __construct($name, $description, $duration, $playListSource, $playListThumbnail, $poster, $videoStartSeconds, $created, $likes, $views, $videos_id, $className='', $tracks=array()) { function __construct($name, $description, $duration, $playListSource, $playListThumbnail, $poster, $videoStartSeconds, $created, $likes, $views, $videos_id, $className='', $tracks=array()) {
$this->name = $name; $this->name = $name;
@ -12,7 +12,7 @@ class PlayListElement {
$this->thumbnail = $playListThumbnail; $this->thumbnail = $playListThumbnail;
$this->poster = $poster; $this->poster = $poster;
$this->videoStartSeconds = intval($videoStartSeconds); $this->videoStartSeconds = intval($videoStartSeconds);
$this->created = strtotime($created); $this->created = empty($created)?0:strtotime($created);
$this->likes = $likes; $this->likes = $likes;
$this->views = $views; $this->views = $views;
$this->videos_id = $videos_id; $this->videos_id = $videos_id;
@ -38,7 +38,7 @@ class PlayListElement {
} }
function getPlayListThumbnail() { function getPlayListThumbnail() {
return $this->playListThumbnail; return $this->thumbnail;
} }
function setName($name) { function setName($name) {
@ -133,7 +133,7 @@ class PlayListElement {
class playListSource { class playListSource {
public $src, $type; public $src, $type, $label;
function __construct($src, $youtube = false) { function __construct($src, $youtube = false) {
$this->src = $src; $this->src = $src;

View file

@ -8,6 +8,8 @@ require_once $global['systemRootPath'] . 'plugin/PlayLists/Objects/Playlists_sch
require_once $global['systemRootPath'] . 'plugin/PlayLists/PlayListElement.php'; require_once $global['systemRootPath'] . 'plugin/PlayLists/PlayListElement.php';
class PlayLists extends PluginAbstract { class PlayLists extends PluginAbstract {
const PERMISSION_CAN_MANAGE_ALL_PLAYLISTS = 0;
public function getTags() { public function getTags() {
return array( return array(
@ -30,6 +32,33 @@ class PlayLists extends PluginAbstract {
return "plist12345-370-4b1f-977a-fd0e5cabtube"; return "plist12345-370-4b1f-977a-fd0e5cabtube";
} }
function getPermissionsOptions():array {
$permissions = array();
$permissions[] = new PluginPermissionOption(self::PERMISSION_CAN_MANAGE_ALL_PLAYLISTS, __("Can Manage All Playlists"), __("Can Manage All Playlists"), 'PlayLists');
return $permissions;
}
static function canManageAllPlaylists():bool {
if(User::isAdmin()){
return true;
}
return Permissions::hasPermission(self::PERMISSION_CAN_MANAGE_ALL_PLAYLISTS, 'PlayLists');
}
static function canManagePlaylist($playlists_id) {
if (!User::isLogged()) {
return false;
}
if (self::canManageAllPlaylists()) {
return true;
}
$pl = new PlayList($playlists_id);
if ($pl->getUsers_id() == User::getId()) {
return true;
}
return false;
}
public function getPluginVersion() { public function getPluginVersion() {
return "1.0"; return "1.0";
} }
@ -564,20 +593,6 @@ class PlayLists extends PluginAbstract {
return !empty($obj->showTVFeatures); return !empty($obj->showTVFeatures);
} }
static function canManagePlaylist($playlists_id) {
if (!User::isLogged()) {
return false;
}
if (User::isAdmin()) {
return true;
}
$pl = new PlayList($playlists_id);
if ($pl->getUsers_id() == User::getId()) {
return true;
}
return false;
}
static function getShowOnTVSwitch($playlists_id) { static function getShowOnTVSwitch($playlists_id) {
if (!self::showTVFeatures()) { if (!self::showTVFeatures()) {
return ""; return "";
@ -1002,9 +1017,10 @@ class PlayListPlayer {
$playListData = array(); $playListData = array();
} }
foreach ($this->videos as $key => $video) { foreach ($this->videos as $key => $video) {
if ($video['type'] === 'embed') { if ($video['type'] === 'embed') {
$sources[0]['type'] = 'video'; $sources[0]['type'] = 'video';
$sources[0]['url'] = $video["videoLink"]; $sources[0]['url'] = @$video["videoLink"];
} else { } else {
$sources = getVideosURL($video['filename']); $sources = getVideosURL($video['filename']);
} }
@ -1027,7 +1043,7 @@ class PlayListPlayer {
$messagesFromPlayList[] = "videos_id={$video['videos_id']} empty playlist source "; $messagesFromPlayList[] = "videos_id={$video['videos_id']} empty playlist source ";
continue; continue;
} }
$playListData[] = new PlayListElement($video['title'], $video['description'], $video['duration'], $playListSources, $thumbnail, $images->poster, parseDurationToSeconds(@$externalOptions->videoStartSeconds), @$video['created'], $video['likes'], $video['views_count'], $video['videos_id']); $playListData[] = new PlayListElement($video['title'], $video['description'], @$video['duration'], $playListSources, $thumbnail, $images->poster, parseDurationToSeconds(@$externalOptions->videoStartSeconds), @$video['created'], @$video['likes'], @$video['views_count'], $video['videos_id']);
} }
return $playListData; return $playListData;
} }

View file

@ -9,8 +9,6 @@ $program = PlayList::getFromDbFromId($playlists_id);
if(empty($program)){ if(empty($program)){
return; return;
} }
//var_dump($playlists_id, $program);
$isMyChannel = $program['users_id'] == User::getId();
$playListButtons = AVideoPlugin::getPlayListButtons($playlists_id); $playListButtons = AVideoPlugin::getPlayListButtons($playlists_id);
$link = PlayLists::getLink($program['id']); $link = PlayLists::getLink($program['id']);
@ -28,7 +26,7 @@ if (empty($isASerie)) {
<?php echo $playListButtons; ?> <?php echo $playListButtons; ?>
<?php <?php
echo PlayLists::getPlayLiveButton($program['id']); echo PlayLists::getPlayLiveButton($program['id']);
if ($isMyChannel) { if (PlayLists::canManagePlaylist($playlists_id)) {
?> ?>
<script> <script>
$(function () { $(function () {

View file

@ -7,405 +7,435 @@ require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isLogged()) { if (!User::isLogged()) {
gotToLoginAndComeBackHere(''); gotToLoginAndComeBackHere('');
} }
$users_id = User::getId(); function getPlaylistOwnerUsersId(){
if(User::isAdmin() && !empty($_REQUEST['users_id'])){ if(!empty($_REQUEST['PlaylistOwnerUsersId'])){
$users_id = $_REQUEST['users_id']; return intval($_REQUEST['PlaylistOwnerUsersId']);
}else if (User::isAdmin() && !empty($_REQUEST['users_id'])) {
return intval($_REQUEST['users_id']);
}
return User::getId();
} }
$users_id = getPlaylistOwnerUsersId();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?php echo getLanguage(); ?>"> <html lang="<?php echo getLanguage(); ?>">
<head>
<title><?php echo __("Users") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
include $global['systemRootPath'] . 'view/managerUsers_head.php';
?>
<style>
.playLists li{
min-height: 45px;
}
.playLists .list-group{
height: 221px;
overflow: auto;
}
.videoTitle.ellipsis{ <head>
width: calc(100% - 90px); <title><?php echo __("Users") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
float: left; <?php
} include $global['systemRootPath'] . 'view/include/head.php';
include $global['systemRootPath'] . 'view/managerUsers_head.php';
?>
<style>
.playLists li {
min-height: 45px;
}
.playLists .tab-content{ .playLists .list-group {
min-height: 250px; height: 221px;
} overflow: auto;
}
.playLists { .videoTitle.ellipsis {
min-height: 330px; width: calc(100% - 90px);
} float: left;
.pl .panel-footer{ }
min-height: 42px;
}
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<br>
<div class="panel"> .playLists .tab-content {
<div class="panel-heading"> min-height: 250px;
<ul class="nav nav-tabs"> }
<li class="active pl_filter" onclick="pl_filter('all', $(this));" data-toggle="tooltip"
title="<?php echo __('Show all types'); ?>">
<a href="#"><i class="fas fa-layer-group"></i>
<i class="fas fa-list"></i>
<i class="fas fa-film"></i> <?php echo __('All'); ?></a></li>
<li class="pl_filter" onclick="pl_filter('serie', $(this));" data-toggle="tooltip"
title="<?php echo __('Show all programs that are listed in your video library'); ?>">
<a href="#"><span class="label label-success"><i class="fas fa-list"></i>
<?php echo __('Series'); ?></span></a></li>
<li class="pl_filter" onclick="pl_filter('collection', $(this));" data-toggle="tooltip"
title="<?php echo __('Show all that is a collection of programs'); ?>">
<a href="#"><span class="label label-primary"><i class="fas fa-layer-group"></i>
<?php echo __('Collections'); ?></span></a></li>
<li class="pl_filter" onclick="pl_filter('videos', $(this));" data-toggle="tooltip"
title="<?php echo __('Show all that include a list of videos'); ?>">
<a href="#"><span class="label label-default"><i class="fas fa-film"></i>
<?php echo __('Videos'); ?></span></a></li>
<li class="pull-right" >
<button type="button" class="btn btn-default pull-right" data-toggle="tooltip" title="<?php echo __('New'); ?>"
onclick="createNewProgram();" >
<i class="fas fa-plus"></i>
</button>
</li>
</ul>
</div>
<div class="panel-body">
<div class="row">
<?php
$pl = PlayList::getAllFromUser($users_id, false);
$count = 0;
foreach ($pl as $value) {
$count++;
//var_dump($value);
$rowsSubPlaylists = PlayList::getAllSubPlayLists($value["id"]); .playLists {
$totalSubPlaylists = count($rowsSubPlaylists); min-height: 330px;
}
.pl .panel-footer {
min-height: 42px;
}
</style>
</head>
$rowsNOTSubPlaylists = PlayList::getAllNOTSubPlayLists($value["id"]); <body class="<?php echo $global['bodyClass']; ?>">
$totalNOTSubPlaylists = count($rowsNOTSubPlaylists); <?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<br>
$classes = array(); <div class="panel">
$isASerie = PlayLists::isPlayListASerie($value["id"]); <div class="panel-heading">
if ($isASerie) { <ul class="nav nav-tabs">
$classes[] = 'pl_serie'; <li class="active pl_filter" onclick="pl_filter('all', $(this));" data-toggle="tooltip" title="<?php echo __('Show all types'); ?>">
} <a href="#"><i class="fas fa-layer-group"></i>
if ($totalSubPlaylists) { <i class="fas fa-list"></i>
$classes[] = 'pl_collection'; <i class="fas fa-film"></i> <?php echo __('All'); ?></a>
} </li>
if ($totalNOTSubPlaylists) { <li class="pl_filter" onclick="pl_filter('serie', $(this));" data-toggle="tooltip" title="<?php echo __('Show all programs that are listed in your video library'); ?>">
$classes[] = 'pl_videos'; <a href="#"><span class="label label-success"><i class="fas fa-list"></i>
} <?php echo __('Series'); ?></span></a>
$durationInSeconds = 0; </li>
?> <li class="pl_filter" onclick="pl_filter('collection', $(this));" data-toggle="tooltip" title="<?php echo __('Show all that is a collection of programs'); ?>">
<div class="col-sm-6 col-md-4 col-lg-3 pl pl<?php echo $value["id"]; ?> <?php echo implode(' ', $classes) ?>" > <a href="#"><span class="label label-primary"><i class="fas fa-layer-group"></i>
<div class="panel panel-<?php echo $totalSubPlaylists ? 'primary' : 'default'; ?>"> <?php echo __('Collections'); ?></span></a>
<div class="panel-heading"> </li>
<?php <li class="pl_filter" onclick="pl_filter('videos', $(this));" data-toggle="tooltip" title="<?php echo __('Show all that include a list of videos'); ?>">
if (!empty($totalSubPlaylists)) { <a href="#"><span class="label label-default"><i class="fas fa-film"></i>
echo '<i class="fas fa-layer-group"></i> '; <?php echo __('Videos'); ?></span></a>
} else { </li>
echo '<i class="fas fa-film"></i> '; <li class="pull-right">
} <button type="button" class="btn btn-default pull-right" data-toggle="tooltip" title="<?php echo __('New'); ?>" onclick="createNewProgram();">
echo $value['name_translated']; <i class="fas fa-plus"></i>
?> </button>
</li>
<div class="btn-group pull-right" playlists_id="<?php echo $value["id"]; ?>"> <?php
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" if (PlayLists::canManageAllPlaylists()) {
title="<?php echo __('Delete'); ?>" ?>
onclick="deleteProgram(<?php echo $value["id"]; ?>);" > <li class="pull-right">
<i class="fas fa-trash"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip"
title="<?php echo __('Play'); ?>" onclick="avideoModalIframe('<?php echo PlayLists::getLink($value["id"], true); ?>');" >
<i class="fas fa-play"></i>
</button>
<button type="button" class="btn btn-default btn-xs editBtn " onclick="editPlayList(<?php echo $value["id"]; ?>);" data-toggle="tooltip"
title="<?php echo __('Edit'); ?>" >
<i class="fas fa-edit"></i>
</button>
</div>
</div>
<div class="panel-body playLists">
<ul class="nav nav-tabs">
<?php
$active = 'active';
if (!empty($totalSubPlaylists)) {
?>
<li class="<?php echo $active; ?>">
<a data-toggle="tab" href="#seasons<?php echo $value["id"]; ?>"><i class="fas fa-list"></i> <?php echo __('Seasons'); ?>
<span class="badge" id="badge_playlists_id_<?php echo $value["id"]; ?>">
<?php
echo $totalSubPlaylists;
?>
</span>
</a>
</li>
<?php
$active = '';
}
if (!empty($totalNOTSubPlaylists)) {
?>
<li class="<?php echo $active; ?>">
<a data-toggle="tab" href="#videos<?php echo $value["id"]; ?>"><i class="fas fa-video"></i> <?php echo __('Videos'); ?>
<span class="badge" id="badge_playlists_id_<?php echo $value["id"]; ?>">
<?php
echo $totalNOTSubPlaylists;
?>
</span>
</a>
</li>
<?php
$active = '';
}
?>
</ul>
<div class="tab-content">
<?php
$active = ' in active';
if (!empty($totalSubPlaylists)) {
?>
<div id="seasons<?php echo $value["id"]; ?>" class="tab-pane fade <?php echo $active; ?>">
<ul class="list-group">
<?php
if ($totalSubPlaylists > 0) {
foreach ($rowsSubPlaylists as $row) {
$durationInSeconds += durationToSeconds($row["duration"]);
?>
<li class="list-group-item" id="videos_id_<?php echo $row["id"]; ?>_playlists_id_<?php echo $value["id"]; ?>">
<div class="ellipsis videoTitle">
<?php
echo $row['title'];
?>
</div>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Remove Serie'); ?>" onclick="removeFromSerie(<?php echo $value["id"]; ?>, <?php echo $row["id"]; ?>);" >
<i class="fas fa-trash"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Play Video'); ?>" onclick="avideoModalIframe('<?php echo Video::getPermaLink($row["id"], true); ?>');" >
<i class="fas fa-play"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Edit Video'); ?>" onclick="avideoModalIframe(webSiteRootURL+'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $row['id']; ?>');" >
<i class="fas fa-edit"></i>
</button>
</li>
<?php
}
}
?>
</ul>
</div>
<?php
$active = '';
}
if (!empty($totalNOTSubPlaylists)) {
?>
<div id="videos<?php echo $value["id"]; ?>" class="tab-pane fade <?php echo $active; ?>">
<ul class="list-group">
<?php
foreach ($rowsNOTSubPlaylists as $row) {
if ($totalNOTSubPlaylists > 0) {
$durationInSeconds += durationToSeconds($row["duration"]);
?>
<li class="list-group-item" id="videos_id_<?php echo $row["id"]; ?>_playlists_id_<?php echo $value["id"]; ?>">
<div class="ellipsis videoTitle">
<?php
echo $row['title'];
?>
</div>
<button type="button" class="btn btn-default btn-xs pull-right"
data-toggle="tooltip" title="<?php echo __('Remove Video'); ?>"
onclick="removeFromSerie(<?php echo $value["id"]; ?>, <?php echo $row["id"]; ?>);" >
<i class="fas fa-trash"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right"
data-toggle="tooltip" title="<?php echo __('Play Video'); ?>"
onclick="avideoModalIframe('<?php echo Video::getPermaLink($row["id"], true); ?>');" >
<i class="fas fa-play"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right"
data-toggle="tooltip" title="<?php echo __('Edit Video'); ?>"
onclick="avideoModalIframe(webSiteRootURL+'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $row['id']; ?>');" >
<i class="fas fa-edit"></i>
</button>
</li>
<?php
}
}
?>
</ul>
</div>
<?php
$active = '';
}
?>
</div>
</div>
<div class="panel-footer text-right">
<?php
if ($isASerie) {
echo '<div class="pull-left" style="margin-right:5px;">'.Video::getChangeVideoStatusButton($isASerie['id']).'</div> ';
echo '<span class="label label-success"><i class="fas fa-list"></i> ' . $isASerie['title'];
echo '</span>';
}
if ($totalSubPlaylists) {
echo '<span class="label label-primary"><i class="fas fa-layer-group"></i> ' . __('Collections') . '</span>';
}
if ($totalNOTSubPlaylists) {
echo '<span class="label label-default"><i class="fas fa-film"></i> ' . __('Videos') . '</span>';
}
echo '<span class="label label-default"><i class="far fa-clock"></i> ' . seconds2human($durationInSeconds) . '</span>';
?>
</div>
</div>
</div>
<?php <?php
} if (PlayLists::canManageAllPlaylists()) {
if (empty($count)) { $autocomplete = Layout::getUserAutocomplete(getPlaylistOwnerUsersId(), 'User_playlist_owner', array(), 'updatePlaylistOwner()');
}
?> ?>
<div class="col-sm-12"> </li>
<div class="alert alert-info"> <?php
<?php echo __('Sorry you do not have any playlist yet'); ?> }
?>
</ul>
</div>
<div class="panel-body">
<div class="row">
<?php
$pl = PlayList::getAllFromUser($users_id, false);
$count = 0;
foreach ($pl as $value) {
$count++;
//var_dump($value);
$rowsSubPlaylists = PlayList::getAllSubPlayLists($value["id"]);
$totalSubPlaylists = count($rowsSubPlaylists);
$rowsNOTSubPlaylists = PlayList::getAllNOTSubPlayLists($value["id"]);
$totalNOTSubPlaylists = count($rowsNOTSubPlaylists);
$classes = array();
$isASerie = PlayLists::isPlayListASerie($value["id"]);
if ($isASerie) {
$classes[] = 'pl_serie';
}
if ($totalSubPlaylists) {
$classes[] = 'pl_collection';
}
if ($totalNOTSubPlaylists) {
$classes[] = 'pl_videos';
}
$durationInSeconds = 0;
?>
<div class="col-sm-6 col-md-4 col-lg-3 pl pl<?php echo $value["id"]; ?> <?php echo implode(' ', $classes) ?>">
<div class="panel panel-<?php echo $totalSubPlaylists ? 'primary' : 'default'; ?>">
<div class="panel-heading">
<?php
if (!empty($totalSubPlaylists)) {
echo '<i class="fas fa-layer-group"></i> ';
} else {
echo '<i class="fas fa-film"></i> ';
}
echo $value['name_translated'];
?>
<div class="btn-group pull-right" playlists_id="<?php echo $value["id"]; ?>">
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Delete'); ?>" onclick="deleteProgram(<?php echo $value["id"]; ?>);">
<i class="fas fa-trash"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Play'); ?>" onclick="avideoModalIframe('<?php echo PlayLists::getLink($value["id"], true); ?>');">
<i class="fas fa-play"></i>
</button>
<button type="button" class="btn btn-default btn-xs editBtn " onclick="editPlayList(<?php echo $value["id"]; ?>);" data-toggle="tooltip" title="<?php echo __('Edit'); ?>">
<i class="fas fa-edit"></i>
</button>
</div>
</div>
<div class="panel-body playLists">
<ul class="nav nav-tabs">
<?php
$active = 'active';
if (!empty($totalSubPlaylists)) {
?>
<li class="<?php echo $active; ?>">
<a data-toggle="tab" href="#seasons<?php echo $value["id"]; ?>"><i class="fas fa-list"></i> <?php echo __('Seasons'); ?>
<span class="badge" id="badge_playlists_id_<?php echo $value["id"]; ?>">
<?php
echo $totalSubPlaylists;
?>
</span>
</a>
</li>
<?php
$active = '';
}
if (!empty($totalNOTSubPlaylists)) {
?>
<li class="<?php echo $active; ?>">
<a data-toggle="tab" href="#videos<?php echo $value["id"]; ?>"><i class="fas fa-video"></i> <?php echo __('Videos'); ?>
<span class="badge" id="badge_playlists_id_<?php echo $value["id"]; ?>">
<?php
echo $totalNOTSubPlaylists;
?>
</span>
</a>
</li>
<?php
$active = '';
}
?>
</ul>
<div class="tab-content">
<?php
$active = ' in active';
if (!empty($totalSubPlaylists)) {
?>
<div id="seasons<?php echo $value["id"]; ?>" class="tab-pane fade <?php echo $active; ?>">
<ul class="list-group">
<?php
if ($totalSubPlaylists > 0) {
foreach ($rowsSubPlaylists as $row) {
$durationInSeconds += durationToSeconds($row["duration"]);
?>
<li class="list-group-item" id="videos_id_<?php echo $row["id"]; ?>_playlists_id_<?php echo $value["id"]; ?>">
<div class="ellipsis videoTitle">
<?php
echo $row['title'];
?>
</div>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Remove Serie'); ?>" onclick="removeFromSerie(<?php echo $value["id"]; ?>, <?php echo $row["id"]; ?>);">
<i class="fas fa-trash"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Play Video'); ?>" onclick="avideoModalIframe('<?php echo Video::getPermaLink($row["id"], true); ?>');">
<i class="fas fa-play"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Edit Video'); ?>" onclick="avideoModalIframe(webSiteRootURL+'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $row['id']; ?>');">
<i class="fas fa-edit"></i>
</button>
</li>
<?php
}
}
?>
</ul>
</div>
<?php
$active = '';
}
if (!empty($totalNOTSubPlaylists)) {
?>
<div id="videos<?php echo $value["id"]; ?>" class="tab-pane fade <?php echo $active; ?>">
<ul class="list-group">
<?php
foreach ($rowsNOTSubPlaylists as $row) {
if ($totalNOTSubPlaylists > 0) {
$durationInSeconds += durationToSeconds($row["duration"]);
?>
<li class="list-group-item" id="videos_id_<?php echo $row["id"]; ?>_playlists_id_<?php echo $value["id"]; ?>">
<div class="ellipsis videoTitle">
<?php
echo $row['title'];
?>
</div>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Remove Video'); ?>" onclick="removeFromSerie(<?php echo $value["id"]; ?>, <?php echo $row["id"]; ?>);">
<i class="fas fa-trash"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Play Video'); ?>" onclick="avideoModalIframe('<?php echo Video::getPermaLink($row["id"], true); ?>');">
<i class="fas fa-play"></i>
</button>
<button type="button" class="btn btn-default btn-xs pull-right" data-toggle="tooltip" title="<?php echo __('Edit Video'); ?>" onclick="avideoModalIframe(webSiteRootURL+'view/managerVideosLight.php?avideoIframe=1&videos_id=<?php echo $row['id']; ?>');">
<i class="fas fa-edit"></i>
</button>
</li>
<?php
}
}
?>
</ul>
</div>
<?php
$active = '';
}
?>
</div>
</div>
<div class="panel-footer text-right">
<?php
if ($isASerie) {
echo '<div class="pull-left" style="margin-right:5px;">' . Video::getChangeVideoStatusButton($isASerie['id']) . '</div> ';
echo '<span class="label label-success"><i class="fas fa-list"></i> ' . $isASerie['title'];
echo '</span>';
}
if ($totalSubPlaylists) {
echo '<span class="label label-primary"><i class="fas fa-layer-group"></i> ' . __('Collections') . '</span>';
}
if ($totalNOTSubPlaylists) {
echo '<span class="label label-default"><i class="fas fa-film"></i> ' . __('Videos') . '</span>';
}
echo '<span class="label label-default"><i class="far fa-clock"></i> ' . seconds2human($durationInSeconds) . '</span>';
?>
</div> </div>
</div> </div>
<?php </div>
} <?php
?> if($count % 2 == 0){
echo '<div class="clearfix visible-sm"></div>';
}
if($count % 3 == 0){
echo '<div class="clearfix visible-md"></div>';
}
if($count % 4 == 0){
echo '<div class="clearfix visible-lg"></div>';
}
}
if (empty($count)) {
?>
<div class="col-sm-12">
<div class="alert alert-info">
<?php echo __('Sorry you do not have any playlist yet'); ?>
</div>
</div>
<?php
}
?>
</div>
</div> </div>
</div> </div>
</div> </div>
<?php </div>
include $global['systemRootPath'] . 'view/include/footer.php'; <?php
?> include $global['systemRootPath'] . 'view/include/footer.php';
<script> ?>
$(document).ready(function () { <script>
$(document).ready(function() {
}); });
function pl_filter(filter, t) { function updatePlaylistOwner(){
$('.pl_filter').removeClass('active'); modal.showPleaseWait();
t.addClass('active'); var url = window.location.href;
if (filter === 'all') { url = addQueryStringParameter(url, 'PlaylistOwnerUsersId', $('#User_playlist_owner').val());
$('.pl').show(); console.log('updatePlaylistOwner', url);
} else { window.location.href = url;
var selector = '.pl_' + filter; }
$(selector).show();
$('.pl').not(selector).hide(); function pl_filter(filter, t) {
} $('.pl_filter').removeClass('active');
t.addClass('active');
if (filter === 'all') {
$('.pl').show();
} else {
var selector = '.pl_' + filter;
$(selector).show();
$('.pl').not(selector).hide();
} }
}
function editPlayList(playlists_id) { function editPlayList(playlists_id) {
avideoModalIframe(webSiteRootURL + 'viewProgram/' + playlists_id); avideoModalIframe(webSiteRootURL + 'viewProgram/' + playlists_id);
} }
function removeFromSerie(playlists_id, videos_id) { function removeFromSerie(playlists_id, videos_id) {
swal({ swal({
title: "<?php echo __('Are you sure?'); ?>", title: "<?php echo __('Are you sure?'); ?>",
text: "<?php echo __('You will not be able to recover this action!'); ?>", text: "<?php echo __('You will not be able to recover this action!'); ?>",
icon: "warning", icon: "warning",
buttons: true, buttons: true,
dangerMode: true, dangerMode: true,
}) })
.then(function (willDelete) { .then(function(willDelete) {
if (willDelete) { if (willDelete) {
addVideoToPlayList(videos_id, false, playlists_id); addVideoToPlayList(videos_id, false, playlists_id);
$('#videos_id_' + videos_id + '_playlists_id_' + playlists_id).fadeOut(); $('#videos_id_' + videos_id + '_playlists_id_' + playlists_id).fadeOut();
$('#badge_playlists_id_' + playlists_id).text(parseInt($('#badge_playlists_id_' + playlists_id).text()) - 1); $('#badge_playlists_id_' + playlists_id).text(parseInt($('#badge_playlists_id_' + playlists_id).text()) - 1);
} else { } else {
}
});
}
function deleteProgram(playlists_id) {
swal({
title: "<?php echo __('Are you sure?'); ?>",
text: "<?php echo __('You will not be able to recover this action!'); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then(function (willDelete) {
if (willDelete) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/playlistRemove.php',
data: {
"playlist_id": playlists_id
},
type: 'post',
success: function (response) {
$('.pl' + playlists_id).fadeOut();
modal.hidePleaseWait();
avideoToastSuccess('<?php echo __('Deleted'); ?>');
}
});
} else {
}
});
}
function createNewProgram() {
swal({
title: "<?php echo __('New program'); ?>",
text: "<?php echo __('Type your program title'); ?>",
content: {
element: "input",
attributes: {
placeholder: "<?php echo __('Program title'); ?>",
type: "text",
},
},
showCancelButton: true,
closeOnConfirm: true,
inputPlaceholder: "<?php echo __('Program title'); ?>"
}).then((inputValue) => {
if (inputValue === false)
return false;
if (inputValue === "") {
swal.showInputError("<?php echo __('Please provide a title'); ?>");
return false
} }
$.ajax({
url: webSiteRootURL + 'objects/playlistAddNew.json.php',
method: 'POST',
data: {
'status': "public",
'name': inputValue
},
success: function (response) {
if (response.status > 0) {
location.reload();
} else {
modal.hidePleaseWait();
}
}
});
}); });
} }
</script>
</body> function deleteProgram(playlists_id) {
</html> swal({
title: "<?php echo __('Are you sure?'); ?>",
text: "<?php echo __('You will not be able to recover this action!'); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then(function(willDelete) {
if (willDelete) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/playlistRemove.php',
data: {
"playlist_id": playlists_id
},
type: 'post',
success: function(response) {
$('.pl' + playlists_id).fadeOut();
modal.hidePleaseWait();
avideoToastSuccess('<?php echo __('Deleted'); ?>');
}
});
} else {
}
});
}
function createNewProgram() {
swal({
title: "<?php echo __('New program'); ?>",
text: "<?php echo __('Type your program title'); ?>",
content: {
element: "input",
attributes: {
placeholder: "<?php echo __('Program title'); ?>",
type: "text",
},
},
showCancelButton: true,
closeOnConfirm: true,
inputPlaceholder: "<?php echo __('Program title'); ?>"
}).then((inputValue) => {
if (inputValue === false)
return false;
if (inputValue === "") {
swal.showInputError("<?php echo __('Please provide a title'); ?>");
return false
}
$.ajax({
url: webSiteRootURL + 'objects/playlistAddNew.json.php',
method: 'POST',
data: {
'status': "public",
'name': inputValue
},
success: function(response) {
if (response.status > 0) {
location.reload();
} else {
modal.hidePleaseWait();
}
}
});
});
}
</script>
</body>
</html>

View file

@ -38,438 +38,439 @@ $playListsObj = AVideoPlugin::getObjectData("PlayLists");
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?php echo getLanguage(); ?>"> <html lang="<?php echo getLanguage(); ?>">
<head>
<title><?php echo __("Program") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title> <head>
<?php <title><?php echo __("Program") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
include $global['systemRootPath'] . 'view/include/head.php'; <?php
?> include $global['systemRootPath'] . 'view/include/head.php';
<style> ?>
.galleryVideo .panel{ <style>
border-color: transparent; .galleryVideo .panel {
box-shadow: none; border-color: transparent;
} box-shadow: none;
.galleryVideo .panel .panel-body {
padding: 5px;
}
</style>
<?php
if (!empty($videos_id)) {
getOpenGraph($videos_id);
} }
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>"> .galleryVideo .panel .panel-body {
padding: 5px;
}
</style>
<?php
if (!empty($videos_id)) {
getOpenGraph($videos_id);
}
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid gallery">
<?php <?php
include $global['systemRootPath'] . 'view/include/navbar.php'; $channelName = @$_GET['channelName'];
?> unset($_GET['channelName']);
<div class="container-fluid gallery"> $startC = microtime(true);
<?php foreach ($programs as $key => $program) {
$channelName = @$_GET['channelName']; @$timesC[__LINE__] += microtime(true) - $startC;
unset($_GET['channelName']); $startC = microtime(true);
$videosArrayId = PlayList::getVideosIdFromPlaylist($program['id']);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
if (empty($videosArrayId) && ($program['status'] == "favorite" || $program['status'] == "watch_later")) {
unset($programs[$key]);
continue;
} elseif (empty($videosArrayId)) {
$videosP = [];
} else {
$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
} //var_dump($videosArrayId, $videosP);exit;
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//_error_log("channelPlaylist videosP: ".json_encode($videosP));
$videosP = PlayList::sortVideos($videosP, $videosArrayId);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//_error_log("channelPlaylist videosP2: ".json_encode($videosP));
//_error_log("channelPlaylist videosArrayId: ".json_encode($videosArrayId));
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true); $startC = microtime(true);
foreach ($programs as $key => $program) {
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
$videosArrayId = PlayList::getVideosIdFromPlaylist($program['id']);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
if (empty($videosArrayId) && ($program['status'] == "favorite" || $program['status'] == "watch_later")) {
unset($programs[$key]);
continue;
} elseif (empty($videosArrayId)) {
$videosP = [];
} else {
$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
}//var_dump($videosArrayId, $videosP);exit;
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//_error_log("channelPlaylist videosP: ".json_encode($videosP));
$videosP = PlayList::sortVideos($videosP, $videosArrayId);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//_error_log("channelPlaylist videosP2: ".json_encode($videosP));
//_error_log("channelPlaylist videosArrayId: ".json_encode($videosArrayId));
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
?>
<br>
<div class="panel panel-default program" playListId="<?php echo $program['id']; ?>">
<div class="panel-heading">
<strong class="playlistName"><?php echo $program['name']; ?> </strong>
<?php
PlayLists::getPLButtons($program['id'], false);
?>
</div>
?>
<br>
<div class="panel panel-default program" playListId="<?php echo $program['id']; ?>">
<div class="panel-heading">
<strong class="playlistName"><?php echo $program['name']; ?> </strong>
<?php <?php
if (!empty($videosArrayId)) { PlayLists::getPLButtons($program['id'], false);
?>
</div>
<?php
if (!empty($videosArrayId)) {
?>
<div class="panel-body">
<?php
$_REQUEST['user_id'] = $program['users_id'];
$_REQUEST['playlists_id'] = $program['id'];
include $global['systemRootPath'] . 'plugin/PlayLists/epg.html.php';
?> ?>
<div id="sortable<?php echo $program['id']; ?>" style="list-style: none;">
<div class="panel-body">
<?php <?php
$_REQUEST['user_id'] = $program['users_id']; $count = 0;
$_REQUEST['playlists_id'] = $program['id']; $realCount = 0;
include $global['systemRootPath'] . 'plugin/PlayLists/epg.html.php'; foreach ($videosP as $value) {
$episodeLink = "{$global['webSiteRootURL']}program/{$program['id']}/{$count}";
$count++;
if (empty($value['created'])) {
continue;
}
$realCount++;
$img_portrait = ($value['rotation'] === "90" || $value['rotation'] === "270") ? "img-portrait" : "";
$name = User::getNameIdentificationById($value['users_id']);
$class = '';
$style = '';
if ($count > 6) {
$class = "showMoreLess{$program['id']}";
$style = "display: none;";
}
?> ?>
<div id="sortable<?php echo $program['id']; ?>" style="list-style: none;"> <li class="col-lg-2 col-md-4 col-sm-4 col-xs-6 galleryVideo showMoreLess <?php echo $class; ?> " id="<?php echo $value['id']; ?>" style="padding: 1px; <?php echo $style; ?>">
<?php <div class="panel panel-default" playListId="<?php echo $program['id']; ?>" style="min-height: 215px;">
$count = 0; <div class="panel-body" style="overflow: hidden;">
$realCount = 0; <?php
foreach ($videosP as $value) { echo Video::getVideoImagewithHoverAnimationFromVideosId($value);
$episodeLink = "{$global['webSiteRootURL']}program/{$program['id']}/{$count}"; ?>
$count++; <a class="h6 galleryLink hrefLink" href="<?php echo $episodeLink; ?>" title="<?php echo getSEOTitle($value['title']); ?>">
if (empty($value['created'])) { <strong class="title"><?php echo getSEOTitle($value['title']); ?></strong>
continue; </a>
} <div class="galeryDetails" style="min-height: 60px;">
$realCount++; <div class="galleryTags">
$img_portrait = ($value['rotation'] === "90" || $value['rotation'] === "270") ? "img-portrait" : ""; <?php
$name = User::getNameIdentificationById($value['users_id']); $value['tags'] = Video::getTags($value['id']);
foreach ($value['tags'] as $value2) {
$class = ''; if (is_array($value2)) {
$style = ''; $value2 = (object) $value2;
if ($count > 6) {
$class = "showMoreLess{$program['id']}";
$style = "display: none;";
}
?>
<li class="col-lg-2 col-md-4 col-sm-4 col-xs-6 galleryVideo showMoreLess <?php echo $class; ?> " id="<?php echo $value['id']; ?>" style="padding: 1px; <?php echo $style; ?>">
<div class="panel panel-default" playListId="<?php echo $program['id']; ?>" style="min-height: 215px;">
<div class="panel-body" style="overflow: hidden;">
<?php
echo Video::getVideoImagewithHoverAnimationFromVideosId($value);
?>
<a class="h6 galleryLink hrefLink" href="<?php echo $episodeLink; ?>" title="<?php echo getSEOTitle($value['title']); ?>">
<strong class="title"><?php echo getSEOTitle($value['title']); ?></strong>
</a>
<div class="galeryDetails" style="min-height: 60px;">
<div class="galleryTags">
<?php
$value['tags'] = Video::getTags($value['id']);
foreach ($value['tags'] as $value2) {
if (is_array($value2)) {
$value2 = (object) $value2;
}
if ($value2->label === __("Group")) {
?>
<span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span>
<?php
}
} }
?> if ($value2->label === __("Group")) {
</div>
<?php
if (empty($advancedCustom->doNotDisplayViews)) {
?>
<div>
<i class="fa fa-eye"></i>
<span itemprop="interactionCount">
<?php echo number_format($value['views_count'], 0); ?> <?php echo __("Views"); ?>
</span>
</div>
<?php }
?> ?>
<span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($value['videoCreation']), 0, true,true); ?>
</div>
<div>
<i class="fa fa-user"></i>
<?php echo $name; ?>
</div>
<?php <?php
if (Video::canEdit($value['id'])) { }
?> }
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>mvideos?video_id=<?php echo $value['id']; ?>"><i class="fa fa-edit"></i> <?php echo __("Edit Video"); ?></a>
</div>
<?php }
?>
<?php
if ($isMyChannel) {
?>
<div>
<span style=" cursor: pointer;" class="btn-link text-primary removeVideo" playlist_id="<?php echo $program['id']; ?>" video_id="<?php echo $value['id']; ?>">
<i class="fa fa-trash"></i> <?php echo __("Remove"); ?>
</span>
</div>
<div>
<span playlist_id="<?php echo $program['id']; ?>" video_id="<?php echo $value['id']; ?>">
<i class="fas fa-sort-numeric-down"></i> <?php echo __("Sort"); ?>
<input type="number" step="1" class="video_order" value="<?php echo intval($program['videos'][$count - 1]['video_order']); ?>" style="max-width: 50px;">
<button class="btn btn-sm btn-xs sortNow"><i class="fas fa-check-square"></i></button>
</span>
</div>
<?php }
?> ?>
</div> </div>
<?php
if (empty($advancedCustom->doNotDisplayViews)) {
?>
<div>
<i class="fa fa-eye"></i>
<span itemprop="interactionCount">
<?php echo number_format($value['views_count'], 0); ?> <?php echo __("Views"); ?>
</span>
</div>
<?php }
?>
<div>
<i class="far fa-clock"></i>
<?php echo humanTiming(strtotime($value['videoCreation']), 0, true, true); ?>
</div>
<div>
<i class="fa fa-user"></i>
<?php echo $name; ?>
</div>
<?php
if (Video::canEdit($value['id'])) {
?>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>mvideos?video_id=<?php echo $value['id']; ?>"><i class="fa fa-edit"></i> <?php echo __("Edit Video"); ?></a>
</div>
<?php }
?>
<?php
if ($isMyChannel) {
?>
<div>
<span style=" cursor: pointer;" class="btn-link text-primary removeVideo" playlist_id="<?php echo $program['id']; ?>" video_id="<?php echo $value['id']; ?>">
<i class="fa fa-trash"></i> <?php echo __("Remove"); ?>
</span>
</div>
<div>
<span playlist_id="<?php echo $program['id']; ?>" video_id="<?php echo $value['id']; ?>">
<i class="fas fa-sort-numeric-down"></i> <?php echo __("Sort"); ?>
<input type="number" step="1" class="video_order" value="<?php echo empty($program['videos'][$count - 1]) ? 0 : intval(@$program['videos'][$count - 1]['video_order']); ?>" style="max-width: 50px;">
<button class="btn btn-sm btn-xs sortNow"><i class="fas fa-check-square"></i></button>
</span>
</div>
<?php }
?>
</div> </div>
</div> </div>
</li> </div>
<?php </li>
if ($realCount % 6 === 0) {
echo '<div class="clearfix hidden-md hidden-sm hidden-xs"></div>';
}
if ($realCount % 3 === 0) {
echo '<div class="clearfix hidden-lg hidden-xs"></div>';
}
if ($realCount % 2 === 0) {
echo '<div class="clearfix hidden-md hidden-sm hidden-lg"></div>';
}
}
?>
</div>
</div>
<div class="panel-footer">
<?php <?php
if (count($programs) > 1) { if ($realCount % 6 === 0) {
?> echo '<div class="clearfix hidden-md hidden-sm hidden-xs"></div>';
<button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle(); }
$('.<?php echo $class; ?>').slideDown();"><i class="fas fa-angle-down"></i> <?php echo __('Show More'); ?></button> if ($realCount % 3 === 0) {
<button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle(); echo '<div class="clearfix hidden-lg hidden-xs"></div>';
$('.<?php echo $class; ?>').slideUp();" style="display: none;"><i class="fas fa-angle-up"></i> <?php echo __('Show Less'); ?></button> }
<?php if ($realCount % 2 === 0) {
} echo '<div class="clearfix hidden-md hidden-sm hidden-lg"></div>';
if ($isMyChannel && !empty($videosArrayId)) { }
?> }
<span class="label label-info" ><i class="fa fa-info-circle"></i> <?php echo __("Drag and drop to sort"); ?></span>
<?php }
?> ?>
</div> </div>
<?php } </div>
?>
</div> <div class="panel-footer">
<?php <?php
if (count($programs) > 1) {
?>
<button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle();
$('.<?php echo $class; ?>').slideDown();"><i class="fas fa-angle-down"></i> <?php echo __('Show More'); ?></button>
<button class="btn btn-default btn-xs btn-sm showMoreLessBtn showMoreLessBtn<?php echo $program['id']; ?>" onclick="$('.showMoreLessBtn<?php echo $program['id']; ?>').toggle();
$('.<?php echo $class; ?>').slideUp();" style="display: none;"><i class="fas fa-angle-up"></i> <?php echo __('Show Less'); ?></button>
<?php
}
if ($isMyChannel && !empty($videosArrayId)) {
?>
<span class="label label-info"><i class="fa fa-info-circle"></i> <?php echo __("Drag and drop to sort"); ?></span>
<?php }
?>
</div>
<?php }
?>
</div>
<?php
}
$_GET['channelName'] = $channelName;
?>
<script>
var timoutembed;
function setTextEmbedCopied() {
clearTimeout(timoutembed);
$("#btnEmbedText").html("<?php echo __("Copied!"); ?>");
timoutembed = setTimeout(function() {
$("#btnEmbedText").html("<?php echo __("Copy embed code"); ?>");
}, 3000);
} }
$_GET['channelName'] = $channelName; function saveSortable($sortableObject, playlist_id) {
?> var list = $($sortableObject).sortable("toArray");
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php',
data: {
"list": list,
"playlist_id": playlist_id
},
type: 'post',
success: function(response) {
//$("#channelPlaylists").load(webSiteRootURL + "view/channelPlaylist.php?channelName=" + channelName);
modal.hidePleaseWait();
}
});
}
<script> function sortNow($t, position) {
var $this = $($t).closest('.galleryVideo');
var timoutembed; var $uiDiv = $($t).closest('.ui-sortable');
function setTextEmbedCopied() { var $playListId = $($t).closest('.panel').attr('playListId');
clearTimeout(timoutembed); var $list = $($t).closest('.ui-sortable').find('li');
$("#btnEmbedText").html("<?php echo __("Copied!"); ?>"); if (position < 0) {
timoutembed = setTimeout(function () { return false;
$("#btnEmbedText").html("<?php echo __("Copy embed code"); ?>");
}, 3000);
} }
if (position === 0) {
$this.slideUp(500, function() {
$this.insertBefore($this.siblings(':eq(0)'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
} else if ($list.length - 1 > position) {
$this.slideUp(500, function() {
$this.insertBefore($this.siblings(':eq(' + position + ')'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
} else {
$this.slideUp(500, function() {
$this.insertAfter($this.siblings(':eq(' + ($list.length - 2) + ')'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
}
}
function saveSortable($sortableObject, playlist_id) { var currentObject;
var list = $($sortableObject).sortable("toArray"); $(function() {
<?php
if (count($programs) <= 1 || !empty($palyListsObj->expandPlayListOnChannels)) {
?>
$('.showMoreLess').slideDown();
$('.showMoreLessBtn').toggle();
<?php
}
?>
$('.removeVideo').click(function() {
currentObject = this;
swal({
title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then(function(willDelete) {
if (willDelete) {
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
var video_id = $(currentObject).attr('video_id');
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemoveVideo.php',
data: {
"playlist_id": playlist_id,
"video_id": video_id
},
type: 'post',
success: function(response) {
reloadPlayLists();
$(".playListsIds" + video_id).prop("checked", false);
$(currentObject).closest('.galleryVideo').fadeOut();
modal.hidePleaseWait();
}
});
}
});
});
$('.deletePlaylist').click(function() {
currentObject = this;
swal({
title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then(function(willDelete) {
if (willDelete) {
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemove.php',
data: {
"playlist_id": playlist_id
},
type: 'post',
success: function(response) {
$(currentObject).closest('.panel').slideUp();
modal.hidePleaseWait();
}
});
}
});
});
$('.statusPlaylist').click(function() {
var playlist_id = $(this).attr('playlist_id');
var status = "public";
if ($('#statusPrivate' + playlist_id).is(":visible")) {
status = "public";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusPublic' + playlist_id).fadeIn();
} else if ($('#statusPublic' + playlist_id).is(":visible")) {
status = "unlisted";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusUnlisted' + playlist_id).fadeIn();
} else if ($('#statusUnlisted' + playlist_id).is(":visible")) {
status = "private";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusPrivate' + playlist_id).fadeIn();
}
modal.showPleaseWait();
console.log(playlist_id);
$.ajax({ $.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php', url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistStatus.php',
data: { data: {
"list": list, "playlist_id": playlist_id,
"playlist_id": playlist_id "status": status
}, },
type: 'post', type: 'post',
success: function (response) { success: function(response) {
//$("#channelPlaylists").load(webSiteRootURL + "view/channelPlaylist.php?channelName=" + channelName);
modal.hidePleaseWait(); modal.hidePleaseWait();
} }
}); });
}
function sortNow($t, position) {
var $this = $($t).closest('.galleryVideo');
var $uiDiv = $($t).closest('.ui-sortable');
var $playListId = $($t).closest('.panel').attr('playListId');
var $list = $($t).closest('.ui-sortable').find('li');
if (position < 0) {
return false;
}
if (position === 0) {
$this.slideUp(500, function () {
$this.insertBefore($this.siblings(':eq(0)'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
} else if ($list.length - 1 > position) {
$this.slideUp(500, function () {
$this.insertBefore($this.siblings(':eq(' + position + ')'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
} else {
$this.slideUp(500, function () {
$this.insertAfter($this.siblings(':eq(' + ($list.length - 2) + ')'));
saveSortable($uiDiv, $playListId);
}).slideDown(500);
}
}
var currentObject;
$(function () {
<?php
if (count($programs) <= 1 || !empty($palyListsObj->expandPlayListOnChannels)) {
?>
$('.showMoreLess').slideDown();
$('.showMoreLessBtn').toggle();
<?php
}
?>
$('.removeVideo').click(function () {
currentObject = this;
swal({
title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then(function (willDelete) {
if (willDelete) {
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
var video_id = $(currentObject).attr('video_id');
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemoveVideo.php',
data: {
"playlist_id": playlist_id,
"video_id": video_id
},
type: 'post',
success: function (response) {
reloadPlayLists();
$(".playListsIds" + video_id).prop("checked", false);
$(currentObject).closest('.galleryVideo').fadeOut();
modal.hidePleaseWait();
}
});
}
});
});
$('.deletePlaylist').click(function () {
currentObject = this;
swal({
title: "<?php echo __("Are you sure?"); ?>",
text: "<?php echo __("You will not be able to recover this action!"); ?>",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then(function (willDelete) {
if (willDelete) {
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistRemove.php',
data: {
"playlist_id": playlist_id
},
type: 'post',
success: function (response) {
$(currentObject).closest('.panel').slideUp();
modal.hidePleaseWait();
}
});
}
});
});
$('.statusPlaylist').click(function () {
var playlist_id = $(this).attr('playlist_id');
var status = "public";
if ($('#statusPrivate' + playlist_id).is(":visible")) {
status = "public";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusPublic' + playlist_id).fadeIn();
} else if ($('#statusPublic' + playlist_id).is(":visible")) {
status = "unlisted";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusUnlisted' + playlist_id).fadeIn();
} else if ($('#statusUnlisted' + playlist_id).is(":visible")) {
status = "private";
$('.statusPlaylist' + playlist_id + ' span').hide();
$('#statusPrivate' + playlist_id).fadeIn();
}
modal.showPleaseWait();
console.log(playlist_id);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/playlistStatus.php',
data: {
"playlist_id": playlist_id,
"status": status
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
$('.renamePlaylist').click(function () {
currentObject = this;
swal({
text: "<?php echo __("Change Playlist Name"); ?>!",
content: "input",
button: {
text: "<?php echo __("Confirm Playlist name"); ?>",
closeModal: false,
},
}).then(function (name) {
if (!name)
throw null;
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id);
return fetch('<?php echo $global['webSiteRootURL']; ?>objects/playlistRename.php?playlist_id=' + playlist_id + '&name=' + encodeURI(name));
}).then(function (results) {
return results.json();
}).then(function (response) {
if (response.error) {
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg, "error");
modal.hidePleaseWait();
} else {
$(currentObject).closest('.panel').find('.playlistName').text(response.name);
swal.stopLoading();
swal.close();
modal.hidePleaseWait();
}
}).catch(function (err) {
if (err) {
swal("Oh noes!", "The AJAX request failed!", "error");
} else {
swal.stopLoading();
swal.close();
}
modal.hidePleaseWait();
});
;
});
$('.sortNow').click(function () {
var $val = $(this).siblings("input").val();
sortNow(this, $val);
});
$('.video_order').keypress(function (e) {
if (e.which == 13) {
sortNow(this, $(this).val());
}
});
}); });
</script>
<!-- $('.renamePlaylist').click(function() {
currentObject = this;
swal({
text: "<?php echo __("Change Playlist Name"); ?>!",
content: "input",
button: {
text: "<?php echo __("Confirm Playlist name"); ?>",
closeModal: false,
},
}).then(function(name) {
if (!name)
throw null;
modal.showPleaseWait();
var playlist_id = $(currentObject).attr('playlist_id');
console.log(playlist_id);
return fetch('<?php echo $global['webSiteRootURL']; ?>objects/playlistRename.php?playlist_id=' + playlist_id + '&name=' + encodeURI(name));
}).then(function(results) {
return results.json();
}).then(function(response) {
if (response.error) {
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg, "error");
modal.hidePleaseWait();
} else {
$(currentObject).closest('.panel').find('.playlistName').text(response.name);
swal.stopLoading();
swal.close();
modal.hidePleaseWait();
}
}).catch(function(err) {
if (err) {
swal("Oh noes!", "The AJAX request failed!", "error");
} else {
swal.stopLoading();
swal.close();
}
modal.hidePleaseWait();
});;
});
$('.sortNow').click(function() {
var $val = $(this).siblings("input").val();
sortNow(this, $val);
});
$('.video_order').keypress(function(e) {
if (e.which == 13) {
sortNow(this, $(this).val());
}
});
});
</script>
<!--
channelPlaylist channelPlaylist
<?php <?php
$timesC[__LINE__] = microtime(true) - $startC; $timesC[__LINE__] = microtime(true) - $startC;
@ -479,10 +480,11 @@ if (count($programs) <= 1 || !empty($palyListsObj->expandPlayListOnChannels)) {
} }
?> ?>
--> -->
</div><!--/.container--> </div><!--/.container-->
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
</html> </html>

View file

@ -26,7 +26,7 @@ if (file_exists($extraPluginFile) && AVideoPlugin::isEnabledByName("Customize"))
TimeLogEnd($timeLogHead, __LINE__); TimeLogEnd($timeLogHead, __LINE__);
if (!empty($poster)) { if (!empty($poster)) {
$subTitle = str_replace(['"', "\n", "\r"], ["", "", ""], strip_tags($video['description'])); $subTitle = str_replace(['"', "\n", "\r"], ["", "", ""], strip_tags("{$video['description']}"));
$custom = []; $custom = [];
$custom[] = $subTitle; $custom[] = $subTitle;
if (!empty($video["category"])) { if (!empty($video["category"])) {

View file

@ -48,12 +48,12 @@ if (!empty($videoSerie)) {
echo $name; echo $name;
?> ?>
(<?php (<?php
echo User::getNameIdentificationById($users_id); echo User::getNameIdentificationById($users_id);
?>) ?>)
</h3> </h3>
<small> <small>
<?php <?php
echo($playlist_index + 1), "/", count($playlistVideos), " ", __("Videos"); echo ($playlist_index + 1), "/", count($playlistVideos), " ", __("Videos");
?> ?>
</small> </small>
</a> </a>
@ -73,29 +73,31 @@ if (!empty($videoSerie)) {
$indicator = '<span class="fa fa-play text-danger"></span>'; $indicator = '<span class="fa fa-play text-danger"></span>';
} ?> } ?>
<li class="<?php echo $class; ?>"> <li class="<?php echo $class; ?>">
<a href="<?php echo $global['webSiteRootURL']; ?>program/<?php echo $playlist_id; ?>/<?php echo $count . "/" . urlencode(cleanURLName($value["channelName"])) . "/" . urlencode(cleanURLName($playlist->getName())) . "/{$value['clean_title']}"; ?>" title="<?php echo $value['title']; ?>" class="videoLink row"> <a href="<?php echo $global['webSiteRootURL']; ?>program/<?php echo $playlist_id; ?>/<?php echo $count . "/" . urlencode(cleanURLName(@$value["channelName"])) . "/" . urlencode(cleanURLName($playlist->getName())) . "/".(@$value['clean_title']); ?>" title="<?php echo $value['title']; ?>" class="videoLink row">
<div class="col-md-1 col-sm-1 col-xs-1"> <div class="col-md-1 col-sm-1 col-xs-1">
<?php echo $indicator; ?> <?php echo $indicator; ?>
</div> </div>
<div class="col-md-3 col-sm-3 col-xs-3 nopadding"> <div class="col-md-3 col-sm-3 col-xs-3 nopadding">
<?php <?php
if (($value['type'] !== "audio") && ($value['type'] !== "linkAudio")) { if (($value['type'] !== "audio") && ($value['type'] !== "linkAudio")) {
$img = $value['images']['poster']; if(empty($value['images']['poster'])){
$img_portrait = ($value['rotation'] === "90" || $value['rotation'] === "270") ? "img-portrait" : ""; $img = Video::getPoster($value['videos_id']);
}else{
$img = $value['images']['poster'];
}
} else { } else {
$img = "".getCDN()."view/img/audio_wave.jpg"; $img = "" . getCDN() . "view/img/audio_wave.jpg";
$img_portrait = '';
} ?> } ?>
<img src="<?php echo $img; ?>" alt="<?php echo $value['title']; ?>" class="img-responsive <?php echo $img_portrait; ?> rotate<?php echo $value['rotation']; ?>" height="130" itemprop="thumbnail" /> <img src="<?php echo $img; ?>" alt="<?php echo $value['title']; ?>" class="img-responsive" height="130" itemprop="thumbnail" />
<?php <?php
if ($value['type'] !== 'pdf' && $value['type'] !== 'article' && $value['type'] !== 'serie') { if ($value['type'] !== 'pdf' && $value['type'] !== 'article' && $value['type'] !== 'serie') {
?> ?>
<time class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></time> <time class="duration"><?php echo Video::getCleanDuration(@$value['duration']); ?></time>
<div class="progress" style="height: 3px; margin-bottom: 2px;"> <div class="progress" style="height: 3px; margin-bottom: 2px;">
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $value['progress']['percent'] ?>%;" aria-valuenow="<?php echo $value['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div> <div class="progress-bar progress-bar-danger" role="progressbar" style="width: <?php echo $value['progress']['percent'] ?>%;" aria-valuenow="<?php echo $value['progress']['percent'] ?>" aria-valuemin="0" aria-valuemax="100"></div>
</div> </div>
<?php <?php
} ?> } ?>
</div> </div>
<div class="col-md-8 col-sm-8 col-xs-8 videosDetails"> <div class="col-md-8 col-sm-8 col-xs-8 videosDetails">
@ -107,18 +109,18 @@ if (!empty($videoSerie)) {
<?php <?php
if (empty($advancedCustom->doNotDisplayViews)) { if (empty($advancedCustom->doNotDisplayViews)) {
?> ?>
<div> <div>
<strong class=""><?php echo number_format($value['views_count'], 0); ?></strong> <?php echo __("Views"); ?> <strong class=""><?php echo empty($value['views_count'])?0:number_format($value['views_count'], 0); ?></strong> <?php echo __("Views"); ?>
</div> </div>
<?php <?php
} ?> } ?>
</div> </div>
</div> </div>
</a> </a>
</li> </li>
<?php <?php
$count++; $count++;
} }
?> ?>

View file

@ -1,6 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
$cachedFile = '../videos/cache/version.cache'; $cachedFile = '../videos/cache/version'.(empty($_GET['version'])?1:0).'.cache';
if (empty($_GET['modified']) && file_exists($cachedFile)) { if (empty($_GET['modified']) && file_exists($cachedFile)) {
$content = file_get_contents($cachedFile); $content = file_get_contents($cachedFile);

View file

@ -2169,6 +2169,7 @@ function addGetParam(_url, _key, _value) {
} }
_url += sep + param; _url += sep + param;
_url = removeDuplicatedGetParam(_url); _url = removeDuplicatedGetParam(_url);
_url = _url.replace("#?", "?");
return _url; return _url;
} }

View file

@ -390,7 +390,8 @@ print AVideoPlugin::updateUserFormJS();
"status": $('#status').is(':checked') ? 'a' : 'i', "status": $('#status').is(':checked') ? 'a' : 'i',
"isEmailVerified": $('#isEmailVerified').is(':checked'), "isEmailVerified": $('#isEmailVerified').is(':checked'),
"userGroups": selectedUserGroups, "userGroups": selectedUserGroups,
"do_not_login": 1 "do_not_login": 1,
"securityToken": '<?php echo getToken(3600); ?>'
}, },
type: 'post', type: 'post',
success: function (response) { success: function (response) {

View file

@ -177,7 +177,7 @@ if (!empty($evideo)) {
$modeYouTubeTimeLog['Code part 2'] = microtime(true) - $modeYouTubeTime; $modeYouTubeTimeLog['Code part 2'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true); $modeYouTubeTime = microtime(true);
if (!empty($video)) { if (!empty($video) && !empty($video['users_id'])) {
$name = User::getNameIdentificationById($video['users_id']); $name = User::getNameIdentificationById($video['users_id']);
$name = "<a href='" . User::getChannelLink($video['users_id']) . "' class='btn btn-xs btn-default'>{$name} " . User::getEmailVerifiedIcon($video['users_id']) . "</a>"; $name = "<a href='" . User::getChannelLink($video['users_id']) . "' class='btn btn-xs btn-default'>{$name} " . User::getEmailVerifiedIcon($video['users_id']) . "</a>";
$subscribe = Subscribe::getButton($video['users_id']); $subscribe = Subscribe::getButton($video['users_id']);
@ -241,7 +241,7 @@ if (!empty($evideo)) {
} }
TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY); TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
if (empty($_GET['videoName']) && !empty($video)) { if (empty($_GET['videoName']) && !empty($video) && !empty($video['clean_title'])) {
$_GET['videoName'] = $video['clean_title']; $_GET['videoName'] = $video['clean_title'];
} }
if(!empty($video)){ if(!empty($video)){
@ -352,8 +352,7 @@ TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
if (empty($video['type'])) { if (empty($video['type'])) {
$video['type'] = "video"; $video['type'] = "video";
} }
$img_portrait = ($video['rotation'] === "90" || $video['rotation'] === "270") ? "img-portrait" : "";
TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY); TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
require "{$global['systemRootPath']}view/modeYoutubeBundle.php"; require "{$global['systemRootPath']}view/modeYoutubeBundle.php";