Edit File by line
/home/barbar84/www/extracte.../filemang...
File: permission.inc.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
[3] Fix | Delete
$script = function_exists('getenv') ? getenv('SCRIPT_NAME') : $_SERVER['SCRIPT_NAME'];
[4] Fix | Delete
$script = strpos($script, '/') !== false ? dirname($script) : null;
[5] Fix | Delete
$script = str_replace('\\', '/', $script);
[6] Fix | Delete
[7] Fix | Delete
define('IS_INSTALL_ROOT_DIRECTORY', $script == '.' || $script == '/');
[8] Fix | Delete
define('IS_ACCESS_FILE_IN_FILE_MANAGER', defined('INDEX') && isset($_GET['not']));
[9] Fix | Delete
define('DIRECTORY_FILE_MANAGER', strpos($script, '/') !== false ? @substr($script, strrpos($script, '/') + 1) : null);
[10] Fix | Delete
define('PATH_FILE_MANAGER', str_replace('\\', '/', strtolower($_SERVER['DOCUMENT_ROOT'] . $script)));
[11] Fix | Delete
define('NAME_DIRECTORY_INSTALL_FILE_MANAGER', !IS_INSTALL_ROOT_DIRECTORY ? preg_replace('#(\/+|/\+)(.+?)#s', '$2', $script) : null);
[12] Fix | Delete
define('PARENT_PATH_FILE_MANAGER', substr(PATH_FILE_MANAGER, 0, strlen(PATH_FILE_MANAGER) - (NAME_DIRECTORY_INSTALL_FILE_MANAGER == null ? 0 : strlen(NAME_DIRECTORY_INSTALL_FILE_MANAGER) + 1)));
[13] Fix | Delete
[14] Fix | Delete
if (
[15] Fix | Delete
IS_INSTALL_ROOT_DIRECTORY ||
[16] Fix | Delete
IS_ACCESS_FILE_IN_FILE_MANAGER ||
[17] Fix | Delete
[18] Fix | Delete
($script != '.' && $script != '/' && isPathNotPermission(processDirectory($dir))) ||
[19] Fix | Delete
($script != '.' && $script != '/' && $name != null && isPathNotPermission(processDirectory($dir . '/' . $name)))
[20] Fix | Delete
)
[21] Fix | Delete
define('NOT_PERMISSION', true);
[22] Fix | Delete
else
[23] Fix | Delete
define('NOT_PERMISSION', false);
[24] Fix | Delete
[25] Fix | Delete
if (!defined('INDEX') && !defined('LOGIN') && NOT_PERMISSION)
[26] Fix | Delete
goURL('index.php?not');
[27] Fix | Delete
[28] Fix | Delete
if (NOT_PERMISSION) {
[29] Fix | Delete
$dir = null;
[30] Fix | Delete
$dirEncode = null;
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
if ($dir != null)
[34] Fix | Delete
define('IS_ACCESS_PARENT_PATH_FILE_MANAGER', strtolower(processDirectory($dir)) == strtolower(processDirectory(PARENT_PATH_FILE_MANAGER)));
[35] Fix | Delete
else
[36] Fix | Delete
define('IS_ACCESS_PARENT_PATH_FILE_MANAGER', strtolower(processDirectory(PARENT_PATH_FILE_MANAGER)) == strtolower(processDirectory($_SERVER['DOCUMENT_ROOT'])));
[37] Fix | Delete
[38] Fix | Delete
function isPathNotPermission($path, $isUseName = false): bool
[39] Fix | Delete
{
[40] Fix | Delete
if (empty($path) == false) {
[41] Fix | Delete
$reg = $isUseName ? NAME_DIRECTORY_INSTALL_FILE_MANAGER : PATH_FILE_MANAGER;
[42] Fix | Delete
$reg = $reg != null ? strtolower($reg) : null;
[43] Fix | Delete
$path = str_replace('\\', '/', $path);
[44] Fix | Delete
$path = strtolower($path);
[45] Fix | Delete
[46] Fix | Delete
if (preg_match('#^' . $reg . '$#si', $path))
[47] Fix | Delete
return true;
[48] Fix | Delete
elseif (preg_match('#^' . $reg . '/(^\/+|^\\+)(.*?)$#si', $path))
[49] Fix | Delete
return true;
[50] Fix | Delete
elseif (preg_match('#^' . $reg . '/(.*?)$#si', $path))
[51] Fix | Delete
return true;
[52] Fix | Delete
[53] Fix | Delete
return false;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
return false;
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
unset($script);
[60] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function