]>
src.bluestatic.org Git - bugdar.git/blob - includes/functions_datastore.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 // ###################### Start build_languages ######################
23 function build_languages()
27 $languages = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "language");
28 while ($language = $bugsys->db
->fetch_array($languages))
30 $tempstore["$language[languageid]"] = $language;
34 ### replacing the language cache ###
35 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
36 VALUES ('language', '" . $bugsys->escape(serialize($tempstore)) . "')"
39 $bugsys->datastore
['language'] = $tempstore;
42 // ####################### Start build_settings ######################
43 function build_settings()
47 $settings = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "setting");
48 while ($setting = $bugsys->db
->fetch_array($settings))
50 $options["$setting[varname]"] = $setting['value'];
54 ### replacing the setting cache ###
55 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
56 VALUES ('setting', '" . $bugsys->escape(serialize($options)) . "')"
59 $bugsys->datastore
['setting'] = $options;
62 // ###################### Start build_usergroups #####################
63 function build_usergroups()
67 $usergroups = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "usergroup");
68 while ($usergroup = $bugsys->db
->fetch_array($usergroups))
70 $groups["$usergroup[usergroupid]"] = $usergroup;
74 ### replacing usergroup cache ###
75 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
76 VALUES ('usergroup', '" . $bugsys->escape(serialize($groups)) . "')"
79 $bugsys->datastore
['usergroup'] = $groups;
82 // ####################### Start build_statuses ######################
83 function build_statuses()
87 $statuses = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "status ORDER BY displayorder ASC");
88 while ($status = $bugsys->db
->fetch_array($statuses))
90 $tempstore["$status[statusid]"] = $status;
94 ### replacing status cache ###
95 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
96 VALUES ('status', '" . $bugsys->escape(serialize($tempstore)) . "')"
99 $bugsys->datastore
['status'] = $tempstore;
102 // ###################### Start build_severities #####################
103 function build_severities()
107 $severities = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "severity ORDER BY displayorder ASC");
108 while ($severity = $bugsys->db
->fetch_array($severities))
110 $tempstore["$severity[severityid]"] = $severity;
114 ### replacing severity cache ###
115 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
116 VALUES ('severity', '" . $bugsys->escape(serialize($tempstore)) . "')"
119 $bugsys->datastore
['severity'] = $tempstore;
122 // ###################### Start build_priorities #####################
123 function build_priorities()
127 $priorities = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "priority ORDER BY displayorder ASC");
128 while ($priority = $bugsys->db
->fetch_array($priorities))
130 $tempstore["$priority[priorityid]"] = $priority;
134 ### replacing priority cache ###
135 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
136 VALUES ('priority', '" . $bugsys->escape(serialize($tempstore)) . "')"
139 $bugsys->datastore
['priority'] = $tempstore;
142 // ###################### Start build_assignedto #####################
143 function build_assignedto()
147 $users = $bugsys->db
->query("
148 SELECT user.email, user.displayname, user.userid, user.showemail
149 FROM " . TABLE_PREFIX
. "user AS user
150 LEFT JOIN " . TABLE_PREFIX
. "usergroup AS usergroup ON (user.usergroupid = usergroup.usergroupid)
151 WHERE (usergroup.permissions & " . $bugsys->permissions
['canbeassignedto'] . ")"
153 while ($user = $bugsys->db
->fetch_array($users))
155 $devs["$user[userid]"] = $user;
159 ### replacing developer / assign to cache ###
160 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
161 VALUES ('assignto', '" . $bugsys->escape(serialize($devs)) . "')"
164 $bugsys->datastore
['assignto'] = $devs;
167 // ##################### Start build_resolutions #####################
168 function build_resolutions()
172 $resolutions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "resolution ORDER BY displayorder ASC");
173 while ($resolution = $bugsys->db
->fetch_array($resolutions))
175 $tempstore["$resolution[resolutionid]"] = $resolution;
179 ### replacing resolution cache ###
180 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
181 VALUES ('resolution', '" . $bugsys->escape(serialize($tempstore)) . "')"
184 $bugsys->datastore
['resolution'] = $tempstore;
187 // ####################### Start build_versions ######################
188 function build_versions()
192 $versions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "version ORDER BY displayorder ASC");
193 while ($version = $bugsys->db
->fetch_array($versions))
195 $tempstore["$version[versionid]"] = $version;
199 ### replacing version cache ###
200 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
201 VALUES ('version', '" . $bugsys->escape(serialize($tempstore)) . "')"
204 $bugsys->datastore
['version'] = $tempstore;
207 // ####################### Start build_products ######################
208 function build_products()
212 $products = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "product ORDER BY displayorder ASC");
213 while ($product = $bugsys->db
->fetch_array($products))
215 $tempstore["$product[productid]"] = $product;
219 ### replacing product / component cache ###
220 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
221 VALUES ('product', '" . $bugsys->escape(serialize($tempstore)) . "')"
224 $bugsys->datastore
['product'] = $tempstore;
227 // ##################### Start build_permissions #####################
228 function build_permissions()
232 $permissions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "permission ORDER BY usergroupid, productid");
233 while ($permission = $bugsys->db
->fetch_array($permissions))
235 $tempstore["$permission[usergroupid]"]["$permission[productid]"] = $permission['mask'];
239 ### replacing permissions cache ###
240 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
241 VALUES ('permission', '" . $bugsys->escape(serialize($tempstore)) . "')"
244 $bugsys->datastore
['permission'] = $tempstore;
247 // ##################### Start build_auto_actions ####################
248 function build_auto_actions()
252 $autoactions = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "autoaction ORDER BY name ASC");
253 while ($autoaction = $bugsys->db
->fetch_array($autoactions))
255 $actions["$autoaction[actionid]"] = $autoaction;
259 ### replacing auto action cache ###
260 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
261 VALUES ('autoaction', '" . $bugsys->escape(serialize($actions)) . "')"
264 $bugsys->datastore
['autoaction'] = $actions;
267 // ###################### Start build_user_help ######################
268 function build_user_help()
272 // custom field descriptions
273 $descriptions = $bugsys->db
->query("SELECT fieldid, name, description FROM " . TABLE_PREFIX
. "bugfield");
274 while ($field = $bugsys->db
->fetch_array($descriptions))
276 $help["field$field[fieldid]"] = array('title' => $field['name'], 'body' => $field['description']);
279 // standard help texts
280 $texts = $bugsys->db
->query("SELECT * FROM " . TABLE_PREFIX
. "fieldhelp");
281 while ($field = $bugsys->db
->fetch_array($texts))
283 $help["$field[keystring]"] = $field;
287 ### replacing user help cache ###
288 REPLACE INTO " . TABLE_PREFIX
. "datastore (title, data)
289 VALUES ('help', '" . $bugsys->escape(serialize($help)) . "')"
292 $bugsys->datastore
['help'] = $help;
295 /*=====================================================================*\
296 || ###################################################################
299 || ###################################################################
300 \*=====================================================================*/