Index: sandbox/2.5.1-evolucao/phpgwapi/inc/class.sector_search_ldap.inc.php
===================================================================
--- sandbox/2.5.1-evolucao/phpgwapi/inc/class.sector_search_ldap.inc.php	(revision 7655)
+++ sandbox/2.5.1-evolucao/phpgwapi/inc/class.sector_search_ldap.inc.php	(revision 8231)
@@ -122,12 +122,12 @@
 	    ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0);
 
-	ldap_bind($ldap_conn, $dn, $passwd);
+	@ldap_bind($ldap_conn, $dn, $passwd);
 
 	$justthese = array("dn");
 	$filter = $show_invisible_ou ? "(objectClass=organizationalUnit)" : "(& (objectClass=organizationalUnit) (!(phpgwAccountVisible=-1)) )";
-	$search = ldap_search($ldap_conn, $context, $filter, $justthese);
-
-	ldap_sort($ldap_conn, $search, "ou");
-	$info = ldap_get_entries($ldap_conn, $search);
+	$search = @ldap_search($ldap_conn, $context, $filter, $justthese);
+
+	@ldap_sort($ldap_conn, $search, "ou");
+	$info = @ldap_get_entries($ldap_conn, $search);
 	ldap_close($ldap_conn);
 
Index: sandbox/2.5.1-evolucao/expressoAdmin1_2/controller.php
===================================================================
--- sandbox/2.5.1-evolucao/expressoAdmin1_2/controller.php	(revision 7655)
+++ sandbox/2.5.1-evolucao/expressoAdmin1_2/controller.php	(revision 8231)
@@ -22,5 +22,5 @@
 	//	Explode action from cExecuteForm function
 	$cExecuteFormReturn = false;
