mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
ok, first attempt at solving some compatibility issues.
- dropping in replacement for realpath git-svn-id: file:///svn/phpbb/trunk@6122 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1042800c28
commit
3439d0f96e
5 changed files with 79 additions and 10 deletions
|
@ -14,12 +14,12 @@ phpBB Project Manager : theFinn (James Atkinson)
|
|||
phpBB Lead Developers : Acyd Burn (Meik Sievertsen)
|
||||
psoTFX (Paul S. Owen) [2001 - 09/2005]
|
||||
|
||||
phpBB Developers : DavidMJ (David M.)
|
||||
phpBB Developers : Ashe (Ludovic Arnaud) - [10/2002 - 11/2003, 06/2006 - ]
|
||||
DavidMJ (David M.)
|
||||
GrahamJE (Graham Eames)
|
||||
naderman (Nils Aderman)
|
||||
subBlue (Tom Beddard)
|
||||
|
||||
Ashe (Ludovic Arnaud) - [10/2002 - 11/2003]
|
||||
BartVB (Bart van Bragt) - [11/2000 - 03/2006]
|
||||
|
||||
|
||||
|
|
|
@ -376,6 +376,71 @@ if (!function_exists('stripos'))
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('realpath'))
|
||||
{
|
||||
/**
|
||||
* Replacement for realpath if it is disabled
|
||||
* This function is from the php manual by nospam at savvior dot com
|
||||
*/
|
||||
function phpbb_realpath($path)
|
||||
{
|
||||
$translated_path = getenv('PATH_TRANSLATED');
|
||||
|
||||
$translated_path = str_replace('\\', '/', $translated_path);
|
||||
$translated_path = str_replace(basename(getenv('PATH_INFO')), '', $translated_path);
|
||||
|
||||
$translated_path .= '/';
|
||||
|
||||
if ($path == '.' || $path == './')
|
||||
{
|
||||
return $translated_path;
|
||||
}
|
||||
|
||||
// now check for back directory
|
||||
$translated_path .= $path;
|
||||
|
||||
$dirs = explode('/', $translated_path);
|
||||
|
||||
foreach ($dirs as $key => $value)
|
||||
{
|
||||
if ($value == '..')
|
||||
{
|
||||
$dirs[$key] = '';
|
||||
$dirs[$key - 2] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$translated_path = '';
|
||||
|
||||
foreach($dirs as $key => $value)
|
||||
{
|
||||
if (strlen($value) > 0)
|
||||
{
|
||||
$translated_path .= $value . '/';
|
||||
}
|
||||
}
|
||||
|
||||
$translated_path = substr($translated_path, 0, strlen($translated_path) - 1);
|
||||
|
||||
if (is_dir($translated_path) || is_file($translated_path))
|
||||
{
|
||||
return $translated_path;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* A wrapper for realpath
|
||||
*/
|
||||
function phpbb_realpath($path)
|
||||
{
|
||||
return realpath($path);
|
||||
}
|
||||
}
|
||||
|
||||
// functions used for building option fields
|
||||
|
||||
/**
|
||||
|
@ -1189,8 +1254,8 @@ function redirect($url)
|
|||
else
|
||||
{
|
||||
// Get the realpath of dirname
|
||||
$root_dirs = explode('/', str_replace('\\', '/', realpath('./')));
|
||||
$page_dirs = explode('/', str_replace('\\', '/', realpath($pathinfo['dirname'])));
|
||||
$root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath('./')));
|
||||
$page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($pathinfo['dirname'])));
|
||||
$intersection = array_intersect_assoc($root_dirs, $page_dirs);
|
||||
|
||||
$root_dirs = array_diff_assoc($root_dirs, $intersection);
|
||||
|
@ -2144,7 +2209,7 @@ function get_backtrace()
|
|||
|
||||
$output = '<div style="font-family: monospace;">';
|
||||
$backtrace = debug_backtrace();
|
||||
$path = realpath($phpbb_root_path);
|
||||
$path = phpbb_realpath($phpbb_root_path);
|
||||
|
||||
foreach ($backtrace as $number => $trace)
|
||||
{
|
||||
|
@ -2226,8 +2291,8 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
|||
if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false)
|
||||
{
|
||||
// remove complete path to installation, with the risk of changing backslashes meant to be there
|
||||
$errfile = str_replace(array(realpath($phpbb_root_path), '\\'), array('', '/'), $errfile);
|
||||
$msg_text = str_replace(array(realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text);
|
||||
$errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile);
|
||||
$msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text);
|
||||
|
||||
echo '<b>[phpBB Debug] PHP Notice</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n";
|
||||
}
|
||||
|
|
|
@ -141,6 +141,10 @@ function user_add($user_row, $cp_data = false)
|
|||
'user_type' => $user_row['user_type'],
|
||||
);
|
||||
|
||||
/**
|
||||
* @todo user_allow_email is not used anywhere. Think about removing it.
|
||||
*/
|
||||
|
||||
// These are the additional vars able to be specified
|
||||
$additional_vars = array(
|
||||
'user_permissions' => '',
|
||||
|
|
|
@ -67,8 +67,8 @@ class session
|
|||
$page_name = htmlspecialchars(basename($script_name));
|
||||
|
||||
// current directory within the phpBB root (for example: adm)
|
||||
$root_dirs = explode('/', str_replace('\\', '/', realpath($root_path)));
|
||||
$page_dirs = explode('/', str_replace('\\', '/', realpath('./')));
|
||||
$root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($root_path)));
|
||||
$page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath('./')));
|
||||
$intersection = array_intersect_assoc($root_dirs, $page_dirs);
|
||||
|
||||
$root_dirs = array_diff_assoc($root_dirs, $intersection);
|
||||
|
|
|
@ -100,7 +100,7 @@ $lang = array_merge($lang, array(
|
|||
'COLOUR_SWATCH' => 'Colour swatch',
|
||||
'CONFIRM' => 'Confirm',
|
||||
'CONFIRM_CODE' => 'Confirmation code',
|
||||
'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as you see it in the image, it is case insensitive.',
|
||||
'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as you see it in the image, it is case insensitive. Please note that a zero does not exist.',
|
||||
'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.',
|
||||
'CONGRATULATIONS' => 'Congratulations to',
|
||||
'CONNECTION_FAILED' => 'Connection failed',
|
||||
|
|
Loading…
Add table
Reference in a new issue