Ignore:
Timestamp:
08/29/07 08:55:50 (17 years ago)
Author:
niltonneto
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php

    r62 r63  
    11<?php 
     2 
     3include_once('class.functions.inc.php'); 
    24 
    35class imap_functions 
    46{ 
     7        var $functions; 
    58        var $imap; 
    69        var $imapDelimiter; 
     
    1720                $this->imapDelimiter= $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']; 
    1821                $this->imap             = imap_open('{'.$this->imap_server.':'.$this->imap_port.'/novalidate-cert}', $this->imap_admin, $this->imap_passwd, OP_HALFOPEN); 
     22                $this->functions        = new functions; 
    1923        } 
    2024         
     
    7276                else 
    7377                { 
    74                         $quota['mailquota'] = ($get_quota['limit'] / 1024); 
    75                         $quota['mailquota_used'] = ($get_quota['usage'] / 1024); 
     78                        $quota['mailquota'] = round (($get_quota['limit'] / 1024), 2); 
     79                        $quota['mailquota_used'] = round (($get_quota['usage'] / 1024), 2); 
    7680                } 
    7781                         
     
    116120                return $result; 
    117121        } 
     122         
     123        function empty_inbox($params) 
     124        { 
     125                // Verifica o acesso do gerente 
     126                if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_user_inbox')) 
     127                { 
     128                        $result['status'] = false; 
     129                        $result['msg'] = 'Você não tem acesso para executar esta operação.'; 
     130                        return $result; 
     131                } 
     132                 
     133                if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') 
     134                { 
     135                        $imap_options = '/tls/novalidate-cert'; 
     136                } 
     137                else 
     138                { 
     139                        $imap_options = '/notls/novalidate-cert'; 
     140                } 
     141 
     142                 
     143                $result['status'] = true; 
     144                $uid = $params['uid']; 
     145                 
     146                $return_setacl = imap_setacl($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, 'lrswipcda'); 
     147                 
     148                if ($return_setacl) 
     149                { 
     150                        //$mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options.'/user="'.$uid.'"}', $this->imap_admin, $this->imap_passwd); 
     151                        $mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options .'}user'. $this->imapDelimiter . $uid, $this->imap_admin, $this->imap_passwd); 
     152                         
     153                        $check = imap_mailboxmsginfo($mbox_stream); 
     154                        $inbox_size = (string)(round ((($check->Size)/(1024*1024)), 2)); 
     155                         
     156                        $return_imap_delete = imap_delete($mbox_stream,'1:*'); 
     157                        imap_close($mbox_stream, CL_EXPUNGE); 
     158                         
     159                        imap_setacl ($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, ''); 
     160                         
     161                        if ($return_imap_delete) 
     162                        { 
     163                                $result['inbox_size'] = $inbox_size; 
     164                                 
     165                                $get_user_quota = @imap_get_quotaroot($this->imap,"user" . $this->imapDelimiter . $uid); 
     166                                $result['mailquota_used'] = (string)(round(($get_user_quota['usage']/1024), 2)); 
     167                        } 
     168                        else 
     169                        { 
     170                                $result['status'] = false; 
     171                                $result['msg'] = "Nao foi possivel esvaziar a caixa postal do usuario:\n" . imap_last_error(); 
     172                        } 
     173                } 
     174                else 
     175                { 
     176                        $result['status'] = false; 
     177                        $result['msg'] = "Nao foi possivel modificar a acl do usuario:\n" . imap_last_error(); 
     178                } 
     179                return $result; 
     180        } 
    118181} 
Note: See TracChangeset for help on using the changeset viewer.