[ 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/summary/action/ -> summarycustompageaction.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/summary/view/summarycachedview.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/summary/data/validator/customsummarypagevalidator.class.php" );
   6  
   7      /**
   8       * displays custom pages in the summary.php, in case users would like
   9       * to add something extra to the whole set of pages
  10       *
  11       * It will check whether the page requested is one of the default ones and in that
  12       * case, it will *not* show it. It will also perform some sanity checks on the file
  13       * name.
  14       */
  15      class SummaryCustomPageAction extends SummaryAction
  16      {
  17      
  18          var $_page;
  19          var $_error;
  20          
  21  		function perform()
  22          {
  23              $this->_page = $this->_request->getValue( "page" );
  24              $this->_error = $this->_request->getValue( "error", false );
  25              
  26              $val = new CustomSummaryPageValidator();
  27              if( !$val->validate( $this->_page )) {
  28                  // instead of showing an ugly smarty error, let's forward processing
  29                  // to the default action so that at least we can show something!
  30                  SummaryController::setForwardAction( "Default" );
  31              }
  32              else {
  33                  // let's cache the page... After all, we're not expecting much dynamic context in here!
  34                  $this->_view = new SummaryCachedView( $this->_page, Array( "page" => $this->_page, "locale" => $this->_locale->getLocaleCode()));
  35                  
  36                  // we can also have custom pages that return 404 errors, just specify the "error" parameter in the URL
  37                  if( $this->_error ) 
  38                      $this->_view->addHeaderResponse( "HTTP/1.1 404 Not Found" );
  39                  
  40                  $this->setCommonData();
  41              }
  42              
  43              return( true );
  44          }
  45      }
  46  ?>


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