|
indvdum@0
|
1 |
<?php
|
|
indvdum@0
|
2 |
/**
|
|
indvdum@0
|
3 |
*
|
|
indvdum@0
|
4 |
* @package acp
|
|
indvdum@0
|
5 |
* @version $Id$
|
|
indvdum@0
|
6 |
* @copyright (c) 2005 phpBB Group
|
|
indvdum@0
|
7 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
indvdum@0
|
8 |
*
|
|
indvdum@0
|
9 |
*/
|
|
indvdum@0
|
10 |
|
|
indvdum@0
|
11 |
/**
|
|
indvdum@0
|
12 |
* @ignore
|
|
indvdum@0
|
13 |
*/
|
|
indvdum@0
|
14 |
if (!defined('IN_PHPBB'))
|
|
indvdum@0
|
15 |
{
|
|
indvdum@0
|
16 |
exit;
|
|
indvdum@0
|
17 |
}
|
|
indvdum@0
|
18 |
|
|
indvdum@0
|
19 |
/**
|
|
indvdum@0
|
20 |
* @package acp
|
|
indvdum@0
|
21 |
*/
|
|
indvdum@0
|
22 |
class acp_reasons
|
|
indvdum@0
|
23 |
{
|
|
indvdum@0
|
24 |
var $u_action;
|
|
indvdum@0
|
25 |
|
|
indvdum@0
|
26 |
function main($id, $mode)
|
|
indvdum@0
|
27 |
{
|
|
indvdum@0
|
28 |
global $db, $user, $auth, $template, $cache;
|
|
indvdum@0
|
29 |
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|
indvdum@0
|
30 |
|
|
indvdum@0
|
31 |
$user->add_lang(array('mcp', 'acp/posting'));
|
|
indvdum@0
|
32 |
|
|
indvdum@0
|
33 |
// Set up general vars
|
|
indvdum@0
|
34 |
$action = request_var('action', '');
|
|
indvdum@0
|
35 |
$submit = (isset($_POST['submit'])) ? true : false;
|
|
indvdum@0
|
36 |
$reason_id = request_var('id', 0);
|
|
indvdum@0
|
37 |
|
|
indvdum@0
|
38 |
$this->tpl_name = 'acp_reasons';
|
|
indvdum@0
|
39 |
$this->page_title = 'ACP_REASONS';
|
|
indvdum@0
|
40 |
|
|
indvdum@0
|
41 |
$form_name = 'acp_reason';
|
|
indvdum@0
|
42 |
add_form_key('acp_reason');
|
|
indvdum@0
|
43 |
|
|
indvdum@0
|
44 |
$error = array();
|
|
indvdum@0
|
45 |
|
|
indvdum@0
|
46 |
switch ($action)
|
|
indvdum@0
|
47 |
{
|
|
indvdum@0
|
48 |
case 'add':
|
|
indvdum@0
|
49 |
case 'edit':
|
|
indvdum@0
|
50 |
|
|
indvdum@0
|
51 |
$reason_row = array(
|
|
indvdum@0
|
52 |
'reason_title' => utf8_normalize_nfc(request_var('reason_title', '', true)),
|
|
indvdum@0
|
53 |
'reason_description' => utf8_normalize_nfc(request_var('reason_description', '', true)),
|
|
indvdum@0
|
54 |
);
|
|
indvdum@0
|
55 |
|
|
indvdum@0
|
56 |
if ($submit)
|
|
indvdum@0
|
57 |
{
|
|
indvdum@0
|
58 |
if (!check_form_key($form_name))
|
|
indvdum@0
|
59 |
{
|
|
indvdum@0
|
60 |
$error[] = $user->lang['FORM_INVALID'];
|
|
indvdum@0
|
61 |
}
|
|
indvdum@0
|
62 |
// Reason specified?
|
|
indvdum@0
|
63 |
if (!$reason_row['reason_title'] || !$reason_row['reason_description'])
|
|
indvdum@0
|
64 |
{
|
|
indvdum@0
|
65 |
$error[] = $user->lang['NO_REASON_INFO'];
|
|
indvdum@0
|
66 |
}
|
|
indvdum@0
|
67 |
|
|
indvdum@0
|
68 |
$check_double = ($action == 'add') ? true : false;
|
|
indvdum@0
|
69 |
|
|
indvdum@0
|
70 |
if ($action == 'edit')
|
|
indvdum@0
|
71 |
{
|
|
indvdum@0
|
72 |
$sql = 'SELECT reason_title
|
|
indvdum@0
|
73 |
FROM ' . REPORTS_REASONS_TABLE . "
|
|
indvdum@0
|
74 |
WHERE reason_id = $reason_id";
|
|
indvdum@0
|
75 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
76 |
$row = $db->sql_fetchrow($result);
|
|
indvdum@0
|
77 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
78 |
|
|
indvdum@0
|
79 |
if (strtolower($row['reason_title']) == 'other' || strtolower($reason_row['reason_title']) == 'other')
|
|
indvdum@0
|
80 |
{
|
|
indvdum@0
|
81 |
$reason_row['reason_title'] = 'other';
|
|
indvdum@0
|
82 |
}
|
|
indvdum@0
|
83 |
|
|
indvdum@0
|
84 |
if ($row['reason_title'] != $reason_row['reason_title'])
|
|
indvdum@0
|
85 |
{
|
|
indvdum@0
|
86 |
$check_double = true;
|
|
indvdum@0
|
87 |
}
|
|
indvdum@0
|
88 |
}
|
|
indvdum@0
|
89 |
|
|
indvdum@0
|
90 |
// Check for same reason if adding it...
|
|
indvdum@0
|
91 |
if ($check_double)
|
|
indvdum@0
|
92 |
{
|
|
indvdum@0
|
93 |
$sql = 'SELECT reason_id
|
|
indvdum@0
|
94 |
FROM ' . REPORTS_REASONS_TABLE . "
|
|
indvdum@0
|
95 |
WHERE reason_title = '" . $db->sql_escape($reason_row['reason_title']) . "'";
|
|
indvdum@0
|
96 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
97 |
$row = $db->sql_fetchrow($result);
|
|
indvdum@0
|
98 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
99 |
|
|
indvdum@0
|
100 |
if ($row || ($action == 'add' && strtolower($reason_row['reason_title']) == 'other'))
|
|
indvdum@0
|
101 |
{
|
|
indvdum@0
|
102 |
$error[] = $user->lang['REASON_ALREADY_EXIST'];
|
|
indvdum@0
|
103 |
}
|
|
indvdum@0
|
104 |
}
|
|
indvdum@0
|
105 |
|
|
indvdum@0
|
106 |
if (!sizeof($error))
|
|
indvdum@0
|
107 |
{
|
|
indvdum@0
|
108 |
// New reason?
|
|
indvdum@0
|
109 |
if ($action == 'add')
|
|
indvdum@0
|
110 |
{
|
|
indvdum@0
|
111 |
// Get new order...
|
|
indvdum@0
|
112 |
$sql = 'SELECT MAX(reason_order) as max_reason_order
|
|
indvdum@0
|
113 |
FROM ' . REPORTS_REASONS_TABLE;
|
|
indvdum@0
|
114 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
115 |
$max_order = (int) $db->sql_fetchfield('max_reason_order');
|
|
indvdum@0
|
116 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
117 |
|
|
indvdum@0
|
118 |
$sql_ary = array(
|
|
indvdum@0
|
119 |
'reason_title' => (string) $reason_row['reason_title'],
|
|
indvdum@0
|
120 |
'reason_description' => (string) $reason_row['reason_description'],
|
|
indvdum@0
|
121 |
'reason_order' => $max_order + 1
|
|
indvdum@0
|
122 |
);
|
|
indvdum@0
|
123 |
|
|
indvdum@0
|
124 |
$db->sql_query('INSERT INTO ' . REPORTS_REASONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
|
indvdum@0
|
125 |
|
|
indvdum@0
|
126 |
$log = 'ADDED';
|
|
indvdum@0
|
127 |
}
|
|
indvdum@0
|
128 |
else if ($reason_id)
|
|
indvdum@0
|
129 |
{
|
|
indvdum@0
|
130 |
$sql_ary = array(
|
|
indvdum@0
|
131 |
'reason_title' => (string) $reason_row['reason_title'],
|
|
indvdum@0
|
132 |
'reason_description' => (string) $reason_row['reason_description'],
|
|
indvdum@0
|
133 |
);
|
|
indvdum@0
|
134 |
|
|
indvdum@0
|
135 |
$db->sql_query('UPDATE ' . REPORTS_REASONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
indvdum@0
|
136 |
WHERE reason_id = ' . $reason_id);
|
|
indvdum@0
|
137 |
|
|
indvdum@0
|
138 |
$log = 'UPDATED';
|
|
indvdum@0
|
139 |
}
|
|
indvdum@0
|
140 |
|
|
indvdum@0
|
141 |
add_log('admin', 'LOG_REASON_' . $log, $reason_row['reason_title']);
|
|
indvdum@0
|
142 |
trigger_error($user->lang['REASON_' . $log] . adm_back_link($this->u_action));
|
|
indvdum@0
|
143 |
}
|
|
indvdum@0
|
144 |
}
|
|
indvdum@0
|
145 |
else if ($reason_id)
|
|
indvdum@0
|
146 |
{
|
|
indvdum@0
|
147 |
$sql = 'SELECT *
|
|
indvdum@0
|
148 |
FROM ' . REPORTS_REASONS_TABLE . '
|
|
indvdum@0
|
149 |
WHERE reason_id = ' . $reason_id;
|
|
indvdum@0
|
150 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
151 |
$reason_row = $db->sql_fetchrow($result);
|
|
indvdum@0
|
152 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
153 |
|
|
indvdum@0
|
154 |
if (!$reason_row)
|
|
indvdum@0
|
155 |
{
|
|
indvdum@0
|
156 |
trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
indvdum@0
|
157 |
}
|
|
indvdum@0
|
158 |
}
|
|
indvdum@0
|
159 |
|
|
indvdum@0
|
160 |
$l_title = ($action == 'edit') ? 'EDIT' : 'ADD';
|
|
indvdum@0
|
161 |
|
|
indvdum@0
|
162 |
$translated = false;
|
|
indvdum@0
|
163 |
|
|
indvdum@0
|
164 |
// If the reason is defined within the language file, we will use the localized version, else just use the database entry...
|
|
indvdum@0
|
165 |
if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])]))
|
|
indvdum@0
|
166 |
{
|
|
indvdum@0
|
167 |
$translated = true;
|
|
indvdum@0
|
168 |
}
|
|
indvdum@0
|
169 |
|
|
indvdum@0
|
170 |
$template->assign_vars(array(
|
|
indvdum@0
|
171 |
'L_TITLE' => $user->lang['REASON_' . $l_title],
|
|
indvdum@0
|
172 |
'U_ACTION' => $this->u_action . "&id=$reason_id&action=$action",
|
|
indvdum@0
|
173 |
'U_BACK' => $this->u_action,
|
|
indvdum@0
|
174 |
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
indvdum@0
|
175 |
|
|
indvdum@0
|
176 |
'REASON_TITLE' => $reason_row['reason_title'],
|
|
indvdum@0
|
177 |
'REASON_DESCRIPTION' => $reason_row['reason_description'],
|
|
indvdum@0
|
178 |
|
|
indvdum@0
|
179 |
'TRANSLATED_TITLE' => ($translated) ? $user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])] : '',
|
|
indvdum@0
|
180 |
'TRANSLATED_DESCRIPTION'=> ($translated) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])] : '',
|
|
indvdum@0
|
181 |
|
|
indvdum@0
|
182 |
'S_AVAILABLE_TITLES' => implode(', ', array_map('htmlspecialchars', array_keys($user->lang['report_reasons']['TITLE']))),
|
|
indvdum@0
|
183 |
'S_EDIT_REASON' => true,
|
|
indvdum@0
|
184 |
'S_TRANSLATED' => $translated,
|
|
indvdum@0
|
185 |
'S_ERROR' => (sizeof($error)) ? true : false,
|
|
indvdum@0
|
186 |
)
|
|
indvdum@0
|
187 |
);
|
|
indvdum@0
|
188 |
|
|
indvdum@0
|
189 |
return;
|
|
indvdum@0
|
190 |
break;
|
|
indvdum@0
|
191 |
|
|
indvdum@0
|
192 |
case 'delete':
|
|
indvdum@0
|
193 |
|
|
indvdum@0
|
194 |
$sql = 'SELECT *
|
|
indvdum@0
|
195 |
FROM ' . REPORTS_REASONS_TABLE . '
|
|
indvdum@0
|
196 |
WHERE reason_id = ' . $reason_id;
|
|
indvdum@0
|
197 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
198 |
$reason_row = $db->sql_fetchrow($result);
|
|
indvdum@0
|
199 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
200 |
|
|
indvdum@0
|
201 |
if (!$reason_row)
|
|
indvdum@0
|
202 |
{
|
|
indvdum@0
|
203 |
trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
indvdum@0
|
204 |
}
|
|
indvdum@0
|
205 |
|
|
indvdum@0
|
206 |
if (strtolower($reason_row['reason_title']) == 'other')
|
|
indvdum@0
|
207 |
{
|
|
indvdum@0
|
208 |
trigger_error($user->lang['NO_REMOVE_DEFAULT_REASON'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
indvdum@0
|
209 |
}
|
|
indvdum@0
|
210 |
|
|
indvdum@0
|
211 |
// Let the deletion be confirmed...
|
|
indvdum@0
|
212 |
if (confirm_box(true))
|
|
indvdum@0
|
213 |
{
|
|
indvdum@0
|
214 |
$sql = 'SELECT reason_id
|
|
indvdum@0
|
215 |
FROM ' . REPORTS_REASONS_TABLE . "
|
|
indvdum@0
|
216 |
WHERE LOWER(reason_title) = 'other'";
|
|
indvdum@0
|
217 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
218 |
$other_reason_id = (int) $db->sql_fetchfield('reason_id');
|
|
indvdum@0
|
219 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
220 |
|
|
indvdum@0
|
221 |
switch ($db->sql_layer)
|
|
indvdum@0
|
222 |
{
|
|
indvdum@0
|
223 |
// The ugly one!
|
|
indvdum@0
|
224 |
case 'mysqli':
|
|
indvdum@0
|
225 |
case 'mysql4':
|
|
indvdum@0
|
226 |
case 'mysql':
|
|
indvdum@0
|
227 |
// Change the reports using this reason to 'other'
|
|
indvdum@0
|
228 |
$sql = 'UPDATE ' . REPORTS_TABLE . '
|
|
indvdum@0
|
229 |
SET reason_id = ' . $other_reason_id . ", report_text = CONCAT('" . $db->sql_escape($reason_row['reason_description']) . "\n\n', report_text)
|
|
indvdum@0
|
230 |
WHERE reason_id = $reason_id";
|
|
indvdum@0
|
231 |
break;
|
|
indvdum@0
|
232 |
|
|
indvdum@0
|
233 |
// Standard? What's that?
|
|
indvdum@0
|
234 |
case 'mssql':
|
|
indvdum@0
|
235 |
case 'mssql_odbc':
|
|
indvdum@0
|
236 |
case 'mssqlnative':
|
|
indvdum@0
|
237 |
// Change the reports using this reason to 'other'
|
|
indvdum@0
|
238 |
$sql = "DECLARE @ptrval binary(16)
|
|
indvdum@0
|
239 |
|
|
indvdum@0
|
240 |
SELECT @ptrval = TEXTPTR(report_text)
|
|
indvdum@0
|
241 |
FROM " . REPORTS_TABLE . "
|
|
indvdum@0
|
242 |
WHERE reason_id = " . $reason_id . "
|
|
indvdum@0
|
243 |
|
|
indvdum@0
|
244 |
UPDATETEXT " . REPORTS_TABLE . ".report_text @ptrval 0 0 '" . $db->sql_escape($reason_row['reason_description']) . "\n\n'
|
|
indvdum@0
|
245 |
|
|
indvdum@0
|
246 |
UPDATE " . REPORTS_TABLE . '
|
|
indvdum@0
|
247 |
SET reason_id = ' . $other_reason_id . "
|
|
indvdum@0
|
248 |
WHERE reason_id = $reason_id";
|
|
indvdum@0
|
249 |
break;
|
|
indvdum@0
|
250 |
|
|
indvdum@0
|
251 |
// Teh standard
|
|
indvdum@0
|
252 |
case 'postgres':
|
|
indvdum@0
|
253 |
case 'oracle':
|
|
indvdum@0
|
254 |
case 'firebird':
|
|
indvdum@0
|
255 |
case 'sqlite':
|
|
indvdum@0
|
256 |
// Change the reports using this reason to 'other'
|
|
indvdum@0
|
257 |
$sql = 'UPDATE ' . REPORTS_TABLE . '
|
|
indvdum@0
|
258 |
SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' || report_text
|
|
indvdum@0
|
259 |
WHERE reason_id = $reason_id";
|
|
indvdum@0
|
260 |
break;
|
|
indvdum@0
|
261 |
}
|
|
indvdum@0
|
262 |
$db->sql_query($sql);
|
|
indvdum@0
|
263 |
|
|
indvdum@0
|
264 |
$db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id);
|
|
indvdum@0
|
265 |
|
|
indvdum@0
|
266 |
add_log('admin', 'LOG_REASON_REMOVED', $reason_row['reason_title']);
|
|
indvdum@0
|
267 |
trigger_error($user->lang['REASON_REMOVED'] . adm_back_link($this->u_action));
|
|
indvdum@0
|
268 |
}
|
|
indvdum@0
|
269 |
else
|
|
indvdum@0
|
270 |
{
|
|
indvdum@0
|
271 |
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
|
|
indvdum@0
|
272 |
'i' => $id,
|
|
indvdum@0
|
273 |
'mode' => $mode,
|
|
indvdum@0
|
274 |
'action' => $action,
|
|
indvdum@0
|
275 |
'id' => $reason_id))
|
|
indvdum@0
|
276 |
);
|
|
indvdum@0
|
277 |
}
|
|
indvdum@0
|
278 |
|
|
indvdum@0
|
279 |
break;
|
|
indvdum@0
|
280 |
|
|
indvdum@0
|
281 |
case 'move_up':
|
|
indvdum@0
|
282 |
case 'move_down':
|
|
indvdum@0
|
283 |
|
|
indvdum@0
|
284 |
$order = request_var('order', 0);
|
|
indvdum@0
|
285 |
$order_total = $order * 2 + (($action == 'move_up') ? -1 : 1);
|
|
indvdum@0
|
286 |
|
|
indvdum@0
|
287 |
$sql = 'UPDATE ' . REPORTS_REASONS_TABLE . '
|
|
indvdum@0
|
288 |
SET reason_order = ' . $order_total . ' - reason_order
|
|
indvdum@0
|
289 |
WHERE reason_order IN (' . $order . ', ' . (($action == 'move_up') ? $order - 1 : $order + 1) . ')';
|
|
indvdum@0
|
290 |
$db->sql_query($sql);
|
|
indvdum@0
|
291 |
|
|
indvdum@0
|
292 |
break;
|
|
indvdum@0
|
293 |
}
|
|
indvdum@0
|
294 |
|
|
indvdum@0
|
295 |
// By default, check that order is valid and fix it if necessary
|
|
indvdum@0
|
296 |
$sql = 'SELECT reason_id, reason_order
|
|
indvdum@0
|
297 |
FROM ' . REPORTS_REASONS_TABLE . '
|
|
indvdum@0
|
298 |
ORDER BY reason_order';
|
|
indvdum@0
|
299 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
300 |
|
|
indvdum@0
|
301 |
if ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
302 |
{
|
|
indvdum@0
|
303 |
$order = 0;
|
|
indvdum@0
|
304 |
do
|
|
indvdum@0
|
305 |
{
|
|
indvdum@0
|
306 |
++$order;
|
|
indvdum@0
|
307 |
|
|
indvdum@0
|
308 |
if ($row['reason_order'] != $order)
|
|
indvdum@0
|
309 |
{
|
|
indvdum@0
|
310 |
$sql = 'UPDATE ' . REPORTS_REASONS_TABLE . "
|
|
indvdum@0
|
311 |
SET reason_order = $order
|
|
indvdum@0
|
312 |
WHERE reason_id = {$row['reason_id']}";
|
|
indvdum@0
|
313 |
$db->sql_query($sql);
|
|
indvdum@0
|
314 |
}
|
|
indvdum@0
|
315 |
}
|
|
indvdum@0
|
316 |
while ($row = $db->sql_fetchrow($result));
|
|
indvdum@0
|
317 |
}
|
|
indvdum@0
|
318 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
319 |
|
|
indvdum@0
|
320 |
$template->assign_vars(array(
|
|
indvdum@0
|
321 |
'U_ACTION' => $this->u_action,
|
|
indvdum@0
|
322 |
)
|
|
indvdum@0
|
323 |
);
|
|
indvdum@0
|
324 |
|
|
indvdum@0
|
325 |
// Reason count
|
|
indvdum@0
|
326 |
$sql = 'SELECT reason_id, COUNT(reason_id) AS reason_count
|
|
indvdum@0
|
327 |
FROM ' . REPORTS_TABLE . '
|
|
indvdum@0
|
328 |
GROUP BY reason_id';
|
|
indvdum@0
|
329 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
330 |
|
|
indvdum@0
|
331 |
$reason_count = array();
|
|
indvdum@0
|
332 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
333 |
{
|
|
indvdum@0
|
334 |
$reason_count[$row['reason_id']] = $row['reason_count'];
|
|
indvdum@0
|
335 |
}
|
|
indvdum@0
|
336 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
337 |
|
|
indvdum@0
|
338 |
$sql = 'SELECT *
|
|
indvdum@0
|
339 |
FROM ' . REPORTS_REASONS_TABLE . '
|
|
indvdum@0
|
340 |
ORDER BY reason_order ASC';
|
|
indvdum@0
|
341 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
342 |
|
|
indvdum@0
|
343 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
344 |
{
|
|
indvdum@0
|
345 |
$translated = false;
|
|
indvdum@0
|
346 |
$other_reason = ($row['reason_title'] == 'other') ? true : false;
|
|
indvdum@0
|
347 |
|
|
indvdum@0
|
348 |
// If the reason is defined within the language file, we will use the localized version, else just use the database entry...
|
|
indvdum@0
|
349 |
if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
|
|
indvdum@0
|
350 |
{
|
|
indvdum@0
|
351 |
$row['reason_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])];
|
|
indvdum@0
|
352 |
$row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])];
|
|
indvdum@0
|
353 |
|
|
indvdum@0
|
354 |
$translated = true;
|
|
indvdum@0
|
355 |
}
|
|
indvdum@0
|
356 |
|
|
indvdum@0
|
357 |
$template->assign_block_vars('reasons', array(
|
|
indvdum@0
|
358 |
'REASON_TITLE' => $row['reason_title'],
|
|
indvdum@0
|
359 |
'REASON_DESCRIPTION' => $row['reason_description'],
|
|
indvdum@0
|
360 |
'REASON_COUNT' => (isset($reason_count[$row['reason_id']])) ? $reason_count[$row['reason_id']] : 0,
|
|
indvdum@0
|
361 |
|
|
indvdum@0
|
362 |
'S_TRANSLATED' => $translated,
|
|
indvdum@0
|
363 |
'S_OTHER_REASON' => $other_reason,
|
|
indvdum@0
|
364 |
|
|
indvdum@0
|
365 |
'U_EDIT' => $this->u_action . '&action=edit&id=' . $row['reason_id'],
|
|
indvdum@0
|
366 |
'U_DELETE' => (!$other_reason) ? $this->u_action . '&action=delete&id=' . $row['reason_id'] : '',
|
|
indvdum@0
|
367 |
'U_MOVE_UP' => $this->u_action . '&action=move_up&order=' . $row['reason_order'],
|
|
indvdum@0
|
368 |
'U_MOVE_DOWN' => $this->u_action . '&action=move_down&order=' . $row['reason_order'])
|
|
indvdum@0
|
369 |
);
|
|
indvdum@0
|
370 |
}
|
|
indvdum@0
|
371 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
372 |
}
|
|
indvdum@0
|
373 |
}
|
|
indvdum@0
|
374 |
|
|
indvdum@0
|
375 |
?> |