[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/SessionHandler/ -> none.php (source)

   1  <?php
   2  /**
   3   * SessionHandler implementation for PHP's built-in session handler.
   4   *
   5   * Required parameters:<pre>
   6   *   None.</pre>
   7   *
   8   * Optional parameters:<pre>
   9   *   None.</pre>
  10   *
  11   * $Horde: framework/SessionHandler/SessionHandler/none.php,v 1.3.2.4 2006/01/01 21:28:34 jan Exp $
  12   *
  13   * Copyright 2005-2006 Matt Selsky <selsky@columbia.edu>
  14   *
  15   * See the enclosed file COPYING for license information (LGPL). If you
  16   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  17   *
  18   * @author  Matt Selsky <selsky@columbia.edu>
  19   * @since   Horde 3.1
  20   * @package Horde_SessionHandler
  21   */
  22  class SessionHandler_none extends SessionHandler {
  23  
  24      /**
  25       * Read the data for a particular session identifier from the
  26       * SessionHandler backend.
  27       *
  28       * @param string $id  The session identifier.
  29       *
  30       * @return string  The session data.
  31       */
  32      function read($id)
  33      {
  34          $file = session_save_path() . DIRECTORY_SEPARATOR . 'sess_' . $id;
  35  
  36          $session_data = @file_get_contents($file);
  37          if ($session_data === false) {
  38              return PEAR::raiseError(_("Unable to read file: ") . $file);
  39          }
  40  
  41          return $session_data;
  42      }
  43  
  44      /**
  45       * Get a list of the valid session identifiers.
  46       *
  47       * @return array  A list of valid session identifiers.
  48       */
  49      function getSessionIDs()
  50      {
  51          $sessions = array();
  52  
  53          $path = session_save_path();
  54          $d = dir(empty($path) ? Util::getTempDir() : $path);
  55  
  56          while (false !== ($entry = $d->read())) {
  57              /* Make sure we're dealing with files that start with
  58               * sess_. */
  59              if (is_file($d->path . DIRECTORY_SEPARATOR . $entry) &&
  60                  !strncmp($entry, 'sess_', strlen('sess_'))) {
  61                  $sessions[] = substr($entry, strlen('sess_'));
  62              }
  63          }
  64  
  65          return $sessions;
  66      }
  67  
  68  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7