[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/setup/steps/ -> ezstep_registration.php (source)

   1  <?php
   2  //
   3  // Definition of eZStepRegistration class
   4  //
   5  // Created on: <13-Aug-2003 11:17:34 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_registration.php
  30  */
  31  include_once ( 'kernel/setup/steps/ezstep_installer.php');
  32  include_once ( "kernel/setup/ezsetuptests.php" );
  33  include_once ( "kernel/common/i18n.php" );
  34  
  35  /*!
  36    \class eZStepRegistration ezstep_registration.php
  37    \brief The class eZStepRegistration does
  38  
  39  */
  40  
  41  class eZStepRegistration extends eZStepInstaller
  42  {
  43      /*!
  44       Constructor
  45      */
  46      function eZStepRegistration( &$tpl, &$http, &$ini, &$persistenceList )
  47      {
  48          $this->eZStepInstaller( $tpl, $http, $ini, $persistenceList,
  49                                  'registration', 'Registration' );
  50      }
  51  
  52      function generateRegistration( &$mailTpl, $comments )
  53      {
  54          $databaseMap = eZSetupDatabaseMap();
  55          $databaseInfo = $this->PersistenceList['database_info'];
  56          $databaseInfo['info'] = $databaseMap[$databaseInfo['type']];
  57          $regionalInfo = $this->PersistenceList['regional_info'];
  58          if ( !isset( $regionalInfo['languages'] ) )
  59              $regionalInfo['languages'] = array();
  60  //        $demoData = $this->PersistenceList['demo_data'];
  61          $emailInfo = $this->PersistenceList['email_info'];
  62  
  63          $siteTemplates = array();
  64          $siteType = $this->chosenSiteType();
  65  
  66  
  67         /* $typeFunctionality = eZSetupFunctionality( $siteType['identifier'] );
  68          $additionalPackages = array();
  69          if ( isset( $this->PersistenceList['additional_packages'] ) )
  70              $additionalPackages = $this->PersistenceList['additional_packages'];
  71          $extraFunctionality = array_merge( $additionalPackages,
  72                                             $typeFunctionality['required'] );
  73          $extraFunctionality = array_unique( $extraFunctionality );*/
  74          $url = $siteType['url'];
  75          if ( !preg_match( "#^[a-zA-Z0-9]+://(.*)$#", $url ) )
  76          {
  77              $url = 'http://' . $url;
  78          }
  79          $currentURL = $url;
  80          $adminURL = $url;
  81          if ( $siteType['access_type'] == 'url' )
  82          {
  83              $url .= '/' . $siteType['access_type_value'];
  84              $adminURL .= '/' . $siteType['admin_access_type_value'];
  85          }
  86          else if ( $siteType['access_type'] == 'hostname' )
  87          {
  88              $url = eZHTTPTool::createRedirectURL( 'http://' . $siteType['access_type_value'] );
  89              $adminURL = eZHTTPTool::createRedirectURL( 'http://' . $siteType['admin_access_type_value'] );
  90          }
  91          else if ( $siteType['access_type'] == 'port' )
  92          {
  93              $url = eZHTTPTool::createRedirectURL( $currentURL, array( 'override_port' => $siteType['access_type_value'] ) );
  94              $adminURL = eZHTTPTool::createRedirectURL( $currentURL, array( 'override_port' => $siteType['admin_access_type_value'] ) );
  95          }
  96          $siteType['url'] = $url;
  97          $siteType['admin_url'] = $adminURL;
  98          //$siteType['extra_functionality'] = $extraFunctionality;
  99  
 100  
 101          $testsRun = $this->PersistenceList['tests_run'];
 102          $imageMagickProgram = $this->PersistenceList['imagemagick_program'];
 103          $imageGDExtension = $this->PersistenceList['imagegd_extension'];
 104          $phpVersion = $this->PersistenceList['phpversion'];
 105          $webserverInfo = false;
 106          if ( function_exists( 'apache_get_version' ) )
 107          {
 108              $webserverInfo = array( 'version' => apache_get_version() );
 109          }
 110          include_once ( 'lib/ezutils/classes/ezsysinfo.php' );
 111          $systemInfo = new eZSysInfo();
 112          $systemInfo->scan();
 113  
 114          $optionalTests = eZSetupOptionalTests();
 115          $testTable = eZSetupTestTable();
 116  
 117          $arguments = array();
 118          $runResult = eZSetupRunTests( $optionalTests, $arguments, 'eZSetup:init:send_registration', $this->PersistenceList );
 119          $testResults = $runResult['results'];
 120          $testResult = $runResult['result'];
 121          $successCount = $runResult['success_count'];
 122          $persistenceData = $runResult['persistence_list'];
 123  
 124          // Send e-mail
 125  
 126          $mailTpl->setVariable( 'comments', $comments );
 127          $mailTpl->setVariable( 'database_info', $databaseInfo );
 128          $mailTpl->setVariable( 'regional_info', $regionalInfo );
 129  //        $mailTpl->setVariable( 'demo_data', $demoData );
 130          $mailTpl->setVariable( 'email_info', $emailInfo );
 131          $mailTpl->setVariable( 'site_type', $siteType );
 132          $mailTpl->setVariable( 'tests_run', $testsRun );
 133          $mailTpl->setVariable( 'imagemagick_program', $imageMagickProgram );
 134          $mailTpl->setVariable( 'imagegd_extension', $imageGDExtension );
 135          $mailTpl->setVariable( 'phpversion', $phpVersion );
 136          $mailTpl->setVariable( 'webserver', $webserverInfo );
 137          $mailTpl->setVariable( 'system', $systemInfo );
 138          $mailTpl->setVariable( 'os', array( 'name' => php_uname() ) );
 139          $mailTpl->setVariable( 'optional_tests', $testResults );
 140          include_once ( 'lib/version.php' );
 141          $mailTpl->setVariable( "version", array( "text" => eZPublishSDK::version(),
 142                                                   "major" => eZPublishSDK::majorVersion(),
 143                                                   "minor" => eZPublishSDK::minorVersion(),
 144                                                   "release" => eZPublishSDK::release() ) );
 145  
 146          return $mailTpl->fetch( 'design:setup/registration_email.tpl' );
 147      }
 148  
 149      /*!
 150       \reimp
 151      */
 152      function processPostData()
 153      {
 154          if ( !$this->Http->hasPostVariable( 'eZSetupSendRegistration' ) )// skip site registration
 155          {
 156              return true;
 157          }
 158  
 159          include_once ( 'kernel/common/template.php' );
 160          $mailTpl =& templateInit( 'email' );
 161          $comments = false;
 162          if ( $this->Http->hasPostVariable( 'eZSetupRegistrationComment' ) )
 163          {
 164              $comments = $this->Http->postVariable( 'eZSetupRegistrationComment' );
 165          }
 166          $bodyText = $this->generateRegistration( $mailTpl, $comments );
 167          $subject =& $mailTpl->variable( 'subject' );
 168  
 169          // Fill in E-Mail data and send it
 170          include_once ( 'lib/ezutils/classes/ezmail.php' );
 171          include_once ( 'lib/ezutils/classes/ezmailtransport.php' );
 172          $mail = new eZMail();
 173          $mail->setReceiver( 'registerezsite@ez.no', 'eZ Site Registration' );
 174          $mail->setSender( 'registerezsite@ez.no' );
 175          $mail->setSubject( $subject );
 176          $mail->setBody( $bodyText );
 177          $mailResult = eZMailTransport::send( $mail );
 178  
 179          $this->PersistenceList['email_info']['send'] = true;
 180          $this->PersistenceList['email_info']['result'] = $mailResult;
 181  
 182          return true; // Always continue
 183      }
 184  
 185      /*!
 186       \reimp
 187       */
 188      function init()
 189      {
 190          if ( $this->hasKickstartData() )
 191          {
 192              $data = $this->kickstartData();
 193  
 194              $this->PersistenceList['email_info']['send']     =   isset( $data['Send'] ) ? ( $data['Send'] == 'true' ) : true;
 195              $this->PersistenceList['email_info']['comments'] = ( isset( $data['Comments'] ) ) ? $data['Comments'] : false;
 196  
 197              if ( $this->kickstartContinueNextStep() )
 198              {
 199                  if ( $this->PersistenceList['email_info']['send'] )
 200                  {
 201                      include_once ( 'kernel/common/template.php' );
 202                      $mailTpl =& templateInit( 'email' );
 203                      $bodyText = $this->generateRegistration( $mailTpl, $comments );
 204                      $subject =& $mailTpl->variable( 'subject' );
 205  
 206                      // Fill in E-Mail data and send it
 207                      include_once ( 'lib/ezutils/classes/ezmail.php' );
 208                      include_once ( 'lib/ezutils/classes/ezmailtransport.php' );
 209                      $mail = new eZMail();
 210                      $mail->setReceiver( 'registerezsite@ez.no', 'eZ Site Registration' );
 211                      $mail->setSender( 'registerezsite@ez.no' );
 212                      $mail->setSubject( $subject );
 213                      $mail->setBody( $bodyText );
 214                      $mailResult = eZMailTransport::send( $mail );
 215  
 216                      $this->PersistenceList['email_info']['result'] = $mailResult;
 217                  }
 218                  else
 219                  {
 220                      $this->PersistenceList['email_info']['result'] = false;
 221                  }
 222                  return true;
 223              }
 224              else
 225              {
 226                  return false;
 227              }
 228          }
 229  
 230          return false; // Always display registration information
 231      }
 232  
 233      /*!
 234       \reimp
 235      */
 236      function &display()
 237      {
 238          include_once ( 'kernel/common/template.php' );
 239  
 240          $mailTpl  =& templateInit( 'email' );
 241  
 242          $bodyText = $this->generateRegistration( $mailTpl, false );
 243          $send     = ( isset( $this->PersistenceList['email_info']['send'] ) )     ? $this->PersistenceList['email_info']['send'] : true;
 244          $comments = ( isset( $this->PersistenceList['email_info']['comments'] ) ) ? $this->PersistenceList['email_info']['comments'] : false;
 245  
 246          $this->Tpl->setVariable( 'email_body', $bodyText );
 247          $this->Tpl->setVariable( 'send_registration', $send );
 248          $this->Tpl->setVariable( 'email_comments', $comments );
 249          $this->Tpl->setVariable( 'setup_previous_step', 'Registration' );
 250          $this->Tpl->setVariable( 'setup_next_step', 'DatabaseCreate' );
 251  
 252          $result = array();
 253          // Display template
 254          $result['content'] = $this->Tpl->fetch( "design:setup/init/registration.tpl" );
 255          $result['path'] = array( array( 'text' => ezi18n( 'design/standard/setup/init',
 256                                                            'Registration' ),
 257                                          'url' => false ) );
 258          return $result;
 259      }
 260  }
 261  
 262  ?>


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