* finish task#1259.
This commit is contained in:
@@ -17,12 +17,12 @@ if(!function_exists('getWebRoot')){function getWebRoot(){}}
|
||||
|
||||
/* Basic settings. */
|
||||
$config = new config();
|
||||
$config->version = '4.0.1'; // The version of zentaopms. Don't change it.
|
||||
$config->encoding = 'UTF-8'; // The encoding of zentaopms.
|
||||
$config->cookieLife = time() + 2592000; // The cookie life time.
|
||||
$config->timezone = 'Asia/Shanghai'; // The time zone setting, for more see http://www.php.net/manual/en/timezones.php
|
||||
$config->webRoot = ''; // The root path of the pms.
|
||||
$config->checkVersion= true; // Auto check for new version or not.
|
||||
$config->version = '4.0.1'; // The version of zentaopms. Don't change it.
|
||||
$config->charset = 'UTF-8'; // The encoding of zentaopms.
|
||||
$config->cookieLife = time() + 2592000; // The cookie life time.
|
||||
$config->timezone = 'Asia/Shanghai'; // The time zone setting, for more see http://www.php.net/manual/en/timezones.php
|
||||
$config->webRoot = ''; // The root path of the pms.
|
||||
$config->checkVersion = true; // Auto check for new version or not.
|
||||
|
||||
/* The request settings. */
|
||||
$config->requestType = 'PATH_INFO'; // The request type: PATH_INFO|GET, if PATH_INFO, must use url rewrite.
|
||||
@@ -44,6 +44,13 @@ $config->langs['zh-cn'] = '中文简体';
|
||||
$config->langs['zh-tw'] = '中文繁體';
|
||||
$config->langs['en'] = 'English';
|
||||
|
||||
/* Supported charsets. */
|
||||
$config->charsets['zh-cn']['utf-8'] = 'UTF-8';
|
||||
$config->charsets['zh-cn']['gbk'] = 'GBK';
|
||||
$config->charsets['zh-tw']['utf-8'] = 'UTF-8';
|
||||
$config->charsets['zh-tw']['big5'] = 'BIG5';
|
||||
$config->charsets['en']['utf-8'] = 'UTF-8';
|
||||
|
||||
/* Default settings. */
|
||||
$config->default = new stdclass();
|
||||
$config->default->view = 'html'; // Default view.
|
||||
|
||||
@@ -32,7 +32,7 @@ class commonModel extends model
|
||||
*/
|
||||
public function sendHeader()
|
||||
{
|
||||
header("Content-Type: text/html; Language={$this->config->encoding}");
|
||||
header("Content-Type: text/html; Language={$this->config->charset}");
|
||||
header("Cache-control: private");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ $config->mail->fromAddress = ''; // The from address.
|
||||
$config->mail->fromName = 'zentao'; // The from name.
|
||||
$config->mail->mta = 'smtp'; // The send mail type.
|
||||
$config->mail->smtp->debug = 0; // Debug level, 0,1,2.
|
||||
$config->mail->smtp->charset = 'utf-8'; // Charset
|
||||
$config->mail->smtp->auth = true; // Need auth or not. true|false
|
||||
$config->mail->smtp->host = 'localhost';// The smtp server host address.
|
||||
$config->mail->smtp->port = '25'; // The smtp server host port.
|
||||
|
||||
@@ -111,6 +111,7 @@ class mail extends control
|
||||
$mailConfig->smtp->password = $this->post->password;
|
||||
$mailConfig->smtp->secure = $this->post->secure;
|
||||
$mailConfig->smtp->debug = $this->post->debug;
|
||||
$mailConfig->smtp->charset = $this->post->charset;
|
||||
|
||||
$this->loadModel('setting')->setItems('system.mail', $mailConfig);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
@@ -17,6 +17,7 @@ $lang->mail->username = 'SMTP account';
|
||||
$lang->mail->password = 'SMTP password';
|
||||
$lang->mail->secure = 'Secure';
|
||||
$lang->mail->debug = 'Debug';
|
||||
$lang->mail->charset = 'Charset';
|
||||
|
||||
$lang->mail->turnonList[1] = 'on';
|
||||
$lang->mail->turnonList[0] = 'off';
|
||||
|
||||
@@ -17,6 +17,7 @@ $lang->mail->username = 'smtp帐号';
|
||||
$lang->mail->password = 'smtp密码';
|
||||
$lang->mail->secure = '是否加密';
|
||||
$lang->mail->debug = '调试级别';
|
||||
$lang->mail->charset = '编码';
|
||||
|
||||
$lang->mail->turnonList[1] = '打开';
|
||||
$lang->mail->turnonList[0] = '关闭';
|
||||
|
||||
@@ -162,7 +162,7 @@ class mailModel extends model
|
||||
{
|
||||
if(self::$instance == null) self::$instance = new phpmailer(true);
|
||||
$this->mta = self::$instance;
|
||||
$this->mta->CharSet = $this->config->encoding;
|
||||
$this->mta->CharSet = $this->config->charset;
|
||||
$funcName = "set{$this->config->mail->mta}";
|
||||
if(!method_exists($this, $funcName)) $this->app->error("The MTA {$this->config->mail->mta} not supported now.", __FILE__, __LINE__, $exit = true);
|
||||
$this->$funcName();
|
||||
@@ -182,6 +182,7 @@ class mailModel extends model
|
||||
$this->mta->SMTPAuth = $this->config->mail->smtp->auth;
|
||||
$this->mta->Username = $this->config->mail->smtp->username;
|
||||
$this->mta->Password = $this->config->mail->smtp->password;
|
||||
if(isset($this->config->mail->smtp->charset)) $this->mta->CharSet = $this->config->mail->smtp->charset;
|
||||
if(isset($this->config->mail->smtp->port)) $this->mta->Port = $this->config->mail->smtp->port;
|
||||
if(isset($this->config->mail->smtp->secure) and !empty($this->config->mail->smtp->secure))$this->mta->SMTPSecure = strtolower($this->config->mail->smtp->secure);
|
||||
}
|
||||
@@ -265,11 +266,11 @@ class mailModel extends model
|
||||
|
||||
try
|
||||
{
|
||||
$this->mta->setFrom($this->config->mail->fromAddress, $this->config->mail->fromName);
|
||||
$this->setSubject($subject);
|
||||
$this->mta->setFrom($this->config->mail->fromAddress, $this->convertCharset($this->config->mail->fromName));
|
||||
$this->setSubject($this->convertCharset($subject));
|
||||
$this->setTO($toList, $emails);
|
||||
$this->setCC($ccList, $emails);
|
||||
$this->setBody($body);
|
||||
$this->setBody($this->convertCharset($body));
|
||||
$this->setErrorLang();
|
||||
$this->mta->send();
|
||||
}
|
||||
@@ -297,7 +298,7 @@ class mailModel extends model
|
||||
foreach($toList as $account)
|
||||
{
|
||||
if(!isset($emails[$account]) or isset($emails[$account]->sended) or strpos($emails[$account]->email, '@') == false) continue;
|
||||
$this->mta->addAddress($emails[$account]->email, $emails[$account]->realname);
|
||||
$this->mta->addAddress($emails[$account]->email, $this->convertCharset($emails[$account]->realname));
|
||||
$emails[$account]->sended = true;
|
||||
}
|
||||
}
|
||||
@@ -317,7 +318,7 @@ class mailModel extends model
|
||||
foreach($ccList as $account)
|
||||
{
|
||||
if(!isset($emails[$account]) or isset($emails[$account]->sended) or strpos($emails[$account]->email, '@') == false) continue;
|
||||
$this->mta->addCC($emails[$account]->email, $emails[$account]->realname);
|
||||
$this->mta->addCC($emails[$account]->email, $this->convertCharset($emails[$account]->realname));
|
||||
$emails[$account]->sended = true;
|
||||
}
|
||||
}
|
||||
@@ -346,6 +347,19 @@ class mailModel extends model
|
||||
$this->mta->msgHtml("$body");
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert charset.
|
||||
*
|
||||
* @param string $string
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function convertCharset($string)
|
||||
{
|
||||
if($this->config->mail->smtp->charset != strtolower($this->config->charset)) return iconv($this->config->charset, $this->config->mail->smtp->charset, $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set error lang.
|
||||
*
|
||||
|
||||
@@ -54,6 +54,10 @@ include '../../common/view/header.html.php';
|
||||
<th class='rowhead'><?php echo $lang->mail->debug; ?></th>
|
||||
<td><?php echo html::radio('debug', $lang->mail->debugList, $mailConfig->debug);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->mail->charset; ?></th>
|
||||
<td><?php echo html::radio('charset', $config->charsets[$this->cookie->lang], zget($config->charsets[$this->cookie->lang], $mailConfig->charset, 'utf-8', $mailConfig->charset));?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'>
|
||||
|
||||
Reference in New Issue
Block a user