[ 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/ -> adminadminblogselectaction.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/data/validator/integervalidator.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/view/admin/adminsiteblogslistview.class.php" );
   6  
   7      /**
   8       * \ingroup Action
   9       * @private
  10       *
  11       * Sets everything so that admins are allowed to log in into anybody's blog
  12       */
  13      class AdminAdminBlogSelectAction extends AdminAction 
  14      {
  15      
  16          var $_blogId;
  17  
  18          /**
  19           * Constructor. If nothing else, it also has to call the constructor of the parent
  20           * class, BlogAction with the same parameters
  21           */
  22          function AdminAdminBlogSelectAction( $actionInfo, $request )
  23          {
  24              $this->AdminAction( $actionInfo, $request );
  25              
  26              // validate the only field we're expecting, the blog id
  27              $this->registerFieldValidator( "blogId", new IntegerValidator());
  28              $view = new AdminSiteBlogsListView( $this->_blogInfo );
  29              $view->setErrorMessage( $this->_locale->tr( "error_incorrect_blog_id" ));
  30              $this->setValidationErrorView( $view );            
  31              
  32              $this->requireAdminPermission( "edit_blog_admin_mode" );
  33          }
  34  
  35          /**
  36           * Carries out the specified action
  37           */
  38          function perform()
  39          {
  40              $this->_blogId = $this->_request->getValue( "blogId" );
  41          
  42              // load the blog
  43              lt_include( PLOG_CLASS_PATH . "class/dao/blogs.class.php" );
  44              $blogs = new Blogs();
  45              $blogInfo = $blogs->getBlogInfo( $this->_blogId );
  46               
  47              // check if the blog really exists
  48              if( !$blogInfo ) {
  49                  $this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
  50                  $this->_view->setValue( "message", $this->_locale->tr("error_incorrect_blog_id" ));
  51                  $this->setCommonData();            
  52                  return false;                      
  53              }
  54              
  55              // if all correct, we can now set the blogInfo object in the session for later use
  56              $this->_session->setValue( "blogInfo", $blogInfo );
  57              $session = HttpVars::getSession();
  58              $session["SessionInfo"] = $this->_session;
  59              $session["SessionInfo"]->setValue( "blogId", $blogInfo->getId() );
  60              HttpVars::setSession( $session );
  61              
  62              /*print_r($session);
  63              die();*/
  64              
  65              // check if there was any redirection
  66              $this->_nextAction = $this->_request->getValue( "action" );
  67  
  68              if ( $this->_nextAction ) {
  69                  AdminController::setForwardAction( $this->_nextAction );
  70              } else {
  71                  AdminController::setForwardAction( "newPost" );
  72              }
  73              
  74              // better to return true if everything fine
  75              return true;
  76          }
  77      }
  78  ?>


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