@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | * @version 2.1 Beta 4 |
16 | 16 | */ |
17 | 17 | |
18 | -if (!defined('SMF')) |
|
18 | +if (!defined('SMF')) { |
|
19 | 19 | die('No direct access...'); |
20 | +} |
|
20 | 21 | |
21 | 22 | /** |
22 | 23 | * Log an error, if the error logging is enabled. |
@@ -39,10 +40,11 @@ discard block |
||
39 | 40 | $error_call++; |
40 | 41 | |
41 | 42 | // Collect a backtrace |
42 | - if (!isset($db_show_debug) || $db_show_debug === false) |
|
43 | - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
|
44 | - else |
|
45 | - $backtrace = debug_backtrace(); |
|
43 | + if (!isset($db_show_debug) || $db_show_debug === false) { |
|
44 | + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
|
45 | + } else { |
|
46 | + $backtrace = debug_backtrace(); |
|
47 | + } |
|
46 | 48 | |
47 | 49 | // are we in a loop? |
48 | 50 | if($error_call > 2) |
@@ -52,8 +54,9 @@ discard block |
||
52 | 54 | } |
53 | 55 | |
54 | 56 | // Check if error logging is actually on. |
55 | - if (empty($modSettings['enableErrorLogging'])) |
|
56 | - return $error_message; |
|
57 | + if (empty($modSettings['enableErrorLogging'])) { |
|
58 | + return $error_message; |
|
59 | + } |
|
57 | 60 | |
58 | 61 | // Basically, htmlspecialchars it minus &. (for entities!) |
59 | 62 | $error_message = strtr($error_message, array('<' => '<', '>' => '>', '"' => '"')); |
@@ -61,33 +64,39 @@ discard block |
||
61 | 64 | |
62 | 65 | // Add a file and line to the error message? |
63 | 66 | // Don't use the actual txt entries for file and line but instead use %1$s for file and %2$s for line |
64 | - if ($file == null) |
|
65 | - $file = ''; |
|
66 | - else |
|
67 | - // Window style slashes don't play well, lets convert them to the unix style. |
|
67 | + if ($file == null) { |
|
68 | + $file = ''; |
|
69 | + } else { |
|
70 | + // Window style slashes don't play well, lets convert them to the unix style. |
|
68 | 71 | $file = str_replace('\\', '/', $file); |
72 | + } |
|
69 | 73 | |
70 | - if ($line == null) |
|
71 | - $line = 0; |
|
72 | - else |
|
73 | - $line = (int) $line; |
|
74 | + if ($line == null) { |
|
75 | + $line = 0; |
|
76 | + } else { |
|
77 | + $line = (int) $line; |
|
78 | + } |
|
74 | 79 | |
75 | 80 | // Just in case there's no id_member or IP set yet. |
76 | - if (empty($user_info['id'])) |
|
77 | - $user_info['id'] = 0; |
|
78 | - if (empty($user_info['ip'])) |
|
79 | - $user_info['ip'] = ''; |
|
81 | + if (empty($user_info['id'])) { |
|
82 | + $user_info['id'] = 0; |
|
83 | + } |
|
84 | + if (empty($user_info['ip'])) { |
|
85 | + $user_info['ip'] = ''; |
|
86 | + } |
|
80 | 87 | |
81 | 88 | // Find the best query string we can... |
82 | 89 | $query_string = empty($_SERVER['QUERY_STRING']) ? (empty($_SERVER['REQUEST_URL']) ? '' : str_replace($scripturl, '', $_SERVER['REQUEST_URL'])) : $_SERVER['QUERY_STRING']; |
83 | 90 | |
84 | 91 | // Don't log the session hash in the url twice, it's a waste. |
85 | - if (!empty($smcFunc['htmlspecialchars'])) |
|
86 | - $query_string = $smcFunc['htmlspecialchars']((SMF == 'SSI' || SMF == 'BACKGROUND' ? '' : '?') . preg_replace(array('~;sesc=[^&;]+~', '~' . session_name() . '=' . session_id() . '[&;]~'), array(';sesc', ''), $query_string)); |
|
92 | + if (!empty($smcFunc['htmlspecialchars'])) { |
|
93 | + $query_string = $smcFunc['htmlspecialchars']((SMF == 'SSI' || SMF == 'BACKGROUND' ? '' : '?') . preg_replace(array('~;sesc=[^&;]+~', '~' . session_name() . '=' . session_id() . '[&;]~'), array(';sesc', ''), $query_string)); |
|
94 | + } |
|
87 | 95 | |
88 | 96 | // Just so we know what board error messages are from. |
89 | - if (isset($_POST['board']) && !isset($_GET['board'])) |
|
90 | - $query_string .= ($query_string == '' ? 'board=' : ';board=') . $_POST['board']; |
|
97 | + if (isset($_POST['board']) && !isset($_GET['board'])) { |
|
98 | + $query_string .= ($query_string == '' ? 'board=' : ';board=') . $_POST['board']; |
|
99 | + } |
|
91 | 100 | |
92 | 101 | // What types of categories do we have? |
93 | 102 | $known_error_types = array( |
@@ -140,9 +149,9 @@ discard block |
||
140 | 149 | |
141 | 150 | list($context['num_errors']) = $smcFunc['db_fetch_row']($query); |
142 | 151 | $smcFunc['db_free_result']($query); |
152 | + } else { |
|
153 | + $context['num_errors']++; |
|
143 | 154 | } |
144 | - else |
|
145 | - $context['num_errors']++; |
|
146 | 155 | } |
147 | 156 | |
148 | 157 | // reset error call |
@@ -164,12 +173,14 @@ discard block |
||
164 | 173 | global $txt; |
165 | 174 | |
166 | 175 | // Send the appropriate HTTP status header - set this to 0 or false if you don't want to send one at all |
167 | - if (!empty($status)) |
|
168 | - send_http_status($status); |
|
176 | + if (!empty($status)) { |
|
177 | + send_http_status($status); |
|
178 | + } |
|
169 | 179 | |
170 | 180 | // We don't have $txt yet, but that's okay... |
171 | - if (empty($txt)) |
|
172 | - die($error); |
|
181 | + if (empty($txt)) { |
|
182 | + die($error); |
|
183 | + } |
|
173 | 184 | |
174 | 185 | log_error_online($error, false); |
175 | 186 | setup_fatal_error_context($log ? log_error($error, $log) : $error); |
@@ -196,8 +207,9 @@ discard block |
||
196 | 207 | static $fatal_error_called = false; |
197 | 208 | |
198 | 209 | // Send the status header - set this to 0 or false if you don't want to send one at all |
199 | - if (!empty($status)) |
|
200 | - send_http_status($status); |
|
210 | + if (!empty($status)) { |
|
211 | + send_http_status($status); |
|
212 | + } |
|
201 | 213 | |
202 | 214 | // Try to load a theme if we don't have one. |
203 | 215 | if (empty($context['theme_loaded']) && empty($fatal_error_called)) |
@@ -207,8 +219,9 @@ discard block |
||
207 | 219 | } |
208 | 220 | |
209 | 221 | // If we have no theme stuff we can't have the language file... |
210 | - if (empty($context['theme_loaded'])) |
|
211 | - die($error); |
|
222 | + if (empty($context['theme_loaded'])) { |
|
223 | + die($error); |
|
224 | + } |
|
212 | 225 | |
213 | 226 | $reload_lang_file = true; |
214 | 227 | // Log the error in the forum's language, but don't waste the time if we aren't logging |
@@ -244,8 +257,9 @@ discard block |
||
244 | 257 | global $settings, $modSettings, $db_show_debug; |
245 | 258 | |
246 | 259 | // Ignore errors if we're ignoring them or they are strict notices from PHP 5 |
247 | - if (error_reporting() == 0) |
|
248 | - return; |
|
260 | + if (error_reporting() == 0) { |
|
261 | + return; |
|
262 | + } |
|
249 | 263 | |
250 | 264 | if (strpos($file, 'eval()') !== false && !empty($settings['current_include_filename'])) |
251 | 265 | { |
@@ -253,19 +267,22 @@ discard block |
||
253 | 267 | $count = count($array); |
254 | 268 | for ($i = 0; $i < $count; $i++) |
255 | 269 | { |
256 | - if ($array[$i]['function'] != 'loadSubTemplate') |
|
257 | - continue; |
|
270 | + if ($array[$i]['function'] != 'loadSubTemplate') { |
|
271 | + continue; |
|
272 | + } |
|
258 | 273 | |
259 | 274 | // This is a bug in PHP, with eval, it seems! |
260 | - if (empty($array[$i]['args'])) |
|
261 | - $i++; |
|
275 | + if (empty($array[$i]['args'])) { |
|
276 | + $i++; |
|
277 | + } |
|
262 | 278 | break; |
263 | 279 | } |
264 | 280 | |
265 | - if (isset($array[$i]) && !empty($array[$i]['args'])) |
|
266 | - $file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)'; |
|
267 | - else |
|
268 | - $file = realpath($settings['current_include_filename']) . ' (eval?)'; |
|
281 | + if (isset($array[$i]) && !empty($array[$i]['args'])) { |
|
282 | + $file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)'; |
|
283 | + } else { |
|
284 | + $file = realpath($settings['current_include_filename']) . ' (eval?)'; |
|
285 | + } |
|
269 | 286 | } |
270 | 287 | |
271 | 288 | if (isset($db_show_debug) && $db_show_debug === true) |
@@ -274,8 +291,9 @@ discard block |
||
274 | 291 | if ($error_level % 255 != E_ERROR) |
275 | 292 | { |
276 | 293 | $temporary = ob_get_contents(); |
277 | - if (substr($temporary, -2) == '="') |
|
278 | - echo '"'; |
|
294 | + if (substr($temporary, -2) == '="') { |
|
295 | + echo '"'; |
|
296 | + } |
|
279 | 297 | } |
280 | 298 | |
281 | 299 | // Debugging! This should look like a PHP error message. |
@@ -291,23 +309,27 @@ discard block |
||
291 | 309 | call_integration_hook('integrate_output_error', array($message, $error_type, $error_level, $file, $line)); |
292 | 310 | |
293 | 311 | // Dying on these errors only causes MORE problems (blank pages!) |
294 | - if ($file == 'Unknown') |
|
295 | - return; |
|
312 | + if ($file == 'Unknown') { |
|
313 | + return; |
|
314 | + } |
|
296 | 315 | |
297 | 316 | // If this is an E_ERROR or E_USER_ERROR.... die. Violently so. |
298 | - if ($error_level % 255 == E_ERROR) |
|
299 | - obExit(false); |
|
300 | - else |
|
301 | - return; |
|
317 | + if ($error_level % 255 == E_ERROR) { |
|
318 | + obExit(false); |
|
319 | + } else { |
|
320 | + return; |
|
321 | + } |
|
302 | 322 | |
303 | 323 | // If this is an E_ERROR, E_USER_ERROR, E_WARNING, or E_USER_WARNING.... die. Violently so. |
304 | - if ($error_level % 255 == E_ERROR || $error_level % 255 == E_WARNING) |
|
305 | - fatal_error(allowedTo('admin_forum') ? $message : $error_string, false); |
|
324 | + if ($error_level % 255 == E_ERROR || $error_level % 255 == E_WARNING) { |
|
325 | + fatal_error(allowedTo('admin_forum') ? $message : $error_string, false); |
|
326 | + } |
|
306 | 327 | |
307 | 328 | // We should NEVER get to this point. Any fatal error MUST quit, or very bad things can happen. |
308 | - if ($error_level % 255 == E_ERROR) |
|
309 | - die('No direct access...'); |
|
310 | -} |
|
329 | + if ($error_level % 255 == E_ERROR) { |
|
330 | + die('No direct access...'); |
|
331 | + } |
|
332 | + } |
|
311 | 333 | |
312 | 334 | /** |
313 | 335 | * It is called by {@link fatal_error()} and {@link fatal_lang_error()}. |
@@ -323,24 +345,28 @@ discard block |
||
323 | 345 | |
324 | 346 | // Attempt to prevent a recursive loop. |
325 | 347 | ++$level; |
326 | - if ($level > 1) |
|
327 | - return false; |
|
348 | + if ($level > 1) { |
|
349 | + return false; |
|
350 | + } |
|
328 | 351 | |
329 | 352 | // Maybe they came from dlattach or similar? |
330 | - if (SMF != 'SSI' && SMF != 'BACKGROUND' && empty($context['theme_loaded'])) |
|
331 | - loadTheme(); |
|
353 | + if (SMF != 'SSI' && SMF != 'BACKGROUND' && empty($context['theme_loaded'])) { |
|
354 | + loadTheme(); |
|
355 | + } |
|
332 | 356 | |
333 | 357 | // Don't bother indexing errors mate... |
334 | 358 | $context['robot_no_index'] = true; |
335 | 359 | |
336 | - if (!isset($context['error_title'])) |
|
337 | - $context['error_title'] = $txt['error_occured']; |
|
360 | + if (!isset($context['error_title'])) { |
|
361 | + $context['error_title'] = $txt['error_occured']; |
|
362 | + } |
|
338 | 363 | $context['error_message'] = isset($context['error_message']) ? $context['error_message'] : $error_message; |
339 | 364 | |
340 | 365 | $context['error_code'] = isset($error_code) ? 'id="' . $error_code . '" ' : ''; |
341 | 366 | |
342 | - if (empty($context['page_title'])) |
|
343 | - $context['page_title'] = $context['error_title']; |
|
367 | + if (empty($context['page_title'])) { |
|
368 | + $context['page_title'] = $context['error_title']; |
|
369 | + } |
|
344 | 370 | |
345 | 371 | loadTemplate('Errors'); |
346 | 372 | $context['sub_template'] = 'fatal_error'; |
@@ -348,23 +374,26 @@ discard block |
||
348 | 374 | // If this is SSI, what do they want us to do? |
349 | 375 | if (SMF == 'SSI') |
350 | 376 | { |
351 | - if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method)) |
|
352 | - $ssi_on_error_method(); |
|
353 | - elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true) |
|
354 | - loadSubTemplate('fatal_error'); |
|
377 | + if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method)) { |
|
378 | + $ssi_on_error_method(); |
|
379 | + } elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true) { |
|
380 | + loadSubTemplate('fatal_error'); |
|
381 | + } |
|
355 | 382 | |
356 | 383 | // No layers? |
357 | - if (empty($ssi_on_error_method) || $ssi_on_error_method !== true) |
|
358 | - exit; |
|
384 | + if (empty($ssi_on_error_method) || $ssi_on_error_method !== true) { |
|
385 | + exit; |
|
386 | + } |
|
359 | 387 | } |
360 | 388 | // Alternatively from the cron call? |
361 | 389 | elseif (SMF == 'BACKGROUND') |
362 | 390 | { |
363 | 391 | // We can't rely on even having language files available. |
364 | - if (defined('FROM_CLI') && FROM_CLI) |
|
365 | - echo 'cron error: ', $context['error_message']; |
|
366 | - else |
|
367 | - echo 'An error occurred. More information may be available in your logs.'; |
|
392 | + if (defined('FROM_CLI') && FROM_CLI) { |
|
393 | + echo 'cron error: ', $context['error_message']; |
|
394 | + } else { |
|
395 | + echo 'An error occurred. More information may be available in your logs.'; |
|
396 | + } |
|
368 | 397 | exit; |
369 | 398 | } |
370 | 399 | |
@@ -392,8 +421,8 @@ discard block |
||
392 | 421 | |
393 | 422 | set_fatal_error_headers(); |
394 | 423 | |
395 | - if (!empty($maintenance)) |
|
396 | - echo '<!DOCTYPE html> |
|
424 | + if (!empty($maintenance)) { |
|
425 | + echo '<!DOCTYPE html> |
|
397 | 426 | <html> |
398 | 427 | <head> |
399 | 428 | <meta name="robots" content="noindex"> |
@@ -404,6 +433,7 @@ discard block |
||
404 | 433 | ', $mmessage, ' |
405 | 434 | </body> |
406 | 435 | </html>'; |
436 | + } |
|
407 | 437 | |
408 | 438 | die(); |
409 | 439 | } |
@@ -425,15 +455,17 @@ discard block |
||
425 | 455 | // For our purposes, we're gonna want this on if at all possible. |
426 | 456 | $modSettings['cache_enable'] = '1'; |
427 | 457 | |
428 | - if (($temp = cache_get_data('db_last_error', 600)) !== null) |
|
429 | - $db_last_error = max($db_last_error, $temp); |
|
458 | + if (($temp = cache_get_data('db_last_error', 600)) !== null) { |
|
459 | + $db_last_error = max($db_last_error, $temp); |
|
460 | + } |
|
430 | 461 | |
431 | 462 | if ($db_last_error < time() - 3600 * 24 * 3 && empty($maintenance) && !empty($db_error_send)) |
432 | 463 | { |
433 | 464 | // Avoid writing to the Settings.php file if at all possible; use shared memory instead. |
434 | 465 | cache_put_data('db_last_error', time(), 600); |
435 | - if (($temp = cache_get_data('db_last_error', 600)) === null) |
|
436 | - logLastDatabaseError(); |
|
466 | + if (($temp = cache_get_data('db_last_error', 600)) === null) { |
|
467 | + logLastDatabaseError(); |
|
468 | + } |
|
437 | 469 | |
438 | 470 | // Language files aren't loaded yet :(. |
439 | 471 | $db_error = @$smcFunc['db_error']($db_connection); |
@@ -490,8 +522,9 @@ discard block |
||
490 | 522 | */ |
491 | 523 | function set_fatal_error_headers() |
492 | 524 | { |
493 | - if (headers_sent()) |
|
494 | - return; |
|
525 | + if (headers_sent()) { |
|
526 | + return; |
|
527 | + } |
|
495 | 528 | |
496 | 529 | // Don't cache this page! |
497 | 530 | header('expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
@@ -517,12 +550,14 @@ discard block |
||
517 | 550 | global $smcFunc, $user_info, $modSettings; |
518 | 551 | |
519 | 552 | // Don't bother if Who's Online is disabled. |
520 | - if (empty($modSettings['who_enabled'])) |
|
521 | - return; |
|
553 | + if (empty($modSettings['who_enabled'])) { |
|
554 | + return; |
|
555 | + } |
|
522 | 556 | |
523 | 557 | // Maybe they came from SSI or similar where sessions are not recorded? |
524 | - if (SMF == 'SSI' || SMF == 'BACKGROUND') |
|
525 | - return; |
|
558 | + if (SMF == 'SSI' || SMF == 'BACKGROUND') { |
|
559 | + return; |
|
560 | + } |
|
526 | 561 | |
527 | 562 | $session_id = !empty($user_info['is_guest']) ? 'ip' . $user_info['ip'] : session_id(); |
528 | 563 | |
@@ -548,11 +583,13 @@ discard block |
||
548 | 583 | $url = $smcFunc['json_decode']($url, true); |
549 | 584 | $url['error'] = $error; |
550 | 585 | // Url field got a max length of 1024 in db |
551 | - if (strlen($url['error']) > 500) |
|
552 | - $url['error'] = substr($url['error'],0,500); |
|
586 | + if (strlen($url['error']) > 500) { |
|
587 | + $url['error'] = substr($url['error'],0,500); |
|
588 | + } |
|
553 | 589 | |
554 | - if (!empty($sprintf)) |
|
555 | - $url['error_params'] = $sprintf; |
|
590 | + if (!empty($sprintf)) { |
|
591 | + $url['error_params'] = $sprintf; |
|
592 | + } |
|
556 | 593 | |
557 | 594 | $smcFunc['db_query']('', ' |
558 | 595 | UPDATE {db_prefix}log_online |
@@ -583,10 +620,11 @@ discard block |
||
583 | 620 | |
584 | 621 | $protocol = preg_match('~HTTP/1\.[01]~i', $_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'; |
585 | 622 | |
586 | - if (!isset($statuses[$code])) |
|
587 | - header($protocol . ' 500 Internal Server Error'); |
|
588 | - else |
|
589 | - header($protocol . ' ' . $code . ' ' . $statuses[$code]); |
|
590 | -} |
|
623 | + if (!isset($statuses[$code])) { |
|
624 | + header($protocol . ' 500 Internal Server Error'); |
|
625 | + } else { |
|
626 | + header($protocol . ' ' . $code . ' ' . $statuses[$code]); |
|
627 | + } |
|
628 | + } |
|
591 | 629 | |
592 | 630 | ?> |
593 | 631 | \ No newline at end of file |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 4 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * Ban center. The main entrance point for all ban center functions. |
@@ -120,10 +121,11 @@ discard block |
||
120 | 121 | } |
121 | 122 | |
122 | 123 | // Create a date string so we don't overload them with date info. |
123 | - if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
124 | - $context['ban_time_format'] = $user_info['time_format']; |
|
125 | - else |
|
126 | - $context['ban_time_format'] = $matches[0]; |
|
124 | + if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
125 | + $context['ban_time_format'] = $user_info['time_format']; |
|
126 | + } else { |
|
127 | + $context['ban_time_format'] = $matches[0]; |
|
128 | + } |
|
127 | 129 | |
128 | 130 | $listOptions = array( |
129 | 131 | 'id' => 'ban_list', |
@@ -201,16 +203,19 @@ discard block |
||
201 | 203 | 'function' => function($rowData) use ($txt) |
202 | 204 | { |
203 | 205 | // This ban never expires...whahaha. |
204 | - if ($rowData['expire_time'] === null) |
|
205 | - return $txt['never']; |
|
206 | + if ($rowData['expire_time'] === null) { |
|
207 | + return $txt['never']; |
|
208 | + } |
|
206 | 209 | |
207 | 210 | // This ban has already expired. |
208 | - elseif ($rowData['expire_time'] < time()) |
|
209 | - return sprintf('<span class="red">%1$s</span>', $txt['ban_expired']); |
|
211 | + elseif ($rowData['expire_time'] < time()) { |
|
212 | + return sprintf('<span class="red">%1$s</span>', $txt['ban_expired']); |
|
213 | + } |
|
210 | 214 | |
211 | 215 | // Still need to wait a few days for this ban to expire. |
212 | - else |
|
213 | - return sprintf('%1$d %2$s', ceil(($rowData['expire_time'] - time()) / (60 * 60 * 24)), $txt['ban_days']); |
|
216 | + else { |
|
217 | + return sprintf('%1$d %2$s', ceil(($rowData['expire_time'] - time()) / (60 * 60 * 24)), $txt['ban_days']); |
|
218 | + } |
|
214 | 219 | }, |
215 | 220 | ), |
216 | 221 | 'sort' => array( |
@@ -320,8 +325,9 @@ discard block |
||
320 | 325 | ) |
321 | 326 | ); |
322 | 327 | $bans = array(); |
323 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
324 | - $bans[] = $row; |
|
328 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
329 | + $bans[] = $row; |
|
330 | + } |
|
325 | 331 | |
326 | 332 | $smcFunc['db_free_result']($request); |
327 | 333 | |
@@ -363,8 +369,9 @@ discard block |
||
363 | 369 | { |
364 | 370 | global $txt, $modSettings, $context, $scripturl, $smcFunc, $sourcedir; |
365 | 371 | |
366 | - if ((isset($_POST['add_ban']) || isset($_POST['modify_ban']) || isset($_POST['remove_selection'])) && empty($context['ban_errors'])) |
|
367 | - BanEdit2(); |
|
372 | + if ((isset($_POST['add_ban']) || isset($_POST['modify_ban']) || isset($_POST['remove_selection'])) && empty($context['ban_errors'])) { |
|
373 | + BanEdit2(); |
|
374 | + } |
|
368 | 375 | |
369 | 376 | $ban_group_id = isset($context['ban']['id']) ? $context['ban']['id'] : (isset($_REQUEST['bg']) ? (int) $_REQUEST['bg'] : 0); |
370 | 377 | |
@@ -373,11 +380,10 @@ discard block |
||
373 | 380 | createToken('admin-bet'); |
374 | 381 | $context['form_url'] = $scripturl . '?action=admin;area=ban;sa=edit'; |
375 | 382 | |
376 | - if (!empty($context['ban_errors'])) |
|
377 | - foreach ($context['ban_errors'] as $error) |
|
383 | + if (!empty($context['ban_errors'])) { |
|
384 | + foreach ($context['ban_errors'] as $error) |
|
378 | 385 | $context['error_messages'][$error] = $txt[$error]; |
379 | - |
|
380 | - else |
|
386 | + } else |
|
381 | 387 | { |
382 | 388 | // If we're editing an existing ban, get it from the database. |
383 | 389 | if (!empty($ban_group_id)) |
@@ -413,12 +419,13 @@ discard block |
||
413 | 419 | 'data' => array( |
414 | 420 | 'function' => function($ban_item) use ($txt) |
415 | 421 | { |
416 | - if (in_array($ban_item['type'], array('ip', 'hostname', 'email'))) |
|
417 | - return '<strong>' . $txt[$ban_item['type']] . ':</strong> ' . $ban_item[$ban_item['type']]; |
|
418 | - elseif ($ban_item['type'] == 'user') |
|
419 | - return '<strong>' . $txt['username'] . ':</strong> ' . $ban_item['user']['link']; |
|
420 | - else |
|
421 | - return '<strong>' . $txt['unknown'] . ':</strong> ' . $ban_item['no_bantype_selected']; |
|
422 | + if (in_array($ban_item['type'], array('ip', 'hostname', 'email'))) { |
|
423 | + return '<strong>' . $txt[$ban_item['type']] . ':</strong> ' . $ban_item[$ban_item['type']]; |
|
424 | + } elseif ($ban_item['type'] == 'user') { |
|
425 | + return '<strong>' . $txt['username'] . ':</strong> ' . $ban_item['user']['link']; |
|
426 | + } else { |
|
427 | + return '<strong>' . $txt['unknown'] . ':</strong> ' . $ban_item['no_bantype_selected']; |
|
428 | + } |
|
422 | 429 | }, |
423 | 430 | 'style' => 'text-align: left;', |
424 | 431 | ), |
@@ -556,8 +563,9 @@ discard block |
||
556 | 563 | $context['ban']['from_user'] = true; |
557 | 564 | |
558 | 565 | // Would be nice if we could also ban the hostname. |
559 | - if ((preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $context['ban_suggestions']['main_ip']) == 1 || isValidIPv6($context['ban_suggestions']['main_ip'])) && empty($modSettings['disableHostnameLookup'])) |
|
560 | - $context['ban_suggestions']['hostname'] = host_from_ip($context['ban_suggestions']['main_ip']); |
|
566 | + if ((preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $context['ban_suggestions']['main_ip']) == 1 || isValidIPv6($context['ban_suggestions']['main_ip'])) && empty($modSettings['disableHostnameLookup'])) { |
|
567 | + $context['ban_suggestions']['hostname'] = host_from_ip($context['ban_suggestions']['main_ip']); |
|
568 | + } |
|
561 | 569 | |
562 | 570 | $context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']); |
563 | 571 | } |
@@ -625,8 +633,9 @@ discard block |
||
625 | 633 | 'items_per_page' => $items_per_page, |
626 | 634 | ) |
627 | 635 | ); |
628 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
629 | - fatal_lang_error('ban_not_found', false); |
|
636 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
637 | + fatal_lang_error('ban_not_found', false); |
|
638 | + } |
|
630 | 639 | |
631 | 640 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
632 | 641 | { |
@@ -663,18 +672,15 @@ discard block |
||
663 | 672 | { |
664 | 673 | $ban_items[$row['id_ban']]['type'] = 'ip'; |
665 | 674 | $ban_items[$row['id_ban']]['ip'] = range2ip($row['ip_low'], $row['ip_high']); |
666 | - } |
|
667 | - elseif (!empty($row['hostname'])) |
|
675 | + } elseif (!empty($row['hostname'])) |
|
668 | 676 | { |
669 | 677 | $ban_items[$row['id_ban']]['type'] = 'hostname'; |
670 | 678 | $ban_items[$row['id_ban']]['hostname'] = str_replace('%', '*', $row['hostname']); |
671 | - } |
|
672 | - elseif (!empty($row['email_address'])) |
|
679 | + } elseif (!empty($row['email_address'])) |
|
673 | 680 | { |
674 | 681 | $ban_items[$row['id_ban']]['type'] = 'email'; |
675 | 682 | $ban_items[$row['id_ban']]['email'] = str_replace('%', '*', $row['email_address']); |
676 | - } |
|
677 | - elseif (!empty($row['id_member'])) |
|
683 | + } elseif (!empty($row['id_member'])) |
|
678 | 684 | { |
679 | 685 | $ban_items[$row['id_ban']]['type'] = 'user'; |
680 | 686 | $ban_items[$row['id_ban']]['user'] = array( |
@@ -740,9 +746,10 @@ discard block |
||
740 | 746 | $search_list += array('ips_in_messages' => 'banLoadAdditionalIPsMember', 'ips_in_errors' => 'banLoadAdditionalIPsError'); |
741 | 747 | |
742 | 748 | $return = array(); |
743 | - foreach ($search_list as $key => $callable) |
|
744 | - if (is_callable($callable)) |
|
749 | + foreach ($search_list as $key => $callable) { |
|
750 | + if (is_callable($callable)) |
|
745 | 751 | $return[$key] = call_user_func($callable, $member_id); |
752 | + } |
|
746 | 753 | |
747 | 754 | return $return; |
748 | 755 | } |
@@ -767,8 +774,9 @@ discard block |
||
767 | 774 | 'current_user' => $member_id, |
768 | 775 | ) |
769 | 776 | ); |
770 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
771 | - $message_ips[] = inet_dtop($row['poster_ip']); |
|
777 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
778 | + $message_ips[] = inet_dtop($row['poster_ip']); |
|
779 | + } |
|
772 | 780 | $smcFunc['db_free_result']($request); |
773 | 781 | |
774 | 782 | return $message_ips; |
@@ -793,8 +801,9 @@ discard block |
||
793 | 801 | 'current_user' => $member_id, |
794 | 802 | ) |
795 | 803 | ); |
796 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
797 | - $error_ips[] = inet_dtop($row['ip']); |
|
804 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
805 | + $error_ips[] = inet_dtop($row['ip']); |
|
806 | + } |
|
798 | 807 | $smcFunc['db_free_result']($request); |
799 | 808 | |
800 | 809 | return $error_ips; |
@@ -835,11 +844,13 @@ discard block |
||
835 | 844 | $ban_info['cannot']['login'] = !empty($ban_info['full_ban']) || empty($_POST['cannot_login']) ? 0 : 1; |
836 | 845 | |
837 | 846 | // Adding a new ban group |
838 | - if (empty($_REQUEST['bg'])) |
|
839 | - $ban_group_id = insertBanGroup($ban_info); |
|
847 | + if (empty($_REQUEST['bg'])) { |
|
848 | + $ban_group_id = insertBanGroup($ban_info); |
|
849 | + } |
|
840 | 850 | // Editing an existing ban group |
841 | - else |
|
842 | - $ban_group_id = updateBanGroup($ban_info); |
|
851 | + else { |
|
852 | + $ban_group_id = updateBanGroup($ban_info); |
|
853 | + } |
|
843 | 854 | |
844 | 855 | if (is_numeric($ban_group_id)) |
845 | 856 | { |
@@ -850,9 +861,10 @@ discard block |
||
850 | 861 | $context['ban'] = $ban_info; |
851 | 862 | } |
852 | 863 | |
853 | - if (isset($_POST['ban_suggestions'])) |
|
854 | - // @TODO: is $_REQUEST['bi'] ever set? |
|
864 | + if (isset($_POST['ban_suggestions'])) { |
|
865 | + // @TODO: is $_REQUEST['bi'] ever set? |
|
855 | 866 | $saved_triggers = saveTriggers($_POST['ban_suggestions'], $ban_info['id'], isset($_REQUEST['u']) ? (int) $_REQUEST['u'] : 0, isset($_REQUEST['bi']) ? (int) $_REQUEST['bi'] : 0); |
867 | + } |
|
856 | 868 | |
857 | 869 | // Something went wrong somewhere... Oh well, let's go back. |
858 | 870 | if (!empty($context['ban_errors'])) |
@@ -862,8 +874,9 @@ discard block |
||
862 | 874 | $context['ban_suggestions'] = array_merge($context['ban_suggestions'], getMemberData((int) $_REQUEST['u'])); |
863 | 875 | |
864 | 876 | // Not strictly necessary, but it's nice |
865 | - if (!empty($context['ban_suggestions']['member']['id'])) |
|
866 | - $context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']); |
|
877 | + if (!empty($context['ban_suggestions']['member']['id'])) { |
|
878 | + $context['ban_suggestions']['other_ips'] = banLoadAdditionalIPs($context['ban_suggestions']['member']['id']); |
|
879 | + } |
|
867 | 880 | return BanEdit(); |
868 | 881 | } |
869 | 882 | $context['ban_suggestions']['saved_triggers'] = !empty($saved_triggers) ? $saved_triggers : array(); |
@@ -910,10 +923,11 @@ discard block |
||
910 | 923 | |
911 | 924 | foreach ($suggestions as $key => $value) |
912 | 925 | { |
913 | - if (is_array($value)) |
|
914 | - $triggers[$key] = $value; |
|
915 | - else |
|
916 | - $triggers[$value] = !empty($_POST[$value]) ? $_POST[$value] : ''; |
|
926 | + if (is_array($value)) { |
|
927 | + $triggers[$key] = $value; |
|
928 | + } else { |
|
929 | + $triggers[$value] = !empty($_POST[$value]) ? $_POST[$value] : ''; |
|
930 | + } |
|
917 | 931 | } |
918 | 932 | |
919 | 933 | $ban_triggers = validateTriggers($triggers); |
@@ -921,16 +935,18 @@ discard block |
||
921 | 935 | // Time to save! |
922 | 936 | if (!empty($ban_triggers['ban_triggers']) && empty($context['ban_errors'])) |
923 | 937 | { |
924 | - if (empty($ban_id)) |
|
925 | - addTriggers($ban_group, $ban_triggers['ban_triggers'], $ban_triggers['log_info']); |
|
926 | - else |
|
927 | - updateTriggers($ban_id, $ban_group, array_shift($ban_triggers['ban_triggers']), $ban_triggers['log_info']); |
|
938 | + if (empty($ban_id)) { |
|
939 | + addTriggers($ban_group, $ban_triggers['ban_triggers'], $ban_triggers['log_info']); |
|
940 | + } else { |
|
941 | + updateTriggers($ban_id, $ban_group, array_shift($ban_triggers['ban_triggers']), $ban_triggers['log_info']); |
|
942 | + } |
|
943 | + } |
|
944 | + if (!empty($context['ban_errors'])) { |
|
945 | + return $triggers; |
|
946 | + } else { |
|
947 | + return false; |
|
948 | + } |
|
928 | 949 | } |
929 | - if (!empty($context['ban_errors'])) |
|
930 | - return $triggers; |
|
931 | - else |
|
932 | - return false; |
|
933 | -} |
|
934 | 950 | |
935 | 951 | /** |
936 | 952 | * This function removes a bunch of triggers based on ids |
@@ -944,14 +960,17 @@ discard block |
||
944 | 960 | { |
945 | 961 | global $smcFunc, $scripturl; |
946 | 962 | |
947 | - if ($group_id !== false) |
|
948 | - $group_id = (int) $group_id; |
|
963 | + if ($group_id !== false) { |
|
964 | + $group_id = (int) $group_id; |
|
965 | + } |
|
949 | 966 | |
950 | - if (empty($group_id) && empty($items_ids)) |
|
951 | - return false; |
|
967 | + if (empty($group_id) && empty($items_ids)) { |
|
968 | + return false; |
|
969 | + } |
|
952 | 970 | |
953 | - if (!is_array($items_ids)) |
|
954 | - $items_ids = array($items_ids); |
|
971 | + if (!is_array($items_ids)) { |
|
972 | + $items_ids = array($items_ids); |
|
973 | + } |
|
955 | 974 | |
956 | 975 | $log_info = array(); |
957 | 976 | $ban_items = array(); |
@@ -989,8 +1008,7 @@ discard block |
||
989 | 1008 | 'bantype' => ($is_range ? 'ip_range' : 'main_ip'), |
990 | 1009 | 'value' => $ban_items[$row['id_ban']]['ip'], |
991 | 1010 | ); |
992 | - } |
|
993 | - elseif (!empty($row['hostname'])) |
|
1011 | + } elseif (!empty($row['hostname'])) |
|
994 | 1012 | { |
995 | 1013 | $ban_items[$row['id_ban']]['type'] = 'hostname'; |
996 | 1014 | $ban_items[$row['id_ban']]['hostname'] = str_replace('%', '*', $row['hostname']); |
@@ -998,8 +1016,7 @@ discard block |
||
998 | 1016 | 'bantype' => 'hostname', |
999 | 1017 | 'value' => $row['hostname'], |
1000 | 1018 | ); |
1001 | - } |
|
1002 | - elseif (!empty($row['email_address'])) |
|
1019 | + } elseif (!empty($row['email_address'])) |
|
1003 | 1020 | { |
1004 | 1021 | $ban_items[$row['id_ban']]['type'] = 'email'; |
1005 | 1022 | $ban_items[$row['id_ban']]['email'] = str_replace('%', '*', $row['email_address']); |
@@ -1007,8 +1024,7 @@ discard block |
||
1007 | 1024 | 'bantype' => 'email', |
1008 | 1025 | 'value' => $ban_items[$row['id_ban']]['email'], |
1009 | 1026 | ); |
1010 | - } |
|
1011 | - elseif (!empty($row['id_member'])) |
|
1027 | + } elseif (!empty($row['id_member'])) |
|
1012 | 1028 | { |
1013 | 1029 | $ban_items[$row['id_ban']]['type'] = 'user'; |
1014 | 1030 | $ban_items[$row['id_ban']]['user'] = array( |
@@ -1041,8 +1057,7 @@ discard block |
||
1041 | 1057 | 'ban_group' => $group_id, |
1042 | 1058 | ) |
1043 | 1059 | ); |
1044 | - } |
|
1045 | - elseif (!empty($items_ids)) |
|
1060 | + } elseif (!empty($items_ids)) |
|
1046 | 1061 | { |
1047 | 1062 | $smcFunc['db_query']('', ' |
1048 | 1063 | DELETE FROM {db_prefix}ban_items |
@@ -1067,13 +1082,15 @@ discard block |
||
1067 | 1082 | { |
1068 | 1083 | global $smcFunc; |
1069 | 1084 | |
1070 | - if (!is_array($group_ids)) |
|
1071 | - $group_ids = array($group_ids); |
|
1085 | + if (!is_array($group_ids)) { |
|
1086 | + $group_ids = array($group_ids); |
|
1087 | + } |
|
1072 | 1088 | |
1073 | 1089 | $group_ids = array_unique($group_ids); |
1074 | 1090 | |
1075 | - if (empty($group_ids)) |
|
1076 | - return false; |
|
1091 | + if (empty($group_ids)) { |
|
1092 | + return false; |
|
1093 | + } |
|
1077 | 1094 | |
1078 | 1095 | $smcFunc['db_query']('', ' |
1079 | 1096 | DELETE FROM {db_prefix}ban_groups |
@@ -1097,21 +1114,23 @@ discard block |
||
1097 | 1114 | { |
1098 | 1115 | global $smcFunc; |
1099 | 1116 | |
1100 | - if (empty($ids)) |
|
1101 | - $smcFunc['db_query']('truncate_table', ' |
|
1117 | + if (empty($ids)) { |
|
1118 | + $smcFunc['db_query']('truncate_table', ' |
|
1102 | 1119 | TRUNCATE {db_prefix}log_banned', |
1103 | 1120 | array( |
1104 | 1121 | ) |
1105 | 1122 | ); |
1106 | - else |
|
1123 | + } else |
|
1107 | 1124 | { |
1108 | - if (!is_array($ids)) |
|
1109 | - $ids = array($ids); |
|
1125 | + if (!is_array($ids)) { |
|
1126 | + $ids = array($ids); |
|
1127 | + } |
|
1110 | 1128 | |
1111 | 1129 | $ids = array_unique($ids); |
1112 | 1130 | |
1113 | - if (empty($ids)) |
|
1114 | - return false; |
|
1131 | + if (empty($ids)) { |
|
1132 | + return false; |
|
1133 | + } |
|
1115 | 1134 | |
1116 | 1135 | $smcFunc['db_query']('', ' |
1117 | 1136 | DELETE FROM {db_prefix}log_banned |
@@ -1137,8 +1156,9 @@ discard block |
||
1137 | 1156 | { |
1138 | 1157 | global $context, $smcFunc; |
1139 | 1158 | |
1140 | - if (empty($triggers)) |
|
1141 | - $context['ban_erros'][] = 'ban_empty_triggers'; |
|
1159 | + if (empty($triggers)) { |
|
1160 | + $context['ban_erros'][] = 'ban_empty_triggers'; |
|
1161 | + } |
|
1142 | 1162 | |
1143 | 1163 | $ban_triggers = array(); |
1144 | 1164 | $log_info = array(); |
@@ -1147,39 +1167,39 @@ discard block |
||
1147 | 1167 | { |
1148 | 1168 | if (!empty($value)) |
1149 | 1169 | { |
1150 | - if ($key == 'member') |
|
1151 | - continue; |
|
1170 | + if ($key == 'member') { |
|
1171 | + continue; |
|
1172 | + } |
|
1152 | 1173 | |
1153 | 1174 | if ($key == 'main_ip') |
1154 | 1175 | { |
1155 | 1176 | $value = trim($value); |
1156 | 1177 | $ip_parts = ip2range($value); |
1157 | - if (!checkExistingTriggerIP($ip_parts, $value)) |
|
1158 | - $context['ban_erros'][] = 'invalid_ip'; |
|
1159 | - else |
|
1178 | + if (!checkExistingTriggerIP($ip_parts, $value)) { |
|
1179 | + $context['ban_erros'][] = 'invalid_ip'; |
|
1180 | + } else |
|
1160 | 1181 | { |
1161 | 1182 | $ban_triggers['main_ip'] = array( |
1162 | 1183 | 'ip_low' => $ip_parts['low'], |
1163 | 1184 | 'ip_high' => $ip_parts['high'] |
1164 | 1185 | ); |
1165 | 1186 | } |
1166 | - } |
|
1167 | - elseif ($key == 'hostname') |
|
1187 | + } elseif ($key == 'hostname') |
|
1168 | 1188 | { |
1169 | - if (preg_match('/[^\w.\-*]/', $value) == 1) |
|
1170 | - $context['ban_erros'][] = 'invalid_hostname'; |
|
1171 | - else |
|
1189 | + if (preg_match('/[^\w.\-*]/', $value) == 1) { |
|
1190 | + $context['ban_erros'][] = 'invalid_hostname'; |
|
1191 | + } else |
|
1172 | 1192 | { |
1173 | 1193 | // Replace the * wildcard by a MySQL wildcard %. |
1174 | 1194 | $value = substr(str_replace('*', '%', $value), 0, 255); |
1175 | 1195 | |
1176 | 1196 | $ban_triggers['hostname']['hostname'] = $value; |
1177 | 1197 | } |
1178 | - } |
|
1179 | - elseif ($key == 'email') |
|
1198 | + } elseif ($key == 'email') |
|
1180 | 1199 | { |
1181 | - if (preg_match('/[^\w.\-\+*@]/', $value) == 1) |
|
1182 | - $context['ban_erros'][] = 'invalid_email'; |
|
1200 | + if (preg_match('/[^\w.\-\+*@]/', $value) == 1) { |
|
1201 | + $context['ban_erros'][] = 'invalid_email'; |
|
1202 | + } |
|
1183 | 1203 | |
1184 | 1204 | // Check the user is not banning an admin. |
1185 | 1205 | $request = $smcFunc['db_query']('', ' |
@@ -1193,15 +1213,15 @@ discard block |
||
1193 | 1213 | 'email' => $value, |
1194 | 1214 | ) |
1195 | 1215 | ); |
1196 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
1197 | - $context['ban_erros'][] = 'no_ban_admin'; |
|
1216 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
1217 | + $context['ban_erros'][] = 'no_ban_admin'; |
|
1218 | + } |
|
1198 | 1219 | $smcFunc['db_free_result']($request); |
1199 | 1220 | |
1200 | 1221 | $value = substr(strtolower(str_replace('*', '%', $value)), 0, 255); |
1201 | 1222 | |
1202 | 1223 | $ban_triggers['email']['email_address'] = $value; |
1203 | - } |
|
1204 | - elseif ($key == 'user') |
|
1224 | + } elseif ($key == 'user') |
|
1205 | 1225 | { |
1206 | 1226 | $user = preg_replace('~&#(\d{4,5}|[2-9]\d{2,4}|1[2-9]\d);~', '&#$1;', $smcFunc['htmlspecialchars']($value, ENT_QUOTES)); |
1207 | 1227 | |
@@ -1215,8 +1235,9 @@ discard block |
||
1215 | 1235 | 'username' => $user, |
1216 | 1236 | ) |
1217 | 1237 | ); |
1218 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
1219 | - $context['ban_erros'][] = 'invalid_username'; |
|
1238 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
1239 | + $context['ban_erros'][] = 'invalid_username'; |
|
1240 | + } |
|
1220 | 1241 | list ($value, $isAdmin) = $smcFunc['db_fetch_row']($request); |
1221 | 1242 | $smcFunc['db_free_result']($request); |
1222 | 1243 | |
@@ -1224,25 +1245,25 @@ discard block |
||
1224 | 1245 | { |
1225 | 1246 | unset($value); |
1226 | 1247 | $context['ban_erros'][] = 'no_ban_admin'; |
1248 | + } else { |
|
1249 | + $ban_triggers['user']['id_member'] = $value; |
|
1227 | 1250 | } |
1228 | - else |
|
1229 | - $ban_triggers['user']['id_member'] = $value; |
|
1230 | - } |
|
1231 | - elseif (in_array($key, array('ips_in_messages', 'ips_in_errors'))) |
|
1251 | + } elseif (in_array($key, array('ips_in_messages', 'ips_in_errors'))) |
|
1232 | 1252 | { |
1233 | 1253 | // Special case, those two are arrays themselves |
1234 | 1254 | $values = array_unique($value); |
1235 | 1255 | // Don't add the main IP again. |
1236 | - if (isset($triggers['main_ip'])) |
|
1237 | - $values = array_diff($values, array($triggers['main_ip'])); |
|
1256 | + if (isset($triggers['main_ip'])) { |
|
1257 | + $values = array_diff($values, array($triggers['main_ip'])); |
|
1258 | + } |
|
1238 | 1259 | unset($value); |
1239 | 1260 | foreach ($values as $val) |
1240 | 1261 | { |
1241 | 1262 | $val = trim($val); |
1242 | 1263 | $ip_parts = ip2range($val); |
1243 | - if (!checkExistingTriggerIP($ip_parts, $val)) |
|
1244 | - $context['ban_erros'][] = 'invalid_ip'; |
|
1245 | - else |
|
1264 | + if (!checkExistingTriggerIP($ip_parts, $val)) { |
|
1265 | + $context['ban_erros'][] = 'invalid_ip'; |
|
1266 | + } else |
|
1246 | 1267 | { |
1247 | 1268 | $ban_triggers[$key][] = array( |
1248 | 1269 | 'ip_low' => $ip_parts['low'], |
@@ -1255,15 +1276,16 @@ discard block |
||
1255 | 1276 | ); |
1256 | 1277 | } |
1257 | 1278 | } |
1279 | + } else { |
|
1280 | + $context['ban_erros'][] = 'no_bantype_selected'; |
|
1258 | 1281 | } |
1259 | - else |
|
1260 | - $context['ban_erros'][] = 'no_bantype_selected'; |
|
1261 | 1282 | |
1262 | - if (isset($value) && !is_array($value)) |
|
1263 | - $log_info[] = array( |
|
1283 | + if (isset($value) && !is_array($value)) { |
|
1284 | + $log_info[] = array( |
|
1264 | 1285 | 'value' => $value, |
1265 | 1286 | 'bantype' => $key, |
1266 | 1287 | ); |
1288 | + } |
|
1267 | 1289 | } |
1268 | 1290 | } |
1269 | 1291 | return array('ban_triggers' => $ban_triggers, 'log_info' => $log_info); |
@@ -1283,8 +1305,9 @@ discard block |
||
1283 | 1305 | { |
1284 | 1306 | global $smcFunc, $context; |
1285 | 1307 | |
1286 | - if (empty($group_id)) |
|
1287 | - $context['ban_errors'][] = 'ban_id_empty'; |
|
1308 | + if (empty($group_id)) { |
|
1309 | + $context['ban_errors'][] = 'ban_id_empty'; |
|
1310 | + } |
|
1288 | 1311 | |
1289 | 1312 | // Preset all values that are required. |
1290 | 1313 | $values = array( |
@@ -1309,18 +1332,21 @@ discard block |
||
1309 | 1332 | foreach ($triggers as $key => $trigger) |
1310 | 1333 | { |
1311 | 1334 | // Exceptions, exceptions, exceptions...always exceptions... :P |
1312 | - if (in_array($key, array('ips_in_messages', 'ips_in_errors'))) |
|
1313 | - foreach ($trigger as $real_trigger) |
|
1335 | + if (in_array($key, array('ips_in_messages', 'ips_in_errors'))) { |
|
1336 | + foreach ($trigger as $real_trigger) |
|
1314 | 1337 | $insertTriggers[] = array_merge($values, $real_trigger); |
1315 | - else |
|
1316 | - $insertTriggers[] = array_merge($values, $trigger); |
|
1338 | + } else { |
|
1339 | + $insertTriggers[] = array_merge($values, $trigger); |
|
1340 | + } |
|
1317 | 1341 | } |
1318 | 1342 | |
1319 | - if (empty($insertTriggers)) |
|
1320 | - $context['ban_errors'][] = 'ban_no_triggers'; |
|
1343 | + if (empty($insertTriggers)) { |
|
1344 | + $context['ban_errors'][] = 'ban_no_triggers'; |
|
1345 | + } |
|
1321 | 1346 | |
1322 | - if (!empty($context['ban_errors'])) |
|
1323 | - return false; |
|
1347 | + if (!empty($context['ban_errors'])) { |
|
1348 | + return false; |
|
1349 | + } |
|
1324 | 1350 | |
1325 | 1351 | $smcFunc['db_insert']('', |
1326 | 1352 | '{db_prefix}ban_items', |
@@ -1348,15 +1374,19 @@ discard block |
||
1348 | 1374 | { |
1349 | 1375 | global $smcFunc, $context; |
1350 | 1376 | |
1351 | - if (empty($ban_item)) |
|
1352 | - $context['ban_errors'][] = 'ban_ban_item_empty'; |
|
1353 | - if (empty($group_id)) |
|
1354 | - $context['ban_errors'][] = 'ban_id_empty'; |
|
1355 | - if (empty($trigger)) |
|
1356 | - $context['ban_errors'][] = 'ban_no_triggers'; |
|
1377 | + if (empty($ban_item)) { |
|
1378 | + $context['ban_errors'][] = 'ban_ban_item_empty'; |
|
1379 | + } |
|
1380 | + if (empty($group_id)) { |
|
1381 | + $context['ban_errors'][] = 'ban_id_empty'; |
|
1382 | + } |
|
1383 | + if (empty($trigger)) { |
|
1384 | + $context['ban_errors'][] = 'ban_no_triggers'; |
|
1385 | + } |
|
1357 | 1386 | |
1358 | - if (!empty($context['ban_errors'])) |
|
1359 | - return; |
|
1387 | + if (!empty($context['ban_errors'])) { |
|
1388 | + return; |
|
1389 | + } |
|
1360 | 1390 | |
1361 | 1391 | // Preset all values that are required. |
1362 | 1392 | $values = array( |
@@ -1397,8 +1427,9 @@ discard block |
||
1397 | 1427 | */ |
1398 | 1428 | function logTriggersUpdates($logs, $new = true, $removal = false) |
1399 | 1429 | { |
1400 | - if (empty($logs)) |
|
1401 | - return; |
|
1430 | + if (empty($logs)) { |
|
1431 | + return; |
|
1432 | + } |
|
1402 | 1433 | |
1403 | 1434 | $log_name_map = array( |
1404 | 1435 | 'main_ip' => 'ip_range', |
@@ -1409,14 +1440,15 @@ discard block |
||
1409 | 1440 | ); |
1410 | 1441 | |
1411 | 1442 | // Log the addion of the ban entries into the moderation log. |
1412 | - foreach ($logs as $log) |
|
1413 | - logAction('ban' . ($removal == true ? 'remove' : ''), array( |
|
1443 | + foreach ($logs as $log) { |
|
1444 | + logAction('ban' . ($removal == true ? 'remove' : ''), array( |
|
1414 | 1445 | $log_name_map[$log['bantype']] => $log['value'], |
1415 | 1446 | 'new' => empty($new) ? 0 : 1, |
1416 | 1447 | 'remove' => empty($removal) ? 0 : 1, |
1417 | 1448 | 'type' => $log['bantype'], |
1418 | 1449 | )); |
1419 | -} |
|
1450 | + } |
|
1451 | + } |
|
1420 | 1452 | |
1421 | 1453 | /** |
1422 | 1454 | * Updates an existing ban group |
@@ -1430,12 +1462,15 @@ discard block |
||
1430 | 1462 | { |
1431 | 1463 | global $smcFunc, $context; |
1432 | 1464 | |
1433 | - if (empty($ban_info['name'])) |
|
1434 | - $context['ban_errors'][] = 'ban_name_empty'; |
|
1435 | - if (empty($ban_info['id'])) |
|
1436 | - $context['ban_errors'][] = 'ban_id_empty'; |
|
1437 | - if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login'])) |
|
1438 | - $context['ban_errors'][] = 'ban_unknown_restriction_type'; |
|
1465 | + if (empty($ban_info['name'])) { |
|
1466 | + $context['ban_errors'][] = 'ban_name_empty'; |
|
1467 | + } |
|
1468 | + if (empty($ban_info['id'])) { |
|
1469 | + $context['ban_errors'][] = 'ban_id_empty'; |
|
1470 | + } |
|
1471 | + if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login'])) { |
|
1472 | + $context['ban_errors'][] = 'ban_unknown_restriction_type'; |
|
1473 | + } |
|
1439 | 1474 | |
1440 | 1475 | if (!empty($ban_info['id'])) |
1441 | 1476 | { |
@@ -1450,8 +1485,9 @@ discard block |
||
1450 | 1485 | ) |
1451 | 1486 | ); |
1452 | 1487 | |
1453 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
1454 | - $context['ban_errors'][] = 'ban_not_found'; |
|
1488 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
1489 | + $context['ban_errors'][] = 'ban_not_found'; |
|
1490 | + } |
|
1455 | 1491 | $smcFunc['db_free_result']($request); |
1456 | 1492 | } |
1457 | 1493 | |
@@ -1469,13 +1505,15 @@ discard block |
||
1469 | 1505 | 'new_ban_name' => $ban_info['name'], |
1470 | 1506 | ) |
1471 | 1507 | ); |
1472 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
1473 | - $context['ban_errors'][] = 'ban_name_exists'; |
|
1508 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
1509 | + $context['ban_errors'][] = 'ban_name_exists'; |
|
1510 | + } |
|
1474 | 1511 | $smcFunc['db_free_result']($request); |
1475 | 1512 | } |
1476 | 1513 | |
1477 | - if (!empty($context['ban_errors'])) |
|
1478 | - return $ban_info['id']; |
|
1514 | + if (!empty($context['ban_errors'])) { |
|
1515 | + return $ban_info['id']; |
|
1516 | + } |
|
1479 | 1517 | |
1480 | 1518 | $smcFunc['db_query']('', ' |
1481 | 1519 | UPDATE {db_prefix}ban_groups |
@@ -1519,10 +1557,12 @@ discard block |
||
1519 | 1557 | { |
1520 | 1558 | global $smcFunc, $context; |
1521 | 1559 | |
1522 | - if (empty($ban_info['name'])) |
|
1523 | - $context['ban_errors'][] = 'ban_name_empty'; |
|
1524 | - if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login'])) |
|
1525 | - $context['ban_errors'][] = 'ban_unknown_restriction_type'; |
|
1560 | + if (empty($ban_info['name'])) { |
|
1561 | + $context['ban_errors'][] = 'ban_name_empty'; |
|
1562 | + } |
|
1563 | + if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login'])) { |
|
1564 | + $context['ban_errors'][] = 'ban_unknown_restriction_type'; |
|
1565 | + } |
|
1526 | 1566 | |
1527 | 1567 | if (!empty($ban_info['name'])) |
1528 | 1568 | { |
@@ -1537,13 +1577,15 @@ discard block |
||
1537 | 1577 | ) |
1538 | 1578 | ); |
1539 | 1579 | |
1540 | - if ($smcFunc['db_num_rows']($request) == 1) |
|
1541 | - $context['ban_errors'][] = 'ban_name_exists'; |
|
1580 | + if ($smcFunc['db_num_rows']($request) == 1) { |
|
1581 | + $context['ban_errors'][] = 'ban_name_exists'; |
|
1582 | + } |
|
1542 | 1583 | $smcFunc['db_free_result']($request); |
1543 | 1584 | } |
1544 | 1585 | |
1545 | - if (!empty($context['ban_errors'])) |
|
1546 | - return; |
|
1586 | + if (!empty($context['ban_errors'])) { |
|
1587 | + return; |
|
1588 | + } |
|
1547 | 1589 | |
1548 | 1590 | // Yes yes, we're ready to add now. |
1549 | 1591 | $ban_info['id'] = $smcFunc['db_insert']('', |
@@ -1560,8 +1602,9 @@ discard block |
||
1560 | 1602 | 1 |
1561 | 1603 | ); |
1562 | 1604 | |
1563 | - if (empty($ban_info['id'])) |
|
1564 | - $context['ban_errors'][] = 'impossible_insert_new_bangroup'; |
|
1605 | + if (empty($ban_info['id'])) { |
|
1606 | + $context['ban_errors'][] = 'impossible_insert_new_bangroup'; |
|
1607 | + } |
|
1565 | 1608 | |
1566 | 1609 | return $ban_info['id']; |
1567 | 1610 | } |
@@ -1586,24 +1629,24 @@ discard block |
||
1586 | 1629 | $ban_group = isset($_REQUEST['bg']) ? (int) $_REQUEST['bg'] : 0; |
1587 | 1630 | $ban_id = isset($_REQUEST['bi']) ? (int) $_REQUEST['bi'] : 0; |
1588 | 1631 | |
1589 | - if (empty($ban_group)) |
|
1590 | - fatal_lang_error('ban_not_found', false); |
|
1632 | + if (empty($ban_group)) { |
|
1633 | + fatal_lang_error('ban_not_found', false); |
|
1634 | + } |
|
1591 | 1635 | |
1592 | 1636 | if (isset($_POST['add_new_trigger']) && !empty($_POST['ban_suggestions'])) |
1593 | 1637 | { |
1594 | 1638 | saveTriggers($_POST['ban_suggestions'], $ban_group, 0, $ban_id); |
1595 | 1639 | redirectexit('action=admin;area=ban;sa=edit' . (!empty($ban_group) ? ';bg=' . $ban_group : '')); |
1596 | - } |
|
1597 | - elseif (isset($_POST['edit_trigger']) && !empty($_POST['ban_suggestions'])) |
|
1640 | + } elseif (isset($_POST['edit_trigger']) && !empty($_POST['ban_suggestions'])) |
|
1598 | 1641 | { |
1599 | 1642 | // The first replaces the old one, the others are added new (simplification, otherwise it would require another query and some work...) |
1600 | 1643 | saveTriggers(array_shift($_POST['ban_suggestions']), $ban_group, 0, $ban_id); |
1601 | - if (!empty($_POST['ban_suggestions'])) |
|
1602 | - saveTriggers($_POST['ban_suggestions'], $ban_group); |
|
1644 | + if (!empty($_POST['ban_suggestions'])) { |
|
1645 | + saveTriggers($_POST['ban_suggestions'], $ban_group); |
|
1646 | + } |
|
1603 | 1647 | |
1604 | 1648 | redirectexit('action=admin;area=ban;sa=edit' . (!empty($ban_group) ? ';bg=' . $ban_group : '')); |
1605 | - } |
|
1606 | - elseif (isset($_POST['edit_trigger'])) |
|
1649 | + } elseif (isset($_POST['edit_trigger'])) |
|
1607 | 1650 | { |
1608 | 1651 | removeBanTriggers($ban_id); |
1609 | 1652 | redirectexit('action=admin;area=ban;sa=edit' . (!empty($ban_group) ? ';bg=' . $ban_group : '')); |
@@ -1634,8 +1677,7 @@ discard block |
||
1634 | 1677 | ), |
1635 | 1678 | 'is_new' => true, |
1636 | 1679 | ); |
1637 | - } |
|
1638 | - else |
|
1680 | + } else |
|
1639 | 1681 | { |
1640 | 1682 | $request = $smcFunc['db_query']('', ' |
1641 | 1683 | SELECT |
@@ -1652,8 +1694,9 @@ discard block |
||
1652 | 1694 | 'ban_group' => $ban_group, |
1653 | 1695 | ) |
1654 | 1696 | ); |
1655 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
1656 | - fatal_lang_error('ban_not_found', false); |
|
1697 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
1698 | + fatal_lang_error('ban_not_found', false); |
|
1699 | + } |
|
1657 | 1700 | $row = $smcFunc['db_fetch_assoc']($request); |
1658 | 1701 | $smcFunc['db_free_result']($request); |
1659 | 1702 | |
@@ -1702,8 +1745,9 @@ discard block |
||
1702 | 1745 | removeBanTriggers($_POST['remove']); |
1703 | 1746 | |
1704 | 1747 | // Rehabilitate some members. |
1705 | - if ($_REQUEST['entity'] == 'member') |
|
1706 | - updateBanMembers(); |
|
1748 | + if ($_REQUEST['entity'] == 'member') { |
|
1749 | + updateBanMembers(); |
|
1750 | + } |
|
1707 | 1751 | |
1708 | 1752 | // Make sure the ban cache is refreshed. |
1709 | 1753 | updateSettings(array('banLastUpdated' => time())); |
@@ -1816,8 +1860,7 @@ discard block |
||
1816 | 1860 | 'default' => 'bi.ip_low, bi.ip_high, bi.ip_low', |
1817 | 1861 | 'reverse' => 'bi.ip_low DESC, bi.ip_high DESC', |
1818 | 1862 | ); |
1819 | - } |
|
1820 | - elseif ($context['selected_entity'] === 'hostname') |
|
1863 | + } elseif ($context['selected_entity'] === 'hostname') |
|
1821 | 1864 | { |
1822 | 1865 | $listOptions['columns']['banned_entity']['data'] = array( |
1823 | 1866 | 'function' => function($rowData) use ($smcFunc) |
@@ -1829,8 +1872,7 @@ discard block |
||
1829 | 1872 | 'default' => 'bi.hostname', |
1830 | 1873 | 'reverse' => 'bi.hostname DESC', |
1831 | 1874 | ); |
1832 | - } |
|
1833 | - elseif ($context['selected_entity'] === 'email') |
|
1875 | + } elseif ($context['selected_entity'] === 'email') |
|
1834 | 1876 | { |
1835 | 1877 | $listOptions['columns']['banned_entity']['data'] = array( |
1836 | 1878 | 'function' => function($rowData) use ($smcFunc) |
@@ -1842,8 +1884,7 @@ discard block |
||
1842 | 1884 | 'default' => 'bi.email_address', |
1843 | 1885 | 'reverse' => 'bi.email_address DESC', |
1844 | 1886 | ); |
1845 | - } |
|
1846 | - elseif ($context['selected_entity'] === 'member') |
|
1887 | + } elseif ($context['selected_entity'] === 'member') |
|
1847 | 1888 | { |
1848 | 1889 | $listOptions['columns']['banned_entity']['data'] = array( |
1849 | 1890 | 'sprintf' => array( |
@@ -1907,8 +1948,9 @@ discard block |
||
1907 | 1948 | ) |
1908 | 1949 | ); |
1909 | 1950 | $ban_triggers = array(); |
1910 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1911 | - $ban_triggers[] = $row; |
|
1951 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1952 | + $ban_triggers[] = $row; |
|
1953 | + } |
|
1912 | 1954 | $smcFunc['db_free_result']($request); |
1913 | 1955 | |
1914 | 1956 | return $ban_triggers; |
@@ -1964,8 +2006,9 @@ discard block |
||
1964 | 2006 | validateToken('admin-bl'); |
1965 | 2007 | |
1966 | 2008 | // 'Delete all entries' button was pressed. |
1967 | - if (!empty($_POST['removeAll'])) |
|
1968 | - removeBanLogs(); |
|
2009 | + if (!empty($_POST['removeAll'])) { |
|
2010 | + removeBanLogs(); |
|
2011 | + } |
|
1969 | 2012 | // 'Delete selection' button was pressed. |
1970 | 2013 | else |
1971 | 2014 | { |
@@ -2174,12 +2217,15 @@ discard block |
||
2174 | 2217 | $low = inet_dtop($low); |
2175 | 2218 | $high = inet_dtop($high); |
2176 | 2219 | |
2177 | - if ($low == '255.255.255.255') return 'unknown'; |
|
2178 | - if ($low == $high) |
|
2179 | - return $low; |
|
2180 | - else |
|
2181 | - return $low . '-' . $high; |
|
2182 | -} |
|
2220 | + if ($low == '255.255.255.255') { |
|
2221 | + return 'unknown'; |
|
2222 | + } |
|
2223 | + if ($low == $high) { |
|
2224 | + return $low; |
|
2225 | + } else { |
|
2226 | + return $low . '-' . $high; |
|
2227 | + } |
|
2228 | + } |
|
2183 | 2229 | |
2184 | 2230 | /** |
2185 | 2231 | * Checks whether a given IP range already exists in the trigger list. |
@@ -2255,15 +2301,17 @@ discard block |
||
2255 | 2301 | $memberEmailWild = array(); |
2256 | 2302 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
2257 | 2303 | { |
2258 | - if ($row['id_member']) |
|
2259 | - $memberIDs[$row['id_member']] = $row['id_member']; |
|
2304 | + if ($row['id_member']) { |
|
2305 | + $memberIDs[$row['id_member']] = $row['id_member']; |
|
2306 | + } |
|
2260 | 2307 | if ($row['email_address']) |
2261 | 2308 | { |
2262 | 2309 | // Does it have a wildcard - if so we can't do a IN on it. |
2263 | - if (strpos($row['email_address'], '%') !== false) |
|
2264 | - $memberEmailWild[$row['email_address']] = $row['email_address']; |
|
2265 | - else |
|
2266 | - $memberEmails[$row['email_address']] = $row['email_address']; |
|
2310 | + if (strpos($row['email_address'], '%') !== false) { |
|
2311 | + $memberEmailWild[$row['email_address']] = $row['email_address']; |
|
2312 | + } else { |
|
2313 | + $memberEmails[$row['email_address']] = $row['email_address']; |
|
2314 | + } |
|
2267 | 2315 | } |
2268 | 2316 | } |
2269 | 2317 | $smcFunc['db_free_result']($request); |
@@ -2314,14 +2362,15 @@ discard block |
||
2314 | 2362 | } |
2315 | 2363 | |
2316 | 2364 | // We welcome our new members in the realm of the banned. |
2317 | - if (!empty($newMembers)) |
|
2318 | - $smcFunc['db_query']('', ' |
|
2365 | + if (!empty($newMembers)) { |
|
2366 | + $smcFunc['db_query']('', ' |
|
2319 | 2367 | DELETE FROM {db_prefix}log_online |
2320 | 2368 | WHERE id_member IN ({array_int:new_banned_members})', |
2321 | 2369 | array( |
2322 | 2370 | 'new_banned_members' => $newMembers, |
2323 | 2371 | ) |
2324 | 2372 | ); |
2373 | + } |
|
2325 | 2374 | |
2326 | 2375 | // Find members that are wrongfully marked as banned. |
2327 | 2376 | $request = $smcFunc['db_query']('', ' |
@@ -2348,9 +2397,10 @@ discard block |
||
2348 | 2397 | } |
2349 | 2398 | $smcFunc['db_free_result']($request); |
2350 | 2399 | |
2351 | - if (!empty($updates)) |
|
2352 | - foreach ($updates as $newStatus => $members) |
|
2400 | + if (!empty($updates)) { |
|
2401 | + foreach ($updates as $newStatus => $members) |
|
2353 | 2402 | updateMemberData($members, array('is_activated' => $newStatus)); |
2403 | + } |
|
2354 | 2404 | |
2355 | 2405 | // Update the latest member and our total members as banning may change them. |
2356 | 2406 | updateStats('member'); |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | <div id="personal_messages">'; |
22 | 22 | |
23 | 23 | // Show the capacity bar, if available. |
24 | - if (!empty($context['limit_bar'])) |
|
25 | - echo ' |
|
24 | + if (!empty($context['limit_bar'])) { |
|
25 | + echo ' |
|
26 | 26 | <div class="cat_bar"> |
27 | 27 | <h3 class="catbg"> |
28 | 28 | <span class="floatleft">', $txt['pm_capacity'], ':</span> |
@@ -32,14 +32,16 @@ discard block |
||
32 | 32 | <span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span> |
33 | 33 | </h3> |
34 | 34 | </div>'; |
35 | + } |
|
35 | 36 | |
36 | 37 | // Message sent? Show a small indication. |
37 | - if (isset($context['pm_sent'])) |
|
38 | - echo ' |
|
38 | + if (isset($context['pm_sent'])) { |
|
39 | + echo ' |
|
39 | 40 | <div class="infobox"> |
40 | 41 | ', $txt['pm_sent'], ' |
41 | 42 | </div>'; |
42 | -} |
|
43 | + } |
|
44 | + } |
|
43 | 45 | |
44 | 46 | /** |
45 | 47 | * Just the end of the index bar, nothing special. |
@@ -68,13 +70,13 @@ discard block |
||
68 | 70 | </div> |
69 | 71 | <div class="pm_unread">'; |
70 | 72 | |
71 | - if (empty($context['unread_pms'])) |
|
72 | - echo ' |
|
73 | + if (empty($context['unread_pms'])) { |
|
74 | + echo ' |
|
73 | 75 | <div class="no_unread">', $txt['pm_no_unread'], '</div>'; |
74 | - else |
|
76 | + } else |
|
75 | 77 | { |
76 | - foreach ($context['unread_pms'] as $id_pm => $pm_details) |
|
77 | - echo ' |
|
78 | + foreach ($context['unread_pms'] as $id_pm => $pm_details) { |
|
79 | + echo ' |
|
78 | 80 | <div class="unread"> |
79 | 81 | ', !empty($pm_details['member']) ? $pm_details['member']['avatar']['image'] : '', ' |
80 | 82 | <div class="details"> |
@@ -85,6 +87,7 @@ discard block |
||
85 | 87 | </div> |
86 | 88 | </div> |
87 | 89 | </div>'; |
90 | + } |
|
88 | 91 | } |
89 | 92 | |
90 | 93 | echo ' |
@@ -193,14 +196,15 @@ discard block |
||
193 | 196 | if ($context['get_pmessage']('message', true)) |
194 | 197 | { |
195 | 198 | // Show the helpful titlebar - generally. |
196 | - if ($context['display_mode'] != 1) |
|
197 | - echo ' |
|
199 | + if ($context['display_mode'] != 1) { |
|
200 | + echo ' |
|
198 | 201 | <div class="cat_bar"> |
199 | 202 | <h3 class="catbg"> |
200 | 203 | <span id="author">', $txt['author'], '</span> |
201 | 204 | <span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span> |
202 | 205 | </h3> |
203 | 206 | </div>'; |
207 | + } |
|
204 | 208 | |
205 | 209 | // Show a few buttons if we are in conversation mode and outputting the first message. |
206 | 210 | if ($context['display_mode'] == 2) |
@@ -228,9 +232,10 @@ discard block |
||
228 | 232 | <div class="custom_fields_above_member"> |
229 | 233 | <ul class="nolist">'; |
230 | 234 | |
231 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
232 | - echo ' |
|
235 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
236 | + echo ' |
|
233 | 237 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
238 | + } |
|
234 | 239 | |
235 | 240 | echo ' |
236 | 241 | </ul> |
@@ -242,25 +247,28 @@ discard block |
||
242 | 247 | <a id="msg', $message['id'], '"></a>'; |
243 | 248 | |
244 | 249 | // Show online and offline buttons? |
245 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
246 | - echo ' |
|
250 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
251 | + echo ' |
|
247 | 252 | <span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>'; |
253 | + } |
|
248 | 254 | |
249 | 255 | // Custom fields BEFORE the username? |
250 | - if (!empty($message['custom_fields']['before_member'])) |
|
251 | - foreach ($message['custom_fields']['before_member'] as $custom) |
|
256 | + if (!empty($message['custom_fields']['before_member'])) { |
|
257 | + foreach ($message['custom_fields']['before_member'] as $custom) |
|
252 | 258 | echo ' |
253 | 259 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
260 | + } |
|
254 | 261 | |
255 | 262 | // Show a link to the member's profile. |
256 | 263 | echo ' |
257 | 264 | ', $message['member']['link']; |
258 | 265 | |
259 | 266 | // Custom fields AFTER the username? |
260 | - if (!empty($message['custom_fields']['after_member'])) |
|
261 | - foreach ($message['custom_fields']['after_member'] as $custom) |
|
267 | + if (!empty($message['custom_fields']['after_member'])) { |
|
268 | + foreach ($message['custom_fields']['after_member'] as $custom) |
|
262 | 269 | echo ' |
263 | 270 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
271 | + } |
|
264 | 272 | |
265 | 273 | echo ' |
266 | 274 | </h4>'; |
@@ -269,48 +277,56 @@ discard block |
||
269 | 277 | <ul class="user_info">'; |
270 | 278 | |
271 | 279 | // Show the user's avatar. |
272 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
273 | - echo ' |
|
280 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
281 | + echo ' |
|
274 | 282 | <li class="avatar"> |
275 | 283 | <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a> |
276 | 284 | </li>'; |
285 | + } |
|
277 | 286 | |
278 | 287 | // Are there any custom fields below the avatar? |
279 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
280 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
288 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
289 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
281 | 290 | echo ' |
282 | 291 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
292 | + } |
|
283 | 293 | |
284 | - if (!$message['member']['is_guest']) |
|
285 | - echo ' |
|
294 | + if (!$message['member']['is_guest']) { |
|
295 | + echo ' |
|
286 | 296 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
297 | + } |
|
287 | 298 | // Show the member's primary group (like 'Administrator') if they have one. |
288 | - if (isset($message['member']['group']) && $message['member']['group'] != '') |
|
289 | - echo ' |
|
299 | + if (isset($message['member']['group']) && $message['member']['group'] != '') { |
|
300 | + echo ' |
|
290 | 301 | <li class="membergroup">', $message['member']['group'], '</li>'; |
302 | + } |
|
291 | 303 | |
292 | 304 | // Show the member's custom title, if they have one. |
293 | - if (isset($message['member']['title']) && $message['member']['title'] != '') |
|
294 | - echo ' |
|
305 | + if (isset($message['member']['title']) && $message['member']['title'] != '') { |
|
306 | + echo ' |
|
295 | 307 | <li class="title">', $message['member']['title'], '</li>'; |
308 | + } |
|
296 | 309 | |
297 | 310 | // Don't show these things for guests. |
298 | 311 | if (!$message['member']['is_guest']) |
299 | 312 | { |
300 | 313 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
301 | - if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') |
|
302 | - echo ' |
|
314 | + if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') { |
|
315 | + echo ' |
|
303 | 316 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
317 | + } |
|
304 | 318 | |
305 | 319 | // Show how many posts they have made. |
306 | - if (!isset($context['disabled_fields']['posts'])) |
|
307 | - echo ' |
|
320 | + if (!isset($context['disabled_fields']['posts'])) { |
|
321 | + echo ' |
|
308 | 322 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
323 | + } |
|
309 | 324 | |
310 | 325 | // Show their personal text? |
311 | - if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') |
|
312 | - echo ' |
|
326 | + if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') { |
|
327 | + echo ' |
|
313 | 328 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
329 | + } |
|
314 | 330 | |
315 | 331 | // Any custom fields to show as icons? |
316 | 332 | if (!empty($message['custom_fields']['icons'])) |
@@ -319,9 +335,10 @@ discard block |
||
319 | 335 | <li class="im_icons"> |
320 | 336 | <ol>'; |
321 | 337 | |
322 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
323 | - echo ' |
|
338 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
339 | + echo ' |
|
324 | 340 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
341 | + } |
|
325 | 342 | |
326 | 343 | echo ' |
327 | 344 | </ol> |
@@ -329,25 +346,28 @@ discard block |
||
329 | 346 | } |
330 | 347 | |
331 | 348 | // Show the IP to this user for this post - because you can moderate? |
332 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
333 | - echo ' |
|
349 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
350 | + echo ' |
|
334 | 351 | <li class="poster_ip"> |
335 | 352 | <a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a> |
336 | 353 | </li>'; |
354 | + } |
|
337 | 355 | |
338 | 356 | // Or, should we show it because this is you? |
339 | - elseif ($message['can_see_ip']) |
|
340 | - echo ' |
|
357 | + elseif ($message['can_see_ip']) { |
|
358 | + echo ' |
|
341 | 359 | <li class="poster_ip"> |
342 | 360 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a> |
343 | 361 | </li>'; |
362 | + } |
|
344 | 363 | |
345 | 364 | // Okay, you are logged in, then we can show something about why IPs are logged... |
346 | - else |
|
347 | - echo ' |
|
365 | + else { |
|
366 | + echo ' |
|
348 | 367 | <li class="poster_ip"> |
349 | 368 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a> |
350 | 369 | </li>'; |
370 | + } |
|
351 | 371 | |
352 | 372 | // Show the profile, website, email address, and personal message buttons. |
353 | 373 | if ($message['member']['show_profile_buttons']) |
@@ -357,24 +377,28 @@ discard block |
||
357 | 377 | <ol class="profile_icons">'; |
358 | 378 | |
359 | 379 | // Show the profile button |
360 | - if ($message['member']['can_view_profile']) |
|
361 | - echo ' |
|
380 | + if ($message['member']['can_view_profile']) { |
|
381 | + echo ' |
|
362 | 382 | <li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '">' : $txt['view_profile']), '</a></li>'; |
383 | + } |
|
363 | 384 | |
364 | 385 | // Don't show an icon if they haven't specified a website. |
365 | - if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) |
|
366 | - echo ' |
|
386 | + if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) { |
|
387 | + echo ' |
|
367 | 388 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
389 | + } |
|
368 | 390 | |
369 | 391 | // Don't show the email address if they want it hidden. |
370 | - if ($message['member']['show_email']) |
|
371 | - echo ' |
|
392 | + if ($message['member']['show_email']) { |
|
393 | + echo ' |
|
372 | 394 | <li><a href="mailto:', $message['member']['email'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
395 | + } |
|
373 | 396 | |
374 | 397 | // Since we know this person isn't a guest, you *can* message them. |
375 | - if ($context['can_send_pm']) |
|
376 | - echo ' |
|
398 | + if ($context['can_send_pm']) { |
|
399 | + echo ' |
|
377 | 400 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
401 | + } |
|
378 | 402 | |
379 | 403 | echo ' |
380 | 404 | </ol> |
@@ -382,21 +406,24 @@ discard block |
||
382 | 406 | } |
383 | 407 | |
384 | 408 | // Any custom fields for standard placement? |
385 | - if (!empty($message['custom_fields']['standard'])) |
|
386 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
409 | + if (!empty($message['custom_fields']['standard'])) { |
|
410 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
387 | 411 | echo ' |
388 | 412 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
413 | + } |
|
389 | 414 | |
390 | 415 | // Are we showing the warning status? |
391 | - if ($message['member']['can_see_warning']) |
|
392 | - echo ' |
|
416 | + if ($message['member']['can_see_warning']) { |
|
417 | + echo ' |
|
393 | 418 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span>', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
419 | + } |
|
394 | 420 | |
395 | 421 | // Are there any custom fields to show at the bottom of the poster info? |
396 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
397 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
422 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
423 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
398 | 424 | echo ' |
399 | 425 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
426 | + } |
|
400 | 427 | } |
401 | 428 | |
402 | 429 | // Done with the information about the poster... on to the post itself. |
@@ -415,25 +442,29 @@ discard block |
||
415 | 442 | <span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> '; |
416 | 443 | |
417 | 444 | // People it was sent directly to.... |
418 | - if (!empty($message['recipients']['to'])) |
|
419 | - echo implode(', ', $message['recipients']['to']); |
|
445 | + if (!empty($message['recipients']['to'])) { |
|
446 | + echo implode(', ', $message['recipients']['to']); |
|
447 | + } |
|
420 | 448 | |
421 | 449 | // Otherwise, we're just going to say "some people"... |
422 | - elseif ($context['folder'] != 'sent') |
|
423 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
450 | + elseif ($context['folder'] != 'sent') { |
|
451 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
452 | + } |
|
424 | 453 | |
425 | 454 | echo ' |
426 | 455 | <strong> ', $txt['on'], ':</strong> ', $message['time'], ' » |
427 | 456 | </span>'; |
428 | 457 | |
429 | 458 | // If we're in the sent items, show who it was sent to besides the "To:" people. |
430 | - if (!empty($message['recipients']['bcc'])) |
|
431 | - echo '<br> |
|
459 | + if (!empty($message['recipients']['bcc'])) { |
|
460 | + echo '<br> |
|
432 | 461 | <span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>'; |
462 | + } |
|
433 | 463 | |
434 | - if (!empty($message['is_replied_to'])) |
|
435 | - echo '<br> |
|
464 | + if (!empty($message['is_replied_to'])) { |
|
465 | + echo '<br> |
|
436 | 466 | <span class="smalltext">« ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' »</span>'; |
467 | + } |
|
437 | 468 | |
438 | 469 | echo ' |
439 | 470 | </div><!-- .keyinfo --> |
@@ -443,13 +474,15 @@ discard block |
||
443 | 474 | ', $message['body'], ' |
444 | 475 | </div>'; |
445 | 476 | |
446 | - if ($message['can_report'] || $context['can_send_pm']) |
|
447 | - echo ' |
|
477 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
478 | + echo ' |
|
448 | 479 | <div class="under_message">'; |
480 | + } |
|
449 | 481 | |
450 | - if ($message['can_report']) |
|
451 | - echo ' |
|
482 | + if ($message['can_report']) { |
|
483 | + echo ' |
|
452 | 484 | <a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>'; |
485 | + } |
|
453 | 486 | |
454 | 487 | echo ' |
455 | 488 | <ul class="quickbuttons">'; |
@@ -461,32 +494,36 @@ discard block |
||
461 | 494 | if (!$message['member']['is_guest']) |
462 | 495 | { |
463 | 496 | // Is there than more than one recipient you can reply to? |
464 | - if ($message['number_recipients'] > 1) |
|
465 | - echo ' |
|
497 | + if ($message['number_recipients'] > 1) { |
|
498 | + echo ' |
|
466 | 499 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all"><span class="generic_icons reply_all_button"></span>', $txt['reply_to_all'], '</a></li>'; |
500 | + } |
|
467 | 501 | |
468 | 502 | echo ' |
469 | 503 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li> |
470 | 504 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
471 | 505 | } |
472 | 506 | // This is for "forwarding" - even if the member is gone. |
473 | - else |
|
474 | - echo ' |
|
507 | + else { |
|
508 | + echo ' |
|
475 | 509 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote"><span class="generic_icons quote"></span>', $txt['reply_quote'], '</a></li>'; |
510 | + } |
|
476 | 511 | } |
477 | 512 | echo ' |
478 | 513 | <li><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5b', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', addslashes($txt['remove_message_question']), '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>'; |
479 | 514 | |
480 | - if (empty($context['display_mode'])) |
|
481 | - echo ' |
|
515 | + if (empty($context['display_mode'])) { |
|
516 | + echo ' |
|
482 | 517 | <li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;"></li>'; |
518 | + } |
|
483 | 519 | |
484 | 520 | echo ' |
485 | 521 | </ul>'; |
486 | 522 | |
487 | - if ($message['can_report'] || $context['can_send_pm']) |
|
488 | - echo ' |
|
523 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
524 | + echo ' |
|
489 | 525 | </div><!-- .under_message -->'; |
526 | + } |
|
490 | 527 | |
491 | 528 | // Are there any custom profile fields for above the signature? |
492 | 529 | if (!empty($message['custom_fields']['above_signature'])) |
@@ -495,9 +532,10 @@ discard block |
||
495 | 532 | <div class="custom_fields_above_signature"> |
496 | 533 | <ul class="nolist">'; |
497 | 534 | |
498 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
499 | - echo ' |
|
535 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
536 | + echo ' |
|
500 | 537 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
538 | + } |
|
501 | 539 | |
502 | 540 | echo ' |
503 | 541 | </ul> |
@@ -505,11 +543,12 @@ discard block |
||
505 | 543 | } |
506 | 544 | |
507 | 545 | // Show the member's signature? |
508 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
509 | - echo ' |
|
546 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
547 | + echo ' |
|
510 | 548 | <div class="signature"> |
511 | 549 | ', $message['member']['signature'], ' |
512 | 550 | </div>'; |
551 | + } |
|
513 | 552 | |
514 | 553 | // Are there any custom profile fields for below the signature? |
515 | 554 | if (!empty($message['custom_fields']['below_signature'])) |
@@ -518,9 +557,10 @@ discard block |
||
518 | 557 | <div class="custom_fields_below_signature"> |
519 | 558 | <ul class="nolist">'; |
520 | 559 | |
521 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
522 | - echo ' |
|
560 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
561 | + echo ' |
|
523 | 562 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
563 | + } |
|
524 | 564 | |
525 | 565 | echo ' |
526 | 566 | </ul> |
@@ -547,10 +587,11 @@ discard block |
||
547 | 587 | echo ' |
548 | 588 | <option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
549 | 589 | |
550 | - foreach ($context['labels'] as $label) |
|
551 | - if (!isset($message['labels'][$label['id']])) |
|
590 | + foreach ($context['labels'] as $label) { |
|
591 | + if (!isset($message['labels'][$label['id']])) |
|
552 | 592 | echo ' |
553 | 593 | <option value="', $label['id'], '">', $label['name'], '</option>'; |
594 | + } |
|
554 | 595 | } |
555 | 596 | |
556 | 597 | // ... and are there any that can be removed? |
@@ -559,9 +600,10 @@ discard block |
||
559 | 600 | echo ' |
560 | 601 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
561 | 602 | |
562 | - foreach ($message['labels'] as $label) |
|
563 | - echo ' |
|
603 | + foreach ($message['labels'] as $label) { |
|
604 | + echo ' |
|
564 | 605 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
606 | + } |
|
565 | 607 | } |
566 | 608 | echo ' |
567 | 609 | </select> |
@@ -580,14 +622,15 @@ discard block |
||
580 | 622 | </div><!-- .windowbg -->'; |
581 | 623 | } |
582 | 624 | |
583 | - if (empty($context['display_mode'])) |
|
584 | - echo ' |
|
625 | + if (empty($context['display_mode'])) { |
|
626 | + echo ' |
|
585 | 627 | <div class="pagesection"> |
586 | 628 | <div class="floatleft">', $context['page_index'], '</div> |
587 | 629 | <div class="floatright"> |
588 | 630 | <input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button"> |
589 | 631 | </div> |
590 | 632 | </div>'; |
633 | + } |
|
591 | 634 | |
592 | 635 | // Show a few buttons if we are in conversation mode and outputting the first message. |
593 | 636 | elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons'])) |
@@ -647,11 +690,12 @@ discard block |
||
647 | 690 | </thead> |
648 | 691 | <tbody>'; |
649 | 692 | |
650 | - if (!$context['show_delete']) |
|
651 | - echo ' |
|
693 | + if (!$context['show_delete']) { |
|
694 | + echo ' |
|
652 | 695 | <tr class="windowbg"> |
653 | 696 | <td colspan="5">', $txt['pm_alert_none'], '</td> |
654 | 697 | </tr>'; |
698 | + } |
|
655 | 699 | |
656 | 700 | while ($message = $context['get_pmessage']('subject')) |
657 | 701 | { |
@@ -709,17 +753,19 @@ discard block |
||
709 | 753 | |
710 | 754 | foreach ($context['labels'] as $label) |
711 | 755 | { |
712 | - if ($label['id'] != $context['current_label_id']) |
|
713 | - echo ' |
|
756 | + if ($label['id'] != $context['current_label_id']) { |
|
757 | + echo ' |
|
714 | 758 | <option value="add_', $label['id'], '"> ', $label['name'], '</option>'; |
759 | + } |
|
715 | 760 | } |
716 | 761 | |
717 | 762 | echo ' |
718 | 763 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
719 | 764 | |
720 | - foreach ($context['labels'] as $label) |
|
721 | - echo ' |
|
765 | + foreach ($context['labels'] as $label) { |
|
766 | + echo ' |
|
722 | 767 | <option value="rem_', $label['id'], '"> ', $label['name'], '</option>'; |
768 | + } |
|
723 | 769 | |
724 | 770 | echo ' |
725 | 771 | </select> |
@@ -750,11 +796,12 @@ discard block |
||
750 | 796 | <h3 class="catbg">', $txt['pm_search_title'], '</h3> |
751 | 797 | </div>'; |
752 | 798 | |
753 | - if (!empty($context['search_errors'])) |
|
754 | - echo ' |
|
799 | + if (!empty($context['search_errors'])) { |
|
800 | + echo ' |
|
755 | 801 | <div class="errorbox"> |
756 | 802 | ', implode('<br>', $context['search_errors']['messages']), ' |
757 | 803 | </div>'; |
804 | + } |
|
758 | 805 | |
759 | 806 | |
760 | 807 | echo ' |
@@ -803,9 +850,10 @@ discard block |
||
803 | 850 | </dd> |
804 | 851 | </dl>'; |
805 | 852 | |
806 | - if (!$context['currently_using_labels']) |
|
807 | - echo ' |
|
853 | + if (!$context['currently_using_labels']) { |
|
854 | + echo ' |
|
808 | 855 | <input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button">'; |
856 | + } |
|
809 | 857 | |
810 | 858 | echo ' |
811 | 859 | <br class="clear_right"> |
@@ -826,12 +874,13 @@ discard block |
||
826 | 874 | <div id="advanced_panel_div"> |
827 | 875 | <ul id="searchLabelsExpand">'; |
828 | 876 | |
829 | - foreach ($context['search_labels'] as $label) |
|
830 | - echo ' |
|
877 | + foreach ($context['search_labels'] as $label) { |
|
878 | + echo ' |
|
831 | 879 | <li> |
832 | 880 | <label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '> |
833 | 881 | ', $label['name'], '</label> |
834 | 882 | </li>'; |
883 | + } |
|
835 | 884 | |
836 | 885 | echo ' |
837 | 886 | </ul> |
@@ -893,8 +942,8 @@ discard block |
||
893 | 942 | </div>'; |
894 | 943 | |
895 | 944 | // Complete results? |
896 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
897 | - echo ' |
|
945 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
946 | + echo ' |
|
898 | 947 | <table class="table_grid"> |
899 | 948 | <thead> |
900 | 949 | <tr class="title_bar"> |
@@ -904,6 +953,7 @@ discard block |
||
904 | 953 | </tr> |
905 | 954 | </thead> |
906 | 955 | <tbody>'; |
956 | + } |
|
907 | 957 | |
908 | 958 | // Print each message out... |
909 | 959 | foreach ($context['personal_messages'] as $message) |
@@ -923,12 +973,14 @@ discard block |
||
923 | 973 | |
924 | 974 | // Show the recipients. |
925 | 975 | // @todo This doesn't deal with the sent item searching quite right for bcc. |
926 | - if (!empty($message['recipients']['to'])) |
|
927 | - echo implode(', ', $message['recipients']['to']); |
|
976 | + if (!empty($message['recipients']['to'])) { |
|
977 | + echo implode(', ', $message['recipients']['to']); |
|
978 | + } |
|
928 | 979 | |
929 | 980 | // Otherwise, we're just going to say "some people"... |
930 | - elseif ($context['folder'] != 'sent') |
|
931 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
981 | + elseif ($context['folder'] != 'sent') { |
|
982 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
983 | + } |
|
932 | 984 | |
933 | 985 | echo ' |
934 | 986 | </h3> |
@@ -943,15 +995,17 @@ discard block |
||
943 | 995 | $reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"'); |
944 | 996 | |
945 | 997 | // You can only reply if they are not a guest... |
946 | - if (!$message['member']['is_guest']) |
|
947 | - echo ' |
|
998 | + if (!$message['member']['is_guest']) { |
|
999 | + echo ' |
|
948 | 1000 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], ' |
949 | 1001 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator']; |
1002 | + } |
|
950 | 1003 | |
951 | 1004 | // This is for "forwarding" - even if the member is gone. |
952 | - else |
|
953 | - echo ' |
|
1005 | + else { |
|
1006 | + echo ' |
|
954 | 1007 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator']; |
1008 | + } |
|
955 | 1009 | } |
956 | 1010 | |
957 | 1011 | echo ' |
@@ -960,27 +1014,30 @@ discard block |
||
960 | 1014 | } |
961 | 1015 | // Otherwise just a simple list! |
962 | 1016 | // @todo No context at all of the search? |
963 | - else |
|
964 | - echo ' |
|
1017 | + else { |
|
1018 | + echo ' |
|
965 | 1019 | <tr class="windowbg"> |
966 | 1020 | <td>', $message['time'], '</td> |
967 | 1021 | <td>', $message['link'], '</td> |
968 | 1022 | <td>', $message['member']['link'], '</td> |
969 | 1023 | </tr>'; |
1024 | + } |
|
970 | 1025 | } |
971 | 1026 | |
972 | 1027 | // Finish off the page... |
973 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
974 | - echo ' |
|
1028 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
1029 | + echo ' |
|
975 | 1030 | </tbody> |
976 | 1031 | </table>'; |
1032 | + } |
|
977 | 1033 | |
978 | 1034 | // No results? |
979 | - if (empty($context['personal_messages'])) |
|
980 | - echo ' |
|
1035 | + if (empty($context['personal_messages'])) { |
|
1036 | + echo ' |
|
981 | 1037 | <div class="windowbg"> |
982 | 1038 | <p class="centertext">', $txt['pm_search_none_found'], '</p> |
983 | 1039 | </div>'; |
1040 | + } |
|
984 | 1041 | |
985 | 1042 | echo ' |
986 | 1043 | <div class="pagesection"> |
@@ -1005,15 +1062,17 @@ discard block |
||
1005 | 1062 | </div> |
1006 | 1063 | <div class="windowbg">'; |
1007 | 1064 | |
1008 | - if (!empty($context['send_log']['sent'])) |
|
1009 | - foreach ($context['send_log']['sent'] as $log_entry) |
|
1065 | + if (!empty($context['send_log']['sent'])) { |
|
1066 | + foreach ($context['send_log']['sent'] as $log_entry) |
|
1010 | 1067 | echo ' |
1011 | 1068 | <span class="error">', $log_entry, '</span><br>'; |
1069 | + } |
|
1012 | 1070 | |
1013 | - if (!empty($context['send_log']['failed'])) |
|
1014 | - foreach ($context['send_log']['failed'] as $log_entry) |
|
1071 | + if (!empty($context['send_log']['failed'])) { |
|
1072 | + foreach ($context['send_log']['failed'] as $log_entry) |
|
1015 | 1073 | echo ' |
1016 | 1074 | <span class="error">', $log_entry, '</span><br>'; |
1075 | + } |
|
1017 | 1076 | |
1018 | 1077 | echo ' |
1019 | 1078 | </div> |
@@ -1061,12 +1120,13 @@ discard block |
||
1061 | 1120 | </dl> |
1062 | 1121 | </div>'; |
1063 | 1122 | |
1064 | - if (!empty($modSettings['drafts_pm_enabled'])) |
|
1065 | - echo ' |
|
1123 | + if (!empty($modSettings['drafts_pm_enabled'])) { |
|
1124 | + echo ' |
|
1066 | 1125 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
1067 | 1126 | sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' |
1068 | 1127 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
1069 | 1128 | </div>'; |
1129 | + } |
|
1070 | 1130 | |
1071 | 1131 | echo ' |
1072 | 1132 | <dl id="post_header">'; |
@@ -1132,22 +1192,24 @@ discard block |
||
1132 | 1192 | <dt><strong>', $txt['subject'], '</strong></dt> |
1133 | 1193 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
1134 | 1194 | |
1135 | - foreach ($context['drafts'] as $draft) |
|
1136 | - echo ' |
|
1195 | + foreach ($context['drafts'] as $draft) { |
|
1196 | + echo ' |
|
1137 | 1197 | <dt>', $draft['link'], '</dt> |
1138 | 1198 | <dd>', $draft['poster_time'], '</dd>'; |
1199 | + } |
|
1139 | 1200 | echo ' |
1140 | 1201 | </dl> |
1141 | 1202 | </div>'; |
1142 | 1203 | } |
1143 | 1204 | |
1144 | 1205 | // Require an image to be typed to save spamming? |
1145 | - if ($context['require_verification']) |
|
1146 | - echo ' |
|
1206 | + if ($context['require_verification']) { |
|
1207 | + echo ' |
|
1147 | 1208 | <div class="post_verification"> |
1148 | 1209 | <strong>', $txt['pm_visual_verification_label'], ':</strong> |
1149 | 1210 | ', template_control_verification($context['visual_verification_id'], 'all'), ' |
1150 | 1211 | </div>'; |
1212 | + } |
|
1151 | 1213 | |
1152 | 1214 | // Send, Preview, spellcheck buttons. |
1153 | 1215 | echo ' |
@@ -1265,8 +1327,8 @@ discard block |
||
1265 | 1327 | }'; |
1266 | 1328 | |
1267 | 1329 | // Code for showing and hiding drafts |
1268 | - if (!empty($context['drafts'])) |
|
1269 | - echo ' |
|
1330 | + if (!empty($context['drafts'])) { |
|
1331 | + echo ' |
|
1270 | 1332 | var oSwapDraftOptions = new smc_Toggle({ |
1271 | 1333 | bToggleEnabled: true, |
1272 | 1334 | bCurrentlyCollapsed: true, |
@@ -1288,13 +1350,14 @@ discard block |
||
1288 | 1350 | } |
1289 | 1351 | ] |
1290 | 1352 | });'; |
1353 | + } |
|
1291 | 1354 | |
1292 | 1355 | echo ' |
1293 | 1356 | </script>'; |
1294 | 1357 | |
1295 | 1358 | // Show the message you're replying to. |
1296 | - if ($context['reply']) |
|
1297 | - echo ' |
|
1359 | + if ($context['reply']) { |
|
1360 | + echo ' |
|
1298 | 1361 | <br><br> |
1299 | 1362 | <div class="cat_bar"> |
1300 | 1363 | <h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3> |
@@ -1308,6 +1371,7 @@ discard block |
||
1308 | 1371 | ', $context['quoted_message']['body'], ' |
1309 | 1372 | </div> |
1310 | 1373 | <br class="clear">'; |
1374 | + } |
|
1311 | 1375 | |
1312 | 1376 | echo ' |
1313 | 1377 | <script> |
@@ -1319,23 +1383,25 @@ discard block |
||
1319 | 1383 | sToControlId: \'to_control\', |
1320 | 1384 | aToRecipients: ['; |
1321 | 1385 | |
1322 | - foreach ($context['recipients']['to'] as $i => $member) |
|
1323 | - echo ' |
|
1386 | + foreach ($context['recipients']['to'] as $i => $member) { |
|
1387 | + echo ' |
|
1324 | 1388 | { |
1325 | 1389 | sItemId: ', JavaScriptEscape($member['id']), ', |
1326 | 1390 | sItemName: ', JavaScriptEscape($member['name']), ' |
1327 | 1391 | }', $i == count($context['recipients']['to']) - 1 ? '' : ','; |
1392 | + } |
|
1328 | 1393 | |
1329 | 1394 | echo ' |
1330 | 1395 | ], |
1331 | 1396 | aBccRecipients: ['; |
1332 | 1397 | |
1333 | - foreach ($context['recipients']['bcc'] as $i => $member) |
|
1334 | - echo ' |
|
1398 | + foreach ($context['recipients']['bcc'] as $i => $member) { |
|
1399 | + echo ' |
|
1335 | 1400 | { |
1336 | 1401 | sItemId: ', JavaScriptEscape($member['id']), ', |
1337 | 1402 | sItemName: ', JavaScriptEscape($member['name']), ' |
1338 | 1403 | }', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; |
1404 | + } |
|
1339 | 1405 | |
1340 | 1406 | echo ' |
1341 | 1407 | ], |
@@ -1424,26 +1490,28 @@ discard block |
||
1424 | 1490 | </th> |
1425 | 1491 | <th class="centertext table_icon">'; |
1426 | 1492 | |
1427 | - if (count($context['labels']) > 2) |
|
1428 | - echo ' |
|
1493 | + if (count($context['labels']) > 2) { |
|
1494 | + echo ' |
|
1429 | 1495 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1496 | + } |
|
1430 | 1497 | |
1431 | 1498 | echo ' |
1432 | 1499 | </th> |
1433 | 1500 | </tr> |
1434 | 1501 | </thead> |
1435 | 1502 | <tbody>'; |
1436 | - if (count($context['labels']) < 2) |
|
1437 | - echo ' |
|
1503 | + if (count($context['labels']) < 2) { |
|
1504 | + echo ' |
|
1438 | 1505 | <tr class="windowbg"> |
1439 | 1506 | <td colspan="2">', $txt['pm_labels_no_exist'], '</td> |
1440 | 1507 | </tr>'; |
1441 | - else |
|
1508 | + } else |
|
1442 | 1509 | { |
1443 | 1510 | foreach ($context['labels'] as $label) |
1444 | 1511 | { |
1445 | - if ($label['id'] == -1) |
|
1446 | - continue; |
|
1512 | + if ($label['id'] == -1) { |
|
1513 | + continue; |
|
1514 | + } |
|
1447 | 1515 | |
1448 | 1516 | echo ' |
1449 | 1517 | <tr class="windowbg"> |
@@ -1458,12 +1526,13 @@ discard block |
||
1458 | 1526 | </tbody> |
1459 | 1527 | </table>'; |
1460 | 1528 | |
1461 | - if (!count($context['labels']) < 2) |
|
1462 | - echo ' |
|
1529 | + if (!count($context['labels']) < 2) { |
|
1530 | + echo ' |
|
1463 | 1531 | <div class="padding"> |
1464 | 1532 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
1465 | 1533 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure"> |
1466 | 1534 | </div>'; |
1535 | + } |
|
1467 | 1536 | |
1468 | 1537 | echo ' |
1469 | 1538 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1520,9 +1589,10 @@ discard block |
||
1520 | 1589 | <select name="id_admin"> |
1521 | 1590 | <option value="0">', $txt['pm_report_all_admins'], '</option>'; |
1522 | 1591 | |
1523 | - foreach ($context['admins'] as $id => $name) |
|
1524 | - echo ' |
|
1592 | + foreach ($context['admins'] as $id => $name) { |
|
1593 | + echo ' |
|
1525 | 1594 | <option value="', $id, '">', $name, '</option>'; |
1595 | + } |
|
1526 | 1596 | |
1527 | 1597 | echo ' |
1528 | 1598 | </select> |
@@ -1585,9 +1655,10 @@ discard block |
||
1585 | 1655 | </th> |
1586 | 1656 | <th class="centertext table_icon">'; |
1587 | 1657 | |
1588 | - if (!empty($context['rules'])) |
|
1589 | - echo ' |
|
1658 | + if (!empty($context['rules'])) { |
|
1659 | + echo ' |
|
1590 | 1660 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1661 | + } |
|
1591 | 1662 | |
1592 | 1663 | echo ' |
1593 | 1664 | </th> |
@@ -1595,16 +1666,17 @@ discard block |
||
1595 | 1666 | </thead> |
1596 | 1667 | <tbody>'; |
1597 | 1668 | |
1598 | - if (empty($context['rules'])) |
|
1599 | - echo ' |
|
1669 | + if (empty($context['rules'])) { |
|
1670 | + echo ' |
|
1600 | 1671 | <tr class="windowbg"> |
1601 | 1672 | <td colspan="2"> |
1602 | 1673 | ', $txt['pm_rules_none'], ' |
1603 | 1674 | </td> |
1604 | 1675 | </tr>'; |
1676 | + } |
|
1605 | 1677 | |
1606 | - foreach ($context['rules'] as $rule) |
|
1607 | - echo ' |
|
1678 | + foreach ($context['rules'] as $rule) { |
|
1679 | + echo ' |
|
1608 | 1680 | <tr class="windowbg"> |
1609 | 1681 | <td> |
1610 | 1682 | <a href="', $scripturl, '?action=pm;sa=manrules;add;rid=', $rule['id'], '">', $rule['name'], '</a> |
@@ -1613,6 +1685,7 @@ discard block |
||
1613 | 1685 | <input type="checkbox" name="delrule[', $rule['id'], ']"> |
1614 | 1686 | </td> |
1615 | 1687 | </tr>'; |
1688 | + } |
|
1616 | 1689 | |
1617 | 1690 | echo ' |
1618 | 1691 | </tbody> |
@@ -1620,14 +1693,16 @@ discard block |
||
1620 | 1693 | <div class="righttext"> |
1621 | 1694 | <a class="button" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>'; |
1622 | 1695 | |
1623 | - if (!empty($context['rules'])) |
|
1624 | - echo ' |
|
1696 | + if (!empty($context['rules'])) { |
|
1697 | + echo ' |
|
1625 | 1698 | [<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]'; |
1699 | + } |
|
1626 | 1700 | |
1627 | - if (!empty($context['rules'])) |
|
1628 | - echo ' |
|
1701 | + if (!empty($context['rules'])) { |
|
1702 | + echo ' |
|
1629 | 1703 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1630 | 1704 | <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">'; |
1705 | + } |
|
1631 | 1706 | |
1632 | 1707 | echo ' |
1633 | 1708 | </div> |
@@ -1649,14 +1724,16 @@ discard block |
||
1649 | 1724 | var groups = new Array() |
1650 | 1725 | var labels = new Array()'; |
1651 | 1726 | |
1652 | - foreach ($context['groups'] as $id => $title) |
|
1653 | - echo ' |
|
1727 | + foreach ($context['groups'] as $id => $title) { |
|
1728 | + echo ' |
|
1654 | 1729 | groups[', $id, '] = "', addslashes($title), '";'; |
1730 | + } |
|
1655 | 1731 | |
1656 | - foreach ($context['labels'] as $label) |
|
1657 | - if ($label['id'] != -1) |
|
1732 | + foreach ($context['labels'] as $label) { |
|
1733 | + if ($label['id'] != -1) |
|
1658 | 1734 | echo ' |
1659 | 1735 | labels[', ($label['id']), '] = "', addslashes($label['name']), '";'; |
1736 | + } |
|
1660 | 1737 | |
1661 | 1738 | echo ' |
1662 | 1739 | function addCriteriaOption() |
@@ -1671,8 +1748,9 @@ discard block |
||
1671 | 1748 | |
1672 | 1749 | setOuterHTML(document.getElementById("criteriaAddHere"), \'<br><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select> <span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value=""><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>'; |
1673 | 1750 | |
1674 | - foreach ($context['groups'] as $id => $group) |
|
1675 | - echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1751 | + foreach ($context['groups'] as $id => $group) { |
|
1752 | + echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1753 | + } |
|
1676 | 1754 | |
1677 | 1755 | echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\'); |
1678 | 1756 | } |
@@ -1689,9 +1767,10 @@ discard block |
||
1689 | 1767 | |
1690 | 1768 | setOuterHTML(document.getElementById("actionAddHere"), \'<br><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select> <span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>'; |
1691 | 1769 | |
1692 | - foreach ($context['labels'] as $label) |
|
1693 | - if ($label['id'] != -1) |
|
1770 | + foreach ($context['labels'] as $label) { |
|
1771 | + if ($label['id'] != -1) |
|
1694 | 1772 | echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>'; |
1773 | + } |
|
1695 | 1774 | |
1696 | 1775 | echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\'); |
1697 | 1776 | } |
@@ -1805,19 +1884,20 @@ discard block |
||
1805 | 1884 | $isFirst = true; |
1806 | 1885 | foreach ($context['rule']['criteria'] as $k => $criteria) |
1807 | 1886 | { |
1808 | - if (!$isFirst && $criteria['t'] == '') |
|
1809 | - echo '<div id="removeonjs1">'; |
|
1810 | - |
|
1811 | - elseif (!$isFirst) |
|
1812 | - echo '<br>'; |
|
1887 | + if (!$isFirst && $criteria['t'] == '') { |
|
1888 | + echo '<div id="removeonjs1">'; |
|
1889 | + } elseif (!$isFirst) { |
|
1890 | + echo '<br>'; |
|
1891 | + } |
|
1813 | 1892 | |
1814 | 1893 | echo ' |
1815 | 1894 | <select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();"> |
1816 | 1895 | <option value="">', $txt['pm_rule_criteria_pick'], ':</option>'; |
1817 | 1896 | |
1818 | - foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) |
|
1819 | - echo ' |
|
1897 | + foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) { |
|
1898 | + echo ' |
|
1820 | 1899 | <option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>'; |
1900 | + } |
|
1821 | 1901 | |
1822 | 1902 | echo ' |
1823 | 1903 | </select> |
@@ -1828,19 +1908,20 @@ discard block |
||
1828 | 1908 | <select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();"> |
1829 | 1909 | <option value="">', $txt['pm_rule_sel_group'], '</option>'; |
1830 | 1910 | |
1831 | - foreach ($context['groups'] as $id => $group) |
|
1832 | - echo ' |
|
1911 | + foreach ($context['groups'] as $id => $group) { |
|
1912 | + echo ' |
|
1833 | 1913 | <option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>'; |
1914 | + } |
|
1834 | 1915 | echo ' |
1835 | 1916 | </select> |
1836 | 1917 | </span>'; |
1837 | 1918 | |
1838 | 1919 | // If this is the dummy we add a means to hide for non js users. |
1839 | - if ($isFirst) |
|
1840 | - $isFirst = false; |
|
1841 | - |
|
1842 | - elseif ($criteria['t'] == '') |
|
1843 | - echo '</div><!-- .removeonjs1 -->'; |
|
1920 | + if ($isFirst) { |
|
1921 | + $isFirst = false; |
|
1922 | + } elseif ($criteria['t'] == '') { |
|
1923 | + echo '</div><!-- .removeonjs1 -->'; |
|
1924 | + } |
|
1844 | 1925 | } |
1845 | 1926 | |
1846 | 1927 | echo ' |
@@ -1863,10 +1944,11 @@ discard block |
||
1863 | 1944 | $isFirst = true; |
1864 | 1945 | foreach ($context['rule']['actions'] as $k => $action) |
1865 | 1946 | { |
1866 | - if (!$isFirst && $action['t'] == '') |
|
1867 | - echo '<div id="removeonjs2">'; |
|
1868 | - elseif (!$isFirst) |
|
1869 | - echo '<br>'; |
|
1947 | + if (!$isFirst && $action['t'] == '') { |
|
1948 | + echo '<div id="removeonjs2">'; |
|
1949 | + } elseif (!$isFirst) { |
|
1950 | + echo '<br>'; |
|
1951 | + } |
|
1870 | 1952 | |
1871 | 1953 | echo ' |
1872 | 1954 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
@@ -1878,20 +1960,21 @@ discard block |
||
1878 | 1960 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
1879 | 1961 | <option value="">', $txt['pm_rule_sel_label'], '</option>'; |
1880 | 1962 | |
1881 | - foreach ($context['labels'] as $label) |
|
1882 | - if ($label['id'] != -1) |
|
1963 | + foreach ($context['labels'] as $label) { |
|
1964 | + if ($label['id'] != -1) |
|
1883 | 1965 | echo ' |
1884 | 1966 | <option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>'; |
1967 | + } |
|
1885 | 1968 | |
1886 | 1969 | echo ' |
1887 | 1970 | </select> |
1888 | 1971 | </span>'; |
1889 | 1972 | |
1890 | - if ($isFirst) |
|
1891 | - $isFirst = false; |
|
1892 | - |
|
1893 | - elseif ($action['t'] == '') |
|
1894 | - echo '</div><!-- .removeonjs2 -->'; |
|
1973 | + if ($isFirst) { |
|
1974 | + $isFirst = false; |
|
1975 | + } elseif ($action['t'] == '') { |
|
1976 | + echo '</div><!-- .removeonjs2 -->'; |
|
1977 | + } |
|
1895 | 1978 | } |
1896 | 1979 | |
1897 | 1980 | echo ' |
@@ -1915,22 +1998,25 @@ discard block |
||
1915 | 1998 | echo ' |
1916 | 1999 | <script>'; |
1917 | 2000 | |
1918 | - foreach ($context['rule']['criteria'] as $k => $c) |
|
1919 | - echo ' |
|
2001 | + foreach ($context['rule']['criteria'] as $k => $c) { |
|
2002 | + echo ' |
|
1920 | 2003 | updateRuleDef(', $k, ');'; |
2004 | + } |
|
1921 | 2005 | |
1922 | - foreach ($context['rule']['actions'] as $k => $c) |
|
1923 | - echo ' |
|
2006 | + foreach ($context['rule']['actions'] as $k => $c) { |
|
2007 | + echo ' |
|
1924 | 2008 | updateActionDef(', $k, ');'; |
2009 | + } |
|
1925 | 2010 | |
1926 | 2011 | echo ' |
1927 | 2012 | rebuildRuleDesc();'; |
1928 | 2013 | |
1929 | 2014 | // If this isn't a new rule and we have JS enabled remove the JS compatibility stuff. |
1930 | - if ($context['rid']) |
|
1931 | - echo ' |
|
2015 | + if ($context['rid']) { |
|
2016 | + echo ' |
|
1932 | 2017 | document.getElementById("removeonjs1").style.display = "none"; |
1933 | 2018 | document.getElementById("removeonjs2").style.display = "none";'; |
2019 | + } |
|
1934 | 2020 | |
1935 | 2021 | echo ' |
1936 | 2022 | document.getElementById("addonjs1").style.display = ""; |
@@ -1958,12 +2044,12 @@ discard block |
||
1958 | 2044 | </div>'; |
1959 | 2045 | |
1960 | 2046 | // No drafts? Just show an informative message. |
1961 | - if (empty($context['drafts'])) |
|
1962 | - echo ' |
|
2047 | + if (empty($context['drafts'])) { |
|
2048 | + echo ' |
|
1963 | 2049 | <div class="windowbg centertext"> |
1964 | 2050 | ', $txt['draft_none'], ' |
1965 | 2051 | </div>'; |
1966 | - else |
|
2052 | + } else |
|
1967 | 2053 | { |
1968 | 2054 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
1969 | 2055 | foreach ($context['drafts'] as $draft) |
@@ -18,11 +18,12 @@ discard block |
||
18 | 18 | global $context, $txt, $scripturl; |
19 | 19 | |
20 | 20 | // Let them know the action was a success. |
21 | - if (!empty($context['report_post_action'])) |
|
22 | - echo ' |
|
21 | + if (!empty($context['report_post_action'])) { |
|
22 | + echo ' |
|
23 | 23 | <div class="infobox"> |
24 | 24 | ', $txt['report_action_' . $context['report_post_action']], ' |
25 | 25 | </div>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | echo ' |
28 | 29 | <form id="reported_posts" action="', $scripturl, '?action=moderate;area=reportedposts;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '"> |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | |
53 | 54 | // Prepare the comments... |
54 | 55 | $comments = array(); |
55 | - foreach ($report['comments'] as $comment) |
|
56 | - $comments[$comment['member']['id']] = $comment['member']['link']; |
|
56 | + foreach ($report['comments'] as $comment) { |
|
57 | + $comments[$comment['member']['id']] = $comment['member']['link']; |
|
58 | + } |
|
57 | 59 | |
58 | 60 | echo ' |
59 | 61 | ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), ' |
@@ -69,18 +71,21 @@ discard block |
||
69 | 71 | <li><a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>'; |
70 | 72 | |
71 | 73 | // Delete message button. |
72 | - if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards']))) |
|
73 | - echo ' |
|
74 | + if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards']))) { |
|
75 | + echo ' |
|
74 | 76 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'], '.0;msg=', $report['topic']['id_msg'], ';modcenter;', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['mc_reportedp_delete_confirm'], '" class="you_sure">', $delete_button, '</a></li>'; |
77 | + } |
|
75 | 78 | |
76 | 79 | // Ban this user button. |
77 | - if (!$report['closed'] && !empty($context['report_manage_bans'])) |
|
78 | - echo ' |
|
80 | + if (!$report['closed'] && !empty($context['report_manage_bans'])) { |
|
81 | + echo ' |
|
79 | 82 | <li><a href="', $scripturl, '?action=admin;area=ban;sa=add', (!empty($report['author']['id']) ? ';u=' . $report['author']['id'] : ';msg=' . $report['topic']['id_msg']), ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>'; |
83 | + } |
|
80 | 84 | |
81 | - if (!$context['view_closed']) |
|
82 | - echo ' |
|
85 | + if (!$context['view_closed']) { |
|
86 | + echo ' |
|
83 | 87 | <li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>'; |
88 | + } |
|
84 | 89 | |
85 | 90 | echo ' |
86 | 91 | </ul> |
@@ -88,18 +93,20 @@ discard block |
||
88 | 93 | } |
89 | 94 | |
90 | 95 | // Were none found? |
91 | - if (empty($context['reports'])) |
|
92 | - echo ' |
|
96 | + if (empty($context['reports'])) { |
|
97 | + echo ' |
|
93 | 98 | <div class="windowbg"> |
94 | 99 | <p class="centertext">', $txt['mc_reportedp_none_found'], '</p> |
95 | 100 | </div>'; |
101 | + } |
|
96 | 102 | |
97 | 103 | echo ' |
98 | 104 | <div class="pagesection">'; |
99 | 105 | |
100 | - if (!empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many']) |
|
101 | - echo ' |
|
106 | + if (!empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many']) { |
|
107 | + echo ' |
|
102 | 108 | <div class="pagelinks floatleft">' . $context['page_index'] . '</div>'; |
109 | + } |
|
103 | 110 | |
104 | 111 | echo ' |
105 | 112 | <div class="floatright">', !$context['view_closed'] ? ' |
@@ -130,18 +137,20 @@ discard block |
||
130 | 137 | <div class="modbox"> |
131 | 138 | <ul>'; |
132 | 139 | |
133 | - foreach ($context['reported_posts'] as $report) |
|
134 | - echo ' |
|
140 | + foreach ($context['reported_posts'] as $report) { |
|
141 | + echo ' |
|
135 | 142 | <li class="smalltext"> |
136 | 143 | <a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], ' |
137 | 144 | </li>'; |
145 | + } |
|
138 | 146 | |
139 | 147 | // Don't have any watched users right now? |
140 | - if (empty($context['reported_posts'])) |
|
141 | - echo ' |
|
148 | + if (empty($context['reported_posts'])) { |
|
149 | + echo ' |
|
142 | 150 | <li> |
143 | 151 | <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong> |
144 | 152 | </li>'; |
153 | + } |
|
145 | 154 | |
146 | 155 | echo ' |
147 | 156 | </ul> |
@@ -189,11 +198,12 @@ discard block |
||
189 | 198 | global $context, $scripturl, $txt; |
190 | 199 | |
191 | 200 | // Let them know the action was a success. |
192 | - if (!empty($context['report_post_action'])) |
|
193 | - echo ' |
|
201 | + if (!empty($context['report_post_action'])) { |
|
202 | + echo ' |
|
194 | 203 | <div class="infobox"> |
195 | 204 | ', $txt['report_action_' . $context['report_post_action']], ' |
196 | 205 | </div>'; |
206 | + } |
|
197 | 207 | |
198 | 208 | echo ' |
199 | 209 | <div id="modcenter"> |
@@ -229,14 +239,15 @@ discard block |
||
229 | 239 | <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3> |
230 | 240 | </div>'; |
231 | 241 | |
232 | - foreach ($context['report']['comments'] as $comment) |
|
233 | - echo ' |
|
242 | + foreach ($context['report']['comments'] as $comment) { |
|
243 | + echo ' |
|
234 | 244 | <div class="windowbg"> |
235 | 245 | <p class="smalltext"> |
236 | 246 | ', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), ' |
237 | 247 | </p> |
238 | 248 | <p>', $comment['message'], '</p> |
239 | 249 | </div>'; |
250 | + } |
|
240 | 251 | |
241 | 252 | echo ' |
242 | 253 | <br> |
@@ -245,11 +256,12 @@ discard block |
||
245 | 256 | </div> |
246 | 257 | <div>'; |
247 | 258 | |
248 | - if (empty($context['report']['mod_comments'])) |
|
249 | - echo ' |
|
259 | + if (empty($context['report']['mod_comments'])) { |
|
260 | + echo ' |
|
250 | 261 | <div class="information"> |
251 | 262 | <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p> |
252 | 263 | </div>'; |
264 | + } |
|
253 | 265 | |
254 | 266 | foreach ($context['report']['mod_comments'] as $comment) |
255 | 267 | { |
@@ -335,18 +347,20 @@ discard block |
||
335 | 347 | <div class="modbox"> |
336 | 348 | <ul>'; |
337 | 349 | |
338 | - foreach ($context['reported_members'] as $report) |
|
339 | - echo ' |
|
350 | + foreach ($context['reported_members'] as $report) { |
|
351 | + echo ' |
|
340 | 352 | <li class="smalltext"> |
341 | 353 | <a href="', $report['report_href'], '">', $report['user_name'], '</a> |
342 | 354 | </li>'; |
355 | + } |
|
343 | 356 | |
344 | 357 | // Don't have any reported members right now? |
345 | - if (empty($context['reported_members'])) |
|
346 | - echo ' |
|
358 | + if (empty($context['reported_members'])) { |
|
359 | + echo ' |
|
347 | 360 | <li> |
348 | 361 | <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong> |
349 | 362 | </li>'; |
363 | + } |
|
350 | 364 | |
351 | 365 | echo ' |
352 | 366 | </ul> |
@@ -394,11 +408,12 @@ discard block |
||
394 | 408 | global $context, $txt, $scripturl; |
395 | 409 | |
396 | 410 | // Let them know the action was a success. |
397 | - if (!empty($context['report_post_action']) && !empty($txt['report_action_' . $context['report_post_action']])) |
|
398 | - echo ' |
|
411 | + if (!empty($context['report_post_action']) && !empty($txt['report_action_' . $context['report_post_action']])) { |
|
412 | + echo ' |
|
399 | 413 | <div class="infobox"> |
400 | 414 | ', $txt['report_action_' . $context['report_post_action']], ' |
401 | 415 | </div>'; |
416 | + } |
|
402 | 417 | |
403 | 418 | echo ' |
404 | 419 | <form id="reported_members" action="', $scripturl, '?action=moderate;area=reportedmembers;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '"> |
@@ -430,8 +445,9 @@ discard block |
||
430 | 445 | |
431 | 446 | // Prepare the comments... |
432 | 447 | $comments = array(); |
433 | - foreach ($report['comments'] as $comment) |
|
434 | - $comments[$comment['member']['id']] = $comment['member']['link']; |
|
448 | + foreach ($report['comments'] as $comment) { |
|
449 | + $comments[$comment['member']['id']] = $comment['member']['link']; |
|
450 | + } |
|
435 | 451 | |
436 | 452 | echo ' |
437 | 453 | ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), ' |
@@ -443,13 +459,15 @@ discard block |
||
443 | 459 | <li><a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>'; |
444 | 460 | |
445 | 461 | // Ban this user button. |
446 | - if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id'])) |
|
447 | - echo ' |
|
462 | + if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id'])) { |
|
463 | + echo ' |
|
448 | 464 | <li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>'; |
465 | + } |
|
449 | 466 | |
450 | - if (!$context['view_closed']) |
|
451 | - echo ' |
|
467 | + if (!$context['view_closed']) { |
|
468 | + echo ' |
|
452 | 469 | <li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>'; |
470 | + } |
|
453 | 471 | |
454 | 472 | echo ' |
455 | 473 | </ul> |
@@ -457,11 +475,12 @@ discard block |
||
457 | 475 | } |
458 | 476 | |
459 | 477 | // Were none found? |
460 | - if (empty($context['reports'])) |
|
461 | - echo ' |
|
478 | + if (empty($context['reports'])) { |
|
479 | + echo ' |
|
462 | 480 | <div class="windowbg"> |
463 | 481 | <p class="centertext">', $txt['mc_reportedp_none_found'], '</p> |
464 | 482 | </div>'; |
483 | + } |
|
465 | 484 | |
466 | 485 | echo ' |
467 | 486 | <div class="pagesection"> |
@@ -482,11 +501,12 @@ discard block |
||
482 | 501 | global $context, $scripturl, $txt; |
483 | 502 | |
484 | 503 | // Let them know the action was a success. |
485 | - if (!empty($context['report_post_action'])) |
|
486 | - echo ' |
|
504 | + if (!empty($context['report_post_action'])) { |
|
505 | + echo ' |
|
487 | 506 | <div class="infobox"> |
488 | 507 | ', $txt['report_action_' . $context['report_post_action']], ' |
489 | 508 | </div>'; |
509 | + } |
|
490 | 510 | |
491 | 511 | echo ' |
492 | 512 | <div id="modcenter"> |
@@ -519,14 +539,15 @@ discard block |
||
519 | 539 | <h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3> |
520 | 540 | </div>'; |
521 | 541 | |
522 | - foreach ($context['report']['comments'] as $comment) |
|
523 | - echo ' |
|
542 | + foreach ($context['report']['comments'] as $comment) { |
|
543 | + echo ' |
|
524 | 544 | <div class="windowbg"> |
525 | 545 | <p class="smalltext"> |
526 | 546 | ', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), ' |
527 | 547 | </p> |
528 | 548 | <p>', $comment['message'], '</p> |
529 | 549 | </div>'; |
550 | + } |
|
530 | 551 | |
531 | 552 | echo ' |
532 | 553 | <br> |
@@ -535,11 +556,12 @@ discard block |
||
535 | 556 | </div> |
536 | 557 | <div>'; |
537 | 558 | |
538 | - if (empty($context['report']['mod_comments'])) |
|
539 | - echo ' |
|
559 | + if (empty($context['report']['mod_comments'])) { |
|
560 | + echo ' |
|
540 | 561 | <div class="information"> |
541 | 562 | <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p> |
542 | 563 | </div>'; |
564 | + } |
|
543 | 565 | |
544 | 566 | foreach ($context['report']['mod_comments'] as $comment) |
545 | 567 | { |
@@ -40,9 +40,10 @@ discard block |
||
40 | 40 | <option value="0000"', $context['holiday']['year'] == '0000' ? ' selected' : '', '>', $txt['every_year'], '</option>'; |
41 | 41 | |
42 | 42 | // Show a list of all the years we allow... |
43 | - for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++) |
|
44 | - echo ' |
|
43 | + for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++) { |
|
44 | + echo ' |
|
45 | 45 | <option value="', $year, '"', $year == $context['holiday']['year'] ? ' selected' : '', '>', $year, '</option>'; |
46 | + } |
|
46 | 47 | |
47 | 48 | echo ' |
48 | 49 | </select> |
@@ -50,9 +51,10 @@ discard block |
||
50 | 51 | <select name="month" id="month" onchange="generateDays();">'; |
51 | 52 | |
52 | 53 | // There are 12 months per year - ensure that they all get listed. |
53 | - for ($month = 1; $month <= 12; $month++) |
|
54 | - echo ' |
|
54 | + for ($month = 1; $month <= 12; $month++) { |
|
55 | + echo ' |
|
55 | 56 | <option value="', $month, '"', $month == $context['holiday']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>'; |
57 | + } |
|
56 | 58 | |
57 | 59 | echo ' |
58 | 60 | </select> |
@@ -60,23 +62,25 @@ discard block |
||
60 | 62 | <select name="day" id="day" onchange="generateDays();">'; |
61 | 63 | |
62 | 64 | // This prints out all the days in the current month - this changes dynamically as we switch months. |
63 | - for ($day = 1; $day <= $context['holiday']['last_day']; $day++) |
|
64 | - echo ' |
|
65 | + for ($day = 1; $day <= $context['holiday']['last_day']; $day++) { |
|
66 | + echo ' |
|
65 | 67 | <option value="', $day, '"', $day == $context['holiday']['day'] ? ' selected' : '', '>', $day, '</option>'; |
68 | + } |
|
66 | 69 | |
67 | 70 | echo ' |
68 | 71 | </select> |
69 | 72 | </dd> |
70 | 73 | </dl>'; |
71 | 74 | |
72 | - if ($context['is_new']) |
|
73 | - echo ' |
|
75 | + if ($context['is_new']) { |
|
76 | + echo ' |
|
74 | 77 | <input type="submit" value="', $txt['holidays_button_add'], '" class="button">'; |
75 | - else |
|
76 | - echo ' |
|
78 | + } else { |
|
79 | + echo ' |
|
77 | 80 | <input type="submit" name="edit" value="', $txt['holidays_button_edit'], '" class="button"> |
78 | 81 | <input type="submit" name="delete" value="', $txt['holidays_button_remove'], '" class="button"> |
79 | 82 | <input type="hidden" name="holiday" value="', $context['holiday']['id'], '">'; |
83 | + } |
|
80 | 84 | echo ' |
81 | 85 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
82 | 86 | </div><!-- .windowbg --> |
@@ -37,9 +37,10 @@ discard block |
||
37 | 37 | echo ' |
38 | 38 | <optgroup label="', $category['name'], '">'; |
39 | 39 | |
40 | - foreach ($category['boards'] as $board) |
|
41 | - echo ' |
|
40 | + foreach ($category['boards'] as $board) { |
|
41 | + echo ' |
|
42 | 42 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', $board['id'] == $context['current_board'] ? ' disabled' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=> ' : '', $board['name'], '</option>'; |
43 | + } |
|
43 | 44 | echo ' |
44 | 45 | </optgroup>'; |
45 | 46 | } |
@@ -70,9 +71,10 @@ discard block |
||
70 | 71 | </div><!-- .move_topic --> |
71 | 72 | </div><!-- .windowbg -->'; |
72 | 73 | |
73 | - if ($context['back_to_topic']) |
|
74 | - echo ' |
|
74 | + if ($context['back_to_topic']) { |
|
75 | + echo ' |
|
75 | 76 | <input type="hidden" name="goback" value="1">'; |
77 | + } |
|
76 | 78 | |
77 | 79 | echo ' |
78 | 80 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -125,10 +127,10 @@ discard block |
||
125 | 127 | <option value="86400">', $txt['two_months'], '</option> |
126 | 128 | </select> |
127 | 129 | </dd>'; |
128 | - } |
|
129 | - else |
|
130 | - echo ' |
|
130 | + } else { |
|
131 | + echo ' |
|
131 | 132 | <input type="hidden" name="redirect_expires" value="0">'; |
133 | + } |
|
132 | 134 | |
133 | 135 | echo ' |
134 | 136 | </dl> |
@@ -207,9 +209,10 @@ discard block |
||
207 | 209 | echo ' |
208 | 210 | <optgroup label="', $cat['name'], '">'; |
209 | 211 | |
210 | - foreach ($cat['boards'] as $board) |
|
211 | - echo ' |
|
212 | + foreach ($cat['boards'] as $board) { |
|
213 | + echo ' |
|
212 | 214 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], '</option>'; |
215 | + } |
|
213 | 216 | |
214 | 217 | echo ' |
215 | 218 | </optgroup>'; |
@@ -219,9 +222,9 @@ discard block |
||
219 | 222 | <input type="hidden" name="from" value="' . $context['origin_topic'] . '"> |
220 | 223 | <input type="submit" value="', $txt['go'], '" class="button"> |
221 | 224 | </form>'; |
225 | + } else { |
|
226 | + echo $txt['target_below']; |
|
222 | 227 | } |
223 | - else |
|
224 | - echo $txt['target_below']; |
|
225 | 228 | |
226 | 229 | echo ' </h4> |
227 | 230 | </div><!-- .title_bar --> |
@@ -239,12 +242,13 @@ discard block |
||
239 | 242 | |
240 | 243 | $merge_button = create_button('merge', 'merge', ''); |
241 | 244 | |
242 | - foreach ($context['topics'] as $topic) |
|
243 | - echo ' |
|
245 | + foreach ($context['topics'] as $topic) { |
|
246 | + echo ' |
|
244 | 247 | <li> |
245 | 248 | <a href="', $scripturl, '?action=mergetopics;sa=options;board=', $context['current_board'], '.0;from=', $context['origin_topic'], ';to=', $topic['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $merge_button, '</a> |
246 | 249 | <a href="', $scripturl, '?topic=', $topic['id'], '.0" target="_blank" rel="noopener">', $topic['subject'], '</a> ', $txt['started_by'], ' ', $topic['poster']['link'], ' |
247 | 250 | </li>'; |
251 | + } |
|
248 | 252 | |
249 | 253 | echo ' |
250 | 254 | </ul> |
@@ -255,9 +259,10 @@ discard block |
||
255 | 259 | </div>'; |
256 | 260 | } |
257 | 261 | // Just a nice "There aren't any topics" message |
258 | - else |
|
259 | - echo ' |
|
262 | + else { |
|
263 | + echo ' |
|
260 | 264 | <div class="windowbg">', $txt['topic_alert_none'], '</div>'; |
265 | + } |
|
261 | 266 | |
262 | 267 | echo ' |
263 | 268 | <br> |
@@ -307,8 +312,8 @@ discard block |
||
307 | 312 | </thead> |
308 | 313 | <tbody>'; |
309 | 314 | |
310 | - foreach ($context['topics'] as $topic) |
|
311 | - echo ' |
|
315 | + foreach ($context['topics'] as $topic) { |
|
316 | + echo ' |
|
312 | 317 | <tr class="windowbg"> |
313 | 318 | <td> |
314 | 319 | <input type="checkbox" name="topics[]" value="' . $topic['id'] . '" checked> |
@@ -328,6 +333,7 @@ discard block |
||
328 | 333 | <input type="checkbox" name="notifications[]" value="' . $topic['id'] . '" checked> |
329 | 334 | </td> |
330 | 335 | </tr>'; |
336 | + } |
|
331 | 337 | echo ' |
332 | 338 | </tbody> |
333 | 339 | </table> |
@@ -337,9 +343,10 @@ discard block |
||
337 | 343 | <legend>', $txt['merge_select_subject'], '</legend> |
338 | 344 | <select name="subject" onchange="this.form.custom_subject.style.display = (this.options[this.selectedIndex].value != 0) ? \'none\': \'\' ;">'; |
339 | 345 | |
340 | - foreach ($context['topics'] as $topic) |
|
341 | - echo ' |
|
346 | + foreach ($context['topics'] as $topic) { |
|
347 | + echo ' |
|
342 | 348 | <option value="', $topic['id'], '"' . ($topic['selected'] ? ' selected' : '') . '>', $topic['subject'], '</option>'; |
349 | + } |
|
343 | 350 | echo ' |
344 | 351 | <option value="0">', $txt['merge_custom_subject'], ':</option> |
345 | 352 | </select> |
@@ -358,11 +365,12 @@ discard block |
||
358 | 365 | <legend>', $txt['merge_select_target_board'], '</legend> |
359 | 366 | <ul>'; |
360 | 367 | |
361 | - foreach ($context['boards'] as $board) |
|
362 | - echo ' |
|
368 | + foreach ($context['boards'] as $board) { |
|
369 | + echo ' |
|
363 | 370 | <li> |
364 | 371 | <input type="radio" name="board" value="' . $board['id'] . '"' . ($board['selected'] ? ' checked' : '') . '> ' . $board['name'] . ' |
365 | 372 | </li>'; |
373 | + } |
|
366 | 374 | echo ' |
367 | 375 | </ul> |
368 | 376 | </fieldset>'; |
@@ -374,11 +382,12 @@ discard block |
||
374 | 382 | <legend>' . $txt['merge_select_poll'] . '</legend> |
375 | 383 | <ul>'; |
376 | 384 | |
377 | - foreach ($context['polls'] as $poll) |
|
378 | - echo ' |
|
385 | + foreach ($context['polls'] as $poll) { |
|
386 | + echo ' |
|
379 | 387 | <li> |
380 | 388 | <input type="radio" name="poll" value="' . $poll['id'] . '"' . ($poll['selected'] ? ' checked' : '') . '> ' . $poll['question'] . ' (' . $txt['topic'] . ': <a href="' . $scripturl . '?topic=' . $poll['topic']['id'] . '.0" target="_blank" rel="noopener">' . $poll['topic']['subject'] . '</a>) |
381 | 389 | </li>'; |
390 | + } |
|
382 | 391 | echo ' |
383 | 392 | <li> |
384 | 393 | <input type="radio" name="poll" value="-1"> (' . $txt['merge_no_poll'] . ') |
@@ -55,9 +55,10 @@ discard block |
||
55 | 55 | <legend>', $txt['membergroups_edit_select_group_type'], '</legend> |
56 | 56 | <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" checked onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>'; |
57 | 57 | |
58 | - if ($context['allow_protected']) |
|
59 | - echo ' |
|
58 | + if ($context['allow_protected']) { |
|
59 | + echo ' |
|
60 | 60 | <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>'; |
61 | + } |
|
61 | 62 | |
62 | 63 | echo ' |
63 | 64 | <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br> |
@@ -67,14 +68,15 @@ discard block |
||
67 | 68 | </dd>'; |
68 | 69 | } |
69 | 70 | |
70 | - if ($context['post_group'] || $context['undefined_group']) |
|
71 | - echo ' |
|
71 | + if ($context['post_group'] || $context['undefined_group']) { |
|
72 | + echo ' |
|
72 | 73 | <dt id="min_posts_text"> |
73 | 74 | <strong>', $txt['membergroups_min_posts'], ':</strong> |
74 | 75 | </dt> |
75 | 76 | <dd> |
76 | 77 | <input type="number" name="min_posts" id="min_posts_input" size="5"> |
77 | 78 | </dd>'; |
79 | + } |
|
78 | 80 | |
79 | 81 | if (!$context['post_group'] || !empty($modSettings['permission_enable_postgroups'])) |
80 | 82 | { |
@@ -92,9 +94,10 @@ discard block |
||
92 | 94 | <option value="-1">', $txt['membergroups_guests'], '</option> |
93 | 95 | <option value="0" selected>', $txt['membergroups_members'], '</option>'; |
94 | 96 | |
95 | - foreach ($context['groups'] as $group) |
|
96 | - echo ' |
|
97 | + foreach ($context['groups'] as $group) { |
|
98 | + echo ' |
|
97 | 99 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
100 | + } |
|
98 | 101 | |
99 | 102 | echo ' |
100 | 103 | </select> |
@@ -105,9 +108,10 @@ discard block |
||
105 | 108 | <option value="-1">', $txt['membergroups_guests'], '</option> |
106 | 109 | <option value="0" selected>', $txt['membergroups_members'], '</option>'; |
107 | 110 | |
108 | - foreach ($context['groups'] as $group) |
|
109 | - echo ' |
|
111 | + foreach ($context['groups'] as $group) { |
|
112 | + echo ' |
|
110 | 113 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
114 | + } |
|
111 | 115 | |
112 | 116 | echo ' |
113 | 117 | </select> |
@@ -139,8 +143,8 @@ discard block |
||
139 | 143 | <input type="submit" value="', $txt['membergroups_add_group'], '" class="button"> |
140 | 144 | </div><!-- .windowbg -->'; |
141 | 145 | |
142 | - if ($context['undefined_group']) |
|
143 | - echo ' |
|
146 | + if ($context['undefined_group']) { |
|
147 | + echo ' |
|
144 | 148 | <script> |
145 | 149 | function swapPostGroup(isChecked) |
146 | 150 | { |
@@ -150,6 +154,7 @@ discard block |
||
150 | 154 | } |
151 | 155 | swapPostGroup(', $context['post_group'] ? 'true' : 'false', '); |
152 | 156 | </script>'; |
157 | + } |
|
153 | 158 | |
154 | 159 | echo ' |
155 | 160 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -181,14 +186,15 @@ discard block |
||
181 | 186 | <input type="text" name="group_name" id="group_name_input" value="', $context['group']['editable_name'], '" size="30"> |
182 | 187 | </dd>'; |
183 | 188 | |
184 | - if ($context['group']['id'] != 3 && $context['group']['id'] != 4) |
|
185 | - echo ' |
|
189 | + if ($context['group']['id'] != 3 && $context['group']['id'] != 4) { |
|
190 | + echo ' |
|
186 | 191 | <dt id="group_desc_text"> |
187 | 192 | <label for="group_desc_input"><strong>', $txt['membergroups_edit_desc'], ':</strong></label> |
188 | 193 | </dt> |
189 | 194 | <dd> |
190 | 195 | <textarea name="group_desc" id="group_desc_input" rows="4" cols="40">', $context['group']['description'], '</textarea> |
191 | 196 | </dd>'; |
197 | + } |
|
192 | 198 | |
193 | 199 | // Group type... |
194 | 200 | if ($context['group']['allow_post_group']) |
@@ -202,9 +208,10 @@ discard block |
||
202 | 208 | <legend>', $txt['membergroups_edit_select_group_type'], '</legend> |
203 | 209 | <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0"', !$context['group']['is_post_group'] && $context['group']['type'] == 0 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>'; |
204 | 210 | |
205 | - if ($context['group']['allow_protected']) |
|
206 | - echo ' |
|
211 | + if ($context['group']['allow_protected']) { |
|
212 | + echo ' |
|
207 | 213 | <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1"', $context['group']['type'] == 1 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>'; |
214 | + } |
|
208 | 215 | |
209 | 216 | echo ' |
210 | 217 | <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2"', $context['group']['type'] == 2 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br> |
@@ -214,8 +221,8 @@ discard block |
||
214 | 221 | </dd>'; |
215 | 222 | } |
216 | 223 | |
217 | - if ($context['group']['id'] != 3 && $context['group']['id'] != 4) |
|
218 | - echo ' |
|
224 | + if ($context['group']['id'] != 3 && $context['group']['id'] != 4) { |
|
225 | + echo ' |
|
219 | 226 | <dt id="group_moderators_text"> |
220 | 227 | <label for="group_moderators"><strong>', $txt['moderators'], ':</strong></label> |
221 | 228 | </dt> |
@@ -233,6 +240,7 @@ discard block |
||
233 | 240 | <option value="2"', $context['group']['hidden'] == 2 ? ' selected' : '', '>', $txt['membergroups_edit_hidden_all'], '</option> |
234 | 241 | </select> |
235 | 242 | </dd>'; |
243 | + } |
|
236 | 244 | |
237 | 245 | // Can they inherit permissions? |
238 | 246 | if ($context['group']['id'] > 1 && $context['group']['id'] != 3) |
@@ -249,9 +257,10 @@ discard block |
||
249 | 257 | <option value="0"', $context['group']['inherited_from'] == 0 ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_members'], '</option>'; |
250 | 258 | |
251 | 259 | // For all the inheritable groups show an option. |
252 | - foreach ($context['inheritable_groups'] as $id => $group) |
|
253 | - echo ' |
|
260 | + foreach ($context['inheritable_groups'] as $id => $group) { |
|
261 | + echo ' |
|
254 | 262 | <option value="', $id, '"', $context['group']['inherited_from'] == $id ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $group, '</option>'; |
263 | + } |
|
255 | 264 | |
256 | 265 | echo ' |
257 | 266 | </select> |
@@ -259,8 +268,8 @@ discard block |
||
259 | 268 | </dd>'; |
260 | 269 | } |
261 | 270 | |
262 | - if ($context['group']['allow_post_group']) |
|
263 | - echo ' |
|
271 | + if ($context['group']['allow_post_group']) { |
|
272 | + echo ' |
|
264 | 273 | |
265 | 274 | <dt id="min_posts_text"> |
266 | 275 | <label for="min_posts_input"><strong>', $txt['membergroups_min_posts'], ':</strong></label> |
@@ -268,6 +277,7 @@ discard block |
||
268 | 277 | <dd> |
269 | 278 | <input type="number" name="min_posts" id="min_posts_input"', $context['group']['is_post_group'] ? ' value="' . $context['group']['min_posts'] . '"' : '', ' size="6"> |
270 | 279 | </dd>'; |
280 | + } |
|
271 | 281 | |
272 | 282 | echo ' |
273 | 283 | <dt> |
@@ -297,9 +307,10 @@ discard block |
||
297 | 307 | <select name="icon_image" id="icon_image_input">'; |
298 | 308 | |
299 | 309 | // For every possible icon, create an option. |
300 | - foreach ($context['possible_icons'] as $icon) |
|
301 | - echo ' |
|
310 | + foreach ($context['possible_icons'] as $icon) { |
|
311 | + echo ' |
|
302 | 312 | <option value="', $icon, '"', $context['group']['icon_image'] == $icon ? ' selected' : '', '>', $icon, '</option>'; |
313 | + } |
|
303 | 314 | |
304 | 315 | echo ' |
305 | 316 | </select> |
@@ -308,9 +319,10 @@ discard block |
||
308 | 319 | } |
309 | 320 | |
310 | 321 | // No? Hide the entire control. |
311 | - else |
|
312 | - echo ' |
|
322 | + else { |
|
323 | + echo ' |
|
313 | 324 | <input type="hidden" name="icon_image" value="">'; |
325 | + } |
|
314 | 326 | |
315 | 327 | echo ' |
316 | 328 | <dt> |
@@ -322,8 +334,8 @@ discard block |
||
322 | 334 | </dd>'; |
323 | 335 | |
324 | 336 | // Force 2FA for this membergroup? |
325 | - if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) |
|
326 | - echo ' |
|
337 | + if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) { |
|
338 | + echo ' |
|
327 | 339 | <dt> |
328 | 340 | <label for="group_tfa_force_input"><strong>', $txt['membergroups_tfa_force'], ':</strong></label><br> |
329 | 341 | <span class="smalltext">', $txt['membergroups_tfa_force_note'], '</span> |
@@ -331,6 +343,7 @@ discard block |
||
331 | 343 | <dd> |
332 | 344 | <input type="checkbox" name="group_tfa_force"', $context['group']['tfa_required'] ? ' checked' : '', '> |
333 | 345 | </dd>'; |
346 | + } |
|
334 | 347 | |
335 | 348 | if (!empty($context['categories'])) |
336 | 349 | { |
@@ -341,11 +354,11 @@ discard block |
||
341 | 354 | </dt> |
342 | 355 | <dd>'; |
343 | 356 | |
344 | - if (!empty($context['can_manage_boards'])) |
|
345 | - echo $txt['membergroups_can_manage_access']; |
|
346 | - |
|
347 | - else |
|
348 | - template_add_edit_group_boards_list(); |
|
357 | + if (!empty($context['can_manage_boards'])) { |
|
358 | + echo $txt['membergroups_can_manage_access']; |
|
359 | + } else { |
|
360 | + template_add_edit_group_boards_list(); |
|
361 | + } |
|
349 | 362 | |
350 | 363 | echo ' |
351 | 364 | </dd>'; |
@@ -375,20 +388,21 @@ discard block |
||
375 | 388 | sItemListContainerId: \'moderator_container\', |
376 | 389 | aListItems: ['; |
377 | 390 | |
378 | - foreach ($context['group']['moderators'] as $id_member => $member_name) |
|
379 | - echo ' |
|
391 | + foreach ($context['group']['moderators'] as $id_member => $member_name) { |
|
392 | + echo ' |
|
380 | 393 | { |
381 | 394 | sItemId: ', JavaScriptEscape($id_member), ', |
382 | 395 | sItemName: ', JavaScriptEscape($member_name), ' |
383 | 396 | }', $id_member == $context['group']['last_moderator_id'] ? '' : ','; |
397 | + } |
|
384 | 398 | |
385 | 399 | echo ' |
386 | 400 | ] |
387 | 401 | }); |
388 | 402 | </script>'; |
389 | 403 | |
390 | - if ($context['group']['allow_post_group']) |
|
391 | - echo ' |
|
404 | + if ($context['group']['allow_post_group']) { |
|
405 | + echo ' |
|
392 | 406 | <script> |
393 | 407 | function swapPostGroup(isChecked) |
394 | 408 | { |
@@ -436,7 +450,8 @@ discard block |
||
436 | 450 | |
437 | 451 | swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', '); |
438 | 452 | </script>'; |
439 | -} |
|
453 | + } |
|
454 | + } |
|
440 | 455 | |
441 | 456 | /** |
442 | 457 | * The template for determining which boards a group has access to. |
@@ -454,13 +469,13 @@ discard block |
||
454 | 469 | |
455 | 470 | foreach ($context['categories'] as $category) |
456 | 471 | { |
457 | - if (empty($modSettings['deny_boards_access'])) |
|
458 | - echo ' |
|
472 | + if (empty($modSettings['deny_boards_access'])) { |
|
473 | + echo ' |
|
459 | 474 | <li class="category"> |
460 | 475 | <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'new_group\'); return false;"><strong>', $category['name'], '</strong></a> |
461 | 476 | <ul>'; |
462 | - else |
|
463 | - echo ' |
|
477 | + } else { |
|
478 | + echo ' |
|
464 | 479 | <li class="category"> |
465 | 480 | <strong>', $category['name'], '</strong> |
466 | 481 | <span class="select_all_box"> |
@@ -473,16 +488,17 @@ discard block |
||
473 | 488 | </select> |
474 | 489 | </span> |
475 | 490 | <ul id="boards_list_', $category['id'], '">'; |
491 | + } |
|
476 | 492 | |
477 | 493 | foreach ($category['boards'] as $board) |
478 | 494 | { |
479 | - if (empty($modSettings['deny_boards_access'])) |
|
480 | - echo ' |
|
495 | + if (empty($modSettings['deny_boards_access'])) { |
|
496 | + echo ' |
|
481 | 497 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
482 | 498 | <input type="checkbox" name="boardaccess[', $board['id'], ']" id="brd', $board['id'], '" value="allow"', $board['allow'] ? ' checked' : '', '> <label for="brd', $board['id'], '">', $board['name'], '</label> |
483 | 499 | </li>'; |
484 | - else |
|
485 | - echo ' |
|
500 | + } else { |
|
501 | + echo ' |
|
486 | 502 | <li class="board" style="width:100%"> |
487 | 503 | <span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span> |
488 | 504 | <span style="width:50%;float:right"> |
@@ -491,6 +507,7 @@ discard block |
||
491 | 507 | <input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny"', $board['deny'] ? ' checked' : '', '> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label> |
492 | 508 | </span> |
493 | 509 | </li>'; |
510 | + } |
|
494 | 511 | } |
495 | 512 | |
496 | 513 | echo ' |
@@ -501,14 +518,14 @@ discard block |
||
501 | 518 | echo ' |
502 | 519 | </ul>'; |
503 | 520 | |
504 | - if (empty($modSettings['deny_boards_access'])) |
|
505 | - echo ' |
|
521 | + if (empty($modSettings['deny_boards_access'])) { |
|
522 | + echo ' |
|
506 | 523 | <br class="clear"><br> |
507 | 524 | <input type="checkbox" id="checkall_check" onclick="invertAll(this, this.form, \'boardaccess\');"> |
508 | 525 | <label for="checkall_check"><em>', $txt['check_all'], '</em></label> |
509 | 526 | </fieldset>'; |
510 | - else |
|
511 | - echo ' |
|
527 | + } else { |
|
528 | + echo ' |
|
512 | 529 | <br class="clear"> |
513 | 530 | <span class="select_all_box"> |
514 | 531 | <em>', $txt['all'], ': </em> |
@@ -524,15 +541,17 @@ discard block |
||
524 | 541 | }); |
525 | 542 | }); |
526 | 543 | </script>'; |
544 | + } |
|
527 | 545 | |
528 | - if ($collapse) |
|
529 | - echo ' |
|
546 | + if ($collapse) { |
|
547 | + echo ' |
|
530 | 548 | <a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'block\'; document.getElementById(\'visible_boards_link\').style.display = \'none\'; return false;" id="visible_boards_link" style="display: none;">[ ', $txt['membergroups_select_visible_boards'], ' ]</a> |
531 | 549 | <script> |
532 | 550 | document.getElementById("visible_boards_link").style.display = ""; |
533 | 551 | document.getElementById("visible_boards").style.display = "none"; |
534 | 552 | </script>'; |
535 | -} |
|
553 | + } |
|
554 | + } |
|
536 | 555 | |
537 | 556 | /** |
538 | 557 | * Templatine for viewing the members of a group. |
@@ -557,14 +576,15 @@ discard block |
||
557 | 576 | </dd>'; |
558 | 577 | |
559 | 578 | // Any description to show? |
560 | - if (!empty($context['group']['description'])) |
|
561 | - echo ' |
|
579 | + if (!empty($context['group']['description'])) { |
|
580 | + echo ' |
|
562 | 581 | <dt> |
563 | 582 | <strong>' . $txt['membergroups_members_description'] . ':</strong> |
564 | 583 | </dt> |
565 | 584 | <dd> |
566 | 585 | ', $context['group']['description'], ' |
567 | 586 | </dd>'; |
587 | + } |
|
568 | 588 | |
569 | 589 | echo ' |
570 | 590 | <dt> |
@@ -578,8 +598,9 @@ discard block |
||
578 | 598 | if (!empty($context['group']['moderators'])) |
579 | 599 | { |
580 | 600 | $moderators = array(); |
581 | - foreach ($context['group']['moderators'] as $moderator) |
|
582 | - $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>'; |
|
601 | + foreach ($context['group']['moderators'] as $moderator) { |
|
602 | + $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>'; |
|
603 | + } |
|
583 | 604 | |
584 | 605 | echo ' |
585 | 606 | <dt> |
@@ -604,9 +625,10 @@ discard block |
||
604 | 625 | <tr class="title_bar"> |
605 | 626 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>'; |
606 | 627 | |
607 | - if ($context['can_send_email']) |
|
608 | - echo ' |
|
628 | + if ($context['can_send_email']) { |
|
629 | + echo ' |
|
609 | 630 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>'; |
631 | + } |
|
610 | 632 | |
611 | 633 | echo ' |
612 | 634 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? '<span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th> |
@@ -615,20 +637,22 @@ discard block |
||
615 | 637 | <a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
616 | 638 | </th>'; |
617 | 639 | |
618 | - if (!empty($context['group']['assignable'])) |
|
619 | - echo ' |
|
640 | + if (!empty($context['group']['assignable'])) { |
|
641 | + echo ' |
|
620 | 642 | <th style="width: 4%"><input type="checkbox" onclick="invertAll(this, this.form);"></th>'; |
643 | + } |
|
621 | 644 | |
622 | 645 | echo ' |
623 | 646 | </tr> |
624 | 647 | </thead> |
625 | 648 | <tbody>'; |
626 | 649 | |
627 | - if (empty($context['members'])) |
|
628 | - echo ' |
|
650 | + if (empty($context['members'])) { |
|
651 | + echo ' |
|
629 | 652 | <tr class="windowbg"> |
630 | 653 | <td colspan="6">', $txt['membergroups_members_no_members'], '</td> |
631 | 654 | </tr>'; |
655 | + } |
|
632 | 656 | |
633 | 657 | foreach ($context['members'] as $member) |
634 | 658 | { |
@@ -636,20 +660,22 @@ discard block |
||
636 | 660 | <tr class="windowbg"> |
637 | 661 | <td>', $member['name'], '</td>'; |
638 | 662 | |
639 | - if ($context['can_send_email']) |
|
640 | - echo ' |
|
663 | + if ($context['can_send_email']) { |
|
664 | + echo ' |
|
641 | 665 | <td> |
642 | 666 | <a href="mailto:', $member['email'], '">', $member['email'], '</a> |
643 | 667 | </td>'; |
668 | + } |
|
644 | 669 | |
645 | 670 | echo ' |
646 | 671 | <td>', $member['last_online'], '</td> |
647 | 672 | <td>', $member['registered'], '</td> |
648 | 673 | <td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>'; |
649 | 674 | |
650 | - if (!empty($context['group']['assignable'])) |
|
651 | - echo ' |
|
675 | + if (!empty($context['group']['assignable'])) { |
|
676 | + echo ' |
|
652 | 677 | <td style="width: 4%"><input type="checkbox" name="rem[]" value="', $member['id'], '" ', ($context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : ''), '/></td>'; |
678 | + } |
|
653 | 679 | |
654 | 680 | echo ' |
655 | 681 | </tr>'; |
@@ -659,11 +685,12 @@ discard block |
||
659 | 685 | </tbody> |
660 | 686 | </table>'; |
661 | 687 | |
662 | - if (!empty($context['group']['assignable'])) |
|
663 | - echo ' |
|
688 | + if (!empty($context['group']['assignable'])) { |
|
689 | + echo ' |
|
664 | 690 | <div class="floatright"> |
665 | 691 | <input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button "> |
666 | 692 | </div>'; |
693 | + } |
|
667 | 694 | |
668 | 695 | echo ' |
669 | 696 | <div class="pagesection flow_hidden"> |
@@ -671,8 +698,8 @@ discard block |
||
671 | 698 | </div> |
672 | 699 | <br>'; |
673 | 700 | |
674 | - if (!empty($context['group']['assignable'])) |
|
675 | - echo ' |
|
701 | + if (!empty($context['group']['assignable'])) { |
|
702 | + echo ' |
|
676 | 703 | <div class="cat_bar"> |
677 | 704 | <h3 class="catbg">', $txt['membergroups_members_add_title'], '</h3> |
678 | 705 | </div> |
@@ -688,6 +715,7 @@ discard block |
||
688 | 715 | </dl> |
689 | 716 | <input type="submit" name="add" value="', $txt['membergroups_members_add'], '" class="button"> |
690 | 717 | </div>'; |
718 | + } |
|
691 | 719 | |
692 | 720 | echo ' |
693 | 721 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -695,8 +723,8 @@ discard block |
||
695 | 723 | </form> |
696 | 724 | </div><!-- #admincenter -->'; |
697 | 725 | |
698 | - if (!empty($context['group']['assignable'])) |
|
699 | - echo ' |
|
726 | + if (!empty($context['group']['assignable'])) { |
|
727 | + echo ' |
|
700 | 728 | <script> |
701 | 729 | var oAddMemberSuggest = new smc_AutoSuggest({ |
702 | 730 | sSelf: \'oAddMemberSuggest\', |
@@ -712,7 +740,8 @@ discard block |
||
712 | 740 | sItemListContainerId: \'toAddItemContainer\' |
713 | 741 | }); |
714 | 742 | </script>'; |
715 | -} |
|
743 | + } |
|
744 | + } |
|
716 | 745 | |
717 | 746 | /** |
718 | 747 | * Allow the moderator to enter a reason to each user being rejected. |
@@ -732,8 +761,8 @@ discard block |
||
732 | 761 | <dl class="settings">'; |
733 | 762 | |
734 | 763 | // Loop through and print out a reason box for each... |
735 | - foreach ($context['group_requests'] as $request) |
|
736 | - echo ' |
|
764 | + foreach ($context['group_requests'] as $request) { |
|
765 | + echo ' |
|
737 | 766 | <dt> |
738 | 767 | <strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong> |
739 | 768 | </dt> |
@@ -741,6 +770,7 @@ discard block |
||
741 | 770 | <input type="hidden" name="groupr[]" value="', $request['id'], '"> |
742 | 771 | <textarea name="groupreason[', $request['id'], ']" rows="3" cols="40"></textarea> |
743 | 772 | </dd>'; |
773 | + } |
|
744 | 774 | |
745 | 775 | echo ' |
746 | 776 | </dl> |
@@ -22,30 +22,32 @@ discard block |
||
22 | 22 | <div id="calendar">'; |
23 | 23 | |
24 | 24 | // Show the mini-blocks if they're enabled. |
25 | - if (empty($context['blocks_disabled'])) |
|
26 | - echo ' |
|
25 | + if (empty($context['blocks_disabled'])) { |
|
26 | + echo ' |
|
27 | 27 | <div id="month_grid"> |
28 | 28 | ', template_show_month_grid('prev', true), ' |
29 | 29 | ', template_show_month_grid('current', true), ' |
30 | 30 | ', template_show_month_grid('next', true), ' |
31 | 31 | </div>'; |
32 | + } |
|
32 | 33 | |
33 | 34 | // What view are we showing? |
34 | - if ($context['calendar_view'] == 'viewlist') |
|
35 | - echo ' |
|
35 | + if ($context['calendar_view'] == 'viewlist') { |
|
36 | + echo ' |
|
36 | 37 | <div id="main_grid"> |
37 | 38 | ', template_show_upcoming_list('main'), ' |
38 | 39 | </div>'; |
39 | - elseif ($context['calendar_view'] == 'viewweek') |
|
40 | - echo ' |
|
40 | + } elseif ($context['calendar_view'] == 'viewweek') { |
|
41 | + echo ' |
|
41 | 42 | <div id="main_grid"> |
42 | 43 | ', template_show_week_grid('main'), ' |
43 | 44 | </div>'; |
44 | - else |
|
45 | - echo ' |
|
45 | + } else { |
|
46 | + echo ' |
|
46 | 47 | <div id="main_grid"> |
47 | 48 | ', template_show_month_grid('main'), ' |
48 | 49 | </div>'; |
50 | + } |
|
49 | 51 | |
50 | 52 | // Close our wrapper. |
51 | 53 | echo ' |
@@ -64,20 +66,22 @@ discard block |
||
64 | 66 | global $context, $scripturl, $txt; |
65 | 67 | |
66 | 68 | // Bail out if we have nothing to work with |
67 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
68 | - return false; |
|
69 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
70 | + return false; |
|
71 | + } |
|
69 | 72 | |
70 | 73 | // Protect programmer sanity |
71 | 74 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
72 | 75 | |
73 | 76 | // Do we want a title? |
74 | - if (empty($calendar_data['disable_title'])) |
|
75 | - echo ' |
|
77 | + if (empty($calendar_data['disable_title'])) { |
|
78 | + echo ' |
|
76 | 79 | <div class="cat_bar"> |
77 | 80 | <h3 class="catbg centertext largetext"> |
78 | 81 | <a href="', $scripturl, '?action=calendar;viewlist;year=', $calendar_data['start_year'], ';month=', $calendar_data['start_month'], ';day=', $calendar_data['start_day'], '">', $txt['calendar_upcoming'], '</a> |
79 | 82 | </h3> |
80 | 83 | </div>'; |
84 | + } |
|
81 | 85 | |
82 | 86 | // Give the user some controls to work with |
83 | 87 | template_calendar_top($calendar_data); |
@@ -100,11 +104,13 @@ discard block |
||
100 | 104 | <li class="windowbg"> |
101 | 105 | <strong class="event_title">', $event['link'], '</strong>'; |
102 | 106 | |
103 | - if ($event['can_edit']) |
|
104 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
107 | + if ($event['can_edit']) { |
|
108 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
109 | + } |
|
105 | 110 | |
106 | - if ($event['can_export']) |
|
107 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
111 | + if ($event['can_export']) { |
|
112 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
113 | + } |
|
108 | 114 | |
109 | 115 | echo ' |
110 | 116 | <br>'; |
@@ -112,14 +118,14 @@ discard block |
||
112 | 118 | if (!empty($event['allday'])) |
113 | 119 | { |
114 | 120 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
115 | - } |
|
116 | - else |
|
121 | + } else |
|
117 | 122 | { |
118 | 123 | // Display event info relative to user's local timezone |
119 | 124 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
120 | 125 | |
121 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
122 | - echo trim($event['end_date_local']) . ', '; |
|
126 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
127 | + echo trim($event['end_date_local']) . ', '; |
|
128 | + } |
|
123 | 129 | |
124 | 130 | echo trim($event['end_time_local']); |
125 | 131 | |
@@ -128,23 +134,27 @@ discard block |
||
128 | 134 | { |
129 | 135 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
130 | 136 | |
131 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
132 | - echo trim($event['start_date_orig']), ', '; |
|
137 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
138 | + echo trim($event['start_date_orig']), ', '; |
|
139 | + } |
|
133 | 140 | |
134 | 141 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
135 | 142 | |
136 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
137 | - echo trim($event['end_date_orig']) . ', '; |
|
143 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
144 | + echo trim($event['end_date_orig']) . ', '; |
|
145 | + } |
|
138 | 146 | |
139 | 147 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
140 | 148 | } |
141 | 149 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
142 | - else |
|
143 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
150 | + else { |
|
151 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
152 | + } |
|
144 | 153 | } |
145 | 154 | |
146 | - if (!empty($event['location'])) |
|
147 | - echo '<br>', $event['location']; |
|
155 | + if (!empty($event['location'])) { |
|
156 | + echo '<br>', $event['location']; |
|
157 | + } |
|
148 | 158 | |
149 | 159 | echo ' |
150 | 160 | </li>'; |
@@ -176,8 +186,9 @@ discard block |
||
176 | 186 | |
177 | 187 | $birthdays = array(); |
178 | 188 | |
179 | - foreach ($date as $member) |
|
180 | - $birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>'; |
|
189 | + foreach ($date as $member) { |
|
190 | + $birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>'; |
|
191 | + } |
|
181 | 192 | |
182 | 193 | echo implode(', ', $birthdays); |
183 | 194 | |
@@ -208,8 +219,9 @@ discard block |
||
208 | 219 | $date_local = $date['date_local']; |
209 | 220 | unset($date['date_local']); |
210 | 221 | |
211 | - foreach ($date as $holiday) |
|
212 | - $holidays[] = $holiday . ' (' . $date_local . ')'; |
|
222 | + foreach ($date as $holiday) { |
|
223 | + $holidays[] = $holiday . ' (' . $date_local . ')'; |
|
224 | + } |
|
213 | 225 | } |
214 | 226 | |
215 | 227 | echo implode(', ', $holidays); |
@@ -233,17 +245,19 @@ discard block |
||
233 | 245 | global $context, $txt, $scripturl, $modSettings; |
234 | 246 | |
235 | 247 | // If the grid doesn't exist, no point in proceeding. |
236 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
237 | - return false; |
|
248 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
249 | + return false; |
|
250 | + } |
|
238 | 251 | |
239 | 252 | // A handy little pointer variable. |
240 | 253 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
241 | 254 | |
242 | 255 | // Some conditions for whether or not we should show the week links *here*. |
243 | - if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) |
|
244 | - $show_week_links = true; |
|
245 | - else |
|
246 | - $show_week_links = false; |
|
256 | + if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) { |
|
257 | + $show_week_links = true; |
|
258 | + } else { |
|
259 | + $show_week_links = false; |
|
260 | + } |
|
247 | 261 | |
248 | 262 | // Assuming that we've not disabled it, show the title block! |
249 | 263 | if (empty($calendar_data['disable_title'])) |
@@ -253,18 +267,20 @@ discard block |
||
253 | 267 | <h3 class="catbg centertext largetext">'; |
254 | 268 | |
255 | 269 | // Previous Link: If we're showing prev / next and it's not a mini-calendar. |
256 | - if (empty($calendar_data['previous_calendar']['disabled']) && $calendar_data['show_next_prev'] && $is_mini === false) |
|
257 | - echo ' |
|
270 | + if (empty($calendar_data['previous_calendar']['disabled']) && $calendar_data['show_next_prev'] && $is_mini === false) { |
|
271 | + echo ' |
|
258 | 272 | <span class="floatleft"> |
259 | 273 | <a href="', $calendar_data['previous_calendar']['href'], '">«</a> |
260 | 274 | </span>'; |
275 | + } |
|
261 | 276 | |
262 | 277 | // Next Link: if we're showing prev / next and it's not a mini-calendar. |
263 | - if (empty($calendar_data['next_calendar']['disabled']) && $calendar_data['show_next_prev'] && $is_mini === false) |
|
264 | - echo ' |
|
278 | + if (empty($calendar_data['next_calendar']['disabled']) && $calendar_data['show_next_prev'] && $is_mini === false) { |
|
279 | + echo ' |
|
265 | 280 | <span class="floatright"> |
266 | 281 | <a href="', $calendar_data['next_calendar']['href'], '">»</a> |
267 | 282 | </span>'; |
283 | + } |
|
268 | 284 | |
269 | 285 | // Arguably the most exciting part, the title! |
270 | 286 | echo ' |
@@ -274,8 +290,9 @@ discard block |
||
274 | 290 | } |
275 | 291 | |
276 | 292 | // Show the controls on main grids |
277 | - if ($is_mini === false) |
|
278 | - template_calendar_top($calendar_data); |
|
293 | + if ($is_mini === false) { |
|
294 | + template_calendar_top($calendar_data); |
|
295 | + } |
|
279 | 296 | |
280 | 297 | // Finally, the main calendar table. |
281 | 298 | echo ' |
@@ -288,14 +305,16 @@ discard block |
||
288 | 305 | <tr>'; |
289 | 306 | |
290 | 307 | // If we're showing week links, there's an extra column ahead of the week links, so let's think ahead and be prepared! |
291 | - if ($show_week_links === true) |
|
292 | - echo ' |
|
308 | + if ($show_week_links === true) { |
|
309 | + echo ' |
|
293 | 310 | <th></th>'; |
311 | + } |
|
294 | 312 | |
295 | 313 | // Now, loop through each actual day of the week. |
296 | - foreach ($calendar_data['week_days'] as $day) |
|
297 | - echo ' |
|
314 | + foreach ($calendar_data['week_days'] as $day) { |
|
315 | + echo ' |
|
298 | 316 | <th class="days" scope="col">', !empty($calendar_data['short_day_titles']) || $is_mini === true ? $txt['days_short'][$day] : $txt['days'][$day], '</th>'; |
317 | + } |
|
299 | 318 | |
300 | 319 | echo ' |
301 | 320 | </tr>'; |
@@ -313,11 +332,12 @@ discard block |
||
313 | 332 | <tr class="days_wrapper">'; |
314 | 333 | |
315 | 334 | // This is where we add the actual week link, if enabled on this location. |
316 | - if ($show_week_links === true) |
|
317 | - echo ' |
|
335 | + if ($show_week_links === true) { |
|
336 | + echo ' |
|
318 | 337 | <td class="windowbg weeks"> |
319 | 338 | <a href="', $scripturl, '?action=calendar;viewweek;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $week['days'][0]['day'], '" title="', $txt['calendar_view_week'], '">»</a> |
320 | 339 | </td>'; |
340 | + } |
|
321 | 341 | |
322 | 342 | // Now loop through each day in the week we're on. |
323 | 343 | foreach ($week['days'] as $day) |
@@ -333,27 +353,29 @@ discard block |
||
333 | 353 | // Additional classes are given for events, holidays, and birthdays. |
334 | 354 | if (!empty($day['events']) && !empty($calendar_data['highlight']['events'])) |
335 | 355 | { |
336 | - if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) |
|
337 | - $classes[] = 'events'; |
|
338 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) |
|
339 | - $classes[] = 'events'; |
|
356 | + if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) { |
|
357 | + $classes[] = 'events'; |
|
358 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) { |
|
359 | + $classes[] = 'events'; |
|
360 | + } |
|
340 | 361 | } |
341 | 362 | if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays'])) |
342 | 363 | { |
343 | - if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) |
|
344 | - $classes[] = 'holidays'; |
|
345 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) |
|
346 | - $classes[] = 'holidays'; |
|
364 | + if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) { |
|
365 | + $classes[] = 'holidays'; |
|
366 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) { |
|
367 | + $classes[] = 'holidays'; |
|
368 | + } |
|
347 | 369 | } |
348 | 370 | if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays'])) |
349 | 371 | { |
350 | - if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) |
|
351 | - $classes[] = 'birthdays'; |
|
352 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) |
|
353 | - $classes[] = 'birthdays'; |
|
372 | + if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) { |
|
373 | + $classes[] = 'birthdays'; |
|
374 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) { |
|
375 | + $classes[] = 'birthdays'; |
|
376 | + } |
|
354 | 377 | } |
355 | - } |
|
356 | - else |
|
378 | + } else |
|
357 | 379 | { |
358 | 380 | // Default Classes (either compact or comfortable and disabled). |
359 | 381 | $classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable'; |
@@ -371,25 +393,27 @@ discard block |
||
371 | 393 | $title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : ''; |
372 | 394 | |
373 | 395 | // The actual day number - be it a link, or just plain old text! |
374 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
375 | - echo ' |
|
396 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
397 | + echo ' |
|
376 | 398 | <a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
377 | - elseif ($is_mini) |
|
378 | - echo ' |
|
399 | + } elseif ($is_mini) { |
|
400 | + echo ' |
|
379 | 401 | <a href="', $scripturl, '?action=calendar;', $context['calendar_view'], ';year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
380 | - else |
|
381 | - echo ' |
|
402 | + } else { |
|
403 | + echo ' |
|
382 | 404 | <span class="day_text">', $title_prefix, $day['day'], '</span>'; |
405 | + } |
|
383 | 406 | |
384 | 407 | // A lot of stuff, we're not showing on mini-calendars to conserve space. |
385 | 408 | if ($is_mini === false) |
386 | 409 | { |
387 | 410 | // Holidays are always fun, let's show them! |
388 | - if (!empty($day['holidays'])) |
|
389 | - echo ' |
|
411 | + if (!empty($day['holidays'])) { |
|
412 | + echo ' |
|
390 | 413 | <div class="smalltext holiday"> |
391 | 414 | <span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), ' |
392 | 415 | </div>'; |
416 | + } |
|
393 | 417 | |
394 | 418 | // Happy Birthday Dear Member! |
395 | 419 | if (!empty($day['birthdays'])) |
@@ -407,15 +431,17 @@ discard block |
||
407 | 431 | echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] || ($count == 10 && $use_js_hide) ? '' : ', '; |
408 | 432 | |
409 | 433 | // 9...10! Let's stop there. |
410 | - if ($birthday_count == 10 && $use_js_hide) |
|
411 | - // !!TODO - Inline CSS and JavaScript should be moved. |
|
434 | + if ($birthday_count == 10 && $use_js_hide) { |
|
435 | + // !!TODO - Inline CSS and JavaScript should be moved. |
|
412 | 436 | echo '<span class="hidelink" id="bdhidelink_', $day['day'], '">...<br><a href="', $scripturl, '?action=calendar;month=', $calendar_data['current_month'], ';year=', $calendar_data['current_year'], ';showbd" onclick="document.getElementById(\'bdhide_', $day['day'], '\').style.display = \'\'; document.getElementById(\'bdhidelink_', $day['day'], '\').style.display = \'none\'; return false;">(', sprintf($txt['calendar_click_all'], count($day['birthdays'])), ')</a></span><span id="bdhide_', $day['day'], '" style="display: none;">, '; |
437 | + } |
|
413 | 438 | |
414 | 439 | ++$birthday_count; |
415 | 440 | } |
416 | - if ($use_js_hide) |
|
417 | - echo ' |
|
441 | + if ($use_js_hide) { |
|
442 | + echo ' |
|
418 | 443 | </span>'; |
444 | + } |
|
419 | 445 | |
420 | 446 | echo ' |
421 | 447 | </div><!-- .smalltext -->'; |
@@ -426,8 +452,9 @@ discard block |
||
426 | 452 | { |
427 | 453 | // Sort events by start time (all day events will be listed first) |
428 | 454 | uasort($day['events'], function($a, $b) { |
429 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
430 | - return 0; |
|
455 | + if ($a['start_timestamp'] == $b['start_timestamp']) { |
|
456 | + return 0; |
|
457 | + } |
|
431 | 458 | |
432 | 459 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
433 | 460 | }); |
@@ -447,20 +474,22 @@ discard block |
||
447 | 474 | ', $event['link'], '<br> |
448 | 475 | <span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">'; |
449 | 476 | |
450 | - if (!empty($event['start_time_local']) && $event['starts_today'] == true) |
|
451 | - echo trim(str_replace(':00 ', ' ', $event['start_time_local'])); |
|
452 | - elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) |
|
453 | - echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local'])); |
|
454 | - elseif (!empty($event['allday'])) |
|
455 | - echo $txt['calendar_allday']; |
|
477 | + if (!empty($event['start_time_local']) && $event['starts_today'] == true) { |
|
478 | + echo trim(str_replace(':00 ', ' ', $event['start_time_local'])); |
|
479 | + } elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) { |
|
480 | + echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local'])); |
|
481 | + } elseif (!empty($event['allday'])) { |
|
482 | + echo $txt['calendar_allday']; |
|
483 | + } |
|
456 | 484 | |
457 | 485 | echo ' |
458 | 486 | </span>'; |
459 | 487 | |
460 | - if (!empty($event['location'])) |
|
461 | - echo ' |
|
488 | + if (!empty($event['location'])) { |
|
489 | + echo ' |
|
462 | 490 | <br> |
463 | 491 | <span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
492 | + } |
|
464 | 493 | |
465 | 494 | if ($event['can_edit'] || $event['can_export']) |
466 | 495 | { |
@@ -468,18 +497,20 @@ discard block |
||
468 | 497 | <span class="modify_event_links">'; |
469 | 498 | |
470 | 499 | // If they can edit the event, show an icon they can click on.... |
471 | - if ($event['can_edit']) |
|
472 | - echo ' |
|
500 | + if ($event['can_edit']) { |
|
501 | + echo ' |
|
473 | 502 | <a class="modify_event" href="', $event['modify_href'], '"> |
474 | 503 | <span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span> |
475 | 504 | </a>'; |
505 | + } |
|
476 | 506 | |
477 | 507 | // Exporting! |
478 | - if ($event['can_export']) |
|
479 | - echo ' |
|
508 | + if ($event['can_export']) { |
|
509 | + echo ' |
|
480 | 510 | <a class="modify_event" href="', $event['export_href'], '"> |
481 | 511 | <span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span> |
482 | 512 | </a>'; |
513 | + } |
|
483 | 514 | |
484 | 515 | echo ' |
485 | 516 | </span><br class="clear">'; |
@@ -498,10 +529,11 @@ discard block |
||
498 | 529 | // Otherwise, assuming it's not a mini-calendar, we can show previous / next month days! |
499 | 530 | elseif ($is_mini === false) |
500 | 531 | { |
501 | - if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) |
|
502 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
503 | - elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) |
|
504 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
532 | + if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) { |
|
533 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
534 | + } elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) { |
|
535 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
536 | + } |
|
505 | 537 | } |
506 | 538 | |
507 | 539 | // Close this day and increase var count. |
@@ -531,8 +563,9 @@ discard block |
||
531 | 563 | global $context, $txt, $scripturl, $modSettings; |
532 | 564 | |
533 | 565 | // We might have no reason to proceed, if the variable isn't there. |
534 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
535 | - return false; |
|
566 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
567 | + return false; |
|
568 | + } |
|
536 | 569 | |
537 | 570 | // Handy pointer. |
538 | 571 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
@@ -549,22 +582,25 @@ discard block |
||
549 | 582 | <h3 class="catbg centertext largetext">'; |
550 | 583 | |
551 | 584 | // Previous Week Link... |
552 | - if (empty($calendar_data['previous_calendar']['disabled']) && !empty($calendar_data['show_next_prev'])) |
|
553 | - echo ' |
|
585 | + if (empty($calendar_data['previous_calendar']['disabled']) && !empty($calendar_data['show_next_prev'])) { |
|
586 | + echo ' |
|
554 | 587 | <span class="floatleft"> |
555 | 588 | <a href="', $calendar_data['previous_week']['href'], '">«</a> |
556 | 589 | </span>'; |
590 | + } |
|
557 | 591 | |
558 | 592 | // Next Week Link... |
559 | - if (empty($calendar_data['next_calendar']['disabled']) && !empty($calendar_data['show_next_prev'])) |
|
560 | - echo ' |
|
593 | + if (empty($calendar_data['next_calendar']['disabled']) && !empty($calendar_data['show_next_prev'])) { |
|
594 | + echo ' |
|
561 | 595 | <span class="floatright"> |
562 | 596 | <a href="', $calendar_data['next_week']['href'], '">»</a> |
563 | 597 | </span>'; |
598 | + } |
|
564 | 599 | |
565 | 600 | // The Month Title + Week Number... |
566 | - if (!empty($calendar_data['week_title'])) |
|
567 | - echo $calendar_data['week_title']; |
|
601 | + if (!empty($calendar_data['week_title'])) { |
|
602 | + echo $calendar_data['week_title']; |
|
603 | + } |
|
568 | 604 | |
569 | 605 | echo ' |
570 | 606 | </h3> |
@@ -605,11 +641,12 @@ discard block |
||
605 | 641 | <td class="', implode(' ', $classes), ' act_day">'; |
606 | 642 | |
607 | 643 | // Should the day number be a link? |
608 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
609 | - echo ' |
|
644 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
645 | + echo ' |
|
610 | 646 | <a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>'; |
611 | - else |
|
612 | - echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
647 | + } else { |
|
648 | + echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
649 | + } |
|
613 | 650 | |
614 | 651 | echo ' |
615 | 652 | </td> |
@@ -620,8 +657,9 @@ discard block |
||
620 | 657 | { |
621 | 658 | // Sort events by start time (all day events will be listed first) |
622 | 659 | uasort($day['events'], function($a, $b) { |
623 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
624 | - return 0; |
|
660 | + if ($a['start_timestamp'] == $b['start_timestamp']) { |
|
661 | + return 0; |
|
662 | + } |
|
625 | 663 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
626 | 664 | }); |
627 | 665 | |
@@ -635,35 +673,39 @@ discard block |
||
635 | 673 | echo $event['link'], '<br> |
636 | 674 | <span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">'; |
637 | 675 | |
638 | - if (!empty($event['start_time_local'])) |
|
639 | - echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' – ' . trim($event['end_time_local']) : ''; |
|
640 | - else |
|
641 | - echo $txt['calendar_allday']; |
|
676 | + if (!empty($event['start_time_local'])) { |
|
677 | + echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' – ' . trim($event['end_time_local']) : ''; |
|
678 | + } else { |
|
679 | + echo $txt['calendar_allday']; |
|
680 | + } |
|
642 | 681 | |
643 | 682 | echo ' |
644 | 683 | </span>'; |
645 | 684 | |
646 | - if (!empty($event['location'])) |
|
647 | - echo '<br> |
|
685 | + if (!empty($event['location'])) { |
|
686 | + echo '<br> |
|
648 | 687 | <span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
688 | + } |
|
649 | 689 | |
650 | 690 | if (!empty($event_icons_needed)) |
651 | 691 | { |
652 | 692 | echo ' <span class="modify_event_links">'; |
653 | 693 | |
654 | 694 | // If they can edit the event, show a star they can click on.... |
655 | - if (!empty($event['can_edit'])) |
|
656 | - echo ' |
|
695 | + if (!empty($event['can_edit'])) { |
|
696 | + echo ' |
|
657 | 697 | <a class="modify_event" href="', $event['modify_href'], '"> |
658 | 698 | <span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span> |
659 | 699 | </a>'; |
700 | + } |
|
660 | 701 | |
661 | 702 | // Can we export? Sweet. |
662 | - if (!empty($event['can_export'])) |
|
663 | - echo ' |
|
703 | + if (!empty($event['can_export'])) { |
|
704 | + echo ' |
|
664 | 705 | <a class="modify_event" href="', $event['export_href'], '"> |
665 | 706 | <span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span> |
666 | 707 | </a>'; |
708 | + } |
|
667 | 709 | |
668 | 710 | echo ' |
669 | 711 | </span><br class="clear">'; |
@@ -681,22 +723,23 @@ discard block |
||
681 | 723 | </div> |
682 | 724 | <br class="clear">'; |
683 | 725 | } |
684 | - } |
|
685 | - else |
|
726 | + } else |
|
686 | 727 | { |
687 | - if (!empty($context['can_post'])) |
|
688 | - echo ' |
|
728 | + if (!empty($context['can_post'])) { |
|
729 | + echo ' |
|
689 | 730 | <div class="week_add_event"> |
690 | 731 | <a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['calendar_post_event'], '</a> |
691 | 732 | </div>'; |
733 | + } |
|
692 | 734 | } |
693 | 735 | echo ' |
694 | 736 | </td> |
695 | 737 | <td class="', implode(' ', $classes), !empty($day['holidays']) ? ' holidays' : ' disabled', ' holiday_col" data-css-prefix="' . $txt['calendar_prompt'] . ' ">'; |
696 | 738 | |
697 | 739 | // Show any holidays! |
698 | - if (!empty($day['holidays'])) |
|
699 | - echo implode('<br>', $day['holidays']); |
|
740 | + if (!empty($day['holidays'])) { |
|
741 | + echo implode('<br>', $day['holidays']); |
|
742 | + } |
|
700 | 743 | |
701 | 744 | echo ' |
702 | 745 | </td> |
@@ -705,11 +748,12 @@ discard block |
||
705 | 748 | // Show any birthdays... |
706 | 749 | if (!empty($day['birthdays'])) |
707 | 750 | { |
708 | - foreach ($day['birthdays'] as $member) |
|
709 | - echo ' |
|
751 | + foreach ($day['birthdays'] as $member) { |
|
752 | + echo ' |
|
710 | 753 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['name'], '</a> |
711 | 754 | ', isset($member['age']) ? ' (' . $member['age'] . ')' : '', ' |
712 | 755 | ', $member['is_last'] ? '' : '<br>'; |
756 | + } |
|
713 | 757 | } |
714 | 758 | echo ' |
715 | 759 | </td> |
@@ -755,26 +799,27 @@ discard block |
||
755 | 799 | <input type="text" name="end_date" id="end_date" maxlength="10" value="', $calendar_data['end_date'], '" tabindex="', $context['tabindex']++, '" class="date_input end" data-type="date"> |
756 | 800 | <input type="submit" class="button" style="float:none" id="view_button" value="', $txt['view'], '"> |
757 | 801 | </form>'; |
758 | - } |
|
759 | - else |
|
802 | + } else |
|
760 | 803 | { |
761 | 804 | echo' |
762 | 805 | <form action="', $scripturl, '?action=calendar" id="calendar_navigation" method="post" accept-charset="', $context['character_set'], '"> |
763 | 806 | <select name="month" id="input_month">'; |
764 | 807 | |
765 | 808 | // Show a select box with all the months. |
766 | - foreach ($txt['months_short'] as $number => $month) |
|
767 | - echo ' |
|
809 | + foreach ($txt['months_short'] as $number => $month) { |
|
810 | + echo ' |
|
768 | 811 | <option value="', $number, '"', $number == $context['current_month'] ? ' selected' : '', '>', $month, '</option>'; |
812 | + } |
|
769 | 813 | |
770 | 814 | echo ' |
771 | 815 | </select> |
772 | 816 | <select name="year">'; |
773 | 817 | |
774 | 818 | // Show a link for every year... |
775 | - for ($year = $context['calendar_resources']['min_year']; $year <= $context['calendar_resources']['max_year']; $year++) |
|
776 | - echo ' |
|
819 | + for ($year = $context['calendar_resources']['min_year']; $year <= $context['calendar_resources']['max_year']; $year++) { |
|
820 | + echo ' |
|
777 | 821 | <option value="', $year, '"', $year == $context['current_year'] ? ' selected' : '', '>', $year, '</option>'; |
822 | + } |
|
778 | 823 | |
779 | 824 | echo ' |
780 | 825 | </select> |
@@ -796,9 +841,10 @@ discard block |
||
796 | 841 | echo ' |
797 | 842 | <form action="', $scripturl, '?action=calendar;sa=post" method="post" name="postevent" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);">'; |
798 | 843 | |
799 | - if (!empty($context['event']['new'])) |
|
800 | - echo ' |
|
844 | + if (!empty($context['event']['new'])) { |
|
845 | + echo ' |
|
801 | 846 | <input type="hidden" name="eventid" value="', $context['event']['eventid'], '">'; |
847 | + } |
|
802 | 848 | |
803 | 849 | // Start the main table. |
804 | 850 | echo ' |
@@ -809,8 +855,8 @@ discard block |
||
809 | 855 | </h3> |
810 | 856 | </div>'; |
811 | 857 | |
812 | - if (!empty($context['post_error']['messages'])) |
|
813 | - echo ' |
|
858 | + if (!empty($context['post_error']['messages'])) { |
|
859 | + echo ' |
|
814 | 860 | <div class="errorbox"> |
815 | 861 | <dl class="event_error"> |
816 | 862 | <dt> |
@@ -821,6 +867,7 @@ discard block |
||
821 | 867 | </dt> |
822 | 868 | </dl> |
823 | 869 | </div>'; |
870 | + } |
|
824 | 871 | |
825 | 872 | echo ' |
826 | 873 | <div class="roundframe noup"> |
@@ -848,9 +895,10 @@ discard block |
||
848 | 895 | echo ' |
849 | 896 | <optgroup label="', $category['name'], '">'; |
850 | 897 | |
851 | - foreach ($category['boards'] as $board) |
|
852 | - echo ' |
|
898 | + foreach ($category['boards'] as $board) { |
|
899 | + echo ' |
|
853 | 900 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], '</option>'; |
901 | + } |
|
854 | 902 | echo ' |
855 | 903 | </optgroup>'; |
856 | 904 | } |
@@ -886,9 +934,10 @@ discard block |
||
886 | 934 | <span class="label">', $txt['calendar_timezone'], '</span> |
887 | 935 | <select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>'; |
888 | 936 | |
889 | - foreach ($context['all_timezones'] as $tz => $tzname) |
|
890 | - echo ' |
|
937 | + foreach ($context['all_timezones'] as $tz => $tzname) { |
|
938 | + echo ' |
|
891 | 939 | <option', is_numeric($tz) ? ' value="" disabled' : ' value="' . $tz . '"', $tz === $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>'; |
940 | + } |
|
892 | 941 | |
893 | 942 | echo ' |
894 | 943 | </select> |
@@ -904,9 +953,10 @@ discard block |
||
904 | 953 | <input type="submit" value="', empty($context['event']['new']) ? $txt['save'] : $txt['post'], '" class="button">'; |
905 | 954 | |
906 | 955 | // Delete button? |
907 | - if (empty($context['event']['new'])) |
|
908 | - echo ' |
|
956 | + if (empty($context['event']['new'])) { |
|
957 | + echo ' |
|
909 | 958 | <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['calendar_confirm_delete'], '" class="button you_sure">'; |
959 | + } |
|
910 | 960 | |
911 | 961 | echo ' |
912 | 962 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -934,9 +984,10 @@ discard block |
||
934 | 984 | echo ' |
935 | 985 | <td style="padding-', $alt ? 'right' : 'left', ': 1.5em;">'; |
936 | 986 | |
937 | - foreach ($v as $i) |
|
938 | - echo ' |
|
987 | + foreach ($v as $i) { |
|
988 | + echo ' |
|
939 | 989 | <img src="', $context['offimg'], '" alt="" id="', $t, '_', $i, '"><br>'; |
990 | + } |
|
940 | 991 | |
941 | 992 | echo ' |
942 | 993 | </td>'; |
@@ -957,9 +1008,10 @@ discard block |
||
957 | 1008 | |
958 | 1009 | foreach ($context['clockicons'] as $t => $v) |
959 | 1010 | { |
960 | - foreach ($v as $i) |
|
961 | - echo ' |
|
1011 | + foreach ($v as $i) { |
|
1012 | + echo ' |
|
962 | 1013 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1014 | + } |
|
963 | 1015 | } |
964 | 1016 | |
965 | 1017 | echo ' |
@@ -984,13 +1036,14 @@ discard block |
||
984 | 1036 | |
985 | 1037 | foreach ($context['clockicons'] as $t => $v) |
986 | 1038 | { |
987 | - foreach ($v as $i) |
|
988 | - echo ' |
|
1039 | + foreach ($v as $i) { |
|
1040 | + echo ' |
|
989 | 1041 | if (', $t, ' >= ', $i, ') |
990 | 1042 | { |
991 | 1043 | turnon.push("', $t, '_', $i, '"); |
992 | 1044 | ', $t, ' -= ', $i, '; |
993 | 1045 | }'; |
1046 | + } |
|
994 | 1047 | } |
995 | 1048 | |
996 | 1049 | echo ' |
@@ -1034,9 +1087,10 @@ discard block |
||
1034 | 1087 | <tr class="windowbg"> |
1035 | 1088 | <td>'; |
1036 | 1089 | |
1037 | - foreach ($v as $i) |
|
1038 | - echo ' |
|
1090 | + foreach ($v as $i) { |
|
1091 | + echo ' |
|
1039 | 1092 | <img src="', $context['offimg'], '" alt="" id="', $t, '_', $i, '" style="padding: 2px;">'; |
1093 | + } |
|
1040 | 1094 | |
1041 | 1095 | echo ' |
1042 | 1096 | </td> |
@@ -1058,9 +1112,10 @@ discard block |
||
1058 | 1112 | |
1059 | 1113 | foreach ($context['clockicons'] as $t => $v) |
1060 | 1114 | { |
1061 | - foreach ($v as $i) |
|
1062 | - echo ' |
|
1115 | + foreach ($v as $i) { |
|
1116 | + echo ' |
|
1063 | 1117 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1118 | + } |
|
1064 | 1119 | } |
1065 | 1120 | |
1066 | 1121 | echo ' |
@@ -1077,13 +1132,14 @@ discard block |
||
1077 | 1132 | |
1078 | 1133 | foreach ($context['clockicons'] as $t => $v) |
1079 | 1134 | { |
1080 | - foreach ($v as $i) |
|
1081 | - echo ' |
|
1135 | + foreach ($v as $i) { |
|
1136 | + echo ' |
|
1082 | 1137 | if (', $t, ' >= ', $i, ') |
1083 | 1138 | { |
1084 | 1139 | turnon.push("', $t, '_', $i, '"); |
1085 | 1140 | ', $t, ' -= ', $i, '; |
1086 | 1141 | }'; |
1142 | + } |
|
1087 | 1143 | } |
1088 | 1144 | |
1089 | 1145 | echo ' |
@@ -1127,9 +1183,10 @@ discard block |
||
1127 | 1183 | <tr class="windowbg"> |
1128 | 1184 | <td>'; |
1129 | 1185 | |
1130 | - foreach ($v as $i) |
|
1131 | - echo ' |
|
1186 | + foreach ($v as $i) { |
|
1187 | + echo ' |
|
1132 | 1188 | <img src="', $context['offimg'], '" alt="" id="', $t, '_', $i, '" style="padding: 2px;">'; |
1189 | + } |
|
1133 | 1190 | |
1134 | 1191 | echo ' |
1135 | 1192 | </td> |
@@ -1145,9 +1202,10 @@ discard block |
||
1145 | 1202 | |
1146 | 1203 | foreach ($context['clockicons'] as $t => $v) |
1147 | 1204 | { |
1148 | - foreach ($v as $i) |
|
1149 | - echo ' |
|
1205 | + foreach ($v as $i) { |
|
1206 | + echo ' |
|
1150 | 1207 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1208 | + } |
|
1151 | 1209 | } |
1152 | 1210 | |
1153 | 1211 | echo ' |
@@ -1168,13 +1226,14 @@ discard block |
||
1168 | 1226 | |
1169 | 1227 | foreach ($context['clockicons'] as $t => $v) |
1170 | 1228 | { |
1171 | - foreach ($v as $i) |
|
1172 | - echo ' |
|
1229 | + foreach ($v as $i) { |
|
1230 | + echo ' |
|
1173 | 1231 | if (', $t, ' >= ', $i, ') |
1174 | 1232 | { |
1175 | 1233 | turnon.push("', $t, '_', $i, '"); |
1176 | 1234 | ', $t, ' -= ', $i, '; |
1177 | 1235 | }'; |
1236 | + } |
|
1178 | 1237 | } |
1179 | 1238 | |
1180 | 1239 | echo ' |
@@ -1218,9 +1277,10 @@ discard block |
||
1218 | 1277 | <tr class="windowbg"> |
1219 | 1278 | <td>'; |
1220 | 1279 | |
1221 | - foreach ($v as $i) |
|
1222 | - echo ' |
|
1280 | + foreach ($v as $i) { |
|
1281 | + echo ' |
|
1223 | 1282 | <img src="', $i ? $context['onimg'] : $context['offimg'], '" alt="" style="padding: 2px;">'; |
1283 | + } |
|
1224 | 1284 | |
1225 | 1285 | echo ' |
1226 | 1286 | </td> |
@@ -27,9 +27,10 @@ discard block |
||
27 | 27 | <h3 class="catbg"> |
28 | 28 | <span class="floatleft">', $txt['members_list'], '</span>'; |
29 | 29 | |
30 | - if (!isset($context['old_search'])) |
|
31 | - echo ' |
|
30 | + if (!isset($context['old_search'])) { |
|
31 | + echo ' |
|
32 | 32 | <span class="floatright">', $context['letter_links'], '</span>'; |
33 | + } |
|
33 | 34 | echo ' |
34 | 35 | </h3> |
35 | 36 | </div>'; |
@@ -44,20 +45,23 @@ discard block |
||
44 | 45 | foreach ($context['columns'] as $key => $column) |
45 | 46 | { |
46 | 47 | // @TODO maybe find something nicer? |
47 | - if ($key == 'email_address' && !$context['can_send_email']) |
|
48 | - continue; |
|
48 | + if ($key == 'email_address' && !$context['can_send_email']) { |
|
49 | + continue; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | // This is a selected column, so underline it or some such. |
51 | - if ($column['selected']) |
|
52 | - echo ' |
|
53 | + if ($column['selected']) { |
|
54 | + echo ' |
|
53 | 55 | <th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', ' selected" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . '> |
54 | 56 | <a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . '</a><span class="generic_icons sort_' . $context['sort_direction'] . '"></span></th>'; |
57 | + } |
|
55 | 58 | |
56 | 59 | // This is just some column... show the link and be done with it. |
57 | - else |
|
58 | - echo ' |
|
60 | + else { |
|
61 | + echo ' |
|
59 | 62 | <th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' style="width: ' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '> |
60 | 63 | ', $column['link'], '</th>'; |
64 | + } |
|
61 | 65 | } |
62 | 66 | |
63 | 67 | echo ' |
@@ -77,9 +81,10 @@ discard block |
||
77 | 81 | </td> |
78 | 82 | <td class="real_name lefttext">', $member['link'], '</td>'; |
79 | 83 | |
80 | - if (!isset($context['disabled_fields']['website'])) |
|
81 | - echo ' |
|
84 | + if (!isset($context['disabled_fields']['website'])) { |
|
85 | + echo ' |
|
82 | 86 | <td class="website_url centertext">', $member['website']['url'] != '' ? '<a href="' . $member['website']['url'] . '" target="_blank" rel="noopener"><span class="generic_icons www" title="' . $member['website']['title'] . '"></span></a>' : '', '</td>'; |
87 | + } |
|
83 | 88 | |
84 | 89 | // Group and date. |
85 | 90 | echo ' |
@@ -92,32 +97,35 @@ discard block |
||
92 | 97 | <td class="post_count centertext">', $member['posts'], '</td> |
93 | 98 | <td class="statsbar">'; |
94 | 99 | |
95 | - if (!empty($member['post_percent'])) |
|
96 | - echo ' |
|
100 | + if (!empty($member['post_percent'])) { |
|
101 | + echo ' |
|
97 | 102 | <div class="generic_bar"> |
98 | 103 | <div class="bar" style="width: ', $member['post_percent'], '%;"></div> |
99 | 104 | </div>'; |
105 | + } |
|
100 | 106 | |
101 | 107 | echo ' |
102 | 108 | </td>'; |
103 | 109 | } |
104 | 110 | |
105 | 111 | // Show custom fields marked to be shown here |
106 | - if (!empty($context['custom_profile_fields']['columns'])) |
|
107 | - foreach ($context['custom_profile_fields']['columns'] as $key => $column) |
|
112 | + if (!empty($context['custom_profile_fields']['columns'])) { |
|
113 | + foreach ($context['custom_profile_fields']['columns'] as $key => $column) |
|
108 | 114 | echo ' |
109 | 115 | <td class="' , $key , ' centertext">', $member['options'][$key], '</td>'; |
116 | + } |
|
110 | 117 | |
111 | 118 | echo ' |
112 | 119 | </tr>'; |
113 | 120 | } |
114 | 121 | } |
115 | 122 | // No members? |
116 | - else |
|
117 | - echo ' |
|
123 | + else { |
|
124 | + echo ' |
|
118 | 125 | <tr> |
119 | 126 | <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td> |
120 | 127 | </tr>'; |
128 | + } |
|
121 | 129 | |
122 | 130 | echo ' |
123 | 131 | </tbody> |
@@ -130,11 +138,12 @@ discard block |
||
130 | 138 | <div class="pagelinks floatleft">', $context['page_index'], '</div>'; |
131 | 139 | |
132 | 140 | // If it is displaying the result of a search show a "search again" link to edit their criteria. |
133 | - if (isset($context['old_search'])) |
|
134 | - echo ' |
|
141 | + if (isset($context['old_search'])) { |
|
142 | + echo ' |
|
135 | 143 | <div class="buttonlist floatright"> |
136 | 144 | <a class="button" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a> |
137 | 145 | </div>'; |
146 | + } |
|
138 | 147 | echo ' |
139 | 148 | </div> |
140 | 149 | </div><!-- #memberlist -->'; |
@@ -174,12 +183,13 @@ discard block |
||
174 | 183 | <dd> |
175 | 184 | <ul>'; |
176 | 185 | |
177 | - foreach ($context['search_fields'] as $id => $title) |
|
178 | - echo ' |
|
186 | + foreach ($context['search_fields'] as $id => $title) { |
|
187 | + echo ' |
|
179 | 188 | <li> |
180 | 189 | <input type="checkbox" name="fields[]" id="fields-', $id, '" value="', $id, '"', in_array($id, $context['search_defaults']) ? ' checked' : '', '> |
181 | 190 | <label for="fields-', $id, '">', $title, '</label> |
182 | 191 | </li>'; |
192 | + } |
|
183 | 193 | |
184 | 194 | echo ' |
185 | 195 | </ul> |