From c45cb5499ac6327125689fc81f773436e82ea47a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 5 Sep 2011 02:04:31 -0400 Subject: update installer to create more tables --- installer/index.php | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/installer/index.php b/installer/index.php index 5ea418b..a0e9235 100644 --- a/installer/index.php +++ b/installer/index.php @@ -15,7 +15,7 @@ if (!mm_isSqlConfigured($conf_file)) { $t = new Template($BASE); $t->header('Message Manager: Installer'); - + $t->paragraph("First we need to set up the SQL configuration, ". "then we will set up the first user."); @@ -68,12 +68,26 @@ if (!mm_isSqlConfigured($conf_file)) { if ($db) { $table_exists = mm_mysql_table_exists($mysql,$db_prefix.'auth'); if (!$table_exists) { - $query = - 'CREATE TABLE '.$db_prefix."auth (\n". + $query = ''; + $query.='CREATE TABLE '.$db_prefix."auth (\n". " uid INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,\n". " name VARCHAR(255),\n". " hash CHAR(60)\n". - " status INT\n" + " status INT\n". + ");"; + $query.='CREATE TABLE '.$db_prefix."users (\n". + " uid INT UNSIGNED,\n". + " k VARCHAR(255),\n". + " v TEXT\n". + ");"; + $query.='CREATE TABLE '.$db_prefix."conf (\n". + " k VARCHAR(255),\n". + " v VARCHAR(255)\n". + ");"; + $query.='CREATE TABLE '.$db_prefix."plugins (\n". + " plugin VARCHAR(255),\n". + " k VARCHAR(255),\n". + " v VARCHAR(255)\n". ");"; $table = mysql_query($query); if (!$table) { @@ -161,12 +175,13 @@ if (!mm_isSqlConfigured($conf_file)) { //////////////////////////////////////////////////////////////////////// } else { require_once('MessageManager.class.php'); - $m = new MessageManager($conf_file); - $t = $m->template(); + $mm = new MessageManager($conf_file); + $t = $mm->template(); + $db = $mm->database(); $t->header('Message Manager: Installer'); - $user_count = $m->countUsers(); + $user_count = $db->countUsers(); if ($user_count<1) { $t->openTag('form', array('method'=>'post', 'action'=>$uri)); @@ -187,8 +202,8 @@ if (!mm_isSqlConfigured($conf_file)) { $user = $_POST['mm_user']; $password = $_POST['mm_password']; - $uid = $m->addUser($user, $password); - $admin = $m->setStatus($uid, 2); + $uid = $db->addUser($user, $password); + $admin = $db->setStatus($uid, 2); if (!$admin) { $admin_error = mysql_error($mysql); } -- cgit v1.2.3