* adjust for xuanxuan server.
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
<h4><?php echo $lang->chat->settings;?></h4>
|
||||
</div>
|
||||
</div>
|
||||
<form method='post' id='ajaxForm' class='form-inline form-ajax'>
|
||||
<form method='post' id='ajaxForm' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->chat->turnon;?></th>
|
||||
<td><?php echo $type == 'edit' ? html::radio('turnon', $lang->chat->turnonList, $turnon) : zget($lang->chat->turnonList, $config->xuanxuan->turnon);?></td>
|
||||
<td class='w-p20'><?php echo $type == 'edit' ? html::radio('turnon', $lang->chat->turnonList, $turnon) : zget($lang->chat->turnonList, $config->xuanxuan->turnon);?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->chat->version;?></th>
|
||||
@@ -37,7 +38,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->chat->xxdServer;?></th>
|
||||
<td colspan='2'><?php echo $type == 'edit' ? html::input('domain', $domain, "class='form-control'") : $domain;?></td>
|
||||
<td><?php echo $type == 'edit' ? html::input('server', $domain, "class='form-control'") : $domain;?></td>
|
||||
<td><?php if($type == 'edit') echo $lang->chat->xxdServerTip;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->chat->xxd->ip;?></th>
|
||||
@@ -58,7 +60,7 @@
|
||||
<th><?php echo $lang->chat->xxd->uploadFileSize;?></th>
|
||||
<td>
|
||||
<?php if($type == 'edit'):?>
|
||||
<div class='input-group' style='width: 30%'>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->chat->xxd->max;?></span>
|
||||
<?php echo html::input('uploadFileSize', zget($config->xuanxuan, 'uploadFileSize', 20), "class='form-control' placeholder='{$lang->chat->placeholder->xxd->uploadFileSize}' ");?>
|
||||
<span class='input-group-addon'>M</span>
|
||||
@@ -109,8 +111,8 @@
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::a(helper::createLink('admin', 'xuanxuan'), $lang->goback, '', 'class="btn" style="min-width: 120px"');?>
|
||||
<?php else:?>
|
||||
<?php echo html::a(helper::createLink('admin', 'downloadXXD', 'type=package'), $lang->chat->downloadXXD, '', "class='btn btn-primary download download-package' target='_blank'");?>
|
||||
<?php echo html::a(helper::createLink('admin', 'downloadXXD', 'type=config'), $lang->chat->downloadConfig, '', "class='btn btn-primary download'");?>
|
||||
<?php echo html::a(helper::createLink('admin', 'downloadXXD', 'type=package'), $lang->chat->downloadXXD, 'hiddenwin', "class='btn btn-primary download download-package'");?>
|
||||
<?php echo html::a(helper::createLink('admin', 'downloadXXD', 'type=config'), $lang->chat->downloadConfig, 'hiddenwin', "class='btn btn-primary download'");?>
|
||||
<?php echo html::a(helper::createLink('admin', 'xuanxuan', 'type=edit'), $lang->chat->changeSetting, '', "class='btn'");?>
|
||||
<?php echo html::a('http://www.zentao.net/book/zentaopmshelp/302.html', $lang->chat->help, '_blank', "class='btn'");?>
|
||||
<?php endif;?>
|
||||
|
||||
@@ -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 <strong>11443</strong>.';
|
||||
$lang->chat->xxClientConfirm = 'Click to download new zentao client!';
|
||||
|
||||
@@ -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 = '服务器地址应该以<strong>http://</strong>或<strong>https://</strong>开头。';
|
||||
$lang->chat->xxdPortError = '服务器地址应该包含有效的端口号,默认为<strong>11443</strong>。';
|
||||
$lang->chat->zentaoClient = '新增禅道客户端!';
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
public function loadConfigFromDB()
|
||||
{
|
||||
parent::loadConfigFromDB();
|
||||
if(isset($this->config->system->xuanxuan)) $this->app->mergeConfig($this->config->system->xuanxuan, 'xuanxuan');
|
||||
}
|
||||
Reference in New Issue
Block a user