From f7dd239f7a5efacbcd465c7d62e2a0a0f21003ac Mon Sep 17 00:00:00 2001 From: DanielnetoDotCom Date: Thu, 29 Apr 2021 12:36:39 -0300 Subject: [PATCH] https://github.com/WWBN/AVideo/issues/5028 Fixes regarding the encoder process, do not process more then once. --- install/recoverFilesToVideos.php | 2 +- objects/Object.php | 13 +- objects/aVideoEncoder.json.php | 25 +- objects/aVideoEncoderNotifyIsDone.json.php | 32 +- objects/aVideoQueueEncoder.json.php | 2 +- objects/getTimes.json.php | 1 + objects/user.php | 25 ++ objects/video.php | 380 ++++++------------ plugin/ADs/pluginMenu.html | 2 +- plugin/API/info.php | 2 +- plugin/API/pluginMenu.html | 2 +- plugin/AVideoPlugin.php | 24 ++ plugin/BulkEmbed/BulkEmbed.php | 2 +- plugin/Gallery/functions.php | 2 +- plugin/Live/view/menuRight.php | 6 +- plugin/LiveLinks/LiveLinks.php | 77 +++- plugin/LiveLinks/Objects/LiveLinksTable.php | 73 ++++ plugin/LiveLinks/install/install.sql | 20 + plugin/LiveLinks/install/updateV4.0.sql | 20 + plugin/LiveLinks/view/Live.php | 11 +- plugin/LiveLinks/view/addLiveLink.php | 5 +- plugin/LiveLinks/view/footer.php | 18 + plugin/LiveLinks/view/panel.php | 145 ++++--- plugin/MaintenanceMode/index.php | 14 +- .../vendor/countdowntime/countdowntime.js | 159 ++++---- plugin/Meet/Meet.php | 2 +- plugin/MobileManager/upload.php | 2 +- plugin/Permissions/Permissions.php | 2 +- plugin/PlayLists/PlayLists.php | 3 +- plugin/PlayerSkins/PlayerSkins.php | 4 + plugin/Plugin.abstract.php | 8 + plugin/TopMenu/pluginMenu.html | 2 +- plugin/VideoTags/pluginMenu.html | 2 +- view/include/head.php | 5 + view/mini-upload-form/upload.php | 17 +- 35 files changed, 631 insertions(+), 478 deletions(-) create mode 100644 plugin/LiveLinks/install/updateV4.0.sql create mode 100644 plugin/LiveLinks/view/footer.php diff --git a/install/recoverFilesToVideos.php b/install/recoverFilesToVideos.php index 411fdf53e6..2c12a1b28b 100644 --- a/install/recoverFilesToVideos.php +++ b/install/recoverFilesToVideos.php @@ -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"; diff --git a/objects/Object.php b/objects/Object.php index 064e756fad..15b8a93729 100644 --- a/objects/Object.php +++ b/objects/Object.php @@ -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; diff --git a/objects/aVideoEncoder.json.php b/objects/aVideoEncoder.json.php index 5b2519c33c..c3cf47305c 100644 --- a/objects/aVideoEncoder.json.php +++ b/objects/aVideoEncoder.json.php @@ -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")) { diff --git a/objects/aVideoEncoderNotifyIsDone.json.php b/objects/aVideoEncoderNotifyIsDone.json.php index b46e3a5ea7..856bbc288e 100644 --- a/objects/aVideoEncoderNotifyIsDone.json.php +++ b/objects/aVideoEncoderNotifyIsDone.json.php @@ -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; diff --git a/objects/aVideoQueueEncoder.json.php b/objects/aVideoQueueEncoder.json.php index 504f97b49c..221c21954a 100644 --- a/objects/aVideoQueueEncoder.json.php +++ b/objects/aVideoQueueEncoder.json.php @@ -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 diff --git a/objects/getTimes.json.php b/objects/getTimes.json.php index 71757441b8..b65e2a9887 100644 --- a/objects/getTimes.json.php +++ b/objects/getTimes.json.php @@ -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)); \ No newline at end of file diff --git a/objects/user.php b/objects/user.php index 319cc9cc99..f09233231e 100644 --- a/objects/user.php +++ b/objects/user.php @@ -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; + } } diff --git a/objects/video.php b/objects/video.php index d63039e115..59d7c25342 100644 --- a/objects/video.php +++ b/objects/video.php @@ -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']); -} +} \ No newline at end of file diff --git a/plugin/ADs/pluginMenu.html b/plugin/ADs/pluginMenu.html index b8460b742a..b71ce8b23b 100644 --- a/plugin/ADs/pluginMenu.html +++ b/plugin/ADs/pluginMenu.html @@ -1 +1 @@ - Edit \ No newline at end of file + \ No newline at end of file diff --git a/plugin/API/info.php b/plugin/API/info.php index d437022b36..583ee960ac 100644 --- a/plugin/API/info.php +++ b/plugin/API/info.php @@ -52,7 +52,7 @@ $reflector = new ReflectionClass('API'); return strcasecmp($matchesA[2], $matchesB[2]); }); ?> -
+
  • diff --git a/plugin/API/pluginMenu.html b/plugin/API/pluginMenu.html index 04e3bde501..607c5f661e 100644 --- a/plugin/API/pluginMenu.html +++ b/plugin/API/pluginMenu.html @@ -1 +1 @@ - Info \ No newline at end of file + \ No newline at end of file diff --git a/plugin/AVideoPlugin.php b/plugin/AVideoPlugin.php index b29beeaf37..f184b064e9 100644 --- a/plugin/AVideoPlugin.php +++ b/plugin/AVideoPlugin.php @@ -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(); diff --git a/plugin/BulkEmbed/BulkEmbed.php b/plugin/BulkEmbed/BulkEmbed.php index e54efdc623..b2b4c3325c 100644 --- a/plugin/BulkEmbed/BulkEmbed.php +++ b/plugin/BulkEmbed/BulkEmbed.php @@ -42,7 +42,7 @@ class BulkEmbed extends PluginAbstract { public function getPluginMenu() { global $global; - $menu = 'Search'; + $menu = ''; return $menu; } diff --git a/plugin/Gallery/functions.php b/plugin/Gallery/functions.php index 75c865353d..a8b665694f 100644 --- a/plugin/Gallery/functions.php +++ b/plugin/Gallery/functions.php @@ -576,7 +576,7 @@ function createGalleryLiveSection($videos) { $(document).ready(function () {eval("' . $video['galleryCallback'] . '")});'; + echo ''; } diff --git a/plugin/Live/view/menuRight.php b/plugin/Live/view/menuRight.php index 70f8a2b01f..9578d18a2b 100644 --- a/plugin/Live/view/menuRight.php +++ b/plugin/Live/view/menuRight.php @@ -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 { diff --git a/plugin/LiveLinks/LiveLinks.php b/plugin/LiveLinks/LiveLinks.php index df824c3d50..76a3e5fd4f 100644 --- a/plugin/LiveLinks/LiveLinks.php +++ b/plugin/LiveLinks/LiveLinks.php @@ -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 ''; + } + + 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); + } + } diff --git a/plugin/LiveLinks/Objects/LiveLinksTable.php b/plugin/LiveLinks/Objects/LiveLinksTable.php index 637a758fe4..45d73c4240 100644 --- a/plugin/LiveLinks/Objects/LiveLinksTable.php +++ b/plugin/LiveLinks/Objects/LiveLinksTable.php @@ -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; + } } diff --git a/plugin/LiveLinks/install/install.sql b/plugin/LiveLinks/install/install.sql index 3fc322dc57..e14c804b52 100644 --- a/plugin/LiveLinks/install/install.sql +++ b/plugin/LiveLinks/install/install.sql @@ -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; diff --git a/plugin/LiveLinks/install/updateV4.0.sql b/plugin/LiveLinks/install/updateV4.0.sql new file mode 100644 index 0000000000..da87c8c53a --- /dev/null +++ b/plugin/LiveLinks/install/updateV4.0.sql @@ -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; \ No newline at end of file diff --git a/plugin/LiveLinks/view/Live.php b/plugin/LiveLinks/view/Live.php index 6479b182ba..2b86a2019d 100644 --- a/plugin/LiveLinks/view/Live.php +++ b/plugin/LiveLinks/view/Live.php @@ -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 = "{$t['title']}
    {$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; } diff --git a/plugin/LiveLinks/view/addLiveLink.php b/plugin/LiveLinks/view/addLiveLink.php index 90a9c21568..8a89f60b59 100644 --- a/plugin/LiveLinks/view/addLiveLink.php +++ b/plugin/LiveLinks/view/addLiveLink.php @@ -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); diff --git a/plugin/LiveLinks/view/footer.php b/plugin/LiveLinks/view/footer.php new file mode 100644 index 0000000000..f4d23a3f34 --- /dev/null +++ b/plugin/LiveLinks/view/footer.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/plugin/LiveLinks/view/panel.php b/plugin/LiveLinks/view/panel.php index 0824091f1c..b0c07d48d3 100644 --- a/plugin/LiveLinks/view/panel.php +++ b/plugin/LiveLinks/view/panel.php @@ -3,62 +3,97 @@
    -
    -
    - -
    - - " required="true"> -
    -
    - - -
    -
    - - -
    -
    - - " required > -
    -
    - - " required> -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    - - + +
    + +
    +
    +
    + +
    + + " required="true"> +
    +
    + + +
    +
    + + +
    +
    + + " required > +
    +
    + + " required> +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +

    +
    + +
    + +
    + /> + +
    +
    + +
    +
    +
    +
    +
    + + +
    -
    +
    @@ -105,16 +140,8 @@
    - \ No newline at end of file diff --git a/plugin/MaintenanceMode/index.php b/plugin/MaintenanceMode/index.php index 9a5a194576..adda0c49ec 100644 --- a/plugin/MaintenanceMode/index.php +++ b/plugin/MaintenanceMode/index.php @@ -1,3 +1,11 @@ + @@ -12,7 +20,7 @@ - + @@ -114,8 +122,8 @@ - - + diff --git a/plugin/MaintenanceMode/vendor/countdowntime/countdowntime.js b/plugin/MaintenanceMode/vendor/countdowntime/countdowntime.js index 42e47accfe..b898cba1ea 100644 --- a/plugin/MaintenanceMode/vendor/countdowntime/countdowntime.js +++ b/plugin/MaintenanceMode/vendor/countdowntime/countdowntime.js @@ -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); \ No newline at end of file diff --git a/plugin/Meet/Meet.php b/plugin/Meet/Meet.php index 1a330bb35c..415a704722 100644 --- a/plugin/Meet/Meet.php +++ b/plugin/Meet/Meet.php @@ -171,7 +171,7 @@ Passcode: {password} public function getPluginMenu() { global $global; //return ' Edit'; - return ' Check Servers'; + return ''; } static function getMeetServerStatus($cache = 30) { diff --git a/plugin/MobileManager/upload.php b/plugin/MobileManager/upload.php index 6549189544..0136f2a373 100644 --- a/plugin/MobileManager/upload.php +++ b/plugin/MobileManager/upload.php @@ -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 . ")"; diff --git a/plugin/Permissions/Permissions.php b/plugin/Permissions/Permissions.php index b26162bbbc..b99f25ed78 100644 --- a/plugin/Permissions/Permissions.php +++ b/plugin/Permissions/Permissions.php @@ -69,7 +69,7 @@ class Permissions extends PluginAbstract { public function getPluginMenu() { global $global; - return ' Edit'; + return ''; } static function getForm() { diff --git a/plugin/PlayLists/PlayLists.php b/plugin/PlayLists/PlayLists.php index b9dbc85775..bd7353c447 100644 --- a/plugin/PlayLists/PlayLists.php +++ b/plugin/PlayLists/PlayLists.php @@ -752,7 +752,8 @@ class PlayLists extends PluginAbstract { public function getPluginMenu() { global $global; - return ' Schedule'; + return ''; + //return ' Schedule'; } } diff --git a/plugin/PlayerSkins/PlayerSkins.php b/plugin/PlayerSkins/PlayerSkins.php index d63b26bbe9..681f6057ab 100644 --- a/plugin/PlayerSkins/PlayerSkins.php +++ b/plugin/PlayerSkins/PlayerSkins.php @@ -357,6 +357,10 @@ class PlayerSkins extends PluginAbstract { $currentTime = self::getCurrentTime(); } + if(!empty($global['doNotLoadPlayer'])){ + return ''; + } + if(empty($prepareStartPlayerJS_onPlayerReady)){ $prepareStartPlayerJS_onPlayerReady = array(); } diff --git a/plugin/Plugin.abstract.php b/plugin/Plugin.abstract.php index 5ef7121781..94e74791dc 100644 --- a/plugin/Plugin.abstract.php +++ b/plugin/Plugin.abstract.php @@ -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; diff --git a/plugin/TopMenu/pluginMenu.html b/plugin/TopMenu/pluginMenu.html index 36ca1deeac..6663c60723 100644 --- a/plugin/TopMenu/pluginMenu.html +++ b/plugin/TopMenu/pluginMenu.html @@ -1 +1 @@ - Create Menus \ No newline at end of file + \ No newline at end of file diff --git a/plugin/VideoTags/pluginMenu.html b/plugin/VideoTags/pluginMenu.html index 261f234776..7207fe3509 100644 --- a/plugin/VideoTags/pluginMenu.html +++ b/plugin/VideoTags/pluginMenu.html @@ -1 +1 @@ - Create Tag Type \ No newline at end of file + \ No newline at end of file diff --git a/view/include/head.php b/view/include/head.php index e66186f710..b4f3f0e2bd 100644 --- a/view/include/head.php +++ b/view/include/head.php @@ -141,6 +141,11 @@ if (isRTL()) { getDisable_analytics()) { diff --git a/view/mini-upload-form/upload.php b/view/mini-upload-form/upload.php index d845c7692a..fd30d37a69 100644 --- a/view/mini-upload-form/upload.php +++ b/view/mini-upload-form/upload.php @@ -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) {