From 26e8aff7bb46fbbbaba367c518afb2a397658bee Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 25 Dec 2004 06:52:23 +0000 Subject: [PATCH] r32: Preparing for template set system. Forgot to add index.php to Alpha 1... OOPS! :D. --- docs/recache.php | 4 +++ includes/functions_datastore.php | 20 +++++++++++ includes/init.php | 29 +++++++++++++++ index.php | 61 ++++++++++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 index.php diff --git a/docs/recache.php b/docs/recache.php index 453f1e1..8d8fbbd 100755 --- a/docs/recache.php +++ b/docs/recache.php @@ -44,6 +44,10 @@ build_products(); echo '

Products cached

'; +build_templatesets(); + +echo '

Template sets cached

'; + // $Id$ ?> \ No newline at end of file diff --git a/includes/functions_datastore.php b/includes/functions_datastore.php index 8238ac0..1cc1210 100755 --- a/includes/functions_datastore.php +++ b/includes/functions_datastore.php @@ -216,6 +216,26 @@ function build_products() $bugsys->datastore['product'] = $tempstore; } +// ##################### Start build_templatesets #################### +function build_templatesets() +{ + global $DB_sql, $bugsys; + + $templatesets = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "templateset"); + while ($templateset = $DB_sql->fetch_array($templatesets)) + { + $tempstore["$templateset[templatesetid]"] = $templateset; + } + + $DB_sql->query(" + ### replacing the template set cache ### + REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) + VALUES ('templateset', '" . addslasheslike(serialize($tempstore)) . "')" + ); + + $bugsys->datastore['templateset'] = $tempstore; +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/includes/init.php b/includes/init.php index 012c889..6e0ee26 100755 --- a/includes/init.php +++ b/includes/init.php @@ -104,6 +104,35 @@ class BugTracker echo "language file (locale/$language[filename]) could not be loaded!"; exit; } + + // get the templateset + if ($this->userinfo['userid']) + { + $templatesetid = $this->userinfo['templatesetid']; + $templateset = $this->datastore['templateset']["$templatesetid"]; + } + if (!$templatesetid) + { + foreach ($this->datastore['templateset'] AS $templateset) + { + if ($templateset['default']) + { + $templatesetid = $templateset['templatesetid']; + $templateset = $this->datastore['templateset']["$templatesetid"]; + } + } + } + + // load the template system + if (file_exists("./templates/$templateset[shortname]/tsinfo.php")) + { + $this->options['ts_includepath'] = "./templates/$templateset[shortname]/"; + } + else + { + echo "template set info (templates/$templateset[shortname]/tsinfo.php) could not be loaded!"; + exit; + } } function fetch_userinfo($userid = -1, $verify_password = false) diff --git a/index.php b/index.php new file mode 100644 index 0000000..7a02bf4 --- /dev/null +++ b/index.php @@ -0,0 +1,61 @@ +query(" + SELECT bug.*, user1.displayname AS firstreport, user2.displayname AS lastpost + FROM " . TABLE_PREFIX . "bug AS bug + LEFT JOIN user AS user1 + ON (bug.userid = user1.userid) + LEFT JOIN user AS user2 + ON (bug.lastpostby = user2.userid) + ORDER BY bug.lastposttime DESC" +); + +echo ''; +echo ''; + + +while ($bug = $DB_sql->fetch_array($bugs)) +{ + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; +} + +echo '
Bug IDTitleReporterProduct/VersionStatus/ResolutionLast Post
$bug[bugid]$bug[summary]$bug[firstreport]" . $bugsys->datastore['product']["$bug[productid]"]['title'] . '/' . $bugsys->datastore['version']["$bug[versionid]"]['version'] . "" . $bugsys->datastore['status']["$bug[status]"]['status'] . '/' . $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'] . "" . datelike('standard', $bug['lastposttime']) . ' by ' . $bug['lastpost'] . "
'; + +echo '[New Report]'; + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file -- 2.43.5