[ 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/ -> mercury32.php (source)

   1  <?php
   2  /**
   3   * Implementation of the Quota API for Mercury/32 IMAP servers.
   4   * For reading Quota, read size folder user.
   5   *
   6   * Requires the following parameter settings in imp/servers.php:
   7   * 'quota' => array(
   8   *     'driver' => 'mercury32',
   9   *     'params' => array(
  10   *         'mail_user_folder' => 'c:/mercry/mail'
  11   *     )
  12   * );
  13   *
  14   * mail_user_folder --  The path to folder mail mercury
  15   *
  16   *****************************************************************************
  17   * PROBLEM TO ACCESS NETWORK DIRECOTRY
  18   *****************************************************************************
  19   * Matt Grimm
  20   * 06-Jun-2003 10:25
  21   *
  22   * Thought I could help clarify something with accessing network shares on a
  23   * Windows network (2000 in this case), running PHP 4.3.2 under Apache 2.0.44.
  24   * However you are logged into the Windows box, your Apache service must be
  25   * running under an account which has access to the share.  The easiest (and
  26   * probably least safe) way for me was to change the user for the Apache
  27   * service to the computer administrator (do this in the service properties,
  28   * under the "Log On" tab).  After restarting Apache, I could access mapped
  29   * drives by their assigned drive letter ("z:\\") or regular shares by their
  30   * UNC path ("\\\\shareDrive\\shareDir").
  31   *****************************************************************************
  32   *
  33   * $Horde: imp/lib/Quota/mercury32.php,v 1.1.10.8 2007/01/02 13:55:02 jan Exp $
  34   *
  35   * Copyright 2002-2007 Frank Lupo <frank_lupo@email.it>
  36   *
  37   * See the enclosed file COPYING for license information (GPL). If you
  38   * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  39   *
  40   * @author  Frank Lupo <frank_lupo@email.it>
  41   * @since   IMP 4.0
  42   * @package IMP_Quota
  43   */
  44  class IMP_Quota_mercury32 extends IMP_Quota {
  45  
  46      /**
  47       * Constructor
  48       *
  49       * @param array $params  Hash containing connection parameters.
  50       */
  51      function IMP_Quota_mercury32($params = array())
  52      {
  53          $this->_params = $params;
  54      }
  55  
  56      /**
  57       * Get quota information (used/allocated), in bytes.
  58       *
  59       * @return mixed  An associative array.
  60       *                'limit' = Maximum quota allowed
  61       *                'usage' = Currently used portion of quota (in bytes)
  62       *                Returns PEAR_Error on failure.
  63       */
  64      function getQuota()
  65      {
  66          $quota = null;
  67  
  68          $dir_path = $this->_params['mail_user_folder'] . '/' . $_SESSION['imp']['user'] . '/';
  69          if ($dir = @opendir($dir_path)) {
  70              while (($file = readdir($dir)) !== false) {
  71                  $quota += filesize($dir_path . $file);
  72              }
  73              closedir($dir);
  74  
  75              if (!is_null($quota)) {
  76                  return array('usage' => $quota, 'limit' => 0);
  77              }
  78          }
  79          return PEAR::raiseError(_("Unable to retrieve quota"), 'horde.error');
  80      }
  81  
  82  }


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