From 20f7e52241e46ada43b3424a36e7412a3d5c1470 Mon Sep 17 00:00:00 2001 From: Yagami Date: Wed, 19 Dec 2018 11:10:45 +0800 Subject: [PATCH 1/5] * Fix download xxd bugs. --- xuanxuan/module/admin/ext/control/xuanxuan.php | 13 +------------ xuanxuan/module/admin/ext/lang/en.php | 2 ++ xuanxuan/module/admin/ext/lang/zh-cn.php | 2 ++ xuanxuan/module/admin/ext/view/xuanxuan.html.php | 3 +-- .../module/chat/ext/model/class/xuanxuan.class.php | 2 ++ .../ext/model/hook/loadConfigFromDB.xuanxuan.php | 10 +++++++++- xuanxuan/module/group/ext/lang/en/xuanxuan.php | 4 ++++ xuanxuan/module/group/ext/lang/zh-cn/xuanxuan.php | 4 ++++ 8 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 xuanxuan/module/admin/ext/lang/en.php create mode 100644 xuanxuan/module/admin/ext/lang/zh-cn.php create mode 100644 xuanxuan/module/group/ext/lang/en/xuanxuan.php create mode 100644 xuanxuan/module/group/ext/lang/zh-cn/xuanxuan.php diff --git a/xuanxuan/module/admin/ext/control/xuanxuan.php b/xuanxuan/module/admin/ext/control/xuanxuan.php index 91a5140a0f..08a64fd3e2 100644 --- a/xuanxuan/module/admin/ext/control/xuanxuan.php +++ b/xuanxuan/module/admin/ext/control/xuanxuan.php @@ -33,17 +33,6 @@ class admin extends control $os = 'win'; if(strpos(strtolower(PHP_OS), 'win') !== 0) $os = strtolower(PHP_OS); - $isHttps = (isset($this->config->site->scheme) && $this->config->site->scheme == 'https') || $this->server->https == 'on' ? 1 : 0; - if($isHttps == 0) - { - $url = 'https://' . $this->server->http_host . getWebroot() . '?mode=getconfig'; - $snoopy = $this->app->loadClass('snoopy'); - $snoopy->referer = getWebroot(true); - $snoopy->submit($url); - $contents = $snoopy->results; - $contents = json_decode($contents); - if(!empty($contents)) $isHttps = 1; - } $domain = $this->server->http_host; if(!empty($this->config->xuanxuan->server)) @@ -59,7 +48,7 @@ class admin extends control $this->view->type = $type; $this->view->domain = $domain; $this->view->turnon = isset($this->config->xuanxuan->turnon) ? $this->config->xuanxuan->turnon : 1; - $this->view->isHttps = $isHttps; + $this->view->isHttps = $this->config->xuanxuan->isHttps ? $this->config->xuanxuan->isHttps : 0; $this->display(); } } diff --git a/xuanxuan/module/admin/ext/lang/en.php b/xuanxuan/module/admin/ext/lang/en.php new file mode 100644 index 0000000000..22f8d22268 --- /dev/null +++ b/xuanxuan/module/admin/ext/lang/en.php @@ -0,0 +1,2 @@ +admin->xuanxuan = 'Xuanxuan'; diff --git a/xuanxuan/module/admin/ext/lang/zh-cn.php b/xuanxuan/module/admin/ext/lang/zh-cn.php new file mode 100644 index 0000000000..ce20c83b69 --- /dev/null +++ b/xuanxuan/module/admin/ext/lang/zh-cn.php @@ -0,0 +1,2 @@ +admin->xuanxuan = '喧喧集成'; diff --git a/xuanxuan/module/admin/ext/view/xuanxuan.html.php b/xuanxuan/module/admin/ext/view/xuanxuan.html.php index d3d9ce2faf..10b97f2ca5 100644 --- a/xuanxuan/module/admin/ext/view/xuanxuan.html.php +++ b/xuanxuan/module/admin/ext/view/xuanxuan.html.php @@ -54,13 +54,12 @@ xuanxuan, 'commonPort', 11443), "placeholder='{$lang->chat->placeholder->xxd->commonPort}' class='form-control'") : zget($config->xuanxuan, 'commonPort', 11443);?> - chat->xxd->isHttps;?> - chat->httpsOptions, $isHttps, "class='checkbox' {$disabled}") : $lang->chat->httpsOptions[$isHttps];?> + chat->httpsOptions, $isHttps, "class='checkbox'") : $lang->chat->httpsOptions[$isHttps];?> diff --git a/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php b/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php index 94de0f36eb..f9e3c24f2b 100644 --- a/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php @@ -34,6 +34,8 @@ class xuanxuanChat extends chatModel { header("Location: $result"); } + + $this->loadModel('setting')->setItem('system.common.xxserver.installed', 1); exit; } diff --git a/xuanxuan/module/common/ext/model/hook/loadConfigFromDB.xuanxuan.php b/xuanxuan/module/common/ext/model/hook/loadConfigFromDB.xuanxuan.php index 8a6a4e3b44..c0285bbbf0 100644 --- a/xuanxuan/module/common/ext/model/hook/loadConfigFromDB.xuanxuan.php +++ b/xuanxuan/module/common/ext/model/hook/loadConfigFromDB.xuanxuan.php @@ -1,7 +1,15 @@ loadModel('setting')->getItem('owner=system&module=common§ion=xuanxuan&key=key'); +$sn = $this->loadModel('setting')->getItem('owner=system&module=common§ion=xuanxuan&key=key'); +$chatPort = $this->loadModel('setting')->getItem('owner=system&module=common§ion=xuanxuan&key=chatPort'); +$commonPort = $this->loadModel('setting')->getItem('owner=system&module=common§ion=xuanxuan&key=commonPort'); +$ip = $this->loadModel('setting')->getItem('owner=system&module=common§ion=xuanxuan&key=ip'); +$isHttps = $this->loadModel('setting')->getItem('owner=system&module=common§ion=xuanxuan&key=isHttps'); if(empty($sn)) { $this->setting->setItem('system.common.xuanxuan.turnon', 1); $this->setting->setItem('system.common.xuanxuan.key', $this->setting->computeSN()); } +if(!isset($chatPort)) $this->setting->setItem('system.common.xuanxuan.chatPort', 11444); +if(!isset($commonPort)) $this->setting->setItem('system.common.xuanxuan.commonPort', 11443); +if(!isset($ip)) $this->setting->setItem('system.common.xuanxuan.ip', '0.0.0.0'); +if(!isset($isHttps)) $this->setting->setItem('system.common.xuanxuan.isHttps', 0); diff --git a/xuanxuan/module/group/ext/lang/en/xuanxuan.php b/xuanxuan/module/group/ext/lang/en/xuanxuan.php new file mode 100644 index 0000000000..90f49399bc --- /dev/null +++ b/xuanxuan/module/group/ext/lang/en/xuanxuan.php @@ -0,0 +1,4 @@ +resource->admin->xuanxuan = 'xuanxuan'; + +$lang->admin->methodOrder[25] = 'xuanxuan'; diff --git a/xuanxuan/module/group/ext/lang/zh-cn/xuanxuan.php b/xuanxuan/module/group/ext/lang/zh-cn/xuanxuan.php new file mode 100644 index 0000000000..90f49399bc --- /dev/null +++ b/xuanxuan/module/group/ext/lang/zh-cn/xuanxuan.php @@ -0,0 +1,4 @@ +resource->admin->xuanxuan = 'xuanxuan'; + +$lang->admin->methodOrder[25] = 'xuanxuan'; From 252ad1ef8e2aa726543eb08d810feeee0361baf9 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Wed, 19 Dec 2018 11:12:28 +0800 Subject: [PATCH 2/5] * Adjust for task #5162. --- module/misc/control.php | 37 +++++++++++------------- module/misc/lang/en.php | 5 ++-- module/misc/lang/zh-cn.php | 5 ++-- module/misc/view/downloadclient.html.php | 16 +++++----- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/module/misc/control.php b/module/misc/control.php index 1ade939165..44d0ab26e6 100644 --- a/module/misc/control.php +++ b/module/misc/control.php @@ -90,15 +90,13 @@ class misc extends control * @access public * @param string $action * @param string $os - * @param string $version * @return void */ - public function downloadClient($action = 'check', $os = '', $version = '') + public function downloadClient($action = 'check', $os = '') { if($_POST) { - $version = $this->post->version; - $os = $this->post->os; + $os = $this->post->os; die(js::locate($this->createLink('misc', 'downloadClient', "action=getPackage&os=$os"), 'parent')); } @@ -144,7 +142,7 @@ class misc extends control if($action == 'getPackage') { - $this->view->os = $os; + $this->view->os = $os; $this->view->account = $this->app->user->account; } @@ -167,7 +165,7 @@ class misc extends control $account = $this->app->user->account; $clientDir = $this->app->getBasePath() . 'tmp/cache/client/' . "$account/"; - $clientFile = $clientDir . 'zentaoClient.zip'; + $clientFile = $clientDir . 'zentaoclient.zip'; $zipContent = file_get_contents($clientFile); if(is_dir($clientDir)) { @@ -175,7 +173,7 @@ class misc extends control $zfile->removeDir($clientDir); } - $this->fetch('file', 'sendDownHeader', array('fileName' => 'client.zip', 'zip', $zipContent)); + $this->fetch('file', 'sendDownHeader', array('fileName' => 'zentaoclient.zip', 'zip', $zipContent)); } $this->view->action = $action; @@ -186,11 +184,10 @@ class misc extends control * Ajax get client package. * * @param string $os - * @param string $version * @access public * @return void */ - public function ajaxGetClientPackage($os = '', $version = '') + public function ajaxGetClientPackage($os = '') { set_time_limit (0); session_write_close(); @@ -206,17 +203,18 @@ class misc extends control $tmpDir = $clientDir . "/$account/"; if(!is_dir($tmpDir)) mkdir($tmpDir, 0755, true); - if($os == 'windows64') $clientName = "xuanxuan.win64.zip"; - if($os == 'windows32') $clientName = "xuanxuan.win32.zip"; - if($os == 'linux64') $clientName = "xuanxuan.linux.x64.zip"; - if($os == 'linux32') $clientName = "xuanxuan.linux.ia32.zip"; - if($os == 'mac') $clientName = "xuanxuan.mac.zip"; + if($os == 'windows64') $clientName = "zentaoclient.win64.zip"; + if($os == 'windows32') $clientName = "zentaoclient.win32.zip"; + if($os == 'linux64') $clientName = "zentaoclient.linux.x64.zip"; + if($os == 'linux32') $clientName = "zentaoclient.linux.ia32.zip"; + if($os == 'mac') $clientName = "zentaoclient.mac.zip"; $needCache = false; + $version = $this->config->xuanxuan->version; $packageFile = $clientDir . $clientName; if(!file_exists($packageFile)) { - $url = "http://dl.pts.com/xuanxuan/"; + $url = "http://dl.cnezsoft.com/zentaoclient/$version/"; $xxFile = $url . $clientName; $needCache = true; } @@ -225,7 +223,7 @@ class misc extends control $xxFile = $packageFile; } - $clientFile = $tmpDir . 'zentaoClient.zip'; + $clientFile = $tmpDir . 'zentaoclient.zip'; if($xxHd = fopen($xxFile, "rb")) { if($clientHd = fopen($clientFile, "wb")) @@ -266,11 +264,10 @@ class misc extends control * Ajax set client config to client package. * * @param string $os - * @param string $version * @access public * @return void */ - public function ajaxSetClientConfig($os = '', $version = '') + public function ajaxSetClientConfig($os = '') { $response['result'] = 'success'; @@ -292,7 +289,7 @@ class misc extends control define('PCLZIP_TEMPORARY_DIR', $clientDir); $this->app->loadClass('pclzip', true); - $clientFile = $clientDir . 'zentaoClient.zip'; + $clientFile = $clientDir . 'zentaoclient.zip'; $archive = new pclzip($clientFile); if($os == 'mac') @@ -323,7 +320,7 @@ class misc extends control public function ajaxGetPackageSize() { $account = $this->app->user->account; - $packageFile = $this->app->getBasePath() . 'tmp/cache/client/' . $account . '/zentaoClient.zip'; + $packageFile = $this->app->getBasePath() . 'tmp/cache/client/' . $account . '/zentaoclient.zip'; $size = 0; if(file_exists($packageFile)) diff --git a/module/misc/lang/en.php b/module/misc/lang/en.php index ad5e460340..3124219929 100644 --- a/module/misc/lang/en.php +++ b/module/misc/lang/en.php @@ -16,12 +16,13 @@ $lang->misc->api = 'https://api.zentao.net'; $lang->misc->enApi = 'http://api.zentao.pm'; $lang->misc->client = new stdclass(); -$lang->misc->client->version = 'Select Version'; +$lang->misc->client->version = 'Client Version'; $lang->misc->client->os = 'Select OS'; $lang->misc->client->download = 'Download'; $lang->misc->client->downloading = 'Downloading:'; $lang->misc->client->downloaded = 'Downloaded successful!'; -$lang->misc->client->setConfig = 'Set config successful!'; +$lang->misc->client->setting = 'Setting config info.'; +$lang->misc->client->setted = 'Set config info successful!'; $lang->misc->client->osList['windows64'] = 'Windows 64'; $lang->misc->client->osList['windows32'] = 'Windows 32'; diff --git a/module/misc/lang/zh-cn.php b/module/misc/lang/zh-cn.php index f7adfb4b09..14100a02ec 100644 --- a/module/misc/lang/zh-cn.php +++ b/module/misc/lang/zh-cn.php @@ -16,12 +16,13 @@ $lang->misc->api = 'https://api.zentao.net'; $lang->misc->enApi = 'http://api.zentao.pm'; $lang->misc->client = new stdclass(); -$lang->misc->client->version = '选择版本'; +$lang->misc->client->version = '客户端版本'; $lang->misc->client->os = '操作系统'; $lang->misc->client->download = '下载'; $lang->misc->client->downloading = '正在获取安装包:'; $lang->misc->client->downloaded = '成功获取安装包'; -$lang->misc->client->setConfig = '成功设置配置信息'; +$lang->misc->client->setting = '正在设置配置信息'; +$lang->misc->client->setted = '成功设置配置信息'; $lang->misc->client->osList['windows64'] = 'Windows 64位'; $lang->misc->client->osList['windows32'] = 'Windows 32位'; diff --git a/module/misc/view/downloadclient.html.php b/module/misc/view/downloadclient.html.php index 2f5c5517ab..9ed512c6a3 100644 --- a/module/misc/view/downloadclient.html.php +++ b/module/misc/view/downloadclient.html.php @@ -16,8 +16,8 @@
- - + + @@ -36,10 +36,11 @@
misc->client->version;?>misc->client->versionList, '', "class='form-control chosen'");?>misc->client->version;?>xuanxuan->version;?>
misc->client->os;?>