[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/install/ -> etape5.php (source)

   1  <?php
   2  /* Copyright (C) 2004      Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   * Copyright (C) 2004      Benoit Mortier       <benoit.mortier@opensides.be>
   5   * Copyright (C) 2004      Sebastien DiCintio   <sdicintio@ressource-toi.org>
   6   *
   7   * This program is free software; you can redistribute it and/or modify
   8   * it under the terms of the GNU General Public License as published by
   9   * the Free Software Foundation; either version 2 of the License, or
  10   * (at your option) any later version.
  11   *
  12   * This program is distributed in the hope that it will be useful,
  13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15   * GNU General Public License for more details.
  16   *
  17   * You should have received a copy of the GNU General Public License
  18   * along with this program; if not, write to the Free Software
  19   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20   *
  21   * $Id: etape5.php,v 1.26.2.2 2006/01/27 20:21:02 eldy Exp $
  22   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/install/etape5.php,v $
  23   */
  24  
  25  /**
  26          \file       htdocs/install/etape5.php
  27          \brief      Page de fin d'installation ou de migration
  28          \version    $Revision: 1.26.2.2 $
  29  */
  30  
  31  include_once ("./inc.php");
  32  
  33  $setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:'auto');
  34  $langs->setDefaultLang($setuplang);
  35  
  36  $langs->load("admin");
  37  $langs->load("install");
  38  
  39  $success=0;
  40  
  41  if (file_exists($conffile))
  42  {
  43      include($conffile);
  44      if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_'; 
  45      define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
  46  }
  47  
  48  
  49  if($dolibarr_main_db_type == "mysql")
  50      require_once($dolibarr_main_document_root . "/lib/mysql.lib.php");
  51  else
  52      require_once($dolibarr_main_document_root . "/lib/pgsql.lib.php");
  53  
  54  require_once($dolibarr_main_document_root . "/conf/conf.class.php");
  55  
  56  
  57  if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
  58  {
  59      // If install, check pass and pass_verif used to create admin account
  60      if ($_POST["action"] == "set")
  61      {
  62          if ($_POST["pass"] <> $_POST["pass_verif"])
  63          {
  64              Header("Location: etape4.php?error=1&selectlang=$setuplang");
  65              exit;
  66          }
  67      
  68          if (strlen(trim($_POST["pass"])) == 0)
  69          {
  70              Header("Location: etape4.php?error=2&selectlang=$setuplang");
  71              exit;
  72          }
  73      
  74          if (strlen(trim($_POST["login"])) == 0)
  75          {
  76              Header("Location: etape4.php?error=3&selectlang=$setuplang");
  77              exit;
  78          }
  79      }
  80      
  81      // If upgrade
  82      if ($_POST["action"] == "upgrade")
  83      {
  84  
  85      }
  86  
  87      pHeader($langs->trans("SetupEnd"),"etape5");
  88  
  89      print '<table cellspacing="0" cellpadding="2" width="100%">';
  90      $error=0;
  91  
  92      $conf = new Conf();
  93      $conf->db->type = $dolibarr_main_db_type;
  94      $conf->db->host = $dolibarr_main_db_host;
  95      $conf->db->name = $dolibarr_main_db_name;
  96      $conf->db->user = $dolibarr_main_db_user;
  97      $conf->db->pass = $dolibarr_main_db_pass;
  98  
  99      $db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
 100      $ok = 0;
 101  
 102      // Active module user
 103      $modName='modUser';
 104      $file = $modName . ".class.php";
 105      include_once("../includes/modules/$file");
 106      $objMod = new $modName($db);
 107      $objMod->init();
 108      
 109      // If first install
 110      if ($_POST["action"] == "set")
 111      {
 112          if ($db->connected == 1)
 113          {
 114              $sql = "INSERT INTO llx_user(datec,login,pass,admin,name,code) VALUES (now()";
 115              $sql .= ",'".$_POST["login"]."'";
 116              $sql .= ",'".$_POST["pass"]."'";
 117              $sql .= ",1,'Administrateur','ADM')";
 118          }
 119      
 120          $resql=$db->query($sql);
 121      
 122          if ($resql)
 123          {
 124              print $langs->trans("AdminLoginCreatedSuccessfuly")."<br>";
 125              $success = 1;
 126          }
 127          else
 128          {
 129              if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
 130              {
 131                  print $langs->trans("AdminLoginAlreadyExists",$_POST["login"])."<br>";
 132                  $success = 1;
 133              }
 134              else {
 135                  print $langs->trans("FailedToCreateAdminLogin")."<br>";
 136              }
 137          }
 138      
 139          if ($success)
 140          {
 141              $db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'");
 142          
 143              // Si install non Français, on configure pour fonctionner en mode internationnal
 144  //            if ($langs->defaultlang != "fr_FR")
 145  //            {
 146                  $db->query("UPDATE llx_const set value='eldy_backoffice.php' WHERE name='MAIN_MENU_BARRETOP';");
 147                  $db->query("UPDATE llx_const set value='eldy_backoffice.php' WHERE name='MAIN_MENU_BARRELEFT';");
 148  
 149                  $db->query("UPDATE llx_const set value='eldy_frontoffice.php' WHERE name='MAIN_MENUFRONT_BARRETOP';");
 150                  $db->query("UPDATE llx_const set value='eldy_frontoffice.php' WHERE name='MAIN_MENUFRONT_BARRELEFT';");
 151  //            }
 152  
 153          }
 154      }
 155  
 156      $db->query("UPDATE llx_const set value='".$setuplang."' WHERE name='MAIN_LANG_DEFAULT';");
 157              
 158      print '</table>';
 159  
 160      $db->close();
 161  }
 162  
 163  print "<br>";
 164  
 165  
 166  // If first install
 167  if ($_POST["action"] == "set")
 168  {
 169      // Fin install
 170      print $langs->trans("SystemIsInstalled")."<br>";
 171      print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
 172      
 173      print "<br>";
 174      
 175      print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
 176  }
 177  
 178  // If upgrade
 179  if ($_POST["action"] == "upgrade")
 180  {
 181      // Fin install
 182      print $langs->trans("SystemIsUpgraded")."<br>";
 183      print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
 184      
 185      print "<br>";
 186  }
 187  
 188  
 189  print '<a href="'.$dolibarr_main_url_root .'/admin/index.php?mainmenu=home&leftmenu=setup">';
 190  print $langs->trans("GoToSetupArea");
 191  print '</a>';
 192  
 193  
 194  pFooter(1,$setuplang);
 195  
 196  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics