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