summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom N Harris <tnharris@whoopdedo.org>2008-04-05 05:13:01 +0200
committerTom N Harris <tnharris@whoopdedo.org>2008-04-05 05:13:01 +0200
commit12cb3a51d7c18d6d7d23792b0ac095434f62d2ef (patch)
tree59397aa1ca56df5098e35028d599b1e9a2690a69
parentc8d988350483ce9bc1ed1ff059cd386f752f4943 (diff)
downloadrpg-12cb3a51d7c18d6d7d23792b0ac095434f62d2ef.tar.gz
rpg-12cb3a51d7c18d6d7d23792b0ac095434f62d2ef.tar.bz2
Notify subscribers to parent namespaces. And avoid redundant checks.
darcs-hash:20080405031301-6942e-d1e4f344f5cf165f625104f214f2bfae595a6e20.gz
-rw-r--r--inc/common.php52
1 files changed, 24 insertions, 28 deletions
diff --git a/inc/common.php b/inc/common.php
index 189edb61b..d340e90a9 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1108,62 +1108,58 @@ function subscriber_addresslist($id){
global $conf;
global $auth;
- $emails = '';
+ if (!$conf['subscribers']) return '';
- if (!$conf['subscribers']) return;
+ $users = array();
+ $emails = array();
// load the page mlist file content
$mlist = array();
$file=metaFN($id,'.mlist');
if (@file_exists($file)) {
$mlist = file($file);
- }
- if(count($mlist) > 0) {
foreach ($mlist as $who) {
$who = rtrim($who);
- $info = $auth->getUserData($who);
- if($info === false) continue;
- $level = auth_aclcheck($id,$who,$info['grps']);
- if ($level >= AUTH_READ) {
- if (strcasecmp($info['mail'],$conf['notify']) != 0) {
- if (empty($emails)) {
- $emails = $info['mail'];
- } else {
- $emails = "$emails,".$info['mail'];
- }
- }
- }
+ $users[$who] = true;
}
}
// load also the namespace mlist file content
- if(!getNS($id)) {
- $nsfile = metaFN(getNS($id),'.mlist');
- } else {
- $nsfile = metaFN(getNS($id),'/.mlist');
+ $ns = getNS($id);
+ while ($ns) {
+ $nsfile = metaFN($ns,'/.mlist');
+ if (@file_exists($nsfile)) {
+ $mlist = file($nsfile);
+ foreach ($mlist as $who) {
+ $who = rtrim($who);
+ $users[$who] = true;
+ }
+ }
+ $ns = getNS($ns);
}
+ // root namespace
+ $nsfile = metaFN('','.mlist');
if (@file_exists($nsfile)) {
$mlist = file($nsfile);
- }
- if(count($mlist) > 0) {
foreach ($mlist as $who) {
$who = rtrim($who);
+ $users[$who] = true;
+ }
+ }
+ if(!empty($users)) {
+ foreach (array_keys($users) as $who) {
$info = $auth->getUserData($who);
if($info === false) continue;
$level = auth_aclcheck($id,$who,$info['grps']);
if ($level >= AUTH_READ) {
if (strcasecmp($info['mail'],$conf['notify']) != 0) {
- if (empty($emails)) {
- $emails = $info['mail'];
- } else {
- $emails = "$emails,".$info['mail'];
- }
+ $emails[] = $info['mail'];
}
}
}
}
- return $emails;
+ return implode(',',$emails);
}
/**