diff --git a/system/storage.php b/system/storage.php index e03ff7a..45f1e63 100644 --- a/system/storage.php +++ b/system/storage.php @@ -47,9 +47,15 @@ if(!check_function_exists("get_storage_dir")) { } } +if(!check_function_exists("get_safe_path")) { + function get_safe_path($path) { + return str_replace("../", "", $path); + } +} + if(!check_function_exists("get_storage_path")) { function get_storage_path($type="data") { - $dir_path = sprintf("./%s/%s", get_storage_dir(), make_safe_path($type)); + $dir_path = sprintf("./%s/%s", get_storage_dir(), get_safe_path($type)); if(!is_dir($dir_path)) { if(!@mkdir($dir_path, 0777)) { @@ -63,7 +69,7 @@ if(!check_function_exists("get_storage_path")) { if(!check_function_exists("get_storage_url")) { function get_storage_url($type="data") { - return sprintf("%s%s/%s", base_url(), get_storage_dir(), make_safe_path($type)); + return sprintf("%s%s/%s", base_url(), get_storage_dir(), get_safe_path($type)); } } @@ -138,7 +144,7 @@ if(!check_function_exists("read_storage_file")) { $storage_type = get_value_in_array("storage_type", $options, "data"); $upload_base_path = get_storage_path($storage_type); $upload_base_url = get_storage_url($storage_type); - $upload_filename = sprintf("%s/%s", $upload_base_path, make_safe_path($filename)); + $upload_filename = sprintf("%s/%s", $upload_base_path, get_safe_path($filename)); if(file_exists($upload_filename)) { $upload_filesize = filesize($upload_filename); @@ -207,7 +213,7 @@ if(!check_function_exists("remove_storage_file")) { $storage_type = get_value_in_array("storage_type", $options, "data"); $upload_base_path = get_storage_path($storage_type); $upload_base_url = get_storage_url($storage_type); - $upload_filename = sprintf("%s/%s", $upload_base_path, make_safe_path($filename)); + $upload_filename = sprintf("%s/%s", $upload_base_path, get_safe_path($filename)); // add option: encryption $encryption = get_value_in_array("encryption", $options, ""); @@ -251,9 +257,11 @@ if(!check_function_exists("write_storage_file")) { $mode = get_value_in_array("mode", $options, "w"); $upload_base_path = get_storage_path($storage_type); $upload_base_url = get_storage_url($storage_type); - $upload_filename = sprintf("%s/%s", $upload_base_path, make_safe_path($filename)); + $upload_filename = sprintf("%s/%s", $upload_base_path, get_safe_path($filename)); - // add option: encryption + // add option: encryption Update config.php 4 minutes ago + database.php Update database.php 9 days ago + logger.php $encryption = get_value_in_array("encryption", $options, ""); if(!empty($encryption)) { if(!loadHelper("encryptiontool")) { @@ -304,7 +312,7 @@ if(!check_function_exists("append_storage_file")) { if(!check_function_exists("get_real_path")) { function get_real_path($filename) { - $filename = make_safe_path($filename); + $filename = get_safe_path($filename); return file_exists($filename) ? realpath($filename) : false; } }