summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAnika Henke <anika@selfthinker.org>2010-11-07 09:55:17 +0000
committerAnika Henke <anika@selfthinker.org>2010-11-07 09:55:17 +0000
commit23b10d5bcbfb9a11561296670425bc22665fb84c (patch)
tree745e07587c4f3feab0d56b9f9e1ed911b75511cc /inc
parentf5baf821ee5f6ab5b009bb94aff6f43f686d3329 (diff)
parent9c1c56fd8f997025e879c7a36f6d3c5022b925ae (diff)
downloadrpg-23b10d5bcbfb9a11561296670425bc22665fb84c.tar.gz
rpg-23b10d5bcbfb9a11561296670425bc22665fb84c.tar.bz2
Merge branch 'master' of github.com:splitbrain/dokuwiki
Diffstat (limited to 'inc')
-rw-r--r--inc/common.php7
-rw-r--r--inc/init.php3
-rw-r--r--inc/lang/zh/lang.php3
-rw-r--r--inc/mail.php32
-rw-r--r--inc/media.php7
-rw-r--r--inc/template.php2
6 files changed, 40 insertions, 14 deletions
diff --git a/inc/common.php b/inc/common.php
index 3e760419f..881179f4b 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1134,12 +1134,7 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){
$subject = '['.utf8_substr($conf['title'], 0, 20).'...] '.$subject;
}
- $from = $conf['mailfrom'];
- $from = str_replace('@USER@',$_SERVER['REMOTE_USER'],$from);
- $from = str_replace('@NAME@',$INFO['userinfo']['name'],$from);
- $from = str_replace('@MAIL@',$INFO['userinfo']['mail'],$from);
-
- mail_send($to,$subject,$text,$from,'',$bcc);
+ mail_send($to,$subject,$text,$conf['mailfrom'],'',$bcc);
}
/**
diff --git a/inc/init.php b/inc/init.php
index bf7815178..ed4409729 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -220,6 +220,9 @@ if (!defined('NOSESSION')) {
auth_setup();
}
+// setup mail system
+mail_setup();
+
/**
* Checks paths from config file
*/
diff --git a/inc/lang/zh/lang.php b/inc/lang/zh/lang.php
index 9488cffe1..f819aff9a 100644
--- a/inc/lang/zh/lang.php
+++ b/inc/lang/zh/lang.php
@@ -10,6 +10,7 @@
* @author mr.jinyi@gmail.com
* @author ben <ben@livetom.com>
* @author lainme <lainme993@gmail.com>
+ * @author caii <zhoucaiqi@gmail.com>
*/
$lang['encoding'] = 'utf-8';
$lang['direction'] = 'ltr';
@@ -62,7 +63,7 @@ $lang['email'] = 'E-Mail';
$lang['register'] = '注册';
$lang['profile'] = '用户信息';
$lang['badlogin'] = '对不起,用户名或密码错误。';
-$lang['minoredit'] = '轻微修改';
+$lang['minoredit'] = '细微修改';
$lang['draftdate'] = '草稿自动保存于';
$lang['nosecedit'] = '在您编辑期间本页刚被他人修改过,局部信息已过期,故载入全页。';
$lang['regmissing'] = '对不起,您必须填写所有的区域。';
diff --git a/inc/mail.php b/inc/mail.php
index 38232d110..fb163585a 100644
--- a/inc/mail.php
+++ b/inc/mail.php
@@ -30,7 +30,39 @@ if(!defined('QUOTEDPRINTABLE_EOL')) define('QUOTEDPRINTABLE_EOL',"\015\012");
if (!defined('RFC2822_ATEXT')) define('RFC2822_ATEXT',"0-9a-zA-Z!#$%&'*+/=?^_`{|}~-");
if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '['.RFC2822_ATEXT.']+(?:\.['.RFC2822_ATEXT.']+)*@(?i:[0-9a-z][0-9a-z-]*\.)+(?i:[a-z]{2,4}|museum|travel)');
+/**
+ * Prepare mailfrom replacement patterns
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function mail_setup(){
+ global $conf;
+ global $INFO;
+
+ $replace = array();
+
+ if(!empty($INFO['userinfo']['mail'])){
+ $replace['@MAIL@'] = $INFO['userinfo']['mail'];
+ }else{
+ $replace['@MAIL@'] = 'noreply@'.parse_url(DOKU_URL,PHP_URL_HOST);
+ }
+ if(!empty($_SERVER['REMOTE_USER'])){
+ $replace['@USER@'] = $_SERVER['REMOTE_USER'];
+ }else{
+ $replace['@USER@'] = 'noreply';
+ }
+
+ if(!empty($INFO['userinfo']['name'])){
+ $replace['@NAME@'] = $INFO['userinfo']['name'];
+ }else{
+ $replace['@NAME@'] = '';
+ }
+
+ $conf['mailfrom'] = str_replace(array_keys($replace),
+ array_values($replace),
+ $conf['mailfrom']);
+}
/**
* UTF-8 autoencoding replacement for PHPs mail function
diff --git a/inc/media.php b/inc/media.php
index 3dacd12b7..69441352b 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -407,14 +407,9 @@ function media_notify($id,$file,$mime){
$text = str_replace('@MEDIA@',ml($id,'',true,'&',true),$text);
$text = str_replace('@SIZE@',filesize_h(filesize($file)),$text);
- $from = $conf['mailfrom'];
- $from = str_replace('@USER@',$_SERVER['REMOTE_USER'],$from);
- $from = str_replace('@NAME@',$INFO['userinfo']['name'],$from);
- $from = str_replace('@MAIL@',$INFO['userinfo']['mail'],$from);
-
$subject = '['.$conf['title'].'] '.$lang['mail_upload'].' '.$id;
- mail_send($conf['notify'],$subject,$text,$from);
+ mail_send($conf['notify'],$subject,$text,$conf['mailfrom']);
}
/**
diff --git a/inc/template.php b/inc/template.php
index c2ce130ff..cb98c83d7 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -796,7 +796,7 @@ function tpl_userinfo(){
global $lang;
global $INFO;
if(isset($_SERVER['REMOTE_USER'])){
- print $lang['loggedinas'].': '.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')';
+ print $lang['loggedinas'].': '.hsc($INFO['userinfo']['name']).' ('.hsc($_SERVER['REMOTE_USER']).')';
return true;
}
return false;