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

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/view/admin/admindefaultview.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/view/redirectview.class.php" );
   6      lt_include( PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
   7  
   8      /**
   9       * \ingroup Action
  10       * @private
  11       *
  12       * Logs the user out, by removing all the information from the session.
  13       */
  14      class AdminLogoutAction extends AdminAction 
  15      {
  16  
  17          /**
  18           * Constructor. If nothing else, it also has to call the constructor of the parent
  19           * class, BlogAction with the same parameters
  20           */
  21          function AdminLogoutAction( $actionInfo, $request )
  22          {
  23              $this->AdminAction( $actionInfo, $request );
  24          }
  25  
  26          /**
  27           * Carries out the specified action
  28           */
  29          function perform()
  30          {
  31              $config =& Config::getConfig();            
  32              
  33              $this->notifyEvent( EVENT_PRE_LOGOUT );
  34  
  35              // remove all the information from the session
  36              $session = HttpVars::getSession();
  37              $session["SessionInfo"] = null;
  38              unset($session["SessionInfo"]);
  39              $session = Array();
  40              HttpVars::setSession( $session );
  41              session_destroy();
  42              
  43              $destinationUrl = $config->getValue( "logout_destination_url", "" );
  44              if( $destinationUrl == "" ) {
  45                  // and pass the locale to the template
  46                  $this->_view = new AdminDefaultView();            
  47                  $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
  48                  $url = $this->_blogInfo->getBlogRequestGenerator();
  49                  $blogTitle = $this->_blogInfo->getBlog();
  50                  $logoutMessage = $this->_locale->tr("logout_message")."<br/>".$locale->pr("logout_message_2", $url->blogLink(), $blogTitle);
  51                  $this->_view->setSuccessMessage( $logoutMessage );
  52              }
  53              else {
  54                  // nothing else to do, just redirect the browser once we've cleaned up the session
  55                  $this->_view = new RedirectView( $destinationUrl );                
  56              }
  57          
  58              
  59              $this->notifyEvent( EVENT_POST_LOGOUT );
  60  
  61              // better to return true if everything fine
  62              return true;
  63          }
  64      }
  65  ?>


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