[ Index ]
 

Code source de IMP H3 (4.1.5)

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/lib/Quota/ -> courier.php (source)

   1  <?php
   2  /**
   3   * Implementation of the Quota API for Courier IMAP servers.  This also
   4   * works for dovecot servers.
   5   *
   6   * $Horde: imp/lib/Quota/courier.php,v 1.21.10.12 2007/09/28 15:23:50 ericr Exp $
   7   *
   8   * Copyright 2002-2007 Mike Cochrane <mike@graftonhall.co.nz>
   9   *
  10   * See the enclosed file COPYING for license information (GPL). If you
  11   * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  12   *
  13   * @author  Mike Cochrane <mike@graftonhall.co.nz>
  14   * @since   IMP 4.0
  15   * @package IMP_Quota
  16   */
  17  class IMP_Quota_courier extends IMP_Quota {
  18  
  19      /**
  20       * Get quota information (used/allocated), in bytes.
  21       *
  22       * @return mixed  An associative array.
  23       *                'limit' = Maximum quota allowed
  24       *                'usage' = Currently used portion of quota (in bytes)
  25       *                Returns PEAR_Error on failure.
  26       */
  27      function getQuota()
  28      {
  29          $quota = @imap_get_quotaroot($_SESSION['imp']['stream'],
  30                                           $GLOBALS['imp_search']->isSearchMbox($_SESSION['imp']['mailbox']) ? 'INBOX' : $_SESSION['imp']['mailbox']);
  31  
  32          if (is_array($quota)) {
  33              if (count($quota)) {
  34                  if (!empty($quota['limit'])) {
  35                      return array('usage' => $quota['usage'] * 1024, 'limit' => $quota['limit'] * 1024);
  36                  } elseif (!empty($quota['STORAGE']['limit'])) {
  37                      return array('usage' => $quota['STORAGE']['usage'] * 1024, 'limit' => $quota['STORAGE']['limit'] * 1024);
  38                  }
  39              }
  40              return array('usage' => 0, 'limit' => 0);
  41          }
  42  
  43          return PEAR::raiseError(_("Unable to retrieve quota"), 'horde.error');
  44      }
  45  
  46  }


Généré le : Thu Nov 29 12:30:07 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics