]>
Commit | Line | Data |
---|---|---|
4055b8de ER |
1 | --- dokuwiki-2018-04-22c.org/inc/common.php 2022-09-27 22:46:33.691324681 +0200 |
2 | +++ dokuwiki-2018-04-22c/inc/common.php 2022-09-27 22:46:33.924670225 +0200 | |
3 | @@ -897,6 +897,34 @@ function gethostsbyaddrs($ips) { | |
4 | } | |
4a06c10e ER |
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 | /** | |
4055b8de | 36 | * Checks if a given page is currently locked. |
4a06c10e | 37 | * |
4055b8de | 38 | @@ -1435,10 +1463,10 @@ function notify($id, $who, $rev = '', $s |
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 | 43 | if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) return; //skip minors |
43747012 ER |
44 | $tpl = 'mailtext'; |
45 | - $to = $conf['notify']; | |
46 | + $to = notifyNS($id, $conf['notify']); | |
c4df8b0c | 47 | + if(empty($to)) return; //notify enabled? |
82008d57 | 48 | } elseif($who == 'subscribers') { |
43747012 | 49 | if(!actionOK('subscribe')) return false; //subscribers enabled? |
4055b8de ER |
50 | if($conf['useacl'] && $INPUT->server->str('REMOTE_USER') && $minor) return false; //skip minors |
51 | --- dokuwiki-2018-04-22c.org/inc/media.php 2020-05-01 12:38:20.000000000 +0200 | |
52 | +++ dokuwiki-2018-04-22c/inc/media.php 2022-09-27 22:46:33.924670225 +0200 | |
53 | @@ -647,10 +647,11 @@ function media_contentcheck($file,$mime) | |
43747012 ER |
54 | */ |
55 | function media_notify($id,$file,$mime,$old_rev=false){ | |
56 | global $conf; | |
87424c97 | 57 | - if(empty($conf['notify'])) return false; //notify enabled? |
43747012 | 58 | + $to = notifyNS($id, $conf['notify']); |
87424c97 | 59 | + if(empty($to)) return false; //notify enabled? |
43747012 ER |
60 | |
61 | $subscription = new Subscription(); | |
87424c97 ER |
62 | - return $subscription->send_media_diff($conf['notify'], 'uploadmail', $id, $old_rev); |
63 | + return $subscription->send_media_diff($to, 'uploadmail', $id, $old_rev); | |
43747012 ER |
64 | } |
65 | ||
66 | /** | |
4055b8de ER |
67 | --- dokuwiki-2018-04-22c.org/inc/subscription.php 2020-05-01 12:38:20.000000000 +0200 |
68 | +++ dokuwiki-2018-04-22c/inc/subscription.php 2022-09-27 22:46:33.924670225 +0200 | |
69 | @@ -489,7 +489,8 @@ class Subscription { | |
43747012 ER |
70 | */ |
71 | public function send_register($login, $fullname, $email) { | |
72 | global $conf; | |
82008d57 | 73 | - if(empty($conf['registernotify'])) return false; |
43747012 ER |
74 | + $to = notifyNS($id, $conf['registernotify']); |
75 | + if(empty($to)) return false; | |
8b4b2ec3 | 76 | |
43747012 ER |
77 | $trep = array( |
78 | 'NEWUSER' => $login, | |
4055b8de | 79 | @@ -498,7 +499,7 @@ class Subscription { |
43747012 ER |
80 | ); |
81 | ||
82 | return $this->send( | |
83 | - $conf['registernotify'], | |
84 | + $to, | |
85 | 'new_user', | |
86 | $login, | |
87 | 'registermail', | |
4055b8de | 88 | @@ -682,7 +683,8 @@ class Subscription { |
43747012 ER |
89 | |
90 | $level = auth_aclcheck($id, $user, $userinfo['grps']); | |
91 | if($level >= AUTH_READ) { | |
92 | - if(strcasecmp($userinfo['mail'], $conf['notify']) != 0) { //skip user who get notified elsewhere | |
93 | + $to = notifyNS($id, $conf['notify']); | |
94 | + if(strcasecmp($userinfo['mail'], $to) != 0) { //skip user who get notified elsewhere | |
95 | $result[$user] = $userinfo['mail']; | |
96 | } | |
05acfc6e | 97 | } |