Index: trunk/expressoAdmin1_2/inc/class.functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.functions.inc.php	(revision 283)
+++ trunk/expressoAdmin1_2/inc/class.functions.inc.php	(revision 317)
@@ -49,5 +49,5 @@
 			{
 				case list_users:
-					if ($array_acl[acl_add_users] || $array_acl[acl_edit_users] || $array_acl[acl_delete_users] || $array_acl[acl_change_users_password] || $array_acl[acl_change_users_quote] || $array_acl[acl_edit_sambausers_attributes] || $array_acl[acl_view_users] || $array_acl[acl_manipulate_corporative_information])
+					if ($array_acl[acl_add_users] || $array_acl[acl_edit_users] || $array_acl[acl_delete_users] || $array_acl[acl_change_users_password] || $array_acl[acl_change_users_quote] || $array_acl[acl_edit_sambausers_attributes] || $array_acl[acl_view_users] || $array_acl[acl_manipulate_corporative_information] || $array_acl[acl_edit_users_phonenumber] )
 						return true;
 					break;
@@ -85,4 +85,10 @@
 						return true;
 					break;
+
+				case list_institutional_accounts:
+					if ($array_acl[acl_add_institutional_accounts] || $array_acl[acl_edit_institutional_accounts] || $array_acl[acl_delete_institutional_accounts])
+						return true;
+					break;
+
 
 				default:
@@ -288,5 +294,8 @@
 		
 		// Make a array read humam
-		// Last acl:	1.073.741.824
+		// Last acl:	2.147.483.648 -> edit users phonephone
+		// Last acl:	4.294.967.296 -> add institutional accounts
+		// Last acl:	8.589.934.592 -> edit institutional accounts
+		// Last acl:   17.179.869.184 -> remove institutional accounts
 		function make_array_acl($acl)
 		{
@@ -322,5 +331,9 @@
 							 	"acl_manipulate_corporative_information",
 							 	"acl_edit_users_picture",
-							 	"acl_edit_scl_email_lists"
+							 	"acl_edit_scl_email_lists",
+							 	"acl_edit_users_phonenumber",
+							 	"acl_add_institutional_accounts",
+							 	"acl_edit_institutional_accounts",
+							 	"acl_remove_institutional_accounts"
 							 	);
 			
@@ -334,40 +347,19 @@
 				$bin = '1' . $bin;
 				
-				$array_acl[$right] = $acl & bindec($bin);
-			}			
+				$array_acl[$right] = $this->safeBitCheck(bindec($bin), $acl);
+			}
 			return $array_acl;
-			/*
-			$array_acl['acl_add_users'] = $acl & 1;
-			$array_acl['acl_edit_users'] = $acl & 2;
-			$array_acl['acl_delete_users'] = $acl & 4;
-			//8
-			$array_acl['acl_add_groups'] = $acl & 16;
-			$array_acl['acl_edit_groups'] = $acl & 32;
-			$array_acl['acl_delete_groups'] = $acl & 64;
-			$array_acl['acl_change_users_password'] = $acl & 128;
-			$array_acl['acl_add_maillists'] = $acl & 256;
-			$array_acl['acl_edit_maillists'] = $acl & 512;
-			$array_acl['acl_delete_maillists'] = $acl & 1024;
-			//2048
-			$array_acl['acl_create_sectors'] = $acl & 4096;
-			$array_acl['acl_edit_sectors'] = $acl & 8192;
-			$array_acl['acl_delete_sectors'] = $acl & 16384;
-			$array_acl['acl_edit_sambausers_attributes'] = $acl & 32768;
-			$array_acl['acl_view_global_sessions'] = $acl & 65536;
-			$array_acl['acl_view_logs'] = $acl & 131072;
-			$array_acl['acl_change_users_quote'] = $acl & 262144;
-			$array_acl['acl_set_user_default_password'] = $acl & 524288;
-			$array_acl['acl_create_computers'] = $acl & 1048576;
-			$array_acl['acl_edit_computers'] = $acl & 2097152;
-			$array_acl['acl_delete_computers'] = $acl & 4194304;
-			$array_acl['acl_rename_users'] = $acl & 8388608;
-			$array_acl['acl_edit_sambadomains'] = $acl & 16777216;
-			$array_acl['acl_view_users'] = $acl & 33554432;
-			$array_acl['acl_edit_email_groups'] = $acl & 67108864;
-			$array_acl['acl_empty_user_inbox'] = $acl & 134217728;
-			$array_acl['acl_manipulate_corporative_information'] = $acl & 268435456;
-			$array_acl['acl_edit_users_picture'] = $acl & 536870912;
-			return $array_acl;
-			*/
+		}
+
+		function safeBitCheck($number,$comparison)
+		{
+        	$binNumber = base_convert($number,10,2);
+	        $binComparison = strrev(base_convert($comparison,10,2));
+			$str = strlen($binNumber);
+	        
+	        if ( ($str <= strlen($binComparison)) && ($binComparison{$str-1}==="1") )
+        		return '1';
+	        else
+	        	return '0';
 		}
 		
@@ -748,4 +740,11 @@
 		}
 		
+		function lang($key)
+		{
+			if ($_SESSION['phpgw_info']['expressoAdmin']['lang'][$key])
+				return $_SESSION['phpgw_info']['expressoAdmin']['lang'][$key];
+			else
+				return $key . '*';
+		}
 	}
 	
