[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/install/ -> firstuser.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of Plume CMS, a website management application.
   4  # Copyright (C) 2001-2005 Loic d'Anterroches and contributors.
   5  #
   6  # Plume CMS is free software; you can redistribute it and/or modify
   7  # it under the terms of the GNU General Public License as published by
   8  # the Free Software Foundation; either version 2 of the License, or
   9  # (at your option) any later version.
  10  #
  11  # Plume CMS is distributed in the hope that it will be useful,
  12  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  # GNU General Public License for more details.
  15  #
  16  # You should have received a copy of the GNU General Public License
  17  # along with this program; if not, write to the Free Software
  18  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  19  #
  20  # ***** END LICENSE BLOCK *****
  21  require_once dirname(__FILE__).'/prepend.php';
  22  
  23  $_px_p = 50; //percentage of wizard done.
  24  
  25  if (empty($_SESSION['step5'])) {
  26      header('Location: dbinstall.php');
  27      exit;
  28  }
  29  
  30  //load the language file
  31  $_PX_config['encoding'] = $_SESSION['manager_encoding'];
  32  $l = new l10n($_SESSION['lang'], 'install');
  33  $l->l10n($_SESSION['lang']); //load the general lang file
  34  
  35  $_PX_config['db']['db_login']     = $_SESSION['dblogin'];
  36  $_PX_config['db']['db_password']  = $_SESSION['dbpass'];
  37  $_PX_config['db']['db_server']    = $_SESSION['dbserver'];
  38  $_PX_config['db']['db_database']  = $_SESSION['dbname'];
  39  $_PX_config['db']['table_prefix'] = $_SESSION['dbprefix'];
  40  $_PX_config['db_version'] = $_SESSION['db_version'];
  41  $_PX_config['debug'] = true;
  42  
  43  $u = new User(); //empty user
  44  // create a new Manager object and create a new user, the id=1 will be set automatically.
  45  $m = new Manager();
  46  $m->setUser($u);
  47  $error = false;
  48  $error_mess = '';
  49  
  50  $px_username = (!empty($_POST['u_username'])) ? $_POST['u_username'] : '';
  51  $px_realname = (!empty($_POST['u_realname'])) ? $_POST['u_realname'] : '';
  52  $px_email = (!empty($_POST['u_email'])) ? $_POST['u_email'] : '';
  53  $px_pubemail = (!empty($_POST['u_pubemail'])) ? $_POST['u_pubemail'] : '';
  54  $px_password = (!empty($_POST['u_password'])) ? $_POST['u_password'] : '';
  55  
  56  if (!empty($px_username)) {
  57      if ($m->saveUser('', $px_username, $px_password, $px_realname, $px_email, $px_pubemail)) {
  58          $u = new User(1); //just created user
  59          $u->savePref('lang', $_SESSION['manager_lang']);
  60          $_SESSION['username'] = $px_username;
  61          $_SESSION['realname'] = $px_realname;
  62          $_SESSION['email'] = $px_email;
  63          $_SESSION['pubemail'] = $px_pubemail;
  64          $_SESSION['password'] = $px_password;
  65          $_SESSION['step6'] = true;
  66          header('Location: firstwebsite.php');
  67          exit;
  68      } else {
  69          $error = true;
  70          $error_mess = $m->error(true, false);
  71      }
  72  }
  73  include dirname(__FILE__).'/_top.php';
  74  
  75  echo '<h2>'.__('First user creation').'</h2>'."\n\n";
  76  
  77  
  78  if($error === true) {
  79      echo '<p class="important">'.__('Errors during the installation of the first user. Please check the error messages.').'</p>'."\n\n";
  80      echo "\n\n" . $error_mess . "\n\n";
  81  }
  82  ?>
  83  <p><?php echo __('The first user will be the global administrator of the PLUME CMS installation.'); ?></p>
  84  
  85  <form action="firstuser.php" method="post" id="formPost">
  86    <p class="field"><label for="u_username"><strong><?php  echo __('Login:'); ?></strong></label>
  87    <?php echo php_f_textField('u_username', 30, 30, $px_username, '', ''); ?><br />
  88    <?php echo __('The login must contain only letters and digits and no spaces.'); ?></p>
  89  
  90    <p class="field"><label for="u_realname"><strong><?php  echo __('Name:'); ?></strong></label>
  91    <?php echo php_f_textField('u_realname', 30, 50, $px_realname, '', ''); ?></p>
  92  
  93    <p class="field"><label for="u_email"><strong><?php  echo __('Email <span class="small">(not shown)</span>:'); ?></strong></label>
  94    <?php echo php_f_textField('u_email', 30, 50, $px_email, '', ''); ?>
  95    </p>
  96  
  97    <p class="field"><label for="u_pubemail"><?php  echo __('Public email:'); ?></label>
  98    <?php echo php_f_textField('u_pubemail', 30, 50, $px_pubemail, '', ''); ?></p>
  99  
 100    <p class="field"><label for="u_password"><strong><?php  echo __('Password:'); ?></strong></label>
 101    <?php echo php_f_textField('u_password', 30, 50, '', '', ''); ?></p>
 102  
 103  <p>
 104  <input name="next" type="submit" class="submit" value="<?php  echo __('Next'); ?>"  accesskey="n" />
 105  </p>
 106  </form>
 107  
 108  <?php
 109  
 110  include dirname(__FILE__).'/_bottom.php';
 111  
 112  ?>


Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics