diff --git a/install/checkConfiguration.php b/install/checkConfiguration.php index e1c17e3209..e70c127d6c 100644 --- a/install/checkConfiguration.php +++ b/install/checkConfiguration.php @@ -4,7 +4,7 @@ if (file_exists("../videos/configuration.php")) { exit; } -$installationVersion = "10.2"; +$installationVersion = "10.3"; error_log("Installation: ".__LINE__." ". json_encode($_POST)); header('Content-Type: application/json'); diff --git a/install/database.sql b/install/database.sql index 46daa925f7..80a9cbf004 100644 --- a/install/database.sql +++ b/install/database.sql @@ -147,6 +147,7 @@ CREATE TABLE IF NOT EXISTS `videos` ( `encoderURL` VARCHAR(255) NULL DEFAULT NULL, `filepath` VARCHAR(255) NULL DEFAULT NULL, `filesize` BIGINT(19) UNSIGNED NULL DEFAULT 0, + `live_transmitions_history_id` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `fk_videos_users_idx` (`users_id` ASC), INDEX `fk_videos_categories1_idx` (`categories_id` ASC), @@ -158,6 +159,7 @@ CREATE TABLE IF NOT EXISTS `videos` ( INDEX `video_filename_INDEX` (`filename` ASC), INDEX `video_status_idx` (`status` ASC), INDEX `video_type_idx` (`type` ASC) , + INDEX `fk_videos_live_transmitions_history1_idx` (`live_transmitions_history_id` ASC), FULLTEXT INDEX `index17vname` (`title`), FULLTEXT INDEX `index18vdesc` (`description`), CONSTRAINT `fk_videos_sites1` diff --git a/objects/functiongetPagination.php b/objects/functiongetPagination.php index 006454949c..bf487fd153 100644 --- a/objects/functiongetPagination.php +++ b/objects/functiongetPagination.php @@ -16,6 +16,7 @@ }); $container$uid.on('append.infiniteScroll', function (event, response, path, items) { lazyImage(); + avideoSocket(); }); }); diff --git a/objects/functions.php b/objects/functions.php index 474024c785..dd8c12fc37 100644 --- a/objects/functions.php +++ b/objects/functions.php @@ -3309,7 +3309,7 @@ function TimeLogStart($name) { function TimeLogEnd($name, $line, $TimeLogLimit = 0.7) { global $global; - if (!empty($global['noDebug'])) { + if (!empty($global['noDebug']) || empty($global['start'][$name])) { return false; } $time = microtime(); @@ -3843,7 +3843,7 @@ function _dieAndLogObject($obj, $prefix = "") { } function isAVideoPlayer() { - if (isVideo()) { + if (isVideo() || isSerie()) { return true; } return false; @@ -3998,12 +3998,53 @@ function URLsAreSameVideo($url1, $url2) { } function getVideos_id() { + global $_getVideos_id; + if(isset($_getVideos_id)){ + return $_getVideos_id; + } if (isVideo()) { - return getVideoIDFromURL(getSelfURI()); + $videos_id = getVideoIDFromURL(getSelfURI()); + if(empty($videos_id) && !empty($_REQUEST['videoName'])){ + $video = Video::getVideoFromCleanTitle($_REQUEST['videoName']); + if(!empty($video)){ + $videos_id = $video['id']; + } + } + setVideos_id($videos_id); + return $videos_id; } return false; } +function setVideos_id($videos_id) { + global $_getVideos_id; + $_getVideos_id = $videos_id; +} + +function getPlaylists_id() { + global $_isPlayList; + if(!isset($_isPlayList)){ + $_isPlayList = false; + if(isPlayList()){ + $_isPlayList = intval(@$_GET['playlists_id']); + if(empty($_isPlayList)){ + $videos_id = getVideos_id(); + if(empty($videos_id)){ + $_isPlayList = false; + }else{ + $v = Video::getVideoLight($videos_id); + if(empty($v) || empty($v['serie_playlists_id'])){ + $_isPlayList = false; + }else{ + $_isPlayList = $v['serie_playlists_id']; + } + } + } + } + } + return $_isPlayList; +} + function isVideoOrAudioNotEmbed(){ if(!isVideo()){ return false; diff --git a/objects/include_config.php b/objects/include_config.php index 912883c0b6..87db1a8b03 100644 --- a/objects/include_config.php +++ b/objects/include_config.php @@ -125,6 +125,13 @@ if (empty($global['bodyClass'])) { $global['bodyClass'] = ''; } $global['allowedExtension'] = array('gif', 'jpg', 'mp4', 'webm', 'mp3', 'm4a', 'ogg', 'zip', 'm3u8'); + +if(empty($global['avideo_resolutions'])){ + $global['avideo_resolutions'] = array(240, 360, 480, 540, 720, 1080, 1440, 2160); +} + +sort($global['avideo_resolutions']); + $advancedCustom = AVideoPlugin::getObjectData('CustomizeAdvanced'); if (empty($global['disableTimeFix'])) { diff --git a/objects/playlist.php b/objects/playlist.php index 228e26ef3a..7844d4b49e 100644 --- a/objects/playlist.php +++ b/objects/playlist.php @@ -1,4 +1,5 @@ $value2) { + if (!empty($value2['serie_playlists_id'])) { + $videosP[$key]['icon'] = ''; + } else { + $videosP[$key]['icon'] = ''; + } + } + + return $videosP; + } + /** * * @global type $global @@ -65,8 +80,7 @@ class PlayList extends ObjectYPT * @param type $isVideoIdPresent pass the ID of the video checking * @return boolean */ - public static function getAllFromUser($userId, $publicOnly = true, $status = false, $playlists_id = 0, $try = 0) - { + public static function getAllFromUser($userId, $publicOnly = true, $status = false, $playlists_id = 0, $try = 0) { global $global, $config, $refreshCacheFromPlaylist; $playlists_id = intval($playlists_id); $formats = ""; @@ -162,9 +176,62 @@ class PlayList extends ObjectYPT } return $rows; } + + /** + * + * @global type $global + * @param type $publicOnly + * @param type $userId if not present check session + * @param type $isVideoIdPresent pass the ID of the video checking + * @return boolean + */ + public static function getAllFromUserLight($userId, $publicOnly = true, $status = false, $playlists_id = 0, $onlyWithVideos = false) { + global $global, $config, $refreshCacheFromPlaylist; + $playlists_id = intval($playlists_id); + $formats = ""; + $values = array(); + $sql = "SELECT u.*, pl.* FROM " . static::getTableName() . " pl " + . " LEFT JOIN users u ON u.id = users_id WHERE 1=1 "; + if (!empty($playlists_id)) { + $sql .= " AND pl.id = '{$playlists_id}' "; + } + if (!empty($status)) { + $status = str_replace("'", "", $status); + $sql .= " AND pl.status = '{$status}' "; + } elseif ($publicOnly) { + if(User::getId() != $userId){ + $sql .= " AND pl.status = 'public' "; + } + } + if (!empty($userId)) { + $sql .= " AND users_id = ? "; + $formats .= "i"; + $values[] = $userId; + } + $sql .= self::getSqlFromPost("pl."); + //echo $sql, $userId;exit; + $res = sqlDAL::readSql($sql, $formats, $values, $refreshCacheFromPlaylist); + $fullData = sqlDAL::fetchAllAssoc($res); + sqlDAL::close($res); + $rows = array(); + if ($res != false) { + foreach ($fullData as $row) { + $row = cleanUpRowFromDatabase($row); + if($onlyWithVideos){ + $videos = self::getVideosIDFromPlaylistLight($row['id']); + if(empty($videos)){ + continue; + } + } + $rows[] = $row; + } + } else { + die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); + } + return $rows; + } - public static function fixDuplicatePlayList($user_id) - { + public static function fixDuplicatePlayList($user_id) { if (empty($user_id)) { return false; } @@ -217,8 +284,7 @@ class PlayList extends ObjectYPT } } - public static function getAllFromUserVideo($userId, $videos_id, $publicOnly = true, $status = false) - { + public static function getAllFromUserVideo($userId, $videos_id, $publicOnly = true, $status = false) { if (empty($_SESSION['user']['sessionCache']['getAllFromUserVideo'][$videos_id][$userId][intval($publicOnly)][intval($status)])) { $rows = self::getAllFromUser($userId, $publicOnly, $status); foreach ($rows as $key => $value) { @@ -235,25 +301,32 @@ class PlayList extends ObjectYPT return $rows; } - private static function removeCache($videos_id) - { + private static function removeCache($videos_id) { $close = false; _session_start(); unset($_SESSION['user']['sessionCache']['getAllFromUserVideo'][$videos_id]); unset($_SESSION['user']['sessionCache']['getAllFromUserVideo'][$videos_id]); } - public static function getVideosIDFromPlaylistLight($playlists_id) - { - global $global; + public static function getVideosIDFromPlaylistLight($playlists_id) { + global $global, $getVideosIDFromPlaylistLight; + + if(!isset($getVideosIDFromPlaylistLight)){ + $getVideosIDFromPlaylistLight = array(); + } + + if(isset($getVideosIDFromPlaylistLight[$playlists_id])){ + return $getVideosIDFromPlaylistLight[$playlists_id]; + } + $sql = "SELECT * FROM playlists_has_videos p WHERE playlists_id = ? ORDER BY `order` "; /* - cleanSearchVar(); - $sort = @$_POST['sort']; - $_POST['sort'] = array(); - $sql .= self::getSqlFromPost(); - $_POST['sort'] = $sort; - reloadSearchVar(); + cleanSearchVar(); + $sort = @$_POST['sort']; + $_POST['sort'] = array(); + $sql .= self::getSqlFromPost(); + $_POST['sort'] = $sort; + reloadSearchVar(); * */ $res = sqlDAL::readSql($sql, "i", array($playlists_id)); @@ -267,16 +340,15 @@ class PlayList extends ObjectYPT } else { die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); } + $getVideosIDFromPlaylistLight[$playlists_id] = $rows; return $rows; } - public static function setCache($name, $value) - { + public static function setCache($name, $value) { parent::setCache($name, $value); } - public static function getVideosFromPlaylist($playlists_id) - { + public static function getVideosFromPlaylist($playlists_id) { $sql = "SELECT *,v.created as cre, p.`order` as video_order, v.externalOptions as externalOptions " . ", (SELECT count(id) FROM likes as l where l.videos_id = v.id AND `like` = 1 ) as likes " . " FROM playlists_has_videos p " @@ -290,7 +362,7 @@ class PlayList extends ObjectYPT $sql .= self::getSqlFromPost(); reloadSearchVar(); $_POST['sort'] = $sort; - $cacheName = "getVideosFromPlaylist{$playlists_id}".md5($sql); + $cacheName = "getVideosFromPlaylist{$playlists_id}" . md5($sql); $rows = self::getCache($cacheName, 0); if (empty($rows)) { global $global; @@ -301,8 +373,6 @@ class PlayList extends ObjectYPT $rows = array(); $SubtitleSwitcher = AVideoPlugin::loadPluginIfEnabled("SubtitleSwitcher"); if ($res != false) { - $timeLog2 = __FILE__ . " - getVideosFromPlaylist: {$playlists_id}"; - TimeLogStart($timeLog2); foreach ($fullData as $row) { $row = cleanUpRowFromDatabase($row); if (!empty($_GET['isChannel'])) { @@ -310,35 +380,26 @@ class PlayList extends ObjectYPT $row['pluginBtns'] = AVideoPlugin::getPlayListButtons($playlists_id); $row['humancreate'] = humanTiming(strtotime($row['cre'])); } - TimeLogEnd($timeLog2, __LINE__); $images = Video::getImageFromFilename($row['filename'], $row['type']); - TimeLogEnd($timeLog2, __LINE__); + if (!file_exists($images->posterLandscapePath) && !empty($row['serie_playlists_id'])) { + $images = self::getRandomImageFromPlayList($row['serie_playlists_id']); + } $row['images'] = $images; $row['videos'] = Video::getVideosPaths($row['filename'], true); - TimeLogEnd($timeLog2, __LINE__); $row['progress'] = Video::getVideoPogressPercent($row['videos_id']); - TimeLogEnd($timeLog2, __LINE__); $row['title'] = UTF8encode($row['title']); - TimeLogEnd($timeLog2, __LINE__); $row['description'] = UTF8encode($row['description']); - TimeLogEnd($timeLog2, __LINE__); $row['tags'] = Video::getTags($row['videos_id']); - TimeLogEnd($timeLog2, __LINE__); if (AVideoPlugin::isEnabledByName("VideoTags")) { $row['videoTags'] = Tags::getAllFromVideosId($row['videos_id']); $row['videoTagsObject'] = Tags::getObjectFromVideosId($row['videos_id']); } - TimeLogEnd($timeLog2, __LINE__); if ($SubtitleSwitcher) { $row['subtitles'] = getVTTTracks($row['filename'], true); foreach ($row['subtitles'] as $value) { $row['subtitlesSRT'][] = convertSRTTrack($value); } } - TimeLogEnd($timeLog2, __LINE__); - unset($row['password']); - unset($row['recoverPass']); - //unset($row['description']); $rows[] = $row; } @@ -352,18 +413,86 @@ class PlayList extends ObjectYPT return $rows; } - public static function isVideoOnFavorite($videos_id, $users_id) - { + public static function getRandomImageFromPlayList($playlists_id) { + global $global; + $sql = "SELECT v.* " + . " FROM playlists_has_videos p " + . " LEFT JOIN videos as v ON videos_id = v.id " + . " WHERE playlists_id = ? AND v.status != 'i' ORDER BY RAND() + LIMIT 1"; + $res = sqlDAL::readSql($sql, "i", array($playlists_id)); + $data = sqlDAL::fetchAssoc($res); + sqlDAL::close($res); + if ($res) { + $row = $data; + $images = Video::getImageFromFilename($row['filename'], $row['type']); + + if (!file_exists($images->posterLandscapePath) && !empty($row['serie_playlists_id'])) { + return self::getRandomImageFromPlayList($row['serie_playlists_id']); + } + return $images; + } + return false; + } + + public static function isAGroupOfPlayLists($playlists_id) { + + $rows = self::getAllSubPlayLists($playlists_id); + + return count($rows); + } + + public static function getAllSubPlayLists($playlists_id, $NOTSubPlaylists = 0) { + global $getAllSubPlayLists; + if (empty($playlists_id)) { + return false; + } + if (!isset($getAllSubPlayLists)) { + $getAllSubPlayLists = array(); + } + if (!isset($getAllSubPlayLists[$playlists_id])) { + $getAllSubPlayLists[$playlists_id] = array(); + } + if (isset($getAllSubPlayLists[$playlists_id][$NOTSubPlaylists])) { + return $getAllSubPlayLists[$playlists_id][$NOTSubPlaylists]; + } + $sql = "SELECT v.* " + . " FROM playlists_has_videos p " + . " LEFT JOIN videos as v ON videos_id = v.id " + . " WHERE playlists_id = ? AND v.status != 'i' "; + + if ($NOTSubPlaylists) { + $sql .= ' AND serie_playlists_id IS NULL '; + } else { + $sql .= ' AND serie_playlists_id IS NOT NULL '; + } + + $res = sqlDAL::readSql($sql, "i", array($playlists_id)); + $fullData = sqlDAL::fetchAllAssoc($res); + sqlDAL::close($res); + $rows = array(); + if ($res != false) { + foreach ($fullData as $row) { + $rows[] = $row; + } + } + $getAllSubPlayLists[$playlists_id][$NOTSubPlaylists] = $rows; + return $rows; + } + + public static function getAllNOTSubPlayLists($playlists_id) { + return self::getAllSubPlayLists($playlists_id, 1); + } + + public static function isVideoOnFavorite($videos_id, $users_id) { return self::isVideoOn($videos_id, $users_id, 'favorite'); } - public static function isVideoOnWatchLater($videos_id, $users_id) - { + public static function isVideoOnWatchLater($videos_id, $users_id) { return self::isVideoOn($videos_id, $users_id, 'watch_later'); } - private static function isVideoOn($videos_id, $users_id, $status) - { + private static function isVideoOn($videos_id, $users_id, $status) { global $global; $status = str_replace("'", "", $status); @@ -385,8 +514,7 @@ class PlayList extends ObjectYPT return $row; } - public static function getFavoriteIdFromUser($users_id) - { + public static function getFavoriteIdFromUser($users_id) { global $refreshCacheFromPlaylist; $favorite = self::getIdFromUser($users_id, "favorite"); if (empty($favorite)) { @@ -401,8 +529,7 @@ class PlayList extends ObjectYPT return $favorite; } - public static function getWatchLaterIdFromUser($users_id) - { + public static function getWatchLaterIdFromUser($users_id) { global $refreshCacheFromPlaylist; $watch_later = self::getIdFromUser($users_id, "watch_later"); @@ -418,8 +545,7 @@ class PlayList extends ObjectYPT return $watch_later; } - private static function getIdFromUser($users_id, $status) - { + private static function getIdFromUser($users_id, $status) { global $global; $status = str_replace("'", "", $status); @@ -436,8 +562,7 @@ class PlayList extends ObjectYPT return $row; } - public static function getVideosIdFromPlaylist($playlists_id) - { + public static function getVideosIdFromPlaylist($playlists_id) { global $getVideosIdFromPlaylist; if (empty($getVideosIdFromPlaylist)) { $getVideosIdFromPlaylist = array(); @@ -455,8 +580,7 @@ class PlayList extends ObjectYPT return $videosId; } - public static function sortVideos($videosList, $listIdOrder) - { + public static function sortVideos($videosList, $listIdOrder) { $list = array(); foreach ($listIdOrder as $value) { $found = false; @@ -478,8 +602,7 @@ class PlayList extends ObjectYPT return $list; } - public function save() - { + public function save() { if (!User::isLogged()) { return false; } @@ -498,15 +621,13 @@ class PlayList extends ObjectYPT * This is just to fix errors from the update 6.4 to 6.5, where empty playlists were created before the update * @return type */ - private function clearEmptyLists() - { + private function clearEmptyLists() { $sql = "DELETE FROM " . static::getTableName() . " WHERE status = ''"; return sqlDAL::writeSql($sql); } - public function addVideo($videos_id, $add, $order = 0) - { + public function addVideo($videos_id, $add, $order = 0) { global $global; $formats = ""; $values = array(); @@ -528,8 +649,7 @@ class PlayList extends ObjectYPT return sqlDAL::writeSql($sql, $formats, $values); } - public function delete() - { + public function delete() { if (empty($this->id)) { return false; } @@ -540,38 +660,31 @@ class PlayList extends ObjectYPT return sqlDAL::writeSql($sql, "i", array($this->id)); } - public function getId() - { + public function getId() { return $this->id; } - public function getName() - { + public function getName() { return $this->name; } - public function getModified() - { + public function getModified() { return $this->modified; } - public function getUsers_id() - { + public function getUsers_id() { return $this->users_id; } - public function getStatus() - { + public function getStatus() { return $this->status; } - public function setId($id) - { + public function setId($id) { $this->id = $id; } - public function setName($name) - { + public function setName($name) { if (strlen($name) > 45) { $name = substr($name, 0, 42) . '...'; } @@ -579,21 +692,18 @@ class PlayList extends ObjectYPT //var_dump($name,$this->name);exit; } - public function setUsers_id($users_id) - { + public function setUsers_id($users_id) { $this->users_id = $users_id; } - public function setStatus($status) - { + public function setStatus($status) { if (!in_array($status, self::$validStatus)) { $status = 'public'; } $this->status = $status; } - public static function canSee($playlist_id, $users_id) - { + public static function canSee($playlist_id, $users_id) { $obj = new PlayList($playlist_id); $status = $obj->getStatus(); if ($status !== 'public' && $status !== 'unlisted' && $users_id != $obj->getUsers_id()) { @@ -602,33 +712,29 @@ class PlayList extends ObjectYPT return true; } - public static function getEPG() - { + public static function getEPG() { global $config, $global; $encoder = $config->_getEncoderURL(); - $url = "{$encoder}view/videosListEPG.php?date_default_timezone=". urlencode(date_default_timezone_get()); + $url = "{$encoder}view/videosListEPG.php?date_default_timezone=" . urlencode(date_default_timezone_get()); $content = url_get_contents($url); return json_decode($content); } - public function getShowOnTV() - { + public function getShowOnTV() { return intval($this->showOnTV); } - public function setShowOnTV($showOnTV) - { - if (strtolower($showOnTV)==="false") { + public function setShowOnTV($showOnTV) { + if (strtolower($showOnTV) === "false") { $showOnTV = 0; - } elseif (strtolower($showOnTV)==="true") { + } elseif (strtolower($showOnTV) === "true") { $showOnTV = 1; } $this->showOnTV = intval($showOnTV); } - public static function getAllToShowOnTV() - { + public static function getAllToShowOnTV() { global $global; if (!static::isTableInstalled()) { return false; @@ -653,4 +759,26 @@ class PlayList extends ObjectYPT } return $rows; } + + public static function showPlayListSelector($playListArray) { + $collections = array(); + $videos = array(); + foreach ($playListArray as $value) { + if ($value['type'] === 'serie' && !empty($value['serie_playlists_id'])) { + $collections[] = $value; + } else { + $videos[] = $value; + } + } + $countCollections = count($collections); + $countVideos = count($videos); + if(!empty($countCollections)){ + if($countCollections===1 && empty($countVideos)){ + return false; + } + return $collections; + } + return false; + } + } diff --git a/objects/video.php b/objects/video.php index 32742a9c25..9d0f9f1366 100644 --- a/objects/video.php +++ b/objects/video.php @@ -54,6 +54,7 @@ if (!class_exists('Video')) { private $encoderURL; private $filepath; private $filesize; + private $live_transmitions_history_id; public static $statusDesc = array( 'a' => 'active', 'k' => 'active and encoding', @@ -166,6 +167,14 @@ if (!class_exists('Video')) { } } + function getLive_transmitions_history_id() { + return $this->live_transmitions_history_id; + } + + function setLive_transmitions_history_id($live_transmitions_history_id) { + $this->live_transmitions_history_id = intval($live_transmitions_history_id); + } + public function getEncoderURL() { return $this->encoderURL; @@ -321,6 +330,10 @@ if (!class_exists('Video')) { $this->type = 'video'; } } + + if (empty($this->live_transmitions_history_id)) { + $this->live_transmitions_history_id = 'NULL'; + } if (!empty($this->id)) { if (!$this->userCanManageVideo() && !$allowOfflineUser && !Permissions::canModerateVideos()) { @@ -330,13 +343,13 @@ if (!class_exists('Video')) { $sql = "UPDATE videos SET title = '{$this->title}',clean_title = '{$this->clean_title}'," . " filename = '{$this->filename}', categories_id = '{$this->categories_id}', status = '{$this->status}'," . " description = '{$this->description}', duration = '{$this->duration}', type = '{$this->type}', videoDownloadedLink = '{$this->videoDownloadedLink}', youtubeId = '{$this->youtubeId}', videoLink = '{$this->videoLink}', next_videos_id = {$this->next_videos_id}, isSuggested = {$this->isSuggested}, users_id = {$this->users_id}, " - . " 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} , video_password = '{$this->video_password}', " + . " trailer1 = '{$this->trailer1}', trailer2 = '{$this->trailer2}', trailer3 = '{$this->trailer3}', rate = '{$this->rate}', can_download = '{$this->can_download}', can_share = '{$this->can_share}', only_for_paid = '{$this->only_for_paid}', rrating = '{$this->rrating}', externalOptions = '{$this->externalOptions}', sites_id = {$this->sites_id}, serie_playlists_id = {$this->serie_playlists_id} ,live_transmitions_history_id = {$this->live_transmitions_history_id} , video_password = '{$this->video_password}', " . " encoderURL = '{$this->encoderURL}', filepath = '{$this->filepath}' , filesize = '{$this->filesize}' , modified = now()" . " WHERE id = {$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, 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->video_password}', '{$this->encoderURL}', '{$this->filepath}', '{$this->filesize}')"; + . "(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); if ($insert_row) { @@ -566,8 +579,7 @@ if (!class_exists('Video')) { $this->clean_title = cleanURLName($clean_title); } - public function setDuration($duration) - { + public function setDuration($duration){ $this->duration = $duration; } @@ -769,12 +781,14 @@ if (!class_exists('Video')) { $sql .= " AND ("; $sql .= "v.id IN (select videos_id FROM tags_has_videos LEFT JOIN tags as t ON tags_id = t.id AND t.name LIKE '%{$_POST['searchPhrase']}%' WHERE t.id is NOT NULL)"; $sql .= BootGrid::getSqlSearchFromPost($searchFieldsNames, "OR"); + $searchFieldsNames = array('v.title'); + $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']); $sql .= ")"; } else { - $sql .= BootGrid::getSqlSearchFromPost($searchFieldsNames); + $sql .= ' AND (1=1 '.BootGrid::getSqlSearchFromPost($searchFieldsNames); + $searchFieldsNames = array('v.title'); + $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']).')'; } - $searchFieldsNames = array('v.title'); - $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']); } if (!$ignoreGroup) { $arrayNotIN = AVideoPlugin::getAllVideosExcludeVideosIDArray(); @@ -946,14 +960,8 @@ if (!class_exists('Video')) { public static function getVideoFromCleanTitle($clean_title) { - // for some reason in some servers (CPanel) we got the error "Error while sending QUERY packet centos on a select" // even increasing the max_allowed_packet it only goes away when close and reopen the connection - global $global, $mysqlHost, $mysqlUser, $mysqlPass, $mysqlDatabase, $mysqlPort; - $global['mysqli']->close(); - _mysql_connect(); - if (!empty($global['mysqli_charset'])) { - $global['mysqli']->set_charset($global['mysqli_charset']); - } + global $global; $sql = "SELECT id FROM videos WHERE clean_title = ? LIMIT 1"; $res = sqlDAL::readSql($sql, "s", array($clean_title)); $video = sqlDAL::fetchAssoc($res); @@ -975,7 +983,7 @@ if (!class_exists('Video')) { * @param type $videosArrayId an array with videos to return (for filter only) * @return boolean */ - public static function getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false) + public static function getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null) { global $global, $config, $advancedCustom; if ($config->currentVersionLowerThen('5')) { @@ -1017,6 +1025,19 @@ if (!class_exists('Video')) { $uid = intval($user['id']); $sql .= " AND v.users_id = '{$uid}' "; } + + if (isset($_REQUEST['is_serie']) && empty($is_serie)) { + $is_serie = intval($_REQUEST['is_serie']); + } + + if (isset($is_serie)) { + if(empty($is_serie)){ + $sql .= " AND v.serie_playlists_id IS NULL "; + }else{ + $sql .= " AND v.serie_playlists_id IS NOT NULL "; + } + } + if (!empty($videosArrayId) && is_array($videosArrayId)) { $sql .= " AND v.id IN ( '" . implode("', '", $videosArrayId) . "') "; } @@ -1087,9 +1108,9 @@ if (!class_exists('Video')) { $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']); $sql .= ")"; } else { - $sql .= BootGrid::getSqlSearchFromPost($searchFieldsNames); + $sql .= ' AND (1=1 '.BootGrid::getSqlSearchFromPost($searchFieldsNames); $searchFieldsNames = array('v.title'); - $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']); + $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']).')'; } } @@ -1145,7 +1166,7 @@ if (!class_exists('Video')) { } } - //echo $sql;exit; + //echo $sql;//exit; //_error_log("getAllVideos($status, $showOnlyLoggedUserVideos , $ignoreGroup , ". json_encode($videosArrayId).")" . $sql); $res = sqlDAL::readSql($sql); $fullData = sqlDAL::fetchAllAssoc($res); @@ -1487,6 +1508,16 @@ if (!class_exists('Video')) { } elseif (is_int($showOnlyLoggedUserVideos)) { $sql .= " AND v.users_id = '{$showOnlyLoggedUserVideos}'"; } + + if (isset($_REQUEST['is_serie'])) { + $is_serie = intval($_REQUEST['is_serie']); + if(empty($is_serie)){ + $sql .= " AND v.serie_playlists_id IS NULL "; + }else{ + $sql .= " AND v.serie_playlists_id IS NOT NULL "; + } + } + if (!empty($_GET['catName'])) { $catName = $global['mysqli']->real_escape_string($_GET['catName']); $sql .= " AND c.clean_name = '{$catName}'"; @@ -1524,9 +1555,9 @@ if (!class_exists('Video')) { $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']); $sql .= ")"; } else { - $sql .= BootGrid::getSqlSearchFromPost($searchFieldsNames); + $sql .= ' AND (1=1 '.BootGrid::getSqlSearchFromPost($searchFieldsNames); $searchFieldsNames = array('v.title'); - $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']); + $sql .= self::getFullTextSearch($searchFieldsNames, $_POST['searchPhrase']).')'; } } @@ -2030,7 +2061,7 @@ if (!class_exists('Video')) { $res = sqlDAL::writeSql($sql, "si", array($this->duration, $this->id)); return $this->id; } else { - _error_log("Do not need update duration: " . json_encode($this)); + _error_log("Do not need update duration: "); return false; } } @@ -2909,17 +2940,25 @@ if (!class_exists('Video')) { return $VideoGetSourceFile[$cacheName]; } - public static function getCleanFilenameFromFile($filename) - { + public static function getCleanFilenameFromFile($filename){ + global $global; if (empty($filename)) { return ""; } - $cleanName = str_replace( - array('_Low', '_SD', '_HD', '_thumbsV2', '_thumbsSmallV2', '_thumbsSprit', '_roku', - '_2160', '_1440', '_1080', '_720', '_480', '_360', '_240', '_portrait', '_portrait_thumbsV2', '_portrait_thumbsSmallV2'), - array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''), - $filename - ); + + $search = array('_Low', '_SD', '_HD', '_thumbsV2', '_thumbsSmallV2', '_thumbsSprit', '_roku', '_portrait', '_portrait_thumbsV2', '_portrait_thumbsSmallV2'); + $replace = array('', '', '', '', '', '', '', '', '', ''); + + if(empty($global['avideo_resolutions']) || !is_array($global['avideo_resolutions'])){ + $global['avideo_resolutions'] = array(240, 360, 480, 540, 720, 1080, 1440, 2160); + } + + foreach ($global['avideo_resolutions'] as $value) { + $search[] = "_{$value}"; + $replace[] = ''; + } + + $cleanName = str_replace($search,$replace,$filename); $path_parts = pathinfo($cleanName); if (!empty($path_parts["extension"]) && $path_parts["extension"] === "m3u8") { @@ -3060,13 +3099,14 @@ if (!class_exists('Video')) { return false; } - public static function getHigherVideoPathFromID($videos_id) - { + public static function getHigherVideoPathFromID($videos_id){ + global $global; if (empty($videos_id)) { return false; } $paths = self::getVideosPathsFromID($videos_id); - $types = array(0, 2160, 1330, 1080, 720, 'HD', 'SD', 'Low', 480, 360, 240); + + $types = array(0, 2160, 1440, 1080, 720, 'HD', 'SD', 'Low', 540, 480, 360, 240); if (!empty($paths['mp4'])) { foreach ($types as $value) { @@ -3116,9 +3156,14 @@ if (!class_exists('Video')) { return self::getVideosPaths($video->getFilename(), true); } - public static function getVideosPaths($filename, $includeS3 = false) - { - $types = array('', '_Low', '_SD', '_HD', '_2160', '_1440', '_1080', '_720', '_480', '_360', '_240'); + public static function getVideosPaths($filename, $includeS3 = false){ + global $global; + $types = array('', '_Low', '_SD', '_HD'); + + foreach ($global['avideo_resolutions'] as $value) { + $types[] = "_{$value}"; + } + $videos = array(); $plugin = AVideoPlugin::loadPluginIfEnabled("VideoHLS"); @@ -3927,8 +3972,7 @@ if (!class_exists('Video')) { $this->serie_playlists_id = $serie_playlists_id; } - public static function getVideoFromSeriePlayListsId($serie_playlists_id) - { + public static function getVideoFromSeriePlayListsId($serie_playlists_id){ global $global, $config; $serie_playlists_id = intval($serie_playlists_id); $sql = "SELECT * FROM videos WHERE serie_playlists_id = '$serie_playlists_id' LIMIT 1"; @@ -4056,6 +4100,21 @@ if (!class_exists('Video')) { $sql .= ")"; return "{$connection} {$sql}"; } + + public static function getChangeVideoStatusButton($videos_id){ + + $video = new Video('', '', $videos_id); + $status = $video->getStatus(); + + $activeBtn = ''; + $inactiveBtn = ''; + $unlistedBtn = ''; + + return "{$activeBtn}{$inactiveBtn}{$unlistedBtn}"; + } } } // just to convert permalink into clean_title diff --git a/objects/videoStatus.json.php b/objects/videoStatus.json.php index 0a88c0920a..c8e71ac8e3 100644 --- a/objects/videoStatus.json.php +++ b/objects/videoStatus.json.php @@ -16,16 +16,41 @@ if (!is_array($_POST['id'])) { require_once 'video.php'; $id = 0; + +$obj = new stdClass(); +$obj->error = true; +$obj->status = array(); +$obj->msg = ''; + foreach ($_POST['id'] as $value) { - $obj = new Video("", "", $value); - if (empty($obj)) { - die("Object not found"); + $obj2 = new stdClass(); + $obj2->error = true; + $obj2->videos_id = $value; + $obj2->status = $_POST['status']; + $obj2->msg = ''; + + + $v = new Video("", "", $value); + if (empty($v)) { + $obj2->msg = __("Video NOT Found"); + $obj->status[] = $obj2; + continue; } - if (!$obj->userCanManageVideo() && !Permissions::canModerateVideos()) { - $obj->msg = __("You can not Manage This Video"); - die(json_encode($obj)); + if (!$v->userCanManageVideo() && !Permissions::canModerateVideos()) { + $obj2->msg = __("You can not Manage This Video"); + $obj->status[] = $obj2; + continue; } - $obj->setStatus($_POST['status']); - $resp = $value; + $v->setStatus($_POST['status']); + $obj2->error = false; + $obj->status[] = $obj2; } -echo '{"status":"' . !empty($resp) . '"}'; + +foreach ($obj->status as $value) { + if($value->error){ + break; + } + $obj->error = false; +} + +die(json_encode($obj)); diff --git a/plugin/API/API.php b/plugin/API/API.php index c1d2ae0925..f077a53034 100644 --- a/plugin/API/API.php +++ b/plugin/API/API.php @@ -261,6 +261,7 @@ class API extends PluginAbstract { * ['tags_id' the ID of the tag you want to filter] * ['catName' the clean_APIName of the category you want to filter] * ['channelName' the channelName of the videos you want to filter] + * ['is_serie' if is 0 return only videos, if is 1 return only series, if is not set, return all] * @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&catName=default&rowCount=10 * @return \ApiObject */ diff --git a/plugin/AVideoPlugin.php b/plugin/AVideoPlugin.php index b47fcfa415..41b63615c6 100644 --- a/plugin/AVideoPlugin.php +++ b/plugin/AVideoPlugin.php @@ -1168,28 +1168,28 @@ class AVideoPlugin { } } - public static function onUserSocketConnect($users_id, $data) { + public static function onUserSocketConnect() { _mysql_connect(); $plugins = Plugin::getAllEnabled(); foreach ($plugins as $value) { self::YPTstart(); $p = static::loadPlugin($value['dirName']); if (is_object($p)) { - $p->onUserSocketConnect($users_id, $data); + $p->onUserSocketConnect(); } self::YPTend("{$value['dirName']}::" . __FUNCTION__); } _mysql_close(); } - public static function onUserSocketDisconnect($users_id, $data) { + public static function onUserSocketDisconnect() { _mysql_connect(); $plugins = Plugin::getAllEnabled(); foreach ($plugins as $value) { self::YPTstart(); $p = static::loadPlugin($value['dirName']); if (is_object($p)) { - $p->onUserSocketConnect($users_id, $data); + $p->onUserSocketDisconnect(); } self::YPTend("{$value['dirName']}::" . __FUNCTION__); } diff --git a/plugin/AdsForJesus/AdsForJesus.php b/plugin/AdsForJesus/AdsForJesus.php index 42a05379a8..04fb78a702 100644 --- a/plugin/AdsForJesus/AdsForJesus.php +++ b/plugin/AdsForJesus/AdsForJesus.php @@ -63,13 +63,11 @@ class AdsForJesus extends PluginAbstract { $js = ''; $css = ''; //if (!empty($_GET['videoName']) || !empty($_GET['u'])) { - if (!empty($_GET['videoName'])) { - if (empty($_GET['u'])) { - $video = Video::getVideoFromCleanTitle($_GET['videoName']); - $showAds = AVideoPlugin::showAds($video['id']); - if (!$showAds) { - return ""; - } + $videos_id = getVideos_id(); + if (!empty($videos_id)) { + $showAds = AVideoPlugin::showAds($videos_id); + if (!$showAds) { + return ""; } global $global; $css .= ''; @@ -86,7 +84,12 @@ class AdsForJesus extends PluginAbstract { $js .= ''; //if (!empty($_GET['videoName']) || !empty($_GET['u'])) { - if (!empty($_GET['videoName'])) { + $videos_id = getVideos_id(); + if (!empty($videos_id)) { + $showAds = AVideoPlugin::showAds($videos_id); + if (!$showAds) { + return ""; + } if (empty($_GET['u'])) { $video = Video::getVideoFromCleanTitle($_GET['videoName']); $showAds = AVideoPlugin::showAds($video['id']); @@ -101,10 +104,7 @@ class AdsForJesus extends PluginAbstract { $video_length = parseDurationToSeconds($video['duration']); $obj = $this->getDataObject(); PlayerSkins::setIMAADTag("https://forjesus.tv/vmap.xml?video_durarion={$video_length}&start={$obj->start}&mid25Percent={$obj->mid25Percent}&mid50Percent={$obj->mid50Percent}&mid75Percent={$obj->mid75Percent}&end={$obj->end}"); - }else if(isLive()){ - //PlayerSkins::setIMAADTag("https://forjesus.tv/vmap.xml?video_durarion=0&start=1&mid25Percent=0&mid50Percent=0&mid75Percent=0&end=1"); - } - + } return $js; } diff --git a/plugin/Gallery/functions.php b/plugin/Gallery/functions.php index b00c3cb4a2..6384a568f2 100644 --- a/plugin/Gallery/functions.php +++ b/plugin/Gallery/functions.php @@ -176,6 +176,9 @@ function createGallerySection($videos, $crc = "", $get = array(), $ignoreAds = f $images->thumbsJpg = "{$global['webSiteRootURL']}view/img/notfoundThumbs.jpg"; $images->thumbsJpgSmall = "{$global['webSiteRootURL']}view/img/notfoundThumbsSmall.jpg"; } + if ($value['type'] === 'serie' && !empty($value['serie_playlists_id']) && stripos($images->thumbsJpg, 'notfound') !== false) { + $images = PlayList::getRandomImageFromPlayList($value['serie_playlists_id']); + } $startG = microtime(true); $imgGif = $images->thumbsGif; $poster = $images->thumbsJpg; @@ -331,7 +334,7 @@ function createGallerySection($videos, $crc = "", $get = array(), $ignoreAds = f
- +
diff --git a/plugin/Gallery/view/BigVideo.php b/plugin/Gallery/view/BigVideo.php index 34b67aa239..4ffd3b94a8 100644 --- a/plugin/Gallery/view/BigVideo.php +++ b/plugin/Gallery/view/BigVideo.php @@ -221,7 +221,7 @@ if ($obj->BigVideo && empty($_GET['showOnly'])) {
- +
diff --git a/plugin/Gallery/view/footer.php b/plugin/Gallery/view/footer.php index c08f6713cc..689ad296ed 100644 --- a/plugin/Gallery/view/footer.php +++ b/plugin/Gallery/view/footer.php @@ -1,24 +1,8 @@ - - + + \ No newline at end of file diff --git a/plugin/Layout/notifications.js b/plugin/Layout/notifications.js new file mode 100644 index 0000000000..1d84ecd129 --- /dev/null +++ b/plugin/Layout/notifications.js @@ -0,0 +1,60 @@ + +var avideoNotifications = [ + {title: 'test 1', text: 'text 1', image: 'http://192.168.1.4/YouPHPTube/videos/userPhoto/photo1.png', link: 'https://google.com'}, + {title: 'test 2', text: 'text 2', image: 'http://192.168.1.4/YouPHPTube/videos/userPhoto/photo2.png', link: 'https://yahoo.com'} +]; + +$(document).ready(function () { + var avideoNotificationsCookie = Cookies.get('avideoNotifications'); + if (typeof avideoNotificationsCookie !== 'undefined') { + //avideoNotifications = avideoNotificationsCookie; + } + processNotifications(); +}); + +function processNotifications() { + console.log('processNotifications', avideoNotifications); + $('.LayoutNotificationCount').text(avideoNotifications.length); + $('#LayoutNotificationItems').empty(); + for (var item in avideoNotifications) { + if (typeof avideoNotifications[item] == 'function') { + continue; + } + + var html = '
  • '; + html += ''; + html += ''; + html += '
    '+avideoNotifications[item].text+'
    '; + html += '
  • '; + + $('#LayoutNotificationItems').prepend(html); + console.log('processNotifications item', item); + console.log('processNotifications', avideoNotifications[item]); + } +} + +function addNotification(title, text, image, link) { + var obj = {title: title, text: text, image: image, link:link}; + console.log('addNotification type', typeof avideoNotifications); + console.log('addNotification=', avideoNotifications); + console.log('addNotification', obj); + avideoNotifications.push(obj); + /* + Cookies.set('avideoNotifications', avideoNotifications, { + path: '/', + expires: 365 + }); + * + */ +} + +function removeNotification(index) { + avideoNotifications.splice(index, 1); + /* + Cookies.set('avideoNotifications', avideoNotifications, { + path: '/', + expires: 365 + }); + * + */ +} \ No newline at end of file diff --git a/plugin/Live/Live.php b/plugin/Live/Live.php index 59e9956953..265f7c15a5 100644 --- a/plugin/Live/Live.php +++ b/plugin/Live/Live.php @@ -54,7 +54,7 @@ class Live extends PluginAbstract { } public function getPluginVersion() { - return "5.3"; + return "7.0"; } public function updateScript() { @@ -111,7 +111,6 @@ class Live extends PluginAbstract { sqlDal::writeSql(trim($value)); } } - //update version 5.2 if (AVideoPlugin::compareVersion($this->getName(), "6.0") < 0) { $sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV6.0.sql'); $sqlParts = explode(";", $sqls); @@ -119,6 +118,13 @@ class Live extends PluginAbstract { sqlDal::writeSql(trim($value)); } } + if (AVideoPlugin::compareVersion($this->getName(), "7.0") < 0) { + $sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV7.0.sql'); + $sqlParts = explode(";", $sqls); + foreach ($sqlParts as $value) { + sqlDal::writeSql(trim($value)); + } + } return true; } @@ -1505,5 +1511,9 @@ class Live extends PluginAbstract { } return $videos; } + + static function finishLive($key){ + $lh = LiveTransmitionHistory::finish($key); + } } diff --git a/plugin/Live/Objects/LiveTransmitionHistory.php b/plugin/Live/Objects/LiveTransmitionHistory.php index 895f4f2fbf..07a387755a 100644 --- a/plugin/Live/Objects/LiveTransmitionHistory.php +++ b/plugin/Live/Objects/LiveTransmitionHistory.php @@ -6,7 +6,7 @@ require_once dirname(__FILE__) . '/../../../objects/user.php'; class LiveTransmitionHistory extends ObjectYPT { - protected $id, $title, $description, $key, $created, $modified, $users_id, $live_servers_id; + protected $id, $title, $description, $key, $created, $modified, $users_id, $live_servers_id, $finished; static function getSearchFieldsNames() { return array('title', 'description'); @@ -47,7 +47,11 @@ class LiveTransmitionHistory extends ObjectYPT { function setId($id) { $this->id = $id; } - + + function getFinished() { + return $this->finished; + } + function setTitle($title) { global $global; $title = $global['mysqli']->real_escape_string($title); @@ -231,9 +235,13 @@ class LiveTransmitionHistory extends ObjectYPT { return $rows; } - static function getLatest($key) { + static function getLatest($key, $live_servers_id=null) { global $global; - $sql = "SELECT * FROM " . static::getTableName() . " WHERE `key` = ? ORDER BY created DESC LIMIT 1"; + $sql = "SELECT * FROM " . static::getTableName() . " WHERE `key` = ? "; + if(isset($live_servers_id)){ + $sql .= " AND live_servers_id = ".intval($live_servers_id); + } + $sql .= " ORDER BY created DESC LIMIT 1"; // I had to add this because the about from customize plugin was not loading on the about page http://127.0.0.1/AVideo/about $res = sqlDAL::readSql($sql, "s", array($key)); @@ -246,6 +254,28 @@ class LiveTransmitionHistory extends ObjectYPT { } return $row; } + + static function finish($key) { + $row = self::getLatest($key); + if(empty($row) || empty($row['id']) || !empty($row['finished'])){ + return false; + } + + return self::finishFromTransmitionHistoryId($row['id']); + } + + static function finishFromTransmitionHistoryId($live_transmitions_history_id) { + $live_transmitions_history_id = intval($live_transmitions_history_id); + if(empty($live_transmitions_history_id)){ + return false; + } + + $sql = "UPDATE " . static::getTableName() . " SET finished = now() WHERE id = {$live_transmitions_history_id} "; + + $insert_row = sqlDAL::writeSql($sql); + + return $row; + } static function getLatestFromUser($users_id) { global $global; diff --git a/plugin/Live/index.php b/plugin/Live/index.php index 528fde9ee9..704c420233 100644 --- a/plugin/Live/index.php +++ b/plugin/Live/index.php @@ -109,6 +109,7 @@ if (!empty($chat2) && !empty($chat2->useStaticLayout)) { $activeServerFound = false; if (!$obj->useLiveServers) { $activeServerFound = true; + $_REQUEST['live_servers_id'] = 0; ?>
  • @@ -118,6 +119,7 @@ if (!empty($chat2) && !empty($chat2->useStaticLayout)) { $value) { $active = ""; if (isset($_REQUEST['live_servers_id'])) { @@ -144,17 +146,21 @@ if (!empty($chat2) && !empty($chat2->useStaticLayout)) { -
  • - - - -
  • - +
  • + + + +
  • + diff --git a/plugin/Live/install/install.sql b/plugin/Live/install/install.sql index 22cacf3da4..919728fe1f 100644 --- a/plugin/Live/install/install.sql +++ b/plugin/Live/install/install.sql @@ -74,6 +74,7 @@ CREATE TABLE IF NOT EXISTS `live_transmitions_history` ( `modified` DATETIME NULL, `users_id` INT(11) NOT NULL, `live_servers_id` INT(11) NULL DEFAULT NULL, + `finished` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `fk_live_transmitions_history_users_idx` (`users_id` ASC), INDEX `fk_live_transmitions_history_live_servers1_idx` (`live_servers_id` ASC), diff --git a/plugin/Live/install/updateV7.0.sql b/plugin/Live/install/updateV7.0.sql new file mode 100644 index 0000000000..dd7fe21c8d --- /dev/null +++ b/plugin/Live/install/updateV7.0.sql @@ -0,0 +1,2 @@ +ALTER TABLE `live_transmitions_history` +ADD COLUMN `finished` DATETIME NULL DEFAULT NULL; \ No newline at end of file diff --git a/plugin/Live/meet.php b/plugin/Live/meet.php index 040cd735bd..a2d8fb165a 100644 --- a/plugin/Live/meet.php +++ b/plugin/Live/meet.php @@ -122,7 +122,7 @@ include $global['systemRootPath'] . 'plugin/Meet/api.js.php'; on_meetStop(); modal.hidePleaseWait(); } else { - aVideoMeetStart('', response.roomName, response.jwt, '', '', ); + aVideoMeetStart('', response.roomName, response.jwt, '', '', ); meetPassword = response.password; $('#meetPassword').val(meetPassword); diff --git a/plugin/Live/on_publish_done.php b/plugin/Live/on_publish_done.php index 7486636286..809b666595 100644 --- a/plugin/Live/on_publish_done.php +++ b/plugin/Live/on_publish_done.php @@ -46,6 +46,7 @@ if (strpos($_GET['p'], '/') !== false) { $row = LiveTransmitionHistory::getLatest($_POST['name']); +LiveTransmitionHistory::finishFromTransmitionHistoryId($row['id']); $array = setLiveKey($row['key'], $row['live_servers_id']); $array['stats'] = LiveTransmitionHistory::getStatsAndRemoveApplication($row['id']); $socketObj = sendSocketMessageToAll($array, "socketLiveOFFCallback"); diff --git a/plugin/Live/on_publish_socket_notification.php b/plugin/Live/on_publish_socket_notification.php index 72f88f1cbb..21eadd387a 100644 --- a/plugin/Live/on_publish_socket_notification.php +++ b/plugin/Live/on_publish_socket_notification.php @@ -38,6 +38,7 @@ if (AVideoPlugin::isEnabledByName('YPTSocket')) { break; } } + $array['live_transmitions_history_id'] = $liveTransmitionHistory_id; if ($is200) { $array['stats'] = LiveTransmitionHistory::getStatsAndAddApplication($liveTransmitionHistory_id); } else { diff --git a/plugin/Live/view/menuRight.php b/plugin/Live/view/menuRight.php index f7a9cb2dae..13a1838e74 100644 --- a/plugin/Live/view/menuRight.php +++ b/plugin/Live/view/menuRight.php @@ -329,6 +329,17 @@ if (!empty($obj->playLiveInFullScreenOnIframe)) { $('.live_' + json.live_servers_id + "_" + json.key).slideDown(); var selector = '#liveViewStatusID_' + json.key + '_' + json.live_servers_id; onlineLabelOnline(selector); + + // update the chat if the history changes + var IframeClass = ".yptchat2IframeClass_"+json.key+"_"+json.live_servers_id; + if($( IframeClass ).length){ + var src = $( IframeClass ).attr('src'); + if(src){ + avideoToast('Loading new chat'); + var newSRC = addGetParam(src, 'live_transmitions_history_id', json.live_transmitions_history_id); + $( IframeClass ).attr('src', newSRC); + } + } } function socketLiveOFFCallback(json) { console.log('socketLiveOFFCallback', json); diff --git a/plugin/PlayLists/PlayListElement.php b/plugin/PlayLists/PlayListElement.php index 1a2f6ecf9d..6176909b39 100644 --- a/plugin/PlayLists/PlayListElement.php +++ b/plugin/PlayLists/PlayListElement.php @@ -4,7 +4,7 @@ class PlayListElement { public $name, $description, $duration, $sources, $thumbnail, $poster, $videoStartSeconds, $created, $likes, $views, $videos_id; - function __construct($name, $description, $duration, $playListSource, $playListThumbnail, $poster, $videoStartSeconds, $created, $likes, $views, $videos_id) { + function __construct($name, $description, $duration, $playListSource, $playListThumbnail, $poster, $videoStartSeconds, $created, $likes, $views, $videos_id, $className='') { $this->name = $name; $this->description = $description; $this->setDuration($duration); @@ -16,6 +16,7 @@ class PlayListElement { $this->likes = $likes; $this->views = $views; $this->videos_id = $videos_id; + $this->className = $className; } @@ -74,6 +75,12 @@ class playListSource { function __construct($src, $youtube = false) { $this->src = $src; + $this->label = getResolutionFromFilename($src); + if(empty($this->label)){ + $this->label = 'Auto'; + }else{ + $this->label .= 'p'; + } if($youtube){ $this->type = "video/youtube"; }else{ diff --git a/plugin/PlayLists/PlayLists.php b/plugin/PlayLists/PlayLists.php index ec8974d985..25a9c9a72d 100644 --- a/plugin/PlayLists/PlayLists.php +++ b/plugin/PlayLists/PlayLists.php @@ -98,6 +98,10 @@ class PlayLists extends PluginAbstract { $css = ''; $css .= ''; + + if(!empty(getPlaylists_id())){ + $css .= ""; + } return $css; } @@ -123,6 +127,10 @@ class PlayLists extends PluginAbstract { } } + if(!empty(getPlaylists_id())){ + PlayerSkins::getStartPlayerJS(file_get_contents("{$global['systemRootPath']}plugin/PlayLists/playerButton.js")); + } + return $js; } @@ -194,8 +202,9 @@ class PlayLists extends PluginAbstract { $video = self::isPlayListASerie($serie_playlists_id); if (!empty($video)) { $video = new Video("", "", $video['id']); - $video->delete(); + return $video->delete(); } + return false; } static function saveSerie($serie_playlists_id) { @@ -281,6 +290,14 @@ class PlayLists extends PluginAbstract { '; } + $str .= '
  • +
    + + + ' . __("Organize") . ' ' .$obj->name . ' + +
    +
  • '; return $str; } @@ -480,10 +497,10 @@ class PlayLists extends PluginAbstract { if (!self::canManagePlaylist($playlists_id)) { return ""; } - $input = __('Show on TV') . '
    + $input = '
    - -
    '; + +
    '; return $input; } diff --git a/plugin/PlayLists/collections.php b/plugin/PlayLists/collections.php new file mode 100644 index 0000000000..a388dd492c --- /dev/null +++ b/plugin/PlayLists/collections.php @@ -0,0 +1,15 @@ +src = $images->thumbsJpg; + $thumbnail = array(); + $thumbnail[] = $src; - $src = new stdClass(); - $src->src = $images->thumbsJpg; - $thumbnail = array($src); + $playListSources = array(); + foreach ($sources as $value2) { + if ($value2['type'] !== 'video' && $value2['type'] !== 'audio') { + continue; + } + $playListSources[] = new playListSource($value2['url']); + } + if (empty($playListSources)) { + continue; + } + $playListData[] = new PlayListElement($value['title'], $value['description'], $value['duration'], $playListSources, $thumbnail, $images->poster, parseDurationToSeconds(@$externalOptions->videoStartSeconds), $value['cre'], $value['likes'], $value['views_count'], $value['videos_id'], "embedPlayList subPlaylistCollection-{$oldValue['serie_playlists_id']}"); + } + } else { + $sources = getVideosURL($value['filename']); + $images = Video::getImageFromFilename($value['filename'], $value['type']); + $externalOptions = json_decode($value['externalOptions']); - $playListSources = array(); - foreach ($sources as $value2) { - if ($value2['type'] !== 'video' && $value2['type'] !== 'audio') { + $src = new stdClass(); + $src->src = $images->thumbsJpg; + $thumbnail = array(); + $thumbnail[] = $src; + + $playListSources = array(); + foreach ($sources as $value2) { + if ($value2['type'] !== 'video' && $value2['type'] !== 'audio') { + continue; + } + $playListSources[] = new playListSource($value2['url']); + } + if (empty($playListSources)) { continue; } - $playListSources[] = new playListSource($value2['url']); + $playListData[] = new PlayListElement($value['title'], $value['description'], $value['duration'], $playListSources, $thumbnail, $images->poster, parseDurationToSeconds(@$externalOptions->videoStartSeconds), $value['cre'], $value['likes'], $value['views_count'], $value['videos_id'], "embedPlayList "); } - if (empty($playListSources)) { - continue; - } - $playListData[] = new PlayListElement($value['title'], $value['description'], $value['duration'], $playListSources, $thumbnail, $images->poster, parseDurationToSeconds(@$externalOptions->videoStartSeconds), $value['cre'], $value['likes'], $value['views_count'], $value['videos_id']); +} + +if (empty($playListData)) { + forbiddenPage(__("The program is empty")); +} + +$url = PlayLists::getLink($pl->getId()); +$title = $pl->getName(); + +if($serie = PlayLists::isPlayListASerie($pl->getId())){ + setVideos_id($serie['id']); +}else if(!empty($playList[$playlist_index])){ + setVideos_id($playList[$playlist_index]['id']); } //var_dump($playListData);exit; ?> @@ -89,6 +135,35 @@ foreach ($playList as $value) { .vjs-control-bar{ z-index: 1; } + .form-control{ + background-color: #333 !important; + color: #AAA !important; + } + + #playListHolder{ + position: absolute; + right: 0; + top: 0; + width: 30%; + max-width: 320px; + height: 100%; + overflow-y: scroll; + margin-right: 0; + background-color: #00000077; + } + #playList{ + margin-top: 40px; + margin-bottom: 60px; + } + #playListFilters{ + width: 30%; + max-width: 320px; + display: inline-flex; + position: fixed; + top: 0; + right: 0; + z-index: 1; + } - -
    - "/> - + if (!empty($collectionsList)) { + ?> + + + "/> + +
    + +
    + + PlayList && !empty($plObj)) { + $dataFlickirty = new stdClass(); + $dataFlickirty->wrapAround = true; + $dataFlickirty->pageDots = !empty($obj->pageDots); + $dataFlickirty->lazyLoad = 15; + $dataFlickirty->setGallerySize = false; + $dataFlickirty->cellAlign = 'left'; + $dataFlickirty->groupCells = true; + if ($obj->PlayListAutoPlay) { + $dataFlickirty->autoPlay = 10000; + } + + $programs = Video::getAllVideos("viewableNotUnlisted", false, true, array(), false, false, true, false, true); + cleanSearchVar(); + if (!empty($programs)) { + foreach ($programs as $serie) { + $videos = PlayList::getAllFromPlaylistsID($serie['serie_playlists_id']); + + foreach ($videos as $key => $value) { + $videos[$key]['title'] = "{$value['icon']} {$value['title']}"; + } + + $link = PlayLists::getLink($serie['serie_playlists_id']); + $linkEmbed = PlayLists::getLink($serie['serie_playlists_id'], true); + $canWatchPlayButton = ""; + if (User::canWatchVideoWithAds($value['id'])) { + $canWatchPlayButton = "canWatchPlayButton"; + } + ?> +
    +

    + + + +

    + + +
    + + Trending) { $dataFlickirty = new stdClass(); $dataFlickirty->wrapAround = true; @@ -79,7 +173,6 @@ $percent = 90; DateAdded) { $dataFlickirty = new stdClass(); $dataFlickirty->wrapAround = true; @@ -113,7 +206,6 @@ $percent = 90; MostPopular) { $_REQUEST['rowCount'] = $obj->maxVideos; $dataFlickirty = new stdClass(); @@ -148,7 +240,6 @@ $percent = 90; MostWatched) { $_REQUEST['rowCount'] = $obj->maxVideos; $dataFlickirty = new stdClass(); @@ -181,7 +272,6 @@ $percent = 90; SortByName) { $_REQUEST['rowCount'] = $obj->maxVideos; $dataFlickirty = new stdClass(); @@ -214,14 +304,13 @@ $percent = 90; Categories) { $url = "{$global['webSiteRootURL']}plugin/YouPHPFlix2/view/modeFlixCategory.php"; - if(!empty($_GET['catName'])){ + if (!empty($_GET['catName'])) { $url = addQueryStringParameter($url, 'catName', $_GET['catName']); } $search = getSearchVar(); - if(!empty($search)){ + if (!empty($search)) { $url = addQueryStringParameter($url, 'search', $search); } $url = addQueryStringParameter($url, 'tags_id', intval(@$_GET['tags_id'])); @@ -253,7 +342,7 @@ $percent = 90; $container.on('append.infiniteScroll', function (event, response, path, items) { //console.log('Append page: ' + path); - $("img.thumbsJPG").each(function (index) { + $("img.thumbsJPG").not('flickity-lazyloaded').each(function (index) { $(this).attr('src', $(this).attr('data-flickity-lazyload')); $(this).addClass('flickity-lazyloaded'); }); @@ -274,7 +363,6 @@ $percent = 90; \ No newline at end of file diff --git a/plugin/YouPHPFlix2/view/modeFlixFooter.php b/plugin/YouPHPFlix2/view/modeFlixFooter.php index 015ddc5c80..db50caa4c5 100644 --- a/plugin/YouPHPFlix2/view/modeFlixFooter.php +++ b/plugin/YouPHPFlix2/view/modeFlixFooter.php @@ -4,7 +4,6 @@ diff --git a/plugin/YouPHPFlix2/view/modeFlixSerie.php b/plugin/YouPHPFlix2/view/modeFlixSerie.php new file mode 100644 index 0000000000..5b7ce1d861 --- /dev/null +++ b/plugin/YouPHPFlix2/view/modeFlixSerie.php @@ -0,0 +1,83 @@ +PlayList) { + $dataFlickirty = new stdClass(); + $dataFlickirty->wrapAround = true; + $dataFlickirty->pageDots = !empty($obj->pageDots); + $dataFlickirty->lazyLoad = true; + $dataFlickirty->fade = true; + $dataFlickirty->setGallerySize = false; + $dataFlickirty->cellAlign = 'left'; + $dataFlickirty->groupCells = true; + if ($obj->PlayListAutoPlay) { + $dataFlickirty->autoPlay = 10000; + $dataFlickirty->wrapAround = true; + } else { + $dataFlickirty->wrapAround = true; + } + $videos = PlayList::getAllFromPlaylistsID($playlists_id); + $uidFlickirty = uniqid(); + ?> +
    + + +
    + + \ No newline at end of file diff --git a/plugin/YouPHPFlix2/view/row.php b/plugin/YouPHPFlix2/view/row.php index bbff68de8d..db75f75094 100644 --- a/plugin/YouPHPFlix2/view/row.php +++ b/plugin/YouPHPFlix2/view/row.php @@ -1,6 +1,7 @@ landscapePosters)) { @@ -17,14 +18,22 @@ TimeLogStart($timeLog3); "); } $playListsObj = AVideoPlugin::getObjectData("PlayLists"); @@ -142,10 +147,6 @@ unset($_POST['current']);