From 2fc2f521d75b5c0bf88c264739f271e11daeff13 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 16 Oct 2005 06:30:19 +0000 Subject: [PATCH] r559: Most of the installer is now done --- docs/datatools.php | 34 ++++++- install/default_data.php | 194 +++++++++++++++++++++++++++++++++++++++ install/global.php | 10 +- install/install.css | 6 ++ install/install.php | 168 ++++++++++++++++++++++++++++++++- 5 files changed, 406 insertions(+), 6 deletions(-) create mode 100644 install/default_data.php diff --git a/docs/datatools.php b/docs/datatools.php index 24c64b6..9aeb7e1 100644 --- a/docs/datatools.php +++ b/docs/datatools.php @@ -42,7 +42,7 @@ $THELIST = array( Here you can either export or import the standard data tables for BugStrike. These include things such as usergroups, priorities, etc. -

[Export] [Import]

+

[Export] [Import] [View]


@@ -127,4 +127,36 @@ if ($_REQUEST['do'] == 'import') } } +// ################################################################### + +if ($_REQUEST['do'] == 'view') +{ + require_once('./docs/datatools_store.php'); + $DATASTORE = unserialize(stripslashes($DATASTORE)); + + $build = '$data = array('; + + foreach ($THELIST AS $display => $data) + { + $build .= "\n\t'$data[table]' => array("; + foreach ($DATASTORE["$display"] AS $mainarray) + { + $build .= "\n\t\tarray("; + foreach ($mainarray AS $field => $value) + { + $build .= "\n\t\t\t'" . addslashes($field) . "' => '" . addslashes($value) . "',"; + } + $build = substr($build, 0, strlen($build) - 1); + $build .= "\n\t\t),"; + } + $build = substr($build, 0, strlen($build) - 1); + $build .= "\n\t),"; + } + $build = substr($build, 0, strlen($build) - 1); + + $build .= "\n);"; + + echo ''; +} + ?> \ No newline at end of file diff --git a/install/default_data.php b/install/default_data.php new file mode 100644 index 0000000..aa80f92 --- /dev/null +++ b/install/default_data.php @@ -0,0 +1,194 @@ + array( + array( + 'usergroupid' => '1', + 'title' => 'Unregistered/Not Logged In', + 'displaytitle' => 'Guest', + 'opentag' => '', + 'closetag' => '', + 'permissions' => '83' + ), + array( + 'usergroupid' => '2', + 'title' => 'Registered Users', + 'displaytitle' => 'Registered', + 'opentag' => '', + 'closetag' => '', + 'permissions' => '255' + ), + array( + 'usergroupid' => '3', + 'title' => 'Awaiting Email Confirmation', + 'displaytitle' => 'Pending Activation', + 'opentag' => '', + 'closetag' => '', + 'permissions' => '3' + ), + array( + 'usergroupid' => '4', + 'title' => 'Pending Approval', + 'displaytitle' => 'Account Pending', + 'opentag' => '', + 'closetag' => '', + 'permissions' => '3' + ), + array( + 'usergroupid' => '5', + 'title' => 'Developers', + 'displaytitle' => 'Developer', + 'opentag' => '', + 'closetag' => '', + 'permissions' => '15736831' + ), + array( + 'usergroupid' => '6', + 'title' => 'Administrators', + 'displaytitle' => 'Administrator', + 'opentag' => '', + 'closetag' => '', + 'permissions' => '16777215' + ) + ), + 'status' => array( + array( + 'statusid' => '1', + 'status' => 'Unconfirmed', + 'displayorder' => '1', + 'color' => '#D96640' + ), + array( + 'statusid' => '2', + 'status' => 'Verified', + 'displayorder' => '2', + 'color' => '#FFFF40' + ), + array( + 'statusid' => '3', + 'status' => 'Assigned', + 'displayorder' => '3', + 'color' => '#B266D9' + ), + array( + 'statusid' => '4', + 'status' => 'Closed', + 'displayorder' => '4', + 'color' => '#8CD940' + ), + array( + 'statusid' => '5', + 'status' => 'Reopened', + 'displayorder' => '5', + 'color' => '#40D9FF' + ) + ), + 'severity' => array( + array( + 'severityid' => '1', + 'severity' => 'Trivial', + 'displayorder' => '1' + ), + array( + 'severityid' => '2', + 'severity' => 'Minor', + 'displayorder' => '2' + ), + array( + 'severityid' => '3', + 'severity' => 'Moderate', + 'displayorder' => '3' + ), + array( + 'severityid' => '4', + 'severity' => 'Major', + 'displayorder' => '4' + ), + array( + 'severityid' => '5', + 'severity' => 'Critical', + 'displayorder' => '5' + ), + array( + 'severityid' => '6', + 'severity' => 'Enhancement', + 'displayorder' => '6' + ) + ), + 'priority' => array( + array( + 'priorityid' => '1', + 'priority' => 'Normal', + 'displayorder' => '1' + ), + array( + 'priorityid' => '2', + 'priority' => 'Low', + 'displayorder' => '2' + ), + array( + 'priorityid' => '3', + 'priority' => 'High', + 'displayorder' => '3' + ), + array( + 'priorityid' => '4', + 'priority' => 'Address Now', + 'displayorder' => '4' + ), + array( + 'priorityid' => '5', + 'priority' => 'Deferred', + 'displayorder' => '5' + ) + ), + 'resolution' => array( + array( + 'resolutionid' => '1', + 'resolution' => 'Open', + 'displayorder' => '1' + ), + array( + 'resolutionid' => '2', + 'resolution' => 'Fixed', + 'displayorder' => '2' + ), + array( + 'resolutionid' => '3', + 'resolution' => 'Bogus', + 'displayorder' => '3' + ), + array( + 'resolutionid' => '4', + 'resolution' => 'Duplicate', + 'displayorder' => '4' + ), + array( + 'resolutionid' => '5', + 'resolution' => 'Won\'t Fix', + 'displayorder' => '5' + ), + array( + 'resolutionid' => '6', + 'resolution' => 'Works for Me', + 'displayorder' => '6' + ) + ) +); + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ \ No newline at end of file diff --git a/install/global.php b/install/global.php index 83574e6..710d79a 100644 --- a/install/global.php +++ b/install/global.php @@ -89,19 +89,19 @@ function page_start() // ################################################################### // puts the end of the page down -function page_end() +function page_end($next = true) { global $bugsys; - if (defined('STOP_MARK')) + if (defined('STOP_MARK') AND $next) { if ($bugsys->in['mark'] >= STOP_MARK) { - echo 'Go to the Administrative Control Panel'; + echo ''; } else { - echo 'Next Step'; + echo ''; } } @@ -110,6 +110,8 @@ function page_end() '; + + exit; } /*=====================================================================*\ diff --git a/install/install.css b/install/install.css index 7d7cfef..b91fb80 100644 --- a/install/install.css +++ b/install/install.css @@ -25,6 +25,11 @@ h1 color: rgb(66, 137, 155); } +.buttonlink +{ + margin-top: 20px; +} + .buttonlink a { font-weight: bold; @@ -33,6 +38,7 @@ h1 text-decoration: none; color: rgb(37, 37, 37); background-color: rgb(239, 239, 239); + margin-top: 20px; } /*=====================================================================*\ diff --git a/install/install.php b/install/install.php index 744e0fb..0096e0c 100644 --- a/install/install.php +++ b/install/install.php @@ -10,7 +10,7 @@ || ################################################################### || \*=====================================================================*/ -define('STOP_MARK', 2); +define('STOP_MARK', 7); define('ACTIVE_SITE', 'install.php'); require_once('./global.php'); @@ -56,7 +56,173 @@ if ($bugsys->in['mark'] == 1) if ($bugsys->in['mark'] == 2) { +?> +

Loading Default Data

+ +

Default table data for usergroups, statuses, priorities, and other various options are being loaded. This will allow you to use BugStrike with minimal setup.

+ + $records) + { + foreach ($records AS $record) + { + $fields = $values = array(); + foreach ($record AS $field => $value) + { + $fields[] = $field; + $values[] = addslashes($value); + } + + $db->query("INSERT INTO " . TABLE_PREFIX . "$table (" . implode(',', $fields) . ") VALUES ('" . implode("', '", $values) . "')"); + } + + echo 'Populating table ' . $table . '
' . "\n"; + } + + $db->query("INSERT INTO " . TABLE_PREFIX . "product (componentmother, shortname, displayorder, title, description) VALUES (0, 'main', 10, 'Main Product', 'Default product from installer')"); + $db->query("INSERT INTO " . TABLE_PREFIX . "version (productid, version, displayorder) VALUES (1, 'Main Version', 100)"); + + echo 'Inserting default product and version
' . "\n"; +} + +// ################################################################### + +if ($bugsys->in['mark'] == 3) +{ +?> +

Loading Settings

+ +

Default settings are being loaded into the system.

+ + $setting) + { + $db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('" . $varname . "', '" . addslashes($setting[3]) . "')"); + } + + echo 'Settings loaded...'; +} + +// ################################################################### + +if ($bugsys->in['mark'] == 4) +{ +?> +

General Settings

+ +

These three settings are fundamental in setting up your bug tracking system. Please fill them in to proceed with the installation.

+ +
+ + +
Tracker Name:
+
Tracker URL (does not end with a trailing slash!):
+
Webmaster Email:
+ + + +
+ +in['mark'] == 5) +{ +?> +

New Administrator

+ +

Your settings have been saved. Now you must create a new administrative account for yourself. This account will have complete control over the system.

+ +
+ + +
Display Name:
+
Email Address:
+
Password:
+ + +
+ +query("UPDATE " . TABLE_PREFIX . "setting SET value = '" . $bugsys->in['trackertitle'] . "' WHERE varname = 'trackertitle'"); + $db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '" . $bugsys->in['trackerurl'] . "' WHERE varname = 'trackerurl'"); + $db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '" . $bugsys->in['webmasteremail'] . "' WHERE varname = 'webmasteremail'"); + + page_end(false); +} + +// ################################################################### + +if ($bugsys->in['mark'] == 6) +{ +?> +

User Added

+ +

Your new user has been added.

+load('functions'); + + $salt = $funct->rand(15); + + $db->query(" + INSERT INTO " . TABLE_PREFIX . "user + (email, displayname, password, salt, authkey, showemail, showcolours, usergroupid) + VALUES + ('" . $bugsys->in['email'] . "', '" . $bugsys->in['displayname'] . "', + '" . md5(md5($bugsys->in['password']) . md5($salt)) . "', '$salt', + '" . $funct->rand() . "', 1, 1, 6 + )" + ); +} + +// ################################################################### + +if ($bugsys->in['mark'] == 7) +{ +?> +

Cache Data

+ +

In order to make BugStrike the most efficient possible, the system caches the maximum amount of data it can. This reduces the load of your server without compromising usability. Currently the caches are being built.

+\n"; + + build_usergroups(); + echo "Cached usergroups
\n"; + + build_statuses(); + echo "Cached statuses
\n"; + + build_priorities(); + echo "Cached priorities
\n"; + + build_assignedto(); + echo "Cached assignable users/developers
\n"; + + build_resolutions(); + echo "Cached resolutions
\n"; + + build_products(); + echo "Cached products
\n"; + build_versions(); + echo "Cached versions
\n"; } // ################################################################### -- 2.43.5