--- dokuwiki-2012-07-08/inc/common.php~ 2012-07-08 11:24:16.000000000 +0300 +++ dokuwiki-2012-07-08/inc/common.php 2012-07-08 11:25:44.509886848 +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 * @@ -1137,10 +1137,10 @@ // decide if there is something to do, eg. whom to mail if($who == 'admin') { - if(empty($conf['notify'])) return false; //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 false; //subscribers enabled? @@ -1155,9 +1155,9 @@ $to = ''; $text = rawLocale('subscr_single'); } elseif($who == 'register') { - if(empty($conf['registernotify'])) return false; + $to = notifyNS($id, $conf['registernotify']); + if(empty($to)) return; $text = rawLocale('registermail'); - $to = $conf['registernotify']; $bcc = ''; } else { return false; //just to be safe --- dokuwiki-2012-07-19/inc/media.php~ 2012-07-15 23:56:17.000000000 +0300 +++ dokuwiki-2012-07-19/inc/media.php 2012-07-30 17:02:13.070873955 +0300 @@ -539,8 +539,9 @@ $trep['OLD'] = '---'; } + $to = notifyNS($id, $conf['notify']); $mail = new Mailer(); - $mail->to($conf['notify']); + $mail->to($to); $mail->subject($lang['mail_upload'].' '.$id); $mail->setBody($text,$trep); return $mail->send(); --- dokuwiki/./inc/subscription.php~ 2012-07-29 13:25:32.000000000 +0300 +++ dokuwiki/./inc/subscription.php 2012-07-30 18:02:34.710521495 +0300 @@ -289,7 +289,8 @@ if ($info === false) continue; $level = auth_aclcheck($id, $sub[0], $info['grps']); if ($level >= AUTH_READ) { - if (strcasecmp($info['mail'], $conf['notify']) != 0) { + $notify = notifyNS($id, $conf['notify']); + if (strcasecmp($info['mail'], $notify) != 0) { $emails[$sub[0]] = $info['mail']; } }