--- dokuwiki-rc2010-10-07/inc/common.php~ 2010-10-07 21:31:18.000000000 +0300 +++ dokuwiki-rc2010-10-07/inc/common.php 2010-10-07 21:33:06.502518916 +0300 @@ -902,6 +902,34 @@ return $date; } + +/** + * Returns notify address for page $id + * + * @param string $id The changed page + * @param mixed $notify The address (string) or rules where to notify + * + * @author Elan Ruusamäe + */ +function notifyNS($id, $notify) { + if (empty($notify)) { + return ''; + } + + if (is_string($notify)) { + return $notify; + } + + // process $notify for pages + foreach ($notify as $rule => $address) { + if (preg_match('/'.$rule.'/ui',':'.$id)) { + return $address; + } + } + + return ''; +} + /** * Sends a notify mail on page change * @@ -1100,10 +1100,10 @@ // decide if there is something to do if($who == 'admin'){ - if(empty($conf['notify'])) return; //notify enabled? if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) return; //skip minors + $to = notifyNS($id, $conf['notify']); + if(empty($to)) return; //notify enabled? $text = rawLocale('mailtext'); - $to = $conf['notify']; $bcc = ''; }elseif($who == 'subscribers'){ if(!$conf['subscribers']) return; //subscribers enabled? @@ -1116,9 +1116,9 @@ $to = ''; $text = rawLocale('subscr_single'); }elseif($who == 'register'){ - if(empty($conf['registernotify'])) return; + $to = notifyNS($id, $conf['registernotify']); + if(empty($to)) return; $text = rawLocale('registermail'); - $to = $conf['registernotify']; $bcc = ''; }else{ return; //just to be safe