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 @@