------------------------------------------------------------
revno: 915
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Sun 2011-10-16 16:51:34 +0200
message:
  minor corrections when no permission is given
modified:
  src/libs/security.php


--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk

Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to 
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'src/libs/security.php'
--- src/libs/security.php	2011-10-15 17:37:31 +0000
+++ src/libs/security.php	2011-10-16 14:51:34 +0000
@@ -63,23 +63,25 @@
 		global $aiki, $db;
 			
 		if (preg_match_all('/\(\#\(permissions\:(.*)\)\#\)/Us', $text, $matchs)) {
-			foreach ( $matchs[1] as $i => $inline_per ) {
-				// tip to capture always two elements.
-				$get_sides = explode("||", $inline_per . "||", 2);
-								
-				$sql = "SELECT group_level" .
-					   " FROM  aiki_users_groups".
-					   " WHERE group_permissions='". addslashes($get_sides[0]) ."'";
-								
-				$get_group_level = $db->get_var($sql);
+			foreach ( $matchs[1] as $i => $inline_per ) {							
+				if ( strpos ( $inline_per, "||") !== false )  {
+					$get_sides = explode("||", $inline_per, 2);
+									
+					$sql = "SELECT group_level" .
+						   " FROM  aiki_users_groups".
+						   " WHERE group_permissions='". addslashes($get_sides[0]) ."'";
+									
+					$get_group_level = $db->get_var($sql);
 
-				if ( $get_sides[0] == $aiki->membership->permissions ||
-					$aiki->membership->group_level < $get_group_level ) {
-					$replace = $get_sides[1];
-				} else {			
-					$replace = "";						
+					if ( $get_sides[0] == $aiki->membership->permissions ||
+						$aiki->membership->group_level < $get_group_level ) {
+						$replace = $get_sides[1];
+					} else {			
+						$replace = "";						
+					}
+					
+					$text = str_replace($matchs[0][$i],$replace, $text);
 				}
-				$text = str_replace($matchs[0][$i],$replace, $text);
 			}
 		}
 		return $text;
@@ -87,4 +89,4 @@
 
 } // end of class
 
-?>
\ No newline at end of file
+?>

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to