r63: Updated initial copyright year from 2003 to 2002
[bugdar.git] / includes / functions_datastore.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Renapsus [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2002-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2002 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 // ###################### Start build_languages ######################
14 function build_languages()
15 {
16 global $DB_sql, $bugsys;
17
18 $languages = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "language");
19 while ($language = $DB_sql->fetch_array($languages))
20 {
21 $tempstore["$language[languageid]"] = $language;
22 }
23
24 $DB_sql->query("
25 ### replacing the language cache ###
26 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
27 VALUES ('language', '" . addslasheslike(serialize($tempstore)) . "')"
28 );
29
30 $bugsys->datastore['language'] = $tempstore;
31 }
32
33 // ####################### Start build_settings ######################
34 function build_settings()
35 {
36 global $DB_sql, $bugsys;
37
38 $settings = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "setting");
39 while ($setting = $DB_sql->fetch_array($settings))
40 {
41 $options["$setting[varname]"] = $setting['value'];
42 }
43
44 $DB_sql->query("
45 ### replacing the setting cache ###
46 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
47 VALUES ('setting', '" . addslasheslike(serialize($options)) . "')"
48 );
49
50 $bugsys->datastore['setting'] = $options;
51 }
52
53 // ###################### Start build_usergroups #####################
54 function build_usergroups()
55 {
56 global $DB_sql, $bugsys;
57
58 $usergroups = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "usergroup");
59 while ($usergroup = $DB_sql->fetch_array($usergroups))
60 {
61 $groups["$usergroup[usergroupid]"] = $usergroup;
62 }
63
64 $DB_sql->query("
65 ### replacing usergroup cache ###
66 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
67 VALUES ('usergroup', '" . addslasheslike(serialize($groups)) . "')"
68 );
69
70 $bugsys->datastore['usergroup'] = $groups;
71 }
72
73 // ####################### Start build_statuses ######################
74 function build_statuses()
75 {
76 global $DB_sql, $bugsys;
77
78 $statuses = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "status ORDER BY displayorder ASC");
79 while ($status = $DB_sql->fetch_array($statuses))
80 {
81 $tempstore["$status[statusid]"] = $status;
82 }
83
84 $DB_sql->query("
85 ### replacing status cache ###
86 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
87 VALUES ('status', '" . addslasheslike(serialize($tempstore)) . "')"
88 );
89
90 $bugsys->datastore['status'] = $tempstore;
91 }
92
93 // ###################### Start build_severities #####################
94 function build_severities()
95 {
96 global $DB_sql, $bugsys;
97
98 $severities = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder ASC");
99 while ($severity = $DB_sql->fetch_array($severities))
100 {
101 $tempstore["$severity[severityid]"] = $severity;
102 }
103
104 $DB_sql->query("
105 ### replacing severity cache ###
106 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
107 VALUES ('severity', '" . addslasheslike(serialize($tempstore)) . "')"
108 );
109
110 $bugsys->datastore['severity'] = $tempstore;
111 }
112
113 // ###################### Start build_priorities #####################
114 function build_priorities()
115 {
116 global $DB_sql, $bugsys;
117
118 $priorities = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "priority ORDER BY displayorder ASC");
119 while ($priority = $DB_sql->fetch_array($priorities))
120 {
121 $tempstore["$priority[priorityid]"] = $priority;
122 }
123
124 $DB_sql->query("
125 ### replacing priority cache ###
126 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
127 VALUES ('priority', '" . addslasheslike(serialize($tempstore)) . "')"
128 );
129
130 $bugsys->datastore['priority'] = $tempstore;
131 }
132
133 // ###################### Start build_assignedto #####################
134 function build_assignedto()
135 {
136 global $DB_sql, $bugsys;
137
138 $users = $DB_sql->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 . ")"
143 );
144 while ($user = $DB_sql->fetch_array($users))
145 {
146 fetch_user_display_name($user);
147 $devs["$user[userid]"] = $user;
148 }
149
150 $DB_sql->query("
151 ### replacing developer / assign to cache ###
152 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
153 VALUES ('assignto', '" . addslasheslike(serialize($devs)) . "')"
154 );
155
156 $bugsys->datastore['assignto'] = $devs;
157 }
158
159 // ##################### Start build_resolutions #####################
160 function build_resolutions()
161 {
162 global $DB_sql, $bugsys;
163
164 $resolutions = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "resolution ORDER BY displayorder ASC");
165 while ($resolution = $DB_sql->fetch_array($resolutions))
166 {
167 $tempstore["$resolution[resolutionid]"] = $resolution;
168 }
169
170 $DB_sql->query("
171 ### replacing resolution cache ###
172 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
173 VALUES ('resolution', '" . addslasheslike(serialize($tempstore)) . "')"
174 );
175
176 $bugsys->datastore['resolution'] = $tempstore;
177 }
178
179 // ####################### Start build_versions ######################
180 function build_versions()
181 {
182 global $DB_sql, $bugsys;
183
184 $versions = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "version ORDER BY displayorder ASC");
185 while ($version = $DB_sql->fetch_array($versions))
186 {
187 $tempstore["$version[versionid]"] = $version;
188 }
189
190 $DB_sql->query("
191 ### replacing version cache ###
192 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
193 VALUES ('version', '" . addslasheslike(serialize($tempstore)) . "')"
194 );
195
196 $bugsys->datastore['version'] = $tempstore;
197 }
198
199 // ####################### Start build_products ######################
200 function build_products()
201 {
202 global $DB_sql, $bugsys;
203
204 $products = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "product ORDER BY displayorder ASC");
205 while ($product = $DB_sql->fetch_array($products))
206 {
207 $tempstore["$product[productid]"] = $product;
208 }
209
210 $DB_sql->query("
211 ### replacing product / component cache ###
212 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
213 VALUES ('product', '" . addslasheslike(serialize($tempstore)) . "')"
214 );
215
216 $bugsys->datastore['product'] = $tempstore;
217 }
218
219 // ##################### Start build_templatesets ####################
220 function build_templatesets()
221 {
222 global $DB_sql, $bugsys;
223
224 $templatesets = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "templateset");
225 while ($templateset = $DB_sql->fetch_array($templatesets))
226 {
227 $tempstore["$templateset[templatesetid]"] = $templateset;
228 }
229
230 $DB_sql->query("
231 ### replacing the template set cache ###
232 REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
233 VALUES ('templateset', '" . addslasheslike(serialize($tempstore)) . "')"
234 );
235
236 $bugsys->datastore['templateset'] = $tempstore;
237 }
238
239 /*=====================================================================*\
240 || ###################################################################
241 || # $HeadURL$
242 || # $Id$
243 || ###################################################################
244 \*=====================================================================*/
245 ?>