]>
src.bluestatic.org Git - bugdar.git/blob - includes/functions_datastore.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Bugdar [#]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 $devs["$user[userid]"] = $user;
150 ### replacing developer / assign to cache ###
151 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
152 VALUES ('assignto', '" . $bugsys->escape(serialize($devs)) . "')"
155 $bugsys->datastore
['assignto'] = $devs;
158 // ##################### Start build_resolutions #####################
159 function build_resolutions()
163 $resolutions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "resolution ORDER BY displayorder ASC");
164 while ($resolution = $bugsys->db
->fetch_array($resolutions))
166 $tempstore["$resolution[resolutionid]"] = $resolution;
170 ### replacing resolution cache ###
171 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
172 VALUES ('resolution', '" . $bugsys->escape(serialize($tempstore)) . "')"
175 $bugsys->datastore
['resolution'] = $tempstore;
178 // ####################### Start build_versions ######################
179 function build_versions()
183 $versions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "version ORDER BY displayorder ASC");
184 while ($version = $bugsys->db
->fetch_array($versions))
186 $tempstore["$version[versionid]"] = $version;
190 ### replacing version cache ###
191 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
192 VALUES ('version', '" . $bugsys->escape(serialize($tempstore)) . "')"
195 $bugsys->datastore
['version'] = $tempstore;
198 // ####################### Start build_products ######################
199 function build_products()
203 $products = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "product ORDER BY displayorder ASC");
204 while ($product = $bugsys->db
->fetch_array($products))
206 $tempstore["$product[productid]"] = $product;
210 ### replacing product / component cache ###
211 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
212 VALUES ('product', '" . $bugsys->escape(serialize($tempstore)) . "')"
215 $bugsys->datastore
['product'] = $tempstore;
218 // ##################### Start build_permissions #####################
219 function build_permissions()
223 $permissions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "permission ORDER BY usergroupid, productid");
224 while ($permission = $bugsys->db
->fetch_array($permissions))
226 $tempstore["$permission[usergroupid]"]["$permission[productid]"] = $permission['mask'];
230 ### replacing permissions cache ###
231 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
232 VALUES ('permission', '" . $bugsys->escape(serialize($tempstore)) . "')"
235 $bugsys->datastore
['permission'] = $tempstore;
238 // ##################### Start build_auto_actions ####################
239 function build_auto_actions()
243 $autoactions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "autoaction ORDER BY name ASC");
244 while ($autoaction = $bugsys->db
->fetch_array($autoactions))
246 $actions["$autoaction[actionid]"] = $autoaction;
250 ### replacing auto action cache ###
251 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
252 VALUES ('autoaction', '" . $bugsys->escape(serialize($actions)) . "')"
255 $bugsys->datastore
['autoaction'] = $actions;
258 // ###################### Start build_user_help ######################
259 function build_user_help()
263 // custom field descriptions
264 $descriptions = $bugsys->db
->query("SELECT fieldid, name, description FROM " . TABLE_PREFIX
. "bugfield");
265 while ($field = $bugsys->db
->fetch_array($descriptions))
267 $help["field$field[fieldid]"] = array('title' => $field['name'], 'body' => $field['description']);
270 // standard help texts
271 $texts = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "fieldhelp");
272 while ($field = $bugsys->db
->fetch_array($texts))
274 $help["$field[keystring]"] = $field;
278 ### replacing user help cache ###
279 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
280 VALUES ('help', '" . $bugsys->escape(serialize($help)) . "')"
283 $bugsys->datastore
['help'] = $help;
286 /*=====================================================================*\
287 || ###################################################################
290 || ###################################################################
291 \*=====================================================================*/