1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Modernise array syntax.

This commit is contained in:
Caleb Mazalevskis 2023-02-15 23:22:37 +08:00
parent af0b9a239a
commit 3259b922b3
No known key found for this signature in database
GPG key ID: 082E6BC1046FAB95
49 changed files with 312 additions and 312 deletions

View file

@ -6,7 +6,7 @@ if (empty($config)) {
// filter some security here // filter some security here
if (!empty($_GET['lang'])) { if (!empty($_GET['lang'])) {
$_GET['lang'] = str_replace(array("'", '"', """, "'"), array('', '', '', ''), xss_esc($_GET['lang'])); $_GET['lang'] = str_replace(["'", '"', """, "'"], ['', '', '', ''], xss_esc($_GET['lang']));
} }
if (!empty($_GET['lang'])) { if (!empty($_GET['lang'])) {
@ -21,7 +21,7 @@ function __($str, $allowHTML = false) {
if (is_array($t) && function_exists('array_change_key_case') && !isCommandLineInterface()) { if (is_array($t) && function_exists('array_change_key_case') && !isCommandLineInterface()) {
$t_insensitive = array_change_key_case($t, CASE_LOWER); $t_insensitive = array_change_key_case($t, CASE_LOWER);
} else { } else {
$t_insensitive = array(); $t_insensitive = [];
} }
} }
$return = $str; $return = $str;
@ -35,7 +35,7 @@ function __($str, $allowHTML = false) {
if ($allowHTML) { if ($allowHTML) {
return $return; return $return;
} }
return str_replace(array("'", '"', "<", '>'), array('&apos;', '&quot;', '&lt;', '&gt;'), $return); return str_replace(["'", '"', "<", '>'], ['&apos;', '&quot;', '&lt;', '&gt;'], $return);
} }
function printJSString($str, $return = false) { function printJSString($str, $return = false) {
@ -55,7 +55,7 @@ function isRTL() {
function getAllFlags() { function getAllFlags() {
global $global; global $global;
$dir = "{$global['systemRootPath']}view/css/flag-icon-css-master/flags/4x3"; $dir = "{$global['systemRootPath']}view/css/flag-icon-css-master/flags/4x3";
$flags = array(); $flags = [];
if ($handle = opendir($dir)) { if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) { while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") { if ($entry != "." && $entry != "..") {
@ -76,7 +76,7 @@ function getAllFlags() {
function getEnabledLangs() { function getEnabledLangs() {
global $global; global $global;
$dir = "{$global['systemRootPath']}locale"; $dir = "{$global['systemRootPath']}locale";
$flags = array(); $flags = [];
if (empty($global['dont_show_us_flag'])) { if (empty($global['dont_show_us_flag'])) {
$flags[] = 'us'; $flags[] = 'us';
} }
@ -101,7 +101,7 @@ function textToLink($string, $targetBlank = false) {
} }
function br2nl($html) { function br2nl($html) {
$nl = preg_replace(array('#<br\s*/?>#i', '#<p\s*/?>#i', '#</p\s*>#i'), array("\n", "\n", ''), $html); $nl = preg_replace(['#<br\s*/?>#i', '#<p\s*/?>#i', '#</p\s*>#i'], ["\n", "\n", ''], $html);
return $nl; return $nl;
} }

View file

@ -25,7 +25,7 @@ if (isset($_GET['getLanguage'])) {
exit; exit;
} }
$vars = array(); $vars = [];
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
require_once '../objects/functions.php'; require_once '../objects/functions.php';

View file

@ -20,7 +20,7 @@ abstract class ObjectYPT implements ObjectInterface
public static function getSearchFieldsNames() public static function getSearchFieldsNames()
{ {
return array(); return [];
} }
public function load($id) public function load($id)
@ -291,7 +291,7 @@ abstract class ObjectYPT implements ObjectInterface
return false; return false;
} }
$formats = ''; $formats = '';
$values = array(); $values = [];
if (!empty($this->id)) { if (!empty($this->id)) {
$sql = "UPDATE " . static::getTableName() . " SET "; $sql = "UPDATE " . static::getTableName() . " SET ";
$fields = []; $fields = [];
@ -426,7 +426,7 @@ abstract class ObjectYPT implements ObjectInterface
static function ignoreTableSecurityCheck() static function ignoreTableSecurityCheck()
{ {
$ignoreArray = array( $ignoreArray = [
'vast_campaigns_logs', 'vast_campaigns_logs',
'videos', 'CachesInDB', 'videos', 'CachesInDB',
'plugins', 'plugins',
@ -438,7 +438,7 @@ abstract class ObjectYPT implements ObjectInterface
'wallet_log', 'wallet_log',
'live_restreams_logs', 'live_restreams_logs',
'clone_SitesAllowed' 'clone_SitesAllowed'
); ];
return in_array(static::getTableName(), $ignoreArray); return in_array(static::getTableName(), $ignoreArray);
} }

View file

@ -56,13 +56,13 @@ if (empty($_POST['sort']) && empty($_GET['sort'])) {
array_multisort($array_column, SORT_ASC, $categories); array_multisort($array_column, SORT_ASC, $categories);
} }
$json = array( $json = [
'current'=>getCurrentPage(), 'current'=>getCurrentPage(),
'rowCount'=>getRowCount(), 'rowCount'=>getRowCount(),
'total'=>$total, 'total'=>$total,
'rows'=>$categories, 'rows'=>$categories,
'onlyWithVideos'=>$onlyWithVideos, 'onlyWithVideos'=>$onlyWithVideos,
'sameUserGroupAsMe'=>$sameUserGroupAsMe 'sameUserGroupAsMe'=>$sameUserGroupAsMe
); ];
echo _json_encode($json); echo _json_encode($json);

View file

@ -402,7 +402,7 @@ class Category {
_error_log('getAllCategories getUserGroups'); _error_log('getAllCategories getUserGroups');
$users_groups = UserGroups::getUserGroups($sameUserGroupAsMe); $users_groups = UserGroups::getUserGroups($sameUserGroupAsMe);
$users_groups_id = array(0); $users_groups_id = [0];
foreach ($users_groups as $value) { foreach ($users_groups as $value) {
$users_groups_id[] = $value['id']; $users_groups_id[] = $value['id'];
} }
@ -978,10 +978,10 @@ class Category {
public static function setUsergroups($categories_id, $usergroups_ids_array) { public static function setUsergroups($categories_id, $usergroups_ids_array) {
if (!is_array($usergroups_ids_array)) { if (!is_array($usergroups_ids_array)) {
$usergroups_ids_array = array($usergroups_ids_array); $usergroups_ids_array = [$usergroups_ids_array];
} }
Categories_has_users_groups::deleteAllFromCategory($categories_id); Categories_has_users_groups::deleteAllFromCategory($categories_id);
$return = array(); $return = [];
foreach ($usergroups_ids_array as $users_groups_id) { foreach ($usergroups_ids_array as $users_groups_id) {
$id = Categories_has_users_groups::saveUsergroup($categories_id, $users_groups_id); $id = Categories_has_users_groups::saveUsergroup($categories_id, $users_groups_id);
$return[] = $id; $return[] = $id;

View file

@ -14,7 +14,7 @@ setRowCount(10);
//setDefaultSort('id', 'DESC'); //setDefaultSort('id', 'DESC');
if(empty($_REQUEST['id'])){ if(empty($_REQUEST['id'])){
if(empty($_POST['sort'])){ if(empty($_POST['sort'])){
$_POST['sort'] = array(); $_POST['sort'] = [];
$_POST['sort']['pin'] = 'DESC'; $_POST['sort']['pin'] = 'DESC';
//$_POST['sort']['comments_id_pai'] = 'IS NULL DESC'; //$_POST['sort']['comments_id_pai'] = 'IS NULL DESC';
//$_POST['sort']['comments_id_pai'] = 'DESC'; //$_POST['sort']['comments_id_pai'] = 'DESC';
@ -25,10 +25,10 @@ if(empty($_REQUEST['id'])){
}else{ }else{
$comment = Comment::getComment($_REQUEST['id']); $comment = Comment::getComment($_REQUEST['id']);
if(!empty($comment)){ if(!empty($comment)){
$comments = array($comment); $comments = [$comment];
$total = 1; $total = 1;
}else{ }else{
$comments = array(); $comments = [];
$total = 0; $total = 0;
} }
} }

View file

@ -7,7 +7,7 @@ if ($startActive) {
if ($invert) { if ($invert) {
if(preg_match('/style=["\']/', $parameters)){ if(preg_match('/style=["\']/', $parameters)){
$parameters = str_replace(array('style="','style=\''), array('style="transform: scale(-1,1);', 'style=\'transform: scale(-1,1);'), $parameters ); $parameters = str_replace(['style="','style=\''], ['style="transform: scale(-1,1);', 'style=\'transform: scale(-1,1);'], $parameters );
}else{ }else{
$parameters .= 'style="transform: scale(-1,1);"'; $parameters .= 'style="transform: scale(-1,1);"';
} }

View file

@ -8,7 +8,7 @@ $AVideoStorage_UA = "AVideoStorage";
$mysql_connect_was_closed = 1; $mysql_connect_was_closed = 1;
if (!isset($global) || !is_array($global)) { if (!isset($global) || !is_array($global)) {
$global = array(); $global = [];
} }
/** /**
@ -427,7 +427,7 @@ function safeString($text, $strict = false, $try=0){
} }
$originalText = $text; $originalText = $text;
$text = strip_tags($text); $text = strip_tags($text);
$text = str_replace(array('&amp;', '&lt;', '&gt;'), array('', '', ''), $text); $text = str_replace(['&amp;', '&lt;', '&gt;'], ['', '', ''], $text);
$text = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '', $text); $text = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '', $text);
$text = preg_replace('/(&#x*[0-9A-F]+);*/iu', '', $text); $text = preg_replace('/(&#x*[0-9A-F]+);*/iu', '', $text);
$text = html_entity_decode($text, ENT_COMPAT, 'UTF-8'); $text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
@ -1559,7 +1559,7 @@ function getVideosURL_V2($fileName, $recreateCache = false)
$pdf = $paths['path'] . "{$cleanfilename}.pdf"; $pdf = $paths['path'] . "{$cleanfilename}.pdf";
$mp3 = $paths['path'] . "{$cleanfilename}.mp3"; $mp3 = $paths['path'] . "{$cleanfilename}.mp3";
$extraFiles = array(); $extraFiles = [];
if (file_exists($pdf)) { if (file_exists($pdf)) {
$extraFilesPDF = getVideosURLPDF($fileName); $extraFilesPDF = getVideosURLPDF($fileName);
if($isAVideo){ if($isAVideo){
@ -1688,7 +1688,7 @@ function getSources($fileName, $returnArray = false, $try = 0)
} else { } else {
_error_log("getSources($fileName) File not found " . json_encode($video)); _error_log("getSources($fileName) File not found " . json_encode($video));
if (empty($sources)) { if (empty($sources)) {
$sources = array(); $sources = [];
} }
$obj = new stdClass(); $obj = new stdClass();
$obj->type = "video/mp4"; $obj->type = "video/mp4";
@ -1785,7 +1785,7 @@ function getImageFormat($file)
} }
} }
return array('format' => $format, 'extension' => $extension); return ['format' => $format, 'extension' => $extension];
} }
function im_resize($file_src, $file_dest, $wd, $hd, $q = 80) function im_resize($file_src, $file_dest, $wd, $hd, $q = 80)
@ -1955,7 +1955,7 @@ function scaleUpAndMantainAspectRatioFinalSizes($new_w, $old_w, $new_h, $old_h)
$thumb_w = $old_w * $aspectRatio2; $thumb_w = $old_w * $aspectRatio2;
$thumb_h = $old_h * $aspectRatio2; $thumb_h = $old_h * $aspectRatio2;
} }
return array('w' => $thumb_w, 'h' => $thumb_h); return ['w' => $thumb_w, 'h' => $thumb_h];
} }
function scaleUpImage($file_src, $file_dest, $wd, $hd) function scaleUpImage($file_src, $file_dest, $wd, $hd)
@ -3745,7 +3745,7 @@ function siteMap()
$_POST['sort']['created'] = "DESC"; $_POST['sort']['created'] = "DESC";
$rows = Video::getAllVideosLight(!empty($advancedCustom->showPrivateVideosOnSitemap) ? "viewableNotUnlisted" : "publicOnly"); $rows = Video::getAllVideosLight(!empty($advancedCustom->showPrivateVideosOnSitemap) ? "viewableNotUnlisted" : "publicOnly");
if (empty($rows) || !is_array($rows)) { if (empty($rows) || !is_array($rows)) {
$rows = array(); $rows = [];
} }
_error_log("siteMap: getAllVideos " . count($rows)); _error_log("siteMap: getAllVideos " . count($rows));
foreach ($rows as $video) { foreach ($rows as $video) {
@ -4119,7 +4119,7 @@ function convertImageIfNotExists($source, $destination, $width, $height, $scaleU
_error_log("convertImageIfNotExists: source image is empty"); _error_log("convertImageIfNotExists: source image is empty");
return false; return false;
} }
$source = str_replace(array('_thumbsSmallV2'), array(''), $source); $source = str_replace(['_thumbsSmallV2'], [''], $source);
if (!file_exists($source)) { if (!file_exists($source)) {
_error_log("convertImageIfNotExists: source does not exists {$source}"); _error_log("convertImageIfNotExists: source does not exists {$source}");
return false; return false;
@ -4640,11 +4640,11 @@ function blackListRegenerateSession()
if (!requestComesFromSafePlace()) { if (!requestComesFromSafePlace()) {
return false; return false;
} }
$list = array( $list = [
'objects/getCaptcha.php', 'objects/getCaptcha.php',
'objects/userCreate.json.php', 'objects/userCreate.json.php',
'objects/videoAddViewCount.json.php', 'objects/videoAddViewCount.json.php',
); ];
foreach ($list as $needle) { foreach ($list as $needle) {
if (str_ends_with($_SERVER['SCRIPT_NAME'], $needle)) { if (str_ends_with($_SERVER['SCRIPT_NAME'], $needle)) {
return true; return true;
@ -4657,7 +4657,7 @@ function _mysql_connect($persistent = false, $try = 0)
{ {
global $global, $mysqlHost, $mysqlUser, $mysqlPass, $mysqlDatabase, $mysqlPort, $mysql_connect_was_closed; global $global, $mysqlHost, $mysqlUser, $mysqlPass, $mysqlDatabase, $mysqlPort, $mysql_connect_was_closed;
$checkValues = array('mysqlHost', 'mysqlUser', 'mysqlPass', 'mysqlDatabase'); $checkValues = ['mysqlHost', 'mysqlUser', 'mysqlPass', 'mysqlDatabase'];
foreach ($checkValues as $value) { foreach ($checkValues as $value) {
if (!isset($$value)) { if (!isset($$value)) {
@ -5623,14 +5623,14 @@ function getPlayListData()
{ {
global $playListData; global $playListData;
if (empty($playListData)) { if (empty($playListData)) {
$playListData = array(); $playListData = [];
} }
return $playListData; return $playListData;
} }
function getPlayListDataVideosId() function getPlayListDataVideosId()
{ {
$playListData_videos_id = array(); $playListData_videos_id = [];
foreach (getPlayListData() as $value) { foreach (getPlayListData() as $value) {
$playListData_videos_id[] = $value->getVideos_id(); $playListData_videos_id[] = $value->getVideos_id();
} }
@ -5794,7 +5794,7 @@ function isValidEmail($email) {
return false; return false;
} }
if(!isset($_email_hosts_checked)){ if(!isset($_email_hosts_checked)){
$_email_hosts_checked = array(); $_email_hosts_checked = [];
} }
//Get host name from email and check if it is valid //Get host name from email and check if it is valid
@ -5846,7 +5846,7 @@ function isValidURLOrPath($str, $insideCacheOrTmpDirOnly = true) {
return false; return false;
} }
$pathsToCheck = array($absolutePath, $str); $pathsToCheck = [$absolutePath, $str];
foreach ($pathsToCheck as $value) { foreach ($pathsToCheck as $value) {
if ( if (
@ -6578,7 +6578,7 @@ function _json_encode($object)
} }
$json = json_encode($object); $json = json_encode($object);
$errors = array(); $errors = [];
if (empty($json) && json_last_error()) { if (empty($json) && json_last_error()) {
if (preg_match('/Malformed UTF-8 characters/i', json_last_error_msg())) { if (preg_match('/Malformed UTF-8 characters/i', json_last_error_msg())) {
$json = _json_encode_utf8($object); $json = _json_encode_utf8($object);
@ -6816,15 +6816,15 @@ function getCaptcha($uid = "", $forceCaptcha = false)
if (empty($uid)) { if (empty($uid)) {
$uid = "capcha_" . uniqid(); $uid = "capcha_" . uniqid();
} }
$contents = getIncludeFileContent($global['systemRootPath'] . 'objects/functiongetCaptcha.php', array('uid' => $uid, 'forceCaptcha' => $forceCaptcha)); $contents = getIncludeFileContent($global['systemRootPath'] . 'objects/functiongetCaptcha.php', ['uid' => $uid, 'forceCaptcha' => $forceCaptcha]);
$parts = explode('<script>', $contents); $parts = explode('<script>', $contents);
return array( return [
'content' => $contents, 'content' => $contents,
'btnReloadCapcha' => "$('#btnReload{$uid}').trigger('click');", 'btnReloadCapcha' => "$('#btnReload{$uid}').trigger('click');",
'captchaText' => "$('#{$uid}Text').val()", 'captchaText' => "$('#{$uid}Text').val()",
'html' => $parts[0], 'html' => $parts[0],
'script' => str_replace('</script>', '', $parts[1]) 'script' => str_replace('</script>', '', $parts[1])
); ];
} }
function getSharePopupButton($videos_id, $url = "", $title = "") function getSharePopupButton($videos_id, $url = "", $title = "")
@ -7223,11 +7223,11 @@ function showAlertMessage()
{ {
$check = ['error', 'msg', 'success', 'toast']; $check = ['error', 'msg', 'success', 'toast'];
$newAlerts = array(); $newAlerts = [];
if (!empty($_SESSION['YPTalertMessage'])) { if (!empty($_SESSION['YPTalertMessage'])) {
foreach ($check as $value) { foreach ($check as $value) {
$newAlerts[$value] = array(); $newAlerts[$value] = [];
} }
foreach ($_SESSION['YPTalertMessage'] as $value) { foreach ($_SESSION['YPTalertMessage'] as $value) {
if (!empty($value[0])) { if (!empty($value[0])) {
@ -7569,13 +7569,13 @@ function getSocialModal($videos_id, $url = "", $title = "")
$filePath = $global['systemRootPath'] . 'objects/functionGetSocialModal.php'; $filePath = $global['systemRootPath'] . 'objects/functionGetSocialModal.php';
$contents = getIncludeFileContent( $contents = getIncludeFileContent(
$filePath, $filePath,
array( [
'videos_id' => $videos_id, 'videos_id' => $videos_id,
'url' => $url, 'url' => $url,
'title' => $title, 'title' => $title,
'video' => $video, 'video' => $video,
'sharingUid' => $sharingUid 'sharingUid' => $sharingUid
) ]
); );
return ['html' => $contents, 'id' => $sharingUid]; return ['html' => $contents, 'id' => $sharingUid];
} }
@ -7623,7 +7623,7 @@ function getCroppie(
$boundaryHeight = $viewportHeight + $boundary; $boundaryHeight = $viewportHeight + $boundary;
$uid = uniqid(); $uid = uniqid();
$varsArray = array( $varsArray = [
'buttonTitle' => $buttonTitle, 'buttonTitle' => $buttonTitle,
'callBackJSFunction' => $callBackJSFunction, 'callBackJSFunction' => $callBackJSFunction,
'resultWidth' => $resultWidth, 'resultWidth' => $resultWidth,
@ -7636,7 +7636,7 @@ function getCroppie(
'boundaryWidth' => $boundaryWidth, 'boundaryWidth' => $boundaryWidth,
'boundaryHeight' => $boundaryHeight, 'boundaryHeight' => $boundaryHeight,
'uid' => $uid, 'uid' => $uid,
); ];
$contents = getIncludeFileContent($global['systemRootPath'] . 'objects/functionCroppie.php', $varsArray); $contents = getIncludeFileContent($global['systemRootPath'] . 'objects/functionCroppie.php', $varsArray);
@ -7710,7 +7710,7 @@ function convertVideoToMP3FileIfNotExists($videos_id)
if (empty($video)) { if (empty($video)) {
return false; return false;
} }
$types = array('video', 'audio'); $types = ['video', 'audio'];
if (!in_array($video['type'], $types)) { if (!in_array($video['type'], $types)) {
return false; return false;
} }
@ -7914,7 +7914,7 @@ function canFullScreen()
function getTinyMCE($id, $simpleMode = false) function getTinyMCE($id, $simpleMode = false)
{ {
global $global; global $global;
$contents = getIncludeFileContent($global['systemRootPath'] . 'objects/functionsGetTinyMCE.php', array('id' => $id, 'simpleMode' => $simpleMode)); $contents = getIncludeFileContent($global['systemRootPath'] . 'objects/functionsGetTinyMCE.php', ['id' => $id, 'simpleMode' => $simpleMode]);
return $contents; return $contents;
} }
@ -8258,7 +8258,7 @@ function deleteStatsNotifications()
function getLiveVideosFromUsers_id($users_id) function getLiveVideosFromUsers_id($users_id)
{ {
$videos = array(); $videos = [];
if (!empty($users_id)) { if (!empty($users_id)) {
$stats = getStatsNotifications(); $stats = getStatsNotifications();
foreach ($stats["applications"] as $key => $value) { foreach ($stats["applications"] as $key => $value) {
@ -8295,7 +8295,7 @@ function getLiveVideosObject($application)
$user = new User($application['users_id']); $user = new User($application['users_id']);
$cat = new Category($application['categories_id']); $cat = new Category($application['categories_id']);
$video = array( $video = [
'id' => intval(rand(999999, 9999999)), 'id' => intval(rand(999999, 9999999)),
'isLive' => 1, 'isLive' => 1,
'categories_id' => $application['categories_id'], 'categories_id' => $application['categories_id'],
@ -8324,7 +8324,7 @@ function getLiveVideosObject($application)
'galleryCallback' => @$application['callback'], 'galleryCallback' => @$application['callback'],
'stats' => $application, 'stats' => $application,
'embedlink' => addQueryStringParameter($application['href'], 'embed', 1), 'embedlink' => addQueryStringParameter($application['href'], 'embed', 1),
'images' => array( 'images' => [
"poster" => @$application['poster'], "poster" => @$application['poster'],
"posterPortrait" => @$application['poster'], "posterPortrait" => @$application['poster'],
"posterPortraitPath" => @$application['poster'], "posterPortraitPath" => @$application['poster'],
@ -8339,16 +8339,16 @@ function getLiveVideosObject($application)
"posterLandscapePath" => @$application['poster'], "posterLandscapePath" => @$application['poster'],
"posterLandscapeThumbs" => @$application['poster'], "posterLandscapeThumbs" => @$application['poster'],
"posterLandscapeThumbsSmall" => @$application['poster'] "posterLandscapeThumbsSmall" => @$application['poster']
), ],
'videos' => array( 'videos' => [
"m3u8" => array( "m3u8" => [
"url" => $m3u8, "url" => $m3u8,
"url_noCDN" => $m3u8, "url_noCDN" => $m3u8,
"type" => "video", "type" => "video",
"format" => "m3u8", "format" => "m3u8",
"resolution" => "auto" "resolution" => "auto"
) ]
), ],
'Poster' => @$application['poster'], 'Poster' => @$application['poster'],
'Thumbnail' => @$application['poster'], 'Thumbnail' => @$application['poster'],
'createdHumanTiming' => 'Live', 'createdHumanTiming' => 'Live',
@ -8371,36 +8371,36 @@ function getLiveVideosObject($application)
"category_description" => $cat->getDescription(), "category_description" => $cat->getDescription(),
"videoCreation" => date('Y-m-d H:i:s'), "videoCreation" => date('Y-m-d H:i:s'),
"videoModified" => date('Y-m-d H:i:s'), "videoModified" => date('Y-m-d H:i:s'),
"groups" => array(), "groups" => [],
"tags" => array(), "tags" => [],
"videoTags" => [ "videoTags" => [
array( [
"type_name" => "Starring", "type_name" => "Starring",
"name" => "" "name" => ""
), ],
array( [
"type_name" => "Language", "type_name" => "Language",
"name" => "English" "name" => "English"
), ],
array( [
"type_name" => "Release_Date", "type_name" => "Release_Date",
"name" => date('Y') "name" => date('Y')
), ],
array( [
"type_name" => "Running_Time", "type_name" => "Running_Time",
"name" => "" "name" => ""
), ],
array( [
"type_name" => "Genres", "type_name" => "Genres",
"name" => $cat->getName() "name" => $cat->getName()
) ]
], ],
"videoTagsObject" => array('Starring' => array(), 'Language' => array("English"), 'Release_Date' => array(date('Y')), 'Running_Time' => array('0'), 'Genres' => array($cat->getName())), "videoTagsObject" => ['Starring' => [], 'Language' => ["English"], 'Release_Date' => [date('Y')], 'Running_Time' => ['0'], 'Genres' => [$cat->getName()]],
'descriptionHTML' => '', 'descriptionHTML' => '',
"progress" => array( "progress" => [
"percent" => 0, "percent" => 0,
"lastVideoTime" => 0 "lastVideoTime" => 0
), ],
"isFavorite" => null, "isFavorite" => null,
"isWatchLater" => null, "isWatchLater" => null,
"favoriteId" => null, "favoriteId" => null,
@ -8425,7 +8425,7 @@ function getLiveVideosObject($application)
"wwbnChannelURL" => $user->getChannelLink(), "wwbnChannelURL" => $user->getChannelLink(),
"wwbnImgChannel" => $user->getPhoto(), "wwbnImgChannel" => $user->getPhoto(),
"wwbnType" => "live", "wwbnType" => "live",
); ];
//var_dump($videos);exit; //var_dump($videos);exit;
return $video; return $video;
} }
@ -8433,7 +8433,7 @@ function getLiveVideosObject($application)
function getLiveVideosFromCategory($categories_id) function getLiveVideosFromCategory($categories_id)
{ {
$stats = getStatsNotifications(); $stats = getStatsNotifications();
$videos = array(); $videos = [];
if (!empty($categories_id)) { if (!empty($categories_id)) {
foreach ($stats["applications"] as $key => $value) { foreach ($stats["applications"] as $key => $value) {
if (empty($value['categories_id']) || $categories_id != $value['categories_id']) { if (empty($value['categories_id']) || $categories_id != $value['categories_id']) {
@ -8511,7 +8511,7 @@ function getStatsNotifications($force_recreate = false, $listItIfIsAdminOrOwner
$count++; $count++;
} }
if (!empty($json['applications'])) { if (!empty($json['applications'])) {
$applications = array(); $applications = [];
foreach ($json['applications'] as $key => $value) { foreach ($json['applications'] as $key => $value) {
// remove duplicated // remove duplicated
if (!is_array($value) || empty($value['href']) || in_array($value['href'], $applications)) { if (!is_array($value) || empty($value['href']) || in_array($value['href'], $applications)) {
@ -8534,7 +8534,7 @@ function getStatsNotifications($force_recreate = false, $listItIfIsAdminOrOwner
} }
if (empty($json['applications'])) { if (empty($json['applications'])) {
$json['applications'] = array(); $json['applications'] = [];
} }
foreach ($json['applications'] as $key => $value) { foreach ($json['applications'] as $key => $value) {
@ -8648,7 +8648,7 @@ function getLiveUsersLabelHTML($viewsClass = "label label-default", $counterClas
$_getLiveUsersLabelHTML = 1; $_getLiveUsersLabelHTML = 1;
$htmlMediaTag = ''; $htmlMediaTag = '';
$htmlMediaTag .= '<div style="z-index: 999; position: absolute; top:5px; left: 5px; opacity: 0.8; filter: alpha(opacity=80);" class="liveUsersLabel">'; $htmlMediaTag .= '<div style="z-index: 999; position: absolute; top:5px; left: 5px; opacity: 0.8; filter: alpha(opacity=80);" class="liveUsersLabel">';
$htmlMediaTag .= getIncludeFileContent($global['systemRootPath'] . 'plugin/Live/view/onlineLabel.php', array('viewsClass' => $viewsClass, 'counterClass' => $counterClass)); $htmlMediaTag .= getIncludeFileContent($global['systemRootPath'] . 'plugin/Live/view/onlineLabel.php', ['viewsClass' => $viewsClass, 'counterClass' => $counterClass]);
$htmlMediaTag .= getLiveUsersLabel($viewsClass, $counterClass); $htmlMediaTag .= getLiveUsersLabel($viewsClass, $counterClass);
$htmlMediaTag .= '</div>'; $htmlMediaTag .= '</div>';
return $htmlMediaTag; return $htmlMediaTag;
@ -9020,7 +9020,7 @@ function getHashMethodsAndInfo()
$iv = substr($saltMD5, 0, $ivlen); $iv = substr($saltMD5, 0, $ivlen);
$key = substr($saltMD5, 0, $keylen); $key = substr($saltMD5, 0, $keylen);
$_getHashMethod = array('cipher_algo' => $cipher_algo, 'iv' => $iv, 'key' => $key, 'base' => $base, 'salt' => $global['salt']); $_getHashMethod = ['cipher_algo' => $cipher_algo, 'iv' => $iv, 'key' => $key, 'base' => $base, 'salt' => $global['salt']];
} }
return $_getHashMethod; return $_getHashMethod;
} }
@ -9049,7 +9049,7 @@ function idToHash($id)
$hash = preg_replace('/(=+)$/', '', $hash); $hash = preg_replace('/(=+)$/', '', $hash);
$hash = str_replace(['/', '+', '='], ['_', '-', '.'], $hash); $hash = str_replace(['/', '+', '='], ['_', '-', '.'], $hash);
if (empty($hash)) { if (empty($hash)) {
_error_log('idToHash error: ' . openssl_error_string() . PHP_EOL . json_encode(array('id' => $id, 'cipher_algo' => $cipher_algo, 'base' => $base, 'idConverted' => $idConverted, 'hash' => $hash, 'iv' => $iv))); _error_log('idToHash error: ' . openssl_error_string() . PHP_EOL . json_encode(['id' => $id, 'cipher_algo' => $cipher_algo, 'base' => $base, 'idConverted' => $idConverted, 'hash' => $hash, 'iv' => $iv]));
if (!empty($global['useLongHash'])) { if (!empty($global['useLongHash'])) {
$global['useLongHash'] = 0; $global['useLongHash'] = 0;
return idToHash($id); return idToHash($id);
@ -9663,7 +9663,7 @@ function isHTMLEmpty($html_string)
{ {
$html_string_no_tags = strip_specific_tags($html_string, ['br', 'p', 'span', 'div']); $html_string_no_tags = strip_specific_tags($html_string, ['br', 'p', 'span', 'div']);
//var_dump($html_string_no_tags, $html_string); //var_dump($html_string_no_tags, $html_string);
return empty(trim(str_replace(array("\r", "\n"), array('', ''), $html_string_no_tags))); return empty(trim(str_replace(["\r", "\n"], ['', ''], $html_string_no_tags)));
} }
function emptyHTML($html_string) function emptyHTML($html_string)
@ -9766,7 +9766,7 @@ function isDummyFile($filePath)
global $_isDummyFile; global $_isDummyFile;
if (!isset($_isDummyFile)) { if (!isset($_isDummyFile)) {
$_isDummyFile = array(); $_isDummyFile = [];
} }
if (isset($_isDummyFile[$filePath])) { if (isset($_isDummyFile[$filePath])) {
return $_isDummyFile[$filePath]; return $_isDummyFile[$filePath];
@ -9799,7 +9799,7 @@ function forbiddenPageIfCannotEmbed($videos_id)
if (!isAVideoMobileApp()) { if (!isAVideoMobileApp()) {
if (!isSameDomain(@$_SERVER['HTTP_REFERER'], $global['webSiteRootURL'])) { if (!isSameDomain(@$_SERVER['HTTP_REFERER'], $global['webSiteRootURL'])) {
if (!empty($advancedCustomUser->blockEmbedFromSharedVideos) && !CustomizeUser::canShareVideosFromVideo($videos_id)) { if (!empty($advancedCustomUser->blockEmbedFromSharedVideos) && !CustomizeUser::canShareVideosFromVideo($videos_id)) {
$reason = array(); $reason = [];
if (!empty($advancedCustomUser->blockEmbedFromSharedVideos)) { if (!empty($advancedCustomUser->blockEmbedFromSharedVideos)) {
error_log("forbiddenPageIfCannotEmbed: Embed is forbidden: \$advancedCustomUser->blockEmbedFromSharedVideos"); error_log("forbiddenPageIfCannotEmbed: Embed is forbidden: \$advancedCustomUser->blockEmbedFromSharedVideos");
$reason[] = __('Admin block video sharing'); $reason[] = __('Admin block video sharing');
@ -9825,9 +9825,9 @@ function getMediaSessionPosters($imagePath)
if (empty($imagePath) || !file_exists($imagePath)) { if (empty($imagePath) || !file_exists($imagePath)) {
return false; return false;
} }
$sizes = array(96, 128, 192, 256, 384, 512); $sizes = [96, 128, 192, 256, 384, 512];
$posters = array(); $posters = [];
foreach ($sizes as $value) { foreach ($sizes as $value) {
$destination = str_replace('.jpg', "_{$value}.jpg", $imagePath); $destination = str_replace('.jpg', "_{$value}.jpg", $imagePath);
@ -9836,7 +9836,7 @@ function getMediaSessionPosters($imagePath)
$convertedImage = convertImageIfNotExists($imagePath, $destination, $value, $value); $convertedImage = convertImageIfNotExists($imagePath, $destination, $value, $value);
$relativePath = str_replace($global['systemRootPath'], '', $convertedImage); $relativePath = str_replace($global['systemRootPath'], '', $convertedImage);
$url = getURL($relativePath); $url = getURL($relativePath);
$posters[$value] = array('path' => $path, 'relativePath' => $relativePath, 'url' => $url); $posters[$value] = ['path' => $path, 'relativePath' => $relativePath, 'url' => $url];
} }
} }
return $posters; return $posters;
@ -9847,7 +9847,7 @@ function deleteMediaSessionPosters($imagePath)
if (empty($imagePath)) { if (empty($imagePath)) {
return false; return false;
} }
$sizes = array(96, 128, 192, 256, 384, 512); $sizes = [96, 128, 192, 256, 384, 512];
foreach ($sizes as $value) { foreach ($sizes as $value) {
$destination = str_replace('.jpg', "_{$value}.jpg", $imagePath); $destination = str_replace('.jpg', "_{$value}.jpg", $imagePath);
@ -9919,7 +9919,7 @@ function _ob_get_clean()
return $content; return $content;
} }
function getIncludeFileContent($filePath, $varsArray = array()) function getIncludeFileContent($filePath, $varsArray = [])
{ {
global $global, $config; global $global, $config;
if (!empty($global['getIncludeFileContent'])) { if (!empty($global['getIncludeFileContent'])) {
@ -9929,7 +9929,7 @@ function getIncludeFileContent($filePath, $varsArray = array())
} }
} }
function getIncludeFileContentV1($filePath, $varsArray = array()) function getIncludeFileContentV1($filePath, $varsArray = [])
{ {
global $global, $config; global $global, $config;
foreach ($varsArray as $key => $value) { foreach ($varsArray as $key => $value) {
@ -9967,7 +9967,7 @@ function getIncludeFileContentV1($filePath, $varsArray = array())
return $return; return $return;
} }
function getIncludeFileContentV2($filePath, $varsArray = array()) function getIncludeFileContentV2($filePath, $varsArray = [])
{ {
global $global, $config; global $global, $config;
foreach ($varsArray as $key => $value) { foreach ($varsArray as $key => $value) {
@ -10074,7 +10074,7 @@ function getValidCrontabLines()
if (empty($validCrontabLines)) { if (empty($validCrontabLines)) {
$crontab = shell_exec('crontab -l'); $crontab = shell_exec('crontab -l');
$crontabLines = preg_split("/\r\n|\n|\r/", $crontab); $crontabLines = preg_split("/\r\n|\n|\r/", $crontab);
$_validCrontabLines = array(); $_validCrontabLines = [];
foreach ($crontabLines as $line) { foreach ($crontabLines as $line) {
$line = trim($line); $line = trim($line);
@ -10094,12 +10094,12 @@ function getValidCrontabLines()
function is_email($strOrArray) function is_email($strOrArray)
{ {
if (empty($strOrArray)) { if (empty($strOrArray)) {
return array(); return [];
} }
if (!is_array($strOrArray)) { if (!is_array($strOrArray)) {
$strOrArray = array($strOrArray); $strOrArray = [$strOrArray];
} }
$valid_emails = array(); $valid_emails = [];
foreach ($strOrArray as $email) { foreach ($strOrArray as $email) {
if (is_numeric($email)) { if (is_numeric($email)) {
$email = User::getEmailDb($email); $email = User::getEmailDb($email);
@ -10123,10 +10123,10 @@ function getHamburgerButton($id = '', $type = 0, $parameters = 'class="btn btn-d
{ {
global $global; global $global;
if ($type === 'x') { if ($type === 'x') {
$XOptions = array(1, 4, 6, 7, 8); $XOptions = [1, 4, 6, 7, 8];
$type = $XOptions[rand(0, 4)]; $type = $XOptions[rand(0, 4)];
} else if ($type === '<-') { } else if ($type === '<-') {
$XOptions = array(2, 5); $XOptions = [2, 5];
$type = $XOptions[rand(0, 1)]; $type = $XOptions[rand(0, 1)];
} }
$type = intval($type); $type = intval($type);
@ -10137,7 +10137,7 @@ function getHamburgerButton($id = '', $type = 0, $parameters = 'class="btn btn-d
$id = uniqid(); $id = uniqid();
} }
$filePath = $global['systemRootPath'] . 'objects/functionGetHamburgerButton.php'; $filePath = $global['systemRootPath'] . 'objects/functionGetHamburgerButton.php';
return getIncludeFileContent($filePath, array('type' => $type, 'id' => $id, 'parameters' => $parameters, 'startActive' => $startActive, 'invert' => $invert)); return getIncludeFileContent($filePath, ['type' => $type, 'id' => $id, 'parameters' => $parameters, 'startActive' => $startActive, 'invert' => $invert]);
} }
function getUserOnlineLabel($users_id, $class = '', $style = '') function getUserOnlineLabel($users_id, $class = '', $style = '')
@ -10411,9 +10411,9 @@ function addTwitterJS($text)
function getMP3ANDMP4DownloadLinksFromHLS($videos_id, $video_type) function getMP3ANDMP4DownloadLinksFromHLS($videos_id, $video_type)
{ {
$downloadOptions = array(); $downloadOptions = [];
if (empty($videos_id)) { if (empty($videos_id)) {
return array(); return [];
} }
if (empty($video_type)) { if (empty($video_type)) {
$video = Video::getVideoLight($videos_id); $video = Video::getVideoLight($videos_id);
@ -10503,7 +10503,7 @@ function getIframePaths()
$url = addQueryStringParameter($url, $key, $value); $url = addQueryStringParameter($url, $key, $value);
} }
return array('relative' => $relativeSRC, 'url' => $url, 'path' => "{$global['systemRootPath']}{$relativeSRC}", 'modeYoutube' => $modeYoutube); return ['relative' => $relativeSRC, 'url' => $url, 'path' => "{$global['systemRootPath']}{$relativeSRC}", 'modeYoutube' => $modeYoutube];
} }
function getFeedButton($rss, $mrss, $roku) function getFeedButton($rss, $mrss, $roku)
@ -10551,7 +10551,7 @@ function isSafari()
function fixQuotes($str) function fixQuotes($str)
{ {
$chr_map = array( $chr_map = [
// Windows codepage 1252 // Windows codepage 1252
"\xC2\x82" => "'", // U+0082⇒U+201A single low-9 quotation mark "\xC2\x82" => "'", // U+0082⇒U+201A single low-9 quotation mark
"\xC2\x84" => '"', // U+0084⇒U+201E double low-9 quotation mark "\xC2\x84" => '"', // U+0084⇒U+201E double low-9 quotation mark
@ -10575,7 +10575,7 @@ function fixQuotes($str)
"\xE2\x80\x9F" => '"', // U+201F double high-reversed-9 quotation mark "\xE2\x80\x9F" => '"', // U+201F double high-reversed-9 quotation mark
"\xE2\x80\xB9" => "'", // U+2039 single left-pointing angle quotation mark "\xE2\x80\xB9" => "'", // U+2039 single left-pointing angle quotation mark
"\xE2\x80\xBA" => "'", // U+203A single right-pointing angle quotation mark "\xE2\x80\xBA" => "'", // U+203A single right-pointing angle quotation mark
); ];
$chr = array_keys($chr_map); // but: for efficiency you should $chr = array_keys($chr_map); // but: for efficiency you should
$rpl = array_values($chr_map); // pre-calculate these two arrays $rpl = array_values($chr_map); // pre-calculate these two arrays
$str = str_replace($chr, $rpl, html_entity_decode($str, ENT_QUOTES, "UTF-8")); $str = str_replace($chr, $rpl, html_entity_decode($str, ENT_QUOTES, "UTF-8"));

View file

@ -10,18 +10,18 @@ header('Content-Type: application/json');
$_POST['current'] = 1; $_POST['current'] = 1;
$_REQUEST['rowCount'] = 10; $_REQUEST['rowCount'] = 10;
$response = array(); $response = [];
if(preg_match('/^@/', $_REQUEST['term'])){ if(preg_match('/^@/', $_REQUEST['term'])){
$_GET['searchPhrase'] = xss_esc(substr($_REQUEST['term'], 1)); $_GET['searchPhrase'] = xss_esc(substr($_REQUEST['term'], 1));
$ignoreAdmin = true; $ignoreAdmin = true;
$users = User::getAllUsers($ignoreAdmin, ['name', 'email', 'user', 'channelName'], 'a'); $users = User::getAllUsers($ignoreAdmin, ['name', 'email', 'user', 'channelName'], 'a');
foreach ($users as $key => $value) { foreach ($users as $key => $value) {
$response[] = array( $response[] = [
'id'=>$value['id'], 'id'=>$value['id'],
'value'=>$value['identification'], 'value'=>$value['identification'],
'label'=>Video::getCreatorHTML($value['id'], '', true, true) 'label'=>Video::getCreatorHTML($value['id'], '', true, true)
); ];
} }
} }

View file

@ -204,7 +204,7 @@ class PlayList extends ObjectYPT {
} }
} else { } else {
//die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); //die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
$rows = array(); $rows = [];
} }
return $rows; return $rows;
} }
@ -259,7 +259,7 @@ class PlayList extends ObjectYPT {
if ($res !== false) { if ($res !== false) {
foreach ($fullData as $row) { foreach ($fullData as $row) {
$row = cleanUpRowFromDatabase($row); $row = cleanUpRowFromDatabase($row);
$row['videos'] = array(); $row['videos'] = [];
if ($onlyWithVideos) { if ($onlyWithVideos) {
$row['videos'] = self::getVideosIDFromPlaylistLight($row['id']); $row['videos'] = self::getVideosIDFromPlaylistLight($row['id']);
if (empty($row['videos'])) { if (empty($row['videos'])) {
@ -270,7 +270,7 @@ class PlayList extends ObjectYPT {
} }
} else { } else {
//die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); //die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
$rows = array(); $rows = [];
} }
return $rows; return $rows;
} }
@ -389,7 +389,7 @@ class PlayList extends ObjectYPT {
} }
} else { } else {
//die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); //die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
$rows = array(); $rows = [];
} }
$getVideosIDFromPlaylistLight[$playlists_id] = $rows; $getVideosIDFromPlaylistLight[$playlists_id] = $rows;
return $rows; return $rows;
@ -457,7 +457,7 @@ class PlayList extends ObjectYPT {
$cache = self::setCache($cacheName, $rows); $cache = self::setCache($cacheName, $rows);
} else { } else {
//die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); //die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
$rows = array(); $rows = [];
} }
} else { } else {
$rows = object_to_array($rows); $rows = object_to_array($rows);
@ -840,7 +840,7 @@ class PlayList extends ObjectYPT {
} }
} else { } else {
//die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); //die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
$rows = array(); $rows = [];
} }
return $rows; return $rows;
} }

View file

@ -17,9 +17,9 @@ require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once './playlist.php'; require_once './playlist.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
if(is_array($_POST['videos_id'])){ if(is_array($_POST['videos_id'])){
$rows = array(); $rows = [];
foreach ($_POST['videos_id'] as $value) { foreach ($_POST['videos_id'] as $value) {
$rows[] = array('videos_id'=>$value, 'playlists'=>PlayList::getAllFromUserVideo($_POST['users_id'], $value, false)); $rows[] = ['videos_id'=>$value, 'playlists'=>PlayList::getAllFromUserVideo($_POST['users_id'], $value, false)];
} }
echo json_encode($rows); echo json_encode($rows);
}else{ }else{

View file

@ -80,12 +80,12 @@ foreach ($scanVars as $value) {
if (!empty($scanThis[$value])) { if (!empty($scanThis[$value])) {
if (is_string($scanThis[$value])) { if (is_string($scanThis[$value])) {
$scanThis[$value] = fixQuotesIfSafari($scanThis[$value]); $scanThis[$value] = fixQuotesIfSafari($scanThis[$value]);
$scanThis[$value] = str_replace(array("'","`"), array('', ''), trim($scanThis[$value])); $scanThis[$value] = str_replace(["'","`"], ['', ''], trim($scanThis[$value]));
} elseif (is_array($scanThis[$value])) { } elseif (is_array($scanThis[$value])) {
foreach ($scanThis[$value] as $key => $value2) { foreach ($scanThis[$value] as $key => $value2) {
if (is_string($scanThis[$value][$key])) { if (is_string($scanThis[$value][$key])) {
$scanThis[$value] = fixQuotesIfSafari($scanThis[$value]); $scanThis[$value] = fixQuotesIfSafari($scanThis[$value]);
$scanThis[$value][$key] = str_replace(array("'","`"), array('', ''), trim($scanThis[$value][$key])); $scanThis[$value][$key] = str_replace(["'","`"], ['', ''], trim($scanThis[$value][$key]));
} }
} }
} }

View file

@ -21,7 +21,7 @@ $obj->imagePNG = "{$obj->imageJPG}.png";
$obj->imagePNGResponse = saveCroppieImage($obj->imagePNG, "image"); $obj->imagePNGResponse = saveCroppieImage($obj->imagePNG, "image");
$obj->imageJPGResponse = convertImage($obj->imagePNG, $obj->imageJPG, 70); $obj->imageJPGResponse = convertImage($obj->imagePNG, $obj->imageJPG, 70);
$obj->variations = array(); $obj->variations = [];
//var_dump($obj); //var_dump($obj);
if (file_exists($obj->imagePNG)) { if (file_exists($obj->imagePNG)) {
unlink($obj->imagePNG); unlink($obj->imagePNG);

View file

@ -55,16 +55,16 @@ class User {
public static $channel_artDesktopMax = 'desktop_max'; public static $channel_artDesktopMax = 'desktop_max';
public static $channel_artTablet = 'tablet'; public static $channel_artTablet = 'tablet';
public static $channel_artDesktopMin = 'desktop_min'; public static $channel_artDesktopMin = 'desktop_min';
public static $channel_art = array( public static $channel_art = [
'TV' => array('tv', 2550, 1440), 'TV' => ['tv', 2550, 1440],
'DesktopMax' => array('desktop_max', 2550, 423), 'DesktopMax' => ['desktop_max', 2550, 423],
'tablet' => array('tablet', 1855, 423), 'tablet' => ['tablet', 1855, 423],
'DesktopMin' => array('desktop_min', 1546, 423) 'DesktopMin' => ['desktop_min', 1546, 423]
); ];
public static $is_company_status_NOTCOMPANY = 0; public static $is_company_status_NOTCOMPANY = 0;
public static $is_company_status_ISACOMPANY = 1; public static $is_company_status_ISACOMPANY = 1;
public static $is_company_status_WAITINGAPPROVAL = 2; public static $is_company_status_WAITINGAPPROVAL = 2;
public static $is_company_status = array(0 => 'Not a Company', 1 => 'Active Company', 2 => 'Company waiting for approval'); public static $is_company_status = [0 => 'Not a Company', 1 => 'Active Company', 2 => 'Company waiting for approval'];
public function __construct($id, $user = "", $password = "") { public function __construct($id, $user = "", $password = "") {
if (empty($id)) { if (empty($id)) {
@ -940,13 +940,13 @@ if (typeof gtag !== \"function\") {
global $global; global $global;
if (!empty($this->id)) { if (!empty($this->id)) {
$arrayTables = array( $arrayTables = [
//'live_transmition_history_log', //'live_transmition_history_log',
'live_transmitions', 'live_transmitions',
'users_login_history', 'users_login_history',
'audit', 'audit',
'ppvlive_purchases', 'ppvlive_purchases',
); ];
foreach ($arrayTables as $value) { foreach ($arrayTables as $value) {
$sql = "DELETE FROM {$value} WHERE users_id = ?"; $sql = "DELETE FROM {$value} WHERE users_id = ?";
@ -1198,7 +1198,7 @@ if (typeof gtag !== \"function\") {
if (!empty($users_id)) { if (!empty($users_id)) {
if (!isset($_is_a_company)) { if (!isset($_is_a_company)) {
$_is_a_company = array(); $_is_a_company = [];
} }
if (!isset($_is_a_company[$users_id])) { if (!isset($_is_a_company[$users_id])) {
$user = new User($users_id); $user = new User($users_id);
@ -1282,7 +1282,7 @@ if (typeof gtag !== \"function\") {
} }
$can = !empty($this->isAdmin) || !empty($this->canStream); $can = !empty($this->isAdmin) || !empty($this->canStream);
if(empty($can)){ if(empty($can)){
$reasons = array(); $reasons = [];
if(empty($this->isAdmin)){ if(empty($this->isAdmin)){
$reasons[] = 'User is not admin'; $reasons[] = 'User is not admin';
} }
@ -2374,7 +2374,7 @@ if (typeof gtag !== \"function\") {
return false; return false;
} }
if (!isset($_sendVerificationLink_sent)) { if (!isset($_sendVerificationLink_sent)) {
$_sendVerificationLink_sent = array(); $_sendVerificationLink_sent = [];
} }
//Only send the verification email each 30 minutes //Only send the verification email each 30 minutes
if (!empty($_sendVerificationLink_sent[$users_id])) { if (!empty($_sendVerificationLink_sent[$users_id])) {
@ -2468,7 +2468,7 @@ if (typeof gtag !== \"function\") {
} }
if (!isset($_createVerificationCode)) { if (!isset($_createVerificationCode)) {
$_createVerificationCode = array(); $_createVerificationCode = [];
} }
if (empty($_createVerificationCode[$users_id])) { if (empty($_createVerificationCode[$users_id])) {
@ -2973,7 +2973,7 @@ if (typeof gtag !== \"function\") {
$value = $user->getExternalOptions('DonationButtons'); $value = $user->getExternalOptions('DonationButtons');
$json = _json_decode($value); $json = _json_decode($value);
if (empty($json)) { if (empty($json)) {
return array(); return [];
} }
return $json; return $json;
} }

View file

@ -278,7 +278,7 @@ class UserGroups{
} }
if(!isset($__getUserGroups)){ if(!isset($__getUserGroups)){
$__getUserGroups = array(); $__getUserGroups = [];
} }
if(isset($__getUserGroups[$users_id])){ if(isset($__getUserGroups[$users_id])){
@ -403,7 +403,7 @@ class UserGroups{
return false; return false;
} }
if (!is_array($array_groups_id)) { if (!is_array($array_groups_id)) {
$array_groups_id = array($array_groups_id); $array_groups_id = [$array_groups_id];
} }
if ($mergeWithCurrentUserGroups) { if ($mergeWithCurrentUserGroups) {
@ -482,12 +482,12 @@ class UserGroups{
global $_getVideosAndCategoriesUserGroups; global $_getVideosAndCategoriesUserGroups;
if(!isset($_getVideosAndCategoriesUserGroups)){ if(!isset($_getVideosAndCategoriesUserGroups)){
$_getVideosAndCategoriesUserGroups = array(); $_getVideosAndCategoriesUserGroups = [];
} }
if(!empty($force) || !isset($_getVideosAndCategoriesUserGroups[$videos_id])){ if(!empty($force) || !isset($_getVideosAndCategoriesUserGroups[$videos_id])){
$videosug = self::getVideoGroups($videos_id); $videosug = self::getVideoGroups($videos_id);
$categoriessug = self::getCategoriesGroups($videos_id); $categoriessug = self::getCategoriesGroups($videos_id);
$response = array(); $response = [];
foreach ($videosug as $value) { foreach ($videosug as $value) {
$value['isVideoUserGroup'] = 1; $value['isVideoUserGroup'] = 1;
$value['isCategoryUserGroup'] = 0; $value['isCategoryUserGroup'] = 0;

View file

@ -19,10 +19,10 @@ if (!empty($_REQUEST['users_id'])) {
//echo __LINE__, PHP_EOL; //echo __LINE__, PHP_EOL;
$user = User::getUserFromID($_REQUEST['users_id']); $user = User::getUserFromID($_REQUEST['users_id']);
if (!empty($user)) { if (!empty($user)) {
$users = array($user); $users = [$user];
$total = 1; $total = 1;
} else { } else {
$users = array(); $users = [];
$total = 0; $total = 0;
} }
} else if (empty($_REQUEST['user_groups_id'])) { } else if (empty($_REQUEST['user_groups_id'])) {
@ -59,7 +59,7 @@ if (empty($users)) {
} else { } else {
foreach ($users as $key => $value) { foreach ($users as $key => $value) {
if(!$canAdminUsers){ if(!$canAdminUsers){
$u = array(); $u = [];
$u['id'] = $value['id']; $u['id'] = $value['id'];
//$u['user'] = $user['user']; //$u['user'] = $user['user'];
$u['identification'] = $value['identification']; $u['identification'] = $value['identification'];

View file

@ -1242,7 +1242,7 @@ if (!class_exists('Video')) {
public static function getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '') { public static function getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '') {
global $global, $config, $advancedCustom, $advancedCustomUser; global $global, $config, $advancedCustom, $advancedCustomUser;
if ($config->currentVersionLowerThen('11.7')) { if ($config->currentVersionLowerThen('11.7')) {
return array(); return [];
} }
$tolerance = 0.5; $tolerance = 0.5;
/** /**
@ -1482,7 +1482,7 @@ if (!class_exists('Video')) {
TimeLogEnd($timeLogName, __LINE__, 0.2); TimeLogEnd($timeLogName, __LINE__, 0.2);
$allowedDurationTypes = array('video', 'audio'); $allowedDurationTypes = ['video', 'audio'];
/** /**
* *
@ -1654,9 +1654,9 @@ if (!class_exists('Video')) {
$MediaMetadata->title = $video['title']; $MediaMetadata->title = $video['title'];
$MediaMetadata->artist = $video['identification']; $MediaMetadata->artist = $video['identification'];
$MediaMetadata->album = $video['category']; $MediaMetadata->album = $video['category'];
$MediaMetadata->artwork = array(); $MediaMetadata->artwork = [];
foreach ($posters as $key => $value) { foreach ($posters as $key => $value) {
$MediaMetadata->artwork[] = array('src' => $value['url'], 'sizes' => "{$key}x{$key}", 'type' => 'image/jpg'); $MediaMetadata->artwork[] = ['src' => $value['url'], 'sizes' => "{$key}x{$key}", 'type' => 'image/jpg'];
} }
return $MediaMetadata; return $MediaMetadata;
} }
@ -1771,7 +1771,7 @@ if (!class_exists('Video')) {
public static function getAllVideosLight($status = "viewable", $showOnlyLoggedUserVideos = false, $showUnlisted = false, $suggestedOnly = false, $type = '') { public static function getAllVideosLight($status = "viewable", $showOnlyLoggedUserVideos = false, $showUnlisted = false, $suggestedOnly = false, $type = '') {
global $global, $config; global $global, $config;
if ($config->currentVersionLowerThen('5')) { if ($config->currentVersionLowerThen('5')) {
return array(); return [];
} }
$status = str_replace("'", "", $status); $status = str_replace("'", "", $status);
if ($status === 'suggested') { if ($status === 'suggested') {
@ -1861,7 +1861,7 @@ if (!class_exists('Video')) {
} }
//$videos = $res->fetch_all(MYSQLI_ASSOC); //$videos = $res->fetch_all(MYSQLI_ASSOC);
} else { } else {
$videos = array(); $videos = [];
//die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); //die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
} }
return $videos; return $videos;
@ -2039,10 +2039,10 @@ if (!class_exists('Video')) {
if ($advancedCustomUser->videosSearchAlsoSearchesOnChannelName) { if ($advancedCustomUser->videosSearchAlsoSearchesOnChannelName) {
$searchFieldsNames[] = 'u.channelName'; $searchFieldsNames[] = 'u.channelName';
} }
$newSearchFieldsNames = array(); $newSearchFieldsNames = [];
if (!empty($_REQUEST['searchFieldsNames'])) { if (!empty($_REQUEST['searchFieldsNames'])) {
if (!is_array($_REQUEST['searchFieldsNames'])) { if (!is_array($_REQUEST['searchFieldsNames'])) {
$_REQUEST['searchFieldsNames'] = array($_REQUEST['searchFieldsNames']); $_REQUEST['searchFieldsNames'] = [$_REQUEST['searchFieldsNames']];
} }
foreach ($_REQUEST['searchFieldsNames'] as $value) { foreach ($_REQUEST['searchFieldsNames'] as $value) {
if (in_array($value, $searchFieldsNames)) { if (in_array($value, $searchFieldsNames)) {
@ -2606,10 +2606,10 @@ if (!class_exists('Video')) {
} }
// if you're not admin you can only manage your videos // if you're not admin you can only manage your videos
$users_id = array($this->users_id, $this->users_id_company); $users_id = [$this->users_id, $this->users_id_company];
if ($advancedCustomUser->userCanChangeVideoOwner) { if ($advancedCustomUser->userCanChangeVideoOwner) {
$video = new Video("", "", $this->id); // query again to make sure the user is not changing the owner $video = new Video("", "", $this->id); // query again to make sure the user is not changing the owner
$users_id = array($video->getUsers_id(), $video->getUsers_id_company()); $users_id = [$video->getUsers_id(), $video->getUsers_id_company()];
} }
//var_dump(User::getId(), $users_id, $video, $this); //var_dump(User::getId(), $users_id, $video, $this);
if (!in_array(User::getId(), $users_id)) { if (!in_array(User::getId(), $users_id)) {
@ -2681,7 +2681,7 @@ if (!class_exists('Video')) {
if (empty($value2->label) || empty($value2->text)) { if (empty($value2->label) || empty($value2->text)) {
continue; continue;
} }
$valid_tags = array(__("Paid Content"), __("Group"), __("Plugin"), __("Rating")); $valid_tags = [__("Paid Content"), __("Group"), __("Plugin"), __("Rating")];
if (!in_array($value2->label, $valid_tags)) { if (!in_array($value2->label, $valid_tags)) {
continue; continue;
} }
@ -2844,7 +2844,7 @@ if (!class_exists('Video')) {
//$objTag->text = __("Public"); //$objTag->text = __("Public");
} }
} else { } else {
$groupNames = array(); $groupNames = [];
foreach ($groups as $value) { foreach ($groups as $value) {
$groupNames[] = $value['group_name']; $groupNames[] = $value['group_name'];
} }
@ -4376,9 +4376,9 @@ if (!class_exists('Video')) {
} }
if (defaultIsLandscape()) { if (defaultIsLandscape()) {
$return->default = array('url' => $return->posterLandscape, 'path' => $return->posterLandscapePath); $return->default = ['url' => $return->posterLandscape, 'path' => $return->posterLandscapePath];
} else { } else {
$return->default = array('url' => $return->posterPortrait, 'path' => $return->posterPortraitPath); $return->default = ['url' => $return->posterPortrait, 'path' => $return->posterPortraitPath];
} }
return $return; return $return;
@ -5172,7 +5172,7 @@ if (!class_exists('Video')) {
*/ */
$status = $video->getStatus(); $status = $video->getStatus();
$buttons = array(); $buttons = [];
$totalStatusButtons = count($statusThatTheUserCanUpdate); $totalStatusButtons = count($statusThatTheUserCanUpdate);
foreach ($statusThatTheUserCanUpdate as $key => $value) { foreach ($statusThatTheUserCanUpdate as $key => $value) {
$index = $key + 1; $index = $key + 1;
@ -5651,7 +5651,7 @@ if (!class_exists('Video')) {
global $advancedCustom, $_getSeoTags; global $advancedCustom, $_getSeoTags;
if (!isset($_getSeoTags)) { if (!isset($_getSeoTags)) {
$_getSeoTags = array(); $_getSeoTags = [];
} }
if (!empty($_getSeoTags[$videos_id])) { if (!empty($_getSeoTags[$videos_id])) {
@ -5687,23 +5687,23 @@ if (!class_exists('Video')) {
$image = Video::getImageFromID($videos_id); $image = Video::getImageFromID($videos_id);
$tags = array( $tags = [
'h1' => $H1_title, 'h1' => $H1_title,
'h2' => $H2_Short_summary, 'h2' => $H2_Short_summary,
); ];
$meta = array( $meta = [
'description' => $MetaDescription, 'description' => $MetaDescription,
'keywords' => $keywords, 'keywords' => $keywords,
'author' => User::getNameIdentificationById($video->getUsers_id()) 'author' => User::getNameIdentificationById($video->getUsers_id())
); ];
$itemprops = array( $itemprops = [
'name' => $H1_title, 'name' => $H1_title,
'thumbnailUrl' => $image->default['url'], 'thumbnailUrl' => $image->default['url'],
'contentURL' => Video::getLink($videos_id, $video->getClean_title()), 'contentURL' => Video::getLink($videos_id, $video->getClean_title()),
'embedURL' => Video::getLink($videos_id, $video->getClean_title(), true), 'embedURL' => Video::getLink($videos_id, $video->getClean_title(), true),
'uploadDate' => $video->getCreated(), 'uploadDate' => $video->getCreated(),
'description' => $MetaDescription 'description' => $MetaDescription
); ];
$head = ''; $head = '';
foreach ($meta as $key => $value) { foreach ($meta as $key => $value) {
@ -5727,8 +5727,8 @@ if (!class_exists('Video')) {
$body .= "<span itemprop=\"{$key}\" content=\"" . str_replace('"', '', $value) . "\"></span>"; $body .= "<span itemprop=\"{$key}\" content=\"" . str_replace('"', '', $value) . "\"></span>";
} }
$body .= '</div>'; $body .= '</div>';
$response = array(); $response = [];
$response['assets'] = array('tags' => $tags, 'meta' => $meta, 'itemprops' => $itemprops); $response['assets'] = ['tags' => $tags, 'meta' => $meta, 'itemprops' => $itemprops];
$response['head'] = $head; $response['head'] = $head;
$response['body'] = $body; $response['body'] = $body;
$_getSeoTags[$videos_id] = $response; $_getSeoTags[$videos_id] = $response;
@ -5769,12 +5769,12 @@ if (!class_exists('Video')) {
global $config, $_getEPG; global $config, $_getEPG;
if (!isset($_getEPG)) { if (!isset($_getEPG)) {
$_getEPG = array(); $_getEPG = [];
} }
if (!isset($_getEPG[$videos_id])) { if (!isset($_getEPG[$videos_id])) {
$sql = "SELECT * FROM `videos` WHERE id = ? AND `type` = 'linkVideo' AND epg_link IS NOT NULL AND epg_link != ''"; $sql = "SELECT * FROM `videos` WHERE id = ? AND `type` = 'linkVideo' AND epg_link IS NOT NULL AND epg_link != ''";
$res = sqlDAL::readSql($sql, 'i', array($videos_id)); $res = sqlDAL::readSql($sql, 'i', [$videos_id]);
$video = sqlDAL::fetchAssoc($res); $video = sqlDAL::fetchAssoc($res);
sqlDAL::close($res); sqlDAL::close($res);
@ -5810,7 +5810,7 @@ if (!empty($_GET['v']) && empty($_GET['videoName'])) {
$_GET['videoName'] = Video::get_clean_title($_GET['v']); $_GET['videoName'] = Video::get_clean_title($_GET['v']);
} }
$statusThatShowTheCompleteMenu = array( $statusThatShowTheCompleteMenu = [
Video::$statusActive, Video::$statusActive,
Video::$statusInactive, Video::$statusInactive,
Video::$statusScheduledReleaseDate, Video::$statusScheduledReleaseDate,
@ -5818,9 +5818,9 @@ $statusThatShowTheCompleteMenu = array(
Video::$statusUnlistedButSearchable, Video::$statusUnlistedButSearchable,
Video::$statusUnlisted, Video::$statusUnlisted,
Video::$statusFansOnly, Video::$statusFansOnly,
); ];
$statusSearchFilter = array( $statusSearchFilter = [
Video::$statusActive, Video::$statusActive,
Video::$statusInactive, Video::$statusInactive,
Video::$statusScheduledReleaseDate, Video::$statusScheduledReleaseDate,
@ -5829,11 +5829,11 @@ $statusSearchFilter = array(
Video::$statusUnlisted, Video::$statusUnlisted,
Video::$statusUnlistedButSearchable, Video::$statusUnlistedButSearchable,
Video::$statusBrokenMissingFiles, Video::$statusBrokenMissingFiles,
); ];
$statusThatTheUserCanUpdate = array( $statusThatTheUserCanUpdate = [
array(Video::$statusActive, '#0A0'), [Video::$statusActive, '#0A0'],
array(Video::$statusInactive, '#B00'), [Video::$statusInactive, '#B00'],
array(Video::$statusUnlisted, '#AAA'), [Video::$statusUnlisted, '#AAA'],
array(Video::$statusUnlistedButSearchable, '#BBB'), [Video::$statusUnlistedButSearchable, '#BBB'],
); ];

View file

@ -8,8 +8,8 @@ if (!isset($global['systemRootPath'])) {
$obj = new stdClass(); $obj = new stdClass();
$obj->msg = ''; $obj->msg = '';
$obj->error = true; $obj->error = true;
$obj->idsToSave = array(); $obj->idsToSave = [];
$obj->idSaved = array(); $obj->idSaved = [];
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!Permissions::canModerateVideos()) { if (!Permissions::canModerateVideos()) {

View file

@ -606,7 +606,7 @@ class VideoStatistic extends ObjectYPT {
} }
} else { } else {
//die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); //die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
$rows = array(); $rows = [];
} }
return $rows; return $rows;
} }
@ -667,7 +667,7 @@ class VideoStatistic extends ObjectYPT {
$res = sqlDAL::readSql($sql, $formats, $values); $res = sqlDAL::readSql($sql, $formats, $values);
$fullData = sqlDAL::fetchAllAssoc($res); $fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res); sqlDAL::close($res);
$rows = array(); $rows = [];
if ($res != false) { if ($res != false) {
$totalViews = 0; $totalViews = 0;
$totalWatchingTime = 0; $totalWatchingTime = 0;

View file

@ -40,14 +40,14 @@ $type = '';
if($advancedCustomUser->showArticlesTab && AVideoPlugin::isEnabledByName('Articles')){ if($advancedCustomUser->showArticlesTab && AVideoPlugin::isEnabledByName('Articles')){
$uploadedTotalArticles = Video::getTotalVideos($status, $user_id, !isToHidePrivateVideos(), $showUnlisted, true, false, 'article'); $uploadedTotalArticles = Video::getTotalVideos($status, $user_id, !isToHidePrivateVideos(), $showUnlisted, true, false, 'article');
if(!empty($uploadedTotalArticles)){ if(!empty($uploadedTotalArticles)){
$uploadedArticles = Video::getAllVideos($status, $user_id, !isToHidePrivateVideos(), array(), false, $showUnlisted, true, false, null, 'article'); $uploadedArticles = Video::getAllVideos($status, $user_id, !isToHidePrivateVideos(), [], false, $showUnlisted, true, false, null, 'article');
} }
$type = 'notArticle'; $type = 'notArticle';
} }
if($advancedCustomUser->showAudioTab){ if($advancedCustomUser->showAudioTab){
$uploadedTotalAudio = Video::getTotalVideos($status, $user_id, !isToHidePrivateVideos(), $showUnlisted, true, false, 'audio'); $uploadedTotalAudio = Video::getTotalVideos($status, $user_id, !isToHidePrivateVideos(), $showUnlisted, true, false, 'audio');
if(!empty($uploadedTotalAudio)){ if(!empty($uploadedTotalAudio)){
$uploadedAudio = Video::getAllVideos($status, $user_id, !isToHidePrivateVideos(), array(), false, $showUnlisted, true, false, null, 'audio'); $uploadedAudio = Video::getAllVideos($status, $user_id, !isToHidePrivateVideos(), [], false, $showUnlisted, true, false, null, 'audio');
} }
//var_dump($uploadedAudio);exit; //var_dump($uploadedAudio);exit;
if(empty($type)){ if(empty($type)){
@ -57,10 +57,10 @@ if($advancedCustomUser->showAudioTab){
} }
} }
//var_dump($uploadedArticles);exit; //var_dump($uploadedArticles);exit;
$uploadedVideos = array(); $uploadedVideos = [];
$uploadedTotalVideos = Video::getTotalVideos($status, $user_id, !isToHidePrivateVideos(), $showUnlisted, true, false, $type); $uploadedTotalVideos = Video::getTotalVideos($status, $user_id, !isToHidePrivateVideos(), $showUnlisted, true, false, $type);
if(!empty($uploadedTotalVideos)){ if(!empty($uploadedTotalVideos)){
$uploadedVideos = Video::getAllVideos($status, $user_id, !isToHidePrivateVideos(), array(), false, $showUnlisted, true, false, null, $type); $uploadedVideos = Video::getAllVideos($status, $user_id, !isToHidePrivateVideos(), [], false, $showUnlisted, true, false, null, $type);
} }
TimeLogEnd($timeLog, __LINE__); TimeLogEnd($timeLog, __LINE__);
$totalPages = ceil($uploadedTotalVideos / $rowCount); $totalPages = ceil($uploadedTotalVideos / $rowCount);

View file

@ -42,7 +42,7 @@ if (empty($_GET['current'])) {
} }
$_REQUEST['rowCount'] = 4; $_REQUEST['rowCount'] = 4;
$sort = @$_POST['sort']; $sort = @$_POST['sort'];
$_POST['sort'] = array(); $_POST['sort'] = [];
$_POST['sort']['created'] = 'DESC'; $_POST['sort']['created'] = 'DESC';
$playlists = PlayList::getAllFromUser($user_id, $publicOnly, false, 0, 0, true); $playlists = PlayList::getAllFromUser($user_id, $publicOnly, false, 0, 0, true);
$_POST['sort'] = $sort; $_POST['sort'] = $sort;

View file

@ -55,10 +55,10 @@ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['REMOTE_ADDR']; $ip = $_SERVER['REMOTE_ADDR'];
} }
$byPassCaptcha = array( $byPassCaptcha = [
'/Live.on_/', '/Live.on_/',
'/objects.aVideoEncoder/', '/objects.aVideoEncoder/',
); ];
foreach($byPassCaptcha as $regExp){ foreach($byPassCaptcha as $regExp){
if(preg_match($regExp, $_SERVER['PHP_SELF'])){ if(preg_match($regExp, $_SERVER['PHP_SELF'])){
@ -67,7 +67,7 @@ foreach($byPassCaptcha as $regExp){
} }
} }
$ignoreLog = array('/view/xsendfile.php'); $ignoreLog = ['/view/xsendfile.php'];
if(!in_array($_SERVER['PHP_SELF'], $ignoreLog) || preg_match('/(bot|spider|crawl)/i', $_SERVER['HTTP_USER_AGENT'])){ if(!in_array($_SERVER['PHP_SELF'], $ignoreLog) || preg_match('/(bot|spider|crawl)/i', $_SERVER['HTTP_USER_AGENT'])){
error_log("AVideo captcha {$ip} PHP_SELF={$_SERVER['PHP_SELF']} HTTP_USER_AGENT={$ua}"); error_log("AVideo captcha {$ip} PHP_SELF={$_SERVER['PHP_SELF']} HTTP_USER_AGENT={$ua}");
} }

View file

@ -15,7 +15,7 @@ if (!empty($_GET['catName'])) {
$photo = Category::getCategoryPhotoPath($categories_id); $photo = Category::getCategoryPhotoPath($categories_id);
$background = Category::getCategoryBackgroundPath($categories_id); $background = Category::getCategoryBackgroundPath($categories_id);
$data = array('id'=>$categories_id); $data = ['id'=>$categories_id];
?> ?>
<div class="row" style="position: relative; z-index: 1; margin-top: -15px;"> <div class="row" style="position: relative; z-index: 1; margin-top: -15px;">

View file

@ -1,17 +1,17 @@
<?php <?php
$users_tabs = array(); $users_tabs = [];
$users_tabs[] = array('selector' => 'grid', 'queryString' => '?status=a', 'icon' => 'fas fa-user', 'title' => 'Active Users', 'active' => 'active', 'userGroupID' => 0); $users_tabs[] = ['selector' => 'grid', 'queryString' => '?status=a', 'icon' => 'fas fa-user', 'title' => 'Active Users', 'active' => 'active', 'userGroupID' => 0];
$users_tabs[] = array('selector' => 'gridInactive', 'queryString' => '?status=i', 'icon' => 'fas fa-user-slash', 'title' => 'Inactive Users', 'active' => '', 'userGroupID' => 0); $users_tabs[] = ['selector' => 'gridInactive', 'queryString' => '?status=i', 'icon' => 'fas fa-user-slash', 'title' => 'Inactive Users', 'active' => '', 'userGroupID' => 0];
$users_tabs[] = array('selector' => 'gridAdmin', 'queryString' => '?isAdmin=1', 'icon' => 'fas fa-user-tie', 'title' => 'Admin Users', 'active' => '', 'userGroupID' => 0); $users_tabs[] = ['selector' => 'gridAdmin', 'queryString' => '?isAdmin=1', 'icon' => 'fas fa-user-tie', 'title' => 'Admin Users', 'active' => '', 'userGroupID' => 0];
if (empty($advancedCustomUser->disableCompanySignUp)) { if (empty($advancedCustomUser->disableCompanySignUp)) {
$users_tabs[] = array('selector' => 'companyAdmin', 'queryString' => '?isCompany=1', 'icon' => 'fas fa-building', 'title' => 'Company Users', 'active' => '', 'userGroupID' => 0); $users_tabs[] = ['selector' => 'companyAdmin', 'queryString' => '?isCompany=1', 'icon' => 'fas fa-building', 'title' => 'Company Users', 'active' => '', 'userGroupID' => 0];
$users_tabs[] = array('selector' => 'companyApAdmin', 'queryString' => '?isCompany=2', 'icon' => 'fas fa-building', 'title' => 'Company Waiting Approval', 'active' => '', 'userGroupID' => 0); $users_tabs[] = ['selector' => 'companyApAdmin', 'queryString' => '?isCompany=2', 'icon' => 'fas fa-building', 'title' => 'Company Waiting Approval', 'active' => '', 'userGroupID' => 0];
} }
foreach ($userGroups as $value) { foreach ($userGroups as $value) {
$users_tabs[] = array('selector' => 'userGroupGrid' . $value['id'], 'queryString' => '?status=a&user_groups_id=' . $value['id'], 'icon' => 'fas fa-users', 'title' => $value['group_name'], 'active' => '', 'userGroupID' => $value['id']); $users_tabs[] = ['selector' => 'userGroupGrid' . $value['id'], 'queryString' => '?status=a&user_groups_id=' . $value['id'], 'icon' => 'fas fa-users', 'title' => $value['group_name'], 'active' => '', 'userGroupID' => $value['id']];
} }
?> ?>
<div class="panel panel-default"> <div class="panel panel-default">

View file

@ -254,7 +254,7 @@
<?php <?php
$myAffiliates = CustomizeUser::getCompanyAffiliates(User::getId()); $myAffiliates = CustomizeUser::getCompanyAffiliates(User::getId());
if (!empty($myAffiliates)) { if (!empty($myAffiliates)) {
$users_id_list = array(); $users_id_list = [];
$users_id_list[] = User::getId(); $users_id_list[] = User::getId();
foreach ($myAffiliates as $value) { foreach ($myAffiliates as $value) {
$users_id_list[] = $value['users_id_affiliate']; $users_id_list[] = $value['users_id_affiliate'];
@ -267,7 +267,7 @@
<div class="row" <?php if (empty($advancedCustomUser->userCanChangeVideoOwner) && !Permissions::canAdminVideos()) { ?> style="display: none;" <?php } ?>> <div class="row" <?php if (empty($advancedCustomUser->userCanChangeVideoOwner) && !Permissions::canAdminVideos()) { ?> style="display: none;" <?php } ?>>
<label class="control-label" for="inputUserOwner_id" ><?php echo __("Media Owner"); ?></label> <label class="control-label" for="inputUserOwner_id" ><?php echo __("Media Owner"); ?></label>
<?php <?php
$updateUserAutocomplete = Layout::getUserAutocomplete(0, 'inputUserOwner_id', array()); $updateUserAutocomplete = Layout::getUserAutocomplete(0, 'inputUserOwner_id', []);
?> ?>
</div> </div>
<?php <?php
@ -276,7 +276,7 @@
<?php <?php
$myAffiliation = CustomizeUser::getAffiliateCompanies(User::getId()); $myAffiliation = CustomizeUser::getAffiliateCompanies(User::getId());
if (!empty($myAffiliation)) { if (!empty($myAffiliation)) {
$users_id_list = array(); $users_id_list = [];
foreach ($myAffiliation as $value) { foreach ($myAffiliation as $value) {
$users_id_list[] = $value['users_id_company']; $users_id_list[] = $value['users_id_company'];
} }

View file

@ -121,7 +121,7 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
<?php <?php
} }
$filesToDownload = []; $filesToDownload = [];
$files = array(); $files = [];
$canDownloadFiles = CustomizeUser::canDownloadVideosFromVideo($video['id']); $canDownloadFiles = CustomizeUser::canDownloadVideosFromVideo($video['id']);
if ($video['type'] == "zip") { if ($video['type'] == "zip") {
$files = getVideosURLZIP($video['filename']); $files = getVideosURLZIP($video['filename']);
@ -132,8 +132,8 @@ $description = getSEODescription(emptyHTML($video['description']) ? $video['titl
$files = getVideosURL($video['filename']); $files = getVideosURL($video['filename']);
} }
if (!empty($files)) { if (!empty($files)) {
$downloadMP3Link = array(); $downloadMP3Link = [];
$downloadMP4Link = array(); $downloadMP4Link = [];
foreach ($files as $key => $theLink) { foreach ($files as $key => $theLink) {
//$notAllowedKeys = array('m3u8'); //$notAllowedKeys = array('m3u8');
$notAllowedKeys = ['log']; $notAllowedKeys = ['log'];

View file

@ -35,7 +35,7 @@ if ($config->getAuthCanViewChart() == 0) {
$obj = new stdClass(); $obj = new stdClass();
$obj->data = array(); $obj->data = [];
if(empty($users_id)){ if(empty($users_id)){

View file

@ -435,7 +435,7 @@ if (User::hasBlockedUser($video['users_id'])) {
</script> </script>
<?php <?php
} elseif ($video['type'] == "linkVideo" || $video['type'] == "liveLink") { } elseif ($video['type'] == "linkVideo" || $video['type'] == "liveLink") {
$t = array('id'=>$_GET['link']); $t = ['id'=>$_GET['link']];
?> ?>
<!-- videoLink include liveVideo.php [<?php echo $_GET['link']; ?>] --> <!-- videoLink include liveVideo.php [<?php echo $_GET['link']; ?>] -->
<?php <?php

View file

@ -32,7 +32,7 @@ if ($config->getAuthCanViewChart() == 0) {
$obj = new stdClass(); $obj = new stdClass();
$obj->data = array(); $obj->data = [];
if(empty($users_id)){ if(empty($users_id)){
@ -45,15 +45,15 @@ if($users_id === 'all'){
$obj->data = VideoStatistic::getStatisticTotalViewsAndSecondsWatchingFromUser($users_id, $from, $to); $obj->data = VideoStatistic::getStatisticTotalViewsAndSecondsWatchingFromUser($users_id, $from, $to);
$rows = array(); $rows = [];
foreach ($obj->data as $value) { foreach ($obj->data as $value) {
$rows[] = array( $rows[] = [
$value['videos_id'], $value['videos_id'],
$value['title'], $value['title'],
$value['type'], $value['type'],
$value['total_views'], $value['total_views'],
intval($value['seconds_watching_video']) intval($value['seconds_watching_video'])
); ];
} }
$filename = "{$users_id}_{$fromDate}_{$toDate}"; $filename = "{$users_id}_{$fromDate}_{$toDate}";
@ -63,7 +63,7 @@ $identification = 'All Users';
if(!empty($users_id)){ if(!empty($users_id)){
$identification = User::getNameIdentificationById($users_id); $identification = User::getNameIdentificationById($users_id);
} }
fputcsv($output, array('From', $fromDate, 'To', $toDate, 'User', "[{$users_id}] {$identification}")); fputcsv($output, ['From', $fromDate, 'To', $toDate, 'User', "[{$users_id}] {$identification}"]);
$fields = ['videos_id', 'title', 'type', 'total views', 'seconds watching video']; $fields = ['videos_id', 'title', 'type', 'total views', 'seconds watching video'];
fputcsv($output, $fields); fputcsv($output, $fields);
foreach ($rows as $row) { foreach ($rows as $row) {

View file

@ -11,18 +11,18 @@ if (isBot()) {
$videos_id = getVideos_id(); $videos_id = getVideos_id();
$sortOptions = array( $sortOptions = [
array('key' => 'title', 'order' => 'asc', 'sortBy' => 'titleAZ', 'label' => __("Title (A-Z)"), 'data-icon' => '<i class="fas fa-sort-alpha-down"></i>'), ['key' => 'title', 'order' => 'asc', 'sortBy' => 'titleAZ', 'label' => __("Title (A-Z)"), 'data-icon' => '<i class="fas fa-sort-alpha-down"></i>'],
array('key' => 'title', 'order' => 'desc', 'sortBy' => 'titleZA', 'label' => __("Title (Z-A)"), 'data-icon' => '<i class="fas fa-sort-alpha-down-alt"></i>'), ['key' => 'title', 'order' => 'desc', 'sortBy' => 'titleZA', 'label' => __("Title (Z-A)"), 'data-icon' => '<i class="fas fa-sort-alpha-down-alt"></i>'],
array('key' => 'created', 'order' => 'desc', 'sortBy' => 'newest', 'label' => __("Date added (newest)"), 'data-icon' => '<i class="fas fa-sort-numeric-down"></i>'), ['key' => 'created', 'order' => 'desc', 'sortBy' => 'newest', 'label' => __("Date added (newest)"), 'data-icon' => '<i class="fas fa-sort-numeric-down"></i>'],
array('key' => 'created', 'order' => 'asc', 'sortBy' => 'oldest', 'label' => __("Date added (oldest)"), 'data-icon' => '<i class="fas fa-sort-numeric-down"></i>'), ['key' => 'created', 'order' => 'asc', 'sortBy' => 'oldest', 'label' => __("Date added (oldest)"), 'data-icon' => '<i class="fas fa-sort-numeric-down"></i>'],
array('key' => 'likes', 'order' => 'desc', 'sortBy' => 'popular', 'label' => __("Most popular"), 'data-icon' => '<i class="far fa-thumbs-up"></i>'), ['key' => 'likes', 'order' => 'desc', 'sortBy' => 'popular', 'label' => __("Most popular"), 'data-icon' => '<i class="far fa-thumbs-up"></i>'],
array('key' => 'suggested', 'order' => 'desc', 'sortBy' => 'suggested', 'label' => __("Suggested"), 'data-icon' => '<i class="fas fa-star"></i>'), ['key' => 'suggested', 'order' => 'desc', 'sortBy' => 'suggested', 'label' => __("Suggested"), 'data-icon' => '<i class="fas fa-star"></i>'],
array('key' => 'trending', 'order' => 'desc', 'sortBy' => 'trending', 'label' => __("Trending"), 'data-icon' => '<i class="fas fa-fire"></i>'), ['key' => 'trending', 'order' => 'desc', 'sortBy' => 'trending', 'label' => __("Trending"), 'data-icon' => '<i class="fas fa-fire"></i>'],
); ];
if (empty($advancedCustom->doNotDisplayViews)) { if (empty($advancedCustom->doNotDisplayViews)) {
$sortOptions[] = array('key' => 'views_count', 'order' => 'desc', 'sortBy' => 'views_count', 'label' => __("Most watched"), 'data-icon' => '<i class="fas fa-eye"></i>'); $sortOptions[] = ['key' => 'views_count', 'order' => 'desc', 'sortBy' => 'views_count', 'label' => __("Most watched"), 'data-icon' => '<i class="fas fa-eye"></i>'];
} }
$sortBy = $advancedCustom->sortVideoListByDefault->value; $sortBy = $advancedCustom->sortVideoListByDefault->value;
@ -43,7 +43,7 @@ if (empty($_REQUEST['rowCount']) && empty($_SESSION['rowCount'])) {
$jsonRowCountArray = _json_decode($advancedCustom->videosListRowCount); $jsonRowCountArray = _json_decode($advancedCustom->videosListRowCount);
if(empty($jsonRowCountArray) || !is_array($jsonRowCountArray)){ if(empty($jsonRowCountArray) || !is_array($jsonRowCountArray)){
$jsonRowCountArray = array(10,20,30,40,50); $jsonRowCountArray = [10,20,30,40,50];
} }
if (!in_array($_SESSION['rowCount'], $jsonRowCountArray)) { if (!in_array($_SESSION['rowCount'], $jsonRowCountArray)) {
@ -53,7 +53,7 @@ if (!in_array($_SESSION['rowCount'], $jsonRowCountArray)) {
$_REQUEST['rowCount'] = $_SESSION['rowCount']; $_REQUEST['rowCount'] = $_SESSION['rowCount'];
$_SESSION['sortBy'] = $sortBy; $_SESSION['sortBy'] = $sortBy;
$_POST['sort'] = array(); $_POST['sort'] = [];
foreach ($sortOptions as $value) { foreach ($sortOptions as $value) {
//var_dump($sortBy, strtolower($value['sortBy']), $sortBy === strtolower($value['sortBy']));echo '<hr>'; //var_dump($sortBy, strtolower($value['sortBy']), $sortBy === strtolower($value['sortBy']));echo '<hr>';
if ($sortBy === strtolower($value['sortBy'])) { if ($sortBy === strtolower($value['sortBy'])) {
@ -94,10 +94,10 @@ $objGallery = AVideoPlugin::getObjectData("Gallery");
?> ?>
<div class="col-md-8 col-sm-12 " style="position: relative; z-index: 10;" > <div class="col-md-8 col-sm-12 " style="position: relative; z-index: 10;" >
<?php <?php
$optionsArray = array(); $optionsArray = [];
$selected = false; $selected = false;
foreach ($sortOptions as $value) { foreach ($sortOptions as $value) {
$optionsArray[] = array(htmlentities("{$value['data-icon']} {$value['label']}"), $value['sortBy'], 'order="' . $value['order'] . '" key="' . $value['key'] . '"'); $optionsArray[] = [htmlentities("{$value['data-icon']} {$value['label']}"), $value['sortBy'], 'order="' . $value['order'] . '" key="' . $value['key'] . '"'];
//var_dump($sortBy, strtolower($value['sortBy']), $sortBy === strtolower($value['sortBy']));echo '<hr>'; //var_dump($sortBy, strtolower($value['sortBy']), $sortBy === strtolower($value['sortBy']));echo '<hr>';
if ($sortBy === strtolower($value['sortBy'])) { if ($sortBy === strtolower($value['sortBy'])) {
$selected = $value['sortBy']; $selected = $value['sortBy'];