[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/user/ -> activate.php (source)

   1  <?php
   2  //
   3  // Created on: <01-Aug-2002 09:58:09 bf>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  //include_once( 'lib/ezutils/classes/ezhttptool.php' );
  28  include_once ( 'kernel/classes/datatypes/ezuser/ezuser.php' );
  29  include_once ( 'kernel/classes/ezcontentobject.php' );
  30  include_once ( 'kernel/classes/datatypes/ezuser/ezusersetting.php' );
  31  include_once ( 'kernel/classes/datatypes/ezuser/ezuseraccountkey.php' );
  32  
  33  $Module =& $Params['Module'];
  34  //$http =& eZHTTPTool::instance();
  35  $hash =& $Params['Hash'];
  36  
  37  // Check if key exists
  38  $accountActivated = false;
  39  $accountKey = eZUserAccountKey::fetchByKey( $hash );
  40  
  41  if ( $accountKey )
  42  {
  43      $accountActivated = true;
  44      $userID = $accountKey->attribute( 'user_id' );
  45  
  46      // Enable user account
  47      $userSetting = eZUserSetting::fetch( $userID );
  48      $userSetting->setAttribute( 'is_enabled', 1 );
  49      $userSetting->store();
  50  
  51      // Log in user
  52      $user = eZUser::fetch( $userID );
  53  
  54      if ( $user === null )
  55          return $Module->handleError( EZ_ERROR_KERNEL_NOT_FOUND, 'kernel' );
  56  
  57      $user->loginCurrent();
  58  
  59      // Remove key
  60      $accountKey->remove( $userID );
  61  }
  62  
  63  
  64  // Template handling
  65  include_once ( 'kernel/common/template.php' );
  66  $tpl =& templateInit();
  67  
  68  $tpl->setVariable( 'module', $Module );
  69  $tpl->setVariable( 'account_activated', $accountActivated );
  70  
  71  // This line is deprecated, the correct name of the variable should
  72  // be 'account_activated' as shown above.
  73  // However it is kept for backwards compatability.
  74  $tpl->setVariable( 'account_avtivated', $accountActivated );
  75  
  76  $Result = array();
  77  $Result['content'] =& $tpl->fetch( 'design:user/activate.tpl' );
  78  $Result['path'] = array( array( 'text' => ezi18n( 'kernel/user', 'User' ),
  79                                  'url' => false ),
  80                           array( 'text' => ezi18n( 'kernel/user', 'Activate' ),
  81                                  'url' => false ) );
  82  $ini =& eZINI::instance();
  83  if ( $ini->variable( 'SiteSettings', 'LoginPage' ) == 'custom' )
  84      $Result['pagelayout'] = 'loginpagelayout.tpl';
  85  
  86  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7