]>
Commit | Line | Data |
---|---|---|
686c51ad ER |
1 | --- dokuwiki-2022-07-31a/inc/common.php~ 2023-03-30 18:04:18.000000000 +0300 |
2 | +++ dokuwiki-2022-07-31a/inc/common.php 2023-03-30 18:05:59.000277451 +0300 | |
4055b8de ER |
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 | * |
686c51ad | 38 | @@ -1346,10 +1346,10 @@ |
4a06c10e | 39 | |
82008d57 | 40 | // decide if there is something to do, eg. whom to mail |
686c51ad ER |
41 | if ($who == 'admin') { |
42 | - if (empty($conf['notify'])) return false; //notify enabled? | |
43 | if ($conf['useacl'] && $INPUT->server->str('REMOTE_USER') && $minor) return false; //skip minors | |
43747012 ER |
44 | $tpl = 'mailtext'; |
45 | - $to = $conf['notify']; | |
46 | + $to = notifyNS($id, $conf['notify']); | |
686c51ad ER |
47 | + if (empty($to)) return false; //notify enabled? |
48 | } elseif ($who == 'subscribers') { | |
49 | if (!actionOK('subscribe')) return false; //subscribers enabled? | |
50 | if ($conf['useacl'] && $INPUT->server->str('REMOTE_USER') && $minor) return false; //skip minors | |
51 | --- dokuwiki-2022-07-31a/inc/media.php~ 2022-09-03 20:15:22.000000000 +0300 | |
52 | +++ dokuwiki-2022-07-31a/inc/media.php 2023-03-30 18:08:07.797735926 +0300 | |
53 | @@ -668,10 +668,11 @@ | |
43747012 | 54 | */ |
f350088e | 55 | function media_notify($id,$file,$mime,$old_rev=false,$current_rev=false){ |
43747012 | 56 | global $conf; |
686c51ad | 57 | - if(empty($conf['notify'])) return; //notify enabled? |
43747012 | 58 | + $to = notifyNS($id, $conf['notify']); |
686c51ad | 59 | + if (empty($to)) return; //notify enabled? |
43747012 | 60 | |
f350088e | 61 | $subscription = new MediaSubscriptionSender(); |
686c51ad ER |
62 | - $subscription->sendMediaDiff($conf['notify'], 'uploadmail', $id, $old_rev, $current_rev); |
63 | + $subscription->sendMediaDiff($to, 'uploadmail', $id, $old_rev, $current_rev); | |
43747012 ER |
64 | } |
65 | ||
66 | /** | |
f350088e ER |
67 | --- dokuwiki-2020-07-29a/inc/Subscriptions/RegistrationSubscriptionSender.php~ 2022-09-03 19:58:24.000000000 +0300 |
68 | +++ dokuwiki-2020-07-29a/inc/Subscriptions/RegistrationSubscriptionSender.php 2023-03-27 11:37:39.640069460 +0300 | |
69 | @@ -19,7 +19,8 @@ | |
70 | public function sendRegister($login, $fullname, $email) | |
71 | { | |
43747012 | 72 | global $conf; |
f350088e ER |
73 | - if (empty($conf['registernotify'])) { |
74 | + $to = notifyNS($id, $conf['registernotify']); // XXX $id undefined | |
75 | + if (empty($to)) { | |
76 | return false; | |
77 | } | |
8b4b2ec3 | 78 | |
f350088e ER |
79 | @@ -30,7 +31,7 @@ |
80 | ]; | |
43747012 ER |
81 | |
82 | return $this->send( | |
83 | - $conf['registernotify'], | |
84 | + $to, | |
85 | 'new_user', | |
86 | $login, | |
87 | 'registermail', | |
f350088e ER |
88 | --- dokuwiki-2020-07-29a/./inc/Subscriptions/SubscriberManager.php~ 2022-09-03 19:58:24.000000000 +0300 |
89 | +++ dokuwiki-2020-07-29a/./inc/Subscriptions/SubscriberManager.php 2023-03-27 11:38:57.900505224 +0300 | |
90 | @@ -257,7 +257,8 @@ | |
43747012 ER |
91 | |
92 | $level = auth_aclcheck($id, $user, $userinfo['grps']); | |
f350088e ER |
93 | if ($level >= AUTH_READ) { |
94 | - if (strcasecmp($userinfo['mail'], $conf['notify']) != 0) { //skip user who get notified elsewhere | |
43747012 | 95 | + $to = notifyNS($id, $conf['notify']); |
f350088e | 96 | + if (strcasecmp($userinfo['mail'], $to) != 0) { //skip user who get notified elsewhere |
43747012 ER |
97 | $result[$user] = $userinfo['mail']; |
98 | } | |
05acfc6e | 99 | } |