diff --git a/xuanxuan/module/admin/ext/control/downloadxxd.php b/xuanxuan/module/admin/ext/control/downloadxxd.php index e2f82c9cb2..95739bf8d1 100644 --- a/xuanxuan/module/admin/ext/control/downloadxxd.php +++ b/xuanxuan/module/admin/ext/control/downloadxxd.php @@ -5,9 +5,16 @@ class admin extends control { if(in_array($type, array('config', 'package'))) { - $setting = $this->config->xuanxuan; + $this->loadModel('mail'); + $this->loadModel('chat'); + $domain = empty($this->config->mail->domain) ? commonModel::getSysURL() : $this->config->mail->domain; + if(!empty($this->config->xuanxuan->server)) $domain = $this->config->xuanxuan->server; + if(strpos($domain, '127.0.0.1') !== false) die(js::alert($this->lang->chat->xxdServerError)); + if(empty($domain)) die(js::alert($this->lang->chat->xxdServerEmpty)); + + $setting = $this->config->xuanxuan; $setting->os = $os; - $this->loadModel('chat')->downloadXXD($setting, $type); + $this->chat->downloadXXD($setting, $type); } die("Params error."); } diff --git a/xuanxuan/module/admin/ext/control/xuanxuan.php b/xuanxuan/module/admin/ext/control/xuanxuan.php index 08a64fd3e2..e7d4f7c05f 100644 --- a/xuanxuan/module/admin/ext/control/xuanxuan.php +++ b/xuanxuan/module/admin/ext/control/xuanxuan.php @@ -23,10 +23,15 @@ class admin extends control if(empty($setting->sslkey)) $errors['sslkey'] = $this->lang->chat->errorSSLKey; } + if(strpos($setting->server, '127.0.0.1') !== false) $errors[] = $this->lang->chat->xxdServerError; + if(strpos($setting->server, 'https://') !== 0 and strpos($setting->server, 'http://') !== 0) $errors[] = $this->lang->chat->xxdSchemeError; + if(empty($setting->server)) $errors[] = $this->lang->chat->xxdServerEmpty; + if($errors) $this->send(array('result' => 'fail', 'message' => $errors)); - $setting->server = ($setting->isHttps ? 'https' : 'http') . '://' . $setting->domain . ':' . $setting->commonPort; - $result = $this->loadModel('setting')->setItems('system.common.xuanxuan', $setting, 'all'); + + $result = $this->loadModel('setting')->setItems('system.common.xuanxuan', $setting); + $this->setting->setItem('system.mail.domain', $setting->server); if(!$result) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('xuanxuan'))); } @@ -34,13 +39,9 @@ class admin extends control $os = 'win'; if(strpos(strtolower(PHP_OS), 'win') !== 0) $os = strtolower(PHP_OS); - $domain = $this->server->http_host; - if(!empty($this->config->xuanxuan->server)) - { - preg_match('/^(https?:\/\/)?([^\:]+)/i', $this->config->xuanxuan->server, $match); - $domain = $match[2]; - } - + $this->loadModel('mail'); + $domain = empty($this->config->mail->domain) ? commonModel::getSysURL() : $this->config->mail->domain; + if(!empty($this->config->xuanxuan->server)) $domain = $this->config->xuanxuan->server; $this->view->title = $this->lang->chat->common; $this->view->adminList = $this->loadModel('user')->getPairs('admin'); diff --git a/xuanxuan/module/admin/ext/view/xuanxuan.html.php b/xuanxuan/module/admin/ext/view/xuanxuan.html.php index 0ea81fbd52..cb5974b3cb 100644 --- a/xuanxuan/module/admin/ext/view/xuanxuan.html.php +++ b/xuanxuan/module/admin/ext/view/xuanxuan.html.php @@ -21,11 +21,12 @@

chat->settings;?>

