From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/helpers/path_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/path_helper.php') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index cd87a73eb..2eb85fefa 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From 89338828264a6b50e0eb63c449a96f14f0f84076 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Mon, 12 Mar 2012 21:03:37 +0700 Subject: Path helper improvement --- system/helpers/path_helper.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'system/helpers/path_helper.php') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 2eb85fefa..1b9bdae75 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -58,21 +58,15 @@ if ( ! function_exists('set_realpath')) } // Resolve the path - if (function_exists('realpath') AND @realpath($path) !== FALSE) - { - $path = realpath($path); - } - - // Add a trailing slash - $path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; + $realpath = realpath($path); - // Make sure the path exists - if ($check_existance == TRUE && ! is_dir($path)) + if ( ! $realpath) { - show_error('Not a valid path: '.$path); + return $check_existance ? show_error('Not a valid path: '.$path) : $path; } - return $path; + // Add a trailing slash, if this is a directory + return is_dir($realpath) ? rtrim($realpath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $realpath; } } -- cgit v1.2.3-24-g4f1b From 4a7dd98ffd1d21f2b14b9eefa70e6cae2f9aa92d Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Mon, 12 Mar 2012 21:33:55 +0700 Subject: Left the function_exists due some security restriction in some hosting environment --- system/helpers/path_helper.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'system/helpers/path_helper.php') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 1b9bdae75..9c0af44c1 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE * @@ -58,7 +58,14 @@ if ( ! function_exists('set_realpath')) } // Resolve the path - $realpath = realpath($path); + if (function_exists('realpath')) + { + $realpath = realpath($path); + } + else + { + $realpath = (is_dir($path) or is_file($path)) ? $path : FALSE; + } if ( ! $realpath) { -- cgit v1.2.3-24-g4f1b From 7164cda9ab8aea8fc26aad21dd78c9f06839dec7 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Mon, 12 Mar 2012 21:36:04 +0700 Subject: Minimal PHP version annotation --- system/helpers/path_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/path_helper.php') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 9c0af44c1..8c4730d73 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From fc49a657af78b0fb248cc666b162dc894e3e04ba Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Tue, 13 Mar 2012 03:27:58 +0700 Subject: Extra --- system/helpers/path_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/path_helper.php') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 8c4730d73..e4fc6f157 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -58,13 +58,13 @@ if ( ! function_exists('set_realpath')) } // Resolve the path - if (function_exists('realpath')) + if (function_exists('realpath') && @realpath($path) !== FALSE) { $realpath = realpath($path); } else { - $realpath = (is_dir($path) or is_file($path)) ? $path : FALSE; + $realpath = (is_dir($path) OR is_file($path)) ? $path : FALSE; } if ( ! $realpath) -- cgit v1.2.3-24-g4f1b From ce707b4cafd64b95031690cf927584b1d60c7ad7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 14 Mar 2012 10:26:08 +0200 Subject: Further improve the path helper --- system/helpers/path_helper.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'system/helpers/path_helper.php') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index e4fc6f157..c31f0bdc5 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Path Helpers * @@ -51,8 +49,8 @@ if ( ! function_exists('set_realpath')) { function set_realpath($path, $check_existance = FALSE) { - // Security check to make sure the path is NOT a URL. No remote file inclusion! - if (preg_match("#^(http:\/\/|https:\/\/|www\.|ftp|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $path)) + // Security check to make sure the path is NOT a URL. No remote file inclusion! + if (preg_match('#^(http:\/\/|https:\/\/|www\.|ftp|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i', $path)) { show_error('The path you submitted must be a local server path, not a URL'); } @@ -60,20 +58,15 @@ if ( ! function_exists('set_realpath')) // Resolve the path if (function_exists('realpath') && @realpath($path) !== FALSE) { - $realpath = realpath($path); + $path = realpath($path); } - else - { - $realpath = (is_dir($path) OR is_file($path)) ? $path : FALSE; - } - - if ( ! $realpath) + elseif ($check_existance && ! is_dir($path) && ! is_file($path)) { - return $check_existance ? show_error('Not a valid path: '.$path) : $path; + show_error('Not a valid path: '.$path); } // Add a trailing slash, if this is a directory - return is_dir($realpath) ? rtrim($realpath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $realpath; + return is_dir($path) ? rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $path; } } -- cgit v1.2.3-24-g4f1b