[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_handlers/ -> arraystorage_class.php (source)

   1  <?php
   2  
   3  /*
   4  + ----------------------------------------------------------------------------+
   5  |     e107 website system
   6  |
   7  |     ©Steve Dunstan 2001-2002
   8  |     http://e107.org
   9  |     jalist@e107.org
  10  |
  11  |     Released under the terms and conditions of the
  12  |     GNU General Public License (http://gnu.org).
  13  |
  14  |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/arraystorage_class.php,v $
  15  |     $Revision: 1.12 $
  16  |     $Date: 2005/12/14 17:37:34 $
  17  |     $Author: sweetas $
  18  +----------------------------------------------------------------------------+
  19  */
  20  
  21  if (!defined('e107_INIT')) { exit; }
  22  
  23  /**
  24  * Allows Storage of arrays without use of serialize functions
  25  *
  26  */
  27  class ArrayData {
  28  
  29      /**
  30      * Return a string containg exported array data.
  31      *
  32      * @param array $ArrayData array to be stored
  33      * @param bool $AddSlashes default true, add slashes for db storage, else false
  34      * @return string
  35      */
  36  	function WriteArray($ArrayData, $AddSlashes = true) {
  37          if (!is_array($ArrayData)) {
  38              return false;
  39          }
  40          $Array = var_export($ArrayData, true);
  41          if ($AddSlashes == true) {
  42              $Array = addslashes($Array);
  43          }
  44          return $Array;
  45      }
  46  
  47      /**
  48      * Returns an array from stored array data.
  49      *
  50      * @param string $ArrayData
  51      * @return array stored data
  52      */
  53  	function ReadArray($ArrayData) {
  54          if ($ArrayData == ""){
  55              return false;
  56          }
  57          $data = "";
  58          $ArrayData = '$data = '.trim($ArrayData).';';
  59          @eval($ArrayData);
  60          if (!isset($data) || !is_array($data)) {
  61              trigger_error("Bad stored array data - <br /><br />".htmlentities($ArrayData), E_USER_ERROR);
  62              return false;
  63          }
  64          return $data;
  65      }
  66  }
  67  
  68  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7