[ 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/ -> configfile.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 = 100; //percentage of wizard done.
  24  
  25  if (empty($_SESSION['step7'])) {
  26      header('Location: firstwebsite.php');
  27      exit;
  28  }
  29  
  30  //load the language file
  31  $_PX_config['encoding'] = $_SESSION['manager_encoding'];
  32  $l = new l10n($_SESSION['manager_lang'], 'install');
  33  $l->loadDomain($_SESSION['manager_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['debug'] = true;
  41  
  42  $u = new User(1); //user with "root" id
  43  $m = new Manager();
  44  $m->setUser($u);
  45  $error = false;
  46  $error_mess = '';
  47  
  48  $source_file      = dirname(__FILE__).'/../conf/config.php-dist';
  49  $destination_file = dirname(__FILE__).'/../conf/config.php';
  50  @copy($source_file, $destination_file);
  51  @chmod($destination_file, 0666);
  52  
  53  $cfg = new configfile($destination_file);
  54  $cfg->prefix = "_PX_config['db']";
  55  $cfg->editVar('db_login',     (string) $_PX_config['db']['db_login']);
  56  $cfg->editVar('db_password',  (string) $_PX_config['db']['db_password']);
  57  $cfg->editVar('db_server',    (string) $_PX_config['db']['db_server']);
  58  $cfg->editVar('db_database',  (string) $_PX_config['db']['db_database']);
  59  $cfg->editVar('table_prefix', (string) $_PX_config['db']['table_prefix']);
  60  
  61  $cfg->prefix = '_PX_config';
  62  $cfg->editVar('lang', (string) $_SESSION['manager_lang']);
  63  $cfg->editVar('encoding', (string) $_SESSION['manager_encoding']);
  64  $cfg->editVar('debug', false);
  65  $cfg->editVar('secret_key', (string) Misc::getRandomString());
  66  $cfg->editVar('db_version', (string) $_SESSION['db_version']);
  67  
  68  if (!$cfg->saveFile()) {
  69      $error_mess = __('Error: Impossible to create the configuration file.');
  70      $error = true;
  71  }
  72  
  73  include dirname(__FILE__).'/_top.php';
  74  
  75  echo '<h2>'.__('End of the installation').'</h2>'."\n\n";
  76  
  77  if($error === true) {
  78      echo '<p class="important">'.__('Errors during the creation of the configuration file. Check the online documentation to get the solution!').'</p>'."\n\n";
  79      echo "\n\n" . $error_mess . "\n\n";
  80  } else {
  81      echo '<h3>'.__('Congratulations, PLUME CMS has been installed!').'</h3>'."\n\n";
  82  }
  83  
  84  echo '<p>'.__('The very last step is your work. You just have to create a new article or news into you website.').'</p>'."\n";
  85  echo '<p>'.sprintf(__('You can now access the manager with the login and password you provided before. <a href="%s">Access the manager</a>.'), '../login.php?logout=1').'</p>'."\n";
  86  
  87  include dirname(__FILE__).'/_bottom.php';
  88  ?>


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