Index: branches/2.2/reports/inc/class.imap_functions.inc.php
===================================================================
--- branches/2.2/reports/inc/class.imap_functions.inc.php	(revision 3471)
+++ branches/2.2/reports/inc/class.imap_functions.inc.php	(revision 3946)
@@ -12,8 +12,4 @@
 	var $imap_server;
 	var $imap_port;
-    var $imap_trashfolder;
-    var $imap_sentfolder;
-    var $imap_draftsfolder;
-    var $imap_spamfolder;
 	
 	function imap_functions(){
@@ -23,73 +19,6 @@
 		$this->imap_server	= $_SESSION['phpgw_info']['expresso']['email_server']['imapServer'];
 		$this->imap_port	= $_SESSION['phpgw_info']['expresso']['email_server']['imapPort'];
-		$this->imap_trashfolder  = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultTrashFolder']  ? $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultTrashFolder']  : str_replace("*","", $this->functions->lang("trash"));
-		$this->imap_sentfolder   = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSentFolder']   ? $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSentFolder']   : str_replace("*","", $this->functions->lang("sent"));
-		$this->imap_draftsfolder = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultDraftsFolder'] ? $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultDraftsFolder'] : str_replace("*","", $this->functions->lang("drafts"));
-		$this->imap_spamfolder   = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSpamFolder']   ? $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSpamFolder']   : str_replace("*","", $this->functions->lang("spam"));
 		$this->imapDelimiter= $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'];
 		$this->imap 		= imap_open('{'.$this->imap_server.':'.$this->imap_port.'/novalidate-cert}', $this->imap_admin, $this->imap_passwd, OP_HALFOPEN);
-//		$this->imap 		= imap_open('{'.$this->imap_server.':'.$this->imap_port, $this->imap_admin, $this->imap_passwd, OP_HALFOPEN);
-	}
-	
-	function create($uid, $mailquota)
-	{
-		if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid))
-		{
-			$error = imap_errors();
-			if ($error[0] == 'Mailbox already exists')
-			{
-				$result['status'] = true;
-			}
-			else
-			{
-				$result['status'] = false;
-				$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(INBOX) ($uid):" . $error[0];
-			}
-			return $result;
-		}
-		if ( (!empty($this->imap_sentfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_sentfolder)) )
-		{
-			$error = imap_errors();
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_sentfolder."):" . $error[0];
-			return $result;
-		}
-		if ( (!empty($this->imap_draftsfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_draftsfolder)) )
-		{
-			$error = imap_errors();
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_draftsfolder."):" . $error[0];
-			return $result;
-		}
-		if ( (!empty($this->imap_trashfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_trashfolder)) )
-		{
-			$error = imap_errors();
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_trashfolder."):" . $error[0];
-			return $result;
-		}
-		/* Esperando correção do william (prognus) sobre a utilização do DSPAM
-		if (!empty($this->imap_sentfolder))
-		{
-		    if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_spamfolder))
-			{
-			    $error = imap_errors();
-			    $result['status'] = false;
-			    $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_spamfolder."):" . $error[0];
-			    return $result;
-			}
-		}
-		*/
-
-		if (!imap_set_quota($this->imap,"user" . $this->imapDelimiter . $uid, ($mailquota*1024))) 
-		{
-			$error = imap_errors();
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(imap_set_quota):" . $error[0];
-			return $result;
-		}
-		
-		$result['status'] = true;
-		return $result;
 	}
 	
@@ -110,143 +39,3 @@
 		return $quota;
 	}
-	
-	function change_user_quota($uid, $quota)
-	{
-		$result['status'] = true;
-		
-		if (!imap_set_quota($this->imap,"user" . $this->imapDelimiter . $uid, ($quota*1024)) )
-		{
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('it was not possible to change users mailbox quota') . ".\n";
-			$result['msg'] .= $this->functions->lang('Server returns') . ': ' . imap_last_error();
-		}
-		
-		return $result;
-	}
-	
-	function delete_user($uid)
-	{
-		$result['status'] = true;
-		
-		//Seta acl imap para poder deletar o user.
-		// Esta sem tratamento de erro, pois o retorno da funcao deve ter um bug.
-		imap_setacl($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, 'c');
-		
-		if (!imap_deletemailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid))
-		{
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('it was not possible to delete users mailbox') . ".\n";
-			$result['msg'] .= $this->functions->lang('Server returns') . ': ' . imap_last_error();
-		}
-		
-		return $result;
-	}
-	
-	function rename_mailbox($old_mailbox, $new_mailbox)
-	{
-		$result['status'] = true;
-
-		if (!$quota = @imap_get_quotaroot($this->imap, 'user' . $this->imapDelimiter . $old_mailbox))
-		{
-				$result['status'] = false;
-				$result['msg'] = $this->functions->lang("Error getting user quota. Process aborted.\n") . $this->functions->lang('Server returns') . ': ' . imap_last_error();
-				return $result;
-		}
-		$limit = $quota['STORAGE']['limit'];
-		$usage = $quota['STORAGE']['usage'];
-		
-		if ($usage >= $limit)
-		{
-			if (! @imap_set_quota($this->imap, 'user' . $this->imapDelimiter . $old_mailbox, (int)($usage+10240)) )
-			{
-				$result['status'] = false;
-				$result['msg'] = $this->functions->lang("Error increasing user quota. Process aborted.\n") . $this->functions->lang('Server returns') . ': ' . imap_last_error();
-				return $result;
-			}
-		}
-
-		
-		if (! @imap_renamemailbox($this->imap,
-						'{'.$this->imap_server.':'.$this->imap_port.'}user' . $this->imapDelimiter . $old_mailbox,
-						'{'.$this->imap_server.':'.$this->imap_port.'}user' . $this->imapDelimiter . $new_mailbox) )
-		{
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('Server returns') . ': ' . imap_last_error();
-
-		}
-
-
-		if ($usage >= $limit)
-		{
-			if (! @imap_set_quota($this->imap, 'user' . $this->imapDelimiter . $new_mailbox, (int)($limit)) )
-			{
-				$result['status'] = false;
-				$result['msg'] .= $this->functions->lang("Error returning user quota.\n") . $this->functions->lang('Server returns') . ': ' . imap_last_error();
-				
-				@imap_renamemailbox($this->imap,
-					'{'.$this->imap_server.':'.$this->imap_port.'}user' . $this->imapDelimiter . $new_mailbox,
-					'{'.$this->imap_server.':'.$this->imap_port.'}user' . $this->imapDelimiter . $old_mailbox);
-			}
-		}
-
-		return $result;
-	}
-	
-	function empty_inbox($params)
-	{
-		// Verifica o acesso do gerente
-		if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_user_inbox'))
-		{
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('You do not have access to clean an user inbox');
-			return $result;
-		}
-		
-		if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes')
-		{
-			$imap_options = '/tls/novalidate-cert';
-		}
-		else
-		{
-			$imap_options = '/notls/novalidate-cert';
-		}
-
-		
-		$result['status'] = true;
-		$uid = $params['uid'];
-		
-		$return_setacl = imap_setacl($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, 'lrswipcda');
-		
-		if ($return_setacl)
-		{
-			$mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options .'}user'. $this->imapDelimiter . $uid, $this->imap_admin, $this->imap_passwd);
-			
-			$check = imap_mailboxmsginfo($mbox_stream);
-			$inbox_size = (string)(round ((($check->Size)/(1024*1024)), 2));
-			
-			$return_imap_delete = imap_delete($mbox_stream,'1:*');
-			imap_close($mbox_stream, CL_EXPUNGE);
-			
-			imap_setacl ($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, '');
-			
-			if ($return_imap_delete)
-			{
-				$result['inbox_size'] = $inbox_size;
-				
-				$get_user_quota = @imap_get_quotaroot($this->imap,"user" . $this->imapDelimiter . $uid);
-				$result['mailquota_used'] = (string)(round(($get_user_quota['usage']/1024), 2));
-			}
-			else
-			{
-				$result['status'] = false;
-				$result['msg'] = $this->functions->lang('It was not possible clean the users inbox') . ".\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error();
-			}
-		}
-		else
-		{
-			$result['status'] = false;
-			$result['msg'] = $this->functions->lang('It was not possible to modify the users acl') . ".\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error();
-		}
-		return $result;
-	}
 }
