]>
Commit | Line | Data |
---|---|---|
82008d57 ER |
1 | --- dokuwiki-2012-07-08/inc/common.php~ 2012-07-08 11:24:16.000000000 +0300 |
2 | +++ dokuwiki-2012-07-08/inc/common.php 2012-07-08 11:25:44.509886848 +0300 | |
4a06c10e ER |
3 | @@ -902,6 +902,34 @@ |
4 | return $date; | |
5 | } | |
6 | ||
7 | + | |
8 | +/** | |
9 | + * Returns notify address for page $id | |
10 | + * | |
11 | + * @param string $id The changed page | |
12 | + * @param mixed $notify The address (string) or rules where to notify | |
13 | + * | |
14 | + * @author Elan Ruusamäe <glen@delfi.ee> | |
15 | + */ | |
16 | +function notifyNS($id, $notify) { | |
17 | + if (empty($notify)) { | |
18 | + return ''; | |
19 | + } | |
20 | + | |
21 | + if (is_string($notify)) { | |
22 | + return $notify; | |
23 | + } | |
24 | + | |
25 | + // process $notify for pages | |
26 | + foreach ($notify as $rule => $address) { | |
27 | + if (preg_match('/'.$rule.'/ui',':'.$id)) { | |
28 | + return $address; | |
29 | + } | |
30 | + } | |
31 | + | |
32 | + return ''; | |
33 | +} | |
34 | + | |
35 | /** | |
36 | * Sends a notify mail on page change | |
37 | * | |
82008d57 | 38 | @@ -1137,10 +1137,10 @@ |
4a06c10e | 39 | |
82008d57 ER |
40 | // decide if there is something to do, eg. whom to mail |
41 | if($who == 'admin') { | |
42 | - if(empty($conf['notify'])) return false; //notify enabled? | |
c4df8b0c ER |
43 | if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) return; //skip minors |
44 | + $to = notifyNS($id, $conf['notify']); | |
45 | + if(empty($to)) return; //notify enabled? | |
46 | $text = rawLocale('mailtext'); | |
47 | - $to = $conf['notify']; | |
48 | $bcc = ''; | |
82008d57 ER |
49 | } elseif($who == 'subscribers') { |
50 | if(!$conf['subscribers']) return false; //subscribers enabled? | |
51 | @@ -1155,9 +1155,9 @@ | |
c4df8b0c ER |
52 | $to = ''; |
53 | $text = rawLocale('subscr_single'); | |
82008d57 ER |
54 | } elseif($who == 'register') { |
55 | - if(empty($conf['registernotify'])) return false; | |
c4df8b0c ER |
56 | + $to = notifyNS($id, $conf['registernotify']); |
57 | + if(empty($to)) return; | |
58 | $text = rawLocale('registermail'); | |
59 | - $to = $conf['registernotify']; | |
60 | $bcc = ''; | |
82008d57 ER |
61 | } else { |
62 | return false; //just to be safe | |
8b4b2ec3 ER |
63 | --- dokuwiki-2012-07-19/inc/media.php~ 2012-07-15 23:56:17.000000000 +0300 |
64 | +++ dokuwiki-2012-07-19/inc/media.php 2012-07-30 17:02:13.070873955 +0300 | |
65 | @@ -539,8 +539,9 @@ | |
66 | $trep['OLD'] = '---'; | |
67 | } | |
68 | ||
69 | + $to = notifyNS($id, $conf['notify']); | |
70 | $mail = new Mailer(); | |
71 | - $mail->to($conf['notify']); | |
72 | + $mail->to($to); | |
73 | $mail->subject($lang['mail_upload'].' '.$id); | |
74 | $mail->setBody($text,$trep); | |
75 | return $mail->send(); | |
05acfc6e ER |
76 | --- dokuwiki/./inc/subscription.php~ 2012-07-29 13:25:32.000000000 +0300 |
77 | +++ dokuwiki/./inc/subscription.php 2012-07-30 18:02:34.710521495 +0300 | |
78 | @@ -289,7 +289,8 @@ | |
79 | if ($info === false) continue; | |
80 | $level = auth_aclcheck($id, $sub[0], $info['grps']); | |
81 | if ($level >= AUTH_READ) { | |
82 | - if (strcasecmp($info['mail'], $conf['notify']) != 0) { | |
83 | + $notify = notifyNS($id, $conf['notify']); | |
84 | + if (strcasecmp($info['mail'], $notify) != 0) { | |
85 | $emails[$sub[0]] = $info['mail']; | |
86 | } | |
87 | } |