From 0a061c6f06db1ca3b7bb449cc30c95b1b217ca44 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 26 Dec 2016 14:54:04 +0800 Subject: [PATCH] * fix bug #965. --- bin/ztcli | 2 +- framework/base/router.class.php | 14 +++++ lib/pinyin/pinyin.class.php | 4 +- module/admin/model.php | 93 +++++++++++++++++---------------- module/doc/view/browse.html.php | 4 +- module/user/control.php | 5 +- www/index.php | 2 +- www/js/my.full.js | 1 + 8 files changed, 73 insertions(+), 52 deletions(-) diff --git a/bin/ztcli b/bin/ztcli index 432b883cad..b0b83c624e 100755 --- a/bin/ztcli +++ b/bin/ztcli @@ -27,7 +27,7 @@ include './framework/router.class.php'; include './framework/control.class.php'; include './framework/model.class.php'; include './framework/helper.class.php'; -include './config/config.php'; +helper::import(realpath('./config/config.php')); /* Set the PATH_INFO variable. */ if($config->requestType == 'PATH_INFO') diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 4605cac21e..21f48323de 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -1803,8 +1803,22 @@ class baseRouter { foreach($lang->db->custom[$moduleName] as $section => $fields) { + if(isset($lang->{$moduleName}->{$section}[''])) + { + $nullKey = ''; + $nullValue = $lang->{$moduleName}->{$section}[$nullKey]; + } + elseif(isset($lang->{$moduleName}->{$section}[0])) + { + $nullKey = 0; + $nullValue = $lang->{$moduleName}->{$section}[0]; + } unset($lang->{$moduleName}->{$section}); + + if(isset($nullKey))$lang->{$moduleName}->{$section}[$nullKey] = $nullValue; foreach($fields as $key => $value) $lang->{$moduleName}->{$section}[$key] = $value; + unset($nullKey); + unset($nullValue); } } diff --git a/lib/pinyin/pinyin.class.php b/lib/pinyin/pinyin.class.php index 5a8a479849..bf026e62de 100644 --- a/lib/pinyin/pinyin.class.php +++ b/lib/pinyin/pinyin.class.php @@ -14,8 +14,8 @@ class pinyin public function __construct() { $this->segments = array(); - $segment = __DIR__ . '/data/words'; - if(file_exists($segment)) $this->segments = include __DIR__ . '/data/words'; + $segment = dirname(__FILE__) . '/data/words'; + if(file_exists($segment)) $this->segments = include dirname(__FILE__) . '/data/words'; } /** diff --git a/module/admin/model.php b/module/admin/model.php index 11e5a58fee..ce885dde65 100644 --- a/module/admin/model.php +++ b/module/admin/model.php @@ -62,9 +62,9 @@ class adminModel extends model */ public function postAPI($url, $formvars = "") { - $this->agent->cookies['lang'] = $this->cookie->lang; - $this->agent->submit($url, $formvars); - return $this->agent->results; + $this->agent->cookies['lang'] = $this->cookie->lang; + $this->agent->submit($url, $formvars); + return $this->agent->results; } /** @@ -101,65 +101,68 @@ class adminModel extends model } - /** - * Register zentao by API. - * - * @access public - * @return void - */ - public function registerByAPI() - { - $apiURL = 'http://www.zentao.net/user-register.json?bind=yes&HTTP_X_REQUESTED_WITH=XMLHttpRequest'; - return $this->postAPI($apiURL, $_POST); - } + /** + * Register zentao by API. + * + * @access public + * @return void + */ + public function registerByAPI() + { + $apiURL = 'http://www.zentao.net/user-register.json?bind=yes&HTTP_X_REQUESTED_WITH=XMLHttpRequest'; + return $this->postAPI($apiURL, $_POST); + } - /** - * Login zentao by API. - * - * @access public - * @return void - */ - public function bindByAPI() - { - $apiURL = 'http://www.zentao.net/user-bindChanzhi.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest'; - return $this->postAPI($apiURL, $_POST); - } + /** + * Login zentao by API. + * + * @access public + * @return void + */ + public function bindByAPI() + { + $apiURL = 'http://www.zentao.net/user-bindChanzhi.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest'; + return $this->postAPI($apiURL, $_POST); + } public function getSecretKey() { - $apiURL = "http://www.zentao.net/user-secretKey.json"; + //$apiURL = "http://www.zentao.net/user-secretKey.json"; + $apiURL = "http://www.zentao.cn/user-secretKey.json"; $params['u'] = $this->config->global->community; $params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; $params['k'] = $this->getSignature($params); - $this->agent->cookies['lang'] = $this->cookie->lang; - $this->agent->fetch($apiURL . '?' . http_build_query($params)); - $result = $this->agent->results; - $result = json_decode($result); + $this->agent->cookies['lang'] = $this->cookie->lang; + $this->agent->fetch($apiURL . '?' . http_build_query($params)); + $result = $this->agent->results; + $result = json_decode($result); return $result; } public function sendCodeByAPI($type) { $module = $type == 'mobile' ? 'sms' : 'mail'; - $apiURL = "http://www.zentao.net/{$module}-apiSendCode.json"; + //$apiURL = "http://www.zentao.net/{$module}-apiSendCode.json"; + $apiURL = "http://www.zentao.cn/{$module}-apiSendCode.json"; $params['u'] = $this->config->global->community; $params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; $params['k'] = $this->getSignature($params); $param = http_build_query($params); - return $this->postAPI($apiURL . '?' . $param, $_POST); + return $this->postAPI($apiURL . '?' . $param, $_POST); } public function certifyByAPI($type) { $module = $type == 'mobile' ? 'sms' : 'mail'; - $apiURL = "http://www.zentao.net/{$module}-apiCertify.json"; + //$apiURL = "http://www.zentao.net/{$module}-apiCertify.json"; + $apiURL = "http://www.zentao.cn/{$module}-apiCertify.json"; $params['u'] = $this->config->global->community; $params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; $params['k'] = $this->getSignature($params); $param = http_build_query($params); - return $this->postAPI($apiURL . '?' . $param, $_POST); + return $this->postAPI($apiURL . '?' . $param, $_POST); } public function getSignature($params) @@ -169,17 +172,17 @@ class adminModel extends model return md5(http_build_query($params) . md5($privateKey)); } - /** - * Get register information. - * - * @access public - * @return object - */ - public function getRegisterInfo() + /** + * Get register information. + * + * @access public + * @return object + */ + public function getRegisterInfo() { $register = new stdclass(); - $register->company = $this->app->company->name; - $register->email = $this->app->user->email; - return $register; - } + $register->company = $this->app->company->name; + $register->email = $this->app->user->email; + return $register; + } } diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php index bf5c339307..cd63595f32 100644 --- a/module/doc/view/browse.html.php +++ b/module/doc/view/browse.html.php @@ -20,9 +20,9 @@ var browseType = ''; from != 'doc') js::set('type', 'doc');?> cookie->browseType == 'bymenu'):?> - + cookie->browseType == 'bytree'):?> - +