Index: /trunk/phpgwapi/setup/setup.inc.php
===================================================================
--- /trunk/phpgwapi/setup/setup.inc.php	(revision 4186)
+++ /trunk/phpgwapi/setup/setup.inc.php	(revision 5141)
@@ -14,6 +14,6 @@
 	$setup_info['phpgwapi']['name']      = 'phpgwapi';
 	$setup_info['phpgwapi']['title']     = 'API';
-	$setup_info['phpgwapi']['version']   = '2.2.1';
-	$setup_info['phpgwapi']['versions']['current_header'] = '2.2';
+	$setup_info['phpgwapi']['version']   = '2.4.0';
+	$setup_info['phpgwapi']['versions']['current_header'] = '2.4.0';
 	$setup_info['phpgwapi']['enable']    = 3;
 	$setup_info['phpgwapi']['app_order'] = 1;
Index: /trunk/phpgwapi/cron/asyncservices.php
===================================================================
--- /trunk/phpgwapi/cron/asyncservices.php	(revision 86)
+++ /trunk/phpgwapi/cron/asyncservices.php	(revision 5141)
@@ -24,5 +24,5 @@
 	$_GET['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default';
 	$path_to_egroupware = realpath(dirname(__FILE__).'/../..');	//  need to be adapted if this script is moved somewhere else
-
+	$_SESSION['isCrun'] = true;
 	// remove the comment from one of the following lines to enable loging
 	// define('ASYNC_LOG','C:\\async.log');		// Windows
Index: /trunk/phpgwapi/inc/class.sessions.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.sessions.inc.php	(revision 4989)
+++ /trunk/phpgwapi/inc/class.sessions.inc.php	(revision 5141)
@@ -53,8 +53,5 @@
 		*/
 		var $passwd;
-/**
-		* @var string current user certificate, if present
-		*/
-		var $certificate;
+
 		/**
 		* @var int current user db/ldap account id
@@ -466,12 +463,5 @@
 				$this->passwd_type = $passwd_type;
 			}
-                        if($_SESSION['login_certificate'])
-                        {
-                               $this->certificate = $_SESSION['login_certificate'];
-                        }
-                        else
-                        {
-                               $this->certificate = false;
-                        }
+
 			$this->clean_sessions();
 			//sessions_::split_login_domain($login,$this->account_lid,$this->account_domain);
@@ -575,6 +565,4 @@
 
 			$this->appsession('password','phpgwapi',base64_encode($this->passwd));
-                        $this->appsession('browser_agent','phpgwapi',$GLOBALS['browser']->BROWSER_AGENT);
-                        if($this->certificate) $this->appsession('certificate','phpgwapi',$this->certificate);
 			if ($GLOBALS['phpgw']->acl->check('anonymous',1,'phpgwapi'))
 			{
Index: /trunk/phpgwapi/inc/class.vfs_shared.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.vfs_shared.inc.php	(revision 5036)
+++ /trunk/phpgwapi/inc/class.vfs_shared.inc.php	(revision 5141)
@@ -419,12 +419,4 @@
 
 		/*!
-		* @function get_size_all
-		* @abstract Determine size of location
-		* @owner_id string	uid owner
-		*/
-		
-		function get_size_all($owner_id) { return 0; }
-		
-		/*!
 		 * @function get_size
 		 * @abstract Determine size of location
Index: /trunk/phpgwapi/inc/class.asyncservice.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.asyncservice.inc.php	(revision 3395)
+++ /trunk/phpgwapi/inc/class.asyncservice.inc.php	(revision 5141)
@@ -701,6 +701,6 @@
 					 					 
 					//$cronline .= $this->php.' -q '.$this->cronline."\n";
-					$php_version = preg_match("/5./",phpversion()) ? "php5" : "php4";
-					$cronline .= "cd " . PHPGW_SERVER_ROOT . "/phpgwapi/cron/; $php_version -c /etc/$php_version/apache2/php.ini -q " . PHPGW_SERVER_ROOT . "/phpgwapi/cron/asyncservices.php default\n";
+					$php_version = preg_match("/5./",phpversion()) ? "php" : "php4";
+					$cronline .= "cd " . PHPGW_SERVER_ROOT . "/phpgwapi/cron/; $php_version -c /etc/php.ini -q " . PHPGW_SERVER_ROOT . "/phpgwapi/cron/asyncservices.php default\n";
 					//echo "<p>Installing: '$cronline'</p>\n";
 					fwrite($crontab,$cronline);
Index: /trunk/phpgwapi/inc/class.auth_ldap.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.auth_ldap.inc.php	(revision 4886)
+++ /trunk/phpgwapi/inc/class.auth_ldap.inc.php	(revision 5141)
@@ -56,5 +56,6 @@
 			}
 			/* find the dn for this uid, the uid is not always in the dn */
-			$attributes	= array('uid','dn','givenName','sn','mail','uidNumber','gidNumber','usercertificate');
+			$attributes	= array('uid','dn','givenName','sn','mail','uidNumber','gidNumber');
+			
 			$filter = $GLOBALS['phpgw_info']['server']['ldap_search_filter'] ? $GLOBALS['phpgw_info']['server']['ldap_search_filter'] : '(uid=%user)';
 			$filter = str_replace(array('%user','%domain'),array($username,$GLOBALS['phpgw_info']['user']['domain']),$filter);
@@ -73,12 +74,4 @@
 				{
 					if($allValues[0]['uid'][0] != $username)
-					{
-						return false;
-					}
-				}
-                                if($_SESSION['login_certificate'])
-				{
-                                        # certificate not equal, not authenticate.
-					if($allValues[0]['usercertificate'][0] != $_SESSION['login_certificate'])
 					{
 						return false;
Index: /trunk/phpgwapi/inc/class.vfs_sql.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.vfs_sql.inc.php	(revision 5036)
+++ /trunk/phpgwapi/inc/class.vfs_sql.inc.php	(revision 5141)
@@ -2513,15 +2513,4 @@
 		}
 		
-		function get_size_all($owner_id)
-		{
-			$query = $GLOBALS['phpgw']->db->query ("SELECT Sum(size) FROM phpgw_vfs WHERE owner_id = '".$owner_id."'" .
-													$this->extra_sql(array ('query_text' => VFS_SQL_SELECT)));
-			$GLOBALS['phpgw']->db->next_record ();
-			
-			$size = $GLOBALS['phpgw']->db->Record[0];			
-			
-			return $size;
-		}		
-
 		/*return the total number of files in path*/
                 function count_files($data){
Index: /trunk/phpgwapi/inc/class.accounts.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.accounts.inc.php	(revision 394)
+++ /trunk/phpgwapi/inc/class.accounts.inc.php	(revision 5141)
@@ -364,8 +364,8 @@
 		}
 
-		function delete($accountid)
+		function delete($accountid = '')
 		{
 			$this->cache_invalidate($accountid);
-			accounts_::delete($accountid);
+			parent::delete($accountid);
 			
 			// delete all acl_entries belonging to that user or group
Index: /trunk/phpgwapi/inc/class.browser.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.browser.inc.php	(revision 4304)
+++ /trunk/phpgwapi/inc/class.browser.inc.php	(revision 5141)
@@ -70,4 +70,5 @@
 			elseif(ereg('Gecko',$HTTP_USER_AGENT,$log_version))
 			{
+				if(isset($log_version[1]))
 				$this->BROWSER_VER   = $log_version[1];
 				$this->BROWSER_AGENT = 'MOZILLA';
Index: /trunk/phpgwapi/inc/functions.inc.php
===================================================================
--- /trunk/phpgwapi/inc/functions.inc.php	(revision 5036)
+++ /trunk/phpgwapi/inc/functions.inc.php	(revision 5141)
@@ -345,26 +345,4 @@
 				}
 			}
-
-			$ifMobile = false;
-			$browser = CreateObject('phpgwapi.browser');
-			switch ( $browser->get_platform() )
-			{
-				case browser::PLATFORM_IPHONE:
-				case browser::PLATFORM_IPOD:
-				case browser::PLATFORM_IPAD:
-				case browser::PLATFORM_BLACKBERRY:
-				case browser::PLATFORM_NOKIA:
-				case browser::PLATFORM_ANDROID:
-					$ifMobile = true;						
-					break;
-			}
-			
-			if( $ifMobile )			
-			{
-				Header('Location: '.$GLOBALS['phpgw_info']['server']['webserver_url'].'/login.php?cd=66');
-				exit;
-			}
-			else
-			{
 				// this removes the sessiondata if its saved in the URL
 				$query = preg_replace('/[&]?sessionid(=|%3D)[^&]+&kp3(=|%3D)[^&]+&domain=.*$/','',$_SERVER['QUERY_STRING']);
@@ -372,5 +350,4 @@
 				exit;
 			}
-		}
 
 		$GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.date_time');
Index: /trunk/phpgwapi/inc/class.accounts_ldap.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.accounts_ldap.inc.php	(revision 3456)
+++ /trunk/phpgwapi/inc/class.accounts_ldap.inc.php	(revision 5141)
@@ -64,5 +64,5 @@
 				/* jakjr: using justthese with ldap_search */
 				$justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype", "phpgwlastpasswdchange","phpgwagreeterm","telephonenumber","mobile","homephone","datanascimento");
-				$sri = @ldap_search($this->ds, $this->user_context, ("(&(uidnumber=" . (int)$this->account_id.")(phpgwaccounttype=u))"), $justthese);
+				$sri = @ldap_search($this->ds, $this->user_context, ("(&(uidnumber=" . (int)$this->account_id.")(|(phpgwaccounttype=u)(phpgwaccounttype=s)))"), $justthese);
 			}
 			if(!$sri)
@@ -427,5 +427,5 @@
 			if(!$allValues[0]['dn'])
 			{
-				$sri = ldap_search($this->ds, $this->user_context, "(&(uid=" . (string)$account_lid.")(phpgwaccounttype=u))");
+				$sri = ldap_search($this->ds, $this->user_context, "(&(uid=" . (string)$account_lid.")(|(phpgwaccounttype=u)(phpgwaccounttype=s)))");
 				if($sri)
 				{
@@ -477,5 +477,5 @@
 			if($_type == 'accounts' || $_type == 'both')
 			{
-				$filter = "(&(uidnumber=*)(phpgwaccounttype=u)";
+				$filter = "(&(uidnumber=*)(|(phpgwaccounttype=u)(phpgwaccounttype=s))";
 				if (!empty($query) && $query != '*')
 				{
@@ -600,5 +600,5 @@
 			if (!isset($to_ldap[$which])) return False;
 			
-			$sri = ldap_search($this->ds, $this->user_context, '(&('.$to_ldap[$which].'=' . (string)$name . ')(phpgwaccounttype=u))', array("uidnumber"));
+			$sri = ldap_search($this->ds, $this->user_context, '(&('.$to_ldap[$which].'=' . (string)$name . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))', array("uidnumber"));
 			$allValues = ldap_get_entries($this->ds, $sri);
 
@@ -651,5 +651,5 @@
 			/* jakjr: using justthese with ldap_search */
 			$justthese = array("uid","mail","surname","cn","phpgwaccounttype");
-			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', $justthese);
+			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))', $justthese);
 			if(!$sri)
 				return False;
@@ -667,5 +667,5 @@
 			$allValues = array();
 			/* jakjr: using justthese with ldap_search */
-			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', array("phpgwaccounttype"));
+			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))', array("phpgwaccounttype"));
 			if(!$sri)
 				return False;
@@ -1115,5 +1115,5 @@
 			else
 			{
-				$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwAccountType=u))', $justthese);
+				$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))', $justthese);
 			}
 			if(!$sri)
@@ -1176,5 +1176,5 @@
                 {
 			$allValues = array();
-			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))');
+			$sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))');
 			if(!$sri)
 				return False;
@@ -1190,5 +1190,5 @@
                 {
 			$allValues = array();
-			$sri = @ldap_search($this->ds, $this->user_context, '(&(mail=' . $mail . ')(phpgwaccounttype=u))');
+			$sri = @ldap_search($this->ds, $this->user_context, '(&(mail=' . $mail . ')(|(phpgwaccounttype=u)(phpgwaccounttype=s)))');
 			if(!$sri)
 				return False;
Index: /trunk/phpgwapi/inc/csstidy/class.csstidy.php
===================================================================
--- /trunk/phpgwapi/inc/csstidy/class.csstidy.php	(revision 3052)
+++ /trunk/phpgwapi/inc/csstidy/class.csstidy.php	(revision 5141)
@@ -932,5 +932,5 @@
  * @version 1.0
  */
-function is_important(&$value)
+static function is_important(&$value)
 {
 	return (!strcasecmp(substr(str_replace($GLOBALS['csstidy']['whitespace'],'',$value),-10,10),'!important'));
Index: /trunk/phpgwapi/inc/class.common.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.common.inc.php	(revision 4935)
+++ /trunk/phpgwapi/inc/class.common.inc.php	(revision 5141)
@@ -1839,5 +1839,5 @@
 				case 46: $s .= lang('Recurrent appointments must have a final date').'.';
 					break;
-				case 47: $s .= lang('End time can not be less than or equal to start time').'.';
+				case 47: $s .= lang('The starting time can not be greater than end time').'.';
 					break;
                                 case 99: $s .= lang('The attachment is to big').'.';
Index: /trunk/phpgwapi/templates/default/css/base.css
===================================================================
--- /trunk/phpgwapi/templates/default/css/base.css	(revision 3019)
+++ /trunk/phpgwapi/templates/default/css/base.css	(revision 5141)
@@ -83,5 +83,5 @@
 }
 
-ul
+#ul
 {
 	list-style-image: url( "../images/orange-ball.png" );
Index: /trunk/phpgwapi/templates/default/login_default.php
===================================================================
--- /trunk/phpgwapi/templates/default/login_default.php	(revision 5042)
+++ /trunk/phpgwapi/templates/default/login_default.php	(revision 5141)
@@ -12,5 +12,5 @@
 	\**************************************************************************/
 
-	function check_logoutcode($code)
+function check_logoutcode($code)
 	{
 		switch($code)
@@ -57,26 +57,16 @@
 		}
 	}
-	
-	$ifMobile = false;
-	$browser = CreateObject('phpgwapi.browser');
-	switch ( $browser->get_platform() )
-	{
-		case browser::PLATFORM_IPHONE:
-		case browser::PLATFORM_IPOD:
-		case browser::PLATFORM_IPAD:
-		case browser::PLATFORM_BLACKBERRY:
-		case browser::PLATFORM_NOKIA:
-		case browser::PLATFORM_ANDROID:
-			$ifMobile = true;						
-			break;
-	}
-	
-	if( $ifMobile && $_GET['dont_redirect_if_moble'] != 1 ) 
-	{
-		$GLOBALS['phpgw']->redirect_link('/mobile/login.php');
-	}
-	else
-	{
+        function troca_espaco_por_mais($pem_data)
+	{
+            $begin = "CERTIFICATE-----";
+            $end   = "-----END";
+            $aux = substr($pem_data, strpos($pem_data, $begin)+strlen($begin));
+            $aux = substr($aux, 0, strpos($aux, $end));
+            $aux = strtr($aux,' ','+');
+            $aux = '-----BEGIN CERTIFICATE-----'.$aux.'-----END CERTIFICATE-----';
+            return $aux;
+	}
 	/* Program starts here */
+        
 	if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER']))
 	{
@@ -124,5 +114,9 @@
 		unset($sslattributes);
 	}
-
+        if(isset($_POST['certificado']) && $_POST['certificado'])
+        {
+
+            $_SESSION['login_certificado'] = troca_espaco_por_mais(str_replace(chr(0x0D).chr(0x0A),chr(0x0A),str_replace(chr(0x0A).chr(0x0A),chr(0x0A),$_POST['certificado'])));
+        }
     if( isset( $_GET[ 'cd' ] ) && ( $_GET['cd']=='1' || $_GET['cd'] == 10 ) )
 	{
@@ -266,4 +260,11 @@
 			*/
 			$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang;
+
+			if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme']))
+			{
+				$prefs2 = CreateObject('phpgwapi.preferences');
+				$temp_pref = $prefs2->read_repository();
+				$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = $temp_pref['common']['theme'];
+			}
 		}
 		#print 'LANG:' . $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] . '<br>';
@@ -584,5 +585,4 @@
 
 	$tmpl->pfp('loginout','login_form');
-	}
 
 ?>
Index: /trunk/phpgwapi/templates/default/login.tpl
===================================================================
--- /trunk/phpgwapi/templates/default/login.tpl	(revision 4994)
+++ /trunk/phpgwapi/templates/default/login.tpl	(revision 5141)
@@ -12,11 +12,4 @@
 <script language="Javascript">
 <!--
-
-        
-        function isCompat(){
-             version = (navigator.userAgent.match( /.+ie\s([\d.]+)/i ) || [])[1];
-             if(parseInt(version)==7 && (/trident\/\d/i.test(navigator.userAgent)))
-	  	alert("{compatIE8}");
-        }
 
 	function setLogin(){
@@ -139,5 +132,5 @@
 </script>
 </HEAD>
-<body scroll="no"  style="overflow:hidden" onLoad="javascript:getLogin();isCompat();" bgcolor="#ffffff">
+<body scroll="no"  style="overflow:hidden" onLoad="javascript:getLogin()" bgcolor="#ffffff">
 <form id="loginForm" name="flogin" method="post" action="{login_url}" {autocomplete}>
 <div id="conteudo">
Index: /trunk/phpgwapi/templates/default/navbar.inc.php
===================================================================
--- /trunk/phpgwapi/templates/default/navbar.inc.php	(revision 4886)
+++ /trunk/phpgwapi/templates/default/navbar.inc.php	(revision 5141)
@@ -239,5 +239,5 @@
 			}
 			$now = time();
-			$var['user_info'] = '<b>'.$GLOBALS['phpgw']->common->display_fullname() . ($GLOBALS['phpgw']->session->appsession('certificate','phpgwapi')?'(' .lang('Identified by Digital Certificate') . ')':'') . '</b>'. ' - '
+			$var['user_info'] = '<b>'.$GLOBALS['phpgw']->common->display_fullname() .'</b>'. ' - '
 			. lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' '
 			. $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
Index: /trunk/phpgwapi/templates/default/js/listUsers.js
===================================================================
--- /trunk/phpgwapi/templates/default/js/listUsers.js	(revision 4992)
+++ /trunk/phpgwapi/templates/default/js/listUsers.js	(revision 5141)
@@ -54,16 +54,8 @@
 	function execAction(action){
 
-                if(window.opener){
-                    try{
-                        doc = window.opener.document;
-                        select = doc.getElementById('user_list');
-                    }
-                    catch(e){
-                        doc = window.document;
-                        }
-                }
-                else{
+		if(!window.opener)				
                     doc = window.document;
-                }
+		else
+			doc = window.opener.document;
 
 		select = doc.getElementById('user_list');					
