]> git.pld-linux.org Git - packages/dokuwiki.git/blob - dokuwiki-notifyns.patch
- export to pdf also for dw2pdf plugin
[packages/dokuwiki.git] / dokuwiki-notifyns.patch
1 --- dokuwiki-rc2010-10-07/inc/common.php~       2010-10-07 21:31:18.000000000 +0300
2 +++ dokuwiki-rc2010-10-07/inc/common.php        2010-10-07 21:33:06.502518916 +0300
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 @@ -1100,10 +1100,10 @@
39  
40      // decide if there is something to do
41      if($who == 'admin'){
42 -        if(empty($conf['notify'])) return; //notify enabled?
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  = '';
49      }elseif($who == 'subscribers'){
50          if(!$conf['subscribers']) return; //subscribers enabled?
51 @@ -1116,9 +1116,9 @@
52          $to   = '';
53          $text = rawLocale('subscr_single');
54      }elseif($who == 'register'){
55 -        if(empty($conf['registernotify'])) return;
56 +        $to   = notifyNS($id, $conf['registernotify']);
57 +        if(empty($to)) return;
58          $text = rawLocale('registermail');
59 -        $to   = $conf['registernotify'];
60          $bcc  = '';
61      }else{
62          return; //just to be safe
This page took 0.032721 seconds and 3 git commands to generate.