]> src.bluestatic.org Git - bugdar.git/blob - explain.php
We were hitting an infinite loop with isso_pre_parse_hook
[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 $left = $version['version'];
73 $right = null;
74 eval('$globalversions .= "' . $template->fetch('explain_row') . '";');
75 }
76 }
77
78 foreach ($products AS $product)
79 {
80 $left = $product['title'];
81 $right = $product['description'];
82 $trextra = ' class="altcolor"';
83 eval('$productlist .= "' . $template->fetch('explain_row') . '";');
84
85 if (is_array($components["$product[productid]"]))
86 {
87 foreach ($components["$product[productid]"] AS $component)
88 {
89 $left = '&nbsp; &rsaquo; &nbsp; ' . $component['title'];
90 $right = $component['description'];
91 $trextra = '';
92 eval('$productlist .= "' . $template->fetch('explain_row') . '";');
93 }
94 }
95 }
96
97 eval('$template->flush("' . $template->fetch('explain_product') . '");');
98 }
99
100 // ###################################################################
101
102 if ($_REQUEST['do'] == 'automations')
103 {
104 $fields_fetch = $bugsys->db->query("
105 SELECT bugfield.*, MAX(permission.mask) AS mask
106 FROM " . TABLE_PREFIX . "bugfield AS bugfield
107 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
108 ON (bugfield.fieldid = permission.fieldid)
109 WHERE (permission.mask = 2 OR permission.mask = 1)
110 AND permission.usergroupid IN ({bugdar::$userinfo['usergroupid']}" . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ")
111 GROUP BY (bugfield.fieldid)
112 ");
113 foreach ($fields_fetch as $field)
114 {
115 $fields["$field[fieldid]"] = $field;
116 }
117
118 if (is_array(bugdar::$datastore['automation']))
119 {
120 foreach (bugdar::$datastore['automation'] AS $automation)
121 {
122 $automation['fieldchanges'] = unserialize($automation['fieldchanges']);
123
124 $left = $automation['name'];
125 $right = $automation['description'];
126 $trextra = ' class="listinghead"';
127
128 eval('$automations .= "' . $template->fetch('explain_row') . '";');
129
130 if ($automation['comment'])
131 {
132 $left = T('Add Comment');
133 $right = $automation['comment'];
134 $trextra = ' class="altcolor"';
135
136 eval('$automations .= "' . $template->fetch('explain_row') . '";');
137 }
138
139 $trextra = '';
140
141 if (is_array($automation['fieldchanges']['builtin']))
142 {
143 foreach ($automation['fieldchanges']['builtin'] AS $name => $value)
144 {
145 $left = $name;
146 $right = bugdar::$datastore["$left"]["$value"]["$left"];
147 eval('$automations .= "' . $template->fetch('explain_row') . '";');
148 }
149 }
150
151 if (is_array($automation['fieldchanges']['custom']))
152 {
153 foreach ($automation['fieldchanges']['custom'] AS $id => $value)
154 {
155 if (!$fields["$id"])
156 {
157 continue;
158 }
159
160 $left = $fields["$id"]['name'] . ' ' . sprintf(T('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']);
161 $right = $value;
162 eval('$automations .= "' . $template->fetch('explain_row') . '";');
163 }
164 }
165 }
166 }
167
168 eval('$template->flush("' . $template->fetch('explain_automation') . '");');
169 }
170
171 /*=====================================================================*\
172 || ###################################################################
173 || # $HeadURL$
174 || # $Id$
175 || ###################################################################
176 \*=====================================================================*/
177 ?>