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

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/summary/action/registeraction.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/summary/view/summaryxmlview.class.php" );
   6      lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
   7      lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
   8  
   9      /**
  10       * \ingroup Action
  11       * @private
  12       *
  13       * Action that adds a new article category to the database.
  14       */
  15      class CheckUserNameAjaxAction extends RegisterAction 
  16      {
  17  
  18          var $_userName;
  19  
  20          /**
  21           * Constructor. If nothing else, it also has to call the constructor of the parent
  22           * class, BlogAction with the same parameters
  23           */
  24          function CheckUserNameAjaxAction( $actionInfo, $request )
  25          {
  26              $this->RegisterAction( $actionInfo, $request );
  27          }
  28  
  29          /**
  30           * Carries out the specified action
  31           */
  32          function perform()
  33          {
  34              $this->_userName = Textfilter::filterAllHTML($this->_request->getValue( "userName" ));
  35              
  36              // once we have built the object, we can add it to the database
  37              $this->_view = new SummaryXmlView( "response" );                
  38              $this->_view->setValue( "method", "checkUserNameAjax" );
  39              
  40              $uv = new UsernameValidator();
  41              if( !$uv->validate( $this->_userName ) )
  42              {
  43                  $this->_view->setValue( "success", "0" );
  44                  $this->_view->setValue( "message", $this->_locale->tr("error_incorrect_username") );
  45                  
  46                  return true;  
  47              }
  48              
  49              // create the object...
  50              $users = new Users();
  51              $userInfo = $users->getUserInfoFromUsername( $this->_userName );
  52              if( !$userInfo )
  53              {
  54                  $this->_view->setValue( "success", "1" );
  55                  $this->_view->setValue( "message", $this->_locale->tr("check_username_ok") );   
  56              }
  57              else
  58              {
  59                  $this->_view->setValue( "success", "0" );
  60                  $this->_view->setValue( "message", $this->_locale->tr("error_username_exist") );  
  61              }
  62                  
  63              return true;    
  64          }
  65      }
  66  ?>


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