2004-10-20 00:24:10 +02:00
|
|
|
|
<?php
|
2005-01-08 12:40:21 +01:00
|
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
|
|
|
|
|
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
|
2004-02-05 00:11:46 +01:00
|
|
|
|
*
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
*
|
|
|
|
|
|
* $Id$
|
|
|
|
|
|
* $Source$
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
2005-01-08 12:40:21 +01:00
|
|
|
|
|
|
|
|
|
|
/** \file htdocs/install/etape5.php
|
|
|
|
|
|
\brief Page de fin d'installation
|
|
|
|
|
|
\version $Revision$
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2005-02-12 22:25:39 +01:00
|
|
|
|
include_once("./inc.php");
|
|
|
|
|
|
|
2005-02-13 17:47:32 +01:00
|
|
|
|
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:$langcode);
|
2005-02-12 22:25:39 +01:00
|
|
|
|
$langs->defaultlang=$setuplang;
|
2005-02-13 17:47:32 +01:00
|
|
|
|
$langs->load("admin");
|
2005-02-12 22:25:39 +01:00
|
|
|
|
$langs->load("install");
|
|
|
|
|
|
|
2004-02-05 00:24:24 +01:00
|
|
|
|
$success=0;
|
|
|
|
|
|
|
2005-02-12 22:25:39 +01:00
|
|
|
|
if (file_exists($conffile))
|
2004-01-27 15:36:40 +01:00
|
|
|
|
{
|
2005-02-12 22:25:39 +01:00
|
|
|
|
include($conffile);
|
2004-01-27 15:36:40 +01:00
|
|
|
|
}
|
2004-08-25 22:12:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($dolibarr_main_db_type == "mysql")
|
2004-09-09 12:32:18 +02:00
|
|
|
|
require ($dolibarr_main_document_root . "/lib/mysql.lib.php");
|
2004-08-25 22:12:02 +02:00
|
|
|
|
else
|
2004-09-09 12:32:18 +02:00
|
|
|
|
require ($dolibarr_main_document_root . "/lib/pgsql.lib.php");
|
2004-08-25 22:12:02 +02:00
|
|
|
|
|
2004-01-27 15:36:40 +01:00
|
|
|
|
require ($dolibarr_main_document_root . "/conf/conf.class.php");
|
|
|
|
|
|
|
2004-09-04 14:55:30 +02:00
|
|
|
|
if ($_POST["action"] == "set")
|
2004-01-27 15:36:40 +01:00
|
|
|
|
{
|
2004-09-04 14:55:30 +02:00
|
|
|
|
if ($_POST["pass"] <> $_POST["pass_verif"])
|
2004-02-12 17:44:49 +01:00
|
|
|
|
{
|
2005-02-14 22:30:03 +01:00
|
|
|
|
Header("Location: etape4.php?error=1&selectlang=$setuplang");
|
2004-02-12 17:44:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-09-04 14:55:30 +02:00
|
|
|
|
if (strlen(trim($_POST["pass"])) == 0)
|
2004-02-12 17:44:49 +01:00
|
|
|
|
{
|
2005-02-14 22:30:03 +01:00
|
|
|
|
Header("Location: etape4.php?error=2&selectlang=$setuplang");
|
2004-02-12 17:44:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-09-04 14:55:30 +02:00
|
|
|
|
if (strlen(trim($_POST["login"])) == 0)
|
2004-02-12 17:44:49 +01:00
|
|
|
|
{
|
2005-02-14 22:30:03 +01:00
|
|
|
|
Header("Location: etape4.php?error=3&selectlang=$setuplang");
|
2004-02-12 17:44:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-02-13 17:47:32 +01:00
|
|
|
|
pHeader($langs->trans("SetupEnd"),"etape5");
|
2004-01-27 15:36:40 +01:00
|
|
|
|
|
|
|
|
|
|
print '<table cellspacing="0" cellpadding="4" border="1" width="100%">';
|
|
|
|
|
|
$error=0;
|
|
|
|
|
|
|
|
|
|
|
|
$conf = new Conf();
|
|
|
|
|
|
$conf->db->host = $dolibarr_main_db_host;
|
|
|
|
|
|
$conf->db->name = $dolibarr_main_db_name;
|
|
|
|
|
|
$conf->db->user = $dolibarr_main_db_user;
|
|
|
|
|
|
$conf->db->pass = $dolibarr_main_db_pass;
|
|
|
|
|
|
$db = new DoliDb();
|
|
|
|
|
|
$ok = 0;
|
|
|
|
|
|
if ($db->connected == 1)
|
|
|
|
|
|
{
|
2004-01-30 17:00:18 +01:00
|
|
|
|
$sql = "INSERT INTO llx_user(datec,login,pass,admin,name,code) VALUES (now()";
|
2004-09-04 14:55:30 +02:00
|
|
|
|
$sql .= ",'".$_POST["login"]."'";
|
|
|
|
|
|
$sql .= ",'".$_POST["pass"]."'";
|
2004-01-30 17:00:18 +01:00
|
|
|
|
$sql .= ",1,'Administrateur','ADM')";
|
2004-01-27 15:36:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-02-05 00:24:24 +01:00
|
|
|
|
if ($db->query($sql) || $db->errno() == 1062)
|
2004-01-27 15:36:40 +01:00
|
|
|
|
{
|
|
|
|
|
|
$db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'");
|
2005-02-13 17:47:32 +01:00
|
|
|
|
print $langs->trans("AdminLoginCreatedSuccessfuly")."<br>";
|
2004-01-27 15:36:40 +01:00
|
|
|
|
$success = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2004-02-05 00:24:24 +01:00
|
|
|
|
print "Echec de la cr<63>ation du compte administrateur<br>";
|
2004-01-27 15:36:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-02-05 00:24:24 +01:00
|
|
|
|
?>
|
|
|
|
|
|
<br>
|
2004-01-30 17:00:18 +01:00
|
|
|
|
|
2004-10-20 00:24:10 +02:00
|
|
|
|
<?php
|
2005-02-13 17:47:32 +01:00
|
|
|
|
print $langs->trans("SystemIsInstalled")."<br>";
|
|
|
|
|
|
print $langs->trans("YouNeedToPersonalizeSetup")."<br>";
|
2004-06-26 19:40:08 +02:00
|
|
|
|
|
2005-02-13 17:47:32 +01:00
|
|
|
|
print '<br><a href="'.$dolibarr_main_url_root .'/admin/index.php?mainmenu=home&leftmenu=setup">';
|
|
|
|
|
|
print $langs->trans("GoToSetupArea");
|
|
|
|
|
|
print '</a>';
|
2004-02-05 00:24:24 +01:00
|
|
|
|
|
2004-02-12 17:44:49 +01:00
|
|
|
|
pFooter(1);
|
2004-01-27 15:36:40 +01:00
|
|
|
|
?>
|