mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Refactor Video Status Constants
- Updated references from Video::$status* to Video::STATUS_* for consistency across multiple files. - Ensured that all instances of video status checks and assignments utilize the new constant format. - This change improves code readability and maintainability by standardizing the way video statuses are referenced throughout the codebase.
This commit is contained in:
parent
0c05672df9
commit
8db8d44a92
32 changed files with 442 additions and 401 deletions
|
@ -8,4 +8,4 @@ if (!isCommandLineInterface()) {
|
|||
}
|
||||
ob_end_flush();
|
||||
$sql = "UPDATE videos SET status = ? WHERE status = ? ";
|
||||
sqlDAL::writeSql($sql, 'ss', array(Video::$statusUnlistedButSearchable, Video::$statusUnlisted));
|
||||
sqlDAL::writeSql($sql, 'ss', array(Video::STATUS_UNLISTED_BUT_SEARCHABLE, Video::STATUS_UNLISTED));
|
||||
|
|
|
@ -8,11 +8,11 @@ if (!isCommandLineInterface()) {
|
|||
}
|
||||
|
||||
$arrayStatusToDelete = array(
|
||||
Video::$statusBrokenMissingFiles,
|
||||
Video::$statusDownloading,
|
||||
Video::$statusEncoding,
|
||||
Video::$statusEncodingError,
|
||||
Video::$statusTranfering,
|
||||
Video::STATUS_BROKEN_MISSING_FILES,
|
||||
Video::STATUS_DOWNLOADING,
|
||||
Video::STATUS_ENCODING,
|
||||
Video::STATUS_ENCODING_ERROR,
|
||||
Video::STATUS_TRANFERING,
|
||||
);
|
||||
|
||||
ob_end_flush();
|
||||
|
|
|
@ -161,7 +161,7 @@ while ($hasNewContent && !empty($users_id)) {
|
|||
$video->setUsers_id($users_id);
|
||||
$video->setRrating($value->rrating);
|
||||
$video->setExternalOptions($value->externalOptions);
|
||||
$video->setStatus(Video::$statusTranfering);
|
||||
$video->setStatus(Video::STATUS_TRANFERING);
|
||||
|
||||
echo ("importChannel: Saving video").PHP_EOL;
|
||||
$id = $video->save(false, true);
|
||||
|
@ -184,10 +184,10 @@ while ($hasNewContent && !empty($users_id)) {
|
|||
download($value->videos->mp3, $value->filename, $path);
|
||||
}
|
||||
|
||||
$video->setStatus(Video::$statusActive);
|
||||
$video->setStatus(Video::STATUS_ACTIVE);
|
||||
} else {
|
||||
echo ("importChannel: ERROR Video NOT saved").PHP_EOL;
|
||||
$video->setStatus(Video::$statusBrokenMissingFiles);
|
||||
$video->setStatus(Video::STATUS_BROKEN_MISSING_FILES);
|
||||
}
|
||||
$video->save(false, true);
|
||||
//exit;
|
||||
|
|
|
@ -205,7 +205,7 @@ if ($type !== 'm3u8') {
|
|||
//wget($value->background, "{$global['systemRootPath']}videos/userPhoto/photo{$id}.png", true);
|
||||
} else {
|
||||
_error_log("importUsers: ERROR NOT saved");
|
||||
$video->setStatus(Video::$statusBrokenMissingFiles);
|
||||
$video->setStatus(Video::STATUS_BROKEN_MISSING_FILES);
|
||||
}
|
||||
//exit;
|
||||
}
|
||||
|
@ -294,17 +294,17 @@ while ($hasNewContent) {
|
|||
$size = getDirSize($path);
|
||||
if ($size < 10000000) {
|
||||
if(empty($videos_id)){
|
||||
$video->setStatus(Video::$statusTranfering);
|
||||
$video->setStatus(Video::STATUS_TRANFERING);
|
||||
_error_log("importVideo status: transfering ($size) " . humanFileSize($size));
|
||||
}else{
|
||||
if ($size > 1000000) {
|
||||
$video->setStatus(Video::$statusActive);
|
||||
$video->setStatus(Video::STATUS_ACTIVE);
|
||||
}
|
||||
_error_log("importVideo status: else ($size) " . humanFileSize($size));
|
||||
}
|
||||
}
|
||||
if(empty($videos_id)){
|
||||
$video->setStatus(Video::$statusTranfering);
|
||||
$video->setStatus(Video::STATUS_TRANFERING);
|
||||
}
|
||||
|
||||
_error_log("importVideo: Saving video");
|
||||
|
@ -327,7 +327,7 @@ while ($hasNewContent) {
|
|||
download($value->videos->mp3, $value->filename, $path);
|
||||
}
|
||||
|
||||
$video->setStatus(Video::$statusActive);
|
||||
$video->setStatus(Video::STATUS_ACTIVE);
|
||||
if (!empty($value->videos->m3u8)) {
|
||||
if ($size < 10000000) {
|
||||
if(empty($videos_id)){
|
||||
|
@ -336,7 +336,7 @@ while ($hasNewContent) {
|
|||
}
|
||||
|
||||
if(empty($videos_id)){
|
||||
$video->setStatus(Video::$statusEncoding);
|
||||
$video->setStatus(Video::STATUS_ENCODING);
|
||||
}
|
||||
} else {
|
||||
_error_log("importVideo m3u8 NOT SEND: ($size) " . humanFileSize($size));
|
||||
|
@ -354,7 +354,7 @@ while ($hasNewContent) {
|
|||
}
|
||||
} else {
|
||||
_error_log("importVideo: ERROR Video NOT saved");
|
||||
$video->setStatus(Video::$statusBrokenMissingFiles);
|
||||
$video->setStatus(Video::STATUS_BROKEN_MISSING_FILES);
|
||||
}
|
||||
$video->save(false, true);
|
||||
//exit;
|
||||
|
|
|
@ -131,7 +131,7 @@ for ($i = 0; $i < $totalVideos; $i++) {
|
|||
$index = array_rand($cats);
|
||||
|
||||
$video->setCategories_id($cats[$index]['id']);
|
||||
$video->setStatus(Video::$statusActive);
|
||||
$video->setStatus(Video::STATUS_ACTIVE);
|
||||
$video->setFilesize(2858747);
|
||||
$video->setLikes(rand(0, 1000));
|
||||
$video->setDislikes(rand(0, 1000));
|
||||
|
|
|
@ -32,7 +32,7 @@ foreach ($folders as $folder) {
|
|||
if (is_dir($fullPath) && (str_starts_with($folder, 'v_') || str_starts_with($folder, 'video_'))) {
|
||||
$video = Video::getVideoFromFileNameLight($folder);
|
||||
if (!empty($video)) {
|
||||
if ($video['status'] === Video::$statusEncoding) {
|
||||
if ($video['status'] === Video::STATUS_ENCODING) {
|
||||
if (strtotime($video['created']) < strtotime('-2 days')) {
|
||||
if (getDirSize($fullPath) > $_500MB) {
|
||||
$v = new Video('', '', $video['id']);
|
||||
|
|
|
@ -61,7 +61,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(Video::$statusActive);
|
||||
$video->setStatus(Video::STATUS_ACTIVE);
|
||||
$video->setUsers_id(1);
|
||||
if ($video->save(false, true)) {
|
||||
echo "{$count}/{$total} {$title} created\n";
|
||||
|
|
|
@ -52,7 +52,7 @@ foreach ($folders as $folder) {
|
|||
$new_video->setCreated($mysqlDate);
|
||||
$new_video->setCategories_id(1);
|
||||
$new_video->setUsers_id(1);
|
||||
$new_video->setStatus(Video::$statusActive);
|
||||
$new_video->setStatus(Video::STATUS_ACTIVE);
|
||||
$new_video->setType(Video::$videoTypeVideo);
|
||||
|
||||
$id = $new_video->save(false, true);
|
||||
|
|
|
@ -22,7 +22,7 @@ echo "Path: {$path}" . PHP_EOL;
|
|||
$sites_id_to_check = [];
|
||||
|
||||
foreach ($videos as $value) {
|
||||
if ($value['status'] !== Video::$statusBrokenMissingFiles && empty($checkAll)) {
|
||||
if ($value['status'] !== Video::STATUS_BROKEN_MISSING_FILES && empty($checkAll)) {
|
||||
continue;
|
||||
}
|
||||
if ($value['type'] !== Video::$videoTypeVideo) {
|
||||
|
@ -44,8 +44,8 @@ foreach ($sites_id_to_check as $key => $value) {
|
|||
if (Video::isMediaFileMissing($filename)) {
|
||||
$sources = getVideosURL_V2($filename);
|
||||
echo "{$key}/{$total} is missing ". json_encode($sources) . PHP_EOL;
|
||||
} else if($video->getStatus()===Video::$statusBrokenMissingFiles){
|
||||
$video->setStatus(Video::$statusActive);
|
||||
} else if($video->getStatus()===Video::STATUS_BROKEN_MISSING_FILES){
|
||||
$video->setStatus(Video::STATUS_ACTIVE);
|
||||
echo "{$key}/{$total} is set to active " . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,8 +203,8 @@ if (!empty($_FILES['video']['tmp_name'])) {
|
|||
} else {
|
||||
$obj->lines[] = __LINE__;
|
||||
// set encoding
|
||||
$video->setStatus(Video::$statusEncoding);
|
||||
//$video->setAutoStatus(Video::$statusActive);
|
||||
$video->setStatus(Video::STATUS_ENCODING);
|
||||
//$video->setAutoStatus(Video::STATUS_ACTIVE);
|
||||
}
|
||||
if (!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination_local}.jpg")) {
|
||||
$obj->lines[] = __LINE__;
|
||||
|
|
|
@ -50,7 +50,7 @@ $video = new Video("", "", $_REQUEST['videos_id'], true);
|
|||
$obj->video_id = $_REQUEST['videos_id'];
|
||||
|
||||
|
||||
$video->setAutoStatus(Video::$statusActive);
|
||||
$video->setAutoStatus(Video::STATUS_ACTIVE);
|
||||
|
||||
$video_id = $video->save();
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
$video = new Video(preg_replace("/_+/", " ", $path_parts['filename']), $filename, @$_FILES['upl']['videoId'], true);
|
||||
$video->setDuration($duration);
|
||||
$video->setType($type);
|
||||
$video->setStatus(Video::$statusEncoding);
|
||||
$video->setStatus(Video::STATUS_ENCODING);
|
||||
|
||||
$id = $video->save($updateVideoGroups);
|
||||
_error_log("AddQueueEncoder Video saved with ID: " . $id);
|
||||
|
|
|
@ -31,7 +31,7 @@ function getVideoTagsFromVideo($video, $type)
|
|||
}
|
||||
} else {
|
||||
$ppv = AVideoPlugin::getObjectDataIfEnabled("PayPerView");
|
||||
if ($video->getStatus() === Video::$statusFansOnly) {
|
||||
if ($video->getStatus() === Video::STATUS_FANS_ONLY) {
|
||||
$objTag->type = "warning";
|
||||
$objTag->text = '<i class="fas fa-star" ></i>';
|
||||
$objTag->tooltip = __("Fans Only");
|
||||
|
@ -84,31 +84,31 @@ function getVideoTagVideoStatus($video, $type)
|
|||
$status = $video->getStatus();
|
||||
$objTag->text = __(Video::$statusDesc[$status]);
|
||||
switch ($status) {
|
||||
case Video::$statusActive:
|
||||
case Video::STATUS_ACTIVE:
|
||||
$objTag->type = "success";
|
||||
break;
|
||||
case Video::$statusActiveAndEncoding:
|
||||
case Video::STATUS_ACTIVE_AND_ENCODING:
|
||||
$objTag->type = "success";
|
||||
break;
|
||||
case Video::$statusInactive:
|
||||
case Video::STATUS_INACTIVE:
|
||||
$objTag->type = "warning";
|
||||
break;
|
||||
case Video::$statusEncoding:
|
||||
case Video::STATUS_ENCODING:
|
||||
$objTag->type = "info";
|
||||
break;
|
||||
case Video::$statusDownloading:
|
||||
case Video::STATUS_DOWNLOADING:
|
||||
$objTag->type = "info";
|
||||
break;
|
||||
case Video::$statusUnlisted:
|
||||
case Video::STATUS_UNLISTED:
|
||||
$objTag->type = "info";
|
||||
break;
|
||||
case Video::$statusUnlistedButSearchable:
|
||||
case Video::STATUS_UNLISTED_BUT_SEARCHABLE:
|
||||
$objTag->type = "info";
|
||||
break;
|
||||
case Video::$statusRecording:
|
||||
case Video::STATUS_RECORDING:
|
||||
$objTag->type = "danger isRecording isRecordingIcon";
|
||||
break;
|
||||
case Video::$statusDraft:
|
||||
case Video::STATUS_DRAFT:
|
||||
$objTag->type = "primary";
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -558,7 +558,7 @@ class PlayList extends ObjectYPT
|
|||
if (empty($playlists_id)) {
|
||||
$sql = "SELECT 0 as playlists_id, id as videos_id FROM videos p WHERE status = ? ORDER BY `created` DESC ";
|
||||
$formats = 's';
|
||||
$values = [Video::$statusActive];
|
||||
$values = [Video::STATUS_ACTIVE];
|
||||
} else {
|
||||
$sql = "SELECT * FROM playlists_has_videos p WHERE playlists_id = ? " . self::getOrderBy('p.');
|
||||
$formats = 'i';
|
||||
|
|
|
@ -1003,7 +1003,7 @@ if (typeof gtag !== \"function\") {
|
|||
}
|
||||
|
||||
$video = new Video("", "", $videos_id);
|
||||
if ($video->getStatus() === Video::$statusInactive) {
|
||||
if ($video->getStatus() === Video::STATUS_INACTIVE) {
|
||||
$global['canWatchVideoReason'] = "Video is inactive";
|
||||
_error_log("User::canWatchVideo Video is inactive ({$videos_id})");
|
||||
self::setCacheWatchVideo($cacheName, false);
|
||||
|
@ -1088,7 +1088,7 @@ if (typeof gtag !== \"function\") {
|
|||
}
|
||||
|
||||
$video = new Video("", "", $videos_id);
|
||||
if ($video->getStatus() === Video::$statusInactive) {
|
||||
if ($video->getStatus() === Video::STATUS_INACTIVE) {
|
||||
$global['canWatchVideoReason'] = "canWatchVideoWithAds: Video is inactive";
|
||||
_error_log("User::canWatchVideoWithAds Video is inactive ({$videos_id})");
|
||||
return false;
|
||||
|
|
|
@ -71,55 +71,7 @@ if (!class_exists('Video')) {
|
|||
protected $publish_datetime;
|
||||
protected $notification_datetime;
|
||||
protected $made_for_kids;
|
||||
public static $statusDesc = [
|
||||
'a' => 'Active',
|
||||
'k' => 'Active and Encoding',
|
||||
'i' => 'Inactive',
|
||||
'h' => 'Scheduled Release Date',
|
||||
'e' => 'Encoding',
|
||||
'x' => 'Encoding Error',
|
||||
'd' => 'Downloading',
|
||||
't' => 'Transferring',
|
||||
'u' => 'Unlisted',
|
||||
's' => 'Unlisted but Searchable',
|
||||
'r' => 'Recording',
|
||||
'f' => 'FansOnly',
|
||||
'b' => 'Broken Missing files',
|
||||
'p' => 'Unpublished',
|
||||
'c' => 'Draft'
|
||||
];
|
||||
public static $statusIcons = [
|
||||
'a' => '<i class=\'fas fa-eye\'></i>',
|
||||
'k' => '<i class=\'fas fa-cog\'></i>',
|
||||
'i' => '<i class=\'fas fa-eye-slash\'></i>',
|
||||
'h' => '<i class=\'fas fa-clock\'></i>',
|
||||
'e' => '<i class=\'fas fa-cog\'></i>',
|
||||
'x' => '<i class=\'fas fa-exclamation-triangle\'></i>',
|
||||
'd' => '<i class=\'fas fa-download\'></i>',
|
||||
't' => '<i class=\'fas fa-sync\'></i>',
|
||||
'u' => '<i class=\'fas fa-eye\' style=\'color: #BBB;\'></i>',
|
||||
's' => '<i class=\'fas fa-search\' style=\'color: #BBB;\'></i>',
|
||||
'r' => '<i class=\'fas fa-circle\'></i>',
|
||||
'f' => '<i class=\'fas fa-star\'></i>',
|
||||
'b' => '<i class=\'fas fa-times\'></i>',
|
||||
'p' => '<i class=\'fas fa-ban\'></i>',
|
||||
'c' => '<i class=\'fas fa-pencil-alt\'></i>'
|
||||
];
|
||||
public static $statusActive = 'a';
|
||||
public static $statusActiveAndEncoding = 'k';
|
||||
public static $statusInactive = 'i';
|
||||
public static $statusScheduledReleaseDate = 'h';
|
||||
public static $statusEncoding = 'e';
|
||||
public static $statusEncodingError = 'x';
|
||||
public static $statusDownloading = 'd';
|
||||
public static $statusTranfering = 't';
|
||||
public static $statusUnlisted = 'u';
|
||||
public static $statusUnlistedButSearchable = 's';
|
||||
public static $statusRecording = 'r';
|
||||
public static $statusFansOnly = 'f';
|
||||
public static $statusBrokenMissingFiles = 'b';
|
||||
public static $statusUnpublished = 'p';
|
||||
public static $statusDraft = 'c';
|
||||
|
||||
public static $rratingOptions = ['', 'g', 'pg', 'pg-13', 'r', 'nc-17', 'ma'];
|
||||
public static $rratingOptionsText = [
|
||||
'g' => 'General Audience',
|
||||
|
@ -174,6 +126,95 @@ if (!class_exists('Video')) {
|
|||
const SORT_TYPE_SHORTS = 'shorts';
|
||||
const SORT_TYPE_DATEADDED = 'dateadded';
|
||||
|
||||
// Status constants
|
||||
const STATUS_ACTIVE = 'a';
|
||||
const STATUS_ACTIVE_AND_ENCODING = 'k';
|
||||
const STATUS_INACTIVE = 'i';
|
||||
const STATUS_SCHEDULED_RELEASE_DATE = 'h';
|
||||
const STATUS_ENCODING = 'e';
|
||||
const STATUS_ENCODING_ERROR = 'x';
|
||||
const STATUS_DOWNLOADING = 'd';
|
||||
const STATUS_TRANFERING = 't';
|
||||
const STATUS_UNLISTED = 'u';
|
||||
const STATUS_UNLISTED_BUT_SEARCHABLE = 's';
|
||||
const STATUS_RECORDING = 'r';
|
||||
const STATUS_FANS_ONLY = 'f';
|
||||
const STATUS_BROKEN_MISSING_FILES = 'b';
|
||||
const STATUS_UNPUBLISHED = 'p';
|
||||
const STATUS_DRAFT = 'c';
|
||||
|
||||
// Reuse constants in static arrays
|
||||
public static $statusDesc = [
|
||||
self::STATUS_ACTIVE => 'Active',
|
||||
self::STATUS_ACTIVE_AND_ENCODING => 'Active and Encoding',
|
||||
self::STATUS_INACTIVE => 'Inactive',
|
||||
self::STATUS_SCHEDULED_RELEASE_DATE => 'Scheduled Release Date',
|
||||
self::STATUS_ENCODING => 'Encoding',
|
||||
self::STATUS_ENCODING_ERROR => 'Encoding Error',
|
||||
self::STATUS_DOWNLOADING => 'Downloading',
|
||||
self::STATUS_TRANFERING => 'Transferring',
|
||||
self::STATUS_UNLISTED => 'Unlisted',
|
||||
self::STATUS_UNLISTED_BUT_SEARCHABLE => 'Unlisted but Searchable',
|
||||
self::STATUS_RECORDING => 'Recording',
|
||||
self::STATUS_FANS_ONLY => 'FansOnly',
|
||||
self::STATUS_BROKEN_MISSING_FILES => 'Broken Missing files',
|
||||
self::STATUS_UNPUBLISHED => 'Unpublished',
|
||||
self::STATUS_DRAFT => 'Draft'
|
||||
];
|
||||
|
||||
public static $statusDescriptions = [
|
||||
self::STATUS_ACTIVE => 'Active: The video is published and visible to users.',
|
||||
self::STATUS_ACTIVE_AND_ENCODING => 'Active and Encoding: The video is published but still being processed/encoded.',
|
||||
self::STATUS_INACTIVE => 'Inactive: The video is hidden and not available to users.',
|
||||
self::STATUS_SCHEDULED_RELEASE_DATE => 'Scheduled Release Date: The video is scheduled to be published at a future date/time.',
|
||||
self::STATUS_ENCODING => 'Encoding: The video is currently being encoded and is not yet available.',
|
||||
self::STATUS_ENCODING_ERROR => 'Encoding Error: There was an error during encoding; the video is not available.',
|
||||
self::STATUS_DOWNLOADING => 'Downloading: The video is being downloaded from an external source.',
|
||||
self::STATUS_TRANFERING => 'Transferring: The video is being transferred between servers or locations.',
|
||||
self::STATUS_UNLISTED => 'Unlisted: The video is not listed publicly but can be accessed via direct link.',
|
||||
self::STATUS_UNLISTED_BUT_SEARCHABLE => 'Unlisted but Searchable: The video is not listed but can be found via search.',
|
||||
self::STATUS_RECORDING => 'Recording: The video is currently being recorded (e.g., live stream).',
|
||||
self::STATUS_FANS_ONLY => 'FansOnly: The video is restricted to fans or subscribers only.',
|
||||
self::STATUS_BROKEN_MISSING_FILES => 'Broken Missing Files: The video is missing files or is corrupted.',
|
||||
self::STATUS_UNPUBLISHED => 'Unpublished: The video is not published and not visible to users.',
|
||||
self::STATUS_DRAFT => 'Draft: The video is a draft and not yet published.',
|
||||
];
|
||||
|
||||
public static $statusIcons = [
|
||||
self::STATUS_ACTIVE => '<i class=\'fas fa-eye\'></i>',
|
||||
self::STATUS_ACTIVE_AND_ENCODING => '<i class=\'fas fa-cog\'></i>',
|
||||
self::STATUS_INACTIVE => '<i class=\'fas fa-eye-slash\'></i>',
|
||||
self::STATUS_SCHEDULED_RELEASE_DATE => '<i class=\'fas fa-clock\'></i>',
|
||||
self::STATUS_ENCODING => '<i class=\'fas fa-cog\'></i>',
|
||||
self::STATUS_ENCODING_ERROR => '<i class=\'fas fa-exclamation-triangle\'></i>',
|
||||
self::STATUS_DOWNLOADING => '<i class=\'fas fa-download\'></i>',
|
||||
self::STATUS_TRANFERING => '<i class=\'fas fa-sync\'></i>',
|
||||
self::STATUS_UNLISTED => '<i class=\'fas fa-eye\' style=\'color: #BBB;\'></i>',
|
||||
self::STATUS_UNLISTED_BUT_SEARCHABLE => '<i class=\'fas fa-search\' style=\'color: #BBB;\'></i>',
|
||||
self::STATUS_RECORDING => '<i class=\'fas fa-circle\'></i>',
|
||||
self::STATUS_FANS_ONLY => '<i class=\'fas fa-star\'></i>',
|
||||
self::STATUS_BROKEN_MISSING_FILES => '<i class=\'fas fa-times\'></i>',
|
||||
self::STATUS_UNPUBLISHED => '<i class=\'fas fa-ban\'></i>',
|
||||
self::STATUS_DRAFT => '<i class=\'fas fa-pencil-alt\'></i>'
|
||||
];
|
||||
|
||||
// this block will be removed in the future
|
||||
public static $statusActive = self::STATUS_ACTIVE;
|
||||
public static $statusActiveAndEncoding = self::STATUS_ACTIVE_AND_ENCODING;
|
||||
public static $statusInactive = self::STATUS_INACTIVE;
|
||||
public static $statusScheduledReleaseDate = self::STATUS_SCHEDULED_RELEASE_DATE;
|
||||
public static $statusEncoding = self::STATUS_ENCODING;
|
||||
public static $statusEncodingError = self::STATUS_ENCODING_ERROR;
|
||||
public static $statusDownloading = self::STATUS_DOWNLOADING;
|
||||
public static $statusTranfering = self::STATUS_TRANFERING;
|
||||
public static $statusUnlisted = self::STATUS_UNLISTED;
|
||||
public static $statusUnlistedButSearchable = self::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||
public static $statusRecording = self::STATUS_RECORDING;
|
||||
public static $statusFansOnly = self::STATUS_FANS_ONLY;
|
||||
public static $statusBrokenMissingFiles = self::STATUS_BROKEN_MISSING_FILES;
|
||||
public static $statusUnpublished = self::STATUS_UNPUBLISHED;
|
||||
public static $statusDraft = self::STATUS_DRAFT;
|
||||
|
||||
|
||||
public function __construct($title = "", $filename = "", $id = 0, $refreshCache = false)
|
||||
{
|
||||
|
@ -511,9 +552,9 @@ if (!class_exists('Video')) {
|
|||
if (empty($this->status) || empty(self::$statusDesc[$this->status])) {
|
||||
_error_log("Video::save status is empty or not valid {$this->status} " . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
||||
if ($this->type != self::$videoTypeVideo) {
|
||||
$this->status = Video::$statusActive;
|
||||
$this->status = Video::STATUS_ACTIVE;
|
||||
} else {
|
||||
$this->status = Video::$statusEncoding;
|
||||
$this->status = Video::STATUS_ENCODING;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -873,8 +914,8 @@ if (!class_exists('Video')) {
|
|||
|
||||
public function setStatus($status)
|
||||
{
|
||||
if ($status === Video::$statusBrokenMissingFiles) {
|
||||
if (empty($this->status) || $this->status !== Video::$statusBrokenMissingFiles) {
|
||||
if ($status === Video::STATUS_BROKEN_MISSING_FILES) {
|
||||
if (empty($this->status) || $this->status !== Video::STATUS_BROKEN_MISSING_FILES) {
|
||||
_error_log("Video::setStatus({$status}) set to statusBrokenMissingFiles id = {$this->id} " . json_encode(debug_backtrace()), AVideoLog::$WARNING);
|
||||
}
|
||||
}
|
||||
|
@ -883,14 +924,14 @@ if (!class_exists('Video')) {
|
|||
global $global;
|
||||
|
||||
if (empty($status)) {
|
||||
$status = Video::$statusActive;
|
||||
$status = Video::STATUS_ACTIVE;
|
||||
}
|
||||
if (empty(Video::$statusDesc[$status])) {
|
||||
_error_log("Video::setStatus({$status}) NOT found " . json_encode(debug_backtrace()), AVideoLog::$WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->status == Video::$statusUnpublished) {
|
||||
if ($this->status == Video::STATUS_UNPUBLISHED) {
|
||||
if (!User::isAdmin() && !Permissions::canModerateVideos()) {
|
||||
_error_log("Video::setStatus({$status}) Only modetrators can publish videos ", AVideoLog::$WARNING);
|
||||
return false;
|
||||
|
@ -910,17 +951,17 @@ if (!class_exists('Video')) {
|
|||
return false;
|
||||
}
|
||||
self::clearCache($this->id);
|
||||
if ($this->status == Video::$statusActive || $status == Video::$statusActive && ($this->status != $status)) {
|
||||
if ($this->status == Video::STATUS_ACTIVE || $status == Video::STATUS_ACTIVE && ($this->status != $status)) {
|
||||
|
||||
$doNotNotify = array(
|
||||
Video::$statusInactive,
|
||||
Video::$statusUnlisted,
|
||||
Video::$statusUnlistedButSearchable,
|
||||
Video::$statusFansOnly,
|
||||
Video::$statusBrokenMissingFiles,
|
||||
Video::$statusDraft
|
||||
Video::STATUS_INACTIVE,
|
||||
Video::STATUS_UNLISTED,
|
||||
Video::STATUS_UNLISTED_BUT_SEARCHABLE,
|
||||
Video::STATUS_FANS_ONLY,
|
||||
Video::STATUS_BROKEN_MISSING_FILES,
|
||||
Video::STATUS_DRAFT
|
||||
);
|
||||
if (!in_array($this->status, $doNotNotify) && $status == Video::$statusActive) {
|
||||
if (!in_array($this->status, $doNotNotify) && $status == Video::STATUS_ACTIVE) {
|
||||
_error_log("Video::setStatus({$status}) AVideoPlugin::onNewVideo ");
|
||||
$notTriggerOnNewVideo = array(
|
||||
'aVideoEncoder.json.php',
|
||||
|
@ -962,25 +1003,25 @@ if (!class_exists('Video')) {
|
|||
$advancedCustom = AVideoPlugin::getDataObject('CustomizeAdvanced');
|
||||
}
|
||||
if (!empty($_POST['fail'])) {
|
||||
return $this->setStatus(Video::$statusEncodingError);
|
||||
return $this->setStatus(Video::STATUS_ENCODING_ERROR);
|
||||
} else {
|
||||
if ($advancedCustom->enableVideoModeration) {
|
||||
return $this->setStatus(Video::$statusUnpublished);
|
||||
return $this->setStatus(Video::STATUS_UNPUBLISHED);
|
||||
} else if ($this->isScheduledForRelease()) {
|
||||
return $this->setStatus(Video::$statusScheduledReleaseDate);
|
||||
return $this->setStatus(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||
} else
|
||||
if (!empty($_REQUEST['overrideStatus'])) {
|
||||
return $this->setStatus($_REQUEST['overrideStatus']);
|
||||
} else if (!empty($_REQUEST['releaseDate']) && $_REQUEST['releaseDate'] !== 'now') {
|
||||
return $this->setStatus(Video::$statusScheduledReleaseDate);
|
||||
return $this->setStatus(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||
} else { // encoder did not provide a status
|
||||
AVideoPlugin::loadPlugin('Scheduler');
|
||||
$row = Scheduler::isActiveFromVideosId($this->id);
|
||||
if (!empty($row)) { // there is a schedule to activate the video
|
||||
return $this->setStatus(Video::$statusScheduledReleaseDate);
|
||||
return $this->setStatus(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||
} else {
|
||||
if (!empty($_REQUEST['keepEncoding'])) {
|
||||
return $this->setStatus(Video::$statusActiveAndEncoding);
|
||||
return $this->setStatus(Video::STATUS_ACTIVE_AND_ENCODING);
|
||||
} else {
|
||||
if ($this->getTitle() !== "Video automatically booked") {
|
||||
$typesToBeAutoDraft = array(
|
||||
|
@ -991,14 +1032,14 @@ if (!class_exists('Video')) {
|
|||
Video::$videoTypeZip,
|
||||
Video::$videoTypeGallery,
|
||||
);
|
||||
if (in_array($this->type, $typesToBeAutoDraft)){
|
||||
return $this->setStatus(Video::$statusDraft);
|
||||
}else{
|
||||
if (in_array($this->type, $typesToBeAutoDraft)) {
|
||||
return $this->setStatus(Video::STATUS_DRAFT);
|
||||
} else {
|
||||
_error_log("Video::setAutoStatus({$this->type}) set to default status " . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
||||
return $this->setStatus($advancedCustom->defaultVideoStatus->value);
|
||||
}
|
||||
} else {
|
||||
return $this->setStatus(Video::$statusInactive);
|
||||
return $this->setStatus(Video::STATUS_INACTIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1147,26 +1188,26 @@ if (!class_exists('Video')) {
|
|||
if ($status == Video::SORT_TYPE_VIEWABLE) {
|
||||
if (User::isLogged()) {
|
||||
$sql .= " AND ((v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') ";
|
||||
$sql .= " OR ((v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') ";
|
||||
$sql .= " OR ((v.status='" . Video::STATUS_UNLISTED . "' OR v.status='" . Video::STATUS_UNLISTED_BUT_SEARCHABLE . "') ";
|
||||
if (!User::isAdmin() && !Permissions::canAdminVideos()) {
|
||||
$sql .= " AND (v.users_id ='" . User::getId() . "' OR v.users_id_company = '" . User::getId() . "')";
|
||||
}
|
||||
$sql .= " ))";
|
||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') )";
|
||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::STATUS_UNLISTED . "' OR v.status='" . Video::STATUS_UNLISTED_BUT_SEARCHABLE . "') )";
|
||||
$sql .= " )";
|
||||
} else {
|
||||
$sql .= " AND ( v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
|
||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') )";
|
||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::STATUS_UNLISTED . "' OR v.status='" . Video::STATUS_UNLISTED_BUT_SEARCHABLE . "') )";
|
||||
$sql .= " )";
|
||||
}
|
||||
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
|
||||
$sql .= " AND ( v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
|
||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') )";
|
||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::STATUS_UNLISTED . "' OR v.status='" . Video::STATUS_UNLISTED_BUT_SEARCHABLE . "') )";
|
||||
$sql .= " )";
|
||||
} elseif ($status == Video::SORT_TYPE_PUBLICONLY) {
|
||||
$sql .= " AND v.status IN ('" . Video::$statusActive . "', '" . Video::$statusActiveAndEncoding . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
|
||||
$sql .= " AND v.status IN ('" . Video::STATUS_ACTIVE . "', '" . Video::STATUS_ACTIVE_AND_ENCODING . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
|
||||
} elseif ($status == Video::SORT_TYPE_PRIVATEONLY) {
|
||||
$sql .= " AND v.status IN ('" . Video::$statusActive . "', '" . Video::$statusActiveAndEncoding . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) > 0";
|
||||
$sql .= " AND v.status IN ('" . Video::STATUS_ACTIVE . "', '" . Video::STATUS_ACTIVE_AND_ENCODING . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) > 0";
|
||||
} elseif ($status == Video::SORT_TYPE_SHORTS) {
|
||||
$ShortsObj = AVideoPlugin::getDataObject("Shorts");
|
||||
if (!empty($ShortsObj)) {
|
||||
|
@ -1197,7 +1238,7 @@ if (!class_exists('Video')) {
|
|||
|
||||
switch ($sortType) {
|
||||
case Video::SORT_TYPE_SUGGESTED:
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||
$sql .= " ORDER BY RAND() ";
|
||||
$sql .= BootGrid::getSqlFromPost([], empty($_POST['sort']['likes']) ? "v." : "", "", true);
|
||||
if (strpos(mb_strtolower($sql), 'limit') === false) {
|
||||
|
@ -1390,9 +1431,9 @@ if (!class_exists('Video')) {
|
|||
$sql .= " v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
|
||||
/* If I keep the code below it will appear on first page
|
||||
if (User::isAdmin()) {
|
||||
$sql .= " OR v.status = '" . Video::$statusUnpublished . "' ";
|
||||
$sql .= " OR v.status = '" . Video::STATUS_UNPUBLISHED . "' ";
|
||||
} else if (User::isLogged()) {
|
||||
$sql .= " OR (v.status = '" . Video::$statusUnpublished . "' AND v.users_id = '" . User::getId() . "' )";
|
||||
$sql .= " OR (v.status = '" . Video::STATUS_UNPUBLISHED . "' AND v.users_id = '" . User::getId() . "' )";
|
||||
}
|
||||
*/
|
||||
$sql .= " )";
|
||||
|
@ -1401,9 +1442,9 @@ if (!class_exists('Video')) {
|
|||
$sql .= " v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
|
||||
/*If I keep the code below it will appear on first page
|
||||
if (User::isAdmin()) {
|
||||
$sql .= " OR v.status = '" . Video::$statusUnpublished . "' ";
|
||||
$sql .= " OR v.status = '" . Video::STATUS_UNPUBLISHED . "' ";
|
||||
} else if (User::isLogged()) {
|
||||
$sql .= " OR (v.status = '" . Video::$statusUnpublished . "' AND v.users_id = '" . User::getId() . "' )";
|
||||
$sql .= " OR (v.status = '" . Video::STATUS_UNPUBLISHED . "' AND v.users_id = '" . User::getId() . "' )";
|
||||
}
|
||||
*/
|
||||
$sql .= " )";
|
||||
|
@ -1467,7 +1508,7 @@ if (!class_exists('Video')) {
|
|||
$firstClauseLimit = '';
|
||||
if (empty($id)) {
|
||||
if ($suggestedOnly) {
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||
}
|
||||
if (empty($random) && !empty($_GET['videoName'])) {
|
||||
$videoName = addcslashes($_GET['videoName'], "'");
|
||||
|
@ -1486,7 +1527,7 @@ if (!class_exists('Video')) {
|
|||
//var_dump($rand, $numRows);
|
||||
//$sql .= " ORDER BY RAND() ";
|
||||
} elseif ($suggestedOnly && empty($_GET['videoName']) && empty($_GET['search']) && empty($_GET['searchPhrase'])) {
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||
$numRows = self::getTotalVideos($status, false, $ignoreGroup, $showUnlisted, $activeUsersOnly, $suggestedOnly);
|
||||
if ($numRows <= 2) {
|
||||
$rand = 0;
|
||||
|
@ -1708,10 +1749,10 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
|
||||
$serie_playlists_id = $video['serie_playlists_id'];
|
||||
if(empty($serie_playlists_id) && !empty($_REQUEST['serie_playlists_id'])){
|
||||
if (empty($serie_playlists_id) && !empty($_REQUEST['serie_playlists_id'])) {
|
||||
$serie_playlists_id = intval($video['serie_playlists_id']);
|
||||
}
|
||||
if(!empty($serie_playlists_id)){
|
||||
if (!empty($serie_playlists_id)) {
|
||||
unset($_REQUEST['serie_playlists_id']);
|
||||
$videosArrayId = PlayList::getVideosIdFromPlaylist($serie_playlists_id);
|
||||
$rows = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
|
||||
|
@ -2597,7 +2638,7 @@ if (!class_exists('Video')) {
|
|||
if ($status == Video::SORT_TYPE_VIEWABLE) {
|
||||
if (User::isLogged()) {
|
||||
$sql .= " AND (v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') ";
|
||||
$sql .= " OR (v.status='" . Video::$statusUnlisted . "' ";
|
||||
$sql .= " OR (v.status='" . Video::STATUS_UNLISTED . "' ";
|
||||
if (!User::isAdmin() && !Permissions::canAdminVideos()) {
|
||||
$sql .= " AND (v.users_id ='" . User::getId() . "' OR v.users_id_company = '" . User::getId() . "')";
|
||||
}
|
||||
|
@ -2633,7 +2674,7 @@ if (!class_exists('Video')) {
|
|||
$sql .= AVideoPlugin::getVideoWhereClause();
|
||||
|
||||
if ($suggestedOnly) {
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||
$sql .= " ORDER BY RAND() ";
|
||||
} else if ($with_order_only) {
|
||||
$sql .= " ORDER BY v.`order` ASC ";
|
||||
|
@ -2861,7 +2902,7 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
|
||||
if ($suggestedOnly) {
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2961,18 +3002,18 @@ if (!class_exists('Video')) {
|
|||
|
||||
public static function getViewableStatus($showUnlisted = false)
|
||||
{
|
||||
$viewable = [Video::$statusActive, Video::$statusActiveAndEncoding, Video::$statusFansOnly];
|
||||
$viewable = [Video::STATUS_ACTIVE, Video::STATUS_ACTIVE_AND_ENCODING, Video::STATUS_FANS_ONLY];
|
||||
if ($showUnlisted) {
|
||||
$viewable[] = Video::$statusUnlisted;
|
||||
$viewable[] = Video::$statusUnlistedButSearchable;
|
||||
$viewable[] = Video::STATUS_UNLISTED;
|
||||
$viewable[] = Video::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||
} else {
|
||||
$search = getSearchVar();
|
||||
if (!empty($search)) {
|
||||
$viewable[] = Video::$statusUnlistedButSearchable;
|
||||
$viewable[] = Video::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||
}
|
||||
}
|
||||
if (User::isAdmin()) {
|
||||
$viewable[] = Video::$statusScheduledReleaseDate;
|
||||
$viewable[] = Video::STATUS_SCHEDULED_RELEASE_DATE;
|
||||
}
|
||||
/*
|
||||
* Cannot do that otherwise it will list videos on the list videos menu
|
||||
|
@ -3693,7 +3734,7 @@ if (!class_exists('Video')) {
|
|||
$response = array('videos_id' => $videos_id);
|
||||
$video = new Video("", "", $videos_id);
|
||||
$ppv = AVideoPlugin::getObjectDataIfEnabled("PayPerView");
|
||||
$response['fans_only'] = $video->getStatus() === self::$statusFansOnly;
|
||||
$response['fans_only'] = $video->getStatus() === self::STATUS_FANS_ONLY;
|
||||
if ($response['fans_only'] && AVideoPlugin::isEnabledByName("FansSubscriptions")) {
|
||||
$response['fans_only_info'] = FansSubscriptions::getPlansFromUsersID($video->getUsers_id());
|
||||
}
|
||||
|
@ -4835,7 +4876,7 @@ if (!class_exists('Video')) {
|
|||
if ($v['type'] !== 'video') {
|
||||
return [];
|
||||
}
|
||||
if ($v['status'] !== self::$statusActive && $v['status'] !== self::$statusUnlisted && $v['status'] !== self::$statusUnlistedButSearchable) {
|
||||
if ($v['status'] !== self::STATUS_ACTIVE && $v['status'] !== self::STATUS_UNLISTED && $v['status'] !== self::STATUS_UNLISTED_BUT_SEARCHABLE) {
|
||||
return [];
|
||||
}
|
||||
$video = new Video('', '', $v['id']);
|
||||
|
@ -6133,22 +6174,22 @@ if (!class_exists('Video')) {
|
|||
return $response;
|
||||
}
|
||||
|
||||
if ($video->getStatus() == Video::$statusInactive) {
|
||||
if ($video->getStatus() == Video::STATUS_INACTIVE) {
|
||||
$response->canWatch = false;
|
||||
$response->why[] = "This video is inactive";
|
||||
}
|
||||
|
||||
if ($video->getStatus() == Video::$statusBrokenMissingFiles) {
|
||||
if ($video->getStatus() == Video::STATUS_BROKEN_MISSING_FILES) {
|
||||
$response->canWatch = false;
|
||||
$response->why[] = "This video is broken";
|
||||
}
|
||||
|
||||
if ($video->getStatus() == Video::$statusEncoding) {
|
||||
if ($video->getStatus() == Video::STATUS_ENCODING) {
|
||||
$response->canWatch = false;
|
||||
$response->why[] = "This video is encoding, please wait";
|
||||
}
|
||||
|
||||
if ($video->getStatus() == Video::$statusTranfering) {
|
||||
if ($video->getStatus() == Video::STATUS_TRANFERING) {
|
||||
$response->canWatch = false;
|
||||
$response->why[] = "This video is still transfering, please wait";
|
||||
}
|
||||
|
@ -7137,12 +7178,12 @@ if (!class_exists('Video')) {
|
|||
$_checkIfIsBrokenList[$videos_id] = false;
|
||||
return $_checkIfIsBrokenList[$videos_id];
|
||||
}
|
||||
if ($video->getStatus() == Video::$statusActive || $video->getStatus() == Video::$statusUnlisted || $video->getStatus() == Video::$statusUnlistedButSearchable) {
|
||||
if ($video->getStatus() == Video::STATUS_ACTIVE || $video->getStatus() == Video::STATUS_UNLISTED || $video->getStatus() == Video::STATUS_UNLISTED_BUT_SEARCHABLE) {
|
||||
if ($video->getType() == Video::$videoTypeAudio || $video->getType() == Video::$videoTypeVideo) {
|
||||
$checkIfIsBroken++;
|
||||
if (self::isMediaFileMissing($video->getFilename())) {
|
||||
_error_log("Video::checkIfIsBroken($videos_id) true " . $video->getFilename() . ' status=[' . $video->getStatus() . ']' . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
||||
$video->setStatus(Video::$statusBrokenMissingFiles);
|
||||
$video->setStatus(Video::STATUS_BROKEN_MISSING_FILES);
|
||||
Video::clearCache($videos_id);
|
||||
$_checkIfIsBrokenList[$videos_id] = true;
|
||||
return $_checkIfIsBrokenList[$videos_id];
|
||||
|
@ -7150,7 +7191,7 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
}
|
||||
|
||||
$_checkIfIsBrokenList[$videos_id] = $video->getStatus() == Video::$statusBrokenMissingFiles;
|
||||
$_checkIfIsBrokenList[$videos_id] = $video->getStatus() == Video::STATUS_BROKEN_MISSING_FILES;
|
||||
return $_checkIfIsBrokenList[$videos_id];
|
||||
}
|
||||
|
||||
|
@ -7296,7 +7337,7 @@ if (!class_exists('Video')) {
|
|||
static public function getAllActiveEPGs()
|
||||
{
|
||||
global $config;
|
||||
$sql = "SELECT * FROM `videos` WHERE status = '" . Video::$statusActive . "' "
|
||||
$sql = "SELECT * FROM `videos` WHERE status = '" . Video::STATUS_ACTIVE . "' "
|
||||
. "AND `type` = 'linkVideo' "
|
||||
. "AND epg_link IS NOT NULL "
|
||||
. "AND epg_link != ''";
|
||||
|
@ -7400,11 +7441,11 @@ if (!class_exists('Video')) {
|
|||
static function deleteUselessOldVideos($days)
|
||||
{
|
||||
$arrayStatusToDelete = array(
|
||||
Video::$statusBrokenMissingFiles,
|
||||
Video::$statusDownloading,
|
||||
Video::$statusEncoding,
|
||||
Video::$statusEncodingError,
|
||||
Video::$statusTranfering,
|
||||
Video::STATUS_BROKEN_MISSING_FILES,
|
||||
Video::STATUS_DOWNLOADING,
|
||||
Video::STATUS_ENCODING,
|
||||
Video::STATUS_ENCODING_ERROR,
|
||||
Video::STATUS_TRANFERING,
|
||||
);
|
||||
$daysAgo = date("Y-m-d H:i:s", strtotime("-{$days} days"));
|
||||
$sql = "SELECT * FROM videos WHERE status IN ('" . implode("', '", $arrayStatusToDelete) . "') AND created < ? ";
|
||||
|
@ -7615,40 +7656,40 @@ if (!empty($_GET['v']) && empty($_GET['videoName'])) {
|
|||
}
|
||||
global $statusThatShowTheCompleteMenu, $statusSearchFilter, $statusThatTheUserCanUpdate;
|
||||
$statusThatShowTheCompleteMenu = [
|
||||
Video::$statusActive,
|
||||
Video::$statusInactive,
|
||||
Video::$statusScheduledReleaseDate,
|
||||
Video::$statusActiveAndEncoding,
|
||||
Video::$statusUnlistedButSearchable,
|
||||
Video::$statusUnlisted,
|
||||
Video::$statusFansOnly,
|
||||
Video::$statusUnpublished,
|
||||
Video::$statusDraft,
|
||||
Video::STATUS_ACTIVE,
|
||||
Video::STATUS_INACTIVE,
|
||||
Video::STATUS_SCHEDULED_RELEASE_DATE,
|
||||
Video::STATUS_ACTIVE_AND_ENCODING,
|
||||
Video::STATUS_UNLISTED_BUT_SEARCHABLE,
|
||||
Video::STATUS_UNLISTED,
|
||||
Video::STATUS_FANS_ONLY,
|
||||
Video::STATUS_UNPUBLISHED,
|
||||
Video::STATUS_DRAFT,
|
||||
];
|
||||
|
||||
$statusSearchFilter = [
|
||||
Video::$statusActive,
|
||||
Video::$statusInactive,
|
||||
Video::$statusScheduledReleaseDate,
|
||||
Video::$statusEncoding,
|
||||
Video::$statusTranfering,
|
||||
Video::$statusUnlisted,
|
||||
Video::$statusUnlistedButSearchable,
|
||||
Video::$statusBrokenMissingFiles,
|
||||
Video::$statusUnpublished,
|
||||
Video::$statusDraft,
|
||||
Video::STATUS_ACTIVE,
|
||||
Video::STATUS_INACTIVE,
|
||||
Video::STATUS_SCHEDULED_RELEASE_DATE,
|
||||
Video::STATUS_ENCODING,
|
||||
Video::STATUS_TRANFERING,
|
||||
Video::STATUS_UNLISTED,
|
||||
Video::STATUS_UNLISTED_BUT_SEARCHABLE,
|
||||
Video::STATUS_BROKEN_MISSING_FILES,
|
||||
Video::STATUS_UNPUBLISHED,
|
||||
Video::STATUS_DRAFT,
|
||||
];
|
||||
|
||||
$statusThatTheUserCanUpdate = [
|
||||
[Video::$statusDraft, '#00B'],
|
||||
[Video::$statusActive, '#0A0'],
|
||||
[Video::$statusInactive, '#B00'],
|
||||
[Video::$statusUnlisted, '#AAA'],
|
||||
[Video::$statusUnlistedButSearchable, '#888'],
|
||||
[Video::STATUS_DRAFT, '#00B'],
|
||||
[Video::STATUS_ACTIVE, '#0A0'],
|
||||
[Video::STATUS_INACTIVE, '#B00'],
|
||||
[Video::STATUS_UNLISTED, '#AAA'],
|
||||
[Video::STATUS_UNLISTED_BUT_SEARCHABLE, '#888'],
|
||||
];
|
||||
|
||||
AVideoPlugin::loadPlugin('Permissions');
|
||||
if (User::isAdmin() || Permissions::canModerateVideos()) {
|
||||
$statusThatTheUserCanUpdate[] = [Video::$statusUnpublished, '#B00'];
|
||||
$statusThatTheUserCanUpdate[] = [Video::STATUS_UNPUBLISHED, '#B00'];
|
||||
}
|
||||
//Video::videoMadeForKidsExists();exit;
|
||||
|
|
|
@ -154,7 +154,7 @@ if (empty($_POST['id'])) {
|
|||
$obj->setType($_POST['videoLinkType']);
|
||||
}
|
||||
$rowsPath[] = array('line' => __LINE__, 'ElapsedTime' => getElapsedTime());
|
||||
$obj->setAutoStatus(Video::$statusDraft);
|
||||
$obj->setAutoStatus(Video::STATUS_DRAFT);
|
||||
}
|
||||
|
||||
TimeLogEnd(__FILE__, __LINE__);
|
||||
|
@ -286,7 +286,7 @@ $obj->infoObj = json_encode($infoObj);
|
|||
$obj->videos_id = intval($resp);
|
||||
$obj->video = Video::getVideoLight($obj->videos_id, true);
|
||||
$obj->isNewVideo = $isNewVideo;
|
||||
if ($obj->video['status'] == Video::$statusActive) {
|
||||
if ($obj->video['status'] == Video::STATUS_ACTIVE) {
|
||||
$rowsPath[] = array('line' => __LINE__, 'ElapsedTime' => getElapsedTime());
|
||||
_error_log('clearFirstPageCache start');
|
||||
$obj->clearFirstPageCache = clearFirstPageCache();
|
||||
|
|
|
@ -45,7 +45,7 @@ TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
|
|||
foreach ($videos as $key => $value) {
|
||||
/*
|
||||
$video = new Video('', '', $value['id']);
|
||||
$video->setStatus(Video::$statusActive);
|
||||
$video->setStatus(Video::STATUS_ACTIVE);
|
||||
Video::clearCache($value['id']);continue;
|
||||
*/
|
||||
unset($value['password'], $value['recoverPass']);
|
||||
|
|
|
@ -739,7 +739,7 @@ class AI extends PluginAbstract
|
|||
|
||||
$video = new Video('', '', $newVideos_id);
|
||||
if (file_exists($outputFile)) {
|
||||
$video->setAutoStatus(Video::$statusActive);
|
||||
$video->setAutoStatus(Video::STATUS_ACTIVE);
|
||||
AVideoPlugin::onUploadIsDone($newVideos_id);
|
||||
AVideoPlugin::afterNewVideo($newVideos_id);
|
||||
_error_log('AI:videoCut create file success ' . $outputFile);
|
||||
|
|
|
@ -35,7 +35,7 @@ foreach ($videos as $value) {
|
|||
//echo "sites_id is not empty {$value['sites_id']}" . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
if ($value['status'] !== Video::$statusActive) {
|
||||
if ($value['status'] !== Video::STATUS_ACTIVE) {
|
||||
$countStatusNotActive++;
|
||||
//echo "The video status is not active {$value['status']}" . PHP_EOL;
|
||||
continue;
|
||||
|
|
|
@ -27,7 +27,7 @@ $videos = sqlDAL::fetchAllAssoc($res);
|
|||
$total = count($videos);
|
||||
sqlDAL::close($res);
|
||||
foreach ($videos as $key => $value) {
|
||||
if ($value['status'] === Video::$statusActive) {
|
||||
if ($value['status'] === Video::STATUS_ACTIVE) {
|
||||
if (empty($value['sites_id'])) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ foreach ($videos as $key => $value) {
|
|||
$videos_id = $value['id'];
|
||||
$filename = $value['filename'];
|
||||
|
||||
if ($value['status'] === Video::$statusActive) {
|
||||
if ($value['status'] === Video::STATUS_ACTIVE) {
|
||||
echo "[videos_id: {$videos_id}] Processing '{$filename}'" . PHP_EOL;
|
||||
|
||||
if (empty($value['sites_id'])) {
|
||||
|
|
|
@ -35,7 +35,7 @@ foreach ($videos as $value) {
|
|||
ob_flush();
|
||||
continue;
|
||||
}
|
||||
if ($value['status'] !== Video::$statusActive) {
|
||||
if ($value['status'] !== Video::STATUS_ACTIVE) {
|
||||
$countStatusNotActive++;
|
||||
echo "The video status is not active {$value['status']}" . PHP_EOL;
|
||||
ob_flush();
|
||||
|
|
|
@ -42,7 +42,7 @@ foreach ($videos as $value) {
|
|||
//CDNStorage::createDummyFiles($value['id']);
|
||||
continue;
|
||||
}
|
||||
if ($value['status'] !== Video::$statusActive) {
|
||||
if ($value['status'] !== Video::STATUS_ACTIVE) {
|
||||
$countStatusNotActive++;
|
||||
//echo "The video status is not active {$value['status']}" . PHP_EOL;
|
||||
continue;
|
||||
|
|
|
@ -41,12 +41,12 @@ $videos_dir = getVideosDir();
|
|||
$rows = [];
|
||||
|
||||
$transferStatus = [];
|
||||
$transferStatus[] = Video::$statusActive;
|
||||
$transferStatus[] = Video::$statusFansOnly;
|
||||
$transferStatus[] = Video::$statusScheduledReleaseDate;
|
||||
$transferStatus[] = Video::STATUS_ACTIVE;
|
||||
$transferStatus[] = Video::STATUS_FANS_ONLY;
|
||||
$transferStatus[] = Video::STATUS_SCHEDULED_RELEASE_DATE;
|
||||
if($alsoMoveUnlisted){
|
||||
$transferStatus[] = Video::$statusUnlisted;
|
||||
$transferStatus[] = Video::$statusUnlistedButSearchable;
|
||||
$transferStatus[] = Video::STATUS_UNLISTED;
|
||||
$transferStatus[] = Video::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||
}
|
||||
|
||||
$statusSkipped = array();
|
||||
|
|
|
@ -259,11 +259,11 @@ class CustomizeAdvanced extends PluginAbstract {
|
|||
$dbObject = PluginAbstract::getObjectDataFromDatabase($this->getUUID());
|
||||
|
||||
if (!empty($dbObject->makeVideosInactiveAfterEncode)) {
|
||||
$o->value = Video::$statusInactive;
|
||||
$o->value = Video::STATUS_INACTIVE;
|
||||
} elseif (!empty($dbObject->makeVideosUnlistedAfterEncode)) {
|
||||
$o->value = Video::$statusUnlisted;
|
||||
$o->value = Video::STATUS_UNLISTED;
|
||||
}else{
|
||||
$o->value = Video::$statusActive;
|
||||
$o->value = Video::STATUS_ACTIVE;
|
||||
}
|
||||
$obj->defaultVideoStatus = $o;
|
||||
self::addDataObjectHelper('defaultVideoStatus', 'Default video status', 'When you submit a video that will be the default status');
|
||||
|
@ -840,11 +840,11 @@ Disallow: *action=tagsearch*
|
|||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
$transferStatus = [];
|
||||
$transferStatus[] = Video::$statusActive;
|
||||
$transferStatus[] = Video::$statusFansOnly;
|
||||
$transferStatus[] = Video::$statusScheduledReleaseDate;
|
||||
$transferStatus[] = Video::$statusUnlisted;
|
||||
$transferStatus[] = Video::$statusUnlistedButSearchable;
|
||||
$transferStatus[] = Video::STATUS_ACTIVE;
|
||||
$transferStatus[] = Video::STATUS_FANS_ONLY;
|
||||
$transferStatus[] = Video::STATUS_SCHEDULED_RELEASE_DATE;
|
||||
$transferStatus[] = Video::STATUS_UNLISTED;
|
||||
$transferStatus[] = Video::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $key => $row) {
|
||||
|
|
|
@ -100,7 +100,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
$video->setVideo_password($_REQUEST['video_password']);
|
||||
}
|
||||
if ($type == "image") {
|
||||
$video->setStatus(Video::$statusActive);
|
||||
$video->setStatus(Video::STATUS_ACTIVE);
|
||||
make_path($paths['path']);
|
||||
$file = "{$paths['path']}{$paths['filename']}.{$extension}";
|
||||
if (!move_uploaded_file($_FILES['upl']['tmp_name'], $file)) {
|
||||
|
@ -112,7 +112,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
$object->msg = "your image was posted";
|
||||
$object->videos_id = $video->save();
|
||||
} else {
|
||||
$video->setStatus(Video::$statusEncoding);
|
||||
$video->setStatus(Video::STATUS_ENCODING);
|
||||
|
||||
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 . ")";
|
||||
|
|
|
@ -42,7 +42,7 @@ $videos_id = intval(@$_REQUEST['videos_id']);
|
|||
$_GET['rowCount'] = $_REQUEST['rowCount'] = 500;
|
||||
$videos = Video::getAllActiveEPGs();
|
||||
foreach ($videos as $video) {
|
||||
if ($video['status'] !== Video::$statusActive || !isValidURL($video['epg_link'])) {
|
||||
if ($video['status'] !== Video::STATUS_ACTIVE || !isValidURL($video['epg_link'])) {
|
||||
continue;
|
||||
}
|
||||
//if($video['id']=='3847'){ var_dump($video['status']);exit;}
|
||||
|
|
|
@ -411,7 +411,7 @@ class Scheduler extends PluginAbstract
|
|||
$e->setExecuted($videos_id);
|
||||
}
|
||||
|
||||
//$status = $video->setStatus(Video::$statusActive);
|
||||
//$status = $video->setStatus(Video::STATUS_ACTIVE);
|
||||
$status = $video->setStatus($advancedCustom->defaultVideoStatus->value);
|
||||
|
||||
return $status;
|
||||
|
@ -456,11 +456,11 @@ class Scheduler extends PluginAbstract
|
|||
$video = new Video('', '', $videos_id);
|
||||
if ($releaseTime > time()) {
|
||||
$releaseDateTime = date('Y-m-d H:i:s', $releaseTime);
|
||||
$video->setStatus(Video::$statusScheduledReleaseDate);
|
||||
$video->setStatus(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||
self::setReleaseDateTime($videos_id, $releaseDateTime, $releaseTime);
|
||||
self::addVideoToRelease($releaseDateTime, $releaseTime, $videos_id);
|
||||
return true;
|
||||
} else if ($video->getStatus() == Video::$statusScheduledReleaseDate) {
|
||||
} else if ($video->getStatus() == Video::STATUS_SCHEDULED_RELEASE_DATE) {
|
||||
self::releaseVideosNow($videos_id);
|
||||
}
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ class Scheduler extends PluginAbstract
|
|||
|
||||
function executeEveryMinute()
|
||||
{
|
||||
$rows = Video::getAllVideosLight(Video::$statusScheduledReleaseDate);
|
||||
$rows = Video::getAllVideosLight(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||
foreach ($rows as $key => $value) {
|
||||
$releaseDate = self::getReleaseDateTime($value['id']);
|
||||
if (empty($releaseDate) || strtotime($releaseDate) <= time()) {
|
||||
|
|
|
@ -458,10 +458,10 @@ if (empty($advancedCustom)) {
|
|||
$statusSearchFilter = array();
|
||||
}
|
||||
if (AVideoPlugin::isEnabled('FansSubscriptions')) {
|
||||
$statusSearchFilter[] = Video::$statusFansOnly;
|
||||
$statusSearchFilter[] = Video::STATUS_FANS_ONLY;
|
||||
}
|
||||
if (AVideoPlugin::isEnabled('SendRecordedToEncoder')) {
|
||||
$statusSearchFilter[] = Video::$statusRecording;
|
||||
$statusSearchFilter[] = Video::STATUS_RECORDING;
|
||||
}
|
||||
foreach (Video::$statusDesc as $key => $value) {
|
||||
if (!in_array($key, $statusSearchFilter)) {
|
||||
|
@ -1277,7 +1277,7 @@ if (empty($advancedCustom->disableHTMLDescription)) {
|
|||
$('#videoStartSeconds').val('00:00:00');
|
||||
$('#videoSkipIntroSecond').val('00:00:00');
|
||||
$('#inputVideoPassword').val("");
|
||||
$('#videoStatus').val('<?php echo Video::$statusDraft; ?>');
|
||||
$('#videoStatus').val('<?php echo Video::STATUS_DRAFT; ?>');
|
||||
$('#inputCleanTitle').val("");
|
||||
$('#created').val("");
|
||||
$('#inputDescription').val("");
|
||||
|
|
|
@ -46,7 +46,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
$filename = $video->getFilename();
|
||||
if ($video->getTitle() === "Video automatically booked") {
|
||||
$video->setTitle($title);
|
||||
$video->setStatus(Video::$statusInactive);
|
||||
$video->setStatus(Video::STATUS_INACTIVE);
|
||||
}
|
||||
}
|
||||
//var_dump($videos_id, $_FILES['upl']['name'], $title, $video->getTitle());exit;
|
||||
|
@ -101,7 +101,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
$video->setType("zip", true);
|
||||
}
|
||||
|
||||
$video->setAutoStatus(Video::$statusInactive);
|
||||
$video->setAutoStatus(Video::STATUS_INACTIVE);
|
||||
|
||||
$id = $video->save();
|
||||
if ($id) {
|
||||
|
@ -139,7 +139,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
|||
|
||||
if (!empty($_FILES['upl']['tmp_name'])) {
|
||||
$obj->lines[] = __LINE__;
|
||||
$video->setAutoStatus(Video::$statusActive);
|
||||
$video->setAutoStatus(Video::STATUS_ACTIVE);
|
||||
AVideoPlugin::onUploadIsDone($obj->videos_id);
|
||||
AVideoPlugin::afterNewVideo($obj->videos_id);
|
||||
}
|
||||
|
|
|
@ -344,9 +344,9 @@ TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
|
|||
if (empty($video)) {
|
||||
if (!empty($_GET['v'])) {
|
||||
$vid = new Video('', '', $_GET['v']);
|
||||
if ($vid->getStatus() === Video::$statusBrokenMissingFiles) {
|
||||
if ($vid->getStatus() === Video::STATUS_BROKEN_MISSING_FILES) {
|
||||
if (!Video::isMediaFileMissing($vid->getFilename())) {
|
||||
$vid->setStatus(Video::$statusActive);
|
||||
$vid->setStatus(Video::STATUS_ACTIVE);
|
||||
$vid->save();
|
||||
_error_log('Missing files recovered ' . $_GET['v']);
|
||||
} else {
|
||||
|
@ -359,7 +359,7 @@ if (empty($video)) {
|
|||
}
|
||||
exit;
|
||||
}
|
||||
} else if ($vid->getStatus() === Video::$statusUnpublished) {
|
||||
} else if ($vid->getStatus() === Video::STATUS_UNPUBLISHED) {
|
||||
$msg = 'This video is currently unpublished. Please contact an administrator to review and approve it for publication. Thank you for your patience and understanding.';
|
||||
videoNotFound($msg);
|
||||
exit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue