diff --git a/bin/ztcli b/bin/ztcli index 38617347a0..8b31f62ff8 100755 --- a/bin/ztcli +++ b/bin/ztcli @@ -28,23 +28,28 @@ include './framework/control.class.php'; include './framework/model.class.php'; include './framework/helper.class.php'; include './config/config.php'; - + +/* Set the PATH_INFO variable. */ if($config->requestType == 'PATH_INFO') { $path = pathinfo($request['path']); + + /* url like http://pms.zentao.net/zentao/my-todo.html, PATH_INFO is 'my-todo.html'. */ if(strpos($path['basename'], $config->requestFix)) { $_SERVER['PATH_INFO'] = $path['basename']; } else { + /* url like http://pms.zentao.net/zentao/my/, PATH_INFO is 'my'. */ if(is_dir('./module/' . $path['basename'])) { $_SERVER['PATH_INFO'] = $path['basename']; } + /* url like http://pms.zentao.net/zentao/, PATH_INFO is '/'. */ else { - $_SERVER['PATH_INFO'] = ''; + $_SERVER['PATH_INFO'] = '/'; } } } diff --git a/module/common/model.php b/module/common/model.php index 9595020d7c..a20090c471 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -80,7 +80,7 @@ class commonModel extends model { $this->app->user = $this->session->user; } - elseif($this->app->company->guest) + elseif($this->app->company->guest or defined('IN_SHELL')) { $user = new stdClass(); $user->id = 0;