Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2018-12-19 13:19:51 +08:00
12 changed files with 57 additions and 46 deletions
+17 -20
View File
@@ -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." . $os . '.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))
+3 -2
View File
@@ -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';
+3 -2
View File
@@ -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位';
+9 -7
View File
@@ -16,8 +16,8 @@
<form method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='w-70px'><?php echo $lang->misc->client->version;?></th>
<td><?php echo html::select('version', $lang->misc->client->versionList, '', "class='form-control chosen'");?></td>
<th class='w-80px'><?php echo $lang->misc->client->version;?></th>
<td><?php echo $config->xuanxuan->version;?></td>
</tr>
<tr>
<th><?php echo $lang->misc->client->os;?></th>
@@ -36,10 +36,11 @@
<div class='modal-body'>
<ul>
<li id='downloading'><?php echo $lang->misc->client->downloading;?><span>0</span>M</li>
<li id='downloaded' class='hidden'> <?php echo $lang->misc->client->downloaded;?></li>
<li id='setConfig' class='hidden'> <?php echo $lang->misc->client->setConfig;?></li>
<li id='configError' class='hidden'> <?php echo $lang->misc->client->errorInfo->configError;?></li>
<li id='downloadError' class='hidden'> <?php echo $lang->misc->client->errorInfo->downloadError;?></li>
<li id='downloaded' class='hidden'> <?php echo $lang->misc->client->downloaded;?></li>
<li id='setting' class='hidden'> <?php echo $lang->misc->client->setting;?></li>
<li id='setted' class='hidden'> <?php echo $lang->misc->client->setted;?></li>
<li id='configError' class='hidden'> <?php echo $lang->misc->client->errorInfo->configError;?></li>
<li id='downloadError' class='hidden'> <?php echo $lang->misc->client->errorInfo->downloadError;?></li>
</ul>
<div id='hasError' class='alert alert-info hidden'></div>
<div id='clearTmp' class='text-center hidden'><?php echo html::a($this->createLink('misc', 'downloadClient', "action=clearTmpPackage"), $lang->confirm, '', "class='btn btn-primary btn-wide'");?></div>
@@ -61,13 +62,14 @@
clearInterval(progress);
$('#downloading').addClass('hidden');
$('#downloaded').removeClass('hidden');
$('#setting').removeClass('hidden');
var link = createLink('misc', 'ajaxSetClientConfig', 'os=' + os);
$.getJSON(link, function(response)
{
if(response.result == 'success')
{
$('#setConfig').removeClass('hidden');
$('#setted').removeClass('hidden');
var link = createLink('misc', 'downloadClient', "action=downloadPackage" + '&os=' + os);
parent.$.closeModal();
location.href = link;
+1 -12
View File
@@ -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();
}
}
+2
View File
@@ -0,0 +1,2 @@
<?php
$lang->admin->xuanxuan = 'Xuanxuan';
@@ -0,0 +1,2 @@
<?php
$lang->admin->xuanxuan = '喧喧集成';
@@ -54,13 +54,12 @@
<td><?php echo $type == 'edit' ? html::input('commonPort', zget($config->xuanxuan, 'commonPort', 11443), "placeholder='{$lang->chat->placeholder->xxd->commonPort}' class='form-control'") : zget($config->xuanxuan, 'commonPort', 11443);?></td>
<td></td>
</tr>
<?php $disabled = ($isHttps == 1) ? "disabled" : ''?>
<?php if($type == 'edit'):?>
<tr>
<th><?php echo $lang->chat->xxd->isHttps;?></th>
<td>
<?php echo html::hidden('isHttps', $isHttps);?>
<?php echo $type ? html::radio('https', $lang->chat->httpsOptions, $isHttps, "class='checkbox' {$disabled}") : $lang->chat->httpsOptions[$isHttps];?>
<?php echo $type ? html::radio('https', $lang->chat->httpsOptions, $isHttps, "class='checkbox'") : $lang->chat->httpsOptions[$isHttps];?>
</td>
<td></td>
</tr>
@@ -34,6 +34,8 @@ class xuanxuanChat extends chatModel
{
header("Location: $result");
}
$this->loadModel('setting')->setItem('system.common.xxserver.installed', 1);
exit;
}
@@ -1,7 +1,15 @@
<?php
$sn = $this->loadModel('setting')->getItem('owner=system&module=common&section=xuanxuan&key=key');
$sn = $this->loadModel('setting')->getItem('owner=system&module=common&section=xuanxuan&key=key');
$chatPort = $this->loadModel('setting')->getItem('owner=system&module=common&section=xuanxuan&key=chatPort');
$commonPort = $this->loadModel('setting')->getItem('owner=system&module=common&section=xuanxuan&key=commonPort');
$ip = $this->loadModel('setting')->getItem('owner=system&module=common&section=xuanxuan&key=ip');
$isHttps = $this->loadModel('setting')->getItem('owner=system&module=common&section=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(empty($chatPort)) $this->setting->setItem('system.common.xuanxuan.chatPort', 11444);
if(empty($commonPort)) $this->setting->setItem('system.common.xuanxuan.commonPort', 11443);
if(empty($ip)) $this->setting->setItem('system.common.xuanxuan.ip', '0.0.0.0');
if(empty($isHttps)) $this->setting->setItem('system.common.xuanxuan.isHttps', 0);
@@ -0,0 +1,4 @@
<?php
$lang->resource->admin->xuanxuan = 'xuanxuan';
$lang->admin->methodOrder[25] = 'xuanxuan';
@@ -0,0 +1,4 @@
<?php
$lang->resource->admin->xuanxuan = 'xuanxuan';
$lang->admin->methodOrder[25] = 'xuanxuan';