* finish the task #555
This commit is contained in:
@@ -210,11 +210,13 @@ $lang->admin->menu->trashes = array('link' => 'Trash|action|trash', 'subModule
|
||||
$lang->admin->menu->convert = array('link' => 'Import|convert|index', 'subModule' => 'convert');
|
||||
$lang->admin->menu->extension = array('link' => 'Extension|extension|browse', 'subModule' => 'extension');
|
||||
$lang->admin->menu->editor = array('link' => 'Extension editor|editor|index', 'subModule' => 'editor');
|
||||
$lang->admin->menu->email = array('link' => 'ConfigEmail|mail|set', 'subModule' => 'mail');
|
||||
$lang->convert->menu = $lang->admin->menu;
|
||||
$lang->upgrade->menu = $lang->admin->menu;
|
||||
$lang->action->menu = $lang->admin->menu;
|
||||
$lang->extension->menu = $lang->admin->menu;
|
||||
$lang->editor->menu = $lang->admin->menu;
|
||||
$lang->mail->menu = $lang->admin->menu;
|
||||
|
||||
/* Groups. */
|
||||
$lang->menugroup->release = 'product';
|
||||
@@ -235,6 +237,7 @@ $lang->menugroup->todo = 'my';
|
||||
$lang->menugroup->action = 'admin';
|
||||
$lang->menugroup->extension = 'admin';
|
||||
$lang->menugroup->editor = 'admin';
|
||||
$lang->menugroup->mail = 'admin';
|
||||
|
||||
/* Error info. */
|
||||
$lang->error->companyNotFound = "The domain %s does not exist.";
|
||||
|
||||
@@ -210,11 +210,13 @@ $lang->admin->menu->trashes = array('link' => '回收站|action|trash', 'subMo
|
||||
$lang->admin->menu->convert = array('link' => '从其他系统导入|convert|index', 'subModule' => 'convert');
|
||||
$lang->admin->menu->extension = array('link' => '插件管理|extension|browse', 'subModule' => 'extension');
|
||||
$lang->admin->menu->editor = array('link' => '扩展编辑器|editor|index', 'subModule' => 'editor');
|
||||
$lang->admin->menu->mail = array('link' => 'Email配置|mail|set', 'subModule' => 'mail');
|
||||
$lang->convert->menu = $lang->admin->menu;
|
||||
$lang->upgrade->menu = $lang->admin->menu;
|
||||
$lang->action->menu = $lang->admin->menu;
|
||||
$lang->extension->menu = $lang->admin->menu;
|
||||
$lang->editor->menu = $lang->admin->menu;
|
||||
$lang->mail->menu = $lang->admin->menu;
|
||||
|
||||
/*菜单设置:分组设置。*/
|
||||
$lang->menugroup->release = 'product';
|
||||
@@ -235,6 +237,7 @@ $lang->menugroup->todo = 'my';
|
||||
$lang->menugroup->action = 'admin';
|
||||
$lang->menugroup->extension = 'admin';
|
||||
$lang->menugroup->editor = 'admin';
|
||||
$lang->menugroup->mail = 'admin';
|
||||
|
||||
/* 错误提示信息。*/
|
||||
$lang->error->companyNotFound = "您访问的域名 %s 没有对应的公司。";
|
||||
|
||||
Executable
+106
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* The control file of mail module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2011 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Yangyang Shi <shiyangyang@cnezsoft.com>
|
||||
* @package mail
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class mail extends control
|
||||
{
|
||||
/**
|
||||
* Config email.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function set()
|
||||
{
|
||||
$this->view->mailConfig = $this->app->loadConfig('mail')->mail;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the email config.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
if('gmail' == $this->post->mta)
|
||||
{
|
||||
$config = <<<EOT
|
||||
<?php
|
||||
\$config->mail->turnon = {$this->post->turnon};
|
||||
\$config->mail->fromAddress = "{$this->post->fromAddress}";
|
||||
\$config->mail->mta = "gmail";
|
||||
\$config->mail->fromName = "{$this->post->fromName}";
|
||||
\$config->mail->gmail->debug = {$this->post->gmailDebug};
|
||||
\$config->mail->gmail->username = "{$this->post->gmailUsername}";
|
||||
\$config->mail->gmail->password = "{$this->post->gmailPassword}";
|
||||
EOT;
|
||||
}
|
||||
elseif('smtp' == $this->post->mta)
|
||||
{
|
||||
$position = strpos($this->post->fromAddress, '@');
|
||||
$host = 'smtp.' . substr($this->post->fromAddress, $position + 1);
|
||||
|
||||
$config = <<<EOT
|
||||
<?php
|
||||
\$config->mail->turnon = {$this->post->turnon};
|
||||
\$config->mail->fromAddress = "{$this->post->fromAddress}";
|
||||
\$config->mail->mta = "{$this->post->mta}";
|
||||
\$config->mail->fromName = "{$this->post->fromName}";
|
||||
\$config->mail->smtp->debug = {$this->post->smtpDebug};
|
||||
\$config->mail->smtp->username = "{$this->post->smtpUsername}";
|
||||
\$config->mail->smtp->password = "{$this->post->smtpPassword}";
|
||||
\$config->mail->smtp->auth = {$this->post->smtpAuth};
|
||||
\$config->mail->smtp->host = "$host";
|
||||
\$config->mail->smtp->secure = "{$this->post->smtpSecure}";
|
||||
\$config->mail->smtp->port = "{$this->post->smtpPort}";
|
||||
EOT;
|
||||
}
|
||||
elseif('phpmail' == $this->post->mta or 'sendmail' == $this->post->mta)
|
||||
{
|
||||
$config = <<<EOT
|
||||
<?php
|
||||
\$config->mail->turnon = {$this->post->turnon};
|
||||
\$config->mail->fromAddress = "{$this->post->fromAddress}";
|
||||
\$config->mail->mta = "{$this->post->mta}";
|
||||
\$config->mail->fromName = "{$this->post->fromName}";
|
||||
EOT;
|
||||
}
|
||||
|
||||
/* Output config to the extconfig file of mail */
|
||||
$configPath = $this->app->getModuleExtPath('mail', 'config');
|
||||
if(is_writable($configPath))
|
||||
{
|
||||
if(file_put_contents($configPath . 'zzzmail.php', $config))
|
||||
{
|
||||
/* Send test mail */
|
||||
$this->mail->send($this->app->user->account, $this->lang->mail->subject, $this->lang->mail->content,"");
|
||||
if($this->mail->isError()) echo js::error($this->mail->getError());
|
||||
echo js::confirm($this->lang->mail->confirmSave,$this->createLink('mail', 'set'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->view->config = $config;
|
||||
$this->view->configPath = $configPath;
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->view->config = $config;
|
||||
$this->view->configPath = $configPath;
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
function setMtaType(type)
|
||||
{
|
||||
if(type == 'gmail')
|
||||
{
|
||||
$('#gmailUsername').show();
|
||||
$('#gmailPassword').show();
|
||||
$('#gmailDebug').show();
|
||||
$('#smtpDebug').hide();
|
||||
$('#smtpUsername').hide();
|
||||
$('#smtpPassword').hide();
|
||||
$('#smtpAuth').hide();
|
||||
$('#smtpSecure').hide();
|
||||
$('#smtpPort').hide();
|
||||
}
|
||||
else if(type == 'smtp')
|
||||
{
|
||||
$('#gmailUsername').hide();
|
||||
$('#gmailPassword').hide();
|
||||
$('#gmailDebug').hide();
|
||||
$('#smtpDebug').show();
|
||||
$('#smtpUsername').show();
|
||||
$('#smtpPassword').show();
|
||||
$('#smtpAuth').show();
|
||||
$('#smtpSecure').show();
|
||||
$('#smtpPort').show();
|
||||
}
|
||||
else if(type == 'phpmail' || type == 'sendmail')
|
||||
{
|
||||
$('#gmailUsername').hide();
|
||||
$('#gmailPassword').hide();
|
||||
$('#gmailDebug').hide();
|
||||
$('#smtpDebug').hide();
|
||||
$('#smtpUsername').hide();
|
||||
$('#smtpPassword').hide();
|
||||
$('#smtpAuth').hide();
|
||||
$('#smtpSecure').hide();
|
||||
$('#smtpPort').hide();
|
||||
}
|
||||
}
|
||||
function setVerificationType(type)
|
||||
{
|
||||
if(type == 'true')
|
||||
{
|
||||
$('#smtpUsername').show();
|
||||
$('#smtpPassword').show();
|
||||
}
|
||||
else if(type == 'false')
|
||||
{
|
||||
$('#smtpUsername').hide();
|
||||
$('#smtpPassword').hide();
|
||||
}
|
||||
}
|
||||
type = document.getElementById("mta")
|
||||
setMtaType(type.value);
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
$lang->mail->setParam = 'Please input param of Email';
|
||||
|
||||
$lang->mail->turnon = 'trun on email feature or not';
|
||||
$lang->mail->fromAddress = 'The from address';
|
||||
$lang->mail->fromName = 'The from name';
|
||||
$lang->mail->mta = 'The style of send email';
|
||||
$lang->mail->debugExample = '0:close,1 and 2 :open,2 is more infomation than 1';
|
||||
|
||||
$lang->mail->mtaList[''] = '';
|
||||
$lang->mail->mtaList['gmail'] = 'gmail';
|
||||
$lang->mail->mtaList['smtp'] = 'smtp';
|
||||
$lang->mail->mtaList['phpmail'] = 'phpmail';
|
||||
$lang->mail->mtaList['sendmail'] = 'sendmail';
|
||||
|
||||
/* Trun on email feature or not */
|
||||
$lang->mail->turnonList['true'] = 'open';
|
||||
$lang->mail->turnonList['false'] = 'close';
|
||||
|
||||
$lang->mail->debugList[0] = '0';
|
||||
$lang->mail->debugList[1] = '1';
|
||||
$lang->mail->debugList[2] = '2';
|
||||
|
||||
$lang->mail->smtp->authList['true'] = 'yes';
|
||||
$lang->mail->smtp->authList['false'] = 'no';
|
||||
|
||||
$lang->mail->smtp->secureList[''] = 'not encode';
|
||||
$lang->mail->smtp->secureList['ssl'] = 'ssl';
|
||||
$lang->mail->smtp->secureList['tls'] = 'tls';
|
||||
|
||||
/* Set SMTP */
|
||||
$lang->mail->smtp->fromName = 'The from name';
|
||||
$lang->mail->smtp->auth = 'Need auth or not';
|
||||
$lang->mail->smtp->debug = 'Debug level';
|
||||
$lang->mail->smtp->secure = 'The type to encode datas';
|
||||
$lang->mail->smtp->username = 'The smtp user';
|
||||
$lang->mail->smtp->password = "The smtp user's password";
|
||||
$lang->mail->smtp->port = 'The smtp server host port';
|
||||
$lang->mail->smtp->portInfo = 'ssl: default port is 465, tls: default port is 587, not encode: default port is empty';
|
||||
/* Set gmail */
|
||||
$lang->mail->gmail->username = 'The gmail user';
|
||||
$lang->mail->gmail->password = "The gmail user'password";
|
||||
$lang->mail->gmail->debug = 'Debug level';
|
||||
|
||||
$lang->mail->confirmSave = 'Save successful.Please login your email to view the test mail';
|
||||
$lang->mail->subject = 'The test mail';
|
||||
$lang->mail->content = "The email's param is setted";
|
||||
|
||||
/* Save config information */
|
||||
$lang->mail->configInfo = 'Config information';
|
||||
$lang->mail->saveConfig = 'Please save Config information to:';
|
||||
$lang->mail->createFile = 'If the zzz.php is not exist, please create it.';
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
$lang->mail->setParam = '请设置下面的配置参数';
|
||||
|
||||
$lang->mail->turnon = '是否打开发信功能';
|
||||
$lang->mail->fromAddress = '发信人邮箱';
|
||||
$lang->mail->fromName = '发信人名称';
|
||||
$lang->mail->mta = '请选择发信方式';
|
||||
$lang->mail->debugExample = '0表示关闭调试信息,1和2表示打开调试信息,但2比1调试信息显示更详细';
|
||||
|
||||
$lang->mail->mtaList[''] = '';
|
||||
$lang->mail->mtaList['gmail'] = 'gmail';
|
||||
$lang->mail->mtaList['smtp'] = 'smtp';
|
||||
$lang->mail->mtaList['phpmail'] = 'phpmail';
|
||||
$lang->mail->mtaList['sendmail'] = 'sendmail';
|
||||
|
||||
/* Trun on email feature or not */
|
||||
$lang->mail->turnonList['true'] = '打开';
|
||||
$lang->mail->turnonList['false'] = '关闭';
|
||||
|
||||
$lang->mail->debugList[0] = '0';
|
||||
$lang->mail->debugList[1] = '1';
|
||||
$lang->mail->debugList[2] = '2';
|
||||
|
||||
$lang->mail->smtp->authList['true'] = '是';
|
||||
$lang->mail->smtp->authList['false'] = '否';
|
||||
|
||||
$lang->mail->smtp->secureList[''] = '不加密';
|
||||
$lang->mail->smtp->secureList['ssl'] = 'ssl';
|
||||
$lang->mail->smtp->secureList['tls'] = 'tls';
|
||||
|
||||
/* Set SMTP */
|
||||
$lang->mail->smtp->fromName = '发信人姓名';
|
||||
$lang->mail->smtp->auth = '是否需要验证';
|
||||
$lang->mail->smtp->debug = '请选择调试等级';
|
||||
$lang->mail->smtp->secure = '请选择SMTP加密方式';
|
||||
$lang->mail->smtp->username = '发信邮箱用户名';
|
||||
$lang->mail->smtp->password = '请输入密码';
|
||||
$lang->mail->smtp->port = '请输入端口号';
|
||||
$lang->mail->smtp->portInfo = 'ssl加密方式默认端口号为465,tls加密方式默认端口号为587,不加密端口号一般为空';
|
||||
/* Set gmail */
|
||||
$lang->mail->gmail->username = '请输入发信邮箱用户名';
|
||||
$lang->mail->gmail->password = '请输入发信邮箱密码';
|
||||
$lang->mail->gmail->debug = '请选择调试等级';
|
||||
|
||||
$lang->mail->confirmSave = '保存成功, 请到您的邮箱中查看测试邮件是否发送成功。';
|
||||
$lang->mail->subject = '测试邮件';
|
||||
$lang->mail->content = '邮箱设置成功';
|
||||
|
||||
/* Save config information */
|
||||
$lang->mail->configInfo = '配置信息';
|
||||
$lang->mail->saveConfig = '请将该配置信息保存到: ';
|
||||
$lang->mail->createFile = '如果zzz.php文件不存在,请手动创建该文件,将以上配置保存即可。';
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* The config email view file of mail module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2011 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Yangyang Shi <shiyangyang@cnezsoft.com>
|
||||
* @package mail
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
include '../../common/view/header.html.php';
|
||||
?>
|
||||
<table class='table-6' align='center'>
|
||||
<caption><?php echo $lang->mail->configInfo ?></caption>
|
||||
<tr>
|
||||
<td><? echo html::textArea('', $config, "rows='15' class='area-1 f-12px'");?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->mail->saveConfig . $configPath . 'config.php' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->mail->createFile ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
Executable
+132
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* The config email view file of mail module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2011 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Yangyang Shi <shiyangyang@cnezsoft.com>
|
||||
* @package mail
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
include '../../common/view/header.html.php';
|
||||
include '../../common/view/tablesorter.html.php';?>
|
||||
<?php
|
||||
if(!empty($mailConfig->gmail->username))
|
||||
{
|
||||
$gmailUsername = $mailConfig->gmail->username;
|
||||
}
|
||||
else
|
||||
{
|
||||
$gmailUsername = '';
|
||||
}
|
||||
if(!empty($mailConfig->gmail->password))
|
||||
{
|
||||
$gmailPassword = $mailConfig->gmail->password;
|
||||
}
|
||||
else
|
||||
{
|
||||
$gmailPassword = '';
|
||||
}
|
||||
if(!empty($mailConfig->smtp->username))
|
||||
{
|
||||
$smtpUsername = $mailConfig->smtp->username;
|
||||
}
|
||||
else
|
||||
{
|
||||
$smtpUsername = '';
|
||||
}
|
||||
if(!empty($mailConfig->smtp->password))
|
||||
{
|
||||
$smtpPassword = $mailConfig->smtp->password;
|
||||
}
|
||||
else
|
||||
{
|
||||
$smtpPassword = '';
|
||||
}
|
||||
if(!empty($mailConfig->smtp->secure))
|
||||
{
|
||||
$smtpSecure = $mailConfig->smtp->secure;
|
||||
}
|
||||
else
|
||||
{
|
||||
$smtpSecure = '';
|
||||
}
|
||||
if(!empty($mailConfig->smtp->auth))
|
||||
{
|
||||
$smtpAuth = $mailConfig->smtp->auth;
|
||||
}
|
||||
else
|
||||
{
|
||||
$smtpAuth = '';
|
||||
}
|
||||
if(!empty($mailConfig->smtp->port))
|
||||
{
|
||||
$smtpPort = $mailConfig->smtp->port;
|
||||
}
|
||||
else
|
||||
{
|
||||
$smtpPort = '';
|
||||
}
|
||||
?>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin' action='<?php echo inlink('save');?>'>
|
||||
<table align='center' class='table-1'>
|
||||
<caption><?php echo $lang->mail->setParam; ?></caption>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->mail->turnon; ?></th>
|
||||
<td><?php echo html::select('turnon', $lang->mail->turnonList, $mailConfig->turnon); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->mail->mta; ?></th>
|
||||
<td><?php echo html::select('mta', $lang->mail->mtaList, $mailConfig->mta, 'class=select-3 onchange=setMtaType(this.value)'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->mail->fromAddress; ?></th>
|
||||
<td><?php echo html::input('fromAddress', $mailConfig->fromAddress) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->mail->fromName; ?></th>
|
||||
<td><?php echo html::input('fromName', $mailConfig->fromName) ?></td>
|
||||
</tr>
|
||||
<tr id='gmailDebug' class='hidden'>
|
||||
<th><?php echo $lang->mail->gmail->debug; ?></th>
|
||||
<td><?php echo html::select('gmailDebug', $lang->mail->debugList, ''); echo $lang->mail->debugExample; ?></td>
|
||||
</tr>
|
||||
<tr id='gmailUsername' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->mail->gmail->username; ?></th>
|
||||
<td><?php echo html::input('gmailUsername', $gmailUsername) ?></td>
|
||||
</tr>
|
||||
<tr id='gmailPassword' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->mail->gmail->password; ?></th>
|
||||
<td><?php echo html::input('gmailPassword', $gmailPassword) ?></td>
|
||||
</tr>
|
||||
<tr id='smtpDebug' class='hidden'>
|
||||
<th><?php echo $lang->mail->smtp->debug; ?></th>
|
||||
<td><?php echo html::select('smtpDebug', $lang->mail->debugList, ''); echo $lang->mail->debugExample; ?></td>
|
||||
</tr>
|
||||
<tr id='smtpAuth' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->mail->smtp->auth; ?></th>
|
||||
<td><?php echo html::select('smtpAuth', $lang->mail->smtp->authList, $smtpAuth, 'class=select-3 onchange=setVerificationType(this.value)'); ?></td>
|
||||
</tr>
|
||||
<tr id='smtpUsername' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->mail->smtp->username; ?></th>
|
||||
<td><?php echo html::input('smtpUsername', $smtpUsername) ?></td>
|
||||
</tr>
|
||||
<tr id='smtpPassword' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->mail->smtp->password; ?></th>
|
||||
<td><?php echo html::input('smtpPassword', $smtpPassword) ?></td>
|
||||
</tr>
|
||||
<tr id='smtpSecure' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->mail->smtp->secure; ?></th>
|
||||
<td><?php echo html::select('smtpSecure', $lang->mail->smtp->secureList, $smtpSecure); ?></td>
|
||||
</tr>
|
||||
<tr id='smtpPort' class='hidden'>
|
||||
<th class='rowhead'><?php echo $lang->mail->smtp->port; ?></th>
|
||||
<td><?php echo html::input('smtpPort', $smtpPort); echo $lang->mail->smtp->portInfo ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
Reference in New Issue
Block a user