mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Function update
This commit is contained in:
parent
b5d4139547
commit
d5aa44dece
5 changed files with 21 additions and 8 deletions
|
@ -18,7 +18,7 @@ if(empty($_REQUEST['custom'])){
|
||||||
$dir = "{$global['systemRootPath']}videos/locale/";
|
$dir = "{$global['systemRootPath']}videos/locale/";
|
||||||
make_path($dir);
|
make_path($dir);
|
||||||
}
|
}
|
||||||
if (!is_writable($dir) && !isWindows()) {
|
if (!is_writable($dir) && !isWindowsServer()) {
|
||||||
$obj->status = 0;
|
$obj->status = 0;
|
||||||
$obj->error = sprintf(__("Your %s locale dir is not writable"), $global['systemRootPath']);
|
$obj->error = sprintf(__("Your %s locale dir is not writable"), $global['systemRootPath']);
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
|
|
|
@ -5225,11 +5225,23 @@ function getCurrentTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isWindows()
|
function isWindowsServer()
|
||||||
{
|
{
|
||||||
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
|
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isWindows() {
|
||||||
|
global $global;
|
||||||
|
// Check if the HTTP_USER_AGENT is set
|
||||||
|
if (isset($_SERVER['HTTP_USER_AGENT'])) {
|
||||||
|
// Look for 'Windows' in the user agent string
|
||||||
|
if (stripos($_SERVER['HTTP_USER_AGENT'], 'Windows') !== false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !empty($global['isWindows']);
|
||||||
|
}
|
||||||
|
|
||||||
function isURL200($url, $forceRecheck = false)
|
function isURL200($url, $forceRecheck = false)
|
||||||
{
|
{
|
||||||
global $_isURL200;
|
global $_isURL200;
|
||||||
|
@ -5854,7 +5866,7 @@ function getSystemTimezone()
|
||||||
return $_getSystemTimezoneName;
|
return $_getSystemTimezoneName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWindows()) {
|
if (isWindowsServer()) {
|
||||||
$cmd = 'tzutil /g';
|
$cmd = 'tzutil /g';
|
||||||
} else {
|
} else {
|
||||||
$cmd = 'cat /etc/timezone';
|
$cmd = 'cat /etc/timezone';
|
||||||
|
|
|
@ -120,7 +120,7 @@ function getDirSize($dir, $forceNew = false)
|
||||||
|
|
||||||
_error_log("getDirSize: start {$dir}");
|
_error_log("getDirSize: start {$dir}");
|
||||||
|
|
||||||
if (isWindows()) {
|
if (isWindowsServer()) {
|
||||||
$return = foldersize($dir);
|
$return = foldersize($dir);
|
||||||
$_getDirSize[$dir] = $return;
|
$_getDirSize[$dir] = $return;
|
||||||
return $return;
|
return $return;
|
||||||
|
@ -155,7 +155,7 @@ function rrmdirCommandLine($dir, $async = false)
|
||||||
{
|
{
|
||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
$dir = escapeshellarg($dir);
|
$dir = escapeshellarg($dir);
|
||||||
if (isWindows()) {
|
if (isWindowsServer()) {
|
||||||
$command = ('rd /s /q ' . $dir);
|
$command = ('rd /s /q ' . $dir);
|
||||||
} else {
|
} else {
|
||||||
$command = ('rm -fR ' . $dir);
|
$command = ('rm -fR ' . $dir);
|
||||||
|
@ -347,7 +347,7 @@ function execAsync($command, $keyword = null)
|
||||||
$keyword = preg_replace('/[^a-zA-Z0-9_-]/', '_', $keyword);
|
$keyword = preg_replace('/[^a-zA-Z0-9_-]/', '_', $keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWindows()) {
|
if (isWindowsServer()) {
|
||||||
if ($keyword) {
|
if ($keyword) {
|
||||||
// Add the keyword as a comment to the command for Windows
|
// Add the keyword as a comment to the command for Windows
|
||||||
$commandWithKeyword = "start /B cmd /c \"$command & REM $keyword\" > NUL 2>&1";
|
$commandWithKeyword = "start /B cmd /c \"$command & REM $keyword\" > NUL 2>&1";
|
||||||
|
@ -464,7 +464,7 @@ function killProcess($pid)
|
||||||
|
|
||||||
_error_log("killProcess($pid)");
|
_error_log("killProcess($pid)");
|
||||||
|
|
||||||
if (isWindows()) {
|
if (isWindowsServer()) {
|
||||||
$cmd = "taskkill /F /PID $pid";
|
$cmd = "taskkill /F /PID $pid";
|
||||||
} else {
|
} else {
|
||||||
$cmd = "kill -9 $pid";
|
$cmd = "kill -9 $pid";
|
||||||
|
|
|
@ -1032,7 +1032,7 @@ function fixPath($path, $addLastSlash = false)
|
||||||
if (empty($path)) {
|
if (empty($path)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isWindows()) {
|
if (isWindowsServer()) {
|
||||||
$path = str_replace('/', DIRECTORY_SEPARATOR, $path);
|
$path = str_replace('/', DIRECTORY_SEPARATOR, $path);
|
||||||
$path = str_replace('\\\\\\', DIRECTORY_SEPARATOR, $path);
|
$path = str_replace('\\\\\\', DIRECTORY_SEPARATOR, $path);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -108,6 +108,7 @@ class AI extends PluginAbstract
|
||||||
$domain = parse_url($global['webSiteRootURL'], PHP_URL_HOST);
|
$domain = parse_url($global['webSiteRootURL'], PHP_URL_HOST);
|
||||||
}
|
}
|
||||||
self::$isTest = ($domain == "vlu.me");
|
self::$isTest = ($domain == "vlu.me");
|
||||||
|
//return self::$url;
|
||||||
return self::$isTest ? self::$url_test : self::$url;
|
return self::$isTest ? self::$url_test : self::$url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue