[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZStepSiteDetails class 4 // 5 // Created on: <12-Aug-2003 18:30:57 kk> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 /*! \file ezstep_site_details.php 30 */ 31 include_once ( 'kernel/setup/steps/ezstep_installer.php'); 32 include_once ( "kernel/common/i18n.php" ); 33 include_once ( "lib/ezutils/classes/ezmail.php" ); 34 35 define( 'EZ_SETUP_SITE_ADMIN_PASSWORD_MISSMATCH', 1 ); 36 define( 'EZ_SETUP_SITE_ADMIN_FIRST_NAME_MISSING', 2 ); 37 define( 'EZ_SETUP_SITE_ADMIN_LAST_NAME_MISSING', 3 ); 38 define( 'EZ_SETUP_SITE_ADMIN_EMAIL_MISSING', 4 ); 39 define( 'EZ_SETUP_SITE_ADMIN_EMAIL_INVALID', 5 ); 40 define( 'EZ_SETUP_SITE_ADMIN_PASSWORD_MISSING', 6 ); 41 42 /*! 43 \class eZStepSiteAdmin ezstep_site_admin.php 44 \brief The class eZStepSiteAdmin does 45 46 */ 47 48 class eZStepSiteAdmin extends eZStepInstaller 49 { 50 /*! 51 Constructor 52 */ 53 function eZStepSiteAdmin( &$tpl, &$http, &$ini, &$persistenceList ) 54 { 55 $this->eZStepInstaller( $tpl, $http, $ini, $persistenceList, 56 'site_admin', 'Site admin' ); 57 } 58 59 /*! 60 \reimp 61 */ 62 function processPostData() 63 { 64 $user = array(); 65 66 $user['first_name'] = $this->Http->postVariable( 'eZSetup_site_templates_first_name' ); 67 $user['last_name'] = $this->Http->postVariable( 'eZSetup_site_templates_last_name' ); 68 $user['email'] = $this->Http->postVariable( 'eZSetup_site_templates_email' ); 69 if ( strlen( trim( $user['first_name'] ) ) == 0 ) 70 { 71 $this->Error[] = EZ_SETUP_SITE_ADMIN_FIRST_NAME_MISSING; 72 } 73 if ( strlen( trim( $user['last_name'] ) ) == 0 ) 74 { 75 $this->Error[] = EZ_SETUP_SITE_ADMIN_LAST_NAME_MISSING; 76 } 77 if ( strlen( trim( $user['email'] ) ) == 0 ) 78 { 79 $this->Error[] = EZ_SETUP_SITE_ADMIN_EMAIL_MISSING; 80 } 81 else if ( !eZMail::validate( trim( $user['email'] ) ) ) 82 { 83 $this->Error[] = EZ_SETUP_SITE_ADMIN_EMAIL_INVALID; 84 } 85 if ( strlen( trim( $this->Http->postVariable( 'eZSetup_site_templates_password1' ) ) ) == 0 ) 86 { 87 $this->Error[] = EZ_SETUP_SITE_ADMIN_PASSWORD_MISSING; 88 } 89 else if ( $this->Http->postVariable( 'eZSetup_site_templates_password1' ) != $this->Http->postVariable( 'eZSetup_site_templates_password2' ) ) 90 { 91 $this->Error[] = EZ_SETUP_SITE_ADMIN_PASSWORD_MISSMATCH; 92 } 93 else 94 { 95 $user['password'] = $this->Http->postVariable( 'eZSetup_site_templates_password1' ); 96 } 97 if ( !isset( $user['password'] ) ) 98 $user['password'] = ''; 99 $this->PersistenceList['admin'] = $user; 100 101 return ( count( $this->Error ) == 0 ); 102 } 103 104 /*! 105 \reimp 106 */ 107 function init() 108 { 109 $siteType = $this->chosenSiteType(); 110 if ( isset( $siteType['existing_database'] ) && 111 $siteType['existing_database'] == EZ_SETUP_DB_DATA_KEEP ) // Keep existing data in database, no need to reset admin user. 112 { 113 return true; 114 } 115 116 if ( $this->hasKickstartData() ) 117 { 118 $data = $this->kickstartData(); 119 120 $adminUser = array( 'first_name' => 'Administrator', 121 'last_name' => 'User', 122 'email' => false, 123 'password' => false ); 124 125 if ( isset( $data['FirstName'] ) ) 126 $adminUser['first_name'] = $data['FirstName']; 127 if ( isset( $data['LastName'] ) ) 128 $adminUser['last_name'] = $data['LastName']; 129 if ( isset( $data['Email'] ) ) 130 $adminUser['email'] = $data['Email']; 131 if ( isset( $data['Password'] ) ) 132 $adminUser['password'] = $data['Password']; 133 134 $this->PersistenceList['admin'] = $adminUser; 135 return $this->kickstartContinueNextStep(); 136 } 137 138 // Set default values for admin user 139 if ( !isset( $this->PersistenceList['admin'] ) ) 140 { 141 $adminUser = array( 'first_name' => 'Administrator', 142 'last_name' => 'User', 143 'email' => false, 144 'password' => false ); 145 $this->PersistenceList['admin'] = $adminUser; 146 } 147 148 return false; 149 } 150 151 /*! 152 \reimp 153 */ 154 function &display() 155 { 156 $this->Tpl->setVariable( 'first_name_missing', 0 ); 157 $this->Tpl->setVariable( 'last_name_missing', 0 ); 158 $this->Tpl->setVariable( 'email_missing', 0 ); 159 $this->Tpl->setVariable( 'email_invalid', 0 ); 160 $this->Tpl->setVariable( 'password_missmatch', 0 ); 161 $this->Tpl->setVariable( 'password_missing', 0 ); 162 163 if ( isset( $this->Error[0] ) ) 164 { 165 switch ( $this->Error[0] ) 166 { 167 case EZ_SETUP_SITE_ADMIN_FIRST_NAME_MISSING: 168 { 169 $this->Tpl->setVariable( 'first_name_missing', 1 ); 170 } break; 171 172 case EZ_SETUP_SITE_ADMIN_LAST_NAME_MISSING: 173 { 174 $this->Tpl->setVariable( 'last_name_missing', 1 ); 175 } break; 176 177 case EZ_SETUP_SITE_ADMIN_EMAIL_MISSING: 178 { 179 $this->Tpl->setVariable( 'email_missing', 1 ); 180 } break; 181 182 case EZ_SETUP_SITE_ADMIN_EMAIL_INVALID: 183 { 184 $this->Tpl->setVariable( 'email_invalid', 1 ); 185 } break; 186 187 case EZ_SETUP_SITE_ADMIN_PASSWORD_MISSMATCH: 188 { 189 $this->Tpl->setVariable( 'password_missmatch', 1 ); 190 } break; 191 192 case EZ_SETUP_SITE_ADMIN_PASSWORD_MISSING: 193 { 194 $this->Tpl->setVariable( 'password_missing', 1 ); 195 } break; 196 } 197 } 198 199 $this->Tpl->setVariable( 'has_errors', count( $this->Error ) > 0 ); 200 201 $adminUser = array( 'first_name' => false, 202 'last_name' => false, 203 'email' => false, 204 'password' => false ); 205 if ( isset( $this->PersistenceList['admin'] ) ) 206 $adminUser = $this->PersistenceList['admin']; 207 208 $this->Tpl->setVariable( 'admin', $adminUser ); 209 210 // Return template and data to be shown 211 $result = array(); 212 // Display template 213 $result['content'] = $this->Tpl->fetch( 'design:setup/init/site_admin.tpl' ); 214 $result['path'] = array( array( 'text' => ezi18n( 'design/standard/setup/init', 215 'Site administrator' ), 216 'url' => false ) ); 217 return $result; 218 } 219 220 var $Error = array(); 221 } 222 223 ?>
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 |