* finish task #2002.

This commit is contained in:
wangyidong
2014-08-14 06:37:51 +00:00
parent 45be42a13b
commit 4b48e14895
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -583,7 +583,7 @@ function isLocalIP()
function getWebRoot()
{
$path = $_SERVER['SCRIPT_NAME'];
if(defined('IN_SHELL'))
if(PHP_SAPI == 'cli')
{
$url = parse_url($_SERVER['argv'][1]);
$path = empty($url['path']) ? '/' : rtrim($url['path'], '/');
+1 -1
View File
@@ -1597,7 +1597,7 @@ class router
$errorLog .= "when visiting <strong>" . $this->getURI() . "</strong>\n";
/* If the ip is pulic, hidden the full path of scripts. */
if(!defined('IN_SHELL') and !($this->server->server_addr == '127.0.0.1' or filter_var($this->server->server_addr, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) === false))
if(PHP_SAPI != 'cli' and !($this->server->server_addr == '127.0.0.1' or filter_var($this->server->server_addr, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) === false))
{
$errorLog = str_replace($this->getBasePath(), '', $errorLog);
}
+1 -1
View File
@@ -73,7 +73,7 @@ class commonModel extends model
{
$this->app->user = $this->session->user;
}
elseif($this->app->company->guest or defined('IN_SHELL'))
elseif($this->app->company->guest or PHP_SAPI == 'cli')
{
$user = new stdClass();
$user->id = 0;
+1 -1
View File
@@ -519,7 +519,7 @@ EOT;
public function getSysURL()
{
/* Ger URL when run in shell. */
if(defined('IN_SHELL'))
if(PHP_SAPI == 'cli')
{
$url = parse_url(trim($this->server->argv[1]));
$port = (empty($url['port']) or $url['port'] == 80) ? '' : $url['port'];