mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-30 15:52:17 +09:00
Refactor some URL related functions to use Rhymix constants
This commit is contained in:
parent
9ddf2f54f3
commit
a8094fe766
3 changed files with 16 additions and 55 deletions
|
|
@ -18,18 +18,18 @@ define('RX_TIME', intval(RX_MICROTIME));
|
|||
/**
|
||||
* RX_BASEDIR is the SERVER-SIDE absolute path of Rhymix (with trailing slash).
|
||||
*/
|
||||
define('RX_BASEDIR', dirname(__DIR__) . '/');
|
||||
define('RX_BASEDIR', str_replace('\\', '/', dirname(__DIR__)) . '/');
|
||||
|
||||
/**
|
||||
* RX_BASEURL is the CLIENT-SIDE absolute path of Rhymix (with trailing slash, relative to the document root).
|
||||
*/
|
||||
if (isset($_SERVER['DOCUMENT_ROOT']) && !strncmp(RX_BASEDIR, $_SERVER['DOCUMENT_ROOT'], strlen($_SERVER['DOCUMENT_ROOT'])))
|
||||
if (isset($_SERVER['DOCUMENT_ROOT']) && !strncmp(RX_BASEDIR, str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), strlen($_SERVER['DOCUMENT_ROOT'])))
|
||||
{
|
||||
define('RX_BASEURL', rtrim(substr(RX_BASEDIR, strlen($_SERVER['DOCUMENT_ROOT'])), '/') . '/');
|
||||
}
|
||||
elseif (isset($_SERVER['PHP_SELF']) && ($len = strlen($_SERVER['PHP_SELF'])) && $len >= 10 && substr($_SERVER['PHP_SELF'], $len - 10) === '/index.php')
|
||||
{
|
||||
define('RX_BASEURL', rtrim(substr($_SERVER['PHP_SELF'], 0, $len - 10), '/') . '/');
|
||||
define('RX_BASEURL', rtrim(str_replace('\\', '/', substr($_SERVER['PHP_SELF'], 0, $len - 10)), '/') . '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -457,9 +457,7 @@ function getFullSiteUrl()
|
|||
*/
|
||||
function getCurrentPageUrl()
|
||||
{
|
||||
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
|
||||
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE);
|
||||
return escape((RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1213,12 +1211,7 @@ function mysql_pre4_hash_password($password)
|
|||
*/
|
||||
function getScriptPath()
|
||||
{
|
||||
static $url = NULL;
|
||||
if($url == NULL)
|
||||
{
|
||||
$url = str_ireplace('/tools/', '/', preg_replace('/index.php$/i', '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME'])));
|
||||
}
|
||||
return $url;
|
||||
return RX_BASEURL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue