diff --git a/locale/function.php b/locale/function.php
index d3142c922d..9a4887ec57 100644
--- a/locale/function.php
+++ b/locale/function.php
@@ -132,44 +132,61 @@ function setSiteLang() {
global $config, $global;
if (empty($global['systemRootPath'])) {
if (function_exists('getLanguageFromBrowser')) {
+ includeConfigLog(__LINE__, basename(__FILE__));
setLanguage(getLanguageFromBrowser());
} else {
+ includeConfigLog(__LINE__, basename(__FILE__));
setLanguage('en_US');
}
+ includeConfigLog(__LINE__, basename(__FILE__));
} else {
+ includeConfigLog(__LINE__, basename(__FILE__));
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
$userLocation = false;
+ includeConfigLog(__LINE__, basename(__FILE__));
$obj = AVideoPlugin::getDataObjectIfEnabled('User_Location');
+ includeConfigLog(__LINE__, basename(__FILE__));
$userLocation = !empty($obj) && !empty($obj->autoChangeLanguage);
if (!empty($_GET['lang'])) {
+ includeConfigLog(__LINE__, basename(__FILE__));
_session_start();
+ includeConfigLog(__LINE__, basename(__FILE__));
setLanguage($_GET['lang']);
} else if ($userLocation) {
+ includeConfigLog(__LINE__, basename(__FILE__));
User_Location::changeLang();
}
+ includeConfigLog(__LINE__, basename(__FILE__));
try {
if (empty($config) || !is_object($config)) {
+ includeConfigLog(__LINE__, basename(__FILE__));
require_once $global['systemRootPath'] . 'objects/configuration.php';
if (class_exists('Configuration')) {
$config = new Configuration();
} else {
//_error_log("setSiteLang ERROR 1 systemRootPath=[{$global['systemRootPath']}] " . json_encode(debug_backtrace()));
}
+ includeConfigLog(__LINE__, basename(__FILE__));
}
} catch (Exception $exc) {
_error_log("setSiteLang ERROR 2 systemRootPath=[{$global['systemRootPath']}] " . $exc->getMessage() . ' ' . json_encode(debug_backtrace()));
}
if (empty($_SESSION['language']) && is_object($config)) {
+ includeConfigLog(__LINE__, basename(__FILE__));
setLanguage($config->getLanguage());
+ includeConfigLog(__LINE__, basename(__FILE__));
}
if (empty($_SESSION['language'])) {
if (function_exists('getLanguageFromBrowser')) {
+ includeConfigLog(__LINE__, basename(__FILE__));
setLanguage(getLanguageFromBrowser());
} else {
+ includeConfigLog(__LINE__, basename(__FILE__));
setLanguage('en_US');
}
+ includeConfigLog(__LINE__, basename(__FILE__));
}
}
}
diff --git a/objects/Object.php b/objects/Object.php
index 92ad6436e6..481887c3a3 100644
--- a/objects/Object.php
+++ b/objects/Object.php
@@ -1093,7 +1093,7 @@ abstract class CacheHandler {
_session_start();
clearCache(true);
unset($_SESSION['user']['sessionCache']);
- session_write_close();
+ _session_write_close();
$dir = ObjectYPT::getTmpCacheDir() . $prefix;
return exec("rm -R {$dir}");
}
diff --git a/objects/category.php b/objects/category.php
index e101e13cea..dda888308d 100644
--- a/objects/category.php
+++ b/objects/category.php
@@ -447,11 +447,9 @@ class Category
//_error_log("getAllCategories id={$row['id']} line=".__LINE__);
$totals = self::getTotalFromCategory($row['id']);
-
if ($onlyWithVideos && empty($totals['total'])) {
continue;
}
-
//_error_log("getAllCategories id={$row['id']} line=".__LINE__);
$fullTotals = self::getTotalFromCategory($row['id'], false, true, true);
@@ -475,9 +473,11 @@ class Category
//_error_log("getAllCategories id={$row['id']} line=".__LINE__);
$row['description_html'] = textToLink(htmlentities("{$row['description']}"));
$category[] = $row;
+ //break;
}
+ $result = $cacheHandler->setCache($category);
+ //var_dump($category, $result);exit;
- $cacheHandler->setCache($category);
} else {
$category = false;
//die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
@@ -631,11 +631,21 @@ class Category
public static function getTotalFromCategory($categories_id, $showUnlisted = false, $getAllVideos = false, $renew = false)
{
- $videos = self::getTotalVideosFromCategory($categories_id, $showUnlisted, $getAllVideos, $renew);
- $lives = self::getTotalLivesFromCategory($categories_id, $showUnlisted, $renew);
- $livelinkss = self::getTotalLiveLinksFromCategory($categories_id, $showUnlisted, $renew);
- $total = $videos + $lives + $livelinkss;
- return ['videos' => $videos, 'lives' => $lives, 'livelinks' => $livelinkss, 'total' => $total];
+ $cacheSuffix = "getTotalFromCategory_{$categories_id}_".intval($showUnlisted).intval($getAllVideos);
+ $cacheHandler = new CategoryCacheHandler(0);
+ $result = $cacheHandler->getCache($cacheSuffix, 0);
+ if(empty($result)){
+ $videos = self::getTotalVideosFromCategory($categories_id, $showUnlisted, $getAllVideos, $renew);
+ $lives = self::getTotalLivesFromCategory($categories_id, $showUnlisted, $renew);
+ $livelinkss = self::getTotalLiveLinksFromCategory($categories_id, $showUnlisted, $renew);
+ $total = $videos + $lives + $livelinkss;
+ $result = ['videos' => $videos, 'lives' => $lives, 'livelinks' => $livelinkss, 'total' => $total];
+ $cacheHandler->setCache($result);
+ }else{
+ $result = object_to_array($result);
+ }
+
+ return $result;
}
public static function getTotalFromChildCategory($categories_id, $showUnlisted = false, $getAllVideos = false, $renew = false)
diff --git a/objects/functions.php b/objects/functions.php
index a315dd55f6..dca4dd8198 100644
--- a/objects/functions.php
+++ b/objects/functions.php
@@ -700,7 +700,7 @@ function setSiteSendMessage(\PHPMailer\PHPMailer\PHPMailer &$mail)
$mail->isSendmail();
}
// do not let the system hang on email send
- session_write_close();
+ _session_write_close();
}
/**
@@ -3144,7 +3144,7 @@ function url_get_contents($url, $ctx = "", $timeout = 0, $debug = false, $mantai
if (isSameDomainAsMyAVideo($url) || $mantainSession) {
$session_cookie = session_name() . '=' . session_id();
- session_write_close();
+ _session_write_close();
}
if (empty($ctx)) {
$opts = [
@@ -3955,7 +3955,7 @@ function siteMap()
_error_log("siteMap: start");
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 0);
- @session_write_close();
+ @_session_write_close();
global $global, $advancedCustom;
$totalCategories = 0;
@@ -4984,6 +4984,14 @@ function postVariables($url, $array, $httpcodeOnly = true, $timeout = 10)
}
}
+function _session_write_close(){
+ if (session_status() === PHP_SESSION_ACTIVE) {
+ includeConfigLog(__LINE__, 'session_write_close '.basename(__FILE__));
+ _error_log(json_encode(debug_backtrace()));
+ @session_write_close();
+ }
+}
+
function _session_start(array $options = [])
{
try {
@@ -4992,12 +5000,11 @@ function _session_start(array $options = [])
unset($_GET['PHPSESSID']);
if (!User::isLogged()) {
if ($PHPSESSID !== session_id()) {
- if (session_status() !== PHP_SESSION_NONE) {
- @session_write_close();
- }
+ _session_write_close();
session_id($PHPSESSID);
//_error_log("captcha: session_id changed to {$PHPSESSID}");
}
+ includeConfigLog(__LINE__, 'session_start '.basename(__FILE__));
$session = @session_start($options);
if (preg_match('/objects\/getCaptcha\.php/i', $_SERVER['SCRIPT_NAME'])) {
@@ -5012,6 +5019,8 @@ function _session_start(array $options = [])
//_error_log("captcha: user logged we will not change the session ID PHPSESSID={$PHPSESSID} session_id=" . session_id());
}
} elseif (session_status() == PHP_SESSION_NONE) {
+ includeConfigLog(__LINE__, 'session_start '.basename(__FILE__));
+ //_error_log(json_encode(debug_backtrace()));
return @session_start($options);
}
} catch (Exception $exc) {
@@ -5265,7 +5274,7 @@ function getUsageFromFilename($filename, $dir = "")
$files = globVideosDir($filename);
}
//var_dump($paths, $files, $filename);exit;
- session_write_close();
+ _session_write_close();
$filesProcessed = [];
if (empty($files)) {
_error_log("getUsageFromFilename: we did not find any file for {$dir}{$filename}, we will create a fake one " . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
@@ -8331,7 +8340,7 @@ function convertVideoFileWithFFMPEG($fromFileLocation, $toFileLocation, $try = 0
$command .= " 1> {$progressFileEscaped} 2>&1";
$command = removeUserAgentIfNotURL($command);
_error_log("convertVideoFileWithFFMPEG try[{$try}]: " . $command);
- session_write_close();
+ _session_write_close();
_mysql_close();
exec($command, $output, $return);
_session_start();
@@ -9345,7 +9354,7 @@ function outputAndContinueInBackground($msg = '')
return false;
}
$outputAndContinueInBackground = 1;
- @session_write_close();
+ @_session_write_close();
//_mysql_close();
// Instruct PHP to continue execution
ignore_user_abort(true);
diff --git a/objects/getAllVideosAsync.php b/objects/getAllVideosAsync.php
index a39ac0350c..33ede3ab95 100644
--- a/objects/getAllVideosAsync.php
+++ b/objects/getAllVideosAsync.php
@@ -2,7 +2,7 @@
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
//getAllVideosAsync($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
-session_write_close();
+_session_write_close();
$status = $argv[1];
$showOnlyLoggedUserVideos = $argv[2];
$ignoreGroup = $argv[3];
diff --git a/objects/getImageFromFilenameAsync.php b/objects/getImageFromFilenameAsync.php
index ee1b6e2480..c8b063a04e 100644
--- a/objects/getImageFromFilenameAsync.php
+++ b/objects/getImageFromFilenameAsync.php
@@ -3,7 +3,7 @@ require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
//getTotalVideosInfo($status = "viewable", $showOnlyLoggedUserVideos = false,
//$ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false)
-session_write_close();
+_session_write_close();
$filename = $argv[1];
$type = $argv[2];
$cacheFileName = $argv[3];
diff --git a/objects/getTags.php b/objects/getTags.php
index 6a05567be1..2c16957e37 100644
--- a/objects/getTags.php
+++ b/objects/getTags.php
@@ -3,7 +3,7 @@ require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
//getTotalVideosInfo($status = "viewable", $showOnlyLoggedUserVideos = false,
//$ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false)
-session_write_close();
+_session_write_close();
$video_id = $argv[1];
$type = $argv[2];
$cacheFileName = $argv[3];
diff --git a/objects/getTotalVideosInfoAsync.php b/objects/getTotalVideosInfoAsync.php
index e01bb085b6..5bdca08f50 100644
--- a/objects/getTotalVideosInfoAsync.php
+++ b/objects/getTotalVideosInfoAsync.php
@@ -4,7 +4,7 @@ require_once $global['systemRootPath'] . 'objects/video.php';
//getTotalVideosInfo($status = "viewable", $showOnlyLoggedUserVideos = false,
//$ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false)
-session_write_close();
+_session_write_close();
$status = $argv[1];
$showOnlyLoggedUserVideos = boolval($argv[2]);
$ignoreGroup = boolval($argv[3]);
diff --git a/objects/include_config.php b/objects/include_config.php
index ae772f19b0..56de1a7771 100644
--- a/objects/include_config.php
+++ b/objects/include_config.php
@@ -51,10 +51,14 @@ function includeConfigLog($line, $desc=''){
if(empty($_REQUEST['debug'])){
return false;
}
- global $global;
- $seconds = number_format(microtime(true) - $global['avideoStartMicrotime'], 4);
- $msg = "includeConfigLog: {$seconds} seconds line={$line} {$desc}";
- echo $msg."
".PHP_EOL;
+ global $global, $_includeConfigLogID, $_includeConfigLogLastCheck;
+ if(!isset($_includeConfigLogID)){
+ $_includeConfigLogID = date('H:i:s');
+ }
+ $_includeConfigLogLastCheck = microtime(true);
+ $seconds = number_format($_includeConfigLogLastCheck - $global['avideoStartMicrotime'], 4);
+ $msg = "includeConfigLog[$_includeConfigLogID]: {$seconds} seconds line={$line} {$desc}";
+ //echo $msg."
".PHP_EOL;
error_log($msg);
}
includeConfigLog(__LINE__);
@@ -130,7 +134,7 @@ $global['dont_show_us_flag'] = false;
if (empty($doNotStartSessionbaseIncludeConfig)) {
$config = new Configuration();
//var_dump($config);exit;
- @session_write_close();
+ @_session_write_close();
// server should keep session data for AT LEAST 1 hour
ini_set('session.gc_maxlifetime', $config->getSession_timeout());
diff --git a/objects/login.json.php b/objects/login.json.php
index 99fbe24ffc..f061dbd0a6 100644
--- a/objects/login.json.php
+++ b/objects/login.json.php
@@ -344,6 +344,6 @@ $json = _json_encode($object);
//_error_log("login.json.php complete");
//header("Content-length: " . strlen($json));
//_error_log('login.json.php is done '.User::getId());
-session_write_close();
+_session_write_close();
echo $json;
exit;
\ No newline at end of file
diff --git a/objects/mysql_dal.php b/objects/mysql_dal.php
index 17e8f460ab..396398ae01 100644
--- a/objects/mysql_dal.php
+++ b/objects/mysql_dal.php
@@ -103,15 +103,17 @@ class sqlDAL
* @var object $global['mysqli']
*/
// make sure it does not store autid transactions
- $debug = debug_backtrace();
- if (empty($debug[2]['class']) || $debug[2]['class'] !== "AuditTable") {
- $audit = AVideoPlugin::loadPluginIfEnabled('Audit');
- if (!empty($audit)) {
- try {
- $audit->exec(@$debug[1]['function'], @$debug[1]['class'], $preparedStatement, $formats, json_encode($values), User::getId());
- } catch (Exception $exc) {
- _error_log('Error in writeSql: ' . $global['mysqli']->errno . " " . $global['mysqli']->error . ' ' . $preparedStatement);
- log_error($exc->getTraceAsString());
+ if(strpos($preparedStatement, 'CachesInDB')===false){
+ $debug = debug_backtrace();
+ if (empty($debug[2]['class']) || $debug[2]['class'] !== "AuditTable") {
+ $audit = AVideoPlugin::loadPluginIfEnabled('Audit');
+ if (!empty($audit)) {
+ try {
+ $audit->exec(@$debug[1]['function'], @$debug[1]['class'], $preparedStatement, $formats, json_encode($values), User::getId());
+ } catch (Exception $exc) {
+ _error_log('Error in writeSql: ' . $global['mysqli']->errno . " " . $global['mysqli']->error . ' ' . $preparedStatement);
+ log_error($exc->getTraceAsString());
+ }
}
}
}
diff --git a/objects/playlists.json.php b/objects/playlists.json.php
index fdc495a0d9..9b40b38048 100644
--- a/objects/playlists.json.php
+++ b/objects/playlists.json.php
@@ -8,7 +8,7 @@ if (!User::isLogged()) {
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
header('Content-Type: application/json');
-session_write_close();
+_session_write_close();
//mysqlBeginTransaction();
$row = PlayList::getAllFromUser(User::getId(), false);
foreach ($row as $key => $value) {
diff --git a/objects/playlistsFromUser.json.php b/objects/playlistsFromUser.json.php
index da4a89517a..53652b31d7 100644
--- a/objects/playlistsFromUser.json.php
+++ b/objects/playlistsFromUser.json.php
@@ -3,7 +3,7 @@ global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
-session_write_close();
+_session_write_close();
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Content-Type");
header('Content-Type: application/json');
@@ -15,7 +15,7 @@ require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once './playlist.php';
header('Content-Type: application/json');
_error_log('playlistsFromUserVideos getAllFromUser '.$_GET['users_id']);
-session_write_close();
+_session_write_close();
$row = PlayList::getAllFromUser($_GET['users_id'], false);
foreach ($row as $key => $value) {
foreach ($row[$key]['videos'] as $key2 => $value2) {
diff --git a/objects/playlistsFromUserVideos.json.php b/objects/playlistsFromUserVideos.json.php
index c12f9acdd5..21acc57472 100644
--- a/objects/playlistsFromUserVideos.json.php
+++ b/objects/playlistsFromUserVideos.json.php
@@ -7,25 +7,25 @@ if (!isset($global['systemRootPath'])) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
header('Content-Type: application/json');
-if (empty($_POST['users_id'])) {
- die('You need a user');
+if (empty($_REQUEST['users_id'])) {
+ forbiddenPage('You need a user');
}
if (session_status() !== PHP_SESSION_NONE) {
- session_write_close();
+ _session_write_close();
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once './playlist.php';
header('Content-Type: application/json');
//mysqlBeginTransaction();
-if (is_array($_POST['videos_id'])) {
+if (is_array($_REQUEST['videos_id'])) {
$rows = [];
- foreach ($_POST['videos_id'] as $value) {
- $rows[] = ['videos_id' => $value, 'playlists' => PlayList::getAllFromUserVideo($_POST['users_id'], $value, false)];
+ foreach ($_REQUEST['videos_id'] as $value) {
+ $rows[] = ['videos_id' => $value, 'playlists' => PlayList::getAllFromUserVideo($_REQUEST['users_id'], $value, false)];
}
echo json_encode($rows);
} else {
- $row = PlayList::getAllFromUserVideo($_POST['users_id'], $_POST['videos_id'], false);
+ $row = PlayList::getAllFromUserVideo($_REQUEST['users_id'], $_REQUEST['videos_id'], false);
echo json_encode($row);
}
//mysqlCommit();
\ No newline at end of file
diff --git a/objects/playlistsPublic.json.php b/objects/playlistsPublic.json.php
index d884d76575..ab2a545bcc 100644
--- a/objects/playlistsPublic.json.php
+++ b/objects/playlistsPublic.json.php
@@ -8,7 +8,7 @@ if (!User::isLogged()) {
}
require_once $global['systemRootPath'] . 'objects/playlist.php';
header('Content-Type: application/json');
-session_write_close();
+_session_write_close();
setRowCount(10);
//mysqlBeginTransaction();
$row = PlayList::getAll('public', @$_REQUEST['Playlists_id']);
diff --git a/objects/playlistsVideos.json.php b/objects/playlistsVideos.json.php
index 9cc1ee19b7..1ebf47f709 100644
--- a/objects/playlistsVideos.json.php
+++ b/objects/playlistsVideos.json.php
@@ -3,9 +3,6 @@ header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Content-Type");
header('Content-Type: application/json');
global $global, $config;
-if (!empty($_GET) && empty($_POST)) {
- $_POST = $_GET;
-}
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
@@ -15,21 +12,20 @@ require_once 'subscribe.php';
// gettig the mobile submited value
$inputJSON = url_get_contents('php://input');
$input = _json_decode($inputJSON, true); //convert JSON into array
-if (!empty($input) && empty($_POST)) {
+if (!empty($input) && empty($_REQUEST)) {
foreach ($input as $key => $value) {
- $_POST[$key]=$value;
+ $_REQUEST[$key]=$value;
}
}
-if (!empty($_POST['user']) && !empty($_POST['pass'])) {
- $user = new User(0, $_POST['user'], $_POST['pass']);
+if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
+ $user = new User(0, $_REQUEST['user'], $_REQUEST['pass']);
$user->login(false, true);
}
-if (empty($_POST['playlists_id'])) {
+if (empty($_REQUEST['playlists_id'])) {
die('Play List can not be empty');
}
-
require_once './playlist.php';
-$videos = PlayList::getVideosFromPlaylist($_POST['playlists_id']);
+$videos = PlayList::getVideosFromPlaylist($_REQUEST['playlists_id']);
$objMob = AVideoPlugin::getObjectData("MobileManager");
$index = 0;
foreach ($videos as $key => $value) {
@@ -41,11 +37,11 @@ foreach ($videos as $key => $value) {
$videos[$key]['imageClass'] = !empty($objMob->portraitImage) ? "portrait" : "landscape";
$videos[$key]['VideoUrl'] = getVideosURL($videos[$key]['filename']);
$videos[$key]['createdHumanTiming'] = humanTiming(strtotime($videos[$key]['created']));
- $videos[$key]['pageUrl'] = PlayLists::getLink($_POST['playlists_id'], false, $index);
- $videos[$key]['embedUrl'] = PlayLists::getLink($_POST['playlists_id'], true, $index);
- unset($_POST['sort'], $_POST['current'], $_POST['searchPhrase']);
+ $videos[$key]['pageUrl'] = PlayLists::getLink($_REQUEST['playlists_id'], false, $index);
+ $videos[$key]['embedUrl'] = PlayLists::getLink($_REQUEST['playlists_id'], true, $index);
+ unset($_REQUEST['sort'], $_REQUEST['current'], $_REQUEST['searchPhrase']);
$_REQUEST['rowCount'] = 10;
- $_POST['sort']['created'] = "desc";
+ $_REQUEST['sort']['created'] = "desc";
$videos[$key]['comments'] = Comment::getAllComments($videos[$key]['id']);
$videos[$key]['commentsTotal'] = Comment::getTotalComments($videos[$key]['id']);
$videos[$key]['comments'] = Comment::addExtraInfo($videos[$key]['comments']);
diff --git a/objects/user.php b/objects/user.php
index 795b318694..a69d624fe1 100644
--- a/objects/user.php
+++ b/objects/user.php
@@ -1115,7 +1115,7 @@ if (typeof gtag !== \"function\") {
AVideoPlugin::onUserSignIn($_SESSION['user']['id']);
$_SESSION['loginAttempts'] = 0;
_session_regenerate_id();
- session_write_close();
+ _session_write_close();
_error_log('User:login finish users_id=' . json_encode($_SESSION['user']['id']));
return self::USER_LOGGED;
@@ -1221,7 +1221,7 @@ if (typeof gtag !== \"function\") {
$params["httponly"]
);
}
- session_write_close();
+ _session_write_close();
}
private static function recreateLoginFromCookie()
diff --git a/objects/userAddNew.json.php b/objects/userAddNew.json.php
index df9c32fc48..6a9901e94d 100644
--- a/objects/userAddNew.json.php
+++ b/objects/userAddNew.json.php
@@ -25,7 +25,7 @@ if(!isTokenValid($_REQUEST['securityToken'])){
forbiddenPage('Security token is invalid');
}
-session_write_close();
+_session_write_close();
if (!empty($advancedCustomUser->forceLoginToBeTheEmail)) {
$_POST['email'] = $_POST['user'];
}
diff --git a/objects/users.json.php b/objects/users.json.php
index 8e4f4a09e1..1b6dec5eb3 100644
--- a/objects/users.json.php
+++ b/objects/users.json.php
@@ -7,7 +7,7 @@ if (!isset($global['systemRootPath'])) {
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
header('Content-Type: application/json');
-session_write_close();
+_session_write_close();
$canAdminUsers = canAdminUsers();
if (empty($_POST['current'])) {
$_POST['current'] = 1;
diff --git a/objects/videoUpdateUsage.json.php b/objects/videoUpdateUsage.json.php
index 5cf9dc67e0..8a91b4a142 100644
--- a/objects/videoUpdateUsage.json.php
+++ b/objects/videoUpdateUsage.json.php
@@ -6,7 +6,7 @@ global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
-session_write_close();
+_session_write_close();
$obj = new stdClass();
$obj->msg = '';
$obj->error = true;
diff --git a/objects/video_statistic_getTotalLastDays.php b/objects/video_statistic_getTotalLastDays.php
index 0934eb0a33..3262c77183 100644
--- a/objects/video_statistic_getTotalLastDays.php
+++ b/objects/video_statistic_getTotalLastDays.php
@@ -1,7 +1,7 @@
getDataObject();
$oldId = session_id();
if (session_status() !== PHP_SESSION_NONE) {
- session_write_close();
+ _session_write_close();
}
session_id($_GET['vmap_id']);
if (session_status() == PHP_SESSION_NONE) {
@@ -303,7 +303,7 @@ class AD_Server extends PluginAbstract {
}
$adRandomPositions = $_SESSION['adRandomPositions'];
if (session_status() !== PHP_SESSION_NONE) {
- session_write_close();
+ _session_write_close();
}
session_id($oldId);
if (session_status() == PHP_SESSION_NONE) {
diff --git a/plugin/AD_Server/Objects/VastCampaignsLogs.php b/plugin/AD_Server/Objects/VastCampaignsLogs.php
index 87d1f0d74d..4d3866a4cf 100644
--- a/plugin/AD_Server/Objects/VastCampaignsLogs.php
+++ b/plugin/AD_Server/Objects/VastCampaignsLogs.php
@@ -1,9 +1,10 @@
errno . ') ' . $global['mysqli']->error);
- }
+ }
return $data;
}
@@ -123,9 +122,7 @@ class VastCampaignsLogs extends ObjectYPT
foreach ($fullData as $row) {
$data[$row['type']] = $row['total'];
}
- } else {
- die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
- }
+ }
return $data;
}
}
diff --git a/plugin/AD_Server/Objects/VastCampaignsVideos.php b/plugin/AD_Server/Objects/VastCampaignsVideos.php
index 8c43267b1e..d113c6b3a9 100644
--- a/plugin/AD_Server/Objects/VastCampaignsVideos.php
+++ b/plugin/AD_Server/Objects/VastCampaignsVideos.php
@@ -1,8 +1,10 @@
error = true;
diff --git a/plugin/CDN/downloadProgress.json.php b/plugin/CDN/downloadProgress.json.php
index 1d1980802e..2c5c13802f 100644
--- a/plugin/CDN/downloadProgress.json.php
+++ b/plugin/CDN/downloadProgress.json.php
@@ -1,7 +1,7 @@
error = true;
diff --git a/plugin/CDN/status.json.php b/plugin/CDN/status.json.php
index 37d697b24c..183891c237 100644
--- a/plugin/CDN/status.json.php
+++ b/plugin/CDN/status.json.php
@@ -1,7 +1,7 @@
error = true;
diff --git a/plugin/CustomizeUser/getMyAccount.save.json.php b/plugin/CustomizeUser/getMyAccount.save.json.php
index eab6d0b1c7..b7712a521b 100644
--- a/plugin/CustomizeUser/getMyAccount.save.json.php
+++ b/plugin/CustomizeUser/getMyAccount.save.json.php
@@ -1,6 +1,6 @@
error = true;
diff --git a/plugin/CustomizeUser/set.json.php b/plugin/CustomizeUser/set.json.php
index ae6a2fc09e..9572391d67 100644
--- a/plugin/CustomizeUser/set.json.php
+++ b/plugin/CustomizeUser/set.json.php
@@ -1,6 +1,6 @@
here to join our live.";
}
TimeLogEnd($timeName, __LINE__);
- session_write_close();
+ _session_write_close();
$obj = new stdClass();
$obj->error = true;
$obj->msg = "OFFLINE";
diff --git a/plugin/Live/asyncGetStats.php b/plugin/Live/asyncGetStats.php
index eeef6bc30b..e5bfe3a591 100644
--- a/plugin/Live/asyncGetStats.php
+++ b/plugin/Live/asyncGetStats.php
@@ -8,7 +8,7 @@ if (!isset($global['systemRootPath'])) {
}
require_once $configFile;
}
-session_write_close();
+_session_write_close();
_mysql_close();
if (!isCommandLineInterface() && empty($byPassCommandLine)) {
die('Command Line only');
diff --git a/plugin/Live/getImage.php b/plugin/Live/getImage.php
index 1658fde255..831e21142e 100644
--- a/plugin/Live/getImage.php
+++ b/plugin/Live/getImage.php
@@ -40,7 +40,7 @@ if (file_exists($cacheFileImageName) && (time() - $lifetime <= filemtime($cacheF
}
require_once dirname(__FILE__) . '/../../videos/configuration.php';
-session_write_close();
+_session_write_close();
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmition.php';
$_REQUEST['live_servers_id'] = Live::getLiveServersIdRequest();
if (!empty($_GET['c'])) {
@@ -146,7 +146,7 @@ if (!empty($result) && !Live::isDefaultImage($result)) {
//_error_log("Live:getImage $url");
//header('Content-Type: text/plain');var_dump($url);exit;
- session_write_close();
+ _session_write_close();
_mysql_close();
$content = url_get_contents($url, '', 2);
diff --git a/plugin/Live/isLiveRunning.json.php b/plugin/Live/isLiveRunning.json.php
index a1ca3ac926..924695df4a 100644
--- a/plugin/Live/isLiveRunning.json.php
+++ b/plugin/Live/isLiveRunning.json.php
@@ -2,7 +2,7 @@
header('Content-Type: application/json');
require_once '../../videos/configuration.php';
-session_write_close();
+_session_write_close();
$obj = new stdClass();
$obj->error = true;
diff --git a/plugin/Live/m3u8.php b/plugin/Live/m3u8.php
index 3b00446253..5e166c1164 100644
--- a/plugin/Live/m3u8.php
+++ b/plugin/Live/m3u8.php
@@ -3,7 +3,7 @@
$recheckTolerance = 600; // 10 min
require_once dirname(__FILE__) . '/../../videos/configuration.php';
error_reporting(0);
-session_write_close();
+_session_write_close();
if (empty($_GET['uuid'])) {
die("uuid empty");
diff --git a/plugin/Live/standAloneFiles/restreamer.json.php b/plugin/Live/standAloneFiles/restreamer.json.php
index 7c05b0f8f3..c29a8848b4 100644
--- a/plugin/Live/standAloneFiles/restreamer.json.php
+++ b/plugin/Live/standAloneFiles/restreamer.json.php
@@ -280,7 +280,7 @@ $robj->logFile = $obj->logFile;
if (function_exists('_mysql_close')) {
_mysql_close();
}
-session_write_close();
+_session_write_close();
error_log("Restreamer.json.php starting async ");
Loop::run(function () {
global $robj;
diff --git a/plugin/Live/stats.json.php b/plugin/Live/stats.json.php
index 9cdfa24b44..ad0e87f86a 100644
--- a/plugin/Live/stats.json.php
+++ b/plugin/Live/stats.json.php
@@ -1,5 +1,5 @@
server_type->value)) {
ini_set('max_execution_time', 180);
diff --git a/plugin/LiveLinks/getImage.php b/plugin/LiveLinks/getImage.php
index 74e063adb5..a032a63bb2 100644
--- a/plugin/LiveLinks/getImage.php
+++ b/plugin/LiveLinks/getImage.php
@@ -29,7 +29,7 @@ if (file_exists($cacheFileImageName) && (time() - $lifetime <= filemtime($cacheF
}
require_once dirname(__FILE__) . '/../../videos/configuration.php';
-session_write_close();
+_session_write_close();
$filename = $global['systemRootPath'] . 'plugin/Live/view/OnAir.jpg';
//echo file_get_contents($filename);exit;
@@ -74,7 +74,7 @@ if (preg_match("/\b(?:(?:https?):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+
$content = '';
}
if(empty($content)){
- session_write_close();
+ _session_write_close();
_mysql_close();
$content = url_get_contents($url, "", 4);
if(!empty($content)){
diff --git a/plugin/LiveLinks/proxy.php b/plugin/LiveLinks/proxy.php
index 25f523c18c..abf384cbce 100644
--- a/plugin/LiveLinks/proxy.php
+++ b/plugin/LiveLinks/proxy.php
@@ -2,7 +2,7 @@
$doNotConnectDatabaseIncludeConfig = 1;
$doNotStartSessionbaseIncludeConfig = 1;
require_once '../../videos/configuration.php';
-session_write_close();
+_session_write_close();
_mysql_close();
diff --git a/plugin/LoginControl/set.json.php b/plugin/LoginControl/set.json.php
index 59f7d1cb9c..7968ccbfc0 100644
--- a/plugin/LoginControl/set.json.php
+++ b/plugin/LoginControl/set.json.php
@@ -1,6 +1,6 @@
error = true;
diff --git a/plugin/Plugin.abstract.php b/plugin/Plugin.abstract.php
index d56dd39f26..3da5baf442 100644
--- a/plugin/Plugin.abstract.php
+++ b/plugin/Plugin.abstract.php
@@ -238,9 +238,9 @@ abstract class PluginAbstract {
}
}
- PluginAbstract::$dataObject[$this->getUUID()] = $wholeObjects;
+ PluginAbstract::$dataObject[$uuid] = $wholeObjects;
} else {
- $wholeObjects = PluginAbstract::$dataObject[$this->getUUID()];
+ $wholeObjects = PluginAbstract::$dataObject[$uuid];
}
//var_dump($obj['object_data']);
//var_dump($eo, $o, (object) array_merge((array) $eo, (array) $o));exit;
diff --git a/plugin/Scheduler/run.php b/plugin/Scheduler/run.php
index b0766c4e93..ea24823db4 100644
--- a/plugin/Scheduler/run.php
+++ b/plugin/Scheduler/run.php
@@ -24,12 +24,12 @@ if(!isCommandLineInterface()){
echo '
'; } if(empty($rows)){ - echo ("Scheduler row is empty".PHP_EOL); + //echo ("Scheduler row is empty".PHP_EOL); } $rows2 = Scheduler_commands::getAllScheduledTORepeat(); if(empty($rows)){ - echo ("Scheduler row2 is empty".PHP_EOL); + //echo ("Scheduler row2 is empty".PHP_EOL); } $total3 = count($rows2); //_log("There are {$total1} active requests; getAllActiveAndReady={$total2} getAllScheduledTORepeat={$total3} on time ". json_encode(Scheduler_commands::getTimesNow())); @@ -51,7 +51,7 @@ foreach ($rows2 as $value) { } $lastVisitFile = Scheduler::setLastVisit(); if(!empty($lastVisitFile) && !empty($lastVisitFile['size'])){ - echo 'Saved '.json_encode($lastVisitFile); + //echo 'Saved '.json_encode($lastVisitFile); //_error_log("Last visit set {$lastVisitFile}"); }else{ $msg = 'ERROR: Last visit NOT set '.json_encode($lastVisitFile); diff --git a/plugin/VideoTags/VideoTags.php b/plugin/VideoTags/VideoTags.php index 9dcd3c30f3..27913cea28 100644 --- a/plugin/VideoTags/VideoTags.php +++ b/plugin/VideoTags/VideoTags.php @@ -56,7 +56,7 @@ class VideoTags extends PluginAbstract { session_start(); } unset($_SESSION['getVideoTags'][$videos_id]); - session_write_close(); + _session_write_close(); TimeLogEnd(__FILE__ . "::" . __FUNCTION__, __LINE__); if ($deleted) { foreach ($tagsNameList as $value) { diff --git a/plugin/VideoTags/tags.json.php b/plugin/VideoTags/tags.json.php index 0eca109f9e..26a695cc45 100644 --- a/plugin/VideoTags/tags.json.php +++ b/plugin/VideoTags/tags.json.php @@ -1,6 +1,6 @@ serverVersion = YPTSocket::getServerVersion(); @ob_end_flush(); _mysql_close(); -session_write_close(); +_session_write_close(); exec('ulimit -n 20480'); // to handle over 1 k connections $SocketDataObj->port = intval($SocketDataObj->port); _error_log("Starting Socket server at port {$SocketDataObj->port}"); diff --git a/plugin/YPTSocket/server2.php b/plugin/YPTSocket/server2.php index 5efcad04fb..05c25f114d 100644 --- a/plugin/YPTSocket/server2.php +++ b/plugin/YPTSocket/server2.php @@ -25,7 +25,7 @@ $SocketDataObj->serverVersion = YPTSocket::getServerVersion(); ob_end_flush(); _mysql_close(); -session_write_close(); +_session_write_close(); exec('ulimit -n 20480'); // to handle over 1 k connections $SocketDataObj->port = intval($SocketDataObj->port); _error_log("Starting Socket server at port {$SocketDataObj->port}"); diff --git a/plugin/YPTSocket/serverCertbot.php b/plugin/YPTSocket/serverCertbot.php index 432e5e740d..6086a2149d 100644 --- a/plugin/YPTSocket/serverCertbot.php +++ b/plugin/YPTSocket/serverCertbot.php @@ -18,7 +18,7 @@ $SocketDataObj->serverVersion = YPTSocket::getServerVersion(); ob_end_flush(); _mysql_close(); -session_write_close(); +_session_write_close(); killProcessOnPort(); diff --git a/plugin/YPTSocket/stopServer.php b/plugin/YPTSocket/stopServer.php index 958395bc76..b5ab8db88c 100644 --- a/plugin/YPTSocket/stopServer.php +++ b/plugin/YPTSocket/stopServer.php @@ -18,6 +18,6 @@ $SocketDataObj->serverVersion = YPTSocket::getServerVersion(); ob_end_flush(); _mysql_close(); -session_write_close(); +_session_write_close(); killProcessOnPort(); \ No newline at end of file diff --git a/plugin/YouPHPFlix2/view/modeFlixCategory.php b/plugin/YouPHPFlix2/view/modeFlixCategory.php index 77f635fd20..3457fb19fe 100644 --- a/plugin/YouPHPFlix2/view/modeFlixCategory.php +++ b/plugin/YouPHPFlix2/view/modeFlixCategory.php @@ -3,7 +3,7 @@ global $global, $config; if (!isset($global['systemRootPath'])) { require_once '../../../videos/configuration.php'; } -session_write_close(); +_session_write_close(); require_once $global['systemRootPath'] . 'objects/video.php'; require_once $global['systemRootPath'] . 'objects/category.php'; diff --git a/plugin/YouPHPFlix2/view/modeFlixSerie.php b/plugin/YouPHPFlix2/view/modeFlixSerie.php index 6a19e40212..88750b1e01 100644 --- a/plugin/YouPHPFlix2/view/modeFlixSerie.php +++ b/plugin/YouPHPFlix2/view/modeFlixSerie.php @@ -10,7 +10,7 @@ if (empty($playlists_id)) { if (!isset($global['systemRootPath'])) { require_once '../../../videos/configuration.php'; } -session_write_close(); +_session_write_close(); $video = Video::getVideoFromSeriePlayListsId($playlists_id); if (empty($video)) { diff --git a/view/channel.php b/view/channel.php index 935614dfda..92d13161d3 100644 --- a/view/channel.php +++ b/view/channel.php @@ -9,7 +9,7 @@ require_once $global['systemRootPath'] . 'objects/video.php'; require_once $global['systemRootPath'] . 'objects/playlist.php'; require_once $global['systemRootPath'] . 'objects/subscribe.php'; require_once $global['systemRootPath'] . 'plugin/Gallery/functions.php'; -session_write_close(); +_session_write_close(); $user_id = isChannel(); $user = new User($user_id); if ($user->getStatus() === 'i') { diff --git a/view/channelPlaylistItems.php b/view/channelPlaylistItems.php index 45474c1a40..bd8d2c8302 100644 --- a/view/channelPlaylistItems.php +++ b/view/channelPlaylistItems.php @@ -8,7 +8,7 @@ require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/video.php'; require_once $global['systemRootPath'] . 'objects/playlist.php'; -session_write_close(); +_session_write_close(); if (empty($_GET['channelName'])) { if (User::isLogged()) { diff --git a/view/charts_head.php b/view/charts_head.php index e44613701f..53e193e361 100644 --- a/view/charts_head.php +++ b/view/charts_head.php @@ -1,7 +1,7 @@ Wrong captcha"; diff --git a/view/hls.php b/view/hls.php index dc5aa7dad9..cecf0f7b95 100644 --- a/view/hls.php +++ b/view/hls.php @@ -10,7 +10,7 @@ if (!isset($global['systemRootPath'])) { //_error_log("HLS.php: session_id = ". session_id()." IP = ". getRealIpAddr()." URL = ".($actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")); -session_write_close(); +_session_write_close(); if (empty($_GET['videoDirectory'])) { forbiddenPage("No directory set"); } diff --git a/view/img/image404.php b/view/img/image404.php index 8b1cca9641..1a33cc4dfe 100644 --- a/view/img/image404.php +++ b/view/img/image404.php @@ -5,7 +5,7 @@ include(dirname(__FILE__) . '/image404Raw.php'); // Load configuration $configFile = dirname(__FILE__) . '/../../videos/configuration.php'; require_once $configFile; -session_write_close(); +_session_write_close(); // Default image settings $file = ImagesPlaceHolders::getVideoPlaceholder(ImagesPlaceHolders::$RETURN_PATH); diff --git a/view/include/navbar.php b/view/include/navbar.php index 402a656b99..1a7554699c 100644 --- a/view/include/navbar.php +++ b/view/include/navbar.php @@ -1,4 +1,5 @@ keepViewerOnChannel)) { unset($_SESSION['channelName']); } } -session_write_close(); +_session_write_close(); global $includeDefaultNavBar, $global, $config, $advancedCustom, $advancedCustomUser; if (!isset($global['systemRootPath'])) { require_once '../videos/configuration.php'; diff --git a/view/managerVideos.php b/view/managerVideos.php index 7e7bcca2a4..0dbf5b3ce4 100644 --- a/view/managerVideos.php +++ b/view/managerVideos.php @@ -40,3 +40,6 @@ if (!empty($_GET['iframe'])) {