From dc8ee15f44169822ba34574780a3b5172d03879c Mon Sep 17 00:00:00 2001 From: "Patrick Allaire, ptre" Date: Wed, 7 Sep 2022 19:23:10 -0400 Subject: [PATCH 1/4] Update in the README --- README.md | 9 ++++++-- app/laravel/crypterMcrypt.php | 42 +++++++++++------------------------ 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 0fefa4faf..e1c3920b4 100755 --- a/README.md +++ b/README.md @@ -47,10 +47,11 @@ If your version is older than september 2018 ## Requirements: - Tested on: Apache, IIS; -- PHP 7.4+; (since 2022/05/05, PHP 7.3 and lower are no longer supported) +- PHP 7.4+, 8.0, 8.1; + - since July 2022: PHP 7.3 and lower are no longer supported + - since Sept 2022: PHP 8.1 tested and approved, 8.2 not tested but should work - MySQL 5+; - PDO Extension for PHP (MySQL); -- MCrypt Extension for PHP : soon MCrypt will be removed from Bugs project; - Javascript Enabled - Bugs also heavily uses Javascript. - PHP rewrite module @@ -64,6 +65,10 @@ Then, push your modifications through a new branch. NEVER push on master. # Changelog - v.1.9 : Calendar for user`s tasks (started on July 2022) + - Sep 2022: install process totaly rebuilt + - Sep 2022: tags shown with the user`s language + - Sep 2022: ready for PHP 8.1 + - Jul 2022: MCrypt Extension for PHP removed from Bugs project --- files are still present ... in case. - v.1.8 : Responsive template. Now matches the window size wherever you use BUG ( tablet, phone, computer ) - built during summer 2019, first release on Sept 29th - includes the very first searching tools which scan all projects and all issues for regular expression diff --git a/app/laravel/crypterMcrypt.php b/app/laravel/crypterMcrypt.php index 18bac81b2..8f7fe24ba 100644 --- a/app/laravel/crypterMcrypt.php +++ b/app/laravel/crypterMcrypt.php @@ -31,8 +31,7 @@ class Crypter { * @param string $value * @return string */ - public static function encrypt($value) - { + public static function encrypt($value) { $iv = mcrypt_create_iv(static::iv_size(), static::randomizer()); $value = static::pad($value); @@ -48,8 +47,7 @@ public static function encrypt($value) * @param string $value * @return string */ - public static function decrypt($value) - { + public static function decrypt($value) { $value = base64_decode($value); // To decrypt the value, we first need to extract the input vector and @@ -74,26 +72,20 @@ public static function decrypt($value) * * @return int */ - public static function randomizer() - { + public static function randomizer() { // There are various sources from which we can get random numbers // but some are more random than others. We'll choose the most // random source we can for this server environment. - if (defined('MCRYPT_DEV_URANDOM')) - { + if (defined('MCRYPT_DEV_URANDOM')) { return MCRYPT_DEV_URANDOM; - } - elseif (defined('MCRYPT_DEV_RANDOM')) - { + } elseif (defined('MCRYPT_DEV_RANDOM')) { return MCRYPT_DEV_RANDOM; } // When using the default random number generator, we'll seed // the generator on each call to ensure the results are as // random as we can possibly get them. - else - { + else { mt_srand(); - return MCRYPT_RAND; } } @@ -103,8 +95,7 @@ public static function randomizer() * * @return int */ - protected static function iv_size() - { + protected static function iv_size() { return mcrypt_get_iv_size(static::$cipher, static::$mode); } @@ -114,10 +105,8 @@ protected static function iv_size() * @param string $value * @return string */ - protected static function pad($value) - { + protected static function pad($value) { $pad = static::$block - (Str::length($value) % static::$block); - return $value .= str_repeat(chr($pad), $pad); } @@ -127,25 +116,21 @@ protected static function pad($value) * @param string $value * @return string */ - protected static function unpad($value) - { + protected static function unpad($value) { $pad = ord($value[($length = Str::length($value)) - 1]); - if ($pad and $pad < static::$block) - { + if ($pad and $pad < static::$block) { // If the correct padding is present on the string, we will remove // it and return the value. Otherwise, we'll throw an exception // as the padding appears to have been changed. - if (preg_match('/'.chr($pad).'{'.$pad.'}$/', $value)) - { + if (preg_match('/'.chr($pad).'{'.$pad.'}$/', $value)) { return substr($value, 0, $length - $pad); } // If the padding characters do not match the expected padding // for the value we'll bomb out with an exception since the // encrypted value seems to have been changed. - else - { + else { throw new \Exception("Decryption error. Padding is invalid."); } } @@ -158,8 +143,7 @@ protected static function unpad($value) * * @return string */ - protected static function key() - { + protected static function key() { return Config::get('application.key'); } From 3c27b68ee33fea364210a41d6cfb2d5e06fe30db Mon Sep 17 00:00:00 2001 From: "Patrick Allaire, ptre" Date: Wed, 7 Sep 2022 19:29:28 -0400 Subject: [PATCH 2/4] Update in the README ... dates --- README.md | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index e1c3920b4..b3973ae71 100755 --- a/README.md +++ b/README.md @@ -70,27 +70,11 @@ Then, push your modifications through a new branch. NEVER push on master. - Sep 2022: ready for PHP 8.1 - Jul 2022: MCrypt Extension for PHP removed from Bugs project --- files are still present ... in case. - v.1.8 : Responsive template. Now matches the window size wherever you use BUG ( tablet, phone, computer ) - - built during summer 2019, first release on Sept 29th - - includes the very first searching tools which scan all projects and all issues for regular expression - - Nov 2019: attach files form the issue creating menu - - Nov 2019: wysiwyg editor problems fixed; it could work on every comment - - Nov 2019: you can move issue from project A to project B if you have access to both projects - - Jan 2021 : no more reference to FlashPlayer (rev 2). - - Feb 2021: One can move ticket from project A to project B and assigns the ticket to a B's member (rev 3). - - Mar 2021: Owner can change the Ticket's status when he comments it (rev 3). - - Mar 2021: Reader can no longer edit ticket, nor watch stats (rev 3). - - Mar 2021: Search field now will search also into comments' content ( not only title or projects' name (rev 3). - - Mar 2021: Comment and close at once - new button added (rev 3). - - Arp 2021: User can follow project / ticket and receive email when something appends (rev 4). - - May 2021: Admin may change some options and edit texts sent when activity occurs in issue or project (rev 5). - - Aug 2021: BUGS can no more work under PHP 7.0; PHP 7.3 is now minimal requirement - - Sep 2021: install process now includes creation of first project and first ticket - - Oct 2021: Admin may manage many more options, even the way BUGS shows error on screen or by email; ready for PHP 8 (rev 6) - - Nov 2021: Project member may ask BUGS to count his worktime spent on specific ticket ( punch in, punch out ) so your company may charge accordingly the client (rev 7) - - Dec 2021: Acitivites report - what every single user have done (rev 7) - - Dec 2021: Dark templates B-> with touch of blue G-> with touche of green R-> with touch of red/orange (rev 7) - - Feb 2022: While install, you'll skip some (apparently) useless steps - - Feb 2022: Ending the install: the new issue you'll create will now show among the « open issues » list + - May 2022: final release released: all is working good + - Apr 2022: backcolor of tickets and projects reacts to your mouse movements + - Apr 2022: entire access to project history + - Mar 2022: lot more informations logged ( tracability of activities as well as bugs) + - Mar 2022: Recover forgotten password - Feb 2022: Default creator_id forced onto new issue - Feb 2022: Connection notice sent to whichever admin who asked it. - Feb 2022: Pop-up when adding or supressing tags on issue does now dispear properly @@ -99,11 +83,27 @@ Then, push your modifications through a new branch. NEVER push on master. - Feb 2022: User's role managed from project window - Feb 2022: User's roles managed in user's window - Feb 2022: The admin may now define a password when he creates a new user - - Mar 2022: lot more informations logged ( tracability of activities as well as bugs) - - Mar 2022: Recover forgotten password - - Apr 2022: backcolor of tickets and projects reacts to your mouse movements - - Apr 2022: entire access to project history - - May 2022: final release released: all is working good + - Feb 2022: Ending the install: the new issue you'll create will now show among the « open issues » list + - Feb 2022: While install, you'll skip some (apparently) useless steps + - Dec 2021: Dark templates B-> with touch of blue G-> with touche of green R-> with touch of red/orange (rev 7) + - Dec 2021: Acitivites report - what every single user have done (rev 7) + - Nov 2021: Project member may ask BUGS to count his worktime spent on specific ticket ( punch in, punch out ) so your company may charge accordingly the client (rev 7) + - Oct 2021: Admin may manage many more options, even the way BUGS shows error on screen or by email; ready for PHP 8 (rev 6) + - Sep 2021: install process now includes creation of first project and first ticket + - Aug 2021: BUGS can no more work under PHP 7.0; PHP 7.3 is now minimal requirement + - May 2021: Admin may change some options and edit texts sent when activity occurs in issue or project (rev 5). + - Arp 2021: User can follow project / ticket and receive email when something appends (rev 4). + - Mar 2021: Comment and close at once - new button added (rev 3). + - Mar 2021: Search field now will search also into comments' content ( not only title or projects' name (rev 3). + - Mar 2021: Reader can no longer edit ticket, nor watch stats (rev 3). + - Mar 2021: Owner can change the Ticket's status when he comments it (rev 3). + - Feb 2021: One can move ticket from project A to project B and assigns the ticket to a B's member (rev 3). + - Jan 2021 : no more reference to FlashPlayer (rev 2). + - Nov 2019: you can move issue from project A to project B if you have access to both projects + - Nov 2019: wysiwyg editor problems fixed; it could work on every comment + - Nov 2019: attach files form the issue creating menu + - includes the very first searching tools which scan all projects and all issues for regular expression + - built during summer 2019, first release on Sept 29th - v.1.7 : July 2019 - reports are now totally integrated to BUGS which produces pdf files - v.1.6 : February 2019 From 674b6c781db8f7ef334dc94c456a07bc69a4ee9d Mon Sep 17 00:00:00 2001 From: "Patrick Allaire, ptre" Date: Thu, 8 Sep 2022 11:25:21 -0400 Subject: [PATCH 3/4] =?UTF-8?q?Corrections=20=C3=A0=20install=20DBB=20et?= =?UTF-8?q?=20login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/application/config/tinyissue.php | 4 +- app/application/views/layouts/login.php | 25 +++--- app/laravel/database.php | 28 ++----- app/laravel/database/connection.php | 22 +++-- install/config-setup.php | 104 ++++++------------------ 5 files changed, 65 insertions(+), 118 deletions(-) diff --git a/app/application/config/tinyissue.php b/app/application/config/tinyissue.php index c444233d7..4d5abd7a2 100644 --- a/app/application/config/tinyissue.php +++ b/app/application/config/tinyissue.php @@ -1,6 +1,6 @@ '05-09-2022', + 'release_date' => '08-09-2022', 'version' => '1.9', - 'release' => '1d' + 'release' => '1e' ); diff --git a/app/application/views/layouts/login.php b/app/application/views/layouts/login.php index cc4173865..83eea013e 100755 --- a/app/application/views/layouts/login.php +++ b/app/application/views/layouts/login.php @@ -7,13 +7,6 @@ include $prefixe."app/application/language/all.php"; $lng = in_array(strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)), array_flip($Language)) ? strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)) : "en"; if (file_exists($prefixe."install/config-setup.php")) { unlink ($prefixe."install/config-setup.php"); } - - //Auto-update the database if conditions are fullfilled - if (isset($_SERVER ["REDIRECT_SCRIPT_URL"]) && isset($_GET["MAJsql"])) { - if (substr($_SERVER ["REDIRECT_SCRIPT_URL"], 0, -5) == substr($_SERVER["PHP_SELF"], 0, -9) && substr($_SERVER ["REDIRECT_SCRIPT_URL"], -5) == 'login' && trim($_GET["MAJsql"]) != '' && substr($_GET["MAJsql"], 0, 7) == 'update_' && substr($_GET["MAJsql"], -4) == '.sql') { - \Administration::AjourStructureBase("login"); - } - } //Vérification de la présence de toutes les tables $files = scandir("../install"); @@ -21,15 +14,25 @@ foreach ($files as $i => $file) { if (is_dir("../install".$file)) { continue; } elseif (substr($file, 0, 10) != 'DB_Schema_') { continue; } - elseif (substr($file, 0, 10) == 'DB_Schema_' && substr($file, -4) == '.php') { + elseif (substr($file, 0, 10) == 'DB_Schema_' && substr($file, -4) == '.php') { $nameTable = substr($file, 10); $ceci = substr($nameTable, 0, -4); - if (!\DB::table($ceci)) { - include "../install".$file; - } + try { + \DB::table($ceci)->select(array("test" => "Patate"))->first(); + } catch (Exception $ex) { + echo 'Il faut créer manuellement la table '.$ceci.'
'; + } unset($ceci, $nameTable); } else { continue; } } + + //Auto-update the database if conditions are fullfilled + if (isset($_SERVER ["REDIRECT_SCRIPT_URL"]) && isset($_GET["MAJsql"])) { + if (substr($_SERVER ["REDIRECT_SCRIPT_URL"], 0, -5) == substr($_SERVER["PHP_SELF"], 0, -9) && substr($_SERVER ["REDIRECT_SCRIPT_URL"], -5) == 'login' && trim($_GET["MAJsql"]) != '' && substr($_GET["MAJsql"], 0, 7) == 'update_' && substr($_GET["MAJsql"], -4) == '.sql') { + \Administration::AjourStructureBase("login"); + } + } + ?> diff --git a/app/laravel/database.php b/app/laravel/database.php index c5e28ac2a..a4bc496ec 100644 --- a/app/laravel/database.php +++ b/app/laravel/database.php @@ -36,8 +36,7 @@ class Database { * @param string $connection * @return Database\Connection */ - public static function connection($connection = null) - { + public static function connection($connection = null) { if (is_null($connection)) $connection = Config::get('database.default'); if ( ! isset(static::$connections[$connection])) @@ -61,8 +60,7 @@ public static function connection($connection = null) * @param array $config * @return PDO */ - protected static function connect($config) - { + protected static function connect($config) { return static::connector($config['driver'])->connect($config); } @@ -72,8 +70,7 @@ protected static function connect($config) * @param string $driver * @return Database\Connectors\Connector */ - protected static function connector($driver) - { + protected static function connector($driver) { if (isset(static::$registrar[$driver])) { $resolver = static::$registrar[$driver]['connector']; @@ -107,8 +104,7 @@ protected static function connector($driver) * @param string $connection * @return Database\Query */ - public static function table($table, $connection = null) - { + public static function table($table, $connection = null) { return static::connection($connection)->table($table); } @@ -120,8 +116,7 @@ public static function table($table, $connection = null) * @param string $value * @return Expression */ - public static function raw($value) - { + public static function raw($value) { return new Expression($value); } @@ -130,8 +125,7 @@ public static function raw($value) * * @return array */ - public static function profile() - { + public static function profile() { return Database\Connection::$queries; } @@ -142,8 +136,7 @@ public static function profile() * * @return string */ - public static function last_query() - { + public static function last_query() { return end(Database\Connection::$queries); } @@ -156,10 +149,8 @@ public static function last_query() * @param Closure $schema * @return void */ - public static function extend($name, Closure $connector, $query = null, $schema = null) - { + public static function extend($name, Closure $connector, $query = null, $schema = null) { if (is_null($query)) $query = '\Laravel\Database\Query\Grammars\Grammar'; - static::$registrar[$name] = compact('connector', 'query', 'schema'); } @@ -174,8 +165,7 @@ public static function extend($name, Closure $connector, $query = null, $schema * $users = DB::table('users')->get(); * */ - public static function __callStatic($method, $parameters) - { + public static function __callStatic($method, $parameters) { return call_user_func_array(array(static::connection(), $method), $parameters); } diff --git a/app/laravel/database/connection.php b/app/laravel/database/connection.php index b4fa21f9f..f9f44191b 100644 --- a/app/laravel/database/connection.php +++ b/app/laravel/database/connection.php @@ -226,18 +226,30 @@ protected function execute($sql, $bindings = array()) { // set the message to include the SQL and query bindings. try { $statement = $this->pdo->prepare($sql); - $start = microtime(true); - $result = $statement->execute($bindings); } // If an exception occurs, we'll pass it into our custom exception // and set the message to include the SQL and query bindings so // debugging is much easier on the developer. catch (\Exception $exception) { - $exception = new Exception($sql, $bindings, $exception); - - throw $exception; + $posi = strpos($exception, "Base table or view not found").'
'; + if ($posi > 0 && substr($sql, 0, 15) == 'SELECT `Patate`') { + $LaTable = substr($sql, 22, strpos($sql, "LIMIT")-24); + include "../install/DB_Schema_".$LaTable.".php"; + echo 'Nous avons créé la table '.$LaTable.'
'; + $statement = $this->pdo->prepare("SELECT * FROM ".$LaTable); + $start = microtime(true); + $result = $statement->execute($bindings); + } elseif (strpos($exception, "Column not found: 1054 Unknown column 'Patate'") > 0) { + $LaTable = substr($sql, 22, strpos($sql, "LIMIT")-24); + $statement = $this->pdo->prepare("SELECT * FROM ".$LaTable); + $start = microtime(true); + $result = $statement->execute($bindings); + } else { + $exception = new Exception($sql, $bindings, $exception); + throw $exception; + } } // Once we have executed the query, we log the SQL, bindings, and diff --git a/install/config-setup.php b/install/config-setup.php index 6db4a564a..9f8b7b483 100644 --- a/install/config-setup.php +++ b/install/config-setup.php @@ -95,87 +95,29 @@ function ChgLng(Lng = 'en') { document.location.href = 'index.php?Lng=' + Lng; } $DB->Requis("INSERT INTO update_history (id,Footprint,Description,DteRelease,DteInstall) VALUES (NULL, 'First install', 'Install DB through from mysql_structure.php file', '2013-01-01','".$LaDate."') "); //Vérification - foreach ($miss as $i => $nameTable) { - $ord = file_get_contents('DB_Schema_'.$nameTable.'.php'); - $creons = ""; - $ajouts = ""; - $creer = false; - $ajout = false; - $champ = array(); - foreach($ord as $ligne) { - if (strpos($ligne, 'create') > 0) { - $creer = true; - $creons = "CREATE TABLE `".substr($ligne, 17, strpos($ligne, "'", 19)-17)."` ("; - $lien = ""; - continue; - } - if ($creer && substr($ligne, 0, 3) == "});") { - $creons .= ' ENGINE=InnoDB DEFAULT CHARSET=utf8;'; - $DB->Requis($creons); - $creer = false; - continue; - } - if ($creer) { - $creons .= $lien; - switch (substr($ligne, 10, strpos($ligne, "(", 5)-10)) { - case 'increments': - $creons .= '`'.substr($ligne, 22, strpos($ligne, "'", 24)-22).'` int(11) unsigned NOT NULL AUTO_INCREMENT'; - break; - case 'string': - $def = trim(substr($ligne, strpos($ligne, 'default') + 9, strpos($ligne, ')', strpos($ligne, 'default')+2)-2)); - $def = ($def == '') ? "''" : $def; - $creons .= '`'. - substr($ligne, 18, - strpos($ligne, "'", 20)-18).'` VARCHAR('.((intval(substr($ligne,strpos($ligne, "'", 20)+1, 6 )) > 0) ? intval(substr($ligne, strpos($ligne, "'", 20)+1, 6 )) : 255).') DEFAULT '.$def .' '; - break; - case 'integer': - $creons .= '`'.substr($ligne, 17, strpos($ligne, "'", 19)-17).' int(11) '.((intval(substr($ligne, strrpos($ligne, 'default'), -2)) > 0) ? 'NOT NULL DEFAULT '.intval(substr($ligne, strrpos($ligne, 'default'), -2)) : 'DEFAULT NULL' ).''; - break; - case 'text': - $creons .= '`'.substr($ligne, 14, strpos($ligne, "'", 16)-14).' text DEFAULT NULL'; - break; - case 'timestamps': - $creons .= ' `created_at` datetime DEFAULT current_timestamp(), '; - $creons .= ' `updated_at` datetime DEFAULT current_timestamp()'; - break; - } - $lien = ", "; - continue; - } - if (substr($ligne, 0, 11) == '\DB::table') { - $ajout = true; - $ajouts = "INSERT INTO `".substr($ligne, 12, strpos($ligne, "'", 14)-12)."` ("; - $lien = ""; - continue; - } - if ($ajout && substr($ligne, 0, 3) == "});") { - $ajouts .= ';'; - $ajout = false; - $DB->Requis($ajouts); - continue; - } - if ($ajout) { - $ligne = substr($ligne, 8, -2); - $ligne = str_replace(">", "", $ligne); - $c = explode(",", $ligne); - if (count($champ) == 0) { - foreach($c as $ind => $val) { - $lign = explode("=", $val); - $entre = ""; - foreach($lign as $chmp) { $ajouts .= $entre.$lign[0]; $entre = ","; } - } - $ajouts = ") VALUES "; - } - foreach($c as $ind => $val) { - $lign = explode("=", $val); - $entre = ""; - $ajouts .= $lien."("; - foreach($lign as $chmp) { $ajouts .= $entre."'".$lign[1]."'"; $entre = ","; } - } - $ajouts .= ")"; - $lien = ", "; - } - } + if (count($miss) > 0) { + $DB->Requis("CREATE TABLE IF NOT EXISTS `sessions` ( + `id` varchar(40) NOT NULL, + `last_activity` int(10) NOT NULL, + `data` text NOT NULL, + PRIMARY KEY (`id`)) + ENGINE=MyISAM DEFAULT CHARSET=utf8; + "); + $DB->Requis("CREATE TABLE IF NOT EXISTS `users` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `role_id` bigint(20) unsigned NOT NULL default '1', + `email` varchar(255) default NULL, + `password` varchar(255) default NULL, + `firstname` varchar(255) default NULL, + `lastname` varchar(255) default NULL, + `language` varchar(5) default 'en', + `preferences` text, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + `deleted` int(1) NOT NULL default '0', + PRIMARY KEY (`id`)) + ENGINE=MyISAM DEFAULT CHARSET=utf8; + "); } ?> From e4320651533da7f808f903975b1439bbd1b9b3c0 Mon Sep 17 00:00:00 2001 From: "Patrick Allaire, ptre" Date: Thu, 8 Sep 2022 14:18:50 -0400 Subject: [PATCH 4/4] Install able to rebuilt the BDD --- app/application/config/tinyissue.php | 2 +- install/config-setup.php | 5 +---- install/index.php | 25 +++++++++++++++++++++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/application/config/tinyissue.php b/app/application/config/tinyissue.php index 4d5abd7a2..447eb7f66 100644 --- a/app/application/config/tinyissue.php +++ b/app/application/config/tinyissue.php @@ -2,5 +2,5 @@ return array( 'release_date' => '08-09-2022', 'version' => '1.9', - 'release' => '1e' + 'release' => '1f' ); diff --git a/install/config-setup.php b/install/config-setup.php index 9f8b7b483..89b9dc470 100644 --- a/install/config-setup.php +++ b/install/config-setup.php @@ -353,14 +353,11 @@ function ChgLng(Lng = 'en') { document.location.href = 'index.php?Lng=' + Lng; } $timezones = timezone_identifiers_list(); echo 'select name="timezone" size="10">' . "\n"; - - foreach($timezones as $timezone) - { + foreach($timezones as $timezone) { echo '' . $timezone . '' . "\n"; } - echo '' . "\n"; ?> diff --git a/install/index.php b/install/index.php index 40107fd9c..cd13dc0bc 100755 --- a/install/index.php +++ b/install/index.php @@ -37,18 +37,39 @@ $install->db = mysqli_connect($config['database']['host'], $config['database']['username'], $config['database']['password'], $config['database']['database']); $database_check = $install->check_connect(); if ($database_check) { + if (!$install->check_tables("users")) { + $install->Requis("CREATE TABLE IF NOT EXISTS `users` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `role_id` bigint(20) unsigned NOT NULL default '1', + `email` varchar(255) default NULL, + `password` varchar(255) default NULL, + `firstname` varchar(255) default NULL, + `lastname` varchar(255) default NULL, + `language` varchar(5) default 'en', + `preferences` text, + `created_at` datetime default NULL, + `updated_at` datetime default NULL, + `deleted` int(1) NOT NULL default '0', + PRIMARY KEY (`id`)) + ENGINE=MyISAM DEFAULT CHARSET=utf8; + "); + } $resuUSER = $install->Requis("SELECT * FROM users"); //Puisque la base de données est déjà installée, procédons à l'ouverture d'une session d'usager. if ($resuUSER) { - if ($install->Combien($resuUSER) == 0 && isset($_POST["first_name"]) && isset($_POST["last_name"]) && isset($_POST["language"]) && isset($_POST["email"]) && isset($_POST["password"])) { + if (isset($_POST["first_name"]) && isset($_POST["last_name"]) && isset($_POST["language"]) && isset($_POST["email"]) && isset($_POST["password"])) { $install->create_adminUser(); - unlink ('config-setup.php'); if (!isset($_SESSION)) { session_start(); } $_SESSION["usr"] = $_POST["email"]; $_SESSION["psw"] = $_POST["password"]; $_SESSION["automatiquement"] = 'oui'; echo ''; + unlink ('config-setup.php'); } else { + if (isset($_SESSION)) { session_start(); } + unset($_POST["first_name"], $_POST["last_name"], $_POST["language"], $_POST["email"], $_POST["password"]); + unset($_SESSION["usr"], $_SESSION["psw"], $_SESSION["automatiquement"]); +// unlink("../config.app.php"); echo ''; die(); }