1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
\r
5 * An open source application development framework for PHP 4.3.2 or newer
\r
7 * @package CodeIgniter
\r
8 * @author ExpressionEngine Dev Team
\r
9 * @copyright Copyright (c) 2008, EllisLab, Inc.
\r
10 * @license http://codeigniter.com/user_guide/license.html
\r
11 * @link http://codeigniter.com
\r
12 * @since Version 1.0
\r
16 // ------------------------------------------------------------------------
\r
19 * CodeIgniter Path Helpers
\r
21 * @package CodeIgniter
\r
22 * @subpackage Helpers
\r
24 * @author ExpressionEngine Dev Team
\r
25 * @link http://codeigniter.com/user_guide/helpers/xml_helper.html
\r
28 // ------------------------------------------------------------------------
\r
35 * @param bool checks to see if the path exists
\r
38 if ( ! function_exists('set_realpath'))
\r
40 function set_realpath($path, $check_existance = FALSE)
\r
42 // Security check to make sure the path is NOT a URL. No remote file inclusion!
\r
43 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))
\r
45 show_error('The path you submitted must be a local server path, not a URL');
\r
49 if (function_exists('realpath') AND @realpath($path) !== FALSE)
\r
51 $path = realpath($path).'/';
\r
54 // Add a trailing slash
\r
55 $path = preg_replace("#([^/])/*$#", "\\1/", $path);
\r
57 // Make sure the path exists
\r
58 if ($check_existance == TRUE)
\r
60 if ( ! is_dir($path))
\r
62 show_error('Not a valid path: '.$path);
\r
71 /* End of file path_helper.php */
\r
72 /* Location: ./system/helpers/path_helper.php */