]> git.mxchange.org Git - friendica.git/commitdiff
cleaned up ACL expansion to remove unwanted '0' elements
authorMike Macgirvin <mike@macgirvin.com>
Mon, 27 Sep 2010 02:44:03 +0000 (19:44 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Mon, 27 Sep 2010 02:44:03 +0000 (19:44 -0700)
boot.php
include/notifier.php
mod/notifications.php

index 956f2f466c787e270befd59eb14fca50afcb3402..c7b694dd5297950bc58a7fb1db05e54b52223f49 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -567,15 +567,19 @@ function paginate(&$a) {
 
 if(! function_exists('expand_acl')) {
 function expand_acl($s) {
+       // turn string array of angle-bracketed elements into numeric array
+       // e.g. "<1><2><3>" => array(1,2,3);
+       $ret = array();
 
        if(strlen($s)) {
-               $a = explode('<',$s);
-               for($x = 0; $x < count($a); $x ++) {
-                       $a[$x] = intval(str_replace(array('<','>'),array('',''),$a[$x]));
+               $t = str_replace('<','',$s);
+               $a = explode('>',$t);
+               foreach($a as $aa) {
+                       if(intval($aa))
+                               $ret[] = intval($aa);
                }
-               return $a;
        }
-       return array();
+       return $ret;
 }}             
 
 if(! function_exists('sanitise_acl')) {
index 2124c18e763250e6aa9acef86e5d530fbbb443c6..92f739549219e977f60ad8f284af687db163ff9c 100644 (file)
                        $recipients = array_unique(array_merge($recipients,$allow_people,$allow_groups),SORT_NUMERIC);
                        $deny = array_unique(array_merge($deny_people,$deny_groups),SORT_NUMERIC);
                        $recipients = array_diff($recipients,$deny);
-       
+
                        $conversant_str = dbesc(implode(', ',$conversants));
 
 
                        }
                }
        }
-       $atom .= "</feed>\r\n";
+       $atom .= '</feed>' . "\r\n";
 
        if($debugging)
                echo $atom;
index f38f5ae37b214b2b6c2560d2b3c48a241147cd16..603c1117ccfbe53ee34fab797c5c8f25098ef463 100644 (file)
@@ -8,7 +8,7 @@ function notifications_post(&$a) {
        
        $request_id = (($a->argc > 1) ? $a->argv[1] : 0);
        
-       if($request_id == "all")
+       if($request_id === "all")
                return;
 
        if($request_id) {