mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
Use RX_WINDOWS constant in core and file module
This commit is contained in:
parent
76c68c63e0
commit
4ac0a6bf66
4 changed files with 7 additions and 8 deletions
|
|
@ -198,20 +198,19 @@ class Security
|
||||||
// Use other good sources of entropy if random_bytes() is not available.
|
// Use other good sources of entropy if random_bytes() is not available.
|
||||||
if ($entropy === false)
|
if ($entropy === false)
|
||||||
{
|
{
|
||||||
$is_windows = (defined('\PHP_OS') && strtoupper(substr(\PHP_OS, 0, 3)) === 'WIN');
|
|
||||||
if(function_exists('openssl_random_pseudo_bytes'))
|
if(function_exists('openssl_random_pseudo_bytes'))
|
||||||
{
|
{
|
||||||
$entropy = openssl_random_pseudo_bytes($entropy_capped_bytes);
|
$entropy = openssl_random_pseudo_bytes($entropy_capped_bytes);
|
||||||
}
|
}
|
||||||
elseif(function_exists('mcrypt_create_iv') && !$is_windows)
|
elseif(function_exists('mcrypt_create_iv') && !\RX_WINDOWS)
|
||||||
{
|
{
|
||||||
$entropy = mcrypt_create_iv($entropy_capped_bytes, \MCRYPT_DEV_URANDOM);
|
$entropy = mcrypt_create_iv($entropy_capped_bytes, \MCRYPT_DEV_URANDOM);
|
||||||
}
|
}
|
||||||
elseif(function_exists('mcrypt_create_iv') && $is_windows)
|
elseif(function_exists('mcrypt_create_iv') && \RX_WINDOWS)
|
||||||
{
|
{
|
||||||
$entropy = mcrypt_create_iv($entropy_capped_bytes, \MCRYPT_RAND);
|
$entropy = mcrypt_create_iv($entropy_capped_bytes, \MCRYPT_RAND);
|
||||||
}
|
}
|
||||||
elseif(!$is_windows && @is_readable('/dev/urandom'))
|
elseif(!\RX_WINDOWS && @is_readable('/dev/urandom'))
|
||||||
{
|
{
|
||||||
$fp = fopen('/dev/urandom', 'rb');
|
$fp = fopen('/dev/urandom', 'rb');
|
||||||
if (function_exists('stream_set_read_buffer')) // This function does not exist in HHVM.
|
if (function_exists('stream_set_read_buffer')) // This function does not exist in HHVM.
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ class Storage
|
||||||
public static function isExecutable($path)
|
public static function isExecutable($path)
|
||||||
{
|
{
|
||||||
$path = rtrim($path, '/\\');
|
$path = rtrim($path, '/\\');
|
||||||
if (function_exists('exec') && !starts_with('win', \PHP_OS, false))
|
if (function_exists('exec') && !\RX_WINDOWS)
|
||||||
{
|
{
|
||||||
@exec('/bin/ls -l ' . escapeshellarg($path), $output, $return_var);
|
@exec('/bin/ls -l ' . escapeshellarg($path), $output, $return_var);
|
||||||
if ($return_var === 0)
|
if ($return_var === 0)
|
||||||
|
|
@ -880,7 +880,7 @@ class Storage
|
||||||
public static function recommendUmask()
|
public static function recommendUmask()
|
||||||
{
|
{
|
||||||
// On Windows, set the umask to 0000.
|
// On Windows, set the umask to 0000.
|
||||||
if (strncasecmp(\PHP_OS, 'Win', 3) === 0)
|
if (\RX_WINDOWS)
|
||||||
{
|
{
|
||||||
return '0000';
|
return '0000';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class fileAdminController extends file
|
||||||
$config->image_remove_exif_data = Context::get('image_remove_exif_data') === 'Y' ? true : false;
|
$config->image_remove_exif_data = Context::get('image_remove_exif_data') === 'Y' ? true : false;
|
||||||
$config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false;
|
$config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false;
|
||||||
$config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time'));
|
$config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time'));
|
||||||
if(strtoupper(substr(\PHP_OS, 0, 3)) === 'WIN')
|
if (RX_WINDOWS)
|
||||||
{
|
{
|
||||||
$config->ffmpeg_command = escape(Context::get('ffmpeg_command')) ?: 'C:\Program Files\ffmpeg\bin\ffmpeg.exe';
|
$config->ffmpeg_command = escape(Context::get('ffmpeg_command')) ?: 'C:\Program Files\ffmpeg\bin\ffmpeg.exe';
|
||||||
$config->ffprobe_command = escape(Context::get('ffprobe_command')) ?: 'C:\Program Files\ffmpeg\bin\ffprobe.exe';
|
$config->ffprobe_command = escape(Context::get('ffprobe_command')) ?: 'C:\Program Files\ffmpeg\bin\ffprobe.exe';
|
||||||
|
|
|
||||||
|
|
@ -1178,7 +1178,7 @@ class fileController extends file
|
||||||
$adjusted['height'] -= $adjusted['height'] % 2;
|
$adjusted['height'] -= $adjusted['height'] % 2;
|
||||||
|
|
||||||
// Convert using ffmpeg
|
// Convert using ffmpeg
|
||||||
if(strtoupper(substr(\PHP_OS, 0, 3)) === 'WIN')
|
if (RX_WINDOWS)
|
||||||
{
|
{
|
||||||
$command = escapeshellarg($config->ffmpeg_command);
|
$command = escapeshellarg($config->ffmpeg_command);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue