[ 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/ -> firstwebsite.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 = 60; //percentage of wizard done.
  24  
  25  if (empty($_SESSION['step6'])) {
  26      header('Location: firstuser.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  $_PX_config['db_version'] = $_SESSION['db_version'];
  42  
  43  $u = new User(1); //user with "root" id
  44  //$u->set($_SESSION['username']);
  45  //$u->lang = $u->getPref('lang');
  46  $m = new Manager();
  47  $m->setUser($u);
  48  $error = false;
  49  $error_mess = '';
  50  //$m->l10n->loadDomain($_SESSION['lang'], 'install');
  51  
  52  $px_name             = __('New website name');
  53  $s = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '';
  54  $px_website_address  = 'http'.$s.'://'.$_SERVER['SERVER_NAME'].www::getRelativeUrl();
  55  $px_xmedia_name      = 'xmedia';
  56  $px_website_path     = files::real_path(dirname(__FILE__).'/../../');
  57  $px_description      = __('Description of the new website.');
  58  
  59  $show_log = false;
  60  if (!empty($_SESSION['log_new_site']) && !empty($_REQUEST['op'])) {
  61      $show_log = true;
  62      $px_log_new_site = $_SESSION['log_new_site'];
  63      $_px_p = 80;
  64  }
  65  
  66  if (!empty($_POST['s_save'])) {
  67      $px_name             = (!empty($_POST['s_name'])) ? $_POST['s_name'] : $px_name;
  68      $px_website_address  = (!empty($_POST['s_website_address'])) ? $_POST['s_website_address'] : $px_website_address;
  69      $px_xmedia_name      = (!empty($_POST['s_xmedia_name'])) ? $_POST['s_xmedia_name'] : $px_xmedia_name;
  70      $px_website_path     = (!empty($_POST['s_website_path'])) ? $_POST['s_website_path'] : $px_website_path;
  71      $px_description      = (!empty($_POST['s_description'])) ? $_POST['s_description'] : $px_description;
  72      $px_id = '';
  73      $px_log_new_site = '';
  74      $px_sitelang = $_SESSION['manager_lang'];
  75      if (false !== $m->saveSite($px_id, $px_name, $px_description, $px_sitelang, $px_website_address, $px_website_path, $px_xmedia_name, 1, 1, $px_log_new_site, 'default')) {
  76          $msg =  sprintf(__('Site <strong>%s</strong> successfully added.'), $px_name);
  77          $_SESSION['log_new_site'] = $px_log_new_site; //Save the log in the session, the header is to prevent a double "addition".
  78          $_SESSION['step7'] = true;
  79          $_SESSION['s_name'] = $px_name;
  80          $_SESSION['s_website_address'] = $px_website_address;
  81          $_SESSION['s_xmedia_name'] = $px_xmedia_name;
  82          $_SESSION['s_website_path'] = $px_website_path;
  83          $_SESSION['s_description'] = $px_description;
  84          header('Location: firstwebsite.php?op=log&msg='.urlencode($msg));
  85          exit;
  86      } else {
  87          $error = true;
  88          $error_mess = $m->error(true, false);
  89      }
  90  }
  91  include dirname(__FILE__).'/_top.php';
  92  
  93  echo '<h2>'.__('First website creation').'</h2>'."\n\n";
  94  
  95  if (!$show_log) {
  96  
  97  if($error === true) {
  98      echo '<p class="important">'.__('Errors during the installation of the first website. Please check the error messages.').'</p>'."\n\n";
  99      echo "\n\n" . $error_mess . "\n\n";
 100  }
 101  
 102  echo '<p>'.__('Simply provide the necessary information so the system can create the default website for you.').' '.__('Normally you do not have to change anything except the name and the description.').'</p>'."\n";
 103  ?>
 104  
 105  
 106  <form action="firstwebsite.php" method="post" id="formPost">
 107  
 108  <p class="field"><label class="float" for="s_name" style="display:inline"><strong><?php  echo __('Site name:'); ?></strong></label>
 109  <?php echo php_f_textField('s_name', 30, 255, $px_name, '', ''); ?>
 110  </p>
 111  <p class="field"><label class="float" for="s_website_address" style="display:inline"><strong><?php  echo __('Website address:'); ?></strong></label>
 112  <?php echo php_f_textField('s_website_address', 50, 255, $px_website_address, '', ''); ?></p>
 113  <p>
 114  <?php  echo __('For example put <em>https://www.mydomain.com/mysite/</em> or <em>http://www.mydomain.com/</em>. Do not forget the <em>http(s)</em>.'); ?>
 115  </p>
 116  <p class="field"><label class="float" for="s_website_path" style="display:inline"><strong><?php  echo __('Path to the document root of the website:'); ?></strong></label>
 117  <?php echo php_f_textField('s_website_path', 50, 255, $px_website_path, '', ''); ?></p>
 118  <p>
 119  <?php     echo __('Path on the server side. For example <em>/home/login/www</em> or <em>c:/http</em>. The document root is the folder where the <em>index.php</em> will be placed.'); ?>
 120  </p>
 121  
 122  <p class="field"><label class="float" for="s_xmedia_name" style="display:inline"><strong><?php  echo __('Name of the file and image folder:'); ?></strong></label>
 123  <?php echo php_f_textField('s_xmedia_name', 15, 255, $px_xmedia_name, '', ''); ?></p>
 124  <p>
 125  <?php  echo __('For example put <em>xmedia</em> or <em>documents</em>.'); ?>
 126  </p>
 127  
 128  <p>
 129  <label for="s_description"><strong><?php  echo __('Description:'); ?></strong></label>
 130  <?php  echo php_f_textArea('s_description', 60, 4, htmlspecialchars($px_description), '', '');  ?>
 131  </p>
 132  
 133  <p>
 134  <?php echo __('If all the information you provided are valid, the system will copy the required files in the right folders. The complete log of those files will be shown to you. No file already available on the system will be overwritten.'); ?>
 135  </p>
 136  
 137  <p> <input name="s_save" type="submit" class="submit" value="<?php  echo __('Create the website'); ?>"  accesskey="s" />
 138  
 139  <?php
 140  } else { //show the log of the installation
 141  
 142      echo '<p>'.__('Log of the installation:').'</p>'."\n\n";
 143  
 144      echo $px_log_new_site;
 145  
 146      echo '<p>'.__('If you see warnings, check them carefully and look at the online documentation to see the impact. You may need to complete the installation manually.').'</p>'."\n\n";
 147  
 148      echo '<p>'.sprintf(__('In the next step the global configuration will be created. <a href="%s">Next</a>.'), 'configfile.php').'</p>'."\n\n";
 149  }
 150  
 151  include dirname(__FILE__).'/_bottom.php';
 152  ?>


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