- 	if($_POST['_action']) { 		
+ 	if(isset($_POST['_action'])) { 		
  		if($_FILES) {
  			$count_files = $_POST['countFiles'];
@@ -36,10 +36,15 @@
  	}
  	//	Explode action from cExecute function
- 	else if($_GET['action'])
-		list($app,$class,$method) = explode('.',@$_GET['action']);
+ 	else if($_GET['action']){
+		$exp = explode('.',@$_GET['action']);
+		//avoiding undefined offsets
+		if (count($exp) > 1)
+			list($app,$class,$method) = explode('.',@$_GET['action']);
+ 		else
+ 			$app = $exp[0];
+ 	}
 	// NO ACTION
 	else
 		return $_SESSION['response'] = 'false';
-	
 	// Load dinamically class file.
 	if($app == '$this')
Index: sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.db_functions.inc.php
===================================================================
--- sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.db_functions.inc.php	(revision 8204)
+++ sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.db_functions.inc.php	(revision 8231)
@@ -10,6 +10,6 @@
 		\**************************************************************************/ 
 		
-define('PHPGW_INCLUDE_ROOT','../');	
-define('PHPGW_API_INC','../phpgwapi/inc');
+if (!defined('PHPGW_INCLUDE_ROOT')) define('PHPGW_INCLUDE_ROOT','../');	
+if (!defined('PHPGW_API_INC')) define('PHPGW_API_INC','../phpgwapi/inc');
 include_once(PHPGW_API_INC.'/class.db.inc.php');
 
Index: sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.functions.inc.php
===================================================================
--- sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.functions.inc.php	(revision 7769)
+++ sandbox/2.5.1-evolucao/expressoAdmin1_2/inc/class.functions.inc.php	(revision 8231)
@@ -833,5 +833,5 @@
 				if (($i +1) % 3 == 1)
 				{
-					$checked = $user_applications[$app] ? 'CHECKED' : '';
+					$checked = is_array($user_applications) && $user_applications[$app] ? 'CHECKED' : '';
 					$app_col1 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='apps[%s]' value='1' %s %s></td>\n",
 					$data['title'],$app,$checked, $disabled);
@@ -843,5 +843,5 @@
 				if (($i +1) % 3 == 2)
 				{
-					$checked = $user_applications[$app] ? 'CHECKED' : '';
+					$checked = is_array($user_applications) && $user_applications[$app] ? 'CHECKED' : '';
 					$app_col2 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='apps[%s]' value='1' %s %s></td>\n",
 					$data['title'],$app,$checked, $disabled);
@@ -853,5 +853,5 @@
 				if (($i +1) % 3 == 0)
 				{
-					$checked = $user_applications[$app] ? 'CHECKED' : '';
+					$checked = is_array($user_applications) && $user_applications[$app] ? 'CHECKED' : '';
 					$app_col3 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='apps[%s]' value='1' %s %s></td>\n",
 					$data['title'],$app,$checked, $disabled);
Index: sandbox/2.5.1-evolucao/admin/inc/class.uiconfig.inc.php
===================================================================
--- sandbox/2.5.1-evolucao/admin/inc/class.uiconfig.inc.php	(revision 8229)
+++ sandbox/2.5.1-evolucao/admin/inc/class.uiconfig.inc.php	(revision 8231)
@@ -242,31 +242,30 @@
 								<td align=\"center\" style=\"width: 15px;\">
 							</tr>";
-                
-        		foreach ($fields as $i => $line) 
-        		{
-					if ($line["cc_attribute_name_$i"] != '' && $line["cc_attribute_ldapname_$i"] != '') {
-						$campos_vazio  = false;
-                        $selectedText  = $line["cc_attribute_type_$i"] == 'text' ? 'selected="selected"' : '';
-                        $selectedTMult = $line["cc_attribute_type_$i"] == 'multivalues' ? 'selected="selected"' : '';
-						$selectedYes   = $line["cc_attribute_searchable_$i"] == 'true'  ? 'selected="selected"' : '';
-						$selectedNo    = $line["cc_attribute_searchable_$i"] == 'false' ? 'selected="selected"' : '';
-
+				if ($fields !== NULL)			
+	        		foreach ($fields as $i => $line) 
+	        		{
+						if ($line["cc_attribute_name_$i"] != '' && $line["cc_attribute_ldapname_$i"] != '') {
+							$campos_vazio  = false;
+	                        $selectedText  = $line["cc_attribute_type_$i"] == 'text' ? 'selected="selected"' : '';
+	                        $selectedTMult = $line["cc_attribute_type_$i"] == 'multivalues' ? 'selected="selected"' : '';
+							$selectedYes   = $line["cc_attribute_searchable_$i"] == 'true'  ? 'selected="selected"' : '';
+							$selectedNo    = $line["cc_attribute_searchable_$i"] == 'false' ? 'selected="selected"' : '';
 						
-                		$campos = $campos . "
-								<tr>
-									<td><input type=\"text\" name=\"newsettings[cc_attribute_name_" . $i . "]\" value=\"".$line["cc_attribute_name_$i"]."\" style=\"width:170px;\"></input></td>
-									<td><input type=\"text\" name=\"newsettings[cc_attribute_ldapname_" . $i . "]\" value=\"".$line["cc_attribute_ldapname_$i"]."\" style=\"width:170px;\"></input></td>
-									<td><select name=\"newsettings[cc_attribute_type_" . $i . "]\" style=\"width:86px; margin: 0px 0px 0px 8px;\">
-											<option value=\"text\" $selectedText>" . lang('Text') . "</option>
-											<option value=\"multivalues\" $selectedTMult>" . lang('Multivalued') ."</option>
-									</select></td>
-									<td><select name=\"newsettings[cc_attribute_searchable_$i]\" style=\"margin: 0px 16px;\">
-											<option value=\"true\" $selectedYes>" . lang('Yes') . "</option>
-											<option value=\"false\" $selectedNo>" . lang('No') . "</option>
-									</select></td>
-									<td><img src=\"contactcenter/templates/default/images/cc_x.png\" alt=\"". lang('Delete') . "\" title=\"". lang('Delete') ."\" style=\"width: 15px; height: 14px; cursor: pointer; position: relative; top: 3px;\" onclick=\"javascript:cc_attribute_delete(this)\"></img></td>  
-								</tr>";
-                	}
-        		} 
+	                		$campos = $campos . "
+									<tr>
+										<td><input type=\"text\" name=\"newsettings[cc_attribute_name_" . $i . "]\" value=\"".$line["cc_attribute_name_$i"]."\" style=\"width:170px;\"></input></td>
+										<td><input type=\"text\" name=\"newsettings[cc_attribute_ldapname_" . $i . "]\" value=\"".$line["cc_attribute_ldapname_$i"]."\" style=\"width:170px;\"></input></td>
+										<td><select name=\"newsettings[cc_attribute_type_" . $i . "]\" style=\"width:86px; margin: 0px 0px 0px 8px;\">
+												<option value=\"text\" $selectedText>" . lang('Text') . "</option>
+												<option value=\"multivalues\" $selectedTMult>" . lang('Multivalued') ."</option>
+										</select></td>
+										<td><select name=\"newsettings[cc_attribute_searchable_$i]\" style=\"margin: 0px 16px;\">
+												<option value=\"true\" $selectedYes>" . lang('Yes') . "</option>
+												<option value=\"false\" $selectedNo>" . lang('No') . "</option>
+										</select></td>
+										<td><img src=\"contactcenter/templates/default/images/cc_x.png\" alt=\"". lang('Delete') . "\" title=\"". lang('Delete') ."\" style=\"width: 15px; height: 14px; cursor: pointer; position: relative; top: 3px;\" onclick=\"javascript:cc_attribute_delete(this)\"></img></td>  
+									</tr>";
+	                	}
+	        		} 
         	
 			    if ($campos_vazio)
