diff options
author | Steven Danz <steven-danz@kc.rr.com> | 2005-06-27 04:17:48 +0200 |
---|---|---|
committer | Steven Danz <steven-danz@kc.rr.com> | 2005-06-27 04:17:48 +0200 |
commit | b158d625b53833ef391800a991ad93d965d9425e (patch) | |
tree | 56913261bea090738c5b862fc3f2da06a7d6ca68 /inc/common.php | |
parent | 7131b6688badc1c1e9685aba4b222f147bc1df83 (diff) | |
download | rpg-b158d625b53833ef391800a991ad93d965d9425e.tar.gz rpg-b158d625b53833ef391800a991ad93d965d9425e.tar.bz2 |
track_changes.patch
Second go at including changes to allow users to sign up on
mailing lists so they may receive emails each time the page
they are interested in is updated.
darcs-hash:20050627021748-3ed6d-5f6993f51ab649e3928a513b0fbe7c421d880325.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/inc/common.php b/inc/common.php index ad4de9ffd..676787e73 100644 --- a/inc/common.php +++ b/inc/common.php @@ -621,6 +621,10 @@ function saveWikiText($id,$text,$summary){ if (empty($text)){ // remove empty files @unlink($file); + $mfile=wikiMN($id); + if (file_exists($mfile)) { + @unlink($mfile); + } $del = true; //autoset summary on deletion if(empty($summary)) $summary = $lang['deleted']; @@ -673,7 +677,15 @@ function notify($id,$rev="",$summary=""){ global $lang; global $conf; $hdrs =''; - if(empty($conf['notify'])) return; //notify enabled? + + $mlist = array(); + + $file=wikiMN($id); + if (file_exists($file)) { + $mlist = file($file); + } + + if(empty($conf['notify']) && count($mlist) == 0) return; //notify enabled? $text = rawLocale('mailtext'); $text = str_replace('@DATE@',date($conf['dformat']),$text); @@ -701,7 +713,25 @@ function notify($id,$rev="",$summary=""){ $text = str_replace('@DIFF@',$diff,$text); $subject = '['.$conf['title'].'] '.$subject; - mail_send($conf['notify'],$subject,$text,$conf['mailfrom']); + $bcc = ''; + if(count($mlist) > 0) { + foreach ($mlist as $who) { + $who = rtrim($who); + $info = auth_getUserData($who); + $level = auth_aclcheck($id,$who,$info['grps']); + if ($level >= AUTH_READ) { + if (strcasecmp($info['mail'],$conf['notify']) != 0) { + if (empty($bcc)) { + $bcc = $info['mail']; + } else { + $bcc = "$bcc,".$info['mail']; + } + } + } + } + } + + mail_send($conf['notify'],$subject,$text,$conf['mailfrom'],'',$bcc); } /** @@ -891,5 +921,23 @@ function check(){ } } +/** + * Let us know if a user is tracking a page + * + * @author Steven Danz <steven-danz@kc.rr.com> + */ +function tracking($id,$uid){ + $file=wikiMN($id); + if (file_exists($file)) { + $mlist = file($file); + foreach ($mlist as $who) { + $who = rtrim($who); + if ($who==$uid) { + return true; + } + } + } + return false; +} //Setup VIM: ex: et ts=2 enc=utf-8 : |