[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/net/ -> request.class.php (source)

   1  <?php
   2  
   3      
   4      lt_include( PLOG_CLASS_PATH."class/config/properties.class.php" );
   5  
   6      if ( !defined("CHECK_CONFIG_REQUEST_MODE") )
   7          define( "CHECK_CONFIG_REQUEST_MODE", 0 );
   8      if ( !defined("NORMAL_REQUEST_MODE") )
   9          define( "NORMAL_REQUEST_MODE", 1 );
  10      if ( !defined("SEARCH_ENGINE_FRIENDLY_MODE") )
  11          define( "SEARCH_ENGINE_FRIENDLY_MODE", 2);
  12  
  13      /**
  14       * \ingroup Net
  15       *
  16       * Represents a request in our system. Doing so we can in the future
  17       * change the format requests are recognized since all the dirty
  18       * stuff would be done here. After that, using an interface of the type
  19       * getValue( "param" ) would be enough to access those values, regardless
  20       * if the request was /index.php?op=Default&articleId=10 or
  21       * /index.php/op/Default/articleId/10.
  22       */
  23      class Request extends Properties 
  24      {
  25  
  26          var $_paramsRaw;
  27          var $_stripSlashes;
  28  
  29          /**
  30           * Initializes the request object
  31           *
  32           * @param values An associative array that will be used to initialize the object
  33           */
  34      	function Request( $values = null )
  35          {
  36              if( $values == null )
  37                  $this->Properties();
  38              else
  39                  $this->Properties( $values );
  40                  
  41              $this->_stripSlashes = true;
  42          }
  43          
  44          /**
  45           * whether parameters should or should not be unescaped automatically
  46           *
  47           * @param escape
  48           */
  49  		function setStripSlashes( $enabled )
  50          {
  51              $this->_stripSlashes = $enabled;
  52          }
  53          
  54          /**
  55           * reimplemented from Properties::getValue() so that we can correctly
  56           * strip slashes from requests where magic_quotes_gpc was enabled
  57           *
  58           * @param key
  59           * @param defaultValue
  60           * @param filterClass
  61           * @return the value
  62           */
  63  		function getValue( $key, $defaultValue = null, $filterClass = null )
  64          {
  65              // get the value from the parent
  66              $value = parent::getValue( $key, $defaultValue, $filterClass );
  67              
  68              // now if magic quotes are enabled and the input parameter is not an array
  69              // and the feature has not been disabled, then strip the slashes
  70              if( get_magic_quotes_gpc() && !is_array( $value ) && $this->_stripSlashes ) {
  71                  $value = stripslashes( $value );
  72              }
  73              
  74              return( $value );
  75          }
  76      }
  77  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics