diff --git a/module/admin/control.php b/module/admin/control.php index 4b82e00a35..5f752879f3 100755 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -77,101 +77,6 @@ class admin extends control return $this->send(array('result' => 'success')); } - /** - * 登记禅道社区。 - * Register zentao. - * - * @param string $from admin|mail - * @access public - * @return void - */ - public function register(string $from = 'admin') - { - if($_POST) - { - $response = $this->adminZen->registerByAPI(); - $response = json_decode($response); - if($response->result == 'fail') - { - $message = ''; - if(is_string($response->message)) - { - $message = $response->message; - } - else - { - foreach($response->message as $item) $message .= is_array($item) ? join('\n', $item) . '\n' : $item . '\n'; - } - $message = str_replace(array('', ''), '', $message); - - return $this->send(array('result' => 'fail', 'message' => $message)); - } - - $user = $response->data; - $data['community'] = $user->account; - $data['ztPrivateKey'] = $user->private; - - $this->loadModel('setting'); - $this->setting->deleteItems('owner=system&module=common§ion=global&key=community'); - $this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey'); - $this->setting->setItems('system.common.global', $data); - - $locate = true; - if($from == 'admin') $locate = inlink('index'); - if($from == 'mail') $locate = $this->createLink('mail', 'ztcloud'); - - return $this->send(array('result' => 'success', 'message' => $this->lang->admin->registerNotice->success, 'load' => $locate)); - } - - $this->adminZen->initSN(); - - $this->view->title = $this->lang->admin->registerNotice->caption; - $this->view->register = $this->adminZen->getRegisterInfo(); - $this->view->sn = $this->config->global->sn; - $this->view->from = $from; - $this->display(); - } - - /** - * 绑定禅道账号。 - * Bind zentao. - * - * @param string $from admin|mail - * @access public - * @return void - */ - public function bind(string $from = 'admin') - { - if($_POST) - { - $response = $this->adminZen->bindByAPI(); - $response = json_decode($response); - - if($response->result == 'fail') return $this->send($response); - - $user = $response->data; - $data['community'] = $user->account; - $data['ztPrivateKey'] = $user->private; - - $this->loadModel('setting')->deleteItems('owner=system&module=common§ion=global&key=community'); - $this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey'); - $this->setting->setItems('system.common.global', $data); - - $locate = true; - if($from == 'admin') $locate = inlink('index'); - if($from == 'mail') $locate = $this->createLink('mail', 'ztcloud'); - - return $this->send(array('result' => 'success', 'message' => $this->lang->admin->bind->success, 'load' => $locate)); - } - - $this->adminZen->initSN(); - - $this->view->title = $this->lang->admin->bind->caption; - $this->view->sn = $this->config->global->sn; - $this->view->from = $from; - $this->display(); - } - /** * 系统安全设置。 * System security Settings. diff --git a/module/admin/ui/register.html.php b/module/admin/ui/register.html.php deleted file mode 100644 index f3bad95d4f..0000000000 --- a/module/admin/ui/register.html.php +++ /dev/null @@ -1,157 +0,0 @@ - - * @package admin - * @link https://www.zentao.net - */ -namespace zin; - -$canBind = hasPriv('admin', 'bind'); - -$account = zget($config->global, 'community', ''); -if($account == 'na') $account = ''; - -$buildCaptchRow = function($type) : node -{ - global $lang; - return formRow - ( - formGroup - ( - setClass('w-1/2'), - set::label($lang->user->$type), - set::required(true), - inputGroup - ( - input - ( - set::name($type) - ), - span - ( - setClass('input-group-btn'), - button - ( - on::click("sendCaptcha(event, '{$type}')"), - setClass('btn'), - set(array('data-url' => inlink('ajaxSendCode', "type={$type}"))), - $lang->admin->getCaptcha - ) - ) - ) - ), - formGroup - ( - setClass('w-1/2'), - set::label($lang->admin->captcha), - set::name("{$type}Code"), - set::required(true) - ) - ); -}; - -$buildHidden = function($sn, $siteName): array -{ - $items[] = input - ( - set::type('hidden'), - set::name('sn'), - set::value($sn) - ); - $items[] = input - ( - set::type('hidden'), - set::name($siteName), - set::value(common::getSysURL()) - ); - return $items; -}; - -div -( - setClass('flex'), - col - ( - setClass($canBind ? 'pr-2 w-1/2' : 'w-full'), - formPanel - ( - setClass('w-full'), - set::actions(array('submit')), - set::title($lang->admin->registerNotice->common), - set::submitBtnText($lang->admin->registerNotice->submit), - formGroup - ( - set::label($lang->user->account), - set::name('account'), - set::placeholder($lang->admin->registerNotice->lblAccount), - set::required(true) - ), - formGroup - ( - set::label($lang->user->realname), - set::name('realname'), - set::required(true) - ), - formGroup - ( - set::label($lang->user->company), - set::name('company'), - set::value($register->company), - set::required(true) - ), - empty($config->isINT) ? $buildCaptchRow('mobile') : null, - $buildCaptchRow('email'), - formGroup - ( - set::label($lang->user->password), - set::control('password'), - set::name('password1'), - set::placeholder($lang->admin->registerNotice->lblPasswd), - set::required(true) - ), - formGroup - ( - set::label($lang->user->password2), - set::control('password'), - set::name('password2'), - set::required(true) - ), - $buildHidden($sn, 'bindSite') - ) - ), - $canBind ? col - ( - setClass('pl-2 w-1/2'), - formPanel - ( - setClass('w-full'), - set::actions(array('submit')), - set::title($lang->admin->registerNotice->bind), - set::url(inlink('bind', "from={$from}")), - set::submitBtnText($lang->admin->bind->submit), - formGroup - ( - setClass('w-1/2'), - set::label($lang->user->account), - set::name('account'), - set::value($account), - set::required(true) - ), - formGroup - ( - setClass('w-1/2'), - set::label($lang->user->password), - set::control('password'), - set::name('password'), - set::required(true) - ), - $buildHidden($sn, 'site') - ) - ) : null -); - -render(); diff --git a/module/admin/view/register.html.php b/module/admin/view/register.html.php deleted file mode 100755 index 6c74e7aca8..0000000000 --- a/module/admin/view/register.html.php +++ /dev/null @@ -1,171 +0,0 @@ - - * @package admin - * @version $Id: view.html.php 2568 2012-02-09 06:56:35Z shiyangyangwork@yahoo.cn $ - * @link https://www.zentao.net - */ -?> - - - -
-
> -
-
admin->registerNotice->common?>
-
- - - - - - - - - - - - - - isINT)):?> - - - - - - - - - - - - - - - - - - - - -
user->account;?> -
- admin->registerNotice->lblAccount}'");?> -
user->realname;?>
user->company;?>
company, "class='form-control'");?>
user->mobile;?> -
-
- - admin->getCaptcha, '', "id='mobileSender' class='btn'")?> - - admin->captcha?> - -
-
user->email;?> -
-
- email, "class='form-control'");?> - admin->getCaptcha, '', "id='mailSender' class='btn'")?> - - admin->captcha?> - -
-
user->password;?> -
- admin->registerNotice->lblPasswd}'");?> -
user->password2;?> -
- -
- admin->registerNotice->submit) . html::hidden('sn', $sn) . html::hidden('bindSite', common::getSysURL());?> -
-
-
-
- -
-
-
admin->registerNotice->bind?>
-
'> - - - - global, 'community', ''); - if($account == 'na') $account = ''; - ?> - - - - - - - - - -
user->account;?>
user->password;?>
-
-
-
- -
- - diff --git a/module/admin/zen.php b/module/admin/zen.php index 18a1309e55..3b8fad74dc 100644 --- a/module/admin/zen.php +++ b/module/admin/zen.php @@ -16,25 +16,6 @@ class adminZen extends admin */ const EXT_MANAGER_VERSION = '1.3'; - /** - * 初始化sn。 - * Init sn. - * - * @access protected - * @return void - */ - protected function initSN(): void - { - if(!isset($this->config->global->sn)) - { - $this->loadModel('setting'); - $this->setting->setItem('system.common.global.sn', $this->setting->computeSN()); - - if(!isset($this->config->global)) $this->config->global = new stdclass(); - $this->config->global->sn = $this->setting->getItem('owner=system&module=common§ion=global&key=sn'); - } - } - /** * Sync extensions from zentao official website by api. * @@ -145,34 +126,6 @@ class adminZen extends admin if(isset($result->data)) return json_decode($result->data); } - /** - * 注册禅道账号。 - * Register zentao by API. - * - * @access protected - * @return string - */ - protected function registerByAPI(): string - { - $apiConfig = $this->admin->getApiConfig(); - $apiURL = $this->config->admin->apiRoot . "/user-apiRegister.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest&{$apiConfig->sessionVar}={$apiConfig->sessionID}"; - return common::http($apiURL, $_POST); - } - - /** - * 绑定禅道账号。 - * Login zentao by API. - * - * @access protected - * @return string - */ - protected function bindByAPI(): string - { - $apiConfig = $this->admin->getApiConfig(); - $apiURL = $this->config->admin->apiRoot . "/user-bindChanzhi.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest&{$apiConfig->sessionVar}={$apiConfig->sessionID}"; - return common::http($apiURL, $_POST); - } - /** * 发送验证码。 * Send code by API. @@ -239,21 +192,6 @@ class adminZen extends admin return common::http($apiURL . '?' . $param, $_POST); } - /** - * 获取禅道社区注册信息。 - * Get register information. - * - * @access protected - * @return object - */ - protected function getRegisterInfo(): object - { - $register = new stdclass(); - $register->company = $this->app->company->name; - $register->email = $this->app->user->email; - return $register; - } - /** * 获取禅道官网数据。 * Get zentao.net data.