-
+ - + + @@ -37,7 +38,8 @@ - + + @@ -58,7 +60,7 @@
chat->turnon;?>chat->turnonList, $turnon) : zget($lang->chat->turnonList, $config->xuanxuan->turnon);?>chat->turnonList, $turnon) : zget($lang->chat->turnonList, $config->xuanxuan->turnon);?>
chat->version;?>
chat->xxdServer;?>chat->xxdServerTip;?>
chat->xxd->ip;?>chat->xxd->uploadFileSize;?> -
+
chat->xxd->max;?> xuanxuan, 'uploadFileSize', 20), "class='form-control' placeholder='{$lang->chat->placeholder->xxd->uploadFileSize}' ");?> M @@ -109,8 +111,8 @@ goback, '', 'class="btn" style="min-width: 120px"');?> - chat->downloadXXD, '', "class='btn btn-primary download download-package' target='_blank'");?> - chat->downloadConfig, '', "class='btn btn-primary download'");?> + chat->downloadXXD, 'hiddenwin', "class='btn btn-primary download download-package'");?> + chat->downloadConfig, 'hiddenwin', "class='btn btn-primary download'");?> chat->changeSetting, '', "class='btn'");?> chat->help, '_blank', "class='btn'");?> diff --git a/xuanxuan/module/chat/ext/lang/en/xuanxuan.php b/xuanxuan/module/chat/ext/lang/en/xuanxuan.php index 3b6d432358..d0683f2afe 100644 --- a/xuanxuan/module/chat/ext/lang/en/xuanxuan.php +++ b/xuanxuan/module/chat/ext/lang/en/xuanxuan.php @@ -31,8 +31,9 @@ $lang->chat->statusList[0] = 'Disable'; $lang->chat->httpsOptions[1] = 'Enable'; $lang->chat->httpsOptions[0] = 'Disable'; -$lang->chat->xxdServerTip = 'XXD server address contains protocol and host and port,such as https://127.0.0.1:11443'; +$lang->chat->xxdServerTip = 'XXD server address contains protocol and host and port,such as http://192.168.1.35 or http://pms.zentao.com. that can not be 127.0.0.1.'; $lang->chat->xxdServerEmpty = 'XXD server address is empty.'; +$lang->chat->xxdServerError = 'XXD server address can not be 127.0.0.1.'; $lang->chat->xxdSchemeError = 'Server address should started with http:// or https://.'; $lang->chat->xxdPortError = 'Server address should contain valid port and the default is 11443.'; $lang->chat->xxClientConfirm = 'Click to download new zentao client!'; diff --git a/xuanxuan/module/chat/ext/lang/zh-cn/xuanxuan.php b/xuanxuan/module/chat/ext/lang/zh-cn/xuanxuan.php index ca7edea3ff..6217092182 100644 --- a/xuanxuan/module/chat/ext/lang/zh-cn/xuanxuan.php +++ b/xuanxuan/module/chat/ext/lang/zh-cn/xuanxuan.php @@ -29,8 +29,9 @@ $lang->chat->createTodo = '创建待办'; $lang->chat->statusList[1] = '启用'; $lang->chat->statusList[0] = '不启用'; -$lang->chat->xxdServerTip = 'XXD服务器地址为完整的协议+地址+端口,示例:https://127.0.0.1:11443。'; +$lang->chat->xxdServerTip = 'XXD服务器地址为完整的协议+地址+端口,示例:http://192.168.1.35 或 http://pms.zentao.com ,不能使用127.0.0.1。'; $lang->chat->xxdServerEmpty = 'XXD服务器地址为空。'; +$lang->chat->xxdServerError = 'XXD服务器地址不能为 127.0.0.1。'; $lang->chat->xxdSchemeError = '服务器地址应该以http://https://开头。'; $lang->chat->xxdPortError = '服务器地址应该包含有效的端口号,默认为11443。'; $lang->chat->zentaoClient = '新增禅道客户端!'; diff --git a/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php b/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php index ae424d6541..b738e78501 100644 --- a/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php @@ -4,7 +4,6 @@ class xuanxuanChat extends chatModel public function downloadXXD($setting, $type) { $data = new stdClass(); - $data->server = $setting->server; $data->uploadFileSize = $setting->uploadFileSize; $data->isHttps = $setting->isHttps; $data->sslcrt = $setting->sslcrt; @@ -13,12 +12,17 @@ class xuanxuanChat extends chatModel $data->chatPort = $setting->chatPort; $data->commonPort = $setting->commonPort; $data->maxOnlineUser = isset($setting->maxOnlineUser) ? $setting->maxOnlineUser : 0; - $data->host = commonModel::getSysURL() . getWebRoot(); $data->key = $this->config->xuanxuan->key; $data->os = $setting->os; $data->version = $this->config->xuanxuan->version; $data->downloadType = $type; + $this->loadModel('mail'); + $domain = empty($this->config->mail->domain) ? commonModel::getSysURL() : $this->config->mail->domain; + if(!empty($this->config->xuanxuan->server)) $domain = $this->config->xuanxuan->server; + $data->server = $domain; + $data->host = trim($domain, '/') . getWebRoot(); + $url = "https://www.chanzhi.org/license-downloadxxd-zentao.html"; $result = common::http($url, $data); diff --git a/xuanxuan/module/common/ext/model/xuanxuan.php b/xuanxuan/module/common/ext/model/xuanxuan.php deleted file mode 100644 index 0807095a41..0000000000 --- a/xuanxuan/module/common/ext/model/xuanxuan.php +++ /dev/null @@ -1,6 +0,0 @@ -config->system->xuanxuan)) $this->app->mergeConfig($this->config->system->xuanxuan, 'xuanxuan'); -}