[ Index ] |
|
Code source de eZ Publish 3.9.0 |
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 ( "kernel/classes/datatypes/ezuser/ezuser.php" ); 28 include_once ( "lib/ezutils/classes/ezhttptool.php" ); 29 include_once ( "kernel/classes/datatypes/ezuser/ezusersetting.php" ); 30 31 $Module =& $Params["Module"]; 32 if ( isset( $Params["UserID"] ) ) 33 $UserID = $Params["UserID"]; 34 35 $http =& eZHTTPTool::instance(); 36 37 $user = eZUser::fetch( $UserID ); 38 if ( !$user ) 39 return $Module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' ); 40 $userObject =& $user->attribute( 'contentobject' ); 41 if ( !$userObject ) 42 return $Module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' ); 43 $userSetting = eZUserSetting::fetch( $UserID ); 44 45 if ( $http->hasPostVariable( "UpdateSettingButton" ) ) 46 { 47 $isEnabled = 0; 48 if ( $http->hasPostVariable( "max_login" ) ) 49 { 50 $maxLogin = $http->postVariable( "max_login" ); 51 $userSetting->setAttribute( "max_login", $maxLogin ); 52 } 53 54 if ( $http->hasPostVariable( "is_enabled" ) ) 55 { 56 $isEnabled = true; 57 } 58 59 if ( $userSetting->attribute( 'is_enabled' ) != $isEnabled ) 60 { 61 include_once ( 'kernel/classes/ezcontentcachemanager.php' ); 62 eZContentCacheManager::clearContentCacheIfNeeded( $UserID ); 63 eZContentCacheManager::generateObjectViewCache( $UserID ); 64 } 65 66 $userSetting->setAttribute( "is_enabled", $isEnabled ); 67 $userSetting->store(); 68 if ( !$isEnabled ) 69 { 70 eZUser::removeSessionData( $UserID ); 71 } 72 $Module->redirectTo( '/content/view/full/' . $userObject->attribute( 'main_node_id' ) ); 73 return; 74 } 75 76 if ( $http->hasPostVariable( "CancelSettingButton" ) ) 77 { 78 $Module->redirectTo( '/content/view/full/' . $userObject->attribute( 'main_node_id' ) ); 79 return; 80 } 81 82 if ( $http->hasPostVariable( "ResetFailedLoginButton" ) ) 83 { 84 // Reset number of failed login attempts 85 eZUser::setFailedLoginAttempts( $UserID, 0, true ); 86 } 87 88 $failedLoginAttempts = eZUser::failedLoginAttempts( $UserID ); 89 $maxFailedLoginAttempts = eZUser::maxNumberOfFailedLogin(); 90 91 $Module->setTitle( "Edit user settings" ); 92 // Template handling 93 include_once ( "kernel/common/template.php" ); 94 $tpl =& templateInit(); 95 $tpl->setVariable( "module", $Module ); 96 $tpl->setVariable( "http", $http ); 97 $tpl->setVariable( "userID", $UserID ); 98 $tpl->setVariable( "user", $user ); 99 $tpl->setVariable( "userSetting", $userSetting ); 100 $tpl->setVariable( "failed_login_attempts", $failedLoginAttempts ); 101 $tpl->setVariable( "max_failed_login_attempts", $maxFailedLoginAttempts ); 102 103 $Result = array(); 104 $Result['content'] =& $tpl->fetch( "design:user/setting.tpl" ); 105 $Result['path'] = array( array( 'text' => ezi18n( 'kernel/user', 'User' ), 106 'url' => false ), 107 array( 'text' => ezi18n( 'kernel/user', 'Setting' ), 108 'url' => false ) ); 109 110 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |