mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Fixes regarding the encoder process, do not process more then once.
This commit is contained in:
parent
352105fb77
commit
f7dd239f7a
35 changed files with 631 additions and 478 deletions
|
@ -62,7 +62,7 @@ if (!empty($confirm) && strtolower($confirm) === 'y') {
|
|||
$count++;
|
||||
$title = "Video recovered: ".date("Y-m-d H:i:s", filectime($value[1]));
|
||||
$video = new Video($title, $value[0]);
|
||||
$video->setStatus('a');
|
||||
$video->setStatus(Video::$statusActive);
|
||||
$video->setUsers_id(1);
|
||||
if($video->save(false, true)){
|
||||
echo "{$count}/{$total} {$title} created\n";
|
||||
|
|
|
@ -49,15 +49,20 @@ abstract class ObjectYPT implements ObjectInterface {
|
|||
global $advancedCustom;
|
||||
$row = self::getNowFromDB();
|
||||
$dt = new DateTime($row['my_date_field']);
|
||||
$timeZOnesOptions = object_to_array($advancedCustom->timeZone->type);
|
||||
if (empty($timeZOnesOptions[$advancedCustom->timeZone->value])) {
|
||||
if(!empty($_COOKIE['timezone'])){
|
||||
$timezone = $_COOKIE['timezone'];
|
||||
}else{
|
||||
$timeZOnesOptions = object_to_array($advancedCustom->timeZone->type);
|
||||
$timezone = $timeZOnesOptions[$advancedCustom->timeZone->value];
|
||||
}
|
||||
if (empty($timezone)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
$objDate = new DateTimeZone($timeZOnesOptions[$advancedCustom->timeZone->value]);
|
||||
$objDate = new DateTimeZone($timezone);
|
||||
if (is_object($objDate)) {
|
||||
$dt->setTimezone($objDate);
|
||||
date_default_timezone_set($timeZOnesOptions[$advancedCustom->timeZone->value]);
|
||||
date_default_timezone_set($timezone);
|
||||
return $dt;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -69,29 +69,8 @@ if(!empty($_REQUEST['duration'])){
|
|||
}
|
||||
}
|
||||
|
||||
$status = $video->getStatus();
|
||||
// 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');
|
||||
}
|
||||
$status = $video->setAutoStatus();
|
||||
|
||||
} elseif (empty($advancedCustom->makeVideosUnlistedAfterEncode)) {
|
||||
// set active
|
||||
$video->setStatus('u');
|
||||
} else {
|
||||
$video->setStatus('i');
|
||||
}
|
||||
}
|
||||
}
|
||||
$video->setVideoDownloadedLink($_POST['videoDownloadedLink']);
|
||||
_error_log("aVideoEncoder.json: Encoder receiving post " . json_encode($_POST));
|
||||
//_error_log(print_r($_POST, true));
|
||||
|
@ -159,7 +138,7 @@ if (!empty($_FILES['video']['tmp_name'])) {
|
|||
decideMoveUploadedToVideos($_FILES['video']['tmp_name'], $filename);
|
||||
} else {
|
||||
// set encoding
|
||||
$video->setStatus('e');
|
||||
$video->setStatus(Video::$statusEncoding);
|
||||
}
|
||||
if (!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination_local}.jpg")) {
|
||||
if (!move_uploaded_file($_FILES['image']['tmp_name'], "{$destination_local}.jpg")) {
|
||||
|
|
|
@ -39,31 +39,15 @@ Video::clearCache($_POST['videos_id']);
|
|||
$video = new Video("", "", $_POST['videos_id']);
|
||||
$obj->video_id = $_POST['videos_id'];
|
||||
|
||||
if(empty($_POST['fail'])){
|
||||
// if encoder requested a status
|
||||
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->setAutoStatus(Video::$statusActive);
|
||||
|
||||
$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->video_id = $video_id;
|
||||
|
|
|
@ -85,7 +85,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
} else {
|
||||
$video->setType("video");
|
||||
}
|
||||
$video->setStatus('e');
|
||||
$video->setStatus(Video::$statusEncoding);
|
||||
|
||||
/*
|
||||
* set visibility for private videos
|
||||
|
|
|
@ -10,5 +10,6 @@ $obj->_serverTime = time();
|
|||
$obj->_serverDBTime = getDatabaseTime();
|
||||
$obj->_serverTimeString = date('Y-m-d H:i:s');
|
||||
$obj->_serverDBTimeString = date('Y-m-d H:i:s', getDatabaseTime());
|
||||
$obj->_serverTimezone = date_default_timezone_get();
|
||||
|
||||
die(json_encode($obj));
|
|
@ -2366,5 +2366,30 @@ if (typeof gtag !== \"function\") {
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,18 +58,23 @@ if (!class_exists('Video')) {
|
|||
private $filesize;
|
||||
private $live_transmitions_history_id;
|
||||
public static $statusDesc = array(
|
||||
'a' => 'active',
|
||||
'k' => 'active and encoding',
|
||||
'i' => 'inactive',
|
||||
'e' => 'encoding',
|
||||
'x' => 'encoding error',
|
||||
'd' => 'downloading',
|
||||
'xmp4' => 'encoding mp4 error',
|
||||
'xwebm' => 'encoding webm error',
|
||||
'xmp3' => 'encoding mp3 error',
|
||||
'xogg' => 'encoding ogg error',
|
||||
'ximg' => 'get image error',
|
||||
't' => 'transfering');
|
||||
'a' => 'Active',
|
||||
'k' => 'Active and Encoding',
|
||||
'i' => 'Inactive',
|
||||
'e' => 'Encoding',
|
||||
'x' => 'Encoding Error',
|
||||
'd' => 'Downloading',
|
||||
't' => 'Transfering',
|
||||
'u' => 'Unlisted');
|
||||
public static $statusActive = 'a';
|
||||
public static $statusActiveAndEncoding = 'k';
|
||||
public static $statusInactive = 'i';
|
||||
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');
|
||||
//ver 3.4
|
||||
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}', "
|
||||
. " encoderURL = '{$this->encoderURL}', filepath = '{$this->filepath}' , filesize = '{$this->filesize}' , modified = now()"
|
||||
. " WHERE id = {$this->id}";
|
||||
|
||||
$saved = sqlDAL::writeSql($sql);
|
||||
if($saved){
|
||||
$insert_row = $this->id;
|
||||
}
|
||||
} else {
|
||||
$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 "
|
||||
. "('{$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) {
|
||||
_error_log("Video::save ({$this->title}) Saved id = {$insert_row} ");
|
||||
Category::clearCacheCount();
|
||||
|
@ -381,141 +392,6 @@ if (!class_exists('Video')) {
|
|||
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.
|
||||
public static function internalAutoset($catId, $videoFound, $audioFound) {
|
||||
global $config;
|
||||
|
@ -596,6 +472,12 @@ if (!class_exists('Video')) {
|
|||
public function setStatus($status) {
|
||||
if (!empty($this->id)) {
|
||||
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 = ? ";
|
||||
$res = sqlDAL::writeSql($sql, 'si', array($status, $this->id));
|
||||
if ($global['mysqli']->errno != 0) {
|
||||
|
@ -605,6 +487,37 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
AVideoPlugin::onVideoSetStatus($this->id, $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) {
|
||||
|
@ -667,12 +580,12 @@ if (!class_exists('Video')) {
|
|||
if (Permissions::canModerateVideos()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
$obj = AVideoPlugin::getDataObject('Subscription');
|
||||
if ($obj && $obj->allowFreePlayWithAds) {
|
||||
$sql = " AND {$tableAlias}only_for_paid = 0 ";
|
||||
return $sql;
|
||||
}else{
|
||||
} else {
|
||||
$sql = " (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0 ";
|
||||
if (User::isLogged()) {
|
||||
require_once $global['systemRootPath'] . 'objects/userGroups.php';
|
||||
|
@ -771,7 +684,7 @@ if (!class_exists('Video')) {
|
|||
|
||||
if (!empty($_POST['searchPhrase'])) {
|
||||
$searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description');
|
||||
if($advancedCustomUser->videosSearchAlsoSearchesOnChannelName){
|
||||
if ($advancedCustomUser->videosSearchAlsoSearchesOnChannelName) {
|
||||
$searchFieldsNames[] = 'u.channelName';
|
||||
}
|
||||
if (AVideoPlugin::isEnabledByName("VideoTags")) {
|
||||
|
@ -1090,7 +1003,7 @@ if (!class_exists('Video')) {
|
|||
|
||||
if (!empty($_POST['searchPhrase'])) {
|
||||
$searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description');
|
||||
if($advancedCustomUser->videosSearchAlsoSearchesOnChannelName){
|
||||
if ($advancedCustomUser->videosSearchAlsoSearchesOnChannelName) {
|
||||
$searchFieldsNames[] = 'u.channelName';
|
||||
}
|
||||
if (AVideoPlugin::isEnabledByName("VideoTags")) {
|
||||
|
@ -1235,11 +1148,11 @@ if (!class_exists('Video')) {
|
|||
$videos[] = $row;
|
||||
}
|
||||
$rowCount = getRowCount();
|
||||
$tolerance = $rowCount/100;
|
||||
if($tolerance<0.2){
|
||||
$tolerance=0.2;
|
||||
}else if($tolerance>2){
|
||||
$tolerance=2;
|
||||
$tolerance = $rowCount / 100;
|
||||
if ($tolerance < 0.2) {
|
||||
$tolerance = 0.2;
|
||||
} else if ($tolerance > 2) {
|
||||
$tolerance = 2;
|
||||
}
|
||||
TimeLogEnd("video::getAllVideos foreach", __LINE__, $tolerance);
|
||||
//$videos = $res->fetch_all(MYSQLI_ASSOC);
|
||||
|
@ -1541,7 +1454,7 @@ if (!class_exists('Video')) {
|
|||
|
||||
if (!empty($_POST['searchPhrase'])) {
|
||||
$searchFieldsNames = array('v.title', 'v.description', 'c.name', 'c.description');
|
||||
if($advancedCustomUser->videosSearchAlsoSearchesOnChannelName){
|
||||
if ($advancedCustomUser->videosSearchAlsoSearchesOnChannelName) {
|
||||
$searchFieldsNames[] = 'u.channelName';
|
||||
}
|
||||
if (AVideoPlugin::isEnabledByName("VideoTags")) {
|
||||
|
@ -1633,12 +1546,8 @@ if (!class_exists('Video')) {
|
|||
x = encoding error
|
||||
d = downloading
|
||||
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) {
|
||||
$viewable[] = "u";
|
||||
} elseif (!empty($_GET['videoName'])) {
|
||||
|
@ -2280,64 +2189,33 @@ if (!class_exists('Video')) {
|
|||
x = encoding error
|
||||
d = downloading
|
||||
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") {
|
||||
$objTag = new stdClass();
|
||||
$objTag->label = __("Status");
|
||||
switch ($video->getStatus()) {
|
||||
case 'a':
|
||||
$status = $video->getStatus();
|
||||
$objTag->text = __(Video::$statusDesc[$status]);
|
||||
switch ($status) {
|
||||
case Video::$statusActive:
|
||||
$objTag->type = "success";
|
||||
$objTag->text = __("Active");
|
||||
break;
|
||||
case 'k':
|
||||
case Video::$statusActiveAndEncoding:
|
||||
$objTag->type = "success";
|
||||
$objTag->text = __("Active and encoding");
|
||||
break;
|
||||
case 'i':
|
||||
case Video::$statusInactive:
|
||||
$objTag->type = "warning";
|
||||
$objTag->text = __("Inactive");
|
||||
break;
|
||||
case 'e':
|
||||
case Video::$statusEncoding:
|
||||
$objTag->type = "info";
|
||||
$objTag->text = __("Encoding");
|
||||
break;
|
||||
case 'd':
|
||||
case Video::$statusDownloading:
|
||||
$objTag->type = "info";
|
||||
$objTag->text = __("Downloading");
|
||||
break;
|
||||
case 'u':
|
||||
case Video::$statusUnlisted:
|
||||
$objTag->type = "info";
|
||||
$objTag->text = __("Unlisted");
|
||||
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:
|
||||
$objTag->type = "danger";
|
||||
$objTag->text = __("Status not found");
|
||||
break;
|
||||
}
|
||||
$objTag->text = $objTag->text;
|
||||
|
@ -2714,8 +2592,8 @@ if (!class_exists('Video')) {
|
|||
if ($force || empty($this->filename)) {
|
||||
AVideoPlugin::onVideoSetFilename($this->id, $this->filename, $filename, $force);
|
||||
$this->filename = $filename;
|
||||
}else{
|
||||
_error_log('setFilename: fail '.$filename." {$this->id}");
|
||||
} else {
|
||||
_error_log('setFilename: fail ' . $filename . " {$this->id}");
|
||||
}
|
||||
return $this->filename;
|
||||
}
|
||||
|
@ -2829,11 +2707,11 @@ if (!class_exists('Video')) {
|
|||
//if(!isValidFormats($type)){
|
||||
//return array();
|
||||
//}
|
||||
|
||||
if($type == '_thumbsSmallV2.jpg' && empty($advancedCustom->usePreloadLowResolutionImages)){
|
||||
return array('path'=>$global['systemRootPath'].'view/img/loading-gif.png', 'url'=>getCDN().'view/img/loading-gif.png');
|
||||
|
||||
if ($type == '_thumbsSmallV2.jpg' && empty($advancedCustom->usePreloadLowResolutionImages)) {
|
||||
return array('path' => $global['systemRootPath'] . 'view/img/loading-gif.png', 'url' => getCDN() . 'view/img/loading-gif.png');
|
||||
}
|
||||
|
||||
|
||||
$cacheName = md5($filename . $type . $includeS3);
|
||||
if (0 && isset($VideoGetSourceFile[$cacheName]) && is_array($VideoGetSourceFile[$cacheName])) {
|
||||
if (!preg_match("/token=/", $VideoGetSourceFile[$cacheName]['url'])) {
|
||||
|
@ -2905,9 +2783,9 @@ if (!class_exists('Video')) {
|
|||
$source['url'] = "{$advancedCustom->videosCDN}videos/{$filename}/index{$type}{$token}";
|
||||
}
|
||||
} else {
|
||||
$source['url'] = getCDN()."videos/{$filename}{$type}{$token}";
|
||||
$source['url'] = getCDN() . "videos/{$filename}{$type}{$token}";
|
||||
if ($type == ".m3u8") {
|
||||
$source['url'] = getCDN()."videos/{$filename}/index{$type}{$token}";
|
||||
$source['url'] = getCDN() . "videos/{$filename}/index{$type}{$token}";
|
||||
}
|
||||
}
|
||||
/* need it because getDurationFromFile */
|
||||
|
@ -2963,7 +2841,7 @@ if (!class_exists('Video')) {
|
|||
foreach ($global['avideo_resolutions'] as $value) {
|
||||
$search[] = "_{$value}";
|
||||
$replace[] = '';
|
||||
|
||||
|
||||
$search[] = "res{$value}";
|
||||
$replace[] = '';
|
||||
}
|
||||
|
@ -3269,7 +3147,7 @@ if (!class_exists('Video')) {
|
|||
if (convertImageToRoku($images->posterLandscapePath, $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") {
|
||||
|
@ -3356,30 +3234,30 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
} else {
|
||||
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->posterPortraitThumbs = "".getCDN()."view/img/article_portrait.png";
|
||||
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/article_portrait.png";
|
||||
$obj->posterPortraitThumbs = "" . getCDN() . "view/img/article_portrait.png";
|
||||
$obj->posterPortraitThumbsSmall = "" . getCDN() . "view/img/article_portrait.png";
|
||||
} 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->posterPortraitThumbs = "".getCDN()."view/img/pdf_portrait.png";
|
||||
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/pdf_portrait.png";
|
||||
$obj->posterPortraitThumbs = "" . getCDN() . "view/img/pdf_portrait.png";
|
||||
$obj->posterPortraitThumbsSmall = "" . getCDN() . "view/img/pdf_portrait.png";
|
||||
} /* else if ($type == "image") {
|
||||
$obj->posterPortrait = "".getCDN()."view/img/image_portrait.png";
|
||||
$obj->posterPortraitPath = "{$global['systemRootPath']}view/img/image_portrait.png";
|
||||
$obj->posterPortraitThumbs = "".getCDN()."view/img/image_portrait.png";
|
||||
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/image_portrait.png";
|
||||
} */ 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->posterPortraitThumbs = "".getCDN()."view/img/zip_portrait.png";
|
||||
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/zip_portrait.png";
|
||||
$obj->posterPortraitThumbs = "" . getCDN() . "view/img/zip_portrait.png";
|
||||
$obj->posterPortraitThumbsSmall = "" . getCDN() . "view/img/zip_portrait.png";
|
||||
} 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->posterPortraitThumbs = "".getCDN()."view/img/notfound_portrait.jpg";
|
||||
$obj->posterPortraitThumbsSmall = "".getCDN()."view/img/notfound_portrait.jpg";
|
||||
$obj->posterPortraitThumbs = "" . getCDN() . "view/img/notfound_portrait.jpg";
|
||||
$obj->posterPortraitThumbsSmall = "" . getCDN() . "view/img/notfound_portrait.jpg";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3406,35 +3284,35 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
} else {
|
||||
if ($type == "article") {
|
||||
$obj->poster = "".getCDN()."view/img/article.png";
|
||||
$obj->thumbsJpg = "".getCDN()."view/img/article.png";
|
||||
$obj->thumbsJpgSmall = "".getCDN()."view/img/article.png";
|
||||
$obj->poster = "" . getCDN() . "view/img/article.png";
|
||||
$obj->thumbsJpg = "" . getCDN() . "view/img/article.png";
|
||||
$obj->thumbsJpgSmall = "" . getCDN() . "view/img/article.png";
|
||||
} elseif ($type == "pdf") {
|
||||
$obj->poster = "".getCDN()."view/img/pdf.png";
|
||||
$obj->thumbsJpg = "".getCDN()."view/img/pdf.png";
|
||||
$obj->thumbsJpgSmall = "".getCDN()."view/img/pdf.png";
|
||||
$obj->poster = "" . getCDN() . "view/img/pdf.png";
|
||||
$obj->thumbsJpg = "" . getCDN() . "view/img/pdf.png";
|
||||
$obj->thumbsJpgSmall = "" . getCDN() . "view/img/pdf.png";
|
||||
} elseif ($type == "image") {
|
||||
$obj->poster = "".getCDN()."view/img/image.png";
|
||||
$obj->thumbsJpg = "".getCDN()."view/img/image.png";
|
||||
$obj->thumbsJpgSmall = "".getCDN()."view/img/image.png";
|
||||
$obj->poster = "" . getCDN() . "view/img/image.png";
|
||||
$obj->thumbsJpg = "" . getCDN() . "view/img/image.png";
|
||||
$obj->thumbsJpgSmall = "" . getCDN() . "view/img/image.png";
|
||||
} elseif ($type == "zip") {
|
||||
$obj->poster = "".getCDN()."view/img/zip.png";
|
||||
$obj->thumbsJpg = "".getCDN()."view/img/zip.png";
|
||||
$obj->thumbsJpgSmall = "".getCDN()."view/img/zip.png";
|
||||
$obj->poster = "" . getCDN() . "view/img/zip.png";
|
||||
$obj->thumbsJpg = "" . getCDN() . "view/img/zip.png";
|
||||
$obj->thumbsJpgSmall = "" . getCDN() . "view/img/zip.png";
|
||||
} elseif (($type !== "audio") && ($type !== "linkAudio")) {
|
||||
if (file_exists($spectrumSource['path'])) {
|
||||
$obj->poster = $spectrumSource['url'];
|
||||
$obj->thumbsJpg = $spectrumSource['url'];
|
||||
$obj->thumbsJpgSmall = $spectrumSource['url'];
|
||||
} else {
|
||||
$obj->poster = "".getCDN()."view/img/notfound.jpg";
|
||||
$obj->thumbsJpg = "".getCDN()."view/img/notfoundThumbs.jpg";
|
||||
$obj->thumbsJpgSmall = "".getCDN()."view/img/notfoundThumbsSmall.jpg";
|
||||
$obj->poster = "" . getCDN() . "view/img/notfound.jpg";
|
||||
$obj->thumbsJpg = "" . getCDN() . "view/img/notfoundThumbs.jpg";
|
||||
$obj->thumbsJpgSmall = "" . getCDN() . "view/img/notfoundThumbsSmall.jpg";
|
||||
}
|
||||
} else {
|
||||
$obj->poster = "".getCDN()."view/img/audio_wave.jpg";
|
||||
$obj->thumbsJpg = "".getCDN()."view/img/audio_waveThumbs.jpg";
|
||||
$obj->thumbsJpgSmall = "".getCDN()."view/img/audio_waveThumbsSmall.jpg";
|
||||
$obj->poster = "" . getCDN() . "view/img/audio_wave.jpg";
|
||||
$obj->thumbsJpg = "" . getCDN() . "view/img/audio_waveThumbs.jpg";
|
||||
$obj->thumbsJpgSmall = "" . getCDN() . "view/img/audio_waveThumbsSmall.jpg";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3596,8 +3474,8 @@ if (!class_exists('Video')) {
|
|||
$subDir = "article";
|
||||
$subEmbedDir = "articleEmbed";
|
||||
}
|
||||
if(!empty($advancedCustom->makeVideosIDHarderToGuess)){
|
||||
$encryptedVideos_id = '.'.idToHash($videos_id);
|
||||
if (!empty($advancedCustom->makeVideosIDHarderToGuess)) {
|
||||
$encryptedVideos_id = '.' . idToHash($videos_id);
|
||||
$videos_id = $encryptedVideos_id;
|
||||
}
|
||||
if ($embed) {
|
||||
|
@ -3614,8 +3492,8 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if(!empty($advancedCustom->makeVideosIDHarderToGuess)){
|
||||
$encryptedVideos_id = '.'.idToHash($videos_id);
|
||||
if (!empty($advancedCustom->makeVideosIDHarderToGuess)) {
|
||||
$encryptedVideos_id = '.' . idToHash($videos_id);
|
||||
$videos_id = $encryptedVideos_id;
|
||||
}
|
||||
if ($embed) {
|
||||
|
@ -3972,6 +3850,12 @@ if (!class_exists('Video')) {
|
|||
$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() {
|
||||
return $this->serie_playlists_id;
|
||||
}
|
||||
|
@ -4127,4 +4011,4 @@ if (!class_exists('Video')) {
|
|||
// just to convert permalink into clean_title
|
||||
if (!empty($_GET['v']) && empty($_GET['videoName'])) {
|
||||
$_GET['videoName'] = Video::get_clean_title($_GET['v']);
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -52,7 +52,7 @@ $reflector = new ReflectionClass('API');
|
|||
return strcasecmp($matchesA[2], $matchesB[2]);
|
||||
});
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="container-fluid">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<details>
|
||||
|
|
|
@ -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>
|
|
@ -682,6 +682,30 @@ class AVideoPlugin {
|
|||
self::YPTend("{$value['dirName']}::" . __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
$plugins = Plugin::getAllEnabled();
|
||||
|
|
|
@ -42,7 +42,7 @@ class BulkEmbed extends PluginAbstract {
|
|||
|
||||
public function getPluginMenu() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -576,7 +576,7 @@ function createGalleryLiveSection($videos) {
|
|||
<?php
|
||||
if (!empty($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>';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,10 +5,12 @@ $obj = AVideoPlugin::getDataObject("Live");
|
|||
.liveVideo{
|
||||
position: relative;
|
||||
}
|
||||
.liveVideo .liveNow{
|
||||
.liveVideo .liveNow, .liveVideo .liveFuture{
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
.liveVideo .liveNow{
|
||||
background-color: rgba(255,0,0,0.7);
|
||||
}
|
||||
#availableLiveStream{
|
||||
|
@ -349,7 +351,7 @@ if (isVideo()) {
|
|||
}
|
||||
$('#liveVideos').slideDown();
|
||||
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 {
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class LiveLinks extends PluginAbstract {
|
|||
}
|
||||
|
||||
public function getPluginVersion() {
|
||||
return "3.2";
|
||||
return "4.0";
|
||||
}
|
||||
|
||||
public function canAddLinks() {
|
||||
|
@ -68,10 +68,25 @@ class LiveLinks extends PluginAbstract {
|
|||
include $global['systemRootPath'] . 'plugin/LiveLinks/view/menuRight.php';
|
||||
}
|
||||
|
||||
static function getAllActive() {
|
||||
static function getAllActive($future = false, $activeOnly = true, $notStarted = false) {
|
||||
global $global;
|
||||
_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);
|
||||
$rows = array();
|
||||
if ($res) {
|
||||
|
@ -105,7 +120,8 @@ class LiveLinks extends PluginAbstract {
|
|||
$filenameExtra = $global['systemRootPath'] . 'plugin/LiveLinks/view/extraItem.html';
|
||||
$filenameExtraVideoPage = $global['systemRootPath'] . 'plugin/LiveLinks/view/extraItemVideoPage.html';
|
||||
$filenameListItem = $global['systemRootPath'] . 'plugin/LiveLinks/view/videoListItem.html';
|
||||
$row = LiveLinks::getAllActive();
|
||||
$row = LiveLinks::getAllActive(true, true);
|
||||
//var_dump($row);exit;
|
||||
$array = array();
|
||||
$search = array(
|
||||
'_unique_id_',
|
||||
|
@ -155,6 +171,17 @@ class LiveLinks extends PluginAbstract {
|
|||
$newContentExtra = str_replace($search, $replace, $contentExtra);
|
||||
$newContentExtraVideoPage = str_replace($search, $replace, $contentExtraVideoPage);
|
||||
$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(
|
||||
"type" => "LiveLink",
|
||||
"html" => $newContent,
|
||||
|
@ -171,7 +198,9 @@ class LiveLinks extends PluginAbstract {
|
|||
"link" => self::getLinkToLiveFromId($value['id'], true),
|
||||
"href" => self::getLinkToLiveFromId($value['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) {
|
||||
global $global;
|
||||
if(empty($id)){
|
||||
if (empty($id)) {
|
||||
return false;
|
||||
}
|
||||
$ll = new LiveLinksTable($id);
|
||||
if(empty($ll->getLink())){
|
||||
if (empty($ll->getLink())) {
|
||||
return false;
|
||||
}
|
||||
$liveLink = 'Invalid livelink'.$id;
|
||||
$liveLink = 'Invalid livelink' . $id;
|
||||
if (filter_var($ll->getLink(), FILTER_VALIDATE_URL)) {
|
||||
$url = parse_url($ll->getLink());
|
||||
if ($url['scheme'] == 'https') {
|
||||
|
@ -365,7 +394,7 @@ class LiveLinks extends PluginAbstract {
|
|||
if (empty($otherInfo)) {
|
||||
$otherInfo = array();
|
||||
$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['description'] = UTF8encode($row['description']);
|
||||
$otherInfo['descriptionHTML'] = Video::htmlDescription($otherInfo['description']);
|
||||
|
@ -402,4 +431,34 @@ class LiveLinks extends PluginAbstract {
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ class LiveLinksTable extends ObjectYPT {
|
|||
$rows = array();
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $row) {
|
||||
$row['user_groups'] = self::getUserGorups($row['id']);
|
||||
$rows[] = $row;
|
||||
}
|
||||
} else {
|
||||
|
@ -142,6 +143,15 @@ class LiveLinksTable extends ObjectYPT {
|
|||
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(){
|
||||
global $global;
|
||||
if(!User::isLogged()){
|
||||
|
@ -162,5 +172,68 @@ class LiveLinksTable extends ObjectYPT {
|
|||
_error_log("Id for table " . static::getTableName() . " not defined for deletion", AVideoLog::$ERROR);
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,26 @@ CREATE TABLE IF NOT EXISTS `LiveLinks` (
|
|||
ON UPDATE CASCADE)
|
||||
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 FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||
|
|
20
plugin/LiveLinks/install/updateV4.0.sql
Normal file
20
plugin/LiveLinks/install/updateV4.0.sql
Normal 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;
|
|
@ -31,6 +31,15 @@ $t['title'] = $liveLink->getTitle();
|
|||
$t['link'] = $liveLink->getLink();
|
||||
$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']);
|
||||
$user_id = $u->getBdId();
|
||||
$subscribe = Subscribe::getButton($user_id);
|
||||
|
@ -50,7 +59,7 @@ $imgh = 255;
|
|||
|
||||
if (!empty($_GET['embed'])) {
|
||||
$video['videoLink'] = LiveLinks::getSourceLink($t['id']);
|
||||
include $global['systemRootPath'].'view/videoEmbeded.php';
|
||||
include $global['systemRootPath'] . 'view/videoEmbeded.php';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,10 @@ $o->setStatus($_POST['status']);
|
|||
$o->setTitle($_POST['title']);
|
||||
$o->setType($_POST['type']);
|
||||
|
||||
if($o->save()){
|
||||
if($id = $o->save()){
|
||||
$o = new LiveLinksTable($id);
|
||||
$o->deleteAllUserGorups();
|
||||
$o->addUserGorups($_POST['userGroups']);
|
||||
$obj->error = false;
|
||||
}
|
||||
echo json_encode($obj);
|
||||
|
|
18
plugin/LiveLinks/view/footer.php
Normal file
18
plugin/LiveLinks/view/footer.php
Normal 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>
|
|
@ -3,62 +3,97 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fas fa-link"></i> <?php echo __("Add an external Live Link"); ?>
|
||||
<span id="serverTime" class="pull-right"></span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<form id="liveLinksForm">
|
||||
<div class="row">
|
||||
<input type="hidden" name="linkId" id="linkId" value="" >
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="linkTitle"><?php echo __("Title"); ?>:</label>
|
||||
<input type="text" id="linkTitle" name="title" class="form-control input-sm" placeholder="<?php echo __("Title"); ?>" required="true">
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="linkLink"><?php echo __("Link"); ?> (m3u8):</label>
|
||||
<input type="text" id="linkLink" name="link" class="form-control input-sm" placeholder="HLS .m3u8 Link" required="true">
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="linkDescription"><?php echo __("Description"); ?>:</label>
|
||||
<textarea id="linkDescription" name="description" class="form-control input-sm" placeholder="<?php echo __("Description"); ?>" required="true"></textarea>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="inputLinkStarts"><?php echo __("Starts on"); ?>:</label>
|
||||
<input type="text" id="inputLinkStarts" name="start_date" class="form-control datepickerLink input-sm" placeholder="<?php echo __("Starts on"); ?>" required >
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="inputLinkEnd"><?php echo __("End on"); ?>:</label>
|
||||
<input type="text" id="inputLinkEnd" name="end_date" class="form-control datepickerLink input-sm" placeholder="<?php echo __("End on"); ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="title"><?php echo __("Category"); ?>:</label>
|
||||
<?php
|
||||
echo Layout::getCategorySelect('categories_id');
|
||||
?>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="linkType"><?php echo __("Type"); ?>:</label>
|
||||
<select class="form-control input-sm" name="type" id="linkType">
|
||||
<option value="public"><?php echo __("Public"); ?></option>
|
||||
<option value="unlisted"><?php echo __("Unlisted"); ?></option>
|
||||
<option value="logged_only"><?php echo __("Logged Users Only"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="linkStatus"><?php echo __("Status"); ?>:</label>
|
||||
<select class="form-control input-sm" name="status" id="linkStatus">
|
||||
<option value="a"><?php echo __("Active"); ?></option>
|
||||
<option value="i"><?php echo __("Inactive"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="btn-group pull-right">
|
||||
<span class="btn btn-success" id="newLiveLink"><i class="fas fa-plus"></i> <?php echo __("New"); ?></span>
|
||||
<button class="btn btn-primary" id="addLiveLink" type="submit"><i class="fas fa-save"></i> <?php echo __("Save"); ?></button>
|
||||
|
||||
<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">
|
||||
<input type="hidden" name="linkId" id="linkId" value="" >
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="linkTitle"><?php echo __("Title"); ?>:</label>
|
||||
<input type="text" id="linkTitle" name="title" class="form-control input-sm" placeholder="<?php echo __("Title"); ?>" required="true">
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="linkLink"><?php echo __("Link"); ?> (m3u8):</label>
|
||||
<input type="text" id="linkLink" name="link" class="form-control input-sm" placeholder="HLS .m3u8 Link" required="true">
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="linkDescription"><?php echo __("Description"); ?>:</label>
|
||||
<textarea id="linkDescription" name="description" class="form-control input-sm" placeholder="<?php echo __("Description"); ?>" required="true"></textarea>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="inputLinkStarts"><?php echo __("Starts on"); ?>:</label>
|
||||
<input type="text" id="inputLinkStarts" name="start_date" class="form-control datepickerLink input-sm" placeholder="<?php echo __("Starts on"); ?>" required >
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="inputLinkEnd"><?php echo __("End on"); ?>:</label>
|
||||
<input type="text" id="inputLinkEnd" name="end_date" class="form-control datepickerLink input-sm" placeholder="<?php echo __("End on"); ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="title"><?php echo __("Category"); ?>:</label>
|
||||
<?php
|
||||
echo Layout::getCategorySelect('categories_id');
|
||||
?>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="linkType"><?php echo __("Type"); ?>:</label>
|
||||
<select class="form-control input-sm" name="type" id="linkType">
|
||||
<option value="public"><?php echo __("Public"); ?></option>
|
||||
<option value="unlisted"><?php echo __("Unlisted"); ?></option>
|
||||
<option value="logged_only"><?php echo __("Logged Users Only"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="linkStatus"><?php echo __("Status"); ?>:</label>
|
||||
<select class="form-control input-sm" name="status" id="linkStatus">
|
||||
<option value="a"><?php echo __("Active"); ?></option>
|
||||
<option value="i"><?php echo __("Inactive"); ?></option>
|
||||
</select>
|
||||
</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="btn-group pull-right">
|
||||
<span class="btn btn-success" id="newLiveLink"><i class="fas fa-plus"></i> <?php echo __("New"); ?></span>
|
||||
<button class="btn btn-primary" id="addLiveLink" type="submit"><i class="fas fa-save"></i> <?php echo __("Save"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
|
@ -105,16 +140,8 @@
|
|||
</div>
|
||||
<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>
|
||||
<?php $today = getdate(); ?>
|
||||
<script type="text/javascript">
|
||||
$(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({
|
||||
"ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/LiveLinks/view/liveLinks.json.php",
|
||||
"columns": [
|
||||
|
@ -211,6 +238,10 @@
|
|||
$('select[name="categories_id"]').val(data.categories_id);
|
||||
$('select[name="categories_id"]').trigger('change');
|
||||
$('#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>
|
|
@ -1,3 +1,11 @@
|
|||
<?php
|
||||
require_once '../../videos/configuration.php';
|
||||
|
||||
if(empty($obj)){
|
||||
$obj = AVideoPlugin::getDataObject('MaintenanceMode');
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<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/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/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(); ?>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/js/select2/select2.min.js"></script>
|
||||
|
|
|
@ -1,92 +1,93 @@
|
|||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.fn.extend({
|
||||
$.fn.extend({
|
||||
|
||||
countdown100: function(options) {
|
||||
var defaults = {
|
||||
timeZone: "",
|
||||
endtimeYear: 0,
|
||||
endtimeMonth: 0,
|
||||
endtimeDate: 0,
|
||||
endtimeHours: 0,
|
||||
endtimeMinutes: 0,
|
||||
endtimeSeconds: 0,
|
||||
}
|
||||
|
||||
var options = $.extend(defaults, options);
|
||||
|
||||
return this.each(function() {
|
||||
var obj = $(this);
|
||||
var timeNow = new Date();
|
||||
|
||||
var tZ = options.timeZone; console.log(tZ);
|
||||
var endYear = options.endtimeYear;
|
||||
var endMonth = options.endtimeMonth;
|
||||
var endDate = options.endtimeDate;
|
||||
var endHours = options.endtimeHours;
|
||||
var endMinutes = options.endtimeMinutes;
|
||||
var endSeconds = options.endtimeSeconds;
|
||||
|
||||
if(tZ == "") {
|
||||
var deadline = new Date(endYear, endMonth - 1, endDate, endHours, endMinutes, endSeconds);
|
||||
}
|
||||
else {
|
||||
var deadline = moment.tz([endYear, endMonth - 1, endDate, endHours, endMinutes, endSeconds], tZ).format();
|
||||
}
|
||||
|
||||
if(Date.parse(deadline) < Date.parse(timeNow)) {
|
||||
var deadline = new Date(Date.parse(new Date()) + endDate * 24 * 60 * 60 * 1000 + endHours * 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
|
||||
initializeClock(deadline);
|
||||
|
||||
function getTimeRemaining(endtime) {
|
||||
var t = Date.parse(endtime) - Date.parse(new Date());
|
||||
var seconds = Math.floor((t / 1000) % 60);
|
||||
var minutes = Math.floor((t / 1000 / 60) % 60);
|
||||
var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
|
||||
var days = Math.floor(t / (1000 * 60 * 60 * 24));
|
||||
return {
|
||||
'total': t,
|
||||
'days': days,
|
||||
'hours': hours,
|
||||
'minutes': minutes,
|
||||
'seconds': seconds
|
||||
};
|
||||
}
|
||||
|
||||
function initializeClock(endtime) {
|
||||
var daysSpan = $(obj).find('.days');
|
||||
var hoursSpan = $(obj).find('.hours');
|
||||
var minutesSpan = $(obj).find('.minutes');
|
||||
var secondsSpan = $(obj).find('.seconds');
|
||||
|
||||
function updateClock() {
|
||||
var t = getTimeRemaining(endtime);
|
||||
|
||||
daysSpan.html(t.days);
|
||||
hoursSpan.html(('0' + t.hours).slice(-2));
|
||||
minutesSpan.html(('0' + t.minutes).slice(-2));
|
||||
secondsSpan.html(('0' + t.seconds).slice(-2))
|
||||
|
||||
if (t.total <= 0) {
|
||||
clearInterval(timeinterval);
|
||||
}
|
||||
countdown100: function (options) {
|
||||
var defaults = {
|
||||
timeZone: "",
|
||||
endtimeYear: 0,
|
||||
endtimeMonth: 0,
|
||||
endtimeDate: 0,
|
||||
endtimeHours: 0,
|
||||
endtimeMinutes: 0,
|
||||
endtimeSeconds: 0,
|
||||
}
|
||||
|
||||
updateClock();
|
||||
var timeinterval = setInterval(updateClock, 1000);
|
||||
}
|
||||
var options = $.extend(defaults, options);
|
||||
|
||||
|
||||
return this.each(function () {
|
||||
var obj = $(this);
|
||||
var timeNow = new Date();
|
||||
|
||||
var tZ = options.timeZone;
|
||||
console.log(tZ);
|
||||
var endYear = options.endtimeYear;
|
||||
var endMonth = options.endtimeMonth;
|
||||
var endDate = options.endtimeDate;
|
||||
var endHours = options.endtimeHours;
|
||||
var endMinutes = options.endtimeMinutes;
|
||||
var endSeconds = options.endtimeSeconds;
|
||||
|
||||
if (tZ == "") {
|
||||
var deadline = new Date(endYear, endMonth - 1, endDate, endHours, endMinutes, endSeconds);
|
||||
} else {
|
||||
var deadline = moment.tz([endYear, endMonth - 1, endDate, endHours, endMinutes, endSeconds], tZ).format();
|
||||
}
|
||||
|
||||
if (Date.parse(deadline) < Date.parse(timeNow)) {
|
||||
var deadline = new Date(Date.parse(new Date()) + endDate * 24 * 60 * 60 * 1000 + endHours * 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
initializeClock(deadline);
|
||||
|
||||
function getTimeRemaining(endtime) {
|
||||
var t = Date.parse(endtime) - Date.parse(new Date());
|
||||
var seconds = Math.floor((t / 1000) % 60);
|
||||
var minutes = Math.floor((t / 1000 / 60) % 60);
|
||||
var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
|
||||
var days = Math.floor(t / (1000 * 60 * 60 * 24));
|
||||
return {
|
||||
'total': t,
|
||||
'days': days,
|
||||
'hours': hours,
|
||||
'minutes': minutes,
|
||||
'seconds': seconds
|
||||
};
|
||||
}
|
||||
|
||||
function initializeClock(endtime) {
|
||||
var daysSpan = $(obj).find('.days');
|
||||
var hoursSpan = $(obj).find('.hours');
|
||||
var minutesSpan = $(obj).find('.minutes');
|
||||
var secondsSpan = $(obj).find('.seconds');
|
||||
|
||||
function updateClock() {
|
||||
var t = getTimeRemaining(endtime);
|
||||
|
||||
daysSpan.html(t.days);
|
||||
hoursSpan.html(('0' + t.hours).slice(-2));
|
||||
minutesSpan.html(('0' + t.minutes).slice(-2));
|
||||
secondsSpan.html(('0' + t.seconds).slice(-2))
|
||||
|
||||
if (t.total <= 0) {
|
||||
location.reload();
|
||||
clearInterval(timeinterval);
|
||||
}
|
||||
}
|
||||
|
||||
updateClock();
|
||||
var timeinterval = setInterval(updateClock, 1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
|
@ -171,7 +171,7 @@ Passcode: {password}
|
|||
public function getPluginMenu() {
|
||||
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="'.$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) {
|
||||
|
|
|
@ -89,7 +89,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
$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)) {
|
||||
$object->msg = "Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . Video::getStoragePath()."original_" . $filename . ")";
|
||||
|
|
|
@ -69,7 +69,7 @@ class Permissions extends PluginAbstract {
|
|||
|
||||
public function getPluginMenu() {
|
||||
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() {
|
||||
|
|
|
@ -752,7 +752,8 @@ class PlayLists extends PluginAbstract {
|
|||
|
||||
public function getPluginMenu() {
|
||||
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>';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -357,6 +357,10 @@ class PlayerSkins extends PluginAbstract {
|
|||
$currentTime = self::getCurrentTime();
|
||||
}
|
||||
|
||||
if(!empty($global['doNotLoadPlayer'])){
|
||||
return '';
|
||||
}
|
||||
|
||||
if(empty($prepareStartPlayerJS_onPlayerReady)){
|
||||
$prepareStartPlayerJS_onPlayerReady = array();
|
||||
}
|
||||
|
|
|
@ -304,6 +304,14 @@ abstract class PluginAbstract {
|
|||
public function getModeYouTube($videos_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getModeLive($key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getModeLiveLink($liveLink_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getModeYouTubeLive($users_id) {
|
||||
return false;
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -141,6 +141,11 @@ if (isRTL()) {
|
|||
<script>
|
||||
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
||||
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>
|
||||
<?php
|
||||
if (!$config->getDisable_analytics()) {
|
||||
|
|
|
@ -46,7 +46,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
$video = new Video("", $filename, $videos_id);
|
||||
if ($video->getTitle() === "Video automatically booked") {
|
||||
$video->setTitle($title);
|
||||
$video->setStatus('i');
|
||||
$video->setStatus(Video::$statusInactive);
|
||||
}
|
||||
}
|
||||
//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);
|
||||
}
|
||||
if (empty($advancedCustom->makeVideosInactiveAfterEncode) && $video->getTitle() !== "Video automatically booked") {
|
||||
|
||||
// set active
|
||||
|
||||
$video->setStatus('a');
|
||||
} else if (empty($advancedCustom->makeVideosUnlistedAfterEncode) && $video->getTitle() !== "Video automatically booked") {
|
||||
|
||||
// set active
|
||||
|
||||
$video->setStatus('u');
|
||||
} else {
|
||||
$video->setStatus('i');
|
||||
}
|
||||
|
||||
$video->setAutoStatus(Video::$statusInactive);
|
||||
|
||||
$id = $video->save();
|
||||
if ($id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue