]>
Commit | Line | Data |
---|---|---|
4a06c10e ER |
1 | --- dokuwiki-2008-05-05/inc/common.php~ 2008-11-12 16:45:56.298338127 +0200 |
2 | +++ dokuwiki-2008-05-05/inc/common.php 2008-11-12 16:56:31.711609436 +0200 | |
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 | * | |
38 | @@ -924,7 +952,7 @@ | |
39 | if(empty($conf['notify'])) return; //notify enabled? | |
40 | if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) return; //skip minors | |
41 | $text = rawLocale('mailtext'); | |
42 | - $to = $conf['notify']; | |
43 | + $to = notifyNS($id, $conf['notify']); | |
44 | $bcc = ''; | |
45 | }elseif($who == 'subscribers'){ | |
46 | if(!$conf['subscribers']) return; //subscribers enabled? | |
47 | @@ -936,7 +964,7 @@ | |
48 | }elseif($who == 'register'){ | |
49 | if(empty($conf['registernotify'])) return; | |
50 | $text = rawLocale('registermail'); | |
51 | - $to = $conf['registernotify']; | |
52 | + $to = notifyNS($id, $conf['registernotify']); | |
53 | $bcc = ''; | |
54 | }else{ | |
55 | return; //just to be safe | |
56 | @@ -921,10 +949,10 @@ | |
57 | ||
58 | // decide if there is something to do | |
59 | if($who == 'admin'){ | |
60 | - if(empty($conf['notify'])) return; //notify enabled? | |
61 | if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) return; //skip minors | |
62 | + $to = notifyNS($id, $conf['notify']); | |
63 | + if(empty($to)) return; //notify enabled? | |
64 | $text = rawLocale('mailtext'); | |
65 | - $to = $conf['notify']; | |
66 | $bcc = ''; | |
67 | }elseif($who == 'subscribers'){ | |
68 | if(!$conf['subscribers']) return; //subscribers enabled? | |
69 | @@ -934,9 +962,9 @@ | |
70 | $to = ''; | |
71 | $text = rawLocale('subscribermail'); | |
72 | }elseif($who == 'register'){ | |
73 | - if(empty($conf['registernotify'])) return; | |
74 | + $to = notifyNS($id, $conf['registernotify']); | |
75 | + if(empty($to)) return; | |
76 | $text = rawLocale('registermail'); | |
77 | - $to = $conf['registernotify']; | |
78 | $bcc = ''; | |
79 | }else{ | |
80 | return; //just to be safe |