]> src.bluestatic.org Git - bugdar.git/blob - explain.php
Fix the password reset email system
[bugdar.git] / explain.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright ©2002-2007 Blue Static
6 || #
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 2 of the License.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'explain_product',
24 'explain_automation',
25 'explain_row'
26 );
27
28 define('SVN', '$Id$');
29
30 $focus['showreport'] = 'focus';
31
32 require_once('./global.php');
33
34 // ###################################################################
35
36 if (empty($_REQUEST['do']))
37 {
38 $_REQUEST['do'] = 'products';
39 }
40
41 // ###################################################################
42
43 if ($_REQUEST['do'] == 'products')
44 {
45 if (!is_array(bugdar::$datastore['product']))
46 {
47 $message->error(T('There are no products set up.'));
48 }
49
50 foreach (bugdar::$datastore['product'] AS $product)
51 {
52 if ($product['parentid'])
53 {
54 $components["$product[componentmother]"]["$product[productid]"] = $product;
55 }
56 else
57 {
58 $products["$product[productid]"] = $product;
59 }
60 }
61
62 foreach (bugdar::$datastore['version'] AS $version)
63 {
64 $versions["$version[productid]"]["$version[versionid]"] = $version;
65 }
66
67 // global versions
68 if (is_array($versions['0']))
69 {
70 foreach ($versions['0'] as $version)
71 {
72 $tpl = new BSTemplate('explain_row');
73 $tpl->vars = array(
74 'left' => $version['version'],
75 );
76 $globalversions .= $tpl->evaluate()->getTemplate();
77 }
78 }
79
80 foreach ($products as $product)
81 {
82 $tpl = new BSTemplate('explain_row');
83 $tpl->vars = array(
84 'left' => $product['title'],
85 'right' => $product['description'],
86 'trextra' => ' class="altcolor"'
87 );
88 $productlist .= $tpl->evaluate()->getTemplate();
89
90 if (is_array($components["$product[productid]"]))
91 {
92 foreach ($components["$product[productid]"] as $component)
93 {
94 $tpl = new BSTemplate('explain_row');
95 $tpl->vars = array(
96 'left' => '&nbsp; &rsaquo; &nbsp; ' . $component['title'],
97 'right' => $component['description'],
98 );
99 $productlist .= $tpl->evaluate()->getTemplate();
100 }
101 }
102 }
103
104 $tpl = new BSTemplate('explain_product');
105 $tpl->vars = array(
106 'globalversions' => $globalversions,
107 'productlist' => $productlist
108 );
109 $tpl->evaluate()->flush();
110 }
111
112 // ###################################################################
113
114 if ($_REQUEST['do'] == 'automations')
115 {
116 $fields_fetch = $db->query("
117 SELECT bugfield.*, MAX(permission.mask) AS mask
118 FROM " . TABLE_PREFIX . "bugfield AS bugfield
119 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
120 ON (bugfield.fieldid = permission.fieldid)
121 WHERE (permission.mask = 2 OR permission.mask = 1)
122 AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ")
123 GROUP BY (bugfield.fieldid)
124 ");
125 foreach ($fields_fetch as $field)
126 {
127 $fields["$field[fieldid]"] = $field;
128 }
129
130 if (is_array(bugdar::$datastore['automation']))
131 {
132 foreach (bugdar::$datastore['automation'] as $automation)
133 {
134 $automation['fieldchanges'] = unserialize($automation['fieldchanges']);
135
136 $tpl = new BSTemplate('explain_row');
137 $tpl->vars = array(
138 'left' => $automation['name'],
139 'right' => $automation['description'],
140 'trextra' => ' class="listinghead"'
141 );
142 $automations .= $tpl->evaluate()->getTemplate();
143
144 if ($automation['comment'])
145 {
146 $tpl = new BSTemplate('explain_row');
147 $tpl->vars = array(
148 'left' => T('Add Comment'),
149 'right' => $automation['comment'],
150 'trextra' => ' class="altcolor"'
151 );
152 $automations .= $tpl->evaluate()->getTemplate();
153 }
154
155 $trextra = '';
156
157 if (is_array($automation['fieldchanges']['builtin']))
158 {
159 foreach ($automation['fieldchanges']['builtin'] AS $name => $value)
160 {
161 $tpl = new BSTemplate('explain_row');
162 $tpl->vars = array(
163 'left' => $name,
164 'right' => bugdar::$datastore["$name"]["$value"]["$name"],
165 );
166 $automations .= $tpl->evaluate()->getTemplate();
167 }
168 }
169
170 if (is_array($automation['fieldchanges']['custom']))
171 {
172 foreach ($automation['fieldchanges']['custom'] AS $id => $value)
173 {
174 if (!$fields["$id"])
175 {
176 continue;
177 }
178
179 $tpl = new BSTemplate('explain_row');
180 $tpl->vars = array(
181 'left' => $fields["$id"]['name'] . ' ' . sprintf(T('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']),
182 'right' => $value,
183 );
184 $automations .= $tpl->evaluate()->getTemplate();
185 }
186 }
187 }
188 }
189
190 $tpl = new BSTemplate('explain_automation');
191 $tpl->vars = array('automations' => $automations);
192 $tpl->evaluate()->flush();
193 }
194
195 /*=====================================================================*\
196 || ###################################################################
197 || # $HeadURL$
198 || # $Id$
199 || ###################################################################
200 \*=====================================================================*/
201 ?>