[dokuwiki] Re: [patch] allow for customizable change e-mail subjects

  • From: Mike Frysinger <vapier@xxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 27 Jun 2007 07:10:53 -0400

On Monday 11 June 2007, Guy Brand wrote:
> On 11 June at 15:00, Mike Frysinger wrote:
> > >   I've added Mike's patch to the "page of patches living outside the
> > >   upstream": http://wiki.splitbrain.org/wiki:patch:patches
> >
> > how do i go about updating this (that one doesnt apply to latest version)
> > ?  i created an account on the dokuwiki and i can edit the patch:patches
> > page, but i cant seem to modify the attachments in the files/images menu
> > ...
>
>   Send it to me, I'll upload it to this page.

attached patch is against the new release from yesterday
-mike
--- dokuwiki-2007-06-26/conf/dokuwiki.php
+++ dokuwiki-2007-06-26/conf/dokuwiki.php
@@ -86,6 +86,7 @@
 $conf['locktime']    = 15*60;            //maximum age for lockfiles (defaults 
to 15 minutes)
 $conf['fetchsize']   = 0;                //maximum size (bytes) fetch.php may 
download from extern, disabled by default
 $conf['notify']      = '';               //send change info to this email 
(leave blank for nobody)
+$conf['notify_subject'] = '[@TITLE@] @REASON@ @ID@'; //subject template for 
change emails
 $conf['registernotify'] = '';            //send info about newly registered 
users to this email (leave blank for nobody)
 $conf['mailfrom']    = '';               //use this email when sending mails
 $conf['gzip_output'] = 0;                //use gzip content encodeing for the 
output xhtml (if allowed by browser)
--- dokuwiki-2007-06-26/inc/common.php
+++ dokuwiki-2007-06-26/inc/common.php
@@ -868,7 +868,7 @@
   if($who == 'register'){
     $subject = $lang['mail_new_user'].' '.$summary;
   }elseif($rev){
-    $subject = $lang['mail_changed'].' '.$id;
+    $subject = 
str_replace('@REASON@',$lang['mail_changed'],$conf['notify_subject']);
     $text = str_replace('@OLDPAGE@',wl($id,"rev=$rev",true,'&'),$text);
     require_once(DOKU_INC.'inc/DifferenceEngine.php');
     $df  = new Diff(split("\n",rawWiki($id,$rev)),
@@ -876,12 +876,16 @@
     $dformat = new UnifiedDiffFormatter();
     $diff    = $dformat->format($df);
   }else{
-    $subject=$lang['mail_newpage'].' '.$id;
+    $subject = 
str_replace('@REASON@',$lang['mail_newpage'],$conf['notify_subject']);
     $text = str_replace('@OLDPAGE@','none',$text);
     $diff = rawWiki($id);
   }
   $text = str_replace('@DIFF@',$diff,$text);
-  $subject = '['.$conf['title'].'] '.$subject;
+  $subject = str_replace('@DATE@',date($conf['dformat']),$subject);
+  $subject = str_replace('@PAGE@',$id,$subject);
+  $subject = str_replace('@TITLE@',$conf['title'],$subject);
+  $subject = str_replace('@SUMMARY@',$summary,$subject);
+  $subject = str_replace('@USER@',$_SERVER['REMOTE_USER'],$subject);
 
   $from = $conf['mailfrom'];
   $from = str_replace('@USER@',$_SERVER['REMOTE_USER'],$from);
--- dokuwiki-2007-06-26/lib/plugins/config/lang/en/lang.php
+++ dokuwiki-2007-06-26/lib/plugins/config/lang/en/lang.php
@@ -112,6 +112,7 @@
 $lang['locktime']    = 'Maximum age for lock files (sec)';
 $lang['fetchsize']   = 'Maximum size (bytes) fetch.php may download from 
extern';
 $lang['notify']      = 'Send change notifications to this email address';
+$lang['notify_subject'] = 'Subject to use in notification emails';
 $lang['registernotify'] = 'Send info on newly registered users to this email 
address';
 $lang['mailfrom']    = 'Email address to use for automatic mails';
 $lang['gzip_output'] = 'Use gzip Content-Encoding for xhtml';
--- dokuwiki-2007-06-26/lib/plugins/config/settings/config.metadata.php
+++ dokuwiki-2007-06-26/lib/plugins/config/settings/config.metadata.php
@@ -133,6 +133,7 @@
 $meta['htmlok']      = array('onoff');
 $meta['phpok']       = array('onoff');
 $meta['notify']      = array('email');
+$meta['notify_subject'] = array('string');
 $meta['subscribers'] = array('onoff');
 $meta['locktime']    = array('numeric');
 $meta['cachetime']   = array('numeric');

Other related posts: