]>
src.bluestatic.org Git - bugdar.git/blob - includes/functions_datastore.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 // ###################### Start build_languages ######################
14 function build_languages()
18 $languages = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "language");
19 while ($language = $bugsys->db
->fetch_array($languages))
21 $tempstore["$language[languageid]"] = $language;
25 ### replacing the language cache ###
26 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
27 VALUES ('language', '" . $bugsys->escape(serialize($tempstore)) . "')"
30 $bugsys->datastore
['language'] = $tempstore;
33 // ####################### Start build_settings ######################
34 function build_settings()
38 $settings = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "setting");
39 while ($setting = $bugsys->db
->fetch_array($settings))
41 $options["$setting[varname]"] = $setting['value'];
45 ### replacing the setting cache ###
46 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
47 VALUES ('setting', '" . $bugsys->escape(serialize($options)) . "')"
50 $bugsys->datastore
['setting'] = $options;
53 // ###################### Start build_usergroups #####################
54 function build_usergroups()
58 $usergroups = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "usergroup");
59 while ($usergroup = $bugsys->db
->fetch_array($usergroups))
61 $groups["$usergroup[usergroupid]"] = $usergroup;
65 ### replacing usergroup cache ###
66 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
67 VALUES ('usergroup', '" . $bugsys->escape(serialize($groups)) . "')"
70 $bugsys->datastore
['usergroup'] = $groups;
73 // ####################### Start build_statuses ######################
74 function build_statuses()
78 $statuses = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "status ORDER BY displayorder ASC");
79 while ($status = $bugsys->db
->fetch_array($statuses))
81 $tempstore["$status[statusid]"] = $status;
85 ### replacing status cache ###
86 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
87 VALUES ('status', '" . $bugsys->escape(serialize($tempstore)) . "')"
90 $bugsys->datastore
['status'] = $tempstore;
93 // ###################### Start build_severities #####################
94 function build_severities()
98 $severities = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "severity ORDER BY displayorder ASC");
99 while ($severity = $bugsys->db
->fetch_array($severities))
101 $tempstore["$severity[severityid]"] = $severity;
105 ### replacing severity cache ###
106 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
107 VALUES ('severity', '" . $bugsys->escape(serialize($tempstore)) . "')"
110 $bugsys->datastore
['severity'] = $tempstore;
113 // ###################### Start build_priorities #####################
114 function build_priorities()
118 $priorities = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "priority ORDER BY displayorder ASC");
119 while ($priority = $bugsys->db
->fetch_array($priorities))
121 $tempstore["$priority[priorityid]"] = $priority;
125 ### replacing priority cache ###
126 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
127 VALUES ('priority', '" . $bugsys->escape(serialize($tempstore)) . "')"
130 $bugsys->datastore
['priority'] = $tempstore;
133 // ###################### Start build_assignedto #####################
134 function build_assignedto()
138 $users = $bugsys->db
->query("
139 SELECT user.email, user.displayname, user.userid, user.showemail
140 FROM " . TABLE_PREFIX
. "user AS user
141 LEFT JOIN " . TABLE_PREFIX
. "usergroup AS usergroup ON (user.usergroupid = usergroup.usergroupid)
142 WHERE (usergroup.permissions & " . CANBEASSIGNEDTO
. ")"
144 while ($user = $bugsys->db
->fetch_array($users))
146 fetch_user_display_name($user);
147 $devs["$user[userid]"] = $user;
151 ### replacing developer / assign to cache ###
152 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
153 VALUES ('assignto', '" . $bugsys->escape(serialize($devs)) . "')"
156 $bugsys->datastore
['assignto'] = $devs;
159 // ##################### Start build_resolutions #####################
160 function build_resolutions()
164 $resolutions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "resolution ORDER BY displayorder ASC");
165 while ($resolution = $bugsys->db
->fetch_array($resolutions))
167 $tempstore["$resolution[resolutionid]"] = $resolution;
171 ### replacing resolution cache ###
172 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
173 VALUES ('resolution', '" . $bugsys->escape(serialize($tempstore)) . "')"
176 $bugsys->datastore
['resolution'] = $tempstore;
179 // ####################### Start build_versions ######################
180 function build_versions()
184 $versions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "version ORDER BY displayorder ASC");
185 while ($version = $bugsys->db
->fetch_array($versions))
187 $tempstore["$version[versionid]"] = $version;
191 ### replacing version cache ###
192 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
193 VALUES ('version', '" . $bugsys->escape(serialize($tempstore)) . "')"
196 $bugsys->datastore
['version'] = $tempstore;
199 // ####################### Start build_products ######################
200 function build_products()
204 $products = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "product ORDER BY displayorder ASC");
205 while ($product = $bugsys->db
->fetch_array($products))
207 $tempstore["$product[productid]"] = $product;
211 ### replacing product / component cache ###
212 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
213 VALUES ('product', '" . $bugsys->escape(serialize($tempstore)) . "')"
216 $bugsys->datastore
['product'] = $tempstore;
219 // ##################### Start build_templatesets ####################
220 function build_templatesets()
224 $templatesets = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "templateset");
225 while ($templateset = $bugsys->db
->fetch_array($templatesets))
227 $tempstore["$templateset[templatesetid]"] = $templateset;
231 ### replacing the template set cache ###
232 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
233 VALUES ('templateset', '" . $bugsys->escape(serialize($tempstore)) . "')"
236 $bugsys->datastore
['templateset'] = $tempstore;
239 /*=====================================================================*\
240 || ###################################################################
243 || ###################################################################
244 \*=====================================================================*/