forked from kerphi/phpfreechat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename functions to prevent naming conflicts
git-svn-id: https://phpfreechat.svn.sourceforge.net/svnroot/phpfreechat/trunk@1155 2772adf2-ac07-0410-9d30-e29d8120292e
- Loading branch information
Showing
2 changed files
with
38 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,25 +36,49 @@ | |
* Returns the absolute script filename | ||
* takes care of php cgi configuration which do not support SCRIPT_FILENAME variable. | ||
*/ | ||
function getScriptFilename() | ||
function pfc_GetScriptFilename() | ||
{ | ||
$sf = isset($_SERVER["PATH_TRANSLATED"]) ? $_SERVER["PATH_TRANSLATED"] : ""; // check for a cgi configurations | ||
if ( $sf == "" || | ||
!file_exists($sf)) | ||
$sf = isset($_SERVER["SCRIPT_FILENAME"]) ? $_SERVER["SCRIPT_FILENAME"] : ""; // for 'normal' configurations | ||
if ( $sf == "" || | ||
!file_exists($sf)) | ||
$sf = ''; | ||
if(function_exists('debug_backtrace')) | ||
{ | ||
// browse the backtrace history and take the first unknown filename as the client script | ||
foreach(debug_backtrace() as $db) | ||
{ | ||
$f = $db['file']; | ||
if (!preg_match('/phpfreechat.class.php/',$f) && | ||
!preg_match('/pfcglobalconfig.class.php/',$f) && | ||
!preg_match('/pfctools.class.php/',$f) && | ||
!preg_match('/pfcinfo.class.php/',$f) | ||
) | ||
{ | ||
$sf = $f; | ||
break; | ||
} | ||
} | ||
} | ||
else if (isset($_SERVER['PATH_TRANSLATED']) && | ||
file_exists($_SERVER['SCRIPT_FILENAME'])) // check for a cgi configurations | ||
{ | ||
$sf = $_SERVER['PATH_TRANSLATED']; | ||
} | ||
else if (isset($_SERVER['SCRIPT_FILENAME'])&& | ||
file_exists($_SERVER['SCRIPT_FILENAME'])) // for non-cgi configurations | ||
{ | ||
$sf = $_SERVER['SCRIPT_FILENAME']; | ||
} | ||
else | ||
{ | ||
echo "<pre>"; | ||
echo "<span style='color:red'>Error: GetScriptFilename function returns a wrong path. Please contact the pfc team ([email protected]) and copy/paste this array to help debugging.</span>\n"; | ||
echo "<span style='color:red'>Error: pfc_GetScriptFilename function returns a wrong path. Please contact the pfc team ([email protected]) and copy/paste these data to help debugging:</span>\n"; | ||
print_r($_SERVER); | ||
print_r(debug_backtrace()); | ||
echo "</pre>"; | ||
exit; | ||
} | ||
return $sf; | ||
} | ||
|
||
function relativePath($p1, $p2) | ||
function pfc_RelativePath($p1, $p2) | ||
{ | ||
if (is_file($p1)) $p1 = dirname($p1); | ||
if (is_file($p2)) $p2 = dirname($p2); | ||
|