mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
- fix compatibility for PHP version < 5.6
This commit is contained in:
@@ -1042,10 +1042,16 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
public function _realpath($path, $realpath = null)
|
public function _realpath($path, $realpath = null)
|
||||||
{
|
{
|
||||||
static $nds = array('/' => '\\', '\\' => '/');
|
static $nds = null;
|
||||||
static $sepDotsep = DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR;
|
static $sepDotsep = null;
|
||||||
static $sepDot = DIRECTORY_SEPARATOR . '.';
|
static $sepDot = null;
|
||||||
static $sepSep = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
|
static $sepSep =null;
|
||||||
|
if (!isset($nds)) {
|
||||||
|
$nds = array('/' => '\\', '\\' => '/');
|
||||||
|
$sepDotsep = DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR;
|
||||||
|
$sepDot = DIRECTORY_SEPARATOR . '.';
|
||||||
|
$sepSep = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
|
||||||
|
}
|
||||||
// normalize DIRECTORY_SEPARATOR
|
// normalize DIRECTORY_SEPARATOR
|
||||||
$path = str_replace(array($nds[DIRECTORY_SEPARATOR], $sepDotsep), DIRECTORY_SEPARATOR, $path);
|
$path = str_replace(array($nds[DIRECTORY_SEPARATOR], $sepDotsep), DIRECTORY_SEPARATOR, $path);
|
||||||
if (strpos($path,$sepDot) === false && (($realpath === false && $path[0] === '.') || $realpath === null) && $path[0] !== '\\') {
|
if (strpos($path,$sepDot) === false && (($realpath === false && $path[0] === '.') || $realpath === null) && $path[0] !== '\\') {
|
||||||
|
Reference in New Issue
Block a user