* change for bind sendcloud.
This commit is contained in:
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
class ztcloud
|
||||
{
|
||||
public $url = 'http://smtp.zentao.cn/index.php?m=mail&f=apiSend';
|
||||
public $account = '';
|
||||
public $secretKey = '';
|
||||
public $from = '';
|
||||
public $fromName = '';
|
||||
public $toList = '';
|
||||
public $ccList = '';
|
||||
public $subject = '';
|
||||
public $body = '';
|
||||
public $files = '';
|
||||
public $headers = '';
|
||||
public $Subject = ''; //Compatible phpmailer.
|
||||
|
||||
/**
|
||||
* Set from.
|
||||
*
|
||||
* @param string $from
|
||||
* @param string $fromName
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setFrom($from, $fromName = '')
|
||||
{
|
||||
$this->from = $from;
|
||||
$this->fromName = empty($fromName) ? $from : $fromName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an address
|
||||
*
|
||||
* @param string $kind
|
||||
* @param string $address
|
||||
* @param string $name
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function addAnAddress($kind, $address, $name = '')
|
||||
{
|
||||
$kind = strtolower($kind);
|
||||
if(!preg_match('/^(to|cc|bcc|replyto)$/', $kind))
|
||||
{
|
||||
$error = 'Invalid recipient array: ' . $kind;
|
||||
throw new Exception($error);
|
||||
echo $error;
|
||||
return false;
|
||||
}
|
||||
|
||||
$address = trim($address);
|
||||
if(empty($address)) return true;
|
||||
|
||||
$key = $kind . 'List';
|
||||
$this->$key .= $address . ';';
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send mail
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function send()
|
||||
{
|
||||
if(!empty($this->Subject) and empty($this->subject)) $this->subject = $this->Subject;
|
||||
|
||||
$param['account'] = $this->account;
|
||||
$param['from'] = $this->from;
|
||||
$param['fromName'] = $this->fromName;
|
||||
$param['toList'] = $this->toList;
|
||||
$param['ccList'] = $this->ccList;
|
||||
$param['subject'] = $this->subject;
|
||||
$param['body'] = $this->body;
|
||||
|
||||
$result = $this->queryZtcloud($this->url, $param);
|
||||
if($result->result == 'fail')
|
||||
{
|
||||
throw new Exception($result->message . "(code:{$result->code})");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Query Ztcloud
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function queryZtcloud($url, $param)
|
||||
{
|
||||
if(!isset($param['signature'])) $param['signature'] = $this->getSignature($param);
|
||||
|
||||
$data = http_build_query($param);
|
||||
$options['http'] = array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
||||
'content' => $data
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, FILE_TEXT, $context);
|
||||
return json_decode($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute Signature.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSignature($param)
|
||||
{
|
||||
ksort($param);
|
||||
$data = '';
|
||||
foreach($param as $key => $value) $data .= $key . '=' . $value . '&';
|
||||
return md5($this->secretKey . '&' . $data . $this->secretKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add address
|
||||
*
|
||||
* @param string $address
|
||||
* @param string $name
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function addAddress($address, $name = '')
|
||||
{
|
||||
return $this->addAnAddress('to', $address, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add cc.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string $name
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function addCC($address, $name = '')
|
||||
{
|
||||
return $this->addAnAddress('cc', $address, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* MsgHtml
|
||||
*
|
||||
* @param string $html
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function msgHtml($html)
|
||||
{
|
||||
$this->body = $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all recipients.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function clearAllRecipients()
|
||||
{
|
||||
$this->toList = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear attachments.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function clearAttachments()
|
||||
{
|
||||
$this->subject = '';
|
||||
$this->html = '';
|
||||
$this->files = '';
|
||||
$this->headers = '';
|
||||
$this->Subject = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language.
|
||||
*
|
||||
* @param string $langcode
|
||||
* @param string $lang_path
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function setLanguage($langcode = 'en', $lang_path = '../phpmailer/language/')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,10 @@ class admin extends control
|
||||
*/
|
||||
public function ignore()
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.common.global.community', 'na');
|
||||
$this->loadModel('setting');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=community');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey');
|
||||
$this->setting->setItem('system.common.global.community', 'na');
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
}
|
||||
|
||||
@@ -57,16 +60,26 @@ class admin extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
public function register($from = 'admin')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$response = $this->admin->registerByAPI();
|
||||
if($response == 'success')
|
||||
$response = json_decode($response);
|
||||
if($response->result == 'success')
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.common.global.community', $this->post->account);
|
||||
$user = json_decode($response->data);
|
||||
$data['community'] = $user->account;
|
||||
$data['ztPrivateKey'] = $user->privateKey;
|
||||
|
||||
$this->loadModel('setting');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=community');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey');
|
||||
$this->setting->setItems('system.common.global', $data);
|
||||
|
||||
echo js::alert($this->lang->admin->register->success);
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
if($from == 'admin') die(js::locate(inlink('index'), 'parent'));
|
||||
if($from == 'mail') die(js::locate($this->createLink('mail', 'ztcloud'), 'parent'));
|
||||
}
|
||||
die($response);
|
||||
}
|
||||
@@ -75,6 +88,7 @@ class admin extends control
|
||||
$this->view->position[] = $this->lang->admin->register->caption;
|
||||
$this->view->register = $this->admin->getRegisterInfo();
|
||||
$this->view->sn = $this->config->global->sn;
|
||||
$this->view->from = $from;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -84,7 +98,7 @@ class admin extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function bind()
|
||||
public function bind($from = 'admin')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
@@ -92,9 +106,18 @@ class admin extends control
|
||||
$response = json_decode($response);
|
||||
if($response->result == 'success')
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.common.global.community', $this->post->account);
|
||||
$user = $response->data;
|
||||
$data['community'] = $user->account;
|
||||
$data['ztPrivateKey'] = $user->privateKey;
|
||||
|
||||
$this->loadModel('setting');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=community');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey');
|
||||
$this->setting->setItems('system.common.global', $data);
|
||||
|
||||
echo js::alert($this->lang->admin->bind->success);
|
||||
die(js::locate(inlink('index'), 'parent'));
|
||||
if($from == 'admin') die(js::locate(inlink('index'), 'parent'));
|
||||
if($from == 'mail') die(js::locate($this->createLink('mail', 'ztcloud'), 'parent'));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -105,6 +128,7 @@ class admin extends control
|
||||
$this->view->title = $this->lang->admin->bind->caption;
|
||||
$this->view->position[] = $this->lang->admin->bind->caption;
|
||||
$this->view->sn = $this->config->global->sn;
|
||||
$this->view->from = $from;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -192,4 +216,64 @@ class admin extends control
|
||||
$this->view->code = isset($this->config->sso->code) ? $this->config->sso->code : '';
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function certifyZtEmail($email = '')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$this->admin->certifyByAPI('mail');
|
||||
die(js::locate($this->createLink('mail', 'ztCloud'), 'parent'));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->admin->certifyEmail;
|
||||
$this->view->position[] = $this->lang->admin->certifyEmail;
|
||||
|
||||
$this->view->email = helper::safe64Decode($email);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function certifyZtMobile($mobile = '')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$this->admin->certifyByAPI('mobile');
|
||||
die(js::locate($this->createLink('mail', 'ztCloud'), 'parent'));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->admin->certifyMobile;
|
||||
$this->view->position[] = $this->lang->admin->certifyMobile;
|
||||
|
||||
$this->view->mobile = helper::safe64Decode($mobile);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function ajaxSendCode($type)
|
||||
{
|
||||
die($this->admin->sendCodeByAPI($type));
|
||||
}
|
||||
|
||||
public function sendmail()
|
||||
{
|
||||
$url = 'http://api.sendcloud.net/apiv2/mail/send';
|
||||
$params['apiUser'] = 'zentao_chunsheng';
|
||||
$params['apiKey'] = 'I70rz0E5Org4N3jU';
|
||||
$params['from'] = '876333172@qq.com';
|
||||
$params['fromName'] = 'QQ';
|
||||
$params['to'] = 'wyd621@163.com';
|
||||
$params['subject'] = 'test';
|
||||
$params['html'] = 'test';
|
||||
|
||||
$data = http_build_query($params);
|
||||
|
||||
$options['http'] = array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
||||
'content' => $data
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, FILE_TEXT, $context);
|
||||
|
||||
a($result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,16 @@
|
||||
* @version $Id: zh-cn.php 4767 2013-05-05 06:10:13Z wwccss $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
$lang->admin->common = '后台管理';
|
||||
$lang->admin->index = '后台管理首页';
|
||||
$lang->admin->checkDB = '检查数据库';
|
||||
$lang->admin->sso = '然之集成';
|
||||
$lang->admin->safeIndex = '安全';
|
||||
$lang->admin->checkWeak = '弱口令检查';
|
||||
$lang->admin->common = '后台管理';
|
||||
$lang->admin->index = '后台管理首页';
|
||||
$lang->admin->checkDB = '检查数据库';
|
||||
$lang->admin->sso = '然之集成';
|
||||
$lang->admin->safeIndex = '安全';
|
||||
$lang->admin->checkWeak = '弱口令检查';
|
||||
$lang->admin->certifyMobile = '认证手机';
|
||||
$lang->admin->certifyEmail = '认证邮箱';
|
||||
$lang->admin->captcha = '验证码';
|
||||
$lang->admin->getCaptcha = '获取验证码';
|
||||
|
||||
$lang->admin->info = new stdclass();
|
||||
$lang->admin->info->version = '当前系统的版本是%s,';
|
||||
|
||||
@@ -125,6 +125,55 @@ class adminModel extends model
|
||||
return $this->postAPI($apiURL, $_POST);
|
||||
}
|
||||
|
||||
public function getSecretKey()
|
||||
{
|
||||
//$apiURL = "http://www.zentao.net/user-secretKey.json";
|
||||
$apiURL = "http://www.zentao.cn/user-secretKey.json";
|
||||
$params['account'] = $this->config->global->community;
|
||||
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
$params['signature'] = $this->getSignature($params);
|
||||
$this->agent->cookies['lang'] = $this->cookie->lang;
|
||||
$this->agent->fetch($apiURL . '?' . http_build_query($params));
|
||||
$result = $this->agent->results;
|
||||
$result = json_decode($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function sendCodeByAPI($type)
|
||||
{
|
||||
$module = $type == 'mobile' ? 'sms' : 'mail';
|
||||
// $apiURL = "http://www.zentao.net/{$module}-apiSendCode.json";
|
||||
$apiURL = "http://www.zentao.cn/{$module}-apiSendCode.json";
|
||||
$params['account'] = $this->config->global->community;
|
||||
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
$params['signature'] = $this->getSignature($params);
|
||||
|
||||
$param = http_build_query($params);
|
||||
return $this->postAPI($apiURL . '?' . $param, $_POST);
|
||||
}
|
||||
|
||||
public function certifyByAPI($type)
|
||||
{
|
||||
$module = $type == 'mobile' ? 'sms' : 'mail';
|
||||
// $apiURL = "http://www.zentao.net/{$module}-apiCertify.json";
|
||||
$apiURL = "http://www.zentao.cn/{$module}-apiCertify.json";
|
||||
$params['account'] = $this->config->global->community;
|
||||
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
$params['signature'] = $this->getSignature($params);
|
||||
|
||||
$param = http_build_query($params);
|
||||
return $this->postAPI($apiURL . '?' . $param, $_POST);
|
||||
}
|
||||
|
||||
public function getSignature($params)
|
||||
{
|
||||
ksort($params);
|
||||
$data = '';
|
||||
foreach($params as $key => $value) $data .= $key . '=' . $value . '&';
|
||||
$privateKey = $this->config->global->ztPrivateKey;
|
||||
return md5($privateKey . '&' . $data . $privateKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get register information.
|
||||
*
|
||||
|
||||
@@ -22,7 +22,11 @@
|
||||
<table align='center' class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->user->account;?></th>
|
||||
<td><?php echo html::input('account', '', "class='form-control'");?></td>
|
||||
<?php
|
||||
$account = zget($config->global, 'community', '');
|
||||
if($account == 'na') $account = '';
|
||||
?>
|
||||
<td><?php echo html::input('account', $account, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->password;?></th>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* The certifyztmobile view file of admin module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package admin
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div class='panel' id='checkEmail'>
|
||||
<div class='panel-heading'><strong><?php echo $lang->admin->certifyEmail;?></strong></div>
|
||||
<div class='panel-body'>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->email;?></th>
|
||||
<td><?php echo html::input('email', $email, "class='form-control'");?></td>
|
||||
<td><?php echo html::a(inlink('ajaxsendcode', 'type=email'), $lang->admin->getCaptcha, '', "id='codeSender' class='btn btn-xs'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->admin->captcha;?></th>
|
||||
<td><?php echo html::input('captcha', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#codeSender').click(function()
|
||||
{
|
||||
var data = {email: $('#email').val()};
|
||||
var url = $(this).attr('href');
|
||||
|
||||
$.post(url, data, function(response)
|
||||
{
|
||||
if(response.result == 'success')
|
||||
{
|
||||
$('#codeSender').popover({trigger:'manual', content:response.message, placement:'right'}).popover('show');
|
||||
$('#codeSender').next('.popover').addClass('popover-success');
|
||||
function distroy(){$('#codeSender').popover('destroy')}
|
||||
setTimeout(distroy,2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(response.message);
|
||||
}
|
||||
}, 'json')
|
||||
return false;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* The certifyztmobile view file of admin module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package admin
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div class='panel' id='checkMobile'>
|
||||
<div class='panel-heading'><strong><?php echo $lang->admin->certifyMobile;?></strong></div>
|
||||
<div class='panel-body'>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->mobile;?></th>
|
||||
<td><?php echo html::input('mobile', $mobile, "class='form-control'");?></td>
|
||||
<td><?php echo html::a(inlink('ajaxsendcode', 'type=mobile'), $lang->admin->getCaptcha, '', "id='codeSender' class='btn btn-xs'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->admin->captcha;?></th>
|
||||
<td><?php echo html::input('captcha', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#codeSender').click(function()
|
||||
{
|
||||
var data = {mobile: $('#mobile').val()};
|
||||
var url = $(this).attr('href');
|
||||
|
||||
$.post(url, data, function(response)
|
||||
{
|
||||
if(response.result == 'success')
|
||||
{
|
||||
$('#codeSender').popover({trigger:'manual', content:response.message, placement:'right'}).popover('show');
|
||||
$('#codeSender').next('.popover').addClass('popover-success');
|
||||
function distroy(){$('#codeSender').popover('destroy')}
|
||||
setTimeout(distroy,2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(response.message);
|
||||
}
|
||||
}, 'json')
|
||||
return false;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -19,10 +19,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class='alert'>
|
||||
<div class='pull-right'><?php echo html::a(inlink('bind'), $lang->admin->bind->caption, '', "class='btn btn-success'");?></div>
|
||||
<div class='pull-right'><?php echo html::a(inlink('bind', "from=$from"), $lang->admin->bind->caption, '', "class='btn btn-success'");?></div>
|
||||
<i class='icon-info-sign'></i>
|
||||
<div class='content'>
|
||||
<?php echo sprintf($lang->admin->register->bind, html::a(inlink('bind'), $lang->admin->register->click));?>
|
||||
<?php echo sprintf($lang->admin->register->bind, html::a(inlink('bind', "from=$from"), $lang->admin->register->click));?>
|
||||
</div>
|
||||
</div>
|
||||
<form class='form-condensed mw-600px' method="post" target="hiddenwin">
|
||||
@@ -43,8 +43,8 @@
|
||||
<td><?php echo html::input('company', $register->company, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->phone;?></th>
|
||||
<td><?php echo html::input('phone', '', "class='form-control'");?></td>
|
||||
<th><?php echo $lang->user->mobile;?></th>
|
||||
<td><?php echo html::input('mobile', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->email;?></th>
|
||||
|
||||
@@ -40,6 +40,7 @@ class mail extends control
|
||||
if($this->config->mail->turnon)
|
||||
{
|
||||
if($this->config->mail->mta == 'sendcloud') $this->locate(inlink('sendcloud'));
|
||||
if($this->config->mail->mta == 'ztcloud') $this->locate(inlink('ztcloud'));
|
||||
if($this->config->mail->mta == 'smtp') $this->locate(inlink('edit'));
|
||||
}
|
||||
$this->view->title = $this->lang->mail->common . $this->lang->colon . $this->lang->mail->index;
|
||||
@@ -452,4 +453,79 @@ class mail extends control
|
||||
$this->view->users = $this->loadModel('user')->getList();
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function ztCloud()
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$mailConfig = new stdclass();
|
||||
$mailConfig->sendcloud = new stdclass();
|
||||
|
||||
$mailConfig->turnon = $this->post->turnon;
|
||||
$mailConfig->mta = 'ztcloud';
|
||||
$mailConfig->async = $this->post->async;
|
||||
$mailConfig->fromAddress = $this->post->fromAddress;
|
||||
$mailConfig->fromName = $this->post->fromName;
|
||||
$mailConfig->domain = trim($this->post->domain);
|
||||
|
||||
if(empty($mailConfig->fromName)) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->mail->fromName)));
|
||||
|
||||
$this->loadModel('setting')->setItems('system.mail', $mailConfig);
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->mail->ztCloud;
|
||||
$this->view->position[] = html::a(inlink('index'), $this->lang->mail->common);
|
||||
$this->view->position[] = $this->lang->mail->ztCloud;
|
||||
if(!empty($this->config->mail->ztcloud->secretKey))
|
||||
{
|
||||
$mailConfig = new stdclass();
|
||||
$mailConfig->fromAddress = $this->config->mail->fromAddress;
|
||||
$mailConfig->fromName = $this->config->mail->fromName;
|
||||
$mailConfig->turnon = $this->config->mail->turnon;
|
||||
$mailConfig->domain = isset($this->config->mail->domain) ? $this->config->mail->domain : common::getSysURL();
|
||||
$mailConfig->async = isset($this->config->mail->async) ? $this->config->mail->async : 0;
|
||||
|
||||
$this->view->mailExist = $this->mail->mailExist();
|
||||
$this->view->mailConfig = $mailConfig;
|
||||
$this->view->step = 'config';
|
||||
die($this->display());
|
||||
}
|
||||
|
||||
if($this->cookie->ztCloudLicense != 'yes')
|
||||
{
|
||||
$this->view->step = 'license';
|
||||
die($this->display());
|
||||
}
|
||||
if(empty($this->config->global->ztPrivateKey) or $this->config->global->community == 'na' or empty($this->config->global->community))
|
||||
{
|
||||
if(!empty($this->config->global->community) and $this->config->global->community != 'na') die(js::locate($this->createLink('admin', 'bind', 'from=mail')));
|
||||
die(js::locate($this->createLink('admin', 'register', 'from=mail')));
|
||||
}
|
||||
$result = $this->loadModel('admin')->getSecretKey();
|
||||
$data = $result->data;
|
||||
if($result->result == 'fail' and empty($data->emailCertified))
|
||||
{
|
||||
die(js::locate($this->createLink('admin', 'certifyZtEmail', 'email=' . helper::safe64Encode($data->email))));
|
||||
}
|
||||
if($result->result == 'fail' and (empty($data->mobileCertified) or $data->mobileCertified != $data->mobile))
|
||||
{
|
||||
die(js::locate($this->createLink('admin', 'certifyZtMobile', 'mobile=' . helper::safe64Encode($data->mobile))));
|
||||
}
|
||||
if($result->result == 'success')
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.mail.ztcloud.secretKey', $data->secretKey);
|
||||
$this->setting->setItem('system.mail.fromAddress', $data->email);
|
||||
|
||||
$mailConfig = new stdclass();
|
||||
$mailConfig->turnon = true;
|
||||
$mailConfig->fromAddress = $data->email;
|
||||
$mailConfig->fromName = $this->config->mail->fromName;
|
||||
$mailConfig->domain = isset($this->config->mail->domain) ? $this->config->mail->domain : common::getSysURL();
|
||||
|
||||
$this->view->mailConfig = $mailConfig;
|
||||
$this->view->step = 'config';
|
||||
die($this->display());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
function agreeLicense()
|
||||
{
|
||||
$.cookie('ztCloudLicense', 'yes', {expires:config.cookieLife, path:config.webRoot});
|
||||
self.location.href=self.location.href;
|
||||
}
|
||||
@@ -8,9 +8,12 @@ $lang->mail->test = '测试发信';
|
||||
$lang->mail->reset = '重置';
|
||||
$lang->mail->browse = '邮件列表';
|
||||
$lang->mail->delete = '删除邮件';
|
||||
$lang->mail->sendCloud = 'SendCloud发信';
|
||||
$lang->mail->ztCloud = 'SendCloud发信';
|
||||
$lang->mail->sendCloud = 'Notice发信';
|
||||
$lang->mail->batchDelete = '批量删除';
|
||||
$lang->mail->sendcloudUser = '同步联系人';
|
||||
$lang->mail->agreeLicense = '同意';
|
||||
$lang->mail->disagree = '不同意';
|
||||
|
||||
$lang->mail->turnon = '是否打开';
|
||||
$lang->mail->async = '异步发送';
|
||||
@@ -27,6 +30,7 @@ $lang->mail->debug = '调试级别';
|
||||
$lang->mail->charset = '编码';
|
||||
$lang->mail->accessKey = 'accessKey';
|
||||
$lang->mail->secretKey = 'secretKey';
|
||||
$lang->mail->license = 'Sendcloud发信须知';
|
||||
|
||||
$lang->mail->selectMTA = '请选择发信方式:';
|
||||
$lang->mail->smtp = 'SMTP发信';
|
||||
@@ -85,6 +89,12 @@ EOD;
|
||||
$lang->mail->sendCloudSuccess = '操作成功';
|
||||
$lang->mail->closeSendCloud = '关闭SendCloud';
|
||||
$lang->mail->addressWhiteList = '为防止邮件被屏蔽,请在邮件服务器里面将发信邮箱设为白名单';
|
||||
$lang->mail->ztCloudNotice = <<<EOD
|
||||
<p>1、用户需到禅道官网做账号绑定,并且认证手机和邮箱。同时填写公司信息以便完成禅道企业认证。绑定完成后,即可发信。但每天只能发50封,而且只能用三天。</p>
|
||||
<p>2、禅道对用户提交的认证完成审核,并通过后,即可享受七天,每天200封的发信服务。</p>
|
||||
<p>3、我们会将认证通过的用户信息提交到Sendcloud做认证。Sendcloud认证通过之后,即可享受每天定200封的完整服务。</p>
|
||||
<p>如果不同意以上条款,就不能该服务。</p>
|
||||
EOD;
|
||||
|
||||
$lang->mail->placeholder = new stdclass();
|
||||
$lang->mail->placeholder->password = '有些邮箱需要填写单独申请的授权码,具体请到邮箱相关设置查询。';
|
||||
|
||||
+10
-2
@@ -21,7 +21,8 @@ class mailModel extends model
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->app->loadClass($this->config->mail->mta == 'sendcloud' ? 'sendcloud' : 'phpmailer', $static = true);
|
||||
$mta = $this->config->mail->mta;
|
||||
$this->app->loadClass(($mta == 'sendcloud' or $mta == 'ztcloud') ? $mta : 'phpmailer', $static = true);
|
||||
$this->setMTA();
|
||||
}
|
||||
|
||||
@@ -162,7 +163,8 @@ class mailModel extends model
|
||||
*/
|
||||
public function setMTA()
|
||||
{
|
||||
$className = $this->config->mail->mta == 'sendcloud' ? 'sendcloud' : 'phpmailer';
|
||||
$mta = $this->config->mail->mta;
|
||||
$className = ($mta == 'sendcloud' or $mta == 'ztcloud') ? $mta : 'phpmailer';
|
||||
if(self::$instance == null) self::$instance = new $className(true);
|
||||
$this->mta = self::$instance;
|
||||
$this->mta->CharSet = $this->config->charset;
|
||||
@@ -204,6 +206,12 @@ class mailModel extends model
|
||||
$this->mta->secretKey = $this->config->mail->sendcloud->secretKey;
|
||||
}
|
||||
|
||||
public function setZtcloud()
|
||||
{
|
||||
$this->mta->account = $this->config->global->community;
|
||||
$this->mta->secretKey = $this->config->mail->ztcloud->secretKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPmail.
|
||||
*
|
||||
|
||||
@@ -24,8 +24,8 @@ include '../../common/view/header.html.php';
|
||||
<?php if(common::hasPriv('mail', 'detect')):?>
|
||||
<?php echo html::a(inlink('detect'), $lang->mail->smtp, '', "class='btn btn-sm w-120px'")?>
|
||||
<?php endif;?>
|
||||
<?php if($this->app->getClientLang() != 'en' and common::hasPriv('mail', 'sendCloud')):?>
|
||||
<?php echo html::a(inlink('sendCloud'), $lang->mail->sendCloud, '', "class='btn btn-sm w-120px'")?>
|
||||
<?php if($this->app->getClientLang() != 'en' and common::hasPriv('mail', 'ztCloud')):?>
|
||||
<?php echo html::a(inlink('ztCloud'), $lang->mail->ztCloud, '', "class='btn btn-sm w-120px'")?>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
<td class='text-left'>
|
||||
<?php
|
||||
echo html::submitButton($lang->mail->test);
|
||||
echo html::linkButton($lang->mail->edit, inLink($config->mail->mta == 'sendcloud' ? 'sendcloud' : 'edit'));
|
||||
$mta = $config->mail->mta;
|
||||
echo html::linkButton($lang->mail->edit, inlink(($mta == 'sendcloud' or $mta == 'ztcloud') ? $mta : 'edit'));
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* The ztcloud view file of mail module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package mail
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div class='container mw-800px'>
|
||||
<?php if($step == 'license'):?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'><strong><?php echo $lang->mail->license;?></strong></div>
|
||||
</div>
|
||||
<div class='content' style='padding:20px;'>
|
||||
<div class='license'><?php echo$lang->mail->ztCloudNotice;?></div>
|
||||
<p>
|
||||
<?php echo html::a("javascript:agreeLicense()", $lang->mail->agreeLicense, '', "class='btn'");?>
|
||||
<?php echo html::a(inlink('index'), $lang->mail->disagree, '', "class='btn'");?>
|
||||
</p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
<span class='prefix'><?php echo html::icon($lang->icons['mail']);?></span>
|
||||
<strong><?php echo $lang->mail->common;?></strong>
|
||||
<small class='text-muted'> <?php echo $lang->mail->edit;?> <?php echo html::icon('pencil');?></small>
|
||||
</div>
|
||||
</div>
|
||||
<form class='form-condensed' method='post' target='hiddenwin' id='dataform'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='rowhead w-120px'><?php echo $lang->mail->turnon; ?></th>
|
||||
<td class='w-250px'><?php echo html::radio('turnon', $lang->mail->turnonList, isset($mailConfig->turnon) ? $mailConfig->turnon : 1);?></td>
|
||||
</tr>
|
||||
<?php if(!empty($config->global->cron)):?>
|
||||
<tr>
|
||||
<th class='text-top'><?php echo $lang->mail->async?></th>
|
||||
<td><?php echo html::radio('async', $lang->mail->asyncList, zget($config->mail, 'async', 0))?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->mail->domain?></th>
|
||||
<td><?php echo html::input('domain', zget($config->mail, 'domain', common::getSysURL()), "class='form-control'")?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->mail->fromAddress; ?></th>
|
||||
<td><?php echo html::input('fromAddress', $mailConfig->fromAddress, "class='form-control'");?></td>
|
||||
<td colspan='2'><?php echo $lang->mail->addressWhiteList?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->mail->fromName; ?></th>
|
||||
<td colspan='3'>
|
||||
<div class='required required-wrapper'></div>
|
||||
<?php echo html::input('fromName', $mailConfig->fromName, "class='form-control'");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='text-center'>
|
||||
<?php
|
||||
echo html::submitButton();
|
||||
if($this->config->mail->turnon and $mailExist) echo html::linkButton($lang->mail->test, inlink('test'));
|
||||
echo html::linkButton($lang->mail->reset, inlink('reset'));
|
||||
if(common::hasPriv('mail', 'browse') and !empty($config->mail->async) and !empty($config->global->cron)) echo html::linkButton($lang->mail->browse, inlink('browse'));
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -19,7 +19,7 @@ include '../../common/view/chosen.html.php';
|
||||
#bysearchTab {transition: all .3s cubic-bezier(.175, .885, .32, 1);}
|
||||
#bysearchTab.active {background: #fff; padding: 2px 10px 3px; padding-bottom: 2px\0; border: 1px solid #ddd; border-bottom: none}
|
||||
#bysearchTab.active:hover {background: #ddd}
|
||||
#bysearchTab.active > a:after {font-size: 14px; font-family: ZenIcon; content: ' \e6e2'; color: #808080}
|
||||
#bysearchTab.active > a:after {font-size: 14px; font-family: NewZenIcon; content: ' \e6e2'; color: #808080}
|
||||
#featurebar .nav {position: relative;}
|
||||
#featurebar .nav .dropdown .dropdown-menu{z-index:1010;}
|
||||
#querybox form{padding-right: 40px;}
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
#task .task-desc > ul > li {position: relative; padding: 2px 0; overflow: hidden; padding-left: 26px; transition: background .5s}
|
||||
#task .task-desc > ul > li[data-target].finish {color: #999; text-decoration: line-through;}
|
||||
#task .task-desc > ul > li[data-target].finish .task-nav {opacity: .6; text-decoration: line-through;}
|
||||
#task .task-desc > ul > li:before {font-family: ZenIcon; font-size: 14px; font-style: normal; font-weight: 400; font-variant: normal; line-height: 1; text-transform: none; speak: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; content: '\e6ec'; display: block; width: 26px; height: 20px; line-height: 20px; text-align: center; opacity: .6; color: #808080; position: absolute; top: 2px; left: 0}
|
||||
#task .task-desc > ul > li:before {font-family: NewZenIcon; font-size: 14px; font-style: normal; font-weight: 400; font-variant: normal; line-height: 1; text-transform: none; speak: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; content: '\e6ec'; display: block; width: 26px; height: 20px; line-height: 20px; text-align: center; opacity: .6; color: #808080; position: absolute; top: 2px; left: 0}
|
||||
#task .task-desc > ul > li[data-target]:after {content: ' '; display: block; position: absolute; left: 0; top: -100%; width: 100%; height: 100%; border: 2px solid #F1A325; transition: top .5s}
|
||||
#task .task-desc > ul > li[data-target]:before {content: '\e6e8'; color: #333}
|
||||
#task .task-desc > ul > li[data-target]:before {font-family: ZenIcon; content: '\e6e8'; color: #333}
|
||||
#task .task-desc > ul > li[data-target].finish:after {top: 100%;}
|
||||
#task .task-desc > ul > li[data-target].finish:before {content: '\e653'; color: #38B03F}
|
||||
#task .task-desc > ul > li[data-target].active {background: #FFF0D5}
|
||||
#task .task-desc > ul > li[data-target].active:after {top: 0%}
|
||||
#task .task-desc > ul > li[data-target].active:before {color: #EA644A; content: '\f192'}
|
||||
#task .task-desc > ul > li[data-target].active:before {font-family: ZenIcon; color: #EA644A; content: '\f192'}
|
||||
#openTaskPage {display: block; overflow: hidden; position: relative; height: 36px; background: #f5f5f5}
|
||||
#openTaskPage > div {padding: 8px 10px; line-height: 20px; transition: top .4s cubic-bezier(.175,.885,.32,1); position: absolute; left: 0; top: 0; right: 0}
|
||||
#openTaskPage > div > .icon {display: inline-block; width: 30px; text-align: center}
|
||||
|
||||
Reference in New Issue
Block a user