1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
Fixes regarding the encoder process, do not process more then once.
This commit is contained in:
DanielnetoDotCom 2021-04-29 12:36:39 -03:00
parent 352105fb77
commit f7dd239f7a
35 changed files with 631 additions and 478 deletions

View file

@ -62,7 +62,7 @@ if (!empty($confirm) && strtolower($confirm) === 'y') {
$count++; $count++;
$title = "Video recovered: ".date("Y-m-d H:i:s", filectime($value[1])); $title = "Video recovered: ".date("Y-m-d H:i:s", filectime($value[1]));
$video = new Video($title, $value[0]); $video = new Video($title, $value[0]);
$video->setStatus('a'); $video->setStatus(Video::$statusActive);
$video->setUsers_id(1); $video->setUsers_id(1);
if($video->save(false, true)){ if($video->save(false, true)){
echo "{$count}/{$total} {$title} created\n"; echo "{$count}/{$total} {$title} created\n";

View file

@ -49,15 +49,20 @@ abstract class ObjectYPT implements ObjectInterface {
global $advancedCustom; global $advancedCustom;
$row = self::getNowFromDB(); $row = self::getNowFromDB();
$dt = new DateTime($row['my_date_field']); $dt = new DateTime($row['my_date_field']);
if(!empty($_COOKIE['timezone'])){
$timezone = $_COOKIE['timezone'];
}else{
$timeZOnesOptions = object_to_array($advancedCustom->timeZone->type); $timeZOnesOptions = object_to_array($advancedCustom->timeZone->type);
if (empty($timeZOnesOptions[$advancedCustom->timeZone->value])) { $timezone = $timeZOnesOptions[$advancedCustom->timeZone->value];
}
if (empty($timezone)) {
return false; return false;
} }
try { try {
$objDate = new DateTimeZone($timeZOnesOptions[$advancedCustom->timeZone->value]); $objDate = new DateTimeZone($timezone);
if (is_object($objDate)) { if (is_object($objDate)) {
$dt->setTimezone($objDate); $dt->setTimezone($objDate);
date_default_timezone_set($timeZOnesOptions[$advancedCustom->timeZone->value]); date_default_timezone_set($timezone);
return $dt; return $dt;
} }
return false; return false;

View file

@ -69,29 +69,8 @@ if(!empty($_REQUEST['duration'])){
} }
} }
$status = $video->getStatus(); $status = $video->setAutoStatus();
// if encoder requested a status
if (!empty($_POST['overrideStatus'])) {
$video->setStatus($_POST['overrideStatus']);
} else { // encoder did not provide a status
// if status is not unlisted
if ($status !== 'u' && $status !== 'a') {
if (empty($advancedCustom->makeVideosInactiveAfterEncode)) {
// set active or active+encoding
if (!empty($_POST['keepEncoding'])) {
$video->setStatus('k');
} else {
$video->setStatus('a');
}
} elseif (empty($advancedCustom->makeVideosUnlistedAfterEncode)) {
// set active
$video->setStatus('u');
} else {
$video->setStatus('i');
}
}
}
$video->setVideoDownloadedLink($_POST['videoDownloadedLink']); $video->setVideoDownloadedLink($_POST['videoDownloadedLink']);
_error_log("aVideoEncoder.json: Encoder receiving post " . json_encode($_POST)); _error_log("aVideoEncoder.json: Encoder receiving post " . json_encode($_POST));
//_error_log(print_r($_POST, true)); //_error_log(print_r($_POST, true));
@ -159,7 +138,7 @@ if (!empty($_FILES['video']['tmp_name'])) {
decideMoveUploadedToVideos($_FILES['video']['tmp_name'], $filename); decideMoveUploadedToVideos($_FILES['video']['tmp_name'], $filename);
} else { } else {
// set encoding // set encoding
$video->setStatus('e'); $video->setStatus(Video::$statusEncoding);
} }
if (!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination_local}.jpg")) { if (!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination_local}.jpg")) {
if (!move_uploaded_file($_FILES['image']['tmp_name'], "{$destination_local}.jpg")) { if (!move_uploaded_file($_FILES['image']['tmp_name'], "{$destination_local}.jpg")) {

View file

@ -39,31 +39,15 @@ Video::clearCache($_POST['videos_id']);
$video = new Video("", "", $_POST['videos_id']); $video = new Video("", "", $_POST['videos_id']);
$obj->video_id = $_POST['videos_id']; $obj->video_id = $_POST['videos_id'];
if(empty($_POST['fail'])){
// if encoder requested a status $video->setAutoStatus(Video::$statusActive);
if (!empty($_POST['overrideStatus'])) {
$video->setStatus($_POST['overrideStatus']);
} else { // encoder did not provide a status
$status = $video->getStatus();
// if status is not unlisted
if($status!=='u' && $status !== 'a'){
if(empty($advancedCustom->makeVideosInactiveAfterEncode)){
// set active
$video->setStatus('a');
}else if(empty($advancedCustom->makeVideosUnlistedAfterEncode)){
// set active
$video->setStatus('u');
}else{
$video->setStatus('i');
}
}
}
}else{
$video->setStatus('i');
}
$video_id = $video->save(); $video_id = $video->save();
if(empty($_POST['fail'])){
AVideoPlugin::afterNewVideo($_POST['videos_id']); $video = new Video("", "", $video_id);
if($video->getStatus() === Video::$statusActive){
AVideoPlugin::afterNewVideo($video_id);
} }
$obj->error = false; $obj->error = false;
$obj->video_id = $video_id; $obj->video_id = $video_id;

View file

@ -85,7 +85,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
} else { } else {
$video->setType("video"); $video->setType("video");
} }
$video->setStatus('e'); $video->setStatus(Video::$statusEncoding);
/* /*
* set visibility for private videos * set visibility for private videos

View file

@ -10,5 +10,6 @@ $obj->_serverTime = time();
$obj->_serverDBTime = getDatabaseTime(); $obj->_serverDBTime = getDatabaseTime();
$obj->_serverTimeString = date('Y-m-d H:i:s'); $obj->_serverTimeString = date('Y-m-d H:i:s');
$obj->_serverDBTimeString = date('Y-m-d H:i:s', getDatabaseTime()); $obj->_serverDBTimeString = date('Y-m-d H:i:s', getDatabaseTime());
$obj->_serverTimezone = date_default_timezone_get();
die(json_encode($obj)); die(json_encode($obj));

View file

@ -2367,4 +2367,29 @@ if (typeof gtag !== \"function\") {
return sqlDAL::writeSql($sql, "si", array($string, $users_id)); return sqlDAL::writeSql($sql, "si", array($string, $users_id));
} }
static function userGroupsMatch($user_groups, $users_id=0){
if(empty($users_id)){
$users_id = User::getId();
}
if(empty($user_groups)){
return true;
}
if(empty($users_id)){
return false;
}
if(!is_array($user_groups)){
$user_groups = array($user_groups);
}
$user_users_groups = UserGroups::getUserGroups($users_id);
if(empty($user_users_groups)){
return false;
}
foreach ($user_users_groups as $value) {
if(in_array($value['id'], $user_groups)){
return true;
}
}
return false;
}
} }

View file

@ -58,18 +58,23 @@ if (!class_exists('Video')) {
private $filesize; private $filesize;
private $live_transmitions_history_id; private $live_transmitions_history_id;
public static $statusDesc = array( public static $statusDesc = array(
'a' => 'active', 'a' => 'Active',
'k' => 'active and encoding', 'k' => 'Active and Encoding',
'i' => 'inactive', 'i' => 'Inactive',
'e' => 'encoding', 'e' => 'Encoding',
'x' => 'encoding error', 'x' => 'Encoding Error',
'd' => 'downloading', 'd' => 'Downloading',
'xmp4' => 'encoding mp4 error', 't' => 'Transfering',
'xwebm' => 'encoding webm error', 'u' => 'Unlisted');
'xmp3' => 'encoding mp3 error', public static $statusActive = 'a';
'xogg' => 'encoding ogg error', public static $statusActiveAndEncoding = 'k';
'ximg' => 'get image error', public static $statusInactive = 'i';
't' => 'transfering'); public static $statusEncoding = 'e';
public static $statusEncodingError = 'x';
public static $statusDownloading = 'd';
public static $statusTranfering = 't';
public static $statusUnlisted = 'u';
public static $rratingOptions = array('', 'g', 'pg', 'pg-13', 'r', 'nc-17', 'ma'); public static $rratingOptions = array('', 'g', 'pg', 'pg-13', 'r', 'nc-17', 'ma');
//ver 3.4 //ver 3.4
private $youtubeId; private $youtubeId;
@ -337,12 +342,18 @@ if (!class_exists('Video')) {
. " trailer1 = '{$this->trailer1}', trailer2 = '{$this->trailer2}', trailer3 = '{$this->trailer3}', rate = '{$this->rate}', can_download = '{$this->can_download}', can_share = '{$this->can_share}', only_for_paid = '{$this->only_for_paid}', rrating = '{$this->rrating}', externalOptions = '{$this->externalOptions}', sites_id = {$this->sites_id}, serie_playlists_id = {$this->serie_playlists_id} ,live_transmitions_history_id = {$this->live_transmitions_history_id} , video_password = '{$this->video_password}', " . " trailer1 = '{$this->trailer1}', trailer2 = '{$this->trailer2}', trailer3 = '{$this->trailer3}', rate = '{$this->rate}', can_download = '{$this->can_download}', can_share = '{$this->can_share}', only_for_paid = '{$this->only_for_paid}', rrating = '{$this->rrating}', externalOptions = '{$this->externalOptions}', sites_id = {$this->sites_id}, serie_playlists_id = {$this->serie_playlists_id} ,live_transmitions_history_id = {$this->live_transmitions_history_id} , video_password = '{$this->video_password}', "
. " encoderURL = '{$this->encoderURL}', filepath = '{$this->filepath}' , filesize = '{$this->filesize}' , modified = now()" . " encoderURL = '{$this->encoderURL}', filepath = '{$this->filepath}' , filesize = '{$this->filesize}' , modified = now()"
. " WHERE id = {$this->id}"; . " WHERE id = {$this->id}";
$saved = sqlDAL::writeSql($sql);
if($saved){
$insert_row = $this->id;
}
} else { } else {
$sql = "INSERT INTO videos " $sql = "INSERT INTO videos "
. "(title,clean_title, filename, users_id, categories_id, status, description, duration,type,videoDownloadedLink, next_videos_id, created, modified, videoLink, can_download, can_share, only_for_paid, rrating, externalOptions, sites_id, serie_playlists_id,live_transmitions_history_id, video_password, encoderURL, filepath , filesize) values " . "(title,clean_title, filename, users_id, categories_id, status, description, duration,type,videoDownloadedLink, next_videos_id, created, modified, videoLink, can_download, can_share, only_for_paid, rrating, externalOptions, sites_id, serie_playlists_id,live_transmitions_history_id, video_password, encoderURL, filepath , filesize) values "
. "('{$this->title}','{$this->clean_title}', '{$this->filename}', {$this->users_id},{$this->categories_id}, '{$this->status}', '{$this->description}', '{$this->duration}', '{$this->type}', '{$this->videoDownloadedLink}', {$this->next_videos_id},now(), now(), '{$this->videoLink}', '{$this->can_download}', '{$this->can_share}','{$this->only_for_paid}', '{$this->rrating}', '$this->externalOptions', {$this->sites_id}, {$this->serie_playlists_id},{$this->live_transmitions_history_id}, '{$this->video_password}', '{$this->encoderURL}', '{$this->filepath}', '{$this->filesize}')"; . "('{$this->title}','{$this->clean_title}', '{$this->filename}', {$this->users_id},{$this->categories_id}, '{$this->status}', '{$this->description}', '{$this->duration}', '{$this->type}', '{$this->videoDownloadedLink}', {$this->next_videos_id},now(), now(), '{$this->videoLink}', '{$this->can_download}', '{$this->can_share}','{$this->only_for_paid}', '{$this->rrating}', '$this->externalOptions', {$this->sites_id}, {$this->serie_playlists_id},{$this->live_transmitions_history_id}, '{$this->video_password}', '{$this->encoderURL}', '{$this->filepath}', '{$this->filesize}')";
}
$insert_row = sqlDAL::writeSql($sql); $insert_row = sqlDAL::writeSql($sql);
}
if ($insert_row) { if ($insert_row) {
_error_log("Video::save ({$this->title}) Saved id = {$insert_row} "); _error_log("Video::save ({$this->title}) Saved id = {$insert_row} ");
Category::clearCacheCount(); Category::clearCacheCount();
@ -381,141 +392,6 @@ if (!class_exists('Video')) {
return false; return false;
} }
/*
static function autosetCategoryType($catId) {
global $global, $config;
if ($config->currentVersionLowerThen('5.01')) {
return false;
}
$sql = "SELECT * FROM `category_type_cache` WHERE categoryId = ?";
$res = sqlDAL::readSql($sql, "i", array($catId));
$catTypeCache = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
$videoFound = false;
$audioFound = false;
if ($catTypeCache) {
// 3 means auto
if ($catTypeCache['manualSet'] == "0") {
// start incremental search and save
$sql = "SELECT * FROM `videos` WHERE categories_id = ?";
$res = sqlDAL::readSql($sql, "i", array($catId));
$fullResult = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
if ($res != false) {
foreach ($fullResult as $row) {
if ($row['type'] == "audio") {
// echo "found audio";
$audioFound = true;
} else if ($row['type'] == "video") {
//echo "found video";
$videoFound = true;
}
}
}
if (($videoFound == false) || ($audioFound == false)) {
$sql = "SELECT * FROM `categories` WHERE parentId = ?";
$res = sqlDAL::readSql($sql, "i", array($catId));
$fullResult = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
if ($res != false) {
//$tmpVid = $res->fetch_assoc();
foreach ($fullResult as $row) {
$sql = "SELECT type,categories_id FROM `videos` WHERE categories_id = ?;";
$res = sqlDAL::readSql($sql, "i", array($row['parentId']));
$fullResult2 = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
foreach ($fullResult2 as $row) {
if ($row['type'] == "audio") {
// echo "found audio";
$audioFound = true;
} else if ($row['type'] == "video") {
//echo "found video";
$videoFound = true;
}
}
}
}
}
$sql = "UPDATE `category_type_cache` SET `type` = '";
if (($videoFound) && ($audioFound)) {
$sql .= "0";
} else if ($audioFound) {
$sql .= "1";
} else if ($videoFound) {
$sql .= "2";
} else {
$sql .= "0";
}
$sql .= "' WHERE `category_type_cache`.`categoryId` = ?;";
sqlDAL::writeSql($sql, "i", array($catId));
}
} else {
// start incremental search and save - and a lot of this redundant stuff in a method..
$sql = "SELECT type,categories_id FROM `videos` WHERE categories_id = ?;";
$res = sqlDAL::readSql($sql, "i", array($catId));
$fullResult2 = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
if ($res != false) {
foreach ($fullResult2 as $row) {
if ($row['type'] == "audio") {
$audioFound = true;
} else if ($row['type'] == "video") {
$videoFound = true;
}
}
}
if (($videoFound == false) || ($audioFound == false)) {
$sql = "SELECT parentId FROM `categories` WHERE parentId = ?;";
$res = sqlDAL::readSql($sql, "i", array($catId));
$fullResult2 = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
if ($res != false) {
foreach ($fullResult2 as $cat) {
$sql = "SELECT type,categories_id FROM `videos` WHERE categories_id = ?;";
$res = sqlDAL::readSql($sql, "i", array($cat['parentId']));
$fullResult2 = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
if ($res != false) {
foreach ($fullResult2 as $row) {
if ($row['type'] == "audio") {
$audioFound = true;
} else if ($row['type'] == "video") {
$videoFound = true;
}
}
}
}
}
}
$sql = "SELECT * FROM `category_type_cache` WHERE categoryId = ?";
$res = sqlDAL::readSql($sql, "i", array($catId));
$exist = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
$sqlType = 99;
if (($videoFound) && ($audioFound)) {
$sqlType = 0;
} else if ($audioFound) {
$sqlType = 1;
} else if ($videoFound) {
$sqlType = 2;
}
$values = array();
if (empty($exist)) {
$sql = "INSERT INTO `category_type_cache` (`categoryId`, `type`) VALUES (?, ?);";
$values = array($catId, $sqlType);
} else {
$sql = "UPDATE `category_type_cache` SET `type` = ? WHERE `category_type_cache`.`categoryId` = ?;";
$values = array($sqlType, $catId);
}
sqlDAL::writeSql($sql, "ii", $values);
}
}
*/
// i would like to simplify the big part of the method above in this method, but won't work as i want. // i would like to simplify the big part of the method above in this method, but won't work as i want.
public static function internalAutoset($catId, $videoFound, $audioFound) { public static function internalAutoset($catId, $videoFound, $audioFound) {
global $config; global $config;
@ -596,6 +472,12 @@ if (!class_exists('Video')) {
public function setStatus($status) { public function setStatus($status) {
if (!empty($this->id)) { if (!empty($this->id)) {
global $global; global $global;
if(empty(Video::$statusDesc[$status])){
_error_log("Video::setStatus({$status}) NOT found ", AVideoLog::$WARNING);
return false;
}
_error_log("Video::setStatus({$status}) ".json_encode(debug_backtrace()), AVideoLog::$WARNING);
$sql = "UPDATE videos SET status = ?, modified = now() WHERE id = ? "; $sql = "UPDATE videos SET status = ?, modified = now() WHERE id = ? ";
$res = sqlDAL::writeSql($sql, 'si', array($status, $this->id)); $res = sqlDAL::writeSql($sql, 'si', array($status, $this->id));
if ($global['mysqli']->errno != 0) { if ($global['mysqli']->errno != 0) {
@ -605,6 +487,37 @@ if (!class_exists('Video')) {
} }
AVideoPlugin::onVideoSetStatus($this->id, $this->status, $status); AVideoPlugin::onVideoSetStatus($this->id, $this->status, $status);
$this->status = $status; $this->status = $status;
return $status;
}
public function setAutoStatus($default = 'a') {
global $advancedCustom;
if (empty($advancedCustom)) {
$advancedCustom = AVideoPlugin::getDataObject('CustomizeAdvanced');
}
if (!empty($_POST['fail'])) {
return $this->setStatus(Video::$statusEncodingError);
} else {
if (!empty($_REQUEST['overrideStatus'])) {
return $this->setStatus($_REQUEST['overrideStatus']);
} else { // encoder did not provide a status
if (!empty($_REQUEST['keepEncoding'])) {
return $this->setStatus(Video::$statusActiveAndEncoding);
} else{
if($this->getTitle() !== "Video automatically booked"){
if (!empty($advancedCustom->makeVideosInactiveAfterEncode)) {
return $this->setStatus(Video::$statusInactive);
} elseif (!empty($advancedCustom->makeVideosUnlistedAfterEncode)) {
return $this->setStatus(Video::$statusUnlisted);
}
}else{
return $this->setStatus(Video::$statusInactive);
}
}
}
}
return $this->setStatus($default);
} }
public function setType($type, $force = true) { public function setType($type, $force = true) {
@ -672,7 +585,7 @@ if (!class_exists('Video')) {
if ($obj && $obj->allowFreePlayWithAds) { if ($obj && $obj->allowFreePlayWithAds) {
$sql = " AND {$tableAlias}only_for_paid = 0 "; $sql = " AND {$tableAlias}only_for_paid = 0 ";
return $sql; return $sql;
}else{ } else {
$sql = " (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0 "; $sql = " (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0 ";
if (User::isLogged()) { if (User::isLogged()) {
require_once $global['systemRootPath'] . 'objects/userGroups.php'; require_once $global['systemRootPath'] . 'objects/userGroups.php';
@ -771,7 +684,7 @@ if (!class_exists('Video')) {
if (!empty($_POST['searchPhrase'])) { if (!empty($_POST['searchPhrase'])) {
$searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description'); $searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description');
if($advancedCustomUser->videosSearchAlsoSearchesOnChannelName){ if ($advancedCustomUser->videosSearchAlsoSearchesOnChannelName) {
$searchFieldsNames[] = 'u.channelName'; $searchFieldsNames[] = 'u.channelName';
} }
if (AVideoPlugin::isEnabledByName("VideoTags")) { if (AVideoPlugin::isEnabledByName("VideoTags")) {
@ -1090,7 +1003,7 @@ if (!class_exists('Video')) {
if (!empty($_POST['searchPhrase'])) { if (!empty($_POST['searchPhrase'])) {
$searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description'); $searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description');
if($advancedCustomUser->videosSearchAlsoSearchesOnChannelName){ if ($advancedCustomUser->videosSearchAlsoSearchesOnChannelName) {
$searchFieldsNames[] = 'u.channelName'; $searchFieldsNames[] = 'u.channelName';
} }
if (AVideoPlugin::isEnabledByName("VideoTags")) { if (AVideoPlugin::isEnabledByName("VideoTags")) {
@ -1235,11 +1148,11 @@ if (!class_exists('Video')) {
$videos[] = $row; $videos[] = $row;
} }
$rowCount = getRowCount(); $rowCount = getRowCount();
$tolerance = $rowCount/100; $tolerance = $rowCount / 100;
if($tolerance<0.2){ if ($tolerance < 0.2) {
$tolerance=0.2; $tolerance = 0.2;
}else if($tolerance>2){ } else if ($tolerance > 2) {
$tolerance=2; $tolerance = 2;
} }
TimeLogEnd("video::getAllVideos foreach", __LINE__, $tolerance); TimeLogEnd("video::getAllVideos foreach", __LINE__, $tolerance);
//$videos = $res->fetch_all(MYSQLI_ASSOC); //$videos = $res->fetch_all(MYSQLI_ASSOC);
@ -1541,7 +1454,7 @@ if (!class_exists('Video')) {
if (!empty($_POST['searchPhrase'])) { if (!empty($_POST['searchPhrase'])) {
$searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description'); $searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description');
if($advancedCustomUser->videosSearchAlsoSearchesOnChannelName){ if ($advancedCustomUser->videosSearchAlsoSearchesOnChannelName) {
$searchFieldsNames[] = 'u.channelName'; $searchFieldsNames[] = 'u.channelName';
} }
if (AVideoPlugin::isEnabledByName("VideoTags")) { if (AVideoPlugin::isEnabledByName("VideoTags")) {
@ -1633,12 +1546,8 @@ if (!class_exists('Video')) {
x = encoding error x = encoding error
d = downloading d = downloading
u = unlisted u = unlisted
xmp4 = encoding mp4 error
xwebm = encoding webm error
xmp3 = encoding mp3 error
xogg = encoding ogg error
*/ */
$viewable = array('a', 'k', 'xmp4', 'xwebm', 'xmp3', 'xogg'); $viewable = array('a', 'k');
if ($showUnlisted) { if ($showUnlisted) {
$viewable[] = "u"; $viewable[] = "u";
} elseif (!empty($_GET['videoName'])) { } elseif (!empty($_GET['videoName'])) {
@ -2280,64 +2189,33 @@ if (!class_exists('Video')) {
x = encoding error x = encoding error
d = downloading d = downloading
u = unlisted u = unlisted
xmp4 = encoding mp4 error
xwebm = encoding webm error
xmp3 = encoding mp3 error
xogg = encoding ogg error
ximg = get image error
*/ */
if (empty($type) || $type === "status") { if (empty($type) || $type === "status") {
$objTag = new stdClass(); $objTag = new stdClass();
$objTag->label = __("Status"); $objTag->label = __("Status");
switch ($video->getStatus()) { $status = $video->getStatus();
case 'a': $objTag->text = __(Video::$statusDesc[$status]);
switch ($status) {
case Video::$statusActive:
$objTag->type = "success"; $objTag->type = "success";
$objTag->text = __("Active");
break; break;
case 'k': case Video::$statusActiveAndEncoding:
$objTag->type = "success"; $objTag->type = "success";
$objTag->text = __("Active and encoding");
break; break;
case 'i': case Video::$statusInactive:
$objTag->type = "warning"; $objTag->type = "warning";
$objTag->text = __("Inactive");
break; break;
case 'e': case Video::$statusEncoding:
$objTag->type = "info"; $objTag->type = "info";
$objTag->text = __("Encoding");
break; break;
case 'd': case Video::$statusDownloading:
$objTag->type = "info"; $objTag->type = "info";
$objTag->text = __("Downloading");
break; break;
case 'u': case Video::$statusUnlisted:
$objTag->type = "info"; $objTag->type = "info";
$objTag->text = __("Unlisted");
break; break;
case 'xmp4':
$objTag->type = "danger";
$objTag->text = __("Encoding mp4 error");
break;
case 'xwebm':
$objTag->type = "danger";
$objTag->text = __("Encoding xwebm error");
break;
case 'xmp3':
$objTag->type = "danger";
$objTag->text = __("Encoding xmp3 error");
break;
case 'xogg':
$objTag->type = "danger";
$objTag->text = __("Encoding xogg error");
break;
case 'ximg':
$objTag->type = "danger";
$objTag->text = __("Get imgage error");
break;
default: default:
$objTag->type = "danger"; $objTag->type = "danger";
$objTag->text = __("Status not found");
break; break;
} }
$objTag->text = $objTag->text; $objTag->text = $objTag->text;
@ -2714,8 +2592,8 @@ if (!class_exists('Video')) {
if ($force || empty($this->filename)) { if ($force || empty($this->filename)) {
AVideoPlugin::onVideoSetFilename($this->id, $this->filename, $filename, $force); AVideoPlugin::onVideoSetFilename($this->id, $this->filename, $filename, $force);
$this->filename = $filename; $this->filename = $filename;
}else{ } else {
_error_log('setFilename: fail '.$filename." {$this->id}"); _error_log('setFilename: fail ' . $filename . " {$this->id}");
} }
return $this->filename; return $this->filename;
} }
@ -2830,8 +2708,8 @@ if (!class_exists('Video')) {
//return array(); //return array();
//} //}
if($type == '_thumbsSmallV2.jpg' && empty($advancedCustom->usePreloadLowResolutionImages)){ if ($type == '_thumbsSmallV2.jpg' && empty($advancedCustom->usePreloadLowResolutionImages)) {
return array('path'=>$global['systemRootPath'].'view/img/loading-gif.png', 'url'=>getCDN().'view/img/loading-gif.png'); return array('path' => $global['systemRootPath'] . 'view/img/loading-gif.png', 'url' => getCDN() . 'view/img/loading-gif.png');
} }
$cacheName = md5($filename . $type . $includeS3); $cacheName = md5($filename . $type . $includeS3);
@ -2905,9 +2783,9 @@ if (!class_exists('Video')) {
$source['url'] = "{$advancedCustom->videosCDN}videos/{$filename}/index{$type}{$token}"; $source['url'] = "{$advancedCustom->videosCDN}videos/{$filename}/index{$type}{$token}";
} }
} else { } else {
$source['url'] = getCDN()."videos/{$filename}{$type}{$token}"; $source['url'] = getCDN() . "videos/{$filename}{$type}{$token}";
if ($type == ".m3u8") { if ($type == ".m3u8") {
$source['url'] = getCDN()."videos/{$filename}/index{$type}{$token}"; $source['url'] = getCDN() . "videos/{$filename}/index{$type}{$token}";
} }
} }
/* need it because getDurationFromFile */ /* need it because getDurationFromFile */
@ -3269,7 +3147,7 @@ if (!class_exists('Video')) {
if (convertImageToRoku($images->posterLandscapePath, $rokuImage)) { if (convertImageToRoku($images->posterLandscapePath, $rokuImage)) {
return str_replace($global['systemRootPath'], $global['webSiteRootURL'], $rokuImage); return str_replace($global['systemRootPath'], $global['webSiteRootURL'], $rokuImage);
} }
return "".getCDN()."view/img/notfound.jpg"; return "" . getCDN() . "view/img/notfound.jpg";
} }
public static function clearImageCache($filename, $type = "video") { public static function clearImageCache($filename, $type = "video") {
@ -3356,30 +3234,30 @@ if (!class_exists('Video')) {
} }
} else { } else {
if ($type == "article") { if ($type == "article") {
$obj->posterPortrait = "".getCDN()."view/img/article_portrait.png"; $obj->posterPortrait = "" . getCDN() . "view/img/article_portrait.png";
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/article_portrait.png"; $obj->posterPortraitPath = "{$global['systemRootPath']}view/img/article_portrait.png";
$obj->posterPortraitThumbs = "".getCDN()."view/img/article_portrait.png"; $obj->posterPortraitThumbs = "" . getCDN() . "view/img/article_portrait.png";
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/article_portrait.png"; $obj->posterPortraitThumbsSmall = "" . getCDN() . "view/img/article_portrait.png";
} elseif ($type == "pdf") { } elseif ($type == "pdf") {
$obj->posterPortrait = "".getCDN()."view/img/pdf_portrait.png"; $obj->posterPortrait = "" . getCDN() . "view/img/pdf_portrait.png";
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/pdf_portrait.png"; $obj->posterPortraitPath = "{$global['systemRootPath']}view/img/pdf_portrait.png";
$obj->posterPortraitThumbs = "".getCDN()."view/img/pdf_portrait.png"; $obj->posterPortraitThumbs = "" . getCDN() . "view/img/pdf_portrait.png";
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/pdf_portrait.png"; $obj->posterPortraitThumbsSmall = "" . getCDN() . "view/img/pdf_portrait.png";
} /* else if ($type == "image") { } /* else if ($type == "image") {
$obj->posterPortrait = "".getCDN()."view/img/image_portrait.png"; $obj->posterPortrait = "".getCDN()."view/img/image_portrait.png";
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/image_portrait.png"; $obj->posterPortraitPath = "{$global['systemRootPath']}view/img/image_portrait.png";
$obj->posterPortraitThumbs = "".getCDN()."view/img/image_portrait.png"; $obj->posterPortraitThumbs = "".getCDN()."view/img/image_portrait.png";
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/image_portrait.png"; $obj->posterPortraitThumbsSmall = "".getCDN()."view/img/image_portrait.png";
} */ elseif ($type == "zip") { } */ elseif ($type == "zip") {
$obj->posterPortrait = "".getCDN()."view/img/zip_portrait.png"; $obj->posterPortrait = "" . getCDN() . "view/img/zip_portrait.png";
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/zip_portrait.png"; $obj->posterPortraitPath = "{$global['systemRootPath']}view/img/zip_portrait.png";
$obj->posterPortraitThumbs = "".getCDN()."view/img/zip_portrait.png"; $obj->posterPortraitThumbs = "" . getCDN() . "view/img/zip_portrait.png";
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/zip_portrait.png"; $obj->posterPortraitThumbsSmall = "" . getCDN() . "view/img/zip_portrait.png";
} else { } else {
$obj->posterPortrait = "".getCDN()."view/img/notfound_portrait.jpg"; $obj->posterPortrait = "" . getCDN() . "view/img/notfound_portrait.jpg";
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/notfound_portrait.png"; $obj->posterPortraitPath = "{$global['systemRootPath']}view/img/notfound_portrait.png";
$obj->posterPortraitThumbs = "".getCDN()."view/img/notfound_portrait.jpg"; $obj->posterPortraitThumbs = "" . getCDN() . "view/img/notfound_portrait.jpg";
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/notfound_portrait.jpg"; $obj->posterPortraitThumbsSmall = "" . getCDN() . "view/img/notfound_portrait.jpg";
} }
} }
@ -3406,35 +3284,35 @@ if (!class_exists('Video')) {
} }
} else { } else {
if ($type == "article") { if ($type == "article") {
$obj->poster = "".getCDN()."view/img/article.png"; $obj->poster = "" . getCDN() . "view/img/article.png";
$obj->thumbsJpg = "".getCDN()."view/img/article.png"; $obj->thumbsJpg = "" . getCDN() . "view/img/article.png";
$obj->thumbsJpgSmall = "".getCDN()."view/img/article.png"; $obj->thumbsJpgSmall = "" . getCDN() . "view/img/article.png";
} elseif ($type == "pdf") { } elseif ($type == "pdf") {
$obj->poster = "".getCDN()."view/img/pdf.png"; $obj->poster = "" . getCDN() . "view/img/pdf.png";
$obj->thumbsJpg = "".getCDN()."view/img/pdf.png"; $obj->thumbsJpg = "" . getCDN() . "view/img/pdf.png";
$obj->thumbsJpgSmall = "".getCDN()."view/img/pdf.png"; $obj->thumbsJpgSmall = "" . getCDN() . "view/img/pdf.png";
} elseif ($type == "image") { } elseif ($type == "image") {
$obj->poster = "".getCDN()."view/img/image.png"; $obj->poster = "" . getCDN() . "view/img/image.png";
$obj->thumbsJpg = "".getCDN()."view/img/image.png"; $obj->thumbsJpg = "" . getCDN() . "view/img/image.png";
$obj->thumbsJpgSmall = "".getCDN()."view/img/image.png"; $obj->thumbsJpgSmall = "" . getCDN() . "view/img/image.png";
} elseif ($type == "zip") { } elseif ($type == "zip") {
$obj->poster = "".getCDN()."view/img/zip.png"; $obj->poster = "" . getCDN() . "view/img/zip.png";
$obj->thumbsJpg = "".getCDN()."view/img/zip.png"; $obj->thumbsJpg = "" . getCDN() . "view/img/zip.png";
$obj->thumbsJpgSmall = "".getCDN()."view/img/zip.png"; $obj->thumbsJpgSmall = "" . getCDN() . "view/img/zip.png";
} elseif (($type !== "audio") && ($type !== "linkAudio")) { } elseif (($type !== "audio") && ($type !== "linkAudio")) {
if (file_exists($spectrumSource['path'])) { if (file_exists($spectrumSource['path'])) {
$obj->poster = $spectrumSource['url']; $obj->poster = $spectrumSource['url'];
$obj->thumbsJpg = $spectrumSource['url']; $obj->thumbsJpg = $spectrumSource['url'];
$obj->thumbsJpgSmall = $spectrumSource['url']; $obj->thumbsJpgSmall = $spectrumSource['url'];
} else { } else {
$obj->poster = "".getCDN()."view/img/notfound.jpg"; $obj->poster = "" . getCDN() . "view/img/notfound.jpg";
$obj->thumbsJpg = "".getCDN()."view/img/notfoundThumbs.jpg"; $obj->thumbsJpg = "" . getCDN() . "view/img/notfoundThumbs.jpg";
$obj->thumbsJpgSmall = "".getCDN()."view/img/notfoundThumbsSmall.jpg"; $obj->thumbsJpgSmall = "" . getCDN() . "view/img/notfoundThumbsSmall.jpg";
} }
} else { } else {
$obj->poster = "".getCDN()."view/img/audio_wave.jpg"; $obj->poster = "" . getCDN() . "view/img/audio_wave.jpg";
$obj->thumbsJpg = "".getCDN()."view/img/audio_waveThumbs.jpg"; $obj->thumbsJpg = "" . getCDN() . "view/img/audio_waveThumbs.jpg";
$obj->thumbsJpgSmall = "".getCDN()."view/img/audio_waveThumbsSmall.jpg"; $obj->thumbsJpgSmall = "" . getCDN() . "view/img/audio_waveThumbsSmall.jpg";
} }
} }
@ -3596,8 +3474,8 @@ if (!class_exists('Video')) {
$subDir = "article"; $subDir = "article";
$subEmbedDir = "articleEmbed"; $subEmbedDir = "articleEmbed";
} }
if(!empty($advancedCustom->makeVideosIDHarderToGuess)){ if (!empty($advancedCustom->makeVideosIDHarderToGuess)) {
$encryptedVideos_id = '.'.idToHash($videos_id); $encryptedVideos_id = '.' . idToHash($videos_id);
$videos_id = $encryptedVideos_id; $videos_id = $encryptedVideos_id;
} }
if ($embed) { if ($embed) {
@ -3614,8 +3492,8 @@ if (!class_exists('Video')) {
} }
} }
} else { } else {
if(!empty($advancedCustom->makeVideosIDHarderToGuess)){ if (!empty($advancedCustom->makeVideosIDHarderToGuess)) {
$encryptedVideos_id = '.'.idToHash($videos_id); $encryptedVideos_id = '.' . idToHash($videos_id);
$videos_id = $encryptedVideos_id; $videos_id = $encryptedVideos_id;
} }
if ($embed) { if ($embed) {
@ -3972,6 +3850,12 @@ if (!class_exists('Video')) {
$this->setExternalOptions(json_encode($externalOptions)); $this->setExternalOptions(json_encode($externalOptions));
} }
public function setVideoEmbedWhitelist($embedWhitelist) {
$externalOptions = _json_decode($this->getExternalOptions());
$externalOptions->embedWhitelist = $embedWhitelist;
$this->setExternalOptions(json_encode($externalOptions));
}
public function getSerie_playlists_id() { public function getSerie_playlists_id() {
return $this->serie_playlists_id; return $this->serie_playlists_id;
} }

View file

@ -1 +1 @@
<a href="plugin/ADs/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fas fa-edit"></i> Edit</a> <button onclick="avideoModalIframe(webSiteRootURL +'plugin/ADs/editor.php');" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fas fa-edit"></i> Edit</button>

View file

@ -52,7 +52,7 @@ $reflector = new ReflectionClass('API');
return strcasecmp($matchesA[2], $matchesB[2]); return strcasecmp($matchesA[2], $matchesB[2]);
}); });
?> ?>
<div class="container"> <div class="container-fluid">
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item"> <li class="list-group-item">
<details> <details>

View file

@ -1 +1 @@
<a href="plugin/API/info.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fas fa-info-circle"></i> Info</a> <button onclick="avideoModalIframeLarge(webSiteRootURL +'plugin/API/info.php');" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fas fa-info-circle"></i> Info</button>

View file

@ -683,6 +683,30 @@ class AVideoPlugin {
} }
} }
public function getModeLive($key) {
$plugins = Plugin::getAllEnabled();
foreach ($plugins as $value) {
self::YPTstart();
$p = static::loadPlugin($value['dirName']);
if (is_object($p)) {
$p->getModeLive($key);
}
self::YPTend("{$value['dirName']}::" . __FUNCTION__);
}
}
public function getModeLiveLink($liveLink_id) {
$plugins = Plugin::getAllEnabled();
foreach ($plugins as $value) {
self::YPTstart();
$p = static::loadPlugin($value['dirName']);
if (is_object($p)) {
$p->getModeLiveLink($liveLink_id);
}
self::YPTend("{$value['dirName']}::" . __FUNCTION__);
}
}
public static function getModeYouTubeLive($users_id) { public static function getModeYouTubeLive($users_id) {
$plugins = Plugin::getAllEnabled(); $plugins = Plugin::getAllEnabled();
foreach ($plugins as $value) { foreach ($plugins as $value) {

View file

@ -42,7 +42,7 @@ class BulkEmbed extends PluginAbstract {
public function getPluginMenu() { public function getPluginMenu() {
global $global; global $global;
$menu = '<a href="' . $global['webSiteRootURL'] . 'plugin/BulkEmbed/search.php" class="btn btn-primary btn-xs btn-block" target="_blank">Search</a>'; $menu = '<button onclick="avideoModalIframe(webSiteRootURL +\'plugin/BulkEmbed/search.php\');" class="btn btn-primary btn-xs btn-block" target="_blank">Search</button>';
return $menu; return $menu;
} }

View file

@ -576,7 +576,7 @@ function createGalleryLiveSection($videos) {
<?php <?php
if (!empty($video['galleryCallback'])) { if (!empty($video['galleryCallback'])) {
$video['galleryCallback'] = addcslashes($video['galleryCallback'], '"'); $video['galleryCallback'] = addcslashes($video['galleryCallback'], '"');
echo '<script>$(document).ready(function () {eval("' . $video['galleryCallback'] . '")});</script>'; echo '<!-- galleryCallback --><script>$(document).ready(function () {eval("' . $video['galleryCallback'] . '")});</script>';
} }

View file

@ -5,10 +5,12 @@ $obj = AVideoPlugin::getDataObject("Live");
.liveVideo{ .liveVideo{
position: relative; position: relative;
} }
.liveVideo .liveNow{ .liveVideo .liveNow, .liveVideo .liveFuture{
position: absolute; position: absolute;
bottom: 5px; bottom: 5px;
right: 5px; right: 5px;
}
.liveVideo .liveNow{
background-color: rgba(255,0,0,0.7); background-color: rgba(255,0,0,0.7);
} }
#availableLiveStream{ #availableLiveStream{
@ -349,7 +351,7 @@ if (isVideo()) {
} }
$('#liveVideos').slideDown(); $('#liveVideos').slideDown();
if (callback) { if (callback) {
eval("try {console.log('processApplication application.callback');$liveLi = " + callback + ";} catch (e) {console.log('processApplication application.callback error',e.message);}"); eval("try {console.log('processApplication application.callback '+callback);$liveLi = " + callback + ";} catch (e) {console.log('processApplication application.callback error',e.message);}");
} }
} else { } else {

View file

@ -44,7 +44,7 @@ class LiveLinks extends PluginAbstract {
} }
public function getPluginVersion() { public function getPluginVersion() {
return "3.2"; return "4.0";
} }
public function canAddLinks() { public function canAddLinks() {
@ -68,10 +68,25 @@ class LiveLinks extends PluginAbstract {
include $global['systemRootPath'] . 'plugin/LiveLinks/view/menuRight.php'; include $global['systemRootPath'] . 'plugin/LiveLinks/view/menuRight.php';
} }
static function getAllActive() { static function getAllActive($future = false, $activeOnly = true, $notStarted = false) {
global $global; global $global;
_mysql_connect(); _mysql_connect();
$sql = "SELECT * FROM LiveLinks WHERE status='a' AND start_date <= now() AND end_date >= now() ORDER BY start_date "; $sql = "SELECT * FROM LiveLinks WHERE 1=1 ";
if (!empty($future)) {
$sql .= " AND end_date >= now() ";
}
if (!empty($activeOnly)) {
$sql .= " AND status='a' ";
}
if (!empty($notStarted)) {
$sql .= " AND start_date >= now() ";
}
$sql .= " ORDER BY start_date ";
//echo $sql;//exit;
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
$rows = array(); $rows = array();
if ($res) { if ($res) {
@ -105,7 +120,8 @@ class LiveLinks extends PluginAbstract {
$filenameExtra = $global['systemRootPath'] . 'plugin/LiveLinks/view/extraItem.html'; $filenameExtra = $global['systemRootPath'] . 'plugin/LiveLinks/view/extraItem.html';
$filenameExtraVideoPage = $global['systemRootPath'] . 'plugin/LiveLinks/view/extraItemVideoPage.html'; $filenameExtraVideoPage = $global['systemRootPath'] . 'plugin/LiveLinks/view/extraItemVideoPage.html';
$filenameListItem = $global['systemRootPath'] . 'plugin/LiveLinks/view/videoListItem.html'; $filenameListItem = $global['systemRootPath'] . 'plugin/LiveLinks/view/videoListItem.html';
$row = LiveLinks::getAllActive(); $row = LiveLinks::getAllActive(true, true);
//var_dump($row);exit;
$array = array(); $array = array();
$search = array( $search = array(
'_unique_id_', '_unique_id_',
@ -155,6 +171,17 @@ class LiveLinks extends PluginAbstract {
$newContentExtra = str_replace($search, $replace, $contentExtra); $newContentExtra = str_replace($search, $replace, $contentExtra);
$newContentExtraVideoPage = str_replace($search, $replace, $contentExtraVideoPage); $newContentExtraVideoPage = str_replace($search, $replace, $contentExtraVideoPage);
$newContentVideoListItem = str_replace($search, $replace, $contentListem); $newContentVideoListItem = str_replace($search, $replace, $contentListem);
$callback = '';
$galleryCallback = '';
if(strtotime($value['start_date']) > time()){
$callback = "liveLinkApps(\$('.liveLink_{$value['id']}'), 'liveLink_{$value['id']}', '{$value['start_date']}')";
$galleryCallback = 'var liveLinkItemSelector = \'.liveLink_' . $value['id'] . ' .liveNow\'; '
. '$(liveLinkItemSelector).attr(\'class\', \'liveNow label label-primary\');'
. '$(liveLinkItemSelector).text(\'' . $value['start_date'] . '\');'
. 'startTimerToDate(\'' . $value['start_date'] . '\', liveLinkItemSelector, true);';
}
$array[] = array( $array[] = array(
"type" => "LiveLink", "type" => "LiveLink",
"html" => $newContent, "html" => $newContent,
@ -171,7 +198,9 @@ class LiveLinks extends PluginAbstract {
"link" => self::getLinkToLiveFromId($value['id'], true), "link" => self::getLinkToLiveFromId($value['id'], true),
"href" => self::getLinkToLiveFromId($value['id']), "href" => self::getLinkToLiveFromId($value['id']),
"categories_id" => intval($value['categories_id']), "categories_id" => intval($value['categories_id']),
"className" => 'liveLink_' . $value['id'] "className" => 'liveLink_' . $value['id'],
"callback" => $callback,
"galleryCallback" => $galleryCallback,
); );
} }
@ -228,14 +257,14 @@ class LiveLinks extends PluginAbstract {
public static function getSourceLink($id) { public static function getSourceLink($id) {
global $global; global $global;
if(empty($id)){ if (empty($id)) {
return false; return false;
} }
$ll = new LiveLinksTable($id); $ll = new LiveLinksTable($id);
if(empty($ll->getLink())){ if (empty($ll->getLink())) {
return false; return false;
} }
$liveLink = 'Invalid livelink'.$id; $liveLink = 'Invalid livelink' . $id;
if (filter_var($ll->getLink(), FILTER_VALIDATE_URL)) { if (filter_var($ll->getLink(), FILTER_VALIDATE_URL)) {
$url = parse_url($ll->getLink()); $url = parse_url($ll->getLink());
if ($url['scheme'] == 'https') { if ($url['scheme'] == 'https') {
@ -365,7 +394,7 @@ class LiveLinks extends PluginAbstract {
if (empty($otherInfo)) { if (empty($otherInfo)) {
$otherInfo = array(); $otherInfo = array();
$otherInfo['category'] = xss_esc_back($row['category']); $otherInfo['category'] = xss_esc_back($row['category']);
$otherInfo['groups'] = UserGroups::getVideoGroups($row['id']); //$otherInfo['groups'] = UserGroups::getVideoGroups($row['id']);
//$otherInfo['title'] = UTF8encode($row['title']); //$otherInfo['title'] = UTF8encode($row['title']);
$otherInfo['description'] = UTF8encode($row['description']); $otherInfo['description'] = UTF8encode($row['description']);
$otherInfo['descriptionHTML'] = Video::htmlDescription($otherInfo['description']); $otherInfo['descriptionHTML'] = Video::htmlDescription($otherInfo['description']);
@ -402,4 +431,34 @@ class LiveLinks extends PluginAbstract {
return $socketObj; return $socketObj;
} }
public function getFooterCode() {
$obj = $this->getDataObject();
global $global;
include $global['systemRootPath'] . 'plugin/LiveLinks/view/footer.php';
return '<!-- LiveLinks Footer Code -->';
}
static function userCanWatch($users_id, $livelinks_id) {
if(empty($users_id) || empty($livelinks_id)){
return false;
}
if(User::isAdmin()){
return true;
}
$livelinks = new LiveLinksTable($livelinks_id);
if($livelinks->getUsers_id()==$users_id){
return true;
}
$user_groups_ids = LiveLinksTable::getUserGorupsIds($livelinks_id);
if(empty($user_groups_ids)){
return true;
}
return LiveLinksTable::userGroupsMatch($livelinks_id, $users_id);
}
} }

View file

@ -134,6 +134,7 @@ class LiveLinksTable extends ObjectYPT {
$rows = array(); $rows = array();
if ($res != false) { if ($res != false) {
foreach ($fullData as $row) { foreach ($fullData as $row) {
$row['user_groups'] = self::getUserGorups($row['id']);
$rows[] = $row; $rows[] = $row;
} }
} else { } else {
@ -142,6 +143,15 @@ class LiveLinksTable extends ObjectYPT {
return $rows; return $rows;
} }
public function userGroupsMatch($livelinks_id, $users_id=0){
$user_groups = self::getUserGorups($livelinks_id);
$user_groups_ids = array();
foreach ($user_groups as $value) {
$user_groups_ids[] = $value['id'];
}
return User::userGroupsMatch($user_groups_ids, $users_id);
}
public function delete(){ public function delete(){
global $global; global $global;
if(!User::isLogged()){ if(!User::isLogged()){
@ -163,4 +173,67 @@ class LiveLinksTable extends ObjectYPT {
return false; return false;
} }
public function deleteAllUserGorups(){
global $global;
if (!empty($this->id)) {
$sql = "DELETE FROM livelinks_has_users_groups ";
$sql .= " WHERE livelinks_id = ?";
$global['lastQuery'] = $sql;
//_error_log("Delete Query: ".$sql);
return sqlDAL::writeSql($sql, "i", array($this->id));
}
_error_log("Id for table " . static::getTableName() . " not defined for deletion", AVideoLog::$ERROR);
return false;
}
public function addUserGorups($usergroups_ids){
global $global;
if(empty($usergroups_ids)){
return false;
}
if(!is_array($usergroups_ids)){
$usergroups_ids = array($usergroups_ids);
}
foreach ($usergroups_ids as $value) {
$sql = "INSERT INTO `livelinks_has_users_groups` (`livelinks_id`, `users_groups_id`, `created`, `modified`) VALUES (?, ?, now(), now());";
sqlDAL::writeSql($sql, "ii", array($this->id, $value));
}
_error_log("Id for table " . static::getTableName() . " not defined for deletion", AVideoLog::$ERROR);
return true;
}
static function getUserGorups($livelinks_id){
if(!self::isTableInstalled("livelinks_has_users_groups") || empty($livelinks_id)){
return array();
}
$sql = "SELECT g.* FROM livelinks_has_users_groups ll LEFT JOIN users_groups g ON users_groups_id = g.id WHERE livelinks_id = ? ";
$sql .= self::getSqlFromPost();
$res = sqlDAL::readSql($sql, 'i', array($livelinks_id));
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
static function getUserGorupsIds($livelinks_id){
$groups = self::getUserGorups($livelinks_id);
$rows = array();
foreach ($groups as $value) {
$rows[] = $value['id'];
}
return $rows;
}
} }

View file

@ -37,6 +37,26 @@ CREATE TABLE IF NOT EXISTS `LiveLinks` (
ON UPDATE CASCADE) ON UPDATE CASCADE)
ENGINE = InnoDB; ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `livelinks_has_users_groups` (
`id` INT NOT NULL AUTO_INCREMENT,
`livelinks_id` INT(11) NOT NULL,
`users_groups_id` INT(11) NOT NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
PRIMARY KEY (`id`),
INDEX `fk_livelinks_has_users_groups_users_groups1_idx` (`users_groups_id` ASC),
INDEX `fk_livelinks_has_users_groups_livelinks1_idx` (`livelinks_id` ASC),
CONSTRAINT `fk_livelinks_has_users_groups_livelinks1`
FOREIGN KEY (`livelinks_id`)
REFERENCES `livelinks` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_livelinks_has_users_groups_users_groups1`
FOREIGN KEY (`users_groups_id`)
REFERENCES `users_groups` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE; SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

View file

@ -0,0 +1,20 @@
CREATE TABLE IF NOT EXISTS `livelinks_has_users_groups` (
`id` INT NOT NULL AUTO_INCREMENT,
`livelinks_id` INT(11) NOT NULL,
`users_groups_id` INT(11) NOT NULL,
`created` DATETIME NULL,
`modified` DATETIME NULL,
PRIMARY KEY (`id`),
INDEX `fk_livelinks_has_users_groups_users_groups1_idx` (`users_groups_id` ASC),
INDEX `fk_livelinks_has_users_groups_livelinks1_idx` (`livelinks_id` ASC),
CONSTRAINT `fk_livelinks_has_users_groups_livelinks1`
FOREIGN KEY (`livelinks_id`)
REFERENCES `livelinks` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_livelinks_has_users_groups_users_groups1`
FOREIGN KEY (`users_groups_id`)
REFERENCES `users_groups` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;

View file

@ -31,6 +31,15 @@ $t['title'] = $liveLink->getTitle();
$t['link'] = $liveLink->getLink(); $t['link'] = $liveLink->getLink();
$t['description'] = $liveLink->getDescription(); $t['description'] = $liveLink->getDescription();
AVideoPlugin::getModeLiveLink($liveLink->getId());
$toTime = strtotime($liveLink->getStart_date());
if ($toTime > time()) {
$message = "<strong>{$t['title']}</strong><br>{$t['description']}";
$image = User::getPhoto($t['users_id']);
$bgImage = LiveLinks::getImage($t['id']);
countDownPage($toTime, $message, $image, $bgImage);
}
$u = new User($t['users_id']); $u = new User($t['users_id']);
$user_id = $u->getBdId(); $user_id = $u->getBdId();
$subscribe = Subscribe::getButton($user_id); $subscribe = Subscribe::getButton($user_id);
@ -50,7 +59,7 @@ $imgh = 255;
if (!empty($_GET['embed'])) { if (!empty($_GET['embed'])) {
$video['videoLink'] = LiveLinks::getSourceLink($t['id']); $video['videoLink'] = LiveLinks::getSourceLink($t['id']);
include $global['systemRootPath'].'view/videoEmbeded.php'; include $global['systemRootPath'] . 'view/videoEmbeded.php';
return false; return false;
} }

View file

@ -24,7 +24,10 @@ $o->setStatus($_POST['status']);
$o->setTitle($_POST['title']); $o->setTitle($_POST['title']);
$o->setType($_POST['type']); $o->setType($_POST['type']);
if($o->save()){ if($id = $o->save()){
$o = new LiveLinksTable($id);
$o->deleteAllUserGorups();
$o->addUserGorups($_POST['userGroups']);
$obj->error = false; $obj->error = false;
} }
echo json_encode($obj); echo json_encode($obj);

View file

@ -0,0 +1,18 @@
<script>
var liveLinkAppsCalled = {};
function liveLinkApps($liveLi, className, live_starts) {
if(new Date(live_starts).getTime()<new Date().getTime()){
return false;
}
if(typeof liveLinkAppsCalled[className] !== 'undefined'){ // do not call it twice
//return false;
}
console.log('liveLinkApps', $liveLi, className, live_starts, $liveLi.find('.liveNow'));
liveLinkAppsCalled[className] = live_starts;
$liveLi.find('.liveNow').html("<?php echo __('Starts in'); ?> <span class='Timer_"+className+"'>"+live_starts+"<span>");
$liveLi.find('.liveNow').attr("class", 'label label-primary liveFuture');
console.log('liveLinkApps', '.'+className+' '+live_starts);
startTimerToDate(live_starts, '.Timer_'+className, false);
return $liveLi;
}
</script>

View file

@ -3,12 +3,23 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<i class="fas fa-link"></i> <?php echo __("Add an external Live Link"); ?> <i class="fas fa-link"></i> <?php echo __("Add an external Live Link"); ?>
<span id="serverTime" class="pull-right"></span>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-sm-4"> <div class="col-sm-4">
<form id="liveLinksForm"> <form id="liveLinksForm">
<div class="tabbable-line">
<ul class="nav nav-tabs">
<li class="active" >
<a data-toggle="tab" href="#tabStreamMetaData"><i class="fas fa-key"></i> <?php echo __("Meta Data"); ?></a>
</li>
<li class="" >
<a data-toggle="tab" href="#tabUserGroups"><i class="fas fa-users"></i> <?php echo __("User Groups"); ?></a>
</li>
</ul>
<div class="tab-content">
<div id="tabStreamMetaData" class="tab-pane fade in active">
<div class="row"> <div class="row">
<input type="hidden" name="linkId" id="linkId" value="" > <input type="hidden" name="linkId" id="linkId" value="" >
<div class="form-group col-sm-12"> <div class="form-group col-sm-12">
@ -52,6 +63,29 @@
<option value="i"><?php echo __("Inactive"); ?></option> <option value="i"><?php echo __("Inactive"); ?></option>
</select> </select>
</div> </div>
</div>
</div>
<div id="tabUserGroups" class="tab-pane fade">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("Groups That Can See This Stream"); ?><br><small><?php echo __("Uncheck all to make it public"); ?></small></div>
<div class="panel-body" style="max-height: 450px; overflow-y: auto;">
<?php
$ug = UserGroups::getAllUsersGroups();
foreach ($ug as $value) {
?>
<div class="form-group">
<span class="fa fa-users"></span> <?php echo $value['group_name']; ?>
<div class="material-switch pull-right">
<input id="group<?php echo $value['id']; ?>" name="userGroups[]" type="checkbox" value="<?php echo $value['id']; ?>" class="userGroups" <?php echo (in_array($value['id'], $groups) ? "checked" : "") ?>/>
<label for="group<?php echo $value['id']; ?>" class="label-success"></label>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<div class="form-group col-sm-12"> <div class="form-group col-sm-12">
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<span class="btn btn-success" id="newLiveLink"><i class="fas fa-plus"></i> <?php echo __("New"); ?></span> <span class="btn btn-success" id="newLiveLink"><i class="fas fa-plus"></i> <?php echo __("New"); ?></span>
@ -59,6 +93,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</form> </form>
</div> </div>
<div class="col-sm-8"> <div class="col-sm-8">
@ -105,16 +140,8 @@
</div> </div>
<script type="text/javascript" src="<?php echo getCDN(); ?>view/css/DataTables/datatables.min.js"></script> <script type="text/javascript" src="<?php echo getCDN(); ?>view/css/DataTables/datatables.min.js"></script>
<script src="<?php echo getCDN(); ?>js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script> <script src="<?php echo getCDN(); ?>js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<?php $today = getdate(); ?>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
var d = new Date(<?php echo $today['year'] . "," . $today['mon'] . "," . $today['mday'] . "," . $today['hours'] . "," . $today['minutes'] . "," . $today['seconds']; ?>);
setInterval(function () {
d.setSeconds(d.getSeconds() + 1);
$('#serverTime').text((d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds()));
}, 1000);
var tableLinks = $('#exampleLinks').DataTable({ var tableLinks = $('#exampleLinks').DataTable({
"ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/LiveLinks/view/liveLinks.json.php", "ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/LiveLinks/view/liveLinks.json.php",
"columns": [ "columns": [
@ -211,6 +238,10 @@
$('select[name="categories_id"]').val(data.categories_id); $('select[name="categories_id"]').val(data.categories_id);
$('select[name="categories_id"]').trigger('change'); $('select[name="categories_id"]').trigger('change');
$('#linkStatus').val(data.status); $('#linkStatus').val(data.status);
$(".userGroups").prop("checked", false);
for (const index in data.user_groups) {
$("#group" + data.user_groups[index].id).prop("checked", true);
}
}); });
}); });
</script> </script>

View file

@ -1,3 +1,11 @@
<?php
require_once '../../videos/configuration.php';
if(empty($obj)){
$obj = AVideoPlugin::getDataObject('MaintenanceMode');
}
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -12,7 +20,7 @@
<!--===============================================================================================--> <!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>plugin/MaintenanceMode/vendor/animate/animate.css"> <link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>plugin/MaintenanceMode/vendor/animate/animate.css">
<!--===============================================================================================--> <!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>plugin/MaintenanceModevendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>plugin/MaintenanceMode/vendor/select2/select2.min.css">
<!--===============================================================================================--> <!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>plugin/MaintenanceMode/css/util.css"> <link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>plugin/MaintenanceMode/css/util.css">
<link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>plugin/MaintenanceMode/css/main.css"> <link rel="stylesheet" type="text/css" href="<?php echo getCDN(); ?>plugin/MaintenanceMode/css/main.css">
@ -114,8 +122,8 @@
<!--===============================================================================================--> <!--===============================================================================================-->
<script src="<?php echo getCDN(); ?>view/js/jquery-3.5.1.min.js" type="text/javascript"></script> <script src="<?php echo getCDN(); ?>view/js/jquery-3.5.1.min.js" type="text/javascript"></script>
<!--===============================================================================================--> <!--===============================================================================================
<script src="<?php echo getCDN(); ?>plugin/MaintenanceMode/vendor/bootstrap/js/popper.js"></script> <script src="<?php echo getCDN(); ?>plugin/MaintenanceMode/vendor/bootstrap/js/popper.js"></script>-->
<script src="<?php echo getCDN(); ?>view/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="<?php echo getCDN(); ?>view/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<!--===============================================================================================--> <!--===============================================================================================-->
<script src="<?php echo getCDN(); ?>view/js/select2/select2.min.js"></script> <script src="<?php echo getCDN(); ?>view/js/select2/select2.min.js"></script>

View file

@ -3,7 +3,7 @@
$.fn.extend({ $.fn.extend({
countdown100: function(options) { countdown100: function (options) {
var defaults = { var defaults = {
timeZone: "", timeZone: "",
endtimeYear: 0, endtimeYear: 0,
@ -16,11 +16,12 @@
var options = $.extend(defaults, options); var options = $.extend(defaults, options);
return this.each(function() { return this.each(function () {
var obj = $(this); var obj = $(this);
var timeNow = new Date(); var timeNow = new Date();
var tZ = options.timeZone; console.log(tZ); var tZ = options.timeZone;
console.log(tZ);
var endYear = options.endtimeYear; var endYear = options.endtimeYear;
var endMonth = options.endtimeMonth; var endMonth = options.endtimeMonth;
var endDate = options.endtimeDate; var endDate = options.endtimeDate;
@ -28,14 +29,13 @@
var endMinutes = options.endtimeMinutes; var endMinutes = options.endtimeMinutes;
var endSeconds = options.endtimeSeconds; var endSeconds = options.endtimeSeconds;
if(tZ == "") { if (tZ == "") {
var deadline = new Date(endYear, endMonth - 1, endDate, endHours, endMinutes, endSeconds); var deadline = new Date(endYear, endMonth - 1, endDate, endHours, endMinutes, endSeconds);
} } else {
else {
var deadline = moment.tz([endYear, endMonth - 1, endDate, endHours, endMinutes, endSeconds], tZ).format(); var deadline = moment.tz([endYear, endMonth - 1, endDate, endHours, endMinutes, endSeconds], tZ).format();
} }
if(Date.parse(deadline) < Date.parse(timeNow)) { if (Date.parse(deadline) < Date.parse(timeNow)) {
var deadline = new Date(Date.parse(new Date()) + endDate * 24 * 60 * 60 * 1000 + endHours * 60 * 60 * 1000); var deadline = new Date(Date.parse(new Date()) + endDate * 24 * 60 * 60 * 1000 + endHours * 60 * 60 * 1000);
} }
@ -72,6 +72,7 @@
secondsSpan.html(('0' + t.seconds).slice(-2)) secondsSpan.html(('0' + t.seconds).slice(-2))
if (t.total <= 0) { if (t.total <= 0) {
location.reload();
clearInterval(timeinterval); clearInterval(timeinterval);
} }
} }

View file

@ -171,7 +171,7 @@ Passcode: {password}
public function getPluginMenu() { public function getPluginMenu() {
global $global; global $global;
//return '<a href="plugin/Meet/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Edit</a>'; //return '<a href="plugin/Meet/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Edit</a>';
return '<a href="'.$global['webSiteRootURL'].'plugin/Meet/checkServers.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fas fa-network-wired"></i> Check Servers</a>'; return '<button onclick="avideoModalIframe(webSiteRootURL +\'plugin/Meet/checkServers.php\');" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fas fa-network-wired"></i> Check Servers</button>';
} }
static function getMeetServerStatus($cache = 30) { static function getMeetServerStatus($cache = 30) {

View file

@ -89,7 +89,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
$video->setCan_share($_REQUEST['can_share']); $video->setCan_share($_REQUEST['can_share']);
} }
$video->setStatus('e'); $video->setStatus(Video::$statusEncoding);
if (!move_uploaded_file($_FILES['upl']['tmp_name'], Video::getStoragePath()."original_" . $filename)) { if (!move_uploaded_file($_FILES['upl']['tmp_name'], Video::getStoragePath()."original_" . $filename)) {
$object->msg = "Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . Video::getStoragePath()."original_" . $filename . ")"; $object->msg = "Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . Video::getStoragePath()."original_" . $filename . ")";

View file

@ -69,7 +69,7 @@ class Permissions extends PluginAbstract {
public function getPluginMenu() { public function getPluginMenu() {
global $global; global $global;
return '<a href="plugin/Permissions/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Edit</a>'; return '<button onclick="avideoModalIframe(webSiteRootURL +\'plugin/Permissions/View/editor.php\');" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Edit</button>';
} }
static function getForm() { static function getForm() {

View file

@ -752,7 +752,8 @@ class PlayLists extends PluginAbstract {
public function getPluginMenu() { public function getPluginMenu() {
global $global; global $global;
return '<a href="plugin/PlayLists/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Schedule</a>'; return '';
//return '<a href="plugin/PlayLists/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Schedule</a>';
} }
} }

View file

@ -357,6 +357,10 @@ class PlayerSkins extends PluginAbstract {
$currentTime = self::getCurrentTime(); $currentTime = self::getCurrentTime();
} }
if(!empty($global['doNotLoadPlayer'])){
return '';
}
if(empty($prepareStartPlayerJS_onPlayerReady)){ if(empty($prepareStartPlayerJS_onPlayerReady)){
$prepareStartPlayerJS_onPlayerReady = array(); $prepareStartPlayerJS_onPlayerReady = array();
} }

View file

@ -305,6 +305,14 @@ abstract class PluginAbstract {
return false; return false;
} }
public function getModeLive($key) {
return false;
}
public function getModeLiveLink($liveLink_id) {
return false;
}
public function getModeYouTubeLive($users_id) { public function getModeYouTubeLive($users_id) {
return false; return false;
} }

View file

@ -1 +1 @@
<a href="plugin/TopMenu/page/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Create Menus</a> <button onclick="avideoModalIframe(webSiteRootURL +'plugin/TopMenu/page/editor.php');" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Create Menus</button>

View file

@ -1 +1 @@
<a href="plugin/VideoTags/" class="btn btn-primary btn-xs btn-block"><i class="fas fa-list-ul"></i> Create Tag Type</a> <button onclick="avideoModalIframe(webSiteRootURL +'plugin/VideoTags/');" class="btn btn-primary btn-xs btn-block"><i class="fas fa-list-ul"></i> Create Tag Type</button>

View file

@ -141,6 +141,11 @@ if (isRTL()) {
<script> <script>
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>'; var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
var player; var player;
var _serverTime = "<?php echo time(); ?>";
var _serverDBTime = "<?php echo getDatabaseTime(); ?>";
var _serverTimeString = "<?php echo date('Y-m-d H:i:s'); ?>";
var _serverDBTimeString = "<?php echo date('Y-m-d H:i:s', getDatabaseTime()); ?>";
var _serverTimezone = "<?php echo date_default_timezone_get(); ?>";
</script> </script>
<?php <?php
if (!$config->getDisable_analytics()) { if (!$config->getDisable_analytics()) {

View file

@ -46,7 +46,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
$video = new Video("", $filename, $videos_id); $video = new Video("", $filename, $videos_id);
if ($video->getTitle() === "Video automatically booked") { if ($video->getTitle() === "Video automatically booked") {
$video->setTitle($title); $video->setTitle($title);
$video->setStatus('i'); $video->setStatus(Video::$statusInactive);
} }
} }
//var_dump($videos_id, $_FILES['upl']['name'], $title, $video->getTitle());exit; //var_dump($videos_id, $_FILES['upl']['name'], $title, $video->getTitle());exit;
@ -103,19 +103,8 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
} }
$video->setType("zip", true); $video->setType("zip", true);
} }
if (empty($advancedCustom->makeVideosInactiveAfterEncode) && $video->getTitle() !== "Video automatically booked") {
// set active $video->setAutoStatus(Video::$statusInactive);
$video->setStatus('a');
} else if (empty($advancedCustom->makeVideosUnlistedAfterEncode) && $video->getTitle() !== "Video automatically booked") {
// set active
$video->setStatus('u');
} else {
$video->setStatus('i');
}
$id = $video->save(); $id = $video->save();
if ($id) { if ($id) {