@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 4 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('Hacking attempt...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Interface cache_api_interface |
@@ -182,8 +183,9 @@ discard block |
||
182 | 183 | { |
183 | 184 | global $cache_enable; |
184 | 185 | |
185 | - if ($test) |
|
186 | - return true; |
|
186 | + if ($test) { |
|
187 | + return true; |
|
188 | + } |
|
187 | 189 | return !empty($cache_enable); |
188 | 190 | } |
189 | 191 | |
@@ -202,18 +204,20 @@ discard block |
||
202 | 204 | global $boardurl, $cachedir; |
203 | 205 | |
204 | 206 | // Find a valid good file to do mtime checks on. |
205 | - if (file_exists($cachedir . '/' . 'index.php')) |
|
206 | - $filemtime = $cachedir . '/' . 'index.php'; |
|
207 | - elseif (is_dir($cachedir . '/')) |
|
208 | - $filemtime = $cachedir . '/'; |
|
209 | - else |
|
210 | - $filemtime = $boardurl . '/index.php'; |
|
207 | + if (file_exists($cachedir . '/' . 'index.php')) { |
|
208 | + $filemtime = $cachedir . '/' . 'index.php'; |
|
209 | + } elseif (is_dir($cachedir . '/')) { |
|
210 | + $filemtime = $cachedir . '/'; |
|
211 | + } else { |
|
212 | + $filemtime = $boardurl . '/index.php'; |
|
213 | + } |
|
211 | 214 | |
212 | 215 | // Set the default if no prefix was specified. |
213 | - if (empty($prefix)) |
|
214 | - $this->prefix = md5($boardurl . filemtime($filemtime)) . '-SMF-'; |
|
215 | - else |
|
216 | - $this->prefix = $prefix; |
|
216 | + if (empty($prefix)) { |
|
217 | + $this->prefix = md5($boardurl . filemtime($filemtime)) . '-SMF-'; |
|
218 | + } else { |
|
219 | + $this->prefix = $prefix; |
|
220 | + } |
|
217 | 221 | |
218 | 222 | return true; |
219 | 223 | } |
@@ -276,8 +280,9 @@ discard block |
||
276 | 280 | |
277 | 281 | // Invalidate cache, to be sure! |
278 | 282 | // ... as long as index.php can be modified, anyway. |
279 | - if (is_writable($cachedir . '/' . 'index.php')) |
|
280 | - @touch($cachedir . '/' . 'index.php'); |
|
283 | + if (is_writable($cachedir . '/' . 'index.php')) { |
|
284 | + @touch($cachedir . '/' . 'index.php'); |
|
285 | + } |
|
281 | 286 | |
282 | 287 | return true; |
283 | 288 | } |
@@ -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 | * Show the list of topics in this board, along with any child boards. |
@@ -56,8 +57,9 @@ discard block |
||
56 | 57 | |
57 | 58 | $context['name'] = $board_info['name']; |
58 | 59 | $context['description'] = $board_info['description']; |
59 | - if (!empty($board_info['description'])) |
|
60 | - $context['meta_description'] = strip_tags($board_info['description']); |
|
60 | + if (!empty($board_info['description'])) { |
|
61 | + $context['meta_description'] = strip_tags($board_info['description']); |
|
62 | + } |
|
61 | 63 | |
62 | 64 | // How many topics do we have in total? |
63 | 65 | $board_info['total_topics'] = allowedTo('approve_posts') ? $board_info['num_topics'] + $board_info['unapproved_topics'] : $board_info['num_topics'] + $board_info['unapproved_user_topics']; |
@@ -73,12 +75,14 @@ discard block |
||
73 | 75 | $session_name = session_name(); |
74 | 76 | foreach ($_GET as $k => $v) |
75 | 77 | { |
76 | - if (!in_array($k, array('board', 'start', $session_name))) |
|
77 | - $context['robot_no_index'] = true; |
|
78 | + if (!in_array($k, array('board', 'start', $session_name))) { |
|
79 | + $context['robot_no_index'] = true; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | } |
80 | - if (!empty($_REQUEST['start']) && (!is_numeric($_REQUEST['start']) || $_REQUEST['start'] % $context['messages_per_page'] != 0)) |
|
81 | - $context['robot_no_index'] = true; |
|
83 | + if (!empty($_REQUEST['start']) && (!is_numeric($_REQUEST['start']) || $_REQUEST['start'] % $context['messages_per_page'] != 0)) { |
|
84 | + $context['robot_no_index'] = true; |
|
85 | + } |
|
82 | 86 | |
83 | 87 | // If we can view unapproved messages and there are some build up a list. |
84 | 88 | if (allowedTo('approve_posts') && ($board_info['unapproved_topics'] || $board_info['unapproved_posts'])) |
@@ -89,14 +93,16 @@ discard block |
||
89 | 93 | } |
90 | 94 | |
91 | 95 | // We only know these. |
92 | - if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post', 'last_post'))) |
|
93 | - $_REQUEST['sort'] = 'last_post'; |
|
96 | + if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post', 'last_post'))) { |
|
97 | + $_REQUEST['sort'] = 'last_post'; |
|
98 | + } |
|
94 | 99 | |
95 | 100 | // Make sure the starting place makes sense and construct the page index. |
96 | - if (isset($_REQUEST['sort'])) |
|
97 | - $context['page_index'] = constructPageIndex($scripturl . '?board=' . $board . '.%1$d;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $board_info['total_topics'], $context['maxindex'], true); |
|
98 | - else |
|
99 | - $context['page_index'] = constructPageIndex($scripturl . '?board=' . $board . '.%1$d', $_REQUEST['start'], $board_info['total_topics'], $context['maxindex'], true); |
|
101 | + if (isset($_REQUEST['sort'])) { |
|
102 | + $context['page_index'] = constructPageIndex($scripturl . '?board=' . $board . '.%1$d;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $board_info['total_topics'], $context['maxindex'], true); |
|
103 | + } else { |
|
104 | + $context['page_index'] = constructPageIndex($scripturl . '?board=' . $board . '.%1$d', $_REQUEST['start'], $board_info['total_topics'], $context['maxindex'], true); |
|
105 | + } |
|
100 | 106 | $context['start'] = &$_REQUEST['start']; |
101 | 107 | |
102 | 108 | // Set a canonical URL for this page. |
@@ -132,14 +138,16 @@ discard block |
||
132 | 138 | $context['link_moderators'] = array(); |
133 | 139 | if (!empty($board_info['moderators'])) |
134 | 140 | { |
135 | - foreach ($board_info['moderators'] as $mod) |
|
136 | - $context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>'; |
|
141 | + foreach ($board_info['moderators'] as $mod) { |
|
142 | + $context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>'; |
|
143 | + } |
|
137 | 144 | } |
138 | 145 | if (!empty($board_info['moderator_groups'])) |
139 | 146 | { |
140 | 147 | // By default just tack the moderator groups onto the end of the members |
141 | - foreach ($board_info['moderator_groups'] as $mod_group) |
|
142 | - $context['link_moderators'][] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $mod_group['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod_group['name'] . '</a>'; |
|
148 | + foreach ($board_info['moderator_groups'] as $mod_group) { |
|
149 | + $context['link_moderators'][] = '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $mod_group['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod_group['name'] . '</a>'; |
|
150 | + } |
|
143 | 151 | } |
144 | 152 | |
145 | 153 | // Now we tack the info onto the end of the linktree |
@@ -191,20 +199,24 @@ discard block |
||
191 | 199 | ); |
192 | 200 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
193 | 201 | { |
194 | - if (empty($row['id_member'])) |
|
195 | - continue; |
|
202 | + if (empty($row['id_member'])) { |
|
203 | + continue; |
|
204 | + } |
|
196 | 205 | |
197 | - if (!empty($row['online_color'])) |
|
198 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
199 | - else |
|
200 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
206 | + if (!empty($row['online_color'])) { |
|
207 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
208 | + } else { |
|
209 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
210 | + } |
|
201 | 211 | |
202 | 212 | $is_buddy = in_array($row['id_member'], $user_info['buddies']); |
203 | - if ($is_buddy) |
|
204 | - $link = '<strong>' . $link . '</strong>'; |
|
213 | + if ($is_buddy) { |
|
214 | + $link = '<strong>' . $link . '</strong>'; |
|
215 | + } |
|
205 | 216 | |
206 | - if (!empty($row['show_online']) || allowedTo('moderate_forum')) |
|
207 | - $context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
|
217 | + if (!empty($row['show_online']) || allowedTo('moderate_forum')) { |
|
218 | + $context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
|
219 | + } |
|
208 | 220 | // @todo why are we filling this array of data that are just counted (twice) and discarded? ??? |
209 | 221 | $context['view_members'][$row['log_time'] . $row['member_name']] = array( |
210 | 222 | 'id' => $row['id_member'], |
@@ -217,8 +229,9 @@ discard block |
||
217 | 229 | 'hidden' => empty($row['show_online']), |
218 | 230 | ); |
219 | 231 | |
220 | - if (empty($row['show_online'])) |
|
221 | - $context['view_num_hidden']++; |
|
232 | + if (empty($row['show_online'])) { |
|
233 | + $context['view_num_hidden']++; |
|
234 | + } |
|
222 | 235 | } |
223 | 236 | $context['view_num_guests'] = $smcFunc['db_num_rows']($request) - count($context['view_members']); |
224 | 237 | $smcFunc['db_free_result']($request); |
@@ -260,8 +273,9 @@ discard block |
||
260 | 273 | // Bring in any changes we want to make before the query. |
261 | 274 | call_integration_hook('integrate_pre_messageindex', array(&$sort_methods)); |
262 | 275 | |
263 | - foreach ($sort_methods as $key => $val) |
|
264 | - $context['topics_headers'][$key] = '<a href="' . $scripturl . '?board=' . $context['current_board'] . '.' . $context['start'] . ';sort=' . $key . ($context['sort_by'] == $key && $context['sort_direction'] == 'up' ? ';desc' : '') . '">' . $txt[$key] . ($context['sort_by'] == $key ? '<span class="sort sort_' . $context['sort_direction'] . '"></span>' : '') . '</a>'; |
|
276 | + foreach ($sort_methods as $key => $val) { |
|
277 | + $context['topics_headers'][$key] = '<a href="' . $scripturl . '?board=' . $context['current_board'] . '.' . $context['start'] . ';sort=' . $key . ($context['sort_by'] == $key && $context['sort_direction'] == 'up' ? ';desc' : '') . '">' . $txt[$key] . ($context['sort_by'] == $key ? '<span class="sort sort_' . $context['sort_direction'] . '"></span>' : '') . '</a>'; |
|
278 | + } |
|
265 | 279 | |
266 | 280 | // Calculate the fastest way to get the topics. |
267 | 281 | $start = (int) $_REQUEST['start']; |
@@ -271,14 +285,15 @@ discard block |
||
271 | 285 | $fake_ascending = true; |
272 | 286 | $context['maxindex'] = $board_info['total_topics'] < $start + $context['maxindex'] + 1 ? $board_info['total_topics'] - $start : $context['maxindex']; |
273 | 287 | $start = $board_info['total_topics'] < $start + $context['maxindex'] + 1 ? 0 : $board_info['total_topics'] - $start - $context['maxindex']; |
288 | + } else { |
|
289 | + $fake_ascending = false; |
|
274 | 290 | } |
275 | - else |
|
276 | - $fake_ascending = false; |
|
277 | 291 | |
278 | 292 | // Setup the default topic icons... |
279 | 293 | $context['icon_sources'] = array(); |
280 | - foreach ($context['stable_icons'] as $icon) |
|
281 | - $context['icon_sources'][$icon] = 'images_url'; |
|
294 | + foreach ($context['stable_icons'] as $icon) { |
|
295 | + $context['icon_sources'][$icon] = 'images_url'; |
|
296 | + } |
|
282 | 297 | |
283 | 298 | $topic_ids = array(); |
284 | 299 | $context['topics'] = array(); |
@@ -316,8 +331,9 @@ discard block |
||
316 | 331 | $message_pre_index_parameters |
317 | 332 | ); |
318 | 333 | $topic_ids = array(); |
319 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
320 | - $topic_ids[] = $row['id_topic']; |
|
334 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
335 | + $topic_ids[] = $row['id_topic']; |
|
336 | + } |
|
321 | 337 | } |
322 | 338 | |
323 | 339 | // Grab the appropriate topic information... |
@@ -375,11 +391,13 @@ discard block |
||
375 | 391 | // Begin 'printing' the message index for current board. |
376 | 392 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
377 | 393 | { |
378 | - if ($row['id_poll'] > 0 && $modSettings['pollMode'] == '0') |
|
379 | - continue; |
|
394 | + if ($row['id_poll'] > 0 && $modSettings['pollMode'] == '0') { |
|
395 | + continue; |
|
396 | + } |
|
380 | 397 | |
381 | - if (!$pre_query) |
|
382 | - $topic_ids[] = $row['id_topic']; |
|
398 | + if (!$pre_query) { |
|
399 | + $topic_ids[] = $row['id_topic']; |
|
400 | + } |
|
383 | 401 | |
384 | 402 | // Reference the main color class. |
385 | 403 | $colorClass = 'windowbg'; |
@@ -389,8 +407,9 @@ discard block |
||
389 | 407 | { |
390 | 408 | // Limit them to $modSettings['preview_characters'] characters |
391 | 409 | $row['first_body'] = strip_tags(strtr(parse_bbc($row['first_body'], $row['first_smileys'], $row['id_first_msg']), array('<br>' => ' '))); |
392 | - if ($smcFunc['strlen']($row['first_body']) > $modSettings['preview_characters']) |
|
393 | - $row['first_body'] = $smcFunc['substr']($row['first_body'], 0, $modSettings['preview_characters']) . '...'; |
|
410 | + if ($smcFunc['strlen']($row['first_body']) > $modSettings['preview_characters']) { |
|
411 | + $row['first_body'] = $smcFunc['substr']($row['first_body'], 0, $modSettings['preview_characters']) . '...'; |
|
412 | + } |
|
394 | 413 | |
395 | 414 | // Censor the subject and message preview. |
396 | 415 | censorText($row['first_subject']); |
@@ -401,27 +420,27 @@ discard block |
||
401 | 420 | { |
402 | 421 | $row['last_subject'] = $row['first_subject']; |
403 | 422 | $row['last_body'] = $row['first_body']; |
404 | - } |
|
405 | - else |
|
423 | + } else |
|
406 | 424 | { |
407 | 425 | $row['last_body'] = strip_tags(strtr(parse_bbc($row['last_body'], $row['last_smileys'], $row['id_last_msg']), array('<br>' => ' '))); |
408 | - if ($smcFunc['strlen']($row['last_body']) > $modSettings['preview_characters']) |
|
409 | - $row['last_body'] = $smcFunc['substr']($row['last_body'], 0, $modSettings['preview_characters']) . '...'; |
|
426 | + if ($smcFunc['strlen']($row['last_body']) > $modSettings['preview_characters']) { |
|
427 | + $row['last_body'] = $smcFunc['substr']($row['last_body'], 0, $modSettings['preview_characters']) . '...'; |
|
428 | + } |
|
410 | 429 | |
411 | 430 | censorText($row['last_subject']); |
412 | 431 | censorText($row['last_body']); |
413 | 432 | } |
414 | - } |
|
415 | - else |
|
433 | + } else |
|
416 | 434 | { |
417 | 435 | $row['first_body'] = ''; |
418 | 436 | $row['last_body'] = ''; |
419 | 437 | censorText($row['first_subject']); |
420 | 438 | |
421 | - if ($row['id_first_msg'] == $row['id_last_msg']) |
|
422 | - $row['last_subject'] = $row['first_subject']; |
|
423 | - else |
|
424 | - censorText($row['last_subject']); |
|
439 | + if ($row['id_first_msg'] == $row['id_last_msg']) { |
|
440 | + $row['last_subject'] = $row['first_subject']; |
|
441 | + } else { |
|
442 | + censorText($row['last_subject']); |
|
443 | + } |
|
425 | 444 | } |
426 | 445 | |
427 | 446 | // Decide how many pages the topic should have. |
@@ -432,42 +451,50 @@ discard block |
||
432 | 451 | $pages = constructPageIndex($scripturl . '?topic=' . $row['id_topic'] . '.%1$d', $start, $row['num_replies'] + 1, $context['messages_per_page'], true, false); |
433 | 452 | |
434 | 453 | // If we can use all, show all. |
435 | - if (!empty($modSettings['enableAllMessages']) && $row['num_replies'] + 1 < $modSettings['enableAllMessages']) |
|
436 | - $pages .= ' <a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;all">' . $txt['all'] . '</a>'; |
|
454 | + if (!empty($modSettings['enableAllMessages']) && $row['num_replies'] + 1 < $modSettings['enableAllMessages']) { |
|
455 | + $pages .= ' <a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;all">' . $txt['all'] . '</a>'; |
|
456 | + } |
|
457 | + } else { |
|
458 | + $pages = ''; |
|
437 | 459 | } |
438 | - else |
|
439 | - $pages = ''; |
|
440 | 460 | |
441 | 461 | // We need to check the topic icons exist... |
442 | 462 | if (!empty($modSettings['messageIconChecks_enable'])) |
443 | 463 | { |
444 | - if (!isset($context['icon_sources'][$row['first_icon']])) |
|
445 | - $context['icon_sources'][$row['first_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['first_icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
446 | - if (!isset($context['icon_sources'][$row['last_icon']])) |
|
447 | - $context['icon_sources'][$row['last_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['last_icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
448 | - } |
|
449 | - else |
|
464 | + if (!isset($context['icon_sources'][$row['first_icon']])) { |
|
465 | + $context['icon_sources'][$row['first_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['first_icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
466 | + } |
|
467 | + if (!isset($context['icon_sources'][$row['last_icon']])) { |
|
468 | + $context['icon_sources'][$row['last_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['last_icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
469 | + } |
|
470 | + } else |
|
450 | 471 | { |
451 | - if (!isset($context['icon_sources'][$row['first_icon']])) |
|
452 | - $context['icon_sources'][$row['first_icon']] = 'images_url'; |
|
453 | - if (!isset($context['icon_sources'][$row['last_icon']])) |
|
454 | - $context['icon_sources'][$row['last_icon']] = 'images_url'; |
|
472 | + if (!isset($context['icon_sources'][$row['first_icon']])) { |
|
473 | + $context['icon_sources'][$row['first_icon']] = 'images_url'; |
|
474 | + } |
|
475 | + if (!isset($context['icon_sources'][$row['last_icon']])) { |
|
476 | + $context['icon_sources'][$row['last_icon']] = 'images_url'; |
|
477 | + } |
|
455 | 478 | } |
456 | 479 | |
457 | - if (!empty($board_info['recycle'])) |
|
458 | - $row['first_icon'] = 'recycled'; |
|
480 | + if (!empty($board_info['recycle'])) { |
|
481 | + $row['first_icon'] = 'recycled'; |
|
482 | + } |
|
459 | 483 | |
460 | 484 | // Is this topic pending approval, or does it have any posts pending approval? |
461 | - if ($context['can_approve_posts'] && $row['unapproved_posts']) |
|
462 | - $colorClass .= (!$row['approved'] ? ' approvetopic' : ' approvepost'); |
|
485 | + if ($context['can_approve_posts'] && $row['unapproved_posts']) { |
|
486 | + $colorClass .= (!$row['approved'] ? ' approvetopic' : ' approvepost'); |
|
487 | + } |
|
463 | 488 | |
464 | 489 | // Sticky topics should get a different color, too. |
465 | - if ($row['is_sticky']) |
|
466 | - $colorClass .= ' sticky'; |
|
490 | + if ($row['is_sticky']) { |
|
491 | + $colorClass .= ' sticky'; |
|
492 | + } |
|
467 | 493 | |
468 | 494 | // Locked topics get special treatment as well. |
469 | - if ($row['locked']) |
|
470 | - $colorClass .= ' locked'; |
|
495 | + if ($row['locked']) { |
|
496 | + $colorClass .= ' locked'; |
|
497 | + } |
|
471 | 498 | |
472 | 499 | // 'Print' the topic info. |
473 | 500 | $context['topics'][$row['id_topic']] = array_merge($row, array( |
@@ -548,8 +575,9 @@ discard block |
||
548 | 575 | $smcFunc['db_free_result']($result); |
549 | 576 | |
550 | 577 | // Fix the sequence of topics if they were retrieved in the wrong order. (for speed reasons...) |
551 | - if ($fake_ascending) |
|
552 | - $context['topics'] = array_reverse($context['topics'], true); |
|
578 | + if ($fake_ascending) { |
|
579 | + $context['topics'] = array_reverse($context['topics'], true); |
|
580 | + } |
|
553 | 581 | |
554 | 582 | if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest'] && !empty($topic_ids)) |
555 | 583 | { |
@@ -566,8 +594,9 @@ discard block |
||
566 | 594 | 'limit' => count($topic_ids), |
567 | 595 | ) |
568 | 596 | ); |
569 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
570 | - $context['topics'][$row['id_topic']]['is_posted_in'] = true; |
|
597 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
598 | + $context['topics'][$row['id_topic']]['is_posted_in'] = true; |
|
599 | + } |
|
571 | 600 | $smcFunc['db_free_result']($result); |
572 | 601 | } |
573 | 602 | } |
@@ -592,9 +621,9 @@ discard block |
||
592 | 621 | // Can we restore topics? |
593 | 622 | $context['can_restore'] = allowedTo('move_any') && !empty($board_info['recycle']); |
594 | 623 | |
595 | - if ($user_info['is_admin'] || $modSettings['topic_move_any']) |
|
596 | - $context['can_move_any'] = true; |
|
597 | - else |
|
624 | + if ($user_info['is_admin'] || $modSettings['topic_move_any']) { |
|
625 | + $context['can_move_any'] = true; |
|
626 | + } else |
|
598 | 627 | { |
599 | 628 | // We'll use this in a minute |
600 | 629 | $boards_allowed = boardsAllowedTo('post_new'); |
@@ -621,11 +650,13 @@ discard block |
||
621 | 650 | } |
622 | 651 | |
623 | 652 | // Can we use quick moderation checkboxes? |
624 | - if ($options['display_quick_mod'] == 1) |
|
625 | - $context['can_quick_mod'] = $context['user']['is_logged'] || $context['can_approve'] || $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move'] || $context['can_merge'] || $context['can_restore']; |
|
653 | + if ($options['display_quick_mod'] == 1) { |
|
654 | + $context['can_quick_mod'] = $context['user']['is_logged'] || $context['can_approve'] || $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move'] || $context['can_merge'] || $context['can_restore']; |
|
655 | + } |
|
626 | 656 | // Or the icons? |
627 | - else |
|
628 | - $context['can_quick_mod'] = $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move']; |
|
657 | + else { |
|
658 | + $context['can_quick_mod'] = $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move']; |
|
659 | + } |
|
629 | 660 | } |
630 | 661 | |
631 | 662 | if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1) |
@@ -659,13 +690,15 @@ discard block |
||
659 | 690 | ); |
660 | 691 | |
661 | 692 | // We've seen all these boards now! |
662 | - foreach ($board_info['parent_boards'] as $k => $dummy) |
|
663 | - if (isset($_SESSION['topicseen_cache'][$k])) |
|
693 | + foreach ($board_info['parent_boards'] as $k => $dummy) { |
|
694 | + if (isset($_SESSION['topicseen_cache'][$k])) |
|
664 | 695 | unset($_SESSION['topicseen_cache'][$k]); |
696 | + } |
|
665 | 697 | } |
666 | 698 | |
667 | - if (isset($_SESSION['topicseen_cache'][$board])) |
|
668 | - unset($_SESSION['topicseen_cache'][$board]); |
|
699 | + if (isset($_SESSION['topicseen_cache'][$board])) { |
|
700 | + unset($_SESSION['topicseen_cache'][$board]); |
|
701 | + } |
|
669 | 702 | |
670 | 703 | $request = $smcFunc['db_query']('', ' |
671 | 704 | SELECT id_topic, id_board, sent |
@@ -686,8 +719,9 @@ discard block |
||
686 | 719 | $context['is_marked_notify'] = true; |
687 | 720 | $board_sent = $row['sent']; |
688 | 721 | } |
689 | - if (!empty($row['id_topic'])) |
|
690 | - $context['topics'][$row['id_topic']]['is_watched'] = true; |
|
722 | + if (!empty($row['id_topic'])) { |
|
723 | + $context['topics'][$row['id_topic']]['is_watched'] = true; |
|
724 | + } |
|
691 | 725 | } |
692 | 726 | $smcFunc['db_free_result']($request); |
693 | 727 | |
@@ -711,8 +745,7 @@ discard block |
||
711 | 745 | $pref = !empty($pref[$user_info['id']]) ? $pref[$user_info['id']] : array(); |
712 | 746 | $pref = isset($pref['board_notify_' . $board]) ? $pref['board_notify_' . $board] : (!empty($pref['board_notify']) ? $pref['board_notify'] : 0); |
713 | 747 | $context['board_notification_mode'] = !$context['is_marked_notify'] ? 1 : ($pref & 0x02 ? 3 : ($pref & 0x01 ? 2 : 1)); |
714 | - } |
|
715 | - else |
|
748 | + } else |
|
716 | 749 | { |
717 | 750 | $context['is_marked_notify'] = false; |
718 | 751 | $context['board_notification_mode'] = 1; |
@@ -725,23 +758,27 @@ discard block |
||
725 | 758 | $context['becomesUnapproved'] = !empty($_SESSION['becomesUnapproved']) ? true : false; |
726 | 759 | |
727 | 760 | // Don't want to show this forever... |
728 | - if ($context['becomesUnapproved']) |
|
729 | - unset($_SESSION['becomesUnapproved']); |
|
761 | + if ($context['becomesUnapproved']) { |
|
762 | + unset($_SESSION['becomesUnapproved']); |
|
763 | + } |
|
730 | 764 | |
731 | 765 | // Build the message index button array. |
732 | 766 | $context['normal_buttons'] = array(); |
733 | 767 | |
734 | - if ($context['can_post_new']) |
|
735 | - $context['normal_buttons']['new_topic'] = array('text' => 'new_topic', 'image' => 'new_topic.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0', 'active' => true); |
|
768 | + if ($context['can_post_new']) { |
|
769 | + $context['normal_buttons']['new_topic'] = array('text' => 'new_topic', 'image' => 'new_topic.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0', 'active' => true); |
|
770 | + } |
|
736 | 771 | |
737 | - if ($context['can_post_poll']) |
|
738 | - $context['normal_buttons']['post_poll'] = array('text' => 'new_poll', 'image' => 'new_poll.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'); |
|
772 | + if ($context['can_post_poll']) { |
|
773 | + $context['normal_buttons']['post_poll'] = array('text' => 'new_poll', 'image' => 'new_poll.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'); |
|
774 | + } |
|
739 | 775 | |
740 | - if (!$context['user']['is_logged']) |
|
741 | - $context['normal_buttons']['markread'] = array('text' => 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'custom' => 'data-confirm="' . $txt['are_sure_mark_read'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']); |
|
776 | + if (!$context['user']['is_logged']) { |
|
777 | + $context['normal_buttons']['markread'] = array('text' => 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'custom' => 'data-confirm="' . $txt['are_sure_mark_read'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']); |
|
778 | + } |
|
742 | 779 | |
743 | - if ($context['can_mark_notify']) |
|
744 | - $context['normal_buttons']['notify'] = array( |
|
780 | + if ($context['can_mark_notify']) { |
|
781 | + $context['normal_buttons']['notify'] = array( |
|
745 | 782 | 'lang' => true, |
746 | 783 | 'text' => 'notify_board_' . $context['board_notification_mode'], |
747 | 784 | 'sub_buttons' => array( |
@@ -759,6 +796,7 @@ discard block |
||
759 | 796 | ), |
760 | 797 | ), |
761 | 798 | ); |
799 | + } |
|
762 | 800 | |
763 | 801 | // Javascript for inline editing. |
764 | 802 | loadJavaScriptFile('topic.js', array('defer' => false), 'smf_topic'); |
@@ -780,18 +818,21 @@ discard block |
||
780 | 818 | checkSession('request'); |
781 | 819 | |
782 | 820 | // Lets go straight to the restore area. |
783 | - if (isset($_REQUEST['qaction']) && $_REQUEST['qaction'] == 'restore' && !empty($_REQUEST['topics'])) |
|
784 | - redirectexit('action=restoretopic;topics=' . implode(',', $_REQUEST['topics']) . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
821 | + if (isset($_REQUEST['qaction']) && $_REQUEST['qaction'] == 'restore' && !empty($_REQUEST['topics'])) { |
|
822 | + redirectexit('action=restoretopic;topics=' . implode(',', $_REQUEST['topics']) . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
823 | + } |
|
785 | 824 | |
786 | - if (isset($_SESSION['topicseen_cache'])) |
|
787 | - $_SESSION['topicseen_cache'] = array(); |
|
825 | + if (isset($_SESSION['topicseen_cache'])) { |
|
826 | + $_SESSION['topicseen_cache'] = array(); |
|
827 | + } |
|
788 | 828 | |
789 | 829 | // This is going to be needed to send off the notifications and for updateLastMessages(). |
790 | 830 | require_once($sourcedir . '/Subs-Post.php'); |
791 | 831 | |
792 | 832 | // Remember the last board they moved things to. |
793 | - if (isset($_REQUEST['move_to'])) |
|
794 | - $_SESSION['move_to_topic'] = $_REQUEST['move_to']; |
|
833 | + if (isset($_REQUEST['move_to'])) { |
|
834 | + $_SESSION['move_to_topic'] = $_REQUEST['move_to']; |
|
835 | + } |
|
795 | 836 | |
796 | 837 | // Only a few possible actions. |
797 | 838 | $possibleActions = array(); |
@@ -811,8 +852,7 @@ discard block |
||
811 | 852 | ); |
812 | 853 | |
813 | 854 | $redirect_url = 'board=' . $board . '.' . $_REQUEST['start']; |
814 | - } |
|
815 | - else |
|
855 | + } else |
|
816 | 856 | { |
817 | 857 | /** |
818 | 858 | * @todo Ugly. There's no getting around this, is there? |
@@ -830,8 +870,7 @@ discard block |
||
830 | 870 | if (!empty($board)) |
831 | 871 | { |
832 | 872 | $boards_can['post_new'] = array_diff(boardsAllowedTo('post_new'), array($board)); |
833 | - } |
|
834 | - else |
|
873 | + } else |
|
835 | 874 | { |
836 | 875 | $boards_can['post_new'] = boardsAllowedTo('post_new'); |
837 | 876 | } |
@@ -842,55 +881,67 @@ discard block |
||
842 | 881 | } |
843 | 882 | } |
844 | 883 | |
845 | - if (!$user_info['is_guest']) |
|
846 | - $possibleActions[] = 'markread'; |
|
847 | - if (!empty($boards_can['make_sticky'])) |
|
848 | - $possibleActions[] = 'sticky'; |
|
849 | - if (!empty($boards_can['move_any']) || !empty($boards_can['move_own'])) |
|
850 | - $possibleActions[] = 'move'; |
|
851 | - if (!empty($boards_can['remove_any']) || !empty($boards_can['remove_own'])) |
|
852 | - $possibleActions[] = 'remove'; |
|
853 | - if (!empty($boards_can['lock_any']) || !empty($boards_can['lock_own'])) |
|
854 | - $possibleActions[] = 'lock'; |
|
855 | - if (!empty($boards_can['merge_any'])) |
|
856 | - $possibleActions[] = 'merge'; |
|
857 | - if (!empty($boards_can['approve_posts'])) |
|
858 | - $possibleActions[] = 'approve'; |
|
884 | + if (!$user_info['is_guest']) { |
|
885 | + $possibleActions[] = 'markread'; |
|
886 | + } |
|
887 | + if (!empty($boards_can['make_sticky'])) { |
|
888 | + $possibleActions[] = 'sticky'; |
|
889 | + } |
|
890 | + if (!empty($boards_can['move_any']) || !empty($boards_can['move_own'])) { |
|
891 | + $possibleActions[] = 'move'; |
|
892 | + } |
|
893 | + if (!empty($boards_can['remove_any']) || !empty($boards_can['remove_own'])) { |
|
894 | + $possibleActions[] = 'remove'; |
|
895 | + } |
|
896 | + if (!empty($boards_can['lock_any']) || !empty($boards_can['lock_own'])) { |
|
897 | + $possibleActions[] = 'lock'; |
|
898 | + } |
|
899 | + if (!empty($boards_can['merge_any'])) { |
|
900 | + $possibleActions[] = 'merge'; |
|
901 | + } |
|
902 | + if (!empty($boards_can['approve_posts'])) { |
|
903 | + $possibleActions[] = 'approve'; |
|
904 | + } |
|
859 | 905 | |
860 | 906 | // Two methods: $_REQUEST['actions'] (id_topic => action), and $_REQUEST['topics'] and $_REQUEST['qaction']. |
861 | 907 | // (if action is 'move', $_REQUEST['move_to'] or $_REQUEST['move_tos'][$topic] is used.) |
862 | 908 | if (!empty($_REQUEST['topics'])) |
863 | 909 | { |
864 | 910 | // If the action isn't valid, just quit now. |
865 | - if (empty($_REQUEST['qaction']) || !in_array($_REQUEST['qaction'], $possibleActions)) |
|
866 | - redirectexit($redirect_url); |
|
911 | + if (empty($_REQUEST['qaction']) || !in_array($_REQUEST['qaction'], $possibleActions)) { |
|
912 | + redirectexit($redirect_url); |
|
913 | + } |
|
867 | 914 | |
868 | 915 | // Merge requires all topics as one parameter and can be done at once. |
869 | 916 | if ($_REQUEST['qaction'] == 'merge') |
870 | 917 | { |
871 | 918 | // Merge requires at least two topics. |
872 | - if (empty($_REQUEST['topics']) || count($_REQUEST['topics']) < 2) |
|
873 | - redirectexit($redirect_url); |
|
919 | + if (empty($_REQUEST['topics']) || count($_REQUEST['topics']) < 2) { |
|
920 | + redirectexit($redirect_url); |
|
921 | + } |
|
874 | 922 | |
875 | 923 | require_once($sourcedir . '/SplitTopics.php'); |
876 | 924 | return MergeExecute($_REQUEST['topics']); |
877 | 925 | } |
878 | 926 | |
879 | 927 | // Just convert to the other method, to make it easier. |
880 | - foreach ($_REQUEST['topics'] as $topic) |
|
881 | - $_REQUEST['actions'][(int) $topic] = $_REQUEST['qaction']; |
|
928 | + foreach ($_REQUEST['topics'] as $topic) { |
|
929 | + $_REQUEST['actions'][(int) $topic] = $_REQUEST['qaction']; |
|
930 | + } |
|
882 | 931 | } |
883 | 932 | |
884 | 933 | // Weird... how'd you get here? |
885 | - if (empty($_REQUEST['actions'])) |
|
886 | - redirectexit($redirect_url); |
|
934 | + if (empty($_REQUEST['actions'])) { |
|
935 | + redirectexit($redirect_url); |
|
936 | + } |
|
887 | 937 | |
888 | 938 | // Validate each action. |
889 | 939 | $temp = array(); |
890 | 940 | foreach ($_REQUEST['actions'] as $topic => $action) |
891 | 941 | { |
892 | - if (in_array($action, $possibleActions)) |
|
893 | - $temp[(int) $topic] = $action; |
|
942 | + if (in_array($action, $possibleActions)) { |
|
943 | + $temp[(int) $topic] = $action; |
|
944 | + } |
|
894 | 945 | } |
895 | 946 | $_REQUEST['actions'] = $temp; |
896 | 947 | |
@@ -911,27 +962,31 @@ discard block |
||
911 | 962 | { |
912 | 963 | if (!empty($board)) |
913 | 964 | { |
914 | - if ($row['id_board'] != $board || ($modSettings['postmod_active'] && !$row['approved'] && !allowedTo('approve_posts'))) |
|
915 | - unset($_REQUEST['actions'][$row['id_topic']]); |
|
916 | - } |
|
917 | - else |
|
965 | + if ($row['id_board'] != $board || ($modSettings['postmod_active'] && !$row['approved'] && !allowedTo('approve_posts'))) { |
|
966 | + unset($_REQUEST['actions'][$row['id_topic']]); |
|
967 | + } |
|
968 | + } else |
|
918 | 969 | { |
919 | 970 | // Don't allow them to act on unapproved posts they can't see... |
920 | - if ($modSettings['postmod_active'] && !$row['approved'] && !in_array(0, $boards_can['approve_posts']) && !in_array($row['id_board'], $boards_can['approve_posts'])) |
|
921 | - unset($_REQUEST['actions'][$row['id_topic']]); |
|
971 | + if ($modSettings['postmod_active'] && !$row['approved'] && !in_array(0, $boards_can['approve_posts']) && !in_array($row['id_board'], $boards_can['approve_posts'])) { |
|
972 | + unset($_REQUEST['actions'][$row['id_topic']]); |
|
973 | + } |
|
922 | 974 | // Goodness, this is fun. We need to validate the action. |
923 | - elseif ($_REQUEST['actions'][$row['id_topic']] == 'sticky' && !in_array(0, $boards_can['make_sticky']) && !in_array($row['id_board'], $boards_can['make_sticky'])) |
|
924 | - unset($_REQUEST['actions'][$row['id_topic']]); |
|
925 | - elseif ($_REQUEST['actions'][$row['id_topic']] == 'move' && !in_array(0, $boards_can['move_any']) && !in_array($row['id_board'], $boards_can['move_any']) && ($row['id_member_started'] != $user_info['id'] || (!in_array(0, $boards_can['move_own']) && !in_array($row['id_board'], $boards_can['move_own'])))) |
|
926 | - unset($_REQUEST['actions'][$row['id_topic']]); |
|
927 | - elseif ($_REQUEST['actions'][$row['id_topic']] == 'remove' && !in_array(0, $boards_can['remove_any']) && !in_array($row['id_board'], $boards_can['remove_any']) && ($row['id_member_started'] != $user_info['id'] || (!in_array(0, $boards_can['remove_own']) && !in_array($row['id_board'], $boards_can['remove_own'])))) |
|
928 | - unset($_REQUEST['actions'][$row['id_topic']]); |
|
975 | + elseif ($_REQUEST['actions'][$row['id_topic']] == 'sticky' && !in_array(0, $boards_can['make_sticky']) && !in_array($row['id_board'], $boards_can['make_sticky'])) { |
|
976 | + unset($_REQUEST['actions'][$row['id_topic']]); |
|
977 | + } elseif ($_REQUEST['actions'][$row['id_topic']] == 'move' && !in_array(0, $boards_can['move_any']) && !in_array($row['id_board'], $boards_can['move_any']) && ($row['id_member_started'] != $user_info['id'] || (!in_array(0, $boards_can['move_own']) && !in_array($row['id_board'], $boards_can['move_own'])))) { |
|
978 | + unset($_REQUEST['actions'][$row['id_topic']]); |
|
979 | + } elseif ($_REQUEST['actions'][$row['id_topic']] == 'remove' && !in_array(0, $boards_can['remove_any']) && !in_array($row['id_board'], $boards_can['remove_any']) && ($row['id_member_started'] != $user_info['id'] || (!in_array(0, $boards_can['remove_own']) && !in_array($row['id_board'], $boards_can['remove_own'])))) { |
|
980 | + unset($_REQUEST['actions'][$row['id_topic']]); |
|
981 | + } |
|
929 | 982 | // @todo $locked is not set, what are you trying to do? (taking the change it is supposed to be $row['locked']) |
930 | - elseif ($_REQUEST['actions'][$row['id_topic']] == 'lock' && !in_array(0, $boards_can['lock_any']) && !in_array($row['id_board'], $boards_can['lock_any']) && ($row['id_member_started'] != $user_info['id'] || $row['locked'] == 1 || (!in_array(0, $boards_can['lock_own']) && !in_array($row['id_board'], $boards_can['lock_own'])))) |
|
931 | - unset($_REQUEST['actions'][$row['id_topic']]); |
|
983 | + elseif ($_REQUEST['actions'][$row['id_topic']] == 'lock' && !in_array(0, $boards_can['lock_any']) && !in_array($row['id_board'], $boards_can['lock_any']) && ($row['id_member_started'] != $user_info['id'] || $row['locked'] == 1 || (!in_array(0, $boards_can['lock_own']) && !in_array($row['id_board'], $boards_can['lock_own'])))) { |
|
984 | + unset($_REQUEST['actions'][$row['id_topic']]); |
|
985 | + } |
|
932 | 986 | // If the topic is approved then you need permission to approve the posts within. |
933 | - elseif ($_REQUEST['actions'][$row['id_topic']] == 'approve' && (!$row['unapproved_posts'] || (!in_array(0, $boards_can['approve_posts']) && !in_array($row['id_board'], $boards_can['approve_posts'])))) |
|
934 | - unset($_REQUEST['actions'][$row['id_topic']]); |
|
987 | + elseif ($_REQUEST['actions'][$row['id_topic']] == 'approve' && (!$row['unapproved_posts'] || (!in_array(0, $boards_can['approve_posts']) && !in_array($row['id_board'], $boards_can['approve_posts'])))) { |
|
988 | + unset($_REQUEST['actions'][$row['id_topic']]); |
|
989 | + } |
|
935 | 990 | } |
936 | 991 | } |
937 | 992 | $smcFunc['db_free_result']($request); |
@@ -949,11 +1004,11 @@ discard block |
||
949 | 1004 | { |
950 | 1005 | $topic = (int) $topic; |
951 | 1006 | |
952 | - if ($action == 'markread') |
|
953 | - $markCache[] = $topic; |
|
954 | - elseif ($action == 'sticky') |
|
955 | - $stickyCache[] = $topic; |
|
956 | - elseif ($action == 'move') |
|
1007 | + if ($action == 'markread') { |
|
1008 | + $markCache[] = $topic; |
|
1009 | + } elseif ($action == 'sticky') { |
|
1010 | + $stickyCache[] = $topic; |
|
1011 | + } elseif ($action == 'move') |
|
957 | 1012 | { |
958 | 1013 | require_once($sourcedir . '/MoveTopic.php'); |
959 | 1014 | moveTopicConcurrence(); |
@@ -961,23 +1016,25 @@ discard block |
||
961 | 1016 | // $moveCache[0] is the topic, $moveCache[1] is the board to move to. |
962 | 1017 | $moveCache[1][$topic] = (int) (isset($_REQUEST['move_tos'][$topic]) ? $_REQUEST['move_tos'][$topic] : $_REQUEST['move_to']); |
963 | 1018 | |
964 | - if (empty($moveCache[1][$topic])) |
|
965 | - continue; |
|
1019 | + if (empty($moveCache[1][$topic])) { |
|
1020 | + continue; |
|
1021 | + } |
|
966 | 1022 | |
967 | 1023 | $moveCache[0][] = $topic; |
1024 | + } elseif ($action == 'remove') { |
|
1025 | + $removeCache[] = $topic; |
|
1026 | + } elseif ($action == 'lock') { |
|
1027 | + $lockCache[] = $topic; |
|
1028 | + } elseif ($action == 'approve') { |
|
1029 | + $approveCache[] = $topic; |
|
968 | 1030 | } |
969 | - elseif ($action == 'remove') |
|
970 | - $removeCache[] = $topic; |
|
971 | - elseif ($action == 'lock') |
|
972 | - $lockCache[] = $topic; |
|
973 | - elseif ($action == 'approve') |
|
974 | - $approveCache[] = $topic; |
|
975 | 1031 | } |
976 | 1032 | |
977 | - if (empty($board)) |
|
978 | - $affectedBoards = array(); |
|
979 | - else |
|
980 | - $affectedBoards = array($board => array(0, 0)); |
|
1033 | + if (empty($board)) { |
|
1034 | + $affectedBoards = array(); |
|
1035 | + } else { |
|
1036 | + $affectedBoards = array($board => array(0, 0)); |
|
1037 | + } |
|
981 | 1038 | |
982 | 1039 | // Do all the stickies... |
983 | 1040 | if (!empty($stickyCache)) |
@@ -1037,14 +1094,16 @@ discard block |
||
1037 | 1094 | { |
1038 | 1095 | $to = $moveCache[1][$row['id_topic']]; |
1039 | 1096 | |
1040 | - if (empty($to)) |
|
1041 | - continue; |
|
1097 | + if (empty($to)) { |
|
1098 | + continue; |
|
1099 | + } |
|
1042 | 1100 | |
1043 | 1101 | // Does this topic's board count the posts or not? |
1044 | 1102 | $countPosts[$row['id_topic']] = empty($row['count_posts']); |
1045 | 1103 | |
1046 | - if (!isset($moveTos[$to])) |
|
1047 | - $moveTos[$to] = array(); |
|
1104 | + if (!isset($moveTos[$to])) { |
|
1105 | + $moveTos[$to] = array(); |
|
1106 | + } |
|
1048 | 1107 | |
1049 | 1108 | $moveTos[$to][] = $row['id_topic']; |
1050 | 1109 | |
@@ -1058,8 +1117,9 @@ discard block |
||
1058 | 1117 | require_once($sourcedir . '/MoveTopic.php'); |
1059 | 1118 | |
1060 | 1119 | // Do the actual moves... |
1061 | - foreach ($moveTos as $to => $topics) |
|
1062 | - moveTopics($topics, $to); |
|
1120 | + foreach ($moveTos as $to => $topics) { |
|
1121 | + moveTopics($topics, $to); |
|
1122 | + } |
|
1063 | 1123 | |
1064 | 1124 | // Does the post counts need to be updated? |
1065 | 1125 | if (!empty($moveTos)) |
@@ -1108,20 +1168,23 @@ discard block |
||
1108 | 1168 | |
1109 | 1169 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1110 | 1170 | { |
1111 | - if (!isset($members[$row['id_member']])) |
|
1112 | - $members[$row['id_member']] = 0; |
|
1171 | + if (!isset($members[$row['id_member']])) { |
|
1172 | + $members[$row['id_member']] = 0; |
|
1173 | + } |
|
1113 | 1174 | |
1114 | - if ($topicRecounts[$row['id_topic']] === '+') |
|
1115 | - $members[$row['id_member']] += 1; |
|
1116 | - else |
|
1117 | - $members[$row['id_member']] -= 1; |
|
1175 | + if ($topicRecounts[$row['id_topic']] === '+') { |
|
1176 | + $members[$row['id_member']] += 1; |
|
1177 | + } else { |
|
1178 | + $members[$row['id_member']] -= 1; |
|
1179 | + } |
|
1118 | 1180 | } |
1119 | 1181 | |
1120 | 1182 | $smcFunc['db_free_result']($request); |
1121 | 1183 | |
1122 | 1184 | // And now update them member's post counts |
1123 | - foreach ($members as $id_member => $post_adj) |
|
1124 | - updateMemberData($id_member, array('posts' => 'posts + ' . $post_adj)); |
|
1185 | + foreach ($members as $id_member => $post_adj) { |
|
1186 | + updateMemberData($id_member, array('posts' => 'posts + ' . $post_adj)); |
|
1187 | + } |
|
1125 | 1188 | |
1126 | 1189 | } |
1127 | 1190 | } |
@@ -1201,8 +1264,9 @@ discard block |
||
1201 | 1264 | approveTopics($approveCache); |
1202 | 1265 | |
1203 | 1266 | // Time for some logging! |
1204 | - foreach ($approveCache as $topic) |
|
1205 | - logAction('approve_topic', array('topic' => $topic, 'member' => $approveCacheMembers[$topic])); |
|
1267 | + foreach ($approveCache as $topic) { |
|
1268 | + logAction('approve_topic', array('topic' => $topic, 'member' => $approveCacheMembers[$topic])); |
|
1269 | + } |
|
1206 | 1270 | } |
1207 | 1271 | } |
1208 | 1272 | |
@@ -1237,8 +1301,7 @@ discard block |
||
1237 | 1301 | $lockStatus[$row['id_topic']] = empty($row['locked']); |
1238 | 1302 | } |
1239 | 1303 | $smcFunc['db_free_result']($result); |
1240 | - } |
|
1241 | - else |
|
1304 | + } else |
|
1242 | 1305 | { |
1243 | 1306 | $result = $smcFunc['db_query']('', ' |
1244 | 1307 | SELECT id_topic, locked, id_board |
@@ -1288,13 +1351,15 @@ discard block |
||
1288 | 1351 | ) |
1289 | 1352 | ); |
1290 | 1353 | $logged_topics = array(); |
1291 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1292 | - $logged_topics[$row['id_topic']] = $row['unwatched']; |
|
1354 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1355 | + $logged_topics[$row['id_topic']] = $row['unwatched']; |
|
1356 | + } |
|
1293 | 1357 | $smcFunc['db_free_result']($request); |
1294 | 1358 | |
1295 | 1359 | $markArray = array(); |
1296 | - foreach ($markCache as $topic) |
|
1297 | - $markArray[] = array($modSettings['maxMsgID'], $user_info['id'], $topic, (isset($logged_topics[$topic]) ? $logged_topics[$topic] : 0)); |
|
1360 | + foreach ($markCache as $topic) { |
|
1361 | + $markArray[] = array($modSettings['maxMsgID'], $user_info['id'], $topic, (isset($logged_topics[$topic]) ? $logged_topics[$topic] : 0)); |
|
1362 | + } |
|
1298 | 1363 | |
1299 | 1364 | $smcFunc['db_insert']('replace', |
1300 | 1365 | '{db_prefix}log_topics', |
@@ -1307,8 +1372,9 @@ discard block |
||
1307 | 1372 | foreach ($moveCache as $topic) |
1308 | 1373 | { |
1309 | 1374 | // Didn't actually move anything! |
1310 | - if (!isset($topic[0])) |
|
1311 | - break; |
|
1375 | + if (!isset($topic[0])) { |
|
1376 | + break; |
|
1377 | + } |
|
1312 | 1378 | |
1313 | 1379 | logAction('move', array('topic' => $topic[0], 'board_from' => $topic[1], 'board_to' => $topic[2])); |
1314 | 1380 | sendNotifications($topic[0], 'move'); |
@@ -1330,8 +1396,9 @@ discard block |
||
1330 | 1396 | 'calendar_updated' => time(), |
1331 | 1397 | )); |
1332 | 1398 | |
1333 | - if (!empty($affectedBoards)) |
|
1334 | - updateLastMessages(array_keys($affectedBoards)); |
|
1399 | + if (!empty($affectedBoards)) { |
|
1400 | + updateLastMessages(array_keys($affectedBoards)); |
|
1401 | + } |
|
1335 | 1402 | |
1336 | 1403 | redirectexit($redirect_url); |
1337 | 1404 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Get all birthdays within the given time range. |
@@ -60,8 +61,7 @@ discard block |
||
60 | 61 | 'max_year' => $year_high, |
61 | 62 | ) |
62 | 63 | ); |
63 | - } |
|
64 | - else |
|
64 | + } else |
|
65 | 65 | { |
66 | 66 | $result = $smcFunc['db_query']('birthday_array', ' |
67 | 67 | SELECT id_member, real_name, YEAR(birthdate) AS birth_year, birthdate |
@@ -91,10 +91,11 @@ discard block |
||
91 | 91 | $bday = array(); |
92 | 92 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
93 | 93 | { |
94 | - if ($year_low != $year_high) |
|
95 | - $age_year = substr($row['birthdate'], 5) < substr($high_date, 5) ? $year_high : $year_low; |
|
96 | - else |
|
97 | - $age_year = $year_low; |
|
94 | + if ($year_low != $year_high) { |
|
95 | + $age_year = substr($row['birthdate'], 5) < substr($high_date, 5) ? $year_high : $year_low; |
|
96 | + } else { |
|
97 | + $age_year = $year_low; |
|
98 | + } |
|
98 | 99 | |
99 | 100 | $bday[$age_year . substr($row['birthdate'], 4)][] = array( |
100 | 101 | 'id' => $row['id_member'], |
@@ -108,8 +109,9 @@ discard block |
||
108 | 109 | ksort($bday); |
109 | 110 | |
110 | 111 | // Set is_last, so the themes know when to stop placing separators. |
111 | - foreach ($bday as $mday => $array) |
|
112 | - $bday[$mday][count($array) - 1]['is_last'] = true; |
|
112 | + foreach ($bday as $mday => $array) { |
|
113 | + $bday[$mday][count($array) - 1]['is_last'] = true; |
|
114 | + } |
|
113 | 115 | |
114 | 116 | return $bday; |
115 | 117 | } |
@@ -133,8 +135,9 @@ discard block |
||
133 | 135 | static $timezone_array = array(); |
134 | 136 | require_once($sourcedir . '/Subs.php'); |
135 | 137 | |
136 | - if (empty($timezone_array['default'])) |
|
137 | - $timezone_array['default'] = timezone_open(date_default_timezone_get()); |
|
138 | + if (empty($timezone_array['default'])) { |
|
139 | + $timezone_array['default'] = timezone_open(date_default_timezone_get()); |
|
140 | + } |
|
138 | 141 | |
139 | 142 | $low_object = date_create($low_date); |
140 | 143 | $high_object = date_create($high_date); |
@@ -161,8 +164,9 @@ discard block |
||
161 | 164 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
162 | 165 | { |
163 | 166 | // If the attached topic is not approved then for the moment pretend it doesn't exist |
164 | - if (!empty($row['id_first_msg']) && $modSettings['postmod_active'] && !$row['approved']) |
|
165 | - continue; |
|
167 | + if (!empty($row['id_first_msg']) && $modSettings['postmod_active'] && !$row['approved']) { |
|
168 | + continue; |
|
169 | + } |
|
166 | 170 | |
167 | 171 | // Force a censor of the title - as often these are used by others. |
168 | 172 | censorText($row['title'], $use_permissions ? false : true); |
@@ -170,12 +174,14 @@ discard block |
||
170 | 174 | // Get the various time and date properties for this event |
171 | 175 | list($start, $end, $allday, $span, $tz, $tz_abbrev) = buildEventDatetimes($row); |
172 | 176 | |
173 | - if (empty($timezone_array[$tz])) |
|
174 | - $timezone_array[$tz] = timezone_open($tz); |
|
177 | + if (empty($timezone_array[$tz])) { |
|
178 | + $timezone_array[$tz] = timezone_open($tz); |
|
179 | + } |
|
175 | 180 | |
176 | 181 | // Sanity check |
177 | - if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) |
|
178 | - continue; |
|
182 | + if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) { |
|
183 | + continue; |
|
184 | + } |
|
179 | 185 | |
180 | 186 | // Get set up for the loop |
181 | 187 | $start_object = date_create($row['start_date'] . (!$allday ? ' ' . $row['start_time'] : ''), $timezone_array[$tz]); |
@@ -239,8 +245,8 @@ discard block |
||
239 | 245 | ); |
240 | 246 | |
241 | 247 | // If we're using permissions (calendar pages?) then just ouput normal contextual style information. |
242 | - if ($use_permissions) |
|
243 | - $events[date_format($cal_date, 'Y-m-d')][] = array_merge($eventProperties, array( |
|
248 | + if ($use_permissions) { |
|
249 | + $events[date_format($cal_date, 'Y-m-d')][] = array_merge($eventProperties, array( |
|
244 | 250 | 'href' => $row['id_board'] == 0 ? '' : $scripturl . '?topic=' . $row['id_topic'] . '.0', |
245 | 251 | 'link' => $row['id_board'] == 0 ? $row['title'] : '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['title'] . '</a>', |
246 | 252 | 'can_edit' => allowedTo('calendar_edit_any') || ($row['id_member'] == $user_info['id'] && allowedTo('calendar_edit_own')), |
@@ -248,9 +254,10 @@ discard block |
||
248 | 254 | 'can_export' => !empty($modSettings['cal_export']) ? true : false, |
249 | 255 | 'export_href' => $scripturl . '?action=calendar;sa=ical;eventid=' . $row['id_event'] . ';' . $context['session_var'] . '=' . $context['session_id'], |
250 | 256 | )); |
257 | + } |
|
251 | 258 | // Otherwise, this is going to be cached and the VIEWER'S permissions should apply... just put together some info. |
252 | - else |
|
253 | - $events[date_format($cal_date, 'Y-m-d')][] = array_merge($eventProperties, array( |
|
259 | + else { |
|
260 | + $events[date_format($cal_date, 'Y-m-d')][] = array_merge($eventProperties, array( |
|
254 | 261 | 'href' => $row['id_topic'] == 0 ? '' : $scripturl . '?topic=' . $row['id_topic'] . '.0', |
255 | 262 | 'link' => $row['id_topic'] == 0 ? $row['title'] : '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['title'] . '</a>', |
256 | 263 | 'can_edit' => false, |
@@ -260,6 +267,7 @@ discard block |
||
260 | 267 | 'poster' => $row['id_member'], |
261 | 268 | 'allowed_groups' => explode(',', $row['member_groups']), |
262 | 269 | )); |
270 | + } |
|
263 | 271 | |
264 | 272 | date_add($cal_date, date_interval_create_from_date_string('1 day')); |
265 | 273 | } |
@@ -269,8 +277,9 @@ discard block |
||
269 | 277 | // If we're doing normal contextual data, go through and make things clear to the templates ;). |
270 | 278 | if ($use_permissions) |
271 | 279 | { |
272 | - foreach ($events as $mday => $array) |
|
273 | - $events[$mday][count($array) - 1]['is_last'] = true; |
|
280 | + foreach ($events as $mday => $array) { |
|
281 | + $events[$mday][count($array) - 1]['is_last'] = true; |
|
282 | + } |
|
274 | 283 | } |
275 | 284 | |
276 | 285 | ksort($events); |
@@ -290,11 +299,12 @@ discard block |
||
290 | 299 | global $smcFunc; |
291 | 300 | |
292 | 301 | // Get the lowest and highest dates for "all years". |
293 | - if (substr($low_date, 0, 4) != substr($high_date, 0, 4)) |
|
294 | - $allyear_part = 'event_date BETWEEN {date:all_year_low} AND {date:all_year_dec} |
|
302 | + if (substr($low_date, 0, 4) != substr($high_date, 0, 4)) { |
|
303 | + $allyear_part = 'event_date BETWEEN {date:all_year_low} AND {date:all_year_dec} |
|
295 | 304 | OR event_date BETWEEN {date:all_year_jan} AND {date:all_year_high}'; |
296 | - else |
|
297 | - $allyear_part = 'event_date BETWEEN {date:all_year_low} AND {date:all_year_high}'; |
|
305 | + } else { |
|
306 | + $allyear_part = 'event_date BETWEEN {date:all_year_low} AND {date:all_year_high}'; |
|
307 | + } |
|
298 | 308 | |
299 | 309 | // Find some holidays... ;). |
300 | 310 | $result = $smcFunc['db_query']('', ' |
@@ -314,10 +324,11 @@ discard block |
||
314 | 324 | $holidays = array(); |
315 | 325 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
316 | 326 | { |
317 | - if (substr($low_date, 0, 4) != substr($high_date, 0, 4)) |
|
318 | - $event_year = substr($row['event_date'], 5) < substr($high_date, 5) ? substr($high_date, 0, 4) : substr($low_date, 0, 4); |
|
319 | - else |
|
320 | - $event_year = substr($low_date, 0, 4); |
|
327 | + if (substr($low_date, 0, 4) != substr($high_date, 0, 4)) { |
|
328 | + $event_year = substr($row['event_date'], 5) < substr($high_date, 5) ? substr($high_date, 0, 4) : substr($low_date, 0, 4); |
|
329 | + } else { |
|
330 | + $event_year = substr($low_date, 0, 4); |
|
331 | + } |
|
321 | 332 | |
322 | 333 | $holidays[$event_year . substr($row['event_date'], 4)][] = $row['title']; |
323 | 334 | } |
@@ -343,10 +354,12 @@ discard block |
||
343 | 354 | isAllowedTo('calendar_post'); |
344 | 355 | |
345 | 356 | // No board? No topic?!? |
346 | - if (empty($board)) |
|
347 | - fatal_lang_error('missing_board_id', false); |
|
348 | - if (empty($topic)) |
|
349 | - fatal_lang_error('missing_topic_id', false); |
|
357 | + if (empty($board)) { |
|
358 | + fatal_lang_error('missing_board_id', false); |
|
359 | + } |
|
360 | + if (empty($topic)) { |
|
361 | + fatal_lang_error('missing_topic_id', false); |
|
362 | + } |
|
350 | 363 | |
351 | 364 | // Administrator, Moderator, or owner. Period. |
352 | 365 | if (!allowedTo('admin_forum') && !allowedTo('moderate_board')) |
@@ -364,12 +377,14 @@ discard block |
||
364 | 377 | if ($row = $smcFunc['db_fetch_assoc']($result)) |
365 | 378 | { |
366 | 379 | // Not the owner of the topic. |
367 | - if ($row['id_member_started'] != $user_info['id']) |
|
368 | - fatal_lang_error('not_your_topic', 'user'); |
|
380 | + if ($row['id_member_started'] != $user_info['id']) { |
|
381 | + fatal_lang_error('not_your_topic', 'user'); |
|
382 | + } |
|
369 | 383 | } |
370 | 384 | // Topic/Board doesn't exist..... |
371 | - else |
|
372 | - fatal_lang_error('calendar_no_topic', 'general'); |
|
385 | + else { |
|
386 | + fatal_lang_error('calendar_no_topic', 'general'); |
|
387 | + } |
|
373 | 388 | $smcFunc['db_free_result']($result); |
374 | 389 | } |
375 | 390 | } |
@@ -457,14 +472,16 @@ discard block |
||
457 | 472 | if (!empty($calendarOptions['start_day'])) |
458 | 473 | { |
459 | 474 | $nShift -= $calendarOptions['start_day']; |
460 | - if ($nShift < 0) |
|
461 | - $nShift = 7 + $nShift; |
|
475 | + if ($nShift < 0) { |
|
476 | + $nShift = 7 + $nShift; |
|
477 | + } |
|
462 | 478 | } |
463 | 479 | |
464 | 480 | // Number of rows required to fit the month. |
465 | 481 | $nRows = floor(($month_info['last_day']['day_of_month'] + $nShift) / 7); |
466 | - if (($month_info['last_day']['day_of_month'] + $nShift) % 7) |
|
467 | - $nRows++; |
|
482 | + if (($month_info['last_day']['day_of_month'] + $nShift) % 7) { |
|
483 | + $nRows++; |
|
484 | + } |
|
468 | 485 | |
469 | 486 | // Fetch the arrays for birthdays, posted events, and holidays. |
470 | 487 | $bday = $calendarOptions['show_birthdays'] ? getBirthdayRange($month_info['first_day']['date'], $month_info['last_day']['date']) : array(); |
@@ -477,8 +494,9 @@ discard block |
||
477 | 494 | { |
478 | 495 | $calendarGrid['week_days'][] = $count; |
479 | 496 | $count++; |
480 | - if ($count == 7) |
|
481 | - $count = 0; |
|
497 | + if ($count == 7) { |
|
498 | + $count = 0; |
|
499 | + } |
|
482 | 500 | } |
483 | 501 | |
484 | 502 | // Iterate through each week. |
@@ -495,8 +513,9 @@ discard block |
||
495 | 513 | { |
496 | 514 | $nDay = ($nRow * 7) + $nCol - $nShift + 1; |
497 | 515 | |
498 | - if ($nDay < 1 || $nDay > $month_info['last_day']['day_of_month']) |
|
499 | - $nDay = 0; |
|
516 | + if ($nDay < 1 || $nDay > $month_info['last_day']['day_of_month']) { |
|
517 | + $nDay = 0; |
|
518 | + } |
|
500 | 519 | |
501 | 520 | $date = sprintf('%04d-%02d-%02d', $year, $month, $nDay); |
502 | 521 | |
@@ -514,8 +533,9 @@ discard block |
||
514 | 533 | } |
515 | 534 | |
516 | 535 | // What is the last day of the month? |
517 | - if ($is_previous === true) |
|
518 | - $calendarGrid['last_of_month'] = $month_info['last_day']['day_of_month']; |
|
536 | + if ($is_previous === true) { |
|
537 | + $calendarGrid['last_of_month'] = $month_info['last_day']['day_of_month']; |
|
538 | + } |
|
519 | 539 | |
520 | 540 | // We'll use the shift in the template. |
521 | 541 | $calendarGrid['shift'] = $nShift; |
@@ -549,8 +569,9 @@ discard block |
||
549 | 569 | { |
550 | 570 | // Here we offset accordingly to get things to the real start of a week. |
551 | 571 | $date_diff = $day_of_week - $calendarOptions['start_day']; |
552 | - if ($date_diff < 0) |
|
553 | - $date_diff += 7; |
|
572 | + if ($date_diff < 0) { |
|
573 | + $date_diff += 7; |
|
574 | + } |
|
554 | 575 | $new_timestamp = mktime(0, 0, 0, $month, $day, $year) - $date_diff * 86400; |
555 | 576 | $day = (int) strftime('%d', $new_timestamp); |
556 | 577 | $month = (int) strftime('%m', $new_timestamp); |
@@ -680,18 +701,20 @@ discard block |
||
680 | 701 | { |
681 | 702 | foreach ($date_events as $event_key => $event_val) |
682 | 703 | { |
683 | - if (in_array($event_val['id'], $temp)) |
|
684 | - unset($calendarGrid['events'][$date][$event_key]); |
|
685 | - else |
|
686 | - $temp[] = $event_val['id']; |
|
704 | + if (in_array($event_val['id'], $temp)) { |
|
705 | + unset($calendarGrid['events'][$date][$event_key]); |
|
706 | + } else { |
|
707 | + $temp[] = $event_val['id']; |
|
708 | + } |
|
687 | 709 | } |
688 | 710 | } |
689 | 711 | |
690 | 712 | // Give birthdays and holidays a friendly format, without the year |
691 | - if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
692 | - $date_format = '%b %d'; |
|
693 | - else |
|
694 | - $date_format = str_replace(array('%Y', '%y', '%G', '%g', '%C', '%c', '%D'), array('', '', '', '', '', '%b %d', '%m/%d'), $matches[0]); |
|
713 | + if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
714 | + $date_format = '%b %d'; |
|
715 | + } else { |
|
716 | + $date_format = str_replace(array('%Y', '%y', '%G', '%g', '%C', '%c', '%D'), array('', '', '', '', '', '%b %d', '%m/%d'), $matches[0]); |
|
717 | + } |
|
695 | 718 | |
696 | 719 | foreach (array('birthdays', 'holidays') as $type) |
697 | 720 | { |
@@ -790,8 +813,9 @@ discard block |
||
790 | 813 | // Holidays between now and now + days. |
791 | 814 | for ($i = $now; $i < $now + $days_for_index; $i += 86400) |
792 | 815 | { |
793 | - if (isset($cached_data['holidays'][strftime('%Y-%m-%d', $i)])) |
|
794 | - $return_data['calendar_holidays'] = array_merge($return_data['calendar_holidays'], $cached_data['holidays'][strftime('%Y-%m-%d', $i)]); |
|
816 | + if (isset($cached_data['holidays'][strftime('%Y-%m-%d', $i)])) { |
|
817 | + $return_data['calendar_holidays'] = array_merge($return_data['calendar_holidays'], $cached_data['holidays'][strftime('%Y-%m-%d', $i)]); |
|
818 | + } |
|
795 | 819 | } |
796 | 820 | } |
797 | 821 | |
@@ -803,8 +827,9 @@ discard block |
||
803 | 827 | $loop_date = strftime('%Y-%m-%d', $i); |
804 | 828 | if (isset($cached_data['birthdays'][$loop_date])) |
805 | 829 | { |
806 | - foreach ($cached_data['birthdays'][$loop_date] as $index => $dummy) |
|
807 | - $cached_data['birthdays'][strftime('%Y-%m-%d', $i)][$index]['is_today'] = $loop_date === $today['date']; |
|
830 | + foreach ($cached_data['birthdays'][$loop_date] as $index => $dummy) { |
|
831 | + $cached_data['birthdays'][strftime('%Y-%m-%d', $i)][$index]['is_today'] = $loop_date === $today['date']; |
|
832 | + } |
|
808 | 833 | $return_data['calendar_birthdays'] = array_merge($return_data['calendar_birthdays'], $cached_data['birthdays'][$loop_date]); |
809 | 834 | } |
810 | 835 | } |
@@ -819,8 +844,9 @@ discard block |
||
819 | 844 | $loop_date = strftime('%Y-%m-%d', $i); |
820 | 845 | |
821 | 846 | // No events today? Check the next day. |
822 | - if (empty($cached_data['events'][$loop_date])) |
|
823 | - continue; |
|
847 | + if (empty($cached_data['events'][$loop_date])) { |
|
848 | + continue; |
|
849 | + } |
|
824 | 850 | |
825 | 851 | // Loop through all events to add a few last-minute values. |
826 | 852 | foreach ($cached_data['events'][$loop_date] as $ev => $event) |
@@ -833,9 +859,9 @@ discard block |
||
833 | 859 | { |
834 | 860 | unset($cached_data['events'][$loop_date][$ev]); |
835 | 861 | continue; |
862 | + } else { |
|
863 | + $duplicates[$this_event['topic'] . $this_event['title']] = true; |
|
836 | 864 | } |
837 | - else |
|
838 | - $duplicates[$this_event['topic'] . $this_event['title']] = true; |
|
839 | 865 | |
840 | 866 | // Might be set to true afterwards, depending on the permissions. |
841 | 867 | $this_event['can_edit'] = false; |
@@ -843,16 +869,19 @@ discard block |
||
843 | 869 | $this_event['date'] = $loop_date; |
844 | 870 | } |
845 | 871 | |
846 | - if (!empty($cached_data['events'][$loop_date])) |
|
847 | - $return_data['calendar_events'] = array_merge($return_data['calendar_events'], $cached_data['events'][$loop_date]); |
|
872 | + if (!empty($cached_data['events'][$loop_date])) { |
|
873 | + $return_data['calendar_events'] = array_merge($return_data['calendar_events'], $cached_data['events'][$loop_date]); |
|
874 | + } |
|
848 | 875 | } |
849 | 876 | } |
850 | 877 | |
851 | 878 | // Mark the last item so that a list separator can be used in the template. |
852 | - for ($i = 0, $n = count($return_data['calendar_birthdays']); $i < $n; $i++) |
|
853 | - $return_data['calendar_birthdays'][$i]['is_last'] = !isset($return_data['calendar_birthdays'][$i + 1]); |
|
854 | - for ($i = 0, $n = count($return_data['calendar_events']); $i < $n; $i++) |
|
855 | - $return_data['calendar_events'][$i]['is_last'] = !isset($return_data['calendar_events'][$i + 1]); |
|
879 | + for ($i = 0, $n = count($return_data['calendar_birthdays']); $i < $n; $i++) { |
|
880 | + $return_data['calendar_birthdays'][$i]['is_last'] = !isset($return_data['calendar_birthdays'][$i + 1]); |
|
881 | + } |
|
882 | + for ($i = 0, $n = count($return_data['calendar_events']); $i < $n; $i++) { |
|
883 | + $return_data['calendar_events'][$i]['is_last'] = !isset($return_data['calendar_events'][$i + 1]); |
|
884 | + } |
|
856 | 885 | |
857 | 886 | return array( |
858 | 887 | 'data' => $return_data, |
@@ -900,37 +929,46 @@ discard block |
||
900 | 929 | if (isset($_POST['start_date'])) |
901 | 930 | { |
902 | 931 | $d = date_parse($_POST['start_date']); |
903 | - if (!empty($d['error_count']) || !empty($d['warning_count'])) |
|
904 | - fatal_lang_error('invalid_date', false); |
|
905 | - if (empty($d['year'])) |
|
906 | - fatal_lang_error('event_year_missing', false); |
|
907 | - if (empty($d['month'])) |
|
908 | - fatal_lang_error('event_month_missing', false); |
|
909 | - } |
|
910 | - elseif (isset($_POST['start_datetime'])) |
|
932 | + if (!empty($d['error_count']) || !empty($d['warning_count'])) { |
|
933 | + fatal_lang_error('invalid_date', false); |
|
934 | + } |
|
935 | + if (empty($d['year'])) { |
|
936 | + fatal_lang_error('event_year_missing', false); |
|
937 | + } |
|
938 | + if (empty($d['month'])) { |
|
939 | + fatal_lang_error('event_month_missing', false); |
|
940 | + } |
|
941 | + } elseif (isset($_POST['start_datetime'])) |
|
911 | 942 | { |
912 | 943 | $d = date_parse($_POST['start_datetime']); |
913 | - if (!empty($d['error_count']) || !empty($d['warning_count'])) |
|
914 | - fatal_lang_error('invalid_date', false); |
|
915 | - if (empty($d['year'])) |
|
916 | - fatal_lang_error('event_year_missing', false); |
|
917 | - if (empty($d['month'])) |
|
918 | - fatal_lang_error('event_month_missing', false); |
|
944 | + if (!empty($d['error_count']) || !empty($d['warning_count'])) { |
|
945 | + fatal_lang_error('invalid_date', false); |
|
946 | + } |
|
947 | + if (empty($d['year'])) { |
|
948 | + fatal_lang_error('event_year_missing', false); |
|
949 | + } |
|
950 | + if (empty($d['month'])) { |
|
951 | + fatal_lang_error('event_month_missing', false); |
|
952 | + } |
|
919 | 953 | } |
920 | 954 | // The 2.0 way |
921 | 955 | else |
922 | 956 | { |
923 | 957 | // No month? No year? |
924 | - if (!isset($_POST['month'])) |
|
925 | - fatal_lang_error('event_month_missing', false); |
|
926 | - if (!isset($_POST['year'])) |
|
927 | - fatal_lang_error('event_year_missing', false); |
|
958 | + if (!isset($_POST['month'])) { |
|
959 | + fatal_lang_error('event_month_missing', false); |
|
960 | + } |
|
961 | + if (!isset($_POST['year'])) { |
|
962 | + fatal_lang_error('event_year_missing', false); |
|
963 | + } |
|
928 | 964 | |
929 | 965 | // Check the month and year... |
930 | - if ($_POST['month'] < 1 || $_POST['month'] > 12) |
|
931 | - fatal_lang_error('invalid_month', false); |
|
932 | - if ($_POST['year'] < $modSettings['cal_minyear'] || $_POST['year'] > $modSettings['cal_maxyear']) |
|
933 | - fatal_lang_error('invalid_year', false); |
|
966 | + if ($_POST['month'] < 1 || $_POST['month'] > 12) { |
|
967 | + fatal_lang_error('invalid_month', false); |
|
968 | + } |
|
969 | + if ($_POST['year'] < $modSettings['cal_minyear'] || $_POST['year'] > $modSettings['cal_maxyear']) { |
|
970 | + fatal_lang_error('invalid_year', false); |
|
971 | + } |
|
934 | 972 | } |
935 | 973 | } |
936 | 974 | |
@@ -940,8 +978,9 @@ discard block |
||
940 | 978 | // If they want to us to calculate an end date, make sure it will fit in an acceptable range. |
941 | 979 | if (isset($_POST['span'])) |
942 | 980 | { |
943 | - if (($_POST['span'] < 1) || (!empty($modSettings['cal_maxspan']) && $_POST['span'] > $modSettings['cal_maxspan'])) |
|
944 | - fatal_lang_error('invalid_days_numb', false); |
|
981 | + if (($_POST['span'] < 1) || (!empty($modSettings['cal_maxspan']) && $_POST['span'] > $modSettings['cal_maxspan'])) { |
|
982 | + fatal_lang_error('invalid_days_numb', false); |
|
983 | + } |
|
945 | 984 | } |
946 | 985 | |
947 | 986 | // There is no need to validate the following values if we are just deleting the event. |
@@ -951,24 +990,29 @@ discard block |
||
951 | 990 | if (empty($_POST['start_date']) && empty($_POST['start_datetime'])) |
952 | 991 | { |
953 | 992 | // No day? |
954 | - if (!isset($_POST['day'])) |
|
955 | - fatal_lang_error('event_day_missing', false); |
|
993 | + if (!isset($_POST['day'])) { |
|
994 | + fatal_lang_error('event_day_missing', false); |
|
995 | + } |
|
956 | 996 | |
957 | 997 | // Bad day? |
958 | - if (!checkdate($_POST['month'], $_POST['day'], $_POST['year'])) |
|
959 | - fatal_lang_error('invalid_date', false); |
|
998 | + if (!checkdate($_POST['month'], $_POST['day'], $_POST['year'])) { |
|
999 | + fatal_lang_error('invalid_date', false); |
|
1000 | + } |
|
960 | 1001 | } |
961 | 1002 | |
962 | - if (!isset($_POST['evtitle']) && !isset($_POST['subject'])) |
|
963 | - fatal_lang_error('event_title_missing', false); |
|
964 | - elseif (!isset($_POST['evtitle'])) |
|
965 | - $_POST['evtitle'] = $_POST['subject']; |
|
1003 | + if (!isset($_POST['evtitle']) && !isset($_POST['subject'])) { |
|
1004 | + fatal_lang_error('event_title_missing', false); |
|
1005 | + } elseif (!isset($_POST['evtitle'])) { |
|
1006 | + $_POST['evtitle'] = $_POST['subject']; |
|
1007 | + } |
|
966 | 1008 | |
967 | 1009 | // No title? |
968 | - if ($smcFunc['htmltrim']($_POST['evtitle']) === '') |
|
969 | - fatal_lang_error('no_event_title', false); |
|
970 | - if ($smcFunc['strlen']($_POST['evtitle']) > 100) |
|
971 | - $_POST['evtitle'] = $smcFunc['substr']($_POST['evtitle'], 0, 100); |
|
1010 | + if ($smcFunc['htmltrim']($_POST['evtitle']) === '') { |
|
1011 | + fatal_lang_error('no_event_title', false); |
|
1012 | + } |
|
1013 | + if ($smcFunc['strlen']($_POST['evtitle']) > 100) { |
|
1014 | + $_POST['evtitle'] = $smcFunc['substr']($_POST['evtitle'], 0, 100); |
|
1015 | + } |
|
972 | 1016 | $_POST['evtitle'] = str_replace(';', '', $_POST['evtitle']); |
973 | 1017 | } |
974 | 1018 | } |
@@ -995,8 +1039,9 @@ discard block |
||
995 | 1039 | ); |
996 | 1040 | |
997 | 1041 | // No results, return false. |
998 | - if ($smcFunc['db_num_rows'] === 0) |
|
999 | - return false; |
|
1042 | + if ($smcFunc['db_num_rows'] === 0) { |
|
1043 | + return false; |
|
1044 | + } |
|
1000 | 1045 | |
1001 | 1046 | // Grab the results and return. |
1002 | 1047 | list ($poster) = $smcFunc['db_fetch_row']($request); |
@@ -1130,8 +1175,9 @@ discard block |
||
1130 | 1175 | call_integration_hook('integrate_modify_event', array($event_id, &$eventOptions, &$event_columns, &$event_parameters)); |
1131 | 1176 | |
1132 | 1177 | $column_clauses = array(); |
1133 | - foreach ($event_columns as $col => $crit) |
|
1134 | - $column_clauses[] = $col . ' = ' . $crit; |
|
1178 | + foreach ($event_columns as $col => $crit) { |
|
1179 | + $column_clauses[] = $col . ' = ' . $crit; |
|
1180 | + } |
|
1135 | 1181 | |
1136 | 1182 | $smcFunc['db_query']('', ' |
1137 | 1183 | UPDATE {db_prefix}calendar |
@@ -1216,8 +1262,9 @@ discard block |
||
1216 | 1262 | ); |
1217 | 1263 | |
1218 | 1264 | // If nothing returned, we are in poo, poo. |
1219 | - if ($smcFunc['db_num_rows']($request) === 0) |
|
1220 | - return false; |
|
1265 | + if ($smcFunc['db_num_rows']($request) === 0) { |
|
1266 | + return false; |
|
1267 | + } |
|
1221 | 1268 | |
1222 | 1269 | $row = $smcFunc['db_fetch_assoc']($request); |
1223 | 1270 | $smcFunc['db_free_result']($request); |
@@ -1225,8 +1272,9 @@ discard block |
||
1225 | 1272 | list($start, $end, $allday, $span, $tz, $tz_abbrev) = buildEventDatetimes($row); |
1226 | 1273 | |
1227 | 1274 | // Sanity check |
1228 | - if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) |
|
1229 | - return false; |
|
1275 | + if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) { |
|
1276 | + return false; |
|
1277 | + } |
|
1230 | 1278 | |
1231 | 1279 | $return_value = array( |
1232 | 1280 | 'boards' => array(), |
@@ -1363,24 +1411,27 @@ discard block |
||
1363 | 1411 | |
1364 | 1412 | // Set $span, in case we need it |
1365 | 1413 | $span = isset($eventOptions['span']) ? $eventOptions['span'] : (isset($_POST['span']) ? $_POST['span'] : 0); |
1366 | - if ($span > 0) |
|
1367 | - $span = !empty($modSettings['cal_maxspan']) ? min($modSettings['cal_maxspan'], $span - 1) : $span - 1; |
|
1414 | + if ($span > 0) { |
|
1415 | + $span = !empty($modSettings['cal_maxspan']) ? min($modSettings['cal_maxspan'], $span - 1) : $span - 1; |
|
1416 | + } |
|
1368 | 1417 | |
1369 | 1418 | // Define the timezone for this event, falling back to the default if not provided |
1370 | - if (!empty($eventOptions['tz']) && in_array($eventOptions['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
1371 | - $tz = $eventOptions['tz']; |
|
1372 | - elseif (!empty($_POST['tz']) && in_array($_POST['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
1373 | - $tz = $_POST['tz']; |
|
1374 | - else |
|
1375 | - $tz = getUserTimezone(); |
|
1419 | + if (!empty($eventOptions['tz']) && in_array($eventOptions['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
1420 | + $tz = $eventOptions['tz']; |
|
1421 | + } elseif (!empty($_POST['tz']) && in_array($_POST['tz'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
1422 | + $tz = $_POST['tz']; |
|
1423 | + } else { |
|
1424 | + $tz = getUserTimezone(); |
|
1425 | + } |
|
1376 | 1426 | |
1377 | 1427 | // Is this supposed to be an all day event, or should it have specific start and end times? |
1378 | - if (isset($eventOptions['allday'])) |
|
1379 | - $allday = $eventOptions['allday']; |
|
1380 | - elseif (empty($_POST['allday'])) |
|
1381 | - $allday = false; |
|
1382 | - else |
|
1383 | - $allday = true; |
|
1428 | + if (isset($eventOptions['allday'])) { |
|
1429 | + $allday = $eventOptions['allday']; |
|
1430 | + } elseif (empty($_POST['allday'])) { |
|
1431 | + $allday = false; |
|
1432 | + } else { |
|
1433 | + $allday = true; |
|
1434 | + } |
|
1384 | 1435 | |
1385 | 1436 | // Input might come as individual parameters... |
1386 | 1437 | $start_year = isset($eventOptions['year']) ? $eventOptions['year'] : (isset($_POST['year']) ? $_POST['year'] : null); |
@@ -1407,10 +1458,12 @@ discard block |
||
1407 | 1458 | $end_time_string = isset($eventOptions['end_time']) ? $eventOptions['end_time'] : (isset($_POST['end_time']) ? $_POST['end_time'] : null); |
1408 | 1459 | |
1409 | 1460 | // If the date and time were given in separate strings, combine them |
1410 | - if (empty($start_string) && isset($start_date_string)) |
|
1411 | - $start_string = $start_date_string . (isset($start_time_string) ? ' ' . $start_time_string : ''); |
|
1412 | - if (empty($end_string) && isset($end_date_string)) |
|
1413 | - $end_string = $end_date_string . (isset($end_time_string) ? ' ' . $end_time_string : ''); |
|
1461 | + if (empty($start_string) && isset($start_date_string)) { |
|
1462 | + $start_string = $start_date_string . (isset($start_time_string) ? ' ' . $start_time_string : ''); |
|
1463 | + } |
|
1464 | + if (empty($end_string) && isset($end_date_string)) { |
|
1465 | + $end_string = $end_date_string . (isset($end_time_string) ? ' ' . $end_time_string : ''); |
|
1466 | + } |
|
1414 | 1467 | |
1415 | 1468 | // If some form of string input was given, override individually defined options with it |
1416 | 1469 | if (isset($start_string)) |
@@ -1501,10 +1554,11 @@ discard block |
||
1501 | 1554 | if ($start_object >= $end_object) |
1502 | 1555 | { |
1503 | 1556 | $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, $start_hour, $start_minute, $start_second) . ' ' . $tz); |
1504 | - if ($span > 0) |
|
1505 | - date_add($end_object, date_interval_create_from_date_string($span . ' days')); |
|
1506 | - else |
|
1507 | - date_add($end_object, date_interval_create_from_date_string('1 hour')); |
|
1557 | + if ($span > 0) { |
|
1558 | + date_add($end_object, date_interval_create_from_date_string($span . ' days')); |
|
1559 | + } else { |
|
1560 | + date_add($end_object, date_interval_create_from_date_string('1 hour')); |
|
1561 | + } |
|
1508 | 1562 | } |
1509 | 1563 | |
1510 | 1564 | // Is $end_object too late? |
@@ -1517,9 +1571,9 @@ discard block |
||
1517 | 1571 | { |
1518 | 1572 | $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, $start_hour, $start_minute, $start_second) . ' ' . $tz); |
1519 | 1573 | date_add($end_object, date_interval_create_from_date_string($modSettings['cal_maxspan'] . ' days')); |
1574 | + } else { |
|
1575 | + $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, '11', '59', '59') . ' ' . $tz); |
|
1520 | 1576 | } |
1521 | - else |
|
1522 | - $end_object = date_create(sprintf('%04d-%02d-%02d %02d:%02d:%02d', $start_year, $start_month, $start_day, '11', '59', '59') . ' ' . $tz); |
|
1523 | 1577 | } |
1524 | 1578 | } |
1525 | 1579 | |
@@ -1532,8 +1586,7 @@ discard block |
||
1532 | 1586 | $start_time = null; |
1533 | 1587 | $end_time = null; |
1534 | 1588 | $tz = null; |
1535 | - } |
|
1536 | - else |
|
1589 | + } else |
|
1537 | 1590 | { |
1538 | 1591 | $start_time = date_format($start_object, 'H:i:s'); |
1539 | 1592 | $end_time = date_format($end_object, 'H:i:s'); |
@@ -1559,19 +1612,21 @@ discard block |
||
1559 | 1612 | // First, try to create a better date format, ignoring the "time" elements. |
1560 | 1613 | if (empty($date_format)) |
1561 | 1614 | { |
1562 | - if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
1563 | - $date_format = '%F'; |
|
1564 | - else |
|
1565 | - $date_format = $matches[0]; |
|
1615 | + if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
1616 | + $date_format = '%F'; |
|
1617 | + } else { |
|
1618 | + $date_format = $matches[0]; |
|
1619 | + } |
|
1566 | 1620 | } |
1567 | 1621 | |
1568 | 1622 | // We want a fairly compact version of the time, but as close as possible to the user's settings. |
1569 | 1623 | if (empty($time_format)) |
1570 | 1624 | { |
1571 | - if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
1572 | - $time_format = '%k:%M'; |
|
1573 | - else |
|
1574 | - $time_format = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
1625 | + if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
1626 | + $time_format = '%k:%M'; |
|
1627 | + } else { |
|
1628 | + $time_format = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
1629 | + } |
|
1575 | 1630 | } |
1576 | 1631 | |
1577 | 1632 | // Should this be an all day event? |
@@ -1581,11 +1636,13 @@ discard block |
||
1581 | 1636 | $span = 1 + date_interval_format(date_diff(date_create($row['start_date']), date_create($row['end_date'])), '%d'); |
1582 | 1637 | |
1583 | 1638 | // We need to have a defined timezone in the steps below |
1584 | - if (empty($row['timezone'])) |
|
1585 | - $row['timezone'] = getUserTimezone(); |
|
1639 | + if (empty($row['timezone'])) { |
|
1640 | + $row['timezone'] = getUserTimezone(); |
|
1641 | + } |
|
1586 | 1642 | |
1587 | - if (empty($timezone_array[$row['timezone']])) |
|
1588 | - $timezone_array[$row['timezone']] = timezone_open($row['timezone']); |
|
1643 | + if (empty($timezone_array[$row['timezone']])) { |
|
1644 | + $timezone_array[$row['timezone']] = timezone_open($row['timezone']); |
|
1645 | + } |
|
1589 | 1646 | |
1590 | 1647 | // Get most of the standard date information for the start and end datetimes |
1591 | 1648 | $start = date_parse($row['start_date'] . (!$allday ? ' ' . $row['start_time'] : '')); |
@@ -1633,8 +1690,9 @@ discard block |
||
1633 | 1690 | global $smcFunc, $context, $user_info, $modSettings, $user_settings; |
1634 | 1691 | static $member_cache = array(); |
1635 | 1692 | |
1636 | - if (is_null($id_member) && $user_info['is_guest'] == false) |
|
1637 | - $id_member = $context['user']['id']; |
|
1693 | + if (is_null($id_member) && $user_info['is_guest'] == false) { |
|
1694 | + $id_member = $context['user']['id']; |
|
1695 | + } |
|
1638 | 1696 | |
1639 | 1697 | //check if the cache got the data |
1640 | 1698 | if (isset($id_member) && isset($member_cache[$id_member])) |
@@ -1663,11 +1721,13 @@ discard block |
||
1663 | 1721 | $smcFunc['db_free_result']($request); |
1664 | 1722 | } |
1665 | 1723 | |
1666 | - if (empty($timezone) || !in_array($timezone, timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) |
|
1667 | - $timezone = isset($modSettings['default_timezone']) ? $modSettings['default_timezone'] : date_default_timezone_get(); |
|
1724 | + if (empty($timezone) || !in_array($timezone, timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) { |
|
1725 | + $timezone = isset($modSettings['default_timezone']) ? $modSettings['default_timezone'] : date_default_timezone_get(); |
|
1726 | + } |
|
1668 | 1727 | |
1669 | - if (isset($id_member)) |
|
1670 | - $member_cache[$id_member] = $timezone; |
|
1728 | + if (isset($id_member)) { |
|
1729 | + $member_cache[$id_member] = $timezone; |
|
1730 | + } |
|
1671 | 1731 | |
1672 | 1732 | return $timezone; |
1673 | 1733 | } |
@@ -1696,8 +1756,9 @@ discard block |
||
1696 | 1756 | ) |
1697 | 1757 | ); |
1698 | 1758 | $holidays = array(); |
1699 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1700 | - $holidays[] = $row; |
|
1759 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1760 | + $holidays[] = $row; |
|
1761 | + } |
|
1701 | 1762 | $smcFunc['db_free_result']($request); |
1702 | 1763 | |
1703 | 1764 | return $holidays; |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Retrieve a list and several other statistics of the users currently online. |
@@ -45,8 +46,9 @@ discard block |
||
45 | 46 | } |
46 | 47 | |
47 | 48 | // Not allowed sort method? Bang! Error! |
48 | - elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options)) |
|
49 | - trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE); |
|
49 | + elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options)) { |
|
50 | + trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE); |
|
51 | + } |
|
50 | 52 | |
51 | 53 | // Initialize the array that'll be returned later on. |
52 | 54 | $membersOnlineStats = array( |
@@ -63,8 +65,9 @@ discard block |
||
63 | 65 | // Get any spiders if enabled. |
64 | 66 | $spiders = array(); |
65 | 67 | $spider_finds = array(); |
66 | - if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) |
|
67 | - $spiders = $smcFunc['json_decode']($modSettings['spider_name_cache'], true); |
|
68 | + if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) { |
|
69 | + $spiders = $smcFunc['json_decode']($modSettings['spider_name_cache'], true); |
|
70 | + } |
|
68 | 71 | |
69 | 72 | // Load the users online right now. |
70 | 73 | $request = $smcFunc['db_query']('', ' |
@@ -92,9 +95,7 @@ discard block |
||
92 | 95 | $membersOnlineStats['num_guests']++; |
93 | 96 | |
94 | 97 | continue; |
95 | - } |
|
96 | - |
|
97 | - elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) |
|
98 | + } elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) |
|
98 | 99 | { |
99 | 100 | // Just increase the stats and don't add this hidden user to any list. |
100 | 101 | $membersOnlineStats['num_users_hidden']++; |
@@ -102,10 +103,11 @@ discard block |
||
102 | 103 | } |
103 | 104 | |
104 | 105 | // Some basic color coding... |
105 | - if (!empty($row['online_color'])) |
|
106 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
107 | - else |
|
108 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
106 | + if (!empty($row['online_color'])) { |
|
107 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
108 | + } else { |
|
109 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
110 | + } |
|
109 | 111 | |
110 | 112 | // Buddies get counted and highlighted. |
111 | 113 | $is_buddy = in_array($row['id_member'], $user_info['buddies']); |
@@ -132,8 +134,8 @@ discard block |
||
132 | 134 | $membersOnlineStats['list_users_online'][$row[$membersOnlineOptions['sort']] . '_' . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
133 | 135 | |
134 | 136 | // Store all distinct (primary) membergroups that are shown. |
135 | - if (!isset($membersOnlineStats['online_groups'][$row['id_group']])) |
|
136 | - $membersOnlineStats['online_groups'][$row['id_group']] = array( |
|
137 | + if (!isset($membersOnlineStats['online_groups'][$row['id_group']])) { |
|
138 | + $membersOnlineStats['online_groups'][$row['id_group']] = array( |
|
137 | 139 | 'id' => $row['id_group'], |
138 | 140 | 'name' => $row['group_name'], |
139 | 141 | 'color' => $row['online_color'], |
@@ -141,6 +143,7 @@ discard block |
||
141 | 143 | 'type' => $row['group_type'], |
142 | 144 | 'parent' => $row['id_parent'], |
143 | 145 | ); |
146 | + } |
|
144 | 147 | } |
145 | 148 | $smcFunc['db_free_result']($request); |
146 | 149 | |
@@ -201,11 +204,12 @@ discard block |
||
201 | 204 | $settingsToUpdate = array(); |
202 | 205 | |
203 | 206 | // More members on now than ever were? Update it! |
204 | - if (!isset($modSettings['mostOnline']) || $total_users_online >= $modSettings['mostOnline']) |
|
205 | - $settingsToUpdate = array( |
|
207 | + if (!isset($modSettings['mostOnline']) || $total_users_online >= $modSettings['mostOnline']) { |
|
208 | + $settingsToUpdate = array( |
|
206 | 209 | 'mostOnline' => $total_users_online, |
207 | 210 | 'mostDate' => time() |
208 | 211 | ); |
212 | + } |
|
209 | 213 | |
210 | 214 | $date = strftime('%Y-%m-%d', forum_time(false)); |
211 | 215 | |
@@ -237,8 +241,9 @@ discard block |
||
237 | 241 | { |
238 | 242 | list ($modSettings['mostOnlineToday']) = $smcFunc['db_fetch_row']($request); |
239 | 243 | |
240 | - if ($total_users_online > $modSettings['mostOnlineToday']) |
|
241 | - trackStats(array('most_on' => $total_users_online)); |
|
244 | + if ($total_users_online > $modSettings['mostOnlineToday']) { |
|
245 | + trackStats(array('most_on' => $total_users_online)); |
|
246 | + } |
|
242 | 247 | |
243 | 248 | $total_users_online = max($total_users_online, $modSettings['mostOnlineToday']); |
244 | 249 | } |
@@ -255,8 +260,9 @@ discard block |
||
255 | 260 | $settingsToUpdate['mostOnlineToday'] = $total_users_online; |
256 | 261 | } |
257 | 262 | |
258 | - if (!empty($settingsToUpdate)) |
|
259 | - updateSettings($settingsToUpdate); |
|
260 | -} |
|
263 | + if (!empty($settingsToUpdate)) { |
|
264 | + updateSettings($settingsToUpdate); |
|
265 | + } |
|
266 | + } |
|
261 | 267 | |
262 | 268 | ?> |
263 | 269 | \ No newline at end of file |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Class Likes |
@@ -106,8 +107,9 @@ discard block |
||
106 | 107 | $this->_extra = isset($_GET['extra']) ? $_GET['extra'] : false; |
107 | 108 | |
108 | 109 | // We do not want to output debug information here. |
109 | - if ($this->_js) |
|
110 | - $db_show_debug = false; |
|
110 | + if ($this->_js) { |
|
111 | + $db_show_debug = false; |
|
112 | + } |
|
111 | 113 | } |
112 | 114 | |
113 | 115 | /** |
@@ -141,8 +143,9 @@ discard block |
||
141 | 143 | $call = $this->_sa; |
142 | 144 | |
143 | 145 | // Guest can only view likes. |
144 | - if ($call != 'view') |
|
145 | - is_not_guest(); |
|
146 | + if ($call != 'view') { |
|
147 | + is_not_guest(); |
|
148 | + } |
|
146 | 149 | |
147 | 150 | checkSession('get'); |
148 | 151 | |
@@ -180,15 +183,17 @@ discard block |
||
180 | 183 | global $smcFunc, $modSettings; |
181 | 184 | |
182 | 185 | // This feature is currently disable. |
183 | - if (empty($modSettings['enable_likes'])) |
|
184 | - return $this->_error = 'like_disable'; |
|
186 | + if (empty($modSettings['enable_likes'])) { |
|
187 | + return $this->_error = 'like_disable'; |
|
188 | + } |
|
185 | 189 | |
186 | 190 | // Zerothly, they did indicate some kind of content to like, right? |
187 | 191 | preg_match('~^([a-z0-9\-\_]{1,6})~i', $this->_type, $matches); |
188 | 192 | $this->_type = isset($matches[1]) ? $matches[1] : ''; |
189 | 193 | |
190 | - if ($this->_type == '' || $this->_content <= 0) |
|
191 | - return $this->_error = 'cannot_'; |
|
194 | + if ($this->_type == '' || $this->_content <= 0) { |
|
195 | + return $this->_error = 'cannot_'; |
|
196 | + } |
|
192 | 197 | |
193 | 198 | // First we need to verify if the user can see the type of content or not. This is set up to be extensible, |
194 | 199 | // so we'll check for the one type we do know about, and if it's not that, we'll defer to any hooks. |
@@ -207,12 +212,14 @@ discard block |
||
207 | 212 | 'msg' => $this->_content, |
208 | 213 | ) |
209 | 214 | ); |
210 | - if ($smcFunc['db_num_rows']($request) == 1) |
|
211 | - list ($this->_idTopic, $topicOwner) = $smcFunc['db_fetch_row']($request); |
|
215 | + if ($smcFunc['db_num_rows']($request) == 1) { |
|
216 | + list ($this->_idTopic, $topicOwner) = $smcFunc['db_fetch_row']($request); |
|
217 | + } |
|
212 | 218 | |
213 | 219 | $smcFunc['db_free_result']($request); |
214 | - if (empty($this->_idTopic)) |
|
215 | - return $this->_error = 'cannot_'; |
|
220 | + if (empty($this->_idTopic)) { |
|
221 | + return $this->_error = 'cannot_'; |
|
222 | + } |
|
216 | 223 | |
217 | 224 | // So we know what topic it's in and more importantly we know the user can see it. |
218 | 225 | // If we're not viewing, we need some info set up. |
@@ -221,9 +228,7 @@ discard block |
||
221 | 228 | $this->_validLikes['redirect'] = 'topic=' . $this->_idTopic . '.msg' . $this->_content . '#msg' . $this->_content; |
222 | 229 | |
223 | 230 | $this->_validLikes['can_like'] = ($this->_user['id'] == $topicOwner ? 'cannot_like_content' : (allowedTo('likes_like') ? true : 'cannot_like_content')); |
224 | - } |
|
225 | - |
|
226 | - else |
|
231 | + } else |
|
227 | 232 | { |
228 | 233 | // Modders: This will give you whatever the user offers up in terms of liking, e.g. $this->_type=msg, $this->_content=1 |
229 | 234 | // When you hook this, check $this->_type first. If it is not something your mod worries about, return false. |
@@ -241,8 +246,9 @@ discard block |
||
241 | 246 | if ($result !== false) |
242 | 247 | { |
243 | 248 | // Match the type with what we already have. |
244 | - if (!isset($result['type']) || $result['type'] != $this->_type) |
|
245 | - return $this->_error = 'not_valid_like_type'; |
|
249 | + if (!isset($result['type']) || $result['type'] != $this->_type) { |
|
250 | + return $this->_error = 'not_valid_like_type'; |
|
251 | + } |
|
246 | 252 | |
247 | 253 | // Fill out the rest. |
248 | 254 | $this->_type = $result['type']; |
@@ -253,13 +259,15 @@ discard block |
||
253 | 259 | } |
254 | 260 | } |
255 | 261 | |
256 | - if (!$found) |
|
257 | - return $this->_error = 'cannot_'; |
|
262 | + if (!$found) { |
|
263 | + return $this->_error = 'cannot_'; |
|
264 | + } |
|
258 | 265 | } |
259 | 266 | |
260 | 267 | // Does the user can like this? Viewing a list of likes doesn't require this permission. |
261 | - if ($this->_sa != 'view' && isset($this->_validLikes['can_like']) && is_string($this->_validLikes['can_like'])) |
|
262 | - return $this->_error = $this->_validLikes['can_like']; |
|
268 | + if ($this->_sa != 'view' && isset($this->_validLikes['can_like']) && is_string($this->_validLikes['can_like'])) { |
|
269 | + return $this->_error = $this->_validLikes['can_like']; |
|
270 | + } |
|
263 | 271 | } |
264 | 272 | |
265 | 273 | /** |
@@ -284,8 +292,9 @@ discard block |
||
284 | 292 | ); |
285 | 293 | |
286 | 294 | // Are we calling this directly? if so, set a proper data for the response. Do note that __METHOD__ returns both the class name and the function name. |
287 | - if ($this->_sa == __FUNCTION__) |
|
288 | - $this->_data = __FUNCTION__; |
|
295 | + if ($this->_sa == __FUNCTION__) { |
|
296 | + $this->_data = __FUNCTION__; |
|
297 | + } |
|
289 | 298 | } |
290 | 299 | |
291 | 300 | /** |
@@ -315,8 +324,8 @@ discard block |
||
315 | 324 | |
316 | 325 | // Add a background task to process sending alerts. |
317 | 326 | // Mod author, you can add your own background task for your own custom like event using the "integrate_issue_like" hook or your callback, both are immediately called after this. |
318 | - if ($this->_type == 'msg') |
|
319 | - $smcFunc['db_insert']('insert', |
|
327 | + if ($this->_type == 'msg') { |
|
328 | + $smcFunc['db_insert']('insert', |
|
320 | 329 | '{db_prefix}background_tasks', |
321 | 330 | array('task_file' => 'string', 'task_class' => 'string', 'task_data' => 'string', 'claimed_time' => 'int'), |
322 | 331 | array('$sourcedir/tasks/Likes-Notify.php', 'Likes_Notify_Background', $smcFunc['json_encode'](array( |
@@ -328,10 +337,12 @@ discard block |
||
328 | 337 | )), 0), |
329 | 338 | array('id_task') |
330 | 339 | ); |
340 | + } |
|
331 | 341 | |
332 | 342 | // Are we calling this directly? if so, set a proper data for the response. Do note that __METHOD__ returns both the class name and the function name. |
333 | - if ($this->_sa == __FUNCTION__) |
|
334 | - $this->_data = __FUNCTION__; |
|
343 | + if ($this->_sa == __FUNCTION__) { |
|
344 | + $this->_data = __FUNCTION__; |
|
345 | + } |
|
335 | 346 | } |
336 | 347 | |
337 | 348 | /** |
@@ -357,8 +368,9 @@ discard block |
||
357 | 368 | $smcFunc['db_free_result']($request); |
358 | 369 | |
359 | 370 | // If you want to call this directly, fill out _data property too. |
360 | - if ($this->_sa == __FUNCTION__) |
|
361 | - $this->_data = $this->_numLikes; |
|
371 | + if ($this->_sa == __FUNCTION__) { |
|
372 | + $this->_data = $this->_numLikes; |
|
373 | + } |
|
362 | 374 | } |
363 | 375 | |
364 | 376 | /** |
@@ -371,8 +383,9 @@ discard block |
||
371 | 383 | global $smcFunc; |
372 | 384 | |
373 | 385 | // Safety first! |
374 | - if (empty($this->_type) || empty($this->_content)) |
|
375 | - return $this->_error = 'cannot_'; |
|
386 | + if (empty($this->_type) || empty($this->_content)) { |
|
387 | + return $this->_error = 'cannot_'; |
|
388 | + } |
|
376 | 389 | |
377 | 390 | // Do we already like this? |
378 | 391 | $request = $smcFunc['db_query']('', ' |
@@ -390,26 +403,28 @@ discard block |
||
390 | 403 | $this->_alreadyLiked = (bool) $smcFunc['db_num_rows']($request) != 0; |
391 | 404 | $smcFunc['db_free_result']($request); |
392 | 405 | |
393 | - if ($this->_alreadyLiked) |
|
394 | - $this->delete(); |
|
395 | - |
|
396 | - else |
|
397 | - $this->insert(); |
|
406 | + if ($this->_alreadyLiked) { |
|
407 | + $this->delete(); |
|
408 | + } else { |
|
409 | + $this->insert(); |
|
410 | + } |
|
398 | 411 | |
399 | 412 | // Now, how many people like this content now? We *could* just +1 / -1 the relevant container but that has proven to become unstable. |
400 | 413 | $this->_count(); |
401 | 414 | |
402 | 415 | // Update the likes count for messages. |
403 | - if ($this->_type == 'msg') |
|
404 | - $this->msgIssueLike(); |
|
416 | + if ($this->_type == 'msg') { |
|
417 | + $this->msgIssueLike(); |
|
418 | + } |
|
405 | 419 | |
406 | 420 | // Any callbacks? |
407 | 421 | elseif (!empty($this->_validLikes['callback'])) |
408 | 422 | { |
409 | 423 | $call = call_helper($this->_validLikes['callback'], true); |
410 | 424 | |
411 | - if (!empty($call)) |
|
412 | - call_user_func_array($call, array($this)); |
|
425 | + if (!empty($call)) { |
|
426 | + call_user_func_array($call, array($this)); |
|
427 | + } |
|
413 | 428 | } |
414 | 429 | |
415 | 430 | // Sometimes there might be other things that need updating after we do this like. |
@@ -418,8 +433,9 @@ discard block |
||
418 | 433 | // Now some clean up. This is provided here for any like handlers that want to do any cache flushing. |
419 | 434 | // This way a like handler doesn't need to explicitly declare anything in integrate_issue_like, but do so |
420 | 435 | // in integrate_valid_likes where it absolutely has to exist. |
421 | - if (!empty($this->_validLikes['flush_cache'])) |
|
422 | - cache_put_data($this->_validLikes['flush_cache'], null); |
|
436 | + if (!empty($this->_validLikes['flush_cache'])) { |
|
437 | + cache_put_data($this->_validLikes['flush_cache'], null); |
|
438 | + } |
|
423 | 439 | |
424 | 440 | // All done, start building the data to pass as response. |
425 | 441 | $this->_data = array( |
@@ -442,8 +458,9 @@ discard block |
||
442 | 458 | { |
443 | 459 | global $smcFunc; |
444 | 460 | |
445 | - if ($this->_type !== 'msg') |
|
446 | - return; |
|
461 | + if ($this->_type !== 'msg') { |
|
462 | + return; |
|
463 | + } |
|
447 | 464 | |
448 | 465 | $smcFunc['db_query']('', ' |
449 | 466 | UPDATE {db_prefix}messages |
@@ -484,8 +501,9 @@ discard block |
||
484 | 501 | 'like_type' => $this->_type, |
485 | 502 | ) |
486 | 503 | ); |
487 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
488 | - $context['likers'][$row['id_member']] = array('timestamp' => $row['like_time']); |
|
504 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
505 | + $context['likers'][$row['id_member']] = array('timestamp' => $row['like_time']); |
|
506 | + } |
|
489 | 507 | |
490 | 508 | // Now to get member data, including avatars and so on. |
491 | 509 | $members = array_keys($context['likers']); |
@@ -493,8 +511,9 @@ discard block |
||
493 | 511 | if (count($loaded) != count($members)) |
494 | 512 | { |
495 | 513 | $members = array_diff($members, $loaded); |
496 | - foreach ($members as $not_loaded) |
|
497 | - unset ($context['likers'][$not_loaded]); |
|
514 | + foreach ($members as $not_loaded) { |
|
515 | + unset ($context['likers'][$not_loaded]); |
|
516 | + } |
|
498 | 517 | } |
499 | 518 | |
500 | 519 | foreach ($context['likers'] as $liker => $dummy) |
@@ -536,12 +555,14 @@ discard block |
||
536 | 555 | global $context, $txt; |
537 | 556 | |
538 | 557 | // Don't do anything if someone else has already take care of the response. |
539 | - if (!$this->_setResponse) |
|
540 | - return; |
|
558 | + if (!$this->_setResponse) { |
|
559 | + return; |
|
560 | + } |
|
541 | 561 | |
542 | 562 | // Want a json response huh? |
543 | - if ($this->_validLikes['json']) |
|
544 | - return $this->jsonResponse(); |
|
563 | + if ($this->_validLikes['json']) { |
|
564 | + return $this->jsonResponse(); |
|
565 | + } |
|
545 | 566 | |
546 | 567 | // Set everything up for display. |
547 | 568 | loadTemplate('Likes'); |
@@ -551,8 +572,9 @@ discard block |
||
551 | 572 | if ($this->_error) |
552 | 573 | { |
553 | 574 | // If this is a generic error, set it up good. |
554 | - if ($this->_error == 'cannot_') |
|
555 | - $this->_error = $this->_sa == 'view' ? 'cannot_view_likes' : 'cannot_like_content'; |
|
575 | + if ($this->_error == 'cannot_') { |
|
576 | + $this->_error = $this->_sa == 'view' ? 'cannot_view_likes' : 'cannot_like_content'; |
|
577 | + } |
|
556 | 578 | |
557 | 579 | // Is this request coming from an ajax call? |
558 | 580 | if ($this->_js) |
@@ -562,8 +584,9 @@ discard block |
||
562 | 584 | } |
563 | 585 | |
564 | 586 | // Nope? then just do a redirect to whatever URL was provided. |
565 | - else |
|
566 | - redirectexit(!empty($this->_validLikes['redirect']) ? $this->_validLikes['redirect'] . ';error=' . $this->_error : ''); |
|
587 | + else { |
|
588 | + redirectexit(!empty($this->_validLikes['redirect']) ? $this->_validLikes['redirect'] . ';error=' . $this->_error : ''); |
|
589 | + } |
|
567 | 590 | |
568 | 591 | return; |
569 | 592 | } |
@@ -572,8 +595,9 @@ discard block |
||
572 | 595 | else |
573 | 596 | { |
574 | 597 | // Not an ajax request so send the user back to the previous location or the main page. |
575 | - if (!$this->_js) |
|
576 | - redirectexit(!empty($this->_validLikes['redirect']) ? $this->_validLikes['redirect'] : ''); |
|
598 | + if (!$this->_js) { |
|
599 | + redirectexit(!empty($this->_validLikes['redirect']) ? $this->_validLikes['redirect'] : ''); |
|
600 | + } |
|
577 | 601 | |
578 | 602 | // These fine gentlemen all share the same template. |
579 | 603 | $generic = array('delete', 'insert', '_count'); |
@@ -606,8 +630,9 @@ discard block |
||
606 | 630 | // If there is an error, send it. |
607 | 631 | if ($this->_error) |
608 | 632 | { |
609 | - if ($this->_error == 'cannot_') |
|
610 | - $this->_error = $this->_sa == 'view' ? 'cannot_view_likes' : 'cannot_like_content'; |
|
633 | + if ($this->_error == 'cannot_') { |
|
634 | + $this->_error = $this->_sa == 'view' ? 'cannot_view_likes' : 'cannot_like_content'; |
|
635 | + } |
|
611 | 636 | |
612 | 637 | $print['error'] = $this->_error; |
613 | 638 | } |
@@ -643,33 +668,36 @@ discard block |
||
643 | 668 | <body style="background-color: #444455; color: white; font-style: italic; font-family: serif;"> |
644 | 669 | <div style="margin-top: 12%; font-size: 1.1em; line-height: 1.4; text-align: center;">'; |
645 | 670 | |
646 | - if (!isset($_GET['verse']) || ($_GET['verse'] != '2:18' && $_GET['verse'] != '22:1-2')) |
|
647 | - $_GET['verse'] = '4:16'; |
|
671 | + if (!isset($_GET['verse']) || ($_GET['verse'] != '2:18' && $_GET['verse'] != '22:1-2')) { |
|
672 | + $_GET['verse'] = '4:16'; |
|
673 | + } |
|
648 | 674 | |
649 | - if ($_GET['verse'] == '2:18') |
|
650 | - echo ' |
|
675 | + if ($_GET['verse'] == '2:18') { |
|
676 | + echo ' |
|
651 | 677 | Woe, it was that his name wasn\'t <em>known</em>, that he came in mystery, and was recognized by none. And it became to be in those days <em>something</em>. Something not yet <em id="unknown" name="[Unknown]">unknown</em> to mankind. And thus what was to be known the <em>secret project</em> began into its existence. Henceforth the opposition was only <em>weary</em> and <em>fearful</em>, for now their match was at arms against them.'; |
652 | - elseif ($_GET['verse'] == '4:16') |
|
653 | - echo ' |
|
678 | + } elseif ($_GET['verse'] == '4:16') { |
|
679 | + echo ' |
|
654 | 680 | And it came to pass that the <em>unbelievers</em> dwindled in number and saw rise of many <em>proselytizers</em>, and the opposition found fear in the face of the <em>x</em> and the <em>j</em> while those who stood with the <em>something</em> grew stronger and came together. Still, this was only the <em>beginning</em>, and what lay in the future was <em id="unknown" name="[Unknown]">unknown</em> to all, even those on the right side.'; |
655 | - elseif ($_GET['verse'] == '22:1-2') |
|
656 | - echo ' |
|
681 | + } elseif ($_GET['verse'] == '22:1-2') { |
|
682 | + echo ' |
|
657 | 683 | <p>Now <em>behold</em>, that which was once the secret project was <em id="unknown" name="[Unknown]">unknown</em> no longer. Alas, it needed more than <em>only one</em>, but yet even thought otherwise. It became that the opposition <em>rumored</em> and lied, but still to no avail. Their match, though not <em>perfect</em>, had them outdone.</p> |
658 | 684 | <p style="margin: 2ex 1ex 0 1ex; font-size: 1.05em; line-height: 1.5; text-align: center;">Let it continue. <em>The end</em>.</p>'; |
685 | + } |
|
659 | 686 | |
660 | 687 | echo ' |
661 | 688 | </div> |
662 | 689 | <div style="margin-top: 2ex; font-size: 2em; text-align: right;">'; |
663 | 690 | |
664 | - if ($_GET['verse'] == '2:18') |
|
665 | - echo ' |
|
691 | + if ($_GET['verse'] == '2:18') { |
|
692 | + echo ' |
|
666 | 693 | from <span style="font-family: Georgia, serif;"><strong><a href="', $scripturl, '?action=about:unknown;verse=4:16" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 2:18</span>'; |
667 | - elseif ($_GET['verse'] == '4:16') |
|
668 | - echo ' |
|
694 | + } elseif ($_GET['verse'] == '4:16') { |
|
695 | + echo ' |
|
669 | 696 | from <span style="font-family: Georgia, serif;"><strong><a href="', $scripturl, '?action=about:unknown;verse=22:1-2" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 4:16</span>'; |
670 | - elseif ($_GET['verse'] == '22:1-2') |
|
671 | - echo ' |
|
697 | + } elseif ($_GET['verse'] == '22:1-2') { |
|
698 | + echo ' |
|
672 | 699 | from <span style="font-family: Georgia, serif;"><strong>The Book of Unknown</strong>, 22:1-2</span>'; |
700 | + } |
|
673 | 701 | |
674 | 702 | echo ' |
675 | 703 | </div> |
@@ -3014,8 +3014,7 @@ |
||
3014 | 3014 | <div class="roundframe"> |
3015 | 3015 | <div> |
3016 | 3016 | ', !empty($context['tfa_backup']) ? ' |
3017 | - <div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : |
|
3018 | - ($modSettings['tfa_mode'] == 2 ? ' |
|
3017 | + <div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : ($modSettings['tfa_mode'] == 2 ? ' |
|
3019 | 3018 | <div class="smalltext"><strong>' . $txt['tfa_forced_desc'] . '</strong></div>' : ''), ' |
3020 | 3019 | <div class="smalltext">', $txt['tfa_desc'], '</div> |
3021 | 3020 | <div class="floatleft"> |
@@ -18,23 +18,25 @@ discard block |
||
18 | 18 | global $context; |
19 | 19 | |
20 | 20 | // Prevent Chrome from auto completing fields when viewing/editing other members profiles |
21 | - if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
|
22 | - echo ' |
|
21 | + if (isBrowser('is_chrome') && !$context['user']['is_owner']) { |
|
22 | + echo ' |
|
23 | 23 | <script> |
24 | 24 | disableAutoComplete(); |
25 | 25 | </script>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | // If an error occurred while trying to save previously, give the user a clue! |
28 | 29 | echo ' |
29 | 30 | ', template_error_message(); |
30 | 31 | |
31 | 32 | // If the profile was update successfully, let the user know this. |
32 | - if (!empty($context['profile_updated'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['profile_updated'])) { |
|
34 | + echo ' |
|
34 | 35 | <div class="infobox"> |
35 | 36 | ', $context['profile_updated'], ' |
36 | 37 | </div>'; |
37 | -} |
|
38 | + } |
|
39 | + } |
|
38 | 40 | |
39 | 41 | /** |
40 | 42 | * Template for any HTML needed below the profile (closing off divs/tables, etc.) |
@@ -102,8 +104,7 @@ discard block |
||
102 | 104 | if (empty($context['unread_alerts'])) |
103 | 105 | { |
104 | 106 | template_alerts_all_read(); |
105 | - } |
|
106 | - else |
|
107 | + } else |
|
107 | 108 | { |
108 | 109 | foreach ($context['unread_alerts'] as $id_alert => $details) |
109 | 110 | { |
@@ -164,10 +165,11 @@ discard block |
||
164 | 165 | <div class="custom_fields_above_name"> |
165 | 166 | <ul >'; |
166 | 167 | |
167 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
168 | - if (!empty($field['output_html'])) |
|
168 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
169 | + if (!empty($field['output_html'])) |
|
169 | 170 | echo ' |
170 | 171 | <li>', $field['output_html'], '</li>'; |
172 | + } |
|
171 | 173 | |
172 | 174 | echo ' |
173 | 175 | </ul> |
@@ -188,10 +190,11 @@ discard block |
||
188 | 190 | <div class="custom_fields_below_avatar"> |
189 | 191 | <ul >'; |
190 | 192 | |
191 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
192 | - if (!empty($field['output_html'])) |
|
193 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
194 | + if (!empty($field['output_html'])) |
|
193 | 195 | echo ' |
194 | 196 | <li>', $field['output_html'], '</li>'; |
197 | + } |
|
195 | 198 | |
196 | 199 | echo ' |
197 | 200 | </ul> |
@@ -202,22 +205,25 @@ discard block |
||
202 | 205 | echo ' |
203 | 206 | <ul class="clear">'; |
204 | 207 | // Email is only visible if it's your profile or you have the moderate_forum permission |
205 | - if ($context['member']['show_email']) |
|
206 | - echo ' |
|
208 | + if ($context['member']['show_email']) { |
|
209 | + echo ' |
|
207 | 210 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
211 | + } |
|
208 | 212 | |
209 | 213 | // Don't show an icon if they haven't specified a website. |
210 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
211 | - echo ' |
|
214 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
215 | + echo ' |
|
212 | 216 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
217 | + } |
|
213 | 218 | |
214 | 219 | // Are there any custom profile fields as icons? |
215 | 220 | if (!empty($context['print_custom_fields']['icons'])) |
216 | 221 | { |
217 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
218 | - if (!empty($field['output_html'])) |
|
222 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
223 | + if (!empty($field['output_html'])) |
|
219 | 224 | echo ' |
220 | 225 | <li class="custom_field">', $field['output_html'], '</li>'; |
226 | + } |
|
221 | 227 | } |
222 | 228 | |
223 | 229 | echo ' |
@@ -225,23 +231,26 @@ discard block |
||
225 | 231 | <span id="userstatus">', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
226 | 232 | |
227 | 233 | // Can they add this member as a buddy? |
228 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
229 | - echo ' |
|
234 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
235 | + echo ' |
|
230 | 236 | <br><a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>'; |
237 | + } |
|
231 | 238 | |
232 | 239 | echo ' |
233 | 240 | </span>'; |
234 | 241 | |
235 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
236 | - echo ' |
|
242 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
243 | + echo ' |
|
237 | 244 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
245 | + } |
|
238 | 246 | |
239 | 247 | echo ' |
240 | 248 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
241 | 249 | |
242 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
243 | - echo ' |
|
250 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
251 | + echo ' |
|
244 | 252 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
253 | + } |
|
245 | 254 | |
246 | 255 | echo ' |
247 | 256 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -253,10 +262,11 @@ discard block |
||
253 | 262 | <div class="custom_fields_bottom"> |
254 | 263 | <ul class="nolist">'; |
255 | 264 | |
256 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
257 | - if (!empty($field['output_html'])) |
|
265 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
266 | + if (!empty($field['output_html'])) |
|
258 | 267 | echo ' |
259 | 268 | <li>', $field['output_html'], '</li>'; |
269 | + } |
|
260 | 270 | |
261 | 271 | echo ' |
262 | 272 | </ul> |
@@ -270,15 +280,17 @@ discard block |
||
270 | 280 | <div id="detailedinfo"> |
271 | 281 | <dl class="settings">'; |
272 | 282 | |
273 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
274 | - echo ' |
|
283 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
284 | + echo ' |
|
275 | 285 | <dt>', $txt['username'], ': </dt> |
276 | 286 | <dd>', $context['member']['username'], '</dd>'; |
287 | + } |
|
277 | 288 | |
278 | - if (!isset($context['disabled_fields']['posts'])) |
|
279 | - echo ' |
|
289 | + if (!isset($context['disabled_fields']['posts'])) { |
|
290 | + echo ' |
|
280 | 291 | <dt>', $txt['profile_posts'], ': </dt> |
281 | 292 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
293 | + } |
|
282 | 294 | |
283 | 295 | if ($context['member']['show_email']) |
284 | 296 | { |
@@ -287,15 +299,17 @@ discard block |
||
287 | 299 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
288 | 300 | } |
289 | 301 | |
290 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
291 | - echo ' |
|
302 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
303 | + echo ' |
|
292 | 304 | <dt>', $txt['custom_title'], ': </dt> |
293 | 305 | <dd>', $context['member']['title'], '</dd>'; |
306 | + } |
|
294 | 307 | |
295 | - if (!empty($context['member']['blurb'])) |
|
296 | - echo ' |
|
308 | + if (!empty($context['member']['blurb'])) { |
|
309 | + echo ' |
|
297 | 310 | <dt>', $txt['personal_text'], ': </dt> |
298 | 311 | <dd>', $context['member']['blurb'], '</dd>'; |
312 | + } |
|
299 | 313 | |
300 | 314 | echo ' |
301 | 315 | <dt>', $txt['age'], ':</dt> |
@@ -309,19 +323,21 @@ discard block |
||
309 | 323 | { |
310 | 324 | $fields = array(); |
311 | 325 | |
312 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
313 | - if (!empty($field['output_html'])) |
|
326 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
327 | + if (!empty($field['output_html'])) |
|
314 | 328 | $fields[] = $field; |
329 | + } |
|
315 | 330 | |
316 | 331 | if (count($fields) > 0) |
317 | 332 | { |
318 | 333 | echo ' |
319 | 334 | <dl class="settings">'; |
320 | 335 | |
321 | - foreach ($fields as $field) |
|
322 | - echo ' |
|
336 | + foreach ($fields as $field) { |
|
337 | + echo ' |
|
323 | 338 | <dt>', $field['name'], ':</dt> |
324 | 339 | <dd>', $field['output_html'], '</dd>'; |
340 | + } |
|
325 | 341 | |
326 | 342 | echo ' |
327 | 343 | </dl>'; |
@@ -341,9 +357,10 @@ discard block |
||
341 | 357 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
342 | 358 | |
343 | 359 | // Can we provide information on what this means? |
344 | - if (!empty($context['warning_status'])) |
|
345 | - echo ' |
|
360 | + if (!empty($context['warning_status'])) { |
|
361 | + echo ' |
|
346 | 362 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
363 | + } |
|
347 | 364 | |
348 | 365 | echo ' |
349 | 366 | </dd>'; |
@@ -354,9 +371,10 @@ discard block |
||
354 | 371 | { |
355 | 372 | |
356 | 373 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
357 | - if (!empty($context['activate_message'])) |
|
358 | - echo ' |
|
374 | + if (!empty($context['activate_message'])) { |
|
375 | + echo ' |
|
359 | 376 | <dt class="clear"><span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>)</dt>'; |
377 | + } |
|
360 | 378 | |
361 | 379 | // If the current member is banned, show a message and possibly a link to the ban. |
362 | 380 | if (!empty($context['member']['bans'])) |
@@ -366,9 +384,10 @@ discard block |
||
366 | 384 | <dt class="clear" id="ban_info" style="display: none;"> |
367 | 385 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
368 | 386 | |
369 | - foreach ($context['member']['bans'] as $ban) |
|
370 | - echo ' |
|
387 | + foreach ($context['member']['bans'] as $ban) { |
|
388 | + echo ' |
|
371 | 389 | <br><span class="smalltext">', $ban['explanation'], '</span>'; |
390 | + } |
|
372 | 391 | |
373 | 392 | echo ' |
374 | 393 | </dt>'; |
@@ -382,30 +401,34 @@ discard block |
||
382 | 401 | // If the person looking is allowed, they can check the members IP address and hostname. |
383 | 402 | if ($context['can_see_ip']) |
384 | 403 | { |
385 | - if (!empty($context['member']['ip'])) |
|
386 | - echo ' |
|
404 | + if (!empty($context['member']['ip'])) { |
|
405 | + echo ' |
|
387 | 406 | <dt>', $txt['ip'], ': </dt> |
388 | 407 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
408 | + } |
|
389 | 409 | |
390 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
391 | - echo ' |
|
410 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
411 | + echo ' |
|
392 | 412 | <dt>', $txt['hostname'], ': </dt> |
393 | 413 | <dd>', $context['member']['hostname'], '</dd>'; |
414 | + } |
|
394 | 415 | } |
395 | 416 | |
396 | 417 | echo ' |
397 | 418 | <dt>', $txt['local_time'], ':</dt> |
398 | 419 | <dd>', $context['member']['local_time'], '</dd>'; |
399 | 420 | |
400 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
401 | - echo ' |
|
421 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
422 | + echo ' |
|
402 | 423 | <dt>', $txt['language'], ':</dt> |
403 | 424 | <dd>', $context['member']['language'], '</dd>'; |
425 | + } |
|
404 | 426 | |
405 | - if ($context['member']['show_last_login']) |
|
406 | - echo ' |
|
427 | + if ($context['member']['show_last_login']) { |
|
428 | + echo ' |
|
407 | 429 | <dt>', $txt['lastLoggedIn'], ': </dt> |
408 | 430 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
431 | + } |
|
409 | 432 | |
410 | 433 | echo ' |
411 | 434 | </dl>'; |
@@ -417,10 +440,11 @@ discard block |
||
417 | 440 | <div class="custom_fields_above_signature"> |
418 | 441 | <ul class="nolist">'; |
419 | 442 | |
420 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
421 | - if (!empty($field['output_html'])) |
|
443 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
444 | + if (!empty($field['output_html'])) |
|
422 | 445 | echo ' |
423 | 446 | <li>', $field['output_html'], '</li>'; |
447 | + } |
|
424 | 448 | |
425 | 449 | echo ' |
426 | 450 | </ul> |
@@ -428,12 +452,13 @@ discard block |
||
428 | 452 | } |
429 | 453 | |
430 | 454 | // Show the users signature. |
431 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
432 | - echo ' |
|
455 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
456 | + echo ' |
|
433 | 457 | <div class="signature"> |
434 | 458 | <h5>', $txt['signature'], ':</h5> |
435 | 459 | ', $context['member']['signature'], ' |
436 | 460 | </div>'; |
461 | + } |
|
437 | 462 | |
438 | 463 | // Are there any custom profile fields for below the signature? |
439 | 464 | if (!empty($context['print_custom_fields']['below_signature'])) |
@@ -442,10 +467,11 @@ discard block |
||
442 | 467 | <div class="custom_fields_below_signature"> |
443 | 468 | <ul class="nolist">'; |
444 | 469 | |
445 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
446 | - if (!empty($field['output_html'])) |
|
470 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
471 | + if (!empty($field['output_html'])) |
|
447 | 472 | echo ' |
448 | 473 | <li>', $field['output_html'], '</li>'; |
474 | + } |
|
449 | 475 | |
450 | 476 | echo ' |
451 | 477 | </ul> |
@@ -490,62 +516,70 @@ discard block |
||
490 | 516 | </div> |
491 | 517 | <div class="list_posts">'; |
492 | 518 | |
493 | - if (!$post['approved']) |
|
494 | - echo ' |
|
519 | + if (!$post['approved']) { |
|
520 | + echo ' |
|
495 | 521 | <div class="approve_post"> |
496 | 522 | <em>', $txt['post_awaiting_approval'], '</em> |
497 | 523 | </div>'; |
524 | + } |
|
498 | 525 | |
499 | 526 | echo ' |
500 | 527 | ', $post['body'], ' |
501 | 528 | </div>'; |
502 | 529 | |
503 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
504 | - echo ' |
|
530 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
531 | + echo ' |
|
505 | 532 | <div class="floatright"> |
506 | 533 | <ul class="quickbuttons">'; |
534 | + } |
|
507 | 535 | |
508 | 536 | // If they *can* reply? |
509 | - if ($post['can_reply']) |
|
510 | - echo ' |
|
537 | + if ($post['can_reply']) { |
|
538 | + echo ' |
|
511 | 539 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
540 | + } |
|
512 | 541 | |
513 | 542 | // If they *can* quote? |
514 | - if ($post['can_quote']) |
|
515 | - echo ' |
|
543 | + if ($post['can_quote']) { |
|
544 | + echo ' |
|
516 | 545 | <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
546 | + } |
|
517 | 547 | |
518 | 548 | // How about... even... remove it entirely?! |
519 | - if ($post['can_delete']) |
|
520 | - echo ' |
|
549 | + if ($post['can_delete']) { |
|
550 | + echo ' |
|
521 | 551 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
552 | + } |
|
522 | 553 | |
523 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
524 | - echo ' |
|
554 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
555 | + echo ' |
|
525 | 556 | </ul> |
526 | 557 | </div>'; |
558 | + } |
|
527 | 559 | |
528 | 560 | echo ' |
529 | 561 | </div>'; |
530 | 562 | } |
563 | + } else { |
|
564 | + template_show_list('attachments'); |
|
531 | 565 | } |
532 | - else |
|
533 | - template_show_list('attachments'); |
|
534 | 566 | |
535 | 567 | // No posts? Just end with a informative message. |
536 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
537 | - echo ' |
|
568 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
569 | + echo ' |
|
538 | 570 | <div class="windowbg2"> |
539 | 571 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
540 | 572 | </div>'; |
573 | + } |
|
541 | 574 | |
542 | 575 | // Show more page numbers. |
543 | - if (!empty($context['page_index'])) |
|
544 | - echo ' |
|
576 | + if (!empty($context['page_index'])) { |
|
577 | + echo ' |
|
545 | 578 | <div class="pagesection"> |
546 | 579 | <div class="pagelinks">', $context['page_index'], '</div> |
547 | 580 | </div>'; |
548 | -} |
|
581 | + } |
|
582 | + } |
|
549 | 583 | |
550 | 584 | /** |
551 | 585 | * Template for showing alerts within the alerts popup |
@@ -555,11 +589,12 @@ discard block |
||
555 | 589 | global $context, $txt, $scripturl; |
556 | 590 | |
557 | 591 | // Do we have an update message? |
558 | - if (!empty($context['update_message'])) |
|
559 | - echo ' |
|
592 | + if (!empty($context['update_message'])) { |
|
593 | + echo ' |
|
560 | 594 | <div class="infobox"> |
561 | 595 | ', $context['update_message'], '. |
562 | 596 | </div>'; |
597 | + } |
|
563 | 598 | |
564 | 599 | echo ' |
565 | 600 | <div class="cat_bar"> |
@@ -568,13 +603,12 @@ discard block |
||
568 | 603 | </h3> |
569 | 604 | </div>'; |
570 | 605 | |
571 | - if (empty($context['alerts'])) |
|
572 | - echo ' |
|
606 | + if (empty($context['alerts'])) { |
|
607 | + echo ' |
|
573 | 608 | <div class="information"> |
574 | 609 | ', $txt['alerts_none'], ' |
575 | 610 | </div>'; |
576 | - |
|
577 | - else |
|
611 | + } else |
|
578 | 612 | { |
579 | 613 | // Start the form. |
580 | 614 | echo ' |
@@ -636,12 +670,12 @@ discard block |
||
636 | 670 | </div>' : ''; |
637 | 671 | |
638 | 672 | // No drafts? Just show an informative message. |
639 | - if (empty($context['drafts'])) |
|
640 | - echo ' |
|
673 | + if (empty($context['drafts'])) { |
|
674 | + echo ' |
|
641 | 675 | <div class="windowbg2 centertext"> |
642 | 676 | ', $txt['draft_none'], ' |
643 | 677 | </div>'; |
644 | - else |
|
678 | + } else |
|
645 | 679 | { |
646 | 680 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
647 | 681 | foreach ($context['drafts'] as $draft) |
@@ -652,11 +686,13 @@ discard block |
||
652 | 686 | <div class="topic_details"> |
653 | 687 | <h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
654 | 688 | |
655 | - if (!empty($draft['sticky'])) |
|
656 | - echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
|
689 | + if (!empty($draft['sticky'])) { |
|
690 | + echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
|
691 | + } |
|
657 | 692 | |
658 | - if (!empty($draft['locked'])) |
|
659 | - echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
|
693 | + if (!empty($draft['locked'])) { |
|
694 | + echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
|
695 | + } |
|
660 | 696 | |
661 | 697 | echo ' |
662 | 698 | </h5> |
@@ -689,12 +725,13 @@ discard block |
||
689 | 725 | { |
690 | 726 | global $context, $scripturl, $txt; |
691 | 727 | |
692 | - if (!empty($context['saved_successful'])) |
|
693 | - echo ' |
|
728 | + if (!empty($context['saved_successful'])) { |
|
729 | + echo ' |
|
694 | 730 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
695 | - elseif (!empty($context['saved_failed'])) |
|
696 | - echo ' |
|
731 | + } elseif (!empty($context['saved_failed'])) { |
|
732 | + echo ' |
|
697 | 733 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
734 | + } |
|
698 | 735 | |
699 | 736 | echo ' |
700 | 737 | <div id="edit_buddies"> |
@@ -708,24 +745,27 @@ discard block |
||
708 | 745 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
709 | 746 | <th scope="col">', $txt['status'], '</th>'; |
710 | 747 | |
711 | - if (allowedTo('moderate_forum')) |
|
712 | - echo ' |
|
748 | + if (allowedTo('moderate_forum')) { |
|
749 | + echo ' |
|
713 | 750 | <th scope="col">', $txt['email'], '</th>'; |
751 | + } |
|
714 | 752 | |
715 | - if (!empty($context['custom_pf'])) |
|
716 | - foreach ($context['custom_pf'] as $column) |
|
753 | + if (!empty($context['custom_pf'])) { |
|
754 | + foreach ($context['custom_pf'] as $column) |
|
717 | 755 | echo '<th scope="col">', $column['label'], '</th>'; |
756 | + } |
|
718 | 757 | |
719 | 758 | echo ' |
720 | 759 | <th scope="col">', $txt['remove'], '</th> |
721 | 760 | </tr>'; |
722 | 761 | |
723 | 762 | // If they don't have any buddies don't list them! |
724 | - if (empty($context['buddies'])) |
|
725 | - echo ' |
|
763 | + if (empty($context['buddies'])) { |
|
764 | + echo ' |
|
726 | 765 | <tr class="windowbg"> |
727 | 766 | <td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"><strong>', $txt['no_buddies'], '</strong></td> |
728 | 767 | </tr>'; |
768 | + } |
|
729 | 769 | |
730 | 770 | // Now loop through each buddy showing info on each. |
731 | 771 | else |
@@ -737,15 +777,17 @@ discard block |
||
737 | 777 | <td>', $buddy['link'], '</td> |
738 | 778 | <td><a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a></td>'; |
739 | 779 | |
740 | - if ($buddy['show_email']) |
|
741 | - echo ' |
|
780 | + if ($buddy['show_email']) { |
|
781 | + echo ' |
|
742 | 782 | <td><a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a></td>'; |
783 | + } |
|
743 | 784 | |
744 | 785 | // Show the custom profile fields for this user. |
745 | - if (!empty($context['custom_pf'])) |
|
746 | - foreach ($context['custom_pf'] as $key => $column) |
|
786 | + if (!empty($context['custom_pf'])) { |
|
787 | + foreach ($context['custom_pf'] as $key => $column) |
|
747 | 788 | echo ' |
748 | 789 | <td class="lefttext">', $buddy['options'][$key], '</td>'; |
790 | + } |
|
749 | 791 | |
750 | 792 | echo ' |
751 | 793 | <td><a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['id_member'], ';remove=', $buddy['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['buddy_remove'], '"></span></a></td> |
@@ -775,9 +817,10 @@ discard block |
||
775 | 817 | </dl> |
776 | 818 | </div>'; |
777 | 819 | |
778 | - if (!empty($context['token_check'])) |
|
779 | - echo ' |
|
820 | + if (!empty($context['token_check'])) { |
|
821 | + echo ' |
|
780 | 822 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
823 | + } |
|
781 | 824 | |
782 | 825 | echo ' |
783 | 826 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -803,12 +846,13 @@ discard block |
||
803 | 846 | { |
804 | 847 | global $context, $scripturl, $txt; |
805 | 848 | |
806 | - if (!empty($context['saved_successful'])) |
|
807 | - echo ' |
|
849 | + if (!empty($context['saved_successful'])) { |
|
850 | + echo ' |
|
808 | 851 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
809 | - elseif (!empty($context['saved_failed'])) |
|
810 | - echo ' |
|
852 | + } elseif (!empty($context['saved_failed'])) { |
|
853 | + echo ' |
|
811 | 854 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
855 | + } |
|
812 | 856 | |
813 | 857 | echo ' |
814 | 858 | <div id="edit_buddies"> |
@@ -822,20 +866,22 @@ discard block |
||
822 | 866 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
823 | 867 | <th scope="col">', $txt['status'], '</th>'; |
824 | 868 | |
825 | - if (allowedTo('moderate_forum')) |
|
826 | - echo ' |
|
869 | + if (allowedTo('moderate_forum')) { |
|
870 | + echo ' |
|
827 | 871 | <th scope="col">', $txt['email'], '</th>'; |
872 | + } |
|
828 | 873 | |
829 | 874 | echo ' |
830 | 875 | <th scope="col">', $txt['ignore_remove'], '</th> |
831 | 876 | </tr>'; |
832 | 877 | |
833 | 878 | // If they don't have anyone on their ignore list, don't list it! |
834 | - if (empty($context['ignore_list'])) |
|
835 | - echo ' |
|
879 | + if (empty($context['ignore_list'])) { |
|
880 | + echo ' |
|
836 | 881 | <tr class="windowbg"> |
837 | 882 | <td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"><strong>', $txt['no_ignore'], '</strong></td> |
838 | 883 | </tr>'; |
884 | + } |
|
839 | 885 | |
840 | 886 | // Now loop through each buddy showing info on each. |
841 | 887 | foreach ($context['ignore_list'] as $member) |
@@ -845,9 +891,10 @@ discard block |
||
845 | 891 | <td>', $member['link'], '</td> |
846 | 892 | <td><a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a></td>'; |
847 | 893 | |
848 | - if ($member['show_email']) |
|
849 | - echo ' |
|
894 | + if ($member['show_email']) { |
|
895 | + echo ' |
|
850 | 896 | <td><a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a></td>'; |
897 | + } |
|
851 | 898 | echo ' |
852 | 899 | <td><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a></td> |
853 | 900 | </tr>'; |
@@ -874,9 +921,10 @@ discard block |
||
874 | 921 | </dl> |
875 | 922 | </div>'; |
876 | 923 | |
877 | - if (!empty($context['token_check'])) |
|
878 | - echo ' |
|
924 | + if (!empty($context['token_check'])) { |
|
925 | + echo ' |
|
879 | 926 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
927 | + } |
|
880 | 928 | |
881 | 929 | echo ' |
882 | 930 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -921,9 +969,10 @@ discard block |
||
921 | 969 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
922 | 970 | |
923 | 971 | // Second address detected? |
924 | - if (!empty($context['last_ip2'])) |
|
925 | - echo ' |
|
972 | + if (!empty($context['last_ip2'])) { |
|
973 | + echo ' |
|
926 | 974 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
975 | + } |
|
927 | 976 | |
928 | 977 | echo ' |
929 | 978 | </dd>'; |
@@ -988,9 +1037,10 @@ discard block |
||
988 | 1037 | <h3 class="catbg">', $txt['whois_title'], ' ', $context['ip'], '</h3> |
989 | 1038 | </div> |
990 | 1039 | <div class="windowbg2 noup">'; |
991 | - foreach ($context['whois_servers'] as $server) |
|
992 | - echo ' |
|
1040 | + foreach ($context['whois_servers'] as $server) { |
|
1041 | + echo ' |
|
993 | 1042 | <a href="', $server['url'], '" target="_blank"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>'; |
1043 | + } |
|
994 | 1044 | echo ' |
995 | 1045 | </div> |
996 | 1046 | <br>'; |
@@ -1001,10 +1051,10 @@ discard block |
||
1001 | 1051 | <div class="cat_bar"> |
1002 | 1052 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
1003 | 1053 | </div>'; |
1004 | - if (empty($context['ips'])) |
|
1005 | - echo ' |
|
1054 | + if (empty($context['ips'])) { |
|
1055 | + echo ' |
|
1006 | 1056 | <p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>'; |
1007 | - else |
|
1057 | + } else |
|
1008 | 1058 | { |
1009 | 1059 | echo ' |
1010 | 1060 | <table class="table_grid"> |
@@ -1017,12 +1067,13 @@ discard block |
||
1017 | 1067 | <tbody>'; |
1018 | 1068 | |
1019 | 1069 | // Loop through each of the members and display them. |
1020 | - foreach ($context['ips'] as $ip => $memberlist) |
|
1021 | - echo ' |
|
1070 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
1071 | + echo ' |
|
1022 | 1072 | <tr class="windowbg"> |
1023 | 1073 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
1024 | 1074 | <td>', implode(', ', $memberlist), '</td> |
1025 | 1075 | </tr>'; |
1076 | + } |
|
1026 | 1077 | |
1027 | 1078 | echo ' |
1028 | 1079 | </tbody> |
@@ -1068,8 +1119,7 @@ discard block |
||
1068 | 1119 | { |
1069 | 1120 | echo ' |
1070 | 1121 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
1071 | - } |
|
1072 | - else |
|
1122 | + } else |
|
1073 | 1123 | { |
1074 | 1124 | echo ' |
1075 | 1125 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1083,9 +1133,10 @@ discard block |
||
1083 | 1133 | </div> |
1084 | 1134 | <div class="windowbg smalltext"> |
1085 | 1135 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
1086 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
1087 | - echo ' |
|
1136 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
1137 | + echo ' |
|
1088 | 1138 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
1139 | + } |
|
1089 | 1140 | echo ' |
1090 | 1141 | </div>'; |
1091 | 1142 | } |
@@ -1117,12 +1168,13 @@ discard block |
||
1117 | 1168 | </td> |
1118 | 1169 | <td class="smalltext">'; |
1119 | 1170 | |
1120 | - if ($permission['is_denied']) |
|
1121 | - echo ' |
|
1171 | + if ($permission['is_denied']) { |
|
1172 | + echo ' |
|
1122 | 1173 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1123 | - else |
|
1124 | - echo ' |
|
1174 | + } else { |
|
1175 | + echo ' |
|
1125 | 1176 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1177 | + } |
|
1126 | 1178 | |
1127 | 1179 | echo ' |
1128 | 1180 | </td> |
@@ -1132,10 +1184,10 @@ discard block |
||
1132 | 1184 | </tbody> |
1133 | 1185 | </table> |
1134 | 1186 | </div><br>'; |
1135 | - } |
|
1136 | - else |
|
1137 | - echo ' |
|
1187 | + } else { |
|
1188 | + echo ' |
|
1138 | 1189 | <p class="windowbg2">', $txt['showPermissions_none_general'], '</p>'; |
1190 | + } |
|
1139 | 1191 | |
1140 | 1192 | // Board permission section. |
1141 | 1193 | echo ' |
@@ -1145,14 +1197,16 @@ discard block |
||
1145 | 1197 | <a id="board_permissions"></a>', $txt['showPermissions_select'], ': |
1146 | 1198 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
1147 | 1199 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], ' </option>'; |
1148 | - if (!empty($context['boards'])) |
|
1149 | - echo ' |
|
1200 | + if (!empty($context['boards'])) { |
|
1201 | + echo ' |
|
1150 | 1202 | <option value="" disabled>---------------------------</option>'; |
1203 | + } |
|
1151 | 1204 | |
1152 | 1205 | // Fill the box with any local permission boards. |
1153 | - foreach ($context['boards'] as $board) |
|
1154 | - echo ' |
|
1206 | + foreach ($context['boards'] as $board) { |
|
1207 | + echo ' |
|
1155 | 1208 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
1209 | + } |
|
1156 | 1210 | |
1157 | 1211 | echo ' |
1158 | 1212 | </select> |
@@ -1183,8 +1237,7 @@ discard block |
||
1183 | 1237 | { |
1184 | 1238 | echo ' |
1185 | 1239 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1186 | - } |
|
1187 | - else |
|
1240 | + } else |
|
1188 | 1241 | { |
1189 | 1242 | echo ' |
1190 | 1243 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
@@ -1196,10 +1249,10 @@ discard block |
||
1196 | 1249 | echo ' |
1197 | 1250 | </tbody> |
1198 | 1251 | </table>'; |
1199 | - } |
|
1200 | - else |
|
1201 | - echo ' |
|
1252 | + } else { |
|
1253 | + echo ' |
|
1202 | 1254 | <p class="windowbg2">', $txt['showPermissions_none_board'], '</p>'; |
1255 | + } |
|
1203 | 1256 | echo ' |
1204 | 1257 | </div> |
1205 | 1258 | </div>'; |
@@ -1241,9 +1294,10 @@ discard block |
||
1241 | 1294 | </div>'; |
1242 | 1295 | |
1243 | 1296 | // If they haven't post at all, don't draw the graph. |
1244 | - if (empty($context['posts_by_time'])) |
|
1245 | - echo ' |
|
1297 | + if (empty($context['posts_by_time'])) { |
|
1298 | + echo ' |
|
1246 | 1299 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1300 | + } |
|
1247 | 1301 | // Otherwise do! |
1248 | 1302 | else |
1249 | 1303 | { |
@@ -1282,11 +1336,10 @@ discard block |
||
1282 | 1336 | </h3> |
1283 | 1337 | </div>'; |
1284 | 1338 | |
1285 | - if (empty($context['popular_boards'])) |
|
1286 | - echo ' |
|
1339 | + if (empty($context['popular_boards'])) { |
|
1340 | + echo ' |
|
1287 | 1341 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1288 | - |
|
1289 | - else |
|
1342 | + } else |
|
1290 | 1343 | { |
1291 | 1344 | echo ' |
1292 | 1345 | <dl class="stats">'; |
@@ -1317,10 +1370,10 @@ discard block |
||
1317 | 1370 | </h3> |
1318 | 1371 | </div>'; |
1319 | 1372 | |
1320 | - if (empty($context['board_activity'])) |
|
1321 | - echo ' |
|
1373 | + if (empty($context['board_activity'])) { |
|
1374 | + echo ' |
|
1322 | 1375 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1323 | - else |
|
1376 | + } else |
|
1324 | 1377 | { |
1325 | 1378 | echo ' |
1326 | 1379 | <dl class="stats">'; |
@@ -1368,41 +1421,46 @@ discard block |
||
1368 | 1421 | <h3 class="catbg profile_hd">'; |
1369 | 1422 | |
1370 | 1423 | // Don't say "Profile" if this isn't the profile... |
1371 | - if (!empty($context['profile_header_text'])) |
|
1372 | - echo ' |
|
1424 | + if (!empty($context['profile_header_text'])) { |
|
1425 | + echo ' |
|
1373 | 1426 | ', $context['profile_header_text']; |
1374 | - else |
|
1375 | - echo ' |
|
1427 | + } else { |
|
1428 | + echo ' |
|
1376 | 1429 | ', $txt['profile']; |
1430 | + } |
|
1377 | 1431 | |
1378 | 1432 | echo ' |
1379 | 1433 | </h3> |
1380 | 1434 | </div>'; |
1381 | 1435 | |
1382 | 1436 | // Have we some description? |
1383 | - if ($context['page_desc']) |
|
1384 | - echo ' |
|
1437 | + if ($context['page_desc']) { |
|
1438 | + echo ' |
|
1385 | 1439 | <p class="information">', $context['page_desc'], '</p>'; |
1440 | + } |
|
1386 | 1441 | |
1387 | 1442 | echo ' |
1388 | 1443 | <div class="roundframe">'; |
1389 | 1444 | |
1390 | 1445 | // Any bits at the start? |
1391 | - if (!empty($context['profile_prehtml'])) |
|
1392 | - echo ' |
|
1446 | + if (!empty($context['profile_prehtml'])) { |
|
1447 | + echo ' |
|
1393 | 1448 | <div>', $context['profile_prehtml'], '</div>'; |
1449 | + } |
|
1394 | 1450 | |
1395 | - if (!empty($context['profile_fields'])) |
|
1396 | - echo ' |
|
1451 | + if (!empty($context['profile_fields'])) { |
|
1452 | + echo ' |
|
1397 | 1453 | <dl class="settings">'; |
1454 | + } |
|
1398 | 1455 | |
1399 | 1456 | // Start the big old loop 'of love. |
1400 | 1457 | $lastItem = 'hr'; |
1401 | 1458 | foreach ($context['profile_fields'] as $key => $field) |
1402 | 1459 | { |
1403 | 1460 | // We add a little hack to be sure we never get more than one hr in a row! |
1404 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
1405 | - continue; |
|
1461 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
1462 | + continue; |
|
1463 | + } |
|
1406 | 1464 | |
1407 | 1465 | $lastItem = $field['type']; |
1408 | 1466 | if ($field['type'] == 'hr') |
@@ -1411,48 +1469,50 @@ discard block |
||
1411 | 1469 | </dl> |
1412 | 1470 | <hr> |
1413 | 1471 | <dl class="settings">'; |
1414 | - } |
|
1415 | - elseif ($field['type'] == 'callback') |
|
1472 | + } elseif ($field['type'] == 'callback') |
|
1416 | 1473 | { |
1417 | 1474 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
1418 | 1475 | { |
1419 | 1476 | $callback_func = 'template_profile_' . $field['callback_func']; |
1420 | 1477 | $callback_func(); |
1421 | 1478 | } |
1422 | - } |
|
1423 | - else |
|
1479 | + } else |
|
1424 | 1480 | { |
1425 | 1481 | echo ' |
1426 | 1482 | <dt> |
1427 | 1483 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
1428 | 1484 | |
1429 | 1485 | // Does it have any subtext to show? |
1430 | - if (!empty($field['subtext'])) |
|
1431 | - echo ' |
|
1486 | + if (!empty($field['subtext'])) { |
|
1487 | + echo ' |
|
1432 | 1488 | <br> |
1433 | 1489 | <span class="smalltext">', $field['subtext'], '</span>'; |
1490 | + } |
|
1434 | 1491 | |
1435 | 1492 | echo ' |
1436 | 1493 | </dt> |
1437 | 1494 | <dd>'; |
1438 | 1495 | |
1439 | 1496 | // Want to put something infront of the box? |
1440 | - if (!empty($field['preinput'])) |
|
1441 | - echo ' |
|
1497 | + if (!empty($field['preinput'])) { |
|
1498 | + echo ' |
|
1442 | 1499 | ', $field['preinput']; |
1500 | + } |
|
1443 | 1501 | |
1444 | 1502 | // What type of data are we showing? |
1445 | - if ($field['type'] == 'label') |
|
1446 | - echo ' |
|
1503 | + if ($field['type'] == 'label') { |
|
1504 | + echo ' |
|
1447 | 1505 | ', $field['value']; |
1506 | + } |
|
1448 | 1507 | |
1449 | 1508 | // Maybe it's a text box - very likely! |
1450 | 1509 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
1451 | 1510 | { |
1452 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
1453 | - $type = 'number'; |
|
1454 | - else |
|
1455 | - $type = $field['type']; |
|
1511 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
1512 | + $type = 'number'; |
|
1513 | + } else { |
|
1514 | + $type = $field['type']; |
|
1515 | + } |
|
1456 | 1516 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
1457 | 1517 | |
1458 | 1518 | |
@@ -1460,9 +1520,10 @@ discard block |
||
1460 | 1520 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
1461 | 1521 | } |
1462 | 1522 | // You "checking" me out? ;) |
1463 | - elseif ($field['type'] == 'check') |
|
1464 | - echo ' |
|
1523 | + elseif ($field['type'] == 'check') { |
|
1524 | + echo ' |
|
1465 | 1525 | <input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
1526 | + } |
|
1466 | 1527 | |
1467 | 1528 | // Always fun - select boxes! |
1468 | 1529 | elseif ($field['type'] == 'select') |
@@ -1473,13 +1534,15 @@ discard block |
||
1473 | 1534 | if (isset($field['options'])) |
1474 | 1535 | { |
1475 | 1536 | // Is this some code to generate the options? |
1476 | - if (!is_array($field['options'])) |
|
1477 | - $field['options'] = $field['options'](); |
|
1537 | + if (!is_array($field['options'])) { |
|
1538 | + $field['options'] = $field['options'](); |
|
1539 | + } |
|
1478 | 1540 | // Assuming we now have some! |
1479 | - if (is_array($field['options'])) |
|
1480 | - foreach ($field['options'] as $value => $name) |
|
1541 | + if (is_array($field['options'])) { |
|
1542 | + foreach ($field['options'] as $value => $name) |
|
1481 | 1543 | echo ' |
1482 | 1544 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
1545 | + } |
|
1483 | 1546 | } |
1484 | 1547 | |
1485 | 1548 | echo ' |
@@ -1487,25 +1550,28 @@ discard block |
||
1487 | 1550 | } |
1488 | 1551 | |
1489 | 1552 | // Something to end with? |
1490 | - if (!empty($field['postinput'])) |
|
1491 | - echo ' |
|
1553 | + if (!empty($field['postinput'])) { |
|
1554 | + echo ' |
|
1492 | 1555 | ', $field['postinput']; |
1556 | + } |
|
1493 | 1557 | |
1494 | 1558 | echo ' |
1495 | 1559 | </dd>'; |
1496 | 1560 | } |
1497 | 1561 | } |
1498 | 1562 | |
1499 | - if (!empty($context['profile_fields'])) |
|
1500 | - echo ' |
|
1563 | + if (!empty($context['profile_fields'])) { |
|
1564 | + echo ' |
|
1501 | 1565 | </dl>'; |
1566 | + } |
|
1502 | 1567 | |
1503 | 1568 | // Are there any custom profile fields - if so print them! |
1504 | 1569 | if (!empty($context['custom_fields'])) |
1505 | 1570 | { |
1506 | - if ($lastItem != 'hr') |
|
1507 | - echo ' |
|
1571 | + if ($lastItem != 'hr') { |
|
1572 | + echo ' |
|
1508 | 1573 | <hr>'; |
1574 | + } |
|
1509 | 1575 | |
1510 | 1576 | echo ' |
1511 | 1577 | <dl class="settings">'; |
@@ -1528,13 +1594,14 @@ discard block |
||
1528 | 1594 | } |
1529 | 1595 | |
1530 | 1596 | // Any closing HTML? |
1531 | - if (!empty($context['profile_posthtml'])) |
|
1532 | - echo ' |
|
1597 | + if (!empty($context['profile_posthtml'])) { |
|
1598 | + echo ' |
|
1533 | 1599 | <div>', $context['profile_posthtml'], '</div>'; |
1600 | + } |
|
1534 | 1601 | |
1535 | 1602 | // Only show the password box if it's actually needed. |
1536 | - if ($context['require_password']) |
|
1537 | - echo ' |
|
1603 | + if ($context['require_password']) { |
|
1604 | + echo ' |
|
1538 | 1605 | <dl class="settings"> |
1539 | 1606 | <dt> |
1540 | 1607 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1544,18 +1611,21 @@ discard block |
||
1544 | 1611 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20"> |
1545 | 1612 | </dd> |
1546 | 1613 | </dl>'; |
1614 | + } |
|
1547 | 1615 | |
1548 | 1616 | // The button shouldn't say "Change profile" unless we're changing the profile... |
1549 | - if (!empty($context['submit_button_text'])) |
|
1550 | - echo ' |
|
1617 | + if (!empty($context['submit_button_text'])) { |
|
1618 | + echo ' |
|
1551 | 1619 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button">'; |
1552 | - else |
|
1553 | - echo ' |
|
1620 | + } else { |
|
1621 | + echo ' |
|
1554 | 1622 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button">'; |
1623 | + } |
|
1555 | 1624 | |
1556 | - if (!empty($context['token_check'])) |
|
1557 | - echo ' |
|
1625 | + if (!empty($context['token_check'])) { |
|
1626 | + echo ' |
|
1558 | 1627 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
1628 | + } |
|
1559 | 1629 | |
1560 | 1630 | echo ' |
1561 | 1631 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1565,10 +1635,11 @@ discard block |
||
1565 | 1635 | </form>'; |
1566 | 1636 | |
1567 | 1637 | // Any final spellchecking stuff? |
1568 | - if (!empty($context['show_spellchecking'])) |
|
1569 | - echo ' |
|
1638 | + if (!empty($context['show_spellchecking'])) { |
|
1639 | + echo ' |
|
1570 | 1640 | <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
1571 | -} |
|
1641 | + } |
|
1642 | + } |
|
1572 | 1643 | |
1573 | 1644 | /** |
1574 | 1645 | * Personal Message settings. |
@@ -1605,10 +1676,11 @@ discard block |
||
1605 | 1676 | <select name="pm_receive_from" id="pm_receive_from"> |
1606 | 1677 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
1607 | 1678 | |
1608 | - if (!empty($modSettings['enable_buddylist'])) |
|
1609 | - echo ' |
|
1679 | + if (!empty($modSettings['enable_buddylist'])) { |
|
1680 | + echo ' |
|
1610 | 1681 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
1611 | 1682 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
1683 | + } |
|
1612 | 1684 | |
1613 | 1685 | echo ' |
1614 | 1686 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1651,11 +1723,12 @@ discard block |
||
1651 | 1723 | if (empty($setting) || !is_array($setting)) |
1652 | 1724 | { |
1653 | 1725 | // Insert a separator (unless this is the first item in the list) |
1654 | - if ($i !== $first_option_key) |
|
1655 | - echo ' |
|
1726 | + if ($i !== $first_option_key) { |
|
1727 | + echo ' |
|
1656 | 1728 | </dl> |
1657 | 1729 | <hr> |
1658 | 1730 | <dl class="settings">'; |
1731 | + } |
|
1659 | 1732 | |
1660 | 1733 | // Should we give a name to this section? |
1661 | 1734 | if (is_string($setting) && !empty($setting)) |
@@ -1663,51 +1736,56 @@ discard block |
||
1663 | 1736 | $titled_section = true; |
1664 | 1737 | echo ' |
1665 | 1738 | <dt><strong>' . $setting . '</strong></dt><dd></dd>'; |
1739 | + } else { |
|
1740 | + $titled_section = false; |
|
1666 | 1741 | } |
1667 | - else |
|
1668 | - $titled_section = false; |
|
1669 | 1742 | |
1670 | 1743 | continue; |
1671 | 1744 | } |
1672 | 1745 | |
1673 | 1746 | // Is this disabled? |
1674 | - if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) |
|
1675 | - continue; |
|
1676 | - elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
|
1677 | - continue; |
|
1678 | - elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) |
|
1679 | - continue; |
|
1680 | - elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) |
|
1681 | - continue; |
|
1682 | - elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) |
|
1683 | - continue; |
|
1684 | - elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
1685 | - continue; |
|
1686 | - elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
1687 | - continue; |
|
1747 | + if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) { |
|
1748 | + continue; |
|
1749 | + } elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) { |
|
1750 | + continue; |
|
1751 | + } elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) { |
|
1752 | + continue; |
|
1753 | + } elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) { |
|
1754 | + continue; |
|
1755 | + } elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) { |
|
1756 | + continue; |
|
1757 | + } elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
1758 | + continue; |
|
1759 | + } elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
1760 | + continue; |
|
1761 | + } |
|
1688 | 1762 | |
1689 | 1763 | // Some of these may not be set... Set to defaults here |
1690 | 1764 | $opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod'); |
1691 | - if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) |
|
1692 | - $context['member']['options'][$setting['id']] = 0; |
|
1765 | + if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) { |
|
1766 | + $context['member']['options'][$setting['id']] = 0; |
|
1767 | + } |
|
1693 | 1768 | |
1694 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
1695 | - $setting['type'] = 'checkbox'; |
|
1696 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
1697 | - $setting['type'] = 'number'; |
|
1698 | - elseif ($setting['type'] == 'string') |
|
1699 | - $setting['type'] = 'text'; |
|
1769 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
1770 | + $setting['type'] = 'checkbox'; |
|
1771 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
1772 | + $setting['type'] = 'number'; |
|
1773 | + } elseif ($setting['type'] == 'string') { |
|
1774 | + $setting['type'] = 'text'; |
|
1775 | + } |
|
1700 | 1776 | |
1701 | - if (isset($setting['options'])) |
|
1702 | - $setting['type'] = 'list'; |
|
1777 | + if (isset($setting['options'])) { |
|
1778 | + $setting['type'] = 'list'; |
|
1779 | + } |
|
1703 | 1780 | |
1704 | 1781 | echo ' |
1705 | 1782 | <dt> |
1706 | 1783 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
1707 | 1784 | |
1708 | - if (isset($setting['description'])) |
|
1709 | - echo ' |
|
1785 | + if (isset($setting['description'])) { |
|
1786 | + echo ' |
|
1710 | 1787 | <br><span class="smalltext">', $setting['description'], '</span>'; |
1788 | + } |
|
1711 | 1789 | echo ' |
1712 | 1790 | </dt> |
1713 | 1791 | <dd>'; |
@@ -1745,13 +1823,11 @@ discard block |
||
1745 | 1823 | |
1746 | 1824 | echo ' |
1747 | 1825 | <input type="number"', $min . $max . $step; |
1748 | - } |
|
1749 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
1826 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
1750 | 1827 | { |
1751 | 1828 | echo' |
1752 | 1829 | <input type="url"'; |
1753 | - } |
|
1754 | - else |
|
1830 | + } else |
|
1755 | 1831 | { |
1756 | 1832 | echo ' |
1757 | 1833 | <input type="text"'; |
@@ -1790,8 +1866,8 @@ discard block |
||
1790 | 1866 | <dl class="settings">'; |
1791 | 1867 | |
1792 | 1868 | // Allow notification on announcements to be disabled? |
1793 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
1794 | - echo ' |
|
1869 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
1870 | + echo ' |
|
1795 | 1871 | <dt> |
1796 | 1872 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
1797 | 1873 | </dt> |
@@ -1799,9 +1875,10 @@ discard block |
||
1799 | 1875 | <input type="hidden" name="notify_announcements" value="0"> |
1800 | 1876 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
1801 | 1877 | </dd>'; |
1878 | + } |
|
1802 | 1879 | |
1803 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
1804 | - echo ' |
|
1880 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
1881 | + echo ' |
|
1805 | 1882 | <dt> |
1806 | 1883 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
1807 | 1884 | </dt> |
@@ -1809,6 +1886,7 @@ discard block |
||
1809 | 1886 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
1810 | 1887 | </dd> |
1811 | 1888 | '; |
1889 | + } |
|
1812 | 1890 | |
1813 | 1891 | echo ' |
1814 | 1892 | </dl> |
@@ -1838,9 +1916,10 @@ discard block |
||
1838 | 1916 | <td colspan="3">'; |
1839 | 1917 | $label = $txt['alert_opt_' . $opts[1]]; |
1840 | 1918 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
1841 | - if ($label_pos == 'before') |
|
1842 | - echo ' |
|
1919 | + if ($label_pos == 'before') { |
|
1920 | + echo ' |
|
1843 | 1921 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
1922 | + } |
|
1844 | 1923 | |
1845 | 1924 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
1846 | 1925 | switch ($opts[0]) |
@@ -1852,17 +1931,19 @@ discard block |
||
1852 | 1931 | case 'select': |
1853 | 1932 | echo ' |
1854 | 1933 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
1855 | - foreach ($opts['opts'] as $k => $v) |
|
1856 | - echo ' |
|
1934 | + foreach ($opts['opts'] as $k => $v) { |
|
1935 | + echo ' |
|
1857 | 1936 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
1937 | + } |
|
1858 | 1938 | echo ' |
1859 | 1939 | </select>'; |
1860 | 1940 | break; |
1861 | 1941 | } |
1862 | 1942 | |
1863 | - if ($label_pos == 'after') |
|
1864 | - echo ' |
|
1943 | + if ($label_pos == 'after') { |
|
1944 | + echo ' |
|
1865 | 1945 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
1946 | + } |
|
1866 | 1947 | |
1867 | 1948 | echo ' |
1868 | 1949 | </td> |
@@ -1976,11 +2057,12 @@ discard block |
||
1976 | 2057 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
1977 | 2058 | |
1978 | 2059 | // Do we have an update message? |
1979 | - if (!empty($context['update_message'])) |
|
1980 | - echo ' |
|
2060 | + if (!empty($context['update_message'])) { |
|
2061 | + echo ' |
|
1981 | 2062 | <div class="infobox"> |
1982 | 2063 | ', $context['update_message'], '. |
1983 | 2064 | </div>'; |
2065 | + } |
|
1984 | 2066 | |
1985 | 2067 | echo ' |
1986 | 2068 | <div id="groups">'; |
@@ -2002,8 +2084,7 @@ discard block |
||
2002 | 2084 | </div> |
2003 | 2085 | </div> |
2004 | 2086 | </div>'; |
2005 | - } |
|
2006 | - else |
|
2087 | + } else |
|
2007 | 2088 | { |
2008 | 2089 | echo ' |
2009 | 2090 | <div class="title_bar"> |
@@ -2015,27 +2096,30 @@ discard block |
||
2015 | 2096 | echo ' |
2016 | 2097 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
2017 | 2098 | |
2018 | - if ($context['can_edit_primary']) |
|
2019 | - echo ' |
|
2099 | + if ($context['can_edit_primary']) { |
|
2100 | + echo ' |
|
2020 | 2101 | <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>'; |
2102 | + } |
|
2021 | 2103 | |
2022 | 2104 | echo ' |
2023 | 2105 | <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
2024 | 2106 | |
2025 | 2107 | // Can they leave their group? |
2026 | - if ($group['can_leave']) |
|
2027 | - echo ' |
|
2108 | + if ($group['can_leave']) { |
|
2109 | + echo ' |
|
2028 | 2110 | <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
2111 | + } |
|
2029 | 2112 | |
2030 | 2113 | echo ' |
2031 | 2114 | </div>'; |
2032 | 2115 | } |
2033 | 2116 | |
2034 | - if ($context['can_edit_primary']) |
|
2035 | - echo ' |
|
2117 | + if ($context['can_edit_primary']) { |
|
2118 | + echo ' |
|
2036 | 2119 | <div class="padding righttext"> |
2037 | 2120 | <input type="submit" value="', $txt['make_primary'], '" class="button"> |
2038 | 2121 | </div>'; |
2122 | + } |
|
2039 | 2123 | |
2040 | 2124 | // Any groups they can join? |
2041 | 2125 | if (!empty($context['groups']['available'])) |
@@ -2051,15 +2135,16 @@ discard block |
||
2051 | 2135 | <div class="windowbg"> |
2052 | 2136 | <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
2053 | 2137 | |
2054 | - if ($group['type'] == 3) |
|
2055 | - echo ' |
|
2138 | + if ($group['type'] == 3) { |
|
2139 | + echo ' |
|
2056 | 2140 | <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
2057 | - elseif ($group['type'] == 2 && $group['pending']) |
|
2058 | - echo ' |
|
2141 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
2142 | + echo ' |
|
2059 | 2143 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
2060 | - elseif ($group['type'] == 2) |
|
2061 | - echo ' |
|
2144 | + } elseif ($group['type'] == 2) { |
|
2145 | + echo ' |
|
2062 | 2146 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
2147 | + } |
|
2063 | 2148 | |
2064 | 2149 | echo ' |
2065 | 2150 | </div>'; |
@@ -2082,9 +2167,10 @@ discard block |
||
2082 | 2167 | |
2083 | 2168 | prevDiv.className = "windowbg"; |
2084 | 2169 | }'; |
2085 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
2086 | - echo ' |
|
2170 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
2171 | + echo ' |
|
2087 | 2172 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
2173 | + } |
|
2088 | 2174 | echo ' |
2089 | 2175 | </script>'; |
2090 | 2176 | } |
@@ -2092,9 +2178,10 @@ discard block |
||
2092 | 2178 | echo ' |
2093 | 2179 | </div>'; |
2094 | 2180 | |
2095 | - if (!empty($context['token_check'])) |
|
2096 | - echo ' |
|
2181 | + if (!empty($context['token_check'])) { |
|
2182 | + echo ' |
|
2097 | 2183 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2184 | + } |
|
2098 | 2185 | |
2099 | 2186 | echo ' |
2100 | 2187 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2141,14 +2228,15 @@ discard block |
||
2141 | 2228 | |
2142 | 2229 | foreach ($category['boards'] as $board) |
2143 | 2230 | { |
2144 | - if ($i == $limit) |
|
2145 | - echo ' |
|
2231 | + if ($i == $limit) { |
|
2232 | + echo ' |
|
2146 | 2233 | </ul> |
2147 | 2234 | </li> |
2148 | 2235 | </ul> |
2149 | 2236 | <ul class="ignoreboards floatright"> |
2150 | 2237 | <li class="category"> |
2151 | 2238 | <ul>'; |
2239 | + } |
|
2152 | 2240 | |
2153 | 2241 | echo ' |
2154 | 2242 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
@@ -2194,10 +2282,11 @@ discard block |
||
2194 | 2282 | |
2195 | 2283 | // Work out the starting color. |
2196 | 2284 | $context['current_color'] = $context['colors'][0]; |
2197 | - foreach ($context['colors'] as $limit => $color) |
|
2198 | - if ($context['member']['warning'] >= $limit) |
|
2285 | + foreach ($context['colors'] as $limit => $color) { |
|
2286 | + if ($context['member']['warning'] >= $limit) |
|
2199 | 2287 | $context['current_color'] = $color; |
2200 | -} |
|
2288 | + } |
|
2289 | + } |
|
2201 | 2290 | |
2202 | 2291 | // Show all warnings of a user? |
2203 | 2292 | function template_viewWarning() |
@@ -2236,14 +2325,15 @@ discard block |
||
2236 | 2325 | </dd>'; |
2237 | 2326 | |
2238 | 2327 | // There's some impact of this? |
2239 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
2240 | - echo ' |
|
2328 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
2329 | + echo ' |
|
2241 | 2330 | <dt> |
2242 | 2331 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
2243 | 2332 | </dt> |
2244 | 2333 | <dd> |
2245 | 2334 | ', $context['level_effects'][$context['current_level']], ' |
2246 | 2335 | </dd>'; |
2336 | + } |
|
2247 | 2337 | |
2248 | 2338 | echo ' |
2249 | 2339 | </dl> |
@@ -2281,10 +2371,11 @@ discard block |
||
2281 | 2371 | |
2282 | 2372 | // Otherwise see what we can do...'; |
2283 | 2373 | |
2284 | - foreach ($context['notification_templates'] as $k => $type) |
|
2285 | - echo ' |
|
2374 | + foreach ($context['notification_templates'] as $k => $type) { |
|
2375 | + echo ' |
|
2286 | 2376 | if (index == ', $k, ') |
2287 | 2377 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
2378 | + } |
|
2288 | 2379 | |
2289 | 2380 | echo ' |
2290 | 2381 | } |
@@ -2294,10 +2385,11 @@ discard block |
||
2294 | 2385 | // Also set the right effect. |
2295 | 2386 | effectText = "";'; |
2296 | 2387 | |
2297 | - foreach ($context['level_effects'] as $limit => $text) |
|
2298 | - echo ' |
|
2388 | + foreach ($context['level_effects'] as $limit => $text) { |
|
2389 | + echo ' |
|
2299 | 2390 | if (slideAmount >= ', $limit, ') |
2300 | 2391 | effectText = "', $text, '";'; |
2392 | + } |
|
2301 | 2393 | |
2302 | 2394 | echo ' |
2303 | 2395 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2312,31 +2404,34 @@ discard block |
||
2312 | 2404 | </h3> |
2313 | 2405 | </div>'; |
2314 | 2406 | |
2315 | - if (!$context['user']['is_owner']) |
|
2316 | - echo ' |
|
2407 | + if (!$context['user']['is_owner']) { |
|
2408 | + echo ' |
|
2317 | 2409 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
2410 | + } |
|
2318 | 2411 | |
2319 | 2412 | echo ' |
2320 | 2413 | <div class="windowbg"> |
2321 | 2414 | <dl class="settings">'; |
2322 | 2415 | |
2323 | - if (!$context['user']['is_owner']) |
|
2324 | - echo ' |
|
2416 | + if (!$context['user']['is_owner']) { |
|
2417 | + echo ' |
|
2325 | 2418 | <dt> |
2326 | 2419 | <strong>', $txt['profile_warning_name'], ':</strong> |
2327 | 2420 | </dt> |
2328 | 2421 | <dd> |
2329 | 2422 | <strong>', $context['member']['name'], '</strong> |
2330 | 2423 | </dd>'; |
2424 | + } |
|
2331 | 2425 | |
2332 | 2426 | echo ' |
2333 | 2427 | <dt> |
2334 | 2428 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
2335 | 2429 | |
2336 | 2430 | // Is there only so much they can apply? |
2337 | - if ($context['warning_limit']) |
|
2338 | - echo ' |
|
2431 | + if ($context['warning_limit']) { |
|
2432 | + echo ' |
|
2339 | 2433 | <br><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
2434 | + } |
|
2340 | 2435 | |
2341 | 2436 | echo ' |
2342 | 2437 | </dt> |
@@ -2389,9 +2484,10 @@ discard block |
||
2389 | 2484 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
2390 | 2485 | <option value="-1" disabled>------------------------------</option>'; |
2391 | 2486 | |
2392 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
2393 | - echo ' |
|
2487 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
2488 | + echo ' |
|
2394 | 2489 | <option value="', $id_template, '">', $template['title'], '</option>'; |
2490 | + } |
|
2395 | 2491 | |
2396 | 2492 | echo ' |
2397 | 2493 | </select> |
@@ -2404,9 +2500,10 @@ discard block |
||
2404 | 2500 | </dl> |
2405 | 2501 | <div class="righttext">'; |
2406 | 2502 | |
2407 | - if (!empty($context['token_check'])) |
|
2408 | - echo ' |
|
2503 | + if (!empty($context['token_check'])) { |
|
2504 | + echo ' |
|
2409 | 2505 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2506 | + } |
|
2410 | 2507 | |
2411 | 2508 | echo ' |
2412 | 2509 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2422,8 +2519,8 @@ discard block |
||
2422 | 2519 | echo ' |
2423 | 2520 | <script>'; |
2424 | 2521 | |
2425 | - if (!$context['user']['is_owner']) |
|
2426 | - echo ' |
|
2522 | + if (!$context['user']['is_owner']) { |
|
2523 | + echo ' |
|
2427 | 2524 | modifyWarnNotify(); |
2428 | 2525 | $(document).ready(function() { |
2429 | 2526 | $("#preview_button").click(function() { |
@@ -2462,6 +2559,7 @@ discard block |
||
2462 | 2559 | }); |
2463 | 2560 | return false; |
2464 | 2561 | }'; |
2562 | + } |
|
2465 | 2563 | |
2466 | 2564 | echo ' |
2467 | 2565 | </script>'; |
@@ -2484,16 +2582,18 @@ discard block |
||
2484 | 2582 | </div>'; |
2485 | 2583 | |
2486 | 2584 | // If deleting another account give them a lovely info box. |
2487 | - if (!$context['user']['is_owner']) |
|
2488 | - echo ' |
|
2585 | + if (!$context['user']['is_owner']) { |
|
2586 | + echo ' |
|
2489 | 2587 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
2588 | + } |
|
2490 | 2589 | echo ' |
2491 | 2590 | <div class="windowbg2">'; |
2492 | 2591 | |
2493 | 2592 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
2494 | - if ($context['needs_approval']) |
|
2495 | - echo ' |
|
2593 | + if ($context['needs_approval']) { |
|
2594 | + echo ' |
|
2496 | 2595 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
2596 | + } |
|
2497 | 2597 | |
2498 | 2598 | // If the user is deleting their own account warn them first - and require a password! |
2499 | 2599 | if ($context['user']['is_owner']) |
@@ -2505,9 +2605,10 @@ discard block |
||
2505 | 2605 | <input type="password" name="oldpasswrd" size="20"> |
2506 | 2606 | <input type="submit" value="', $txt['yes'], '" class="button">'; |
2507 | 2607 | |
2508 | - if (!empty($context['token_check'])) |
|
2509 | - echo ' |
|
2608 | + if (!empty($context['token_check'])) { |
|
2609 | + echo ' |
|
2510 | 2610 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2611 | + } |
|
2511 | 2612 | |
2512 | 2613 | echo ' |
2513 | 2614 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2533,9 +2634,10 @@ discard block |
||
2533 | 2634 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
2534 | 2635 | </select>'; |
2535 | 2636 | |
2536 | - if ($context['show_perma_delete']) |
|
2537 | - echo ' |
|
2637 | + if ($context['show_perma_delete']) { |
|
2638 | + echo ' |
|
2538 | 2639 | <br><label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
2640 | + } |
|
2539 | 2641 | |
2540 | 2642 | echo ' |
2541 | 2643 | </div>'; |
@@ -2548,9 +2650,10 @@ discard block |
||
2548 | 2650 | <div> |
2549 | 2651 | <input type="submit" value="', $txt['delete'], '" class="button">'; |
2550 | 2652 | |
2551 | - if (!empty($context['token_check'])) |
|
2552 | - echo ' |
|
2653 | + if (!empty($context['token_check'])) { |
|
2654 | + echo ' |
|
2553 | 2655 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2656 | + } |
|
2554 | 2657 | |
2555 | 2658 | echo ' |
2556 | 2659 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2576,8 +2679,8 @@ discard block |
||
2576 | 2679 | <hr>'; |
2577 | 2680 | |
2578 | 2681 | // Only show the password box if it's actually needed. |
2579 | - if ($context['require_password']) |
|
2580 | - echo ' |
|
2682 | + if ($context['require_password']) { |
|
2683 | + echo ' |
|
2581 | 2684 | <dl class="settings"> |
2582 | 2685 | <dt> |
2583 | 2686 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2587,13 +2690,15 @@ discard block |
||
2587 | 2690 | <input type="password" name="oldpasswrd" size="20"> |
2588 | 2691 | </dd> |
2589 | 2692 | </dl>'; |
2693 | + } |
|
2590 | 2694 | |
2591 | 2695 | echo ' |
2592 | 2696 | <div class="righttext">'; |
2593 | 2697 | |
2594 | - if (!empty($context['token_check'])) |
|
2595 | - echo ' |
|
2698 | + if (!empty($context['token_check'])) { |
|
2699 | + echo ' |
|
2596 | 2700 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2701 | + } |
|
2597 | 2702 | |
2598 | 2703 | echo ' |
2599 | 2704 | <input type="submit" value="', $txt['change_profile'], '" class="button"> |
@@ -2620,9 +2725,10 @@ discard block |
||
2620 | 2725 | <ul id="list_errors">'; |
2621 | 2726 | |
2622 | 2727 | // Cycle through each error and display an error message. |
2623 | - foreach ($context['post_errors'] as $error) |
|
2624 | - echo ' |
|
2728 | + foreach ($context['post_errors'] as $error) { |
|
2729 | + echo ' |
|
2625 | 2730 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
2731 | + } |
|
2626 | 2732 | |
2627 | 2733 | echo ' |
2628 | 2734 | </ul>'; |
@@ -2648,12 +2754,13 @@ discard block |
||
2648 | 2754 | <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
2649 | 2755 | |
2650 | 2756 | // Fill the select box with all primary member groups that can be assigned to a member. |
2651 | - foreach ($context['member_groups'] as $member_group) |
|
2652 | - if (!empty($member_group['can_be_primary'])) |
|
2757 | + foreach ($context['member_groups'] as $member_group) { |
|
2758 | + if (!empty($member_group['can_be_primary'])) |
|
2653 | 2759 | echo ' |
2654 | 2760 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
2655 | 2761 | ', $member_group['name'], ' |
2656 | 2762 | </option>'; |
2763 | + } |
|
2657 | 2764 | echo ' |
2658 | 2765 | </select> |
2659 | 2766 | </dd> |
@@ -2665,10 +2772,11 @@ discard block |
||
2665 | 2772 | <input type="hidden" name="additional_groups[]" value="0">'; |
2666 | 2773 | |
2667 | 2774 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
2668 | - foreach ($context['member_groups'] as $member_group) |
|
2669 | - if ($member_group['can_be_additional']) |
|
2775 | + foreach ($context['member_groups'] as $member_group) { |
|
2776 | + if ($member_group['can_be_additional']) |
|
2670 | 2777 | echo ' |
2671 | 2778 | <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>'; |
2779 | + } |
|
2672 | 2780 | echo ' |
2673 | 2781 | </span> |
2674 | 2782 | <a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;" class="toggle_down">', $txt['additional_membergroups_show'], '</a> |
@@ -2728,9 +2836,10 @@ discard block |
||
2728 | 2836 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
2729 | 2837 | <br>'; |
2730 | 2838 | |
2731 | - if ($context['show_spellchecking']) |
|
2732 | - echo ' |
|
2839 | + if ($context['show_spellchecking']) { |
|
2840 | + echo ' |
|
2733 | 2841 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
2842 | + } |
|
2734 | 2843 | |
2735 | 2844 | echo ' |
2736 | 2845 | </dt> |
@@ -2738,17 +2847,20 @@ discard block |
||
2738 | 2847 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>'; |
2739 | 2848 | |
2740 | 2849 | // If there is a limit at all! |
2741 | - if (!empty($context['signature_limits']['max_length'])) |
|
2742 | - echo ' |
|
2850 | + if (!empty($context['signature_limits']['max_length'])) { |
|
2851 | + echo ' |
|
2743 | 2852 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
2853 | + } |
|
2744 | 2854 | |
2745 | - if (!empty($context['show_preview_button'])) |
|
2746 | - echo ' |
|
2855 | + if (!empty($context['show_preview_button'])) { |
|
2856 | + echo ' |
|
2747 | 2857 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button">'; |
2858 | + } |
|
2748 | 2859 | |
2749 | - if ($context['signature_warning']) |
|
2750 | - echo ' |
|
2860 | + if ($context['signature_warning']) { |
|
2861 | + echo ' |
|
2751 | 2862 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
2863 | + } |
|
2752 | 2864 | |
2753 | 2865 | // Some javascript used to count how many characters have been used so far in the signature. |
2754 | 2866 | echo ' |
@@ -2792,9 +2904,10 @@ discard block |
||
2792 | 2904 | <div> |
2793 | 2905 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
2794 | 2906 | // This lists all the file categories. |
2795 | - foreach ($context['avatars'] as $avatar) |
|
2796 | - echo ' |
|
2907 | + foreach ($context['avatars'] as $avatar) { |
|
2908 | + echo ' |
|
2797 | 2909 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
2910 | + } |
|
2798 | 2911 | echo ' |
2799 | 2912 | </select> |
2800 | 2913 | </div> |
@@ -2849,16 +2962,17 @@ discard block |
||
2849 | 2962 | <div id="avatar_gravatar"> |
2850 | 2963 | <img src="' . $context['member']['avatar']['href'] . '" alt="" />'; |
2851 | 2964 | |
2852 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
2853 | - echo ' |
|
2965 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
2966 | + echo ' |
|
2854 | 2967 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
2855 | - else |
|
2968 | + } else |
|
2856 | 2969 | { |
2857 | 2970 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
2858 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
2859 | - $textbox_value = ''; |
|
2860 | - else |
|
2861 | - $textbox_value = $context['member']['avatar']['external']; |
|
2971 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
2972 | + $textbox_value = ''; |
|
2973 | + } else { |
|
2974 | + $textbox_value = $context['member']['avatar']['external']; |
|
2975 | + } |
|
2862 | 2976 | |
2863 | 2977 | echo ' |
2864 | 2978 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -2930,8 +3044,9 @@ discard block |
||
2930 | 3044 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
2931 | 3045 | |
2932 | 3046 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
2933 | - if (empty($suffix)) |
|
2934 | - return; |
|
3047 | + if (empty($suffix)) { |
|
3048 | + return; |
|
3049 | + } |
|
2935 | 3050 | |
2936 | 3051 | echo ' |
2937 | 3052 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -2953,9 +3068,10 @@ discard block |
||
2953 | 3068 | <dd> |
2954 | 3069 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">'; |
2955 | 3070 | // Help the user by showing a list of common time formats. |
2956 | - foreach ($context['easy_timeformats'] as $time_format) |
|
2957 | - echo ' |
|
3071 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
3072 | + echo ' |
|
2958 | 3073 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
3074 | + } |
|
2959 | 3075 | echo ' |
2960 | 3076 | </select><br> |
2961 | 3077 | <input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30"> |
@@ -2991,9 +3107,10 @@ discard block |
||
2991 | 3107 | </dt> |
2992 | 3108 | <dd> |
2993 | 3109 | <select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">'; |
2994 | - foreach ($context['smiley_sets'] as $set) |
|
2995 | - echo ' |
|
3110 | + foreach ($context['smiley_sets'] as $set) { |
|
3111 | + echo ' |
|
2996 | 3112 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
3113 | + } |
|
2997 | 3114 | echo ' |
2998 | 3115 | </select> |
2999 | 3116 | <img id="smileypr" class="centericon" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.gif' : $settings['images_url'] . '/blank.png', '" alt=":)"> |
@@ -3044,10 +3161,11 @@ discard block |
||
3044 | 3161 | <img src="', $context['tfa_qr_url'], '" alt=""> |
3045 | 3162 | </div>'; |
3046 | 3163 | |
3047 | - if (!empty($context['from_ajax'])) |
|
3048 | - echo ' |
|
3164 | + if (!empty($context['from_ajax'])) { |
|
3165 | + echo ' |
|
3049 | 3166 | <br> |
3050 | 3167 | <a href="javascript:self.close();"></a>'; |
3168 | + } |
|
3051 | 3169 | |
3052 | 3170 | echo ' |
3053 | 3171 | </div> |
@@ -3086,15 +3204,16 @@ discard block |
||
3086 | 3204 | <br><div class="smalltext">', $txt['tfa_profile_desc'], '</div> |
3087 | 3205 | </dt> |
3088 | 3206 | <dd>'; |
3089 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
3090 | - echo ' |
|
3207 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
3208 | + echo ' |
|
3091 | 3209 | <a href="', !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] < 2 ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
3092 | - elseif (!$context['tfa_enabled']) |
|
3093 | - echo ' |
|
3210 | + } elseif (!$context['tfa_enabled']) { |
|
3211 | + echo ' |
|
3094 | 3212 | ', $txt['tfa_profile_disabled']; |
3095 | - else |
|
3096 | - echo ' |
|
3213 | + } else { |
|
3214 | + echo ' |
|
3097 | 3215 | ', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
3216 | + } |
|
3098 | 3217 | echo ' |
3099 | 3218 | </dd>'; |
3100 | 3219 | } |
@@ -25,13 +25,15 @@ discard block |
||
25 | 25 | </h3> |
26 | 26 | </div>'; |
27 | 27 | |
28 | - if (!empty($context['search_errors'])) |
|
29 | - echo ' |
|
28 | + if (!empty($context['search_errors'])) { |
|
29 | + echo ' |
|
30 | 30 | <div class="errorbox">', implode('<br>', $context['search_errors']['messages']), '</div>'; |
31 | + } |
|
31 | 32 | |
32 | - if (!empty($context['search_ignored'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['search_ignored'])) { |
|
34 | + echo ' |
|
34 | 35 | <p class="noticebox">', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p>'; |
36 | + } |
|
35 | 37 | |
36 | 38 | echo ' |
37 | 39 | <div id="advanced_search" class="roundframe"> |
@@ -42,9 +44,10 @@ discard block |
||
42 | 44 | <dd> |
43 | 45 | <input type="search" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40">'; |
44 | 46 | |
45 | - if (empty($modSettings['search_simple_fulltext'])) |
|
46 | - echo ' |
|
47 | + if (empty($modSettings['search_simple_fulltext'])) { |
|
48 | + echo ' |
|
47 | 49 | <br><em class="smalltext">', $txt['search_example'], '</em>'; |
50 | + } |
|
48 | 51 | |
49 | 52 | echo ' |
50 | 53 | </dd> |
@@ -115,11 +118,12 @@ discard block |
||
115 | 118 | } |
116 | 119 | |
117 | 120 | // If $context['search_params']['topic'] is set, that means we're searching just one topic. |
118 | - if (!empty($context['search_params']['topic'])) |
|
119 | - echo ' |
|
121 | + if (!empty($context['search_params']['topic'])) { |
|
122 | + echo ' |
|
120 | 123 | <p>', $txt['search_specific_topic'], ' "', $context['search_topic']['link'], '".</p> |
121 | 124 | <input type="hidden" name="topic" value="', $context['search_topic']['id'], '"> |
122 | 125 | <input type="submit" name="b_search" value="', $txt['search'], '" class="button">'; |
126 | + } |
|
123 | 127 | |
124 | 128 | echo ' |
125 | 129 | </div>'; |
@@ -149,14 +153,15 @@ discard block |
||
149 | 153 | |
150 | 154 | foreach ($category['boards'] as $board) |
151 | 155 | { |
152 | - if ($i == $limit) |
|
153 | - echo ' |
|
156 | + if ($i == $limit) { |
|
157 | + echo ' |
|
154 | 158 | </ul> |
155 | 159 | </li> |
156 | 160 | </ul> |
157 | 161 | <ul class="ignoreboards floatright"> |
158 | 162 | <li class="category"> |
159 | 163 | <ul>'; |
164 | + } |
|
160 | 165 | |
161 | 166 | echo ' |
162 | 167 | <li class="board"> |
@@ -244,13 +249,15 @@ discard block |
||
244 | 249 | <div class="roundframe">'; |
245 | 250 | |
246 | 251 | // Did they make any typos or mistakes, perhaps? |
247 | - if (isset($context['did_you_mean'])) |
|
248 | - echo ' |
|
252 | + if (isset($context['did_you_mean'])) { |
|
253 | + echo ' |
|
249 | 254 | <p>', $txt['search_did_you_mean'], ' <a href="', $scripturl, '?action=search2;params=', $context['did_you_mean_params'], '">', $context['did_you_mean'], '</a>.</p>'; |
255 | + } |
|
250 | 256 | |
251 | - if (!empty($context['search_ignored'])) |
|
252 | - echo ' |
|
257 | + if (!empty($context['search_ignored'])) { |
|
258 | + echo ' |
|
253 | 259 | <p>', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p>'; |
260 | + } |
|
254 | 261 | |
255 | 262 | echo ' |
256 | 263 | <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
@@ -272,10 +279,11 @@ discard block |
||
272 | 279 | <input type="hidden" name="maxage" value="', !empty($context['search_params']['maxage']) ? $context['search_params']['maxage'] : '9999', '"> |
273 | 280 | <input type="hidden" name="sort" value="', !empty($context['search_params']['sort']) ? $context['search_params']['sort'] : 'relevance', '"> |
274 | 281 | </div>'; |
275 | - if (!empty($context['search_params']['brd'])) |
|
276 | - foreach ($context['search_params']['brd'] as $board_id) |
|
282 | + if (!empty($context['search_params']['brd'])) { |
|
283 | + foreach ($context['search_params']['brd'] as $board_id) |
|
277 | 284 | echo ' |
278 | 285 | <input type="hidden" name="brd[', $board_id, ']" value="', $board_id, '">'; |
286 | + } |
|
279 | 287 | |
280 | 288 | echo ' |
281 | 289 | </form> |
@@ -286,17 +294,19 @@ discard block |
||
286 | 294 | if ($context['compact']) |
287 | 295 | { |
288 | 296 | // Quick moderation set to checkboxes? Oh, how fun :/. |
289 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
290 | - echo ' |
|
297 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
298 | + echo ' |
|
291 | 299 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="topicForm">'; |
300 | + } |
|
292 | 301 | |
293 | 302 | echo ' |
294 | 303 | <div class="cat_bar"> |
295 | 304 | <h3 class="catbg"> |
296 | 305 | <span class="floatright">'; |
297 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
298 | - echo ' |
|
306 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
307 | + echo ' |
|
299 | 308 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">'; |
309 | + } |
|
300 | 310 | echo ' |
301 | 311 | </span> |
302 | 312 | <span class="generic_icons filter"></span> ', $txt['mlist_search_results'], ': ', $context['search_params']['search'], ' |
@@ -304,14 +314,15 @@ discard block |
||
304 | 314 | </div>'; |
305 | 315 | |
306 | 316 | // was anything even found? |
307 | - if (!empty($context['topics'])) |
|
308 | - echo' |
|
317 | + if (!empty($context['topics'])) { |
|
318 | + echo' |
|
309 | 319 | <div class="pagesection"> |
310 | 320 | <span>', $context['page_index'], '</span> |
311 | 321 | </div>'; |
312 | - else |
|
313 | - echo ' |
|
322 | + } else { |
|
323 | + echo ' |
|
314 | 324 | <div class="roundframe">', $txt['find_no_results'], '</div>'; |
325 | + } |
|
315 | 326 | |
316 | 327 | // while we have results to show ... |
317 | 328 | while ($topic = $context['get_topics']()) |
@@ -339,38 +350,43 @@ discard block |
||
339 | 350 | { |
340 | 351 | echo ' |
341 | 352 | <input type="checkbox" name="topics[]" value="', $topic['id'], '">'; |
342 | - } |
|
343 | - else |
|
353 | + } else |
|
344 | 354 | { |
345 | - if ($topic['quick_mod']['remove']) |
|
346 | - echo ' |
|
355 | + if ($topic['quick_mod']['remove']) { |
|
356 | + echo ' |
|
347 | 357 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>'; |
358 | + } |
|
348 | 359 | |
349 | - if ($topic['quick_mod']['lock']) |
|
350 | - echo ' |
|
360 | + if ($topic['quick_mod']['lock']) { |
|
361 | + echo ' |
|
351 | 362 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>'; |
363 | + } |
|
352 | 364 | |
353 | - if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) |
|
354 | - echo ' |
|
365 | + if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) { |
|
366 | + echo ' |
|
355 | 367 | <br>'; |
368 | + } |
|
356 | 369 | |
357 | - if ($topic['quick_mod']['sticky']) |
|
358 | - echo ' |
|
370 | + if ($topic['quick_mod']['sticky']) { |
|
371 | + echo ' |
|
359 | 372 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>'; |
373 | + } |
|
360 | 374 | |
361 | - if ($topic['quick_mod']['move']) |
|
362 | - echo ' |
|
375 | + if ($topic['quick_mod']['move']) { |
|
376 | + echo ' |
|
363 | 377 | <a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
378 | + } |
|
364 | 379 | } |
365 | 380 | |
366 | 381 | echo ' |
367 | 382 | </div>'; |
368 | 383 | } |
369 | 384 | |
370 | - if ($message['body_highlighted'] != '') |
|
371 | - echo ' |
|
385 | + if ($message['body_highlighted'] != '') { |
|
386 | + echo ' |
|
372 | 387 | <br class="clear"> |
373 | 388 | <div class="list_posts double_height">', $message['body_highlighted'], '</div>'; |
389 | + } |
|
374 | 390 | } |
375 | 391 | |
376 | 392 | echo ' |
@@ -378,11 +394,12 @@ discard block |
||
378 | 394 | </div>'; |
379 | 395 | |
380 | 396 | } |
381 | - if (!empty($context['topics'])) |
|
382 | - echo ' |
|
397 | + if (!empty($context['topics'])) { |
|
398 | + echo ' |
|
383 | 399 | <div class="pagesection"> |
384 | 400 | <span>', $context['page_index'], '</span> |
385 | 401 | </div>'; |
402 | + } |
|
386 | 403 | |
387 | 404 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
388 | 405 | { |
@@ -392,17 +409,19 @@ discard block |
||
392 | 409 | <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> |
393 | 410 | <option value="">--------</option>'; |
394 | 411 | |
395 | - foreach ($context['qmod_actions'] as $qmod_action) |
|
396 | - if ($context['can_' . $qmod_action]) |
|
412 | + foreach ($context['qmod_actions'] as $qmod_action) { |
|
413 | + if ($context['can_' . $qmod_action]) |
|
397 | 414 | echo ' |
398 | 415 | <option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>'; |
416 | + } |
|
399 | 417 | |
400 | 418 | echo ' |
401 | 419 | </select>'; |
402 | 420 | |
403 | - if ($context['can_move']) |
|
404 | - echo ' |
|
421 | + if ($context['can_move']) { |
|
422 | + echo ' |
|
405 | 423 | <span id="quick_mod_jump_to"> </span>'; |
424 | + } |
|
406 | 425 | |
407 | 426 | echo ' |
408 | 427 | <input type="hidden" name="redirect_url" value="', $scripturl . '?action=search2;params=' . $context['params'], '"> |
@@ -412,13 +431,13 @@ discard block |
||
412 | 431 | } |
413 | 432 | |
414 | 433 | |
415 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
|
416 | - echo ' |
|
434 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) { |
|
435 | + echo ' |
|
417 | 436 | <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '"> |
418 | 437 | </form>'; |
438 | + } |
|
419 | 439 | |
420 | - } |
|
421 | - else |
|
440 | + } else |
|
422 | 441 | { |
423 | 442 | echo ' |
424 | 443 | <div class="cat_bar"> |
@@ -430,9 +449,10 @@ discard block |
||
430 | 449 | <span>', $context['page_index'], '</span> |
431 | 450 | </div>'; |
432 | 451 | |
433 | - if (empty($context['topics'])) |
|
434 | - echo ' |
|
452 | + if (empty($context['topics'])) { |
|
453 | + echo ' |
|
435 | 454 | <div class="information">(', $txt['search_no_results'], ')</div>'; |
455 | + } |
|
436 | 456 | |
437 | 457 | while ($topic = $context['get_topics']()) |
438 | 458 | { |
@@ -447,23 +467,27 @@ discard block |
||
447 | 467 | </div> |
448 | 468 | <div class="list_posts">', $message['body_highlighted'], '</div>'; |
449 | 469 | |
450 | - if ($topic['can_reply']) |
|
451 | - echo ' |
|
470 | + if ($topic['can_reply']) { |
|
471 | + echo ' |
|
452 | 472 | <ul class="quickbuttons">'; |
473 | + } |
|
453 | 474 | |
454 | 475 | // If they *can* reply? |
455 | - if ($topic['can_reply']) |
|
456 | - echo ' |
|
476 | + if ($topic['can_reply']) { |
|
477 | + echo ' |
|
457 | 478 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
479 | + } |
|
458 | 480 | |
459 | 481 | // If they *can* quote? |
460 | - if ($topic['can_quote']) |
|
461 | - echo ' |
|
482 | + if ($topic['can_quote']) { |
|
483 | + echo ' |
|
462 | 484 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'] . ';quote=' . $message['id'] . '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
485 | + } |
|
463 | 486 | |
464 | - if ($topic['can_reply']) |
|
465 | - echo ' |
|
487 | + if ($topic['can_reply']) { |
|
488 | + echo ' |
|
466 | 489 | </ul>'; |
490 | + } |
|
467 | 491 | echo ' |
468 | 492 | <br class="clear"> |
469 | 493 | </div>'; |
@@ -482,8 +506,8 @@ discard block |
||
482 | 506 | <div class="smalltext righttext" id="search_jump_to"> </div> |
483 | 507 | <script>'; |
484 | 508 | |
485 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) |
|
486 | - echo ' |
|
509 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { |
|
510 | + echo ' |
|
487 | 511 | if (typeof(window.XMLHttpRequest) != "undefined") |
488 | 512 | aJumpTo[aJumpTo.length] = new JumpTo({ |
489 | 513 | sContainerId: "quick_mod_jump_to", |
@@ -498,6 +522,7 @@ discard block |
||
498 | 522 | bDisabled: true, |
499 | 523 | sCustomName: "move_to" |
500 | 524 | });'; |
525 | + } |
|
501 | 526 | |
502 | 527 | echo ' |
503 | 528 | if (typeof(window.XMLHttpRequest) != "undefined") |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | echo ' |
74 | 74 | <div class="main_container"> |
75 | - <div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '','" id="category_', $category['id'], '"> |
|
75 | + <div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '', '" id="category_', $category['id'], '"> |
|
76 | 76 | <h3 class="catbg">'; |
77 | 77 | |
78 | 78 | // If this category even can collapse, show a link to collapse it. |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | foreach ($board['children'] as $child) |
248 | 248 | { |
249 | 249 | if (!$child['is_redirect']) |
250 | - $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
250 | + $child['link'] = '' . ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
251 | 251 | else |
252 | 252 | $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
253 | 253 |
@@ -67,8 +67,9 @@ discard block |
||
67 | 67 | foreach ($context['categories'] as $category) |
68 | 68 | { |
69 | 69 | // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed) |
70 | - if (empty($category['boards']) && !$category['is_collapsed']) |
|
71 | - continue; |
|
70 | + if (empty($category['boards']) && !$category['is_collapsed']) { |
|
71 | + continue; |
|
72 | + } |
|
72 | 73 | |
73 | 74 | echo ' |
74 | 75 | <div class="main_container"> |
@@ -76,9 +77,10 @@ discard block |
||
76 | 77 | <h3 class="catbg">'; |
77 | 78 | |
78 | 79 | // If this category even can collapse, show a link to collapse it. |
79 | - if ($category['can_collapse']) |
|
80 | - echo ' |
|
80 | + if ($category['can_collapse']) { |
|
81 | + echo ' |
|
81 | 82 | <span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'], '" style="display: none;"></span>'; |
83 | + } |
|
82 | 84 | |
83 | 85 | echo ' |
84 | 86 | ', $category['link'], ' |
@@ -108,10 +110,11 @@ discard block |
||
108 | 110 | </div>'; |
109 | 111 | |
110 | 112 | // Won't somebody think of the children! |
111 | - if (function_exists('template_bi_' . $board['type'] . '_children')) |
|
112 | - call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
113 | - else |
|
114 | - template_bi_board_children($board); |
|
113 | + if (function_exists('template_bi_' . $board['type'] . '_children')) { |
|
114 | + call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
115 | + } else { |
|
116 | + template_bi_board_children($board); |
|
117 | + } |
|
115 | 118 | |
116 | 119 | echo ' |
117 | 120 | </div>'; |
@@ -126,10 +129,11 @@ discard block |
||
126 | 129 | </div>'; |
127 | 130 | |
128 | 131 | // Show the mark all as read button? |
129 | - if ($context['user']['is_logged'] && !empty($context['categories'])) |
|
130 | - echo ' |
|
132 | + if ($context['user']['is_logged'] && !empty($context['categories'])) { |
|
133 | + echo ' |
|
131 | 134 | <div class="mark_read">', template_button_strip($context['mark_read_button'], 'right'), '</div>'; |
132 | -} |
|
135 | + } |
|
136 | + } |
|
133 | 137 | |
134 | 138 | /** |
135 | 139 | * Outputs the board icon for a standard board. |
@@ -173,18 +177,20 @@ discard block |
||
173 | 177 | </a>'; |
174 | 178 | |
175 | 179 | // Has it outstanding posts for approval? |
176 | - if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) |
|
177 | - echo ' |
|
180 | + if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) { |
|
181 | + echo ' |
|
178 | 182 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>'; |
183 | + } |
|
179 | 184 | |
180 | 185 | echo ' |
181 | 186 | <p class="board_description">', $board['description'], '</p>'; |
182 | 187 | |
183 | 188 | // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
184 | - if (!empty($board['link_moderators'])) |
|
185 | - echo ' |
|
189 | + if (!empty($board['link_moderators'])) { |
|
190 | + echo ' |
|
186 | 191 | <p class="moderators">', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>'; |
187 | -} |
|
192 | + } |
|
193 | + } |
|
188 | 194 | |
189 | 195 | /** |
190 | 196 | * Outputs the board stats for a standard board. |
@@ -223,10 +229,11 @@ discard block |
||
223 | 229 | */ |
224 | 230 | function template_bi_board_lastpost($board) |
225 | 231 | { |
226 | - if (!empty($board['last_post']['id'])) |
|
227 | - echo ' |
|
232 | + if (!empty($board['last_post']['id'])) { |
|
233 | + echo ' |
|
228 | 234 | <p>', $board['last_post']['last_post_message'], '</p>'; |
229 | -} |
|
235 | + } |
|
236 | + } |
|
230 | 237 | |
231 | 238 | /** |
232 | 239 | * Outputs the board children for a standard board. |
@@ -246,14 +253,16 @@ discard block |
||
246 | 253 | id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */ |
247 | 254 | foreach ($board['children'] as $child) |
248 | 255 | { |
249 | - if (!$child['is_redirect']) |
|
250 | - $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
251 | - else |
|
252 | - $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
256 | + if (!$child['is_redirect']) { |
|
257 | + $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
258 | + } else { |
|
259 | + $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
260 | + } |
|
253 | 261 | |
254 | 262 | // Has it posts awaiting approval? |
255 | - if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) |
|
256 | - $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
263 | + if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) { |
|
264 | + $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
265 | + } |
|
257 | 266 | |
258 | 267 | $children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>'; |
259 | 268 | } |
@@ -280,8 +289,9 @@ discard block |
||
280 | 289 | { |
281 | 290 | global $context, $options, $txt; |
282 | 291 | |
283 | - if (empty($context['info_center'])) |
|
284 | - return; |
|
292 | + if (empty($context['info_center'])) { |
|
293 | + return; |
|
294 | + } |
|
285 | 295 | |
286 | 296 | // Here's where the "Info Center" starts... |
287 | 297 | echo ' |
@@ -381,14 +391,15 @@ discard block |
||
381 | 391 | /* Each post in latest_posts has: |
382 | 392 | board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.), |
383 | 393 | subject, short_subject (shortened with...), time, link, and href. */ |
384 | - foreach ($context['latest_posts'] as $post) |
|
385 | - echo ' |
|
394 | + foreach ($context['latest_posts'] as $post) { |
|
395 | + echo ' |
|
386 | 396 | <tr class="windowbg"> |
387 | 397 | <td class="recentpost"><strong>', $post['link'], '</strong></td> |
388 | 398 | <td class="recentposter">', $post['poster']['link'], '</td> |
389 | 399 | <td class="recentboard">', $post['board']['link'], '</td> |
390 | 400 | <td class="recenttime">', $post['time'], '</td> |
391 | 401 | </tr>'; |
402 | + } |
|
392 | 403 | echo ' |
393 | 404 | </table>'; |
394 | 405 | } |
@@ -412,9 +423,10 @@ discard block |
||
412 | 423 | </div>'; |
413 | 424 | |
414 | 425 | // Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P. |
415 | - if (!empty($context['calendar_holidays'])) |
|
416 | - echo ' |
|
426 | + if (!empty($context['calendar_holidays'])) { |
|
427 | + echo ' |
|
417 | 428 | <p class="inline holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $context['calendar_holidays']), '</p>'; |
429 | + } |
|
418 | 430 | |
419 | 431 | // People's birthdays. Like mine. And yours, I guess. Kidding. |
420 | 432 | if (!empty($context['calendar_birthdays'])) |
@@ -423,9 +435,10 @@ discard block |
||
423 | 435 | <p class="inline"> |
424 | 436 | <span class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</span>'; |
425 | 437 | // Each member in calendar_birthdays has: id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) |
426 | - foreach ($context['calendar_birthdays'] as $member) |
|
427 | - echo ' |
|
438 | + foreach ($context['calendar_birthdays'] as $member) { |
|
439 | + echo ' |
|
428 | 440 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong class="fix_rtl_names">' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', '; |
441 | + } |
|
429 | 442 | echo ' |
430 | 443 | </p>'; |
431 | 444 | } |
@@ -439,9 +452,10 @@ discard block |
||
439 | 452 | |
440 | 453 | // Each event in calendar_events should have: |
441 | 454 | // title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. |
442 | - foreach ($context['calendar_events'] as $event) |
|
443 | - echo ' |
|
455 | + foreach ($context['calendar_events'] as $event) { |
|
456 | + echo ' |
|
444 | 457 | ', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><span class="generic_icons calendar_modify"></span></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br>' : ', '; |
458 | + } |
|
445 | 459 | echo ' |
446 | 460 | </p>'; |
447 | 461 | } |
@@ -486,15 +500,19 @@ discard block |
||
486 | 500 | |
487 | 501 | // Handle hidden users and buddies. |
488 | 502 | $bracketList = array(); |
489 | - if ($context['show_buddies']) |
|
490 | - $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
491 | - if (!empty($context['num_spiders'])) |
|
492 | - $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
493 | - if (!empty($context['num_users_hidden'])) |
|
494 | - $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
503 | + if ($context['show_buddies']) { |
|
504 | + $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
505 | + } |
|
506 | + if (!empty($context['num_spiders'])) { |
|
507 | + $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
508 | + } |
|
509 | + if (!empty($context['num_users_hidden'])) { |
|
510 | + $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
511 | + } |
|
495 | 512 | |
496 | - if (!empty($bracketList)) |
|
497 | - echo ' (' . implode(', ', $bracketList) . ')'; |
|
513 | + if (!empty($bracketList)) { |
|
514 | + echo ' (' . implode(', ', $bracketList) . ')'; |
|
515 | + } |
|
498 | 516 | |
499 | 517 | echo $context['show_who'] ? '</a>' : '', ' |
500 | 518 | |
@@ -508,9 +526,10 @@ discard block |
||
508 | 526 | ', sprintf($txt['users_active'], $modSettings['lastActive']), ': ', implode(', ', $context['list_users_online']); |
509 | 527 | |
510 | 528 | // Showing membergroups? |
511 | - if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) |
|
512 | - echo ' |
|
529 | + if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) { |
|
530 | + echo ' |
|
513 | 531 | <span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>'; |
532 | + } |
|
514 | 533 | } |
515 | 534 | |
516 | 535 | echo ' |
@@ -19,26 +19,28 @@ discard block |
||
19 | 19 | global $context, $settings, $scripturl, $txt, $modSettings; |
20 | 20 | |
21 | 21 | // Not allowed to edit? |
22 | - if (!$context['can_modify']) |
|
23 | - echo ' |
|
22 | + if (!$context['can_modify']) { |
|
23 | + echo ' |
|
24 | 24 | <div class="errorbox"> |
25 | 25 | ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' |
26 | 26 | </div>'; |
27 | + } |
|
27 | 28 | |
28 | 29 | echo ' |
29 | 30 | <div id="admin_form_wrapper"> |
30 | 31 | <form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm">'; |
31 | 32 | |
32 | - if (!empty($context['profile'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['profile'])) { |
|
34 | + echo ' |
|
34 | 35 | <div class="cat_bar"> |
35 | 36 | <h3 class="catbg">', $txt['permissions_for_profile'], ': "', $context['profile']['name'], '"</h3> |
36 | 37 | </div>'; |
37 | - else |
|
38 | - echo ' |
|
38 | + } else { |
|
39 | + echo ' |
|
39 | 40 | <div class="cat_bar"> |
40 | 41 | <h3 class="catbg">', $txt['permissions_title'], '</h3> |
41 | 42 | </div>'; |
43 | + } |
|
42 | 44 | |
43 | 45 | echo ' |
44 | 46 | <table class="table_grid"> |
@@ -47,13 +49,14 @@ discard block |
||
47 | 49 | <th>', $txt['membergroups_name'], '</th> |
48 | 50 | <th class="small_table">', $txt['membergroups_members_top'], '</th>'; |
49 | 51 | |
50 | - if (empty($modSettings['permission_enable_deny'])) |
|
51 | - echo ' |
|
52 | + if (empty($modSettings['permission_enable_deny'])) { |
|
53 | + echo ' |
|
52 | 54 | <th class="small_table">', $txt['membergroups_permissions'], '</th>'; |
53 | - else |
|
54 | - echo ' |
|
55 | + } else { |
|
56 | + echo ' |
|
55 | 57 | <th class="small_table">', $txt['permissions_allowed'], '</th> |
56 | 58 | <th class="small_table">', $txt['permissions_denied'], '</th>'; |
59 | + } |
|
57 | 60 | |
58 | 61 | echo ' |
59 | 62 | <th class="small_table">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th> |
@@ -71,22 +74,24 @@ discard block |
||
71 | 74 | <td> |
72 | 75 | ', !empty($group['help']) ? ' <a class="help" href="' . $scripturl . '?action=helpadmin;help=' . $group['help'] . '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a>' : '<img class="icon" src="' . $settings['images_url'] . '/blank.png" alt="' . $txt['help'] . '">', ' <span>', $group['name'], '</span>'; |
73 | 76 | |
74 | - if (!empty($group['children'])) |
|
75 | - echo ' |
|
77 | + if (!empty($group['children'])) { |
|
78 | + echo ' |
|
76 | 79 | <br> |
77 | 80 | <span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; |
81 | + } |
|
78 | 82 | |
79 | 83 | echo ' |
80 | 84 | </td> |
81 | 85 | <td>', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>'; |
82 | 86 | |
83 | - if (empty($modSettings['permission_enable_deny'])) |
|
84 | - echo ' |
|
87 | + if (empty($modSettings['permission_enable_deny'])) { |
|
88 | + echo ' |
|
85 | 89 | <td>', $group['num_permissions']['allowed'], '</td>'; |
86 | - else |
|
87 | - echo ' |
|
90 | + } else { |
|
91 | + echo ' |
|
88 | 92 | <td ', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '>', $group['num_permissions']['allowed'], '</td> |
89 | 93 | <td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>', $group['num_permissions']['denied'], '</td>'; |
94 | + } |
|
90 | 95 | |
91 | 96 | echo ' |
92 | 97 | <td>', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']) . '</a>' : '', '</td> |
@@ -133,9 +138,10 @@ discard block |
||
133 | 138 | <option value="empty">(', $txt['permissions_select_membergroup'], ')</option>'; |
134 | 139 | foreach ($context['groups'] as $group) |
135 | 140 | { |
136 | - if ($group['id'] != 1) |
|
137 | - echo ' |
|
141 | + if ($group['id'] != 1) { |
|
142 | + echo ' |
|
138 | 143 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
144 | + } |
|
139 | 145 | } |
140 | 146 | |
141 | 147 | echo ' |
@@ -145,9 +151,10 @@ discard block |
||
145 | 151 | <select name="add_remove"> |
146 | 152 | <option value="add">', $txt['permissions_add'], '...</option> |
147 | 153 | <option value="clear">', $txt['permissions_remove'], '...</option>'; |
148 | - if (!empty($modSettings['permission_enable_deny'])) |
|
149 | - echo ' |
|
154 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
155 | + echo ' |
|
150 | 156 | <option value="deny">', $txt['permissions_deny'], '...</option>'; |
157 | + } |
|
151 | 158 | echo ' |
152 | 159 | </select> |
153 | 160 | </dt> |
@@ -156,30 +163,34 @@ discard block |
||
156 | 163 | <option value="">(', $txt['permissions_select_permission'], ')</option>'; |
157 | 164 | foreach ($context['permissions'] as $permissionType) |
158 | 165 | { |
159 | - if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) |
|
160 | - continue; |
|
166 | + if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) { |
|
167 | + continue; |
|
168 | + } |
|
161 | 169 | |
162 | 170 | foreach ($permissionType['columns'] as $column) |
163 | 171 | { |
164 | 172 | foreach ($column as $permissionGroup) |
165 | 173 | { |
166 | - if ($permissionGroup['hidden']) |
|
167 | - continue; |
|
174 | + if ($permissionGroup['hidden']) { |
|
175 | + continue; |
|
176 | + } |
|
168 | 177 | |
169 | 178 | echo ' |
170 | 179 | <option value="" disabled>[', $permissionGroup['name'], ']</option>'; |
171 | 180 | foreach ($permissionGroup['permissions'] as $perm) |
172 | 181 | { |
173 | - if ($perm['hidden']) |
|
174 | - continue; |
|
182 | + if ($perm['hidden']) { |
|
183 | + continue; |
|
184 | + } |
|
175 | 185 | |
176 | - if ($perm['has_own_any']) |
|
177 | - echo ' |
|
186 | + if ($perm['has_own_any']) { |
|
187 | + echo ' |
|
178 | 188 | <option value="', $permissionType['id'], '/', $perm['own']['id'], '"> ', $perm['name'], ' (', $perm['own']['name'], ')</option> |
179 | 189 | <option value="', $permissionType['id'], '/', $perm['any']['id'], '"> ', $perm['name'], ' (', $perm['any']['name'], ')</option>'; |
180 | - else |
|
181 | - echo ' |
|
190 | + } else { |
|
191 | + echo ' |
|
182 | 192 | <option value="', $permissionType['id'], '/', $perm['id'], '"> ', $perm['name'], '</option>'; |
193 | + } |
|
183 | 194 | } |
184 | 195 | } |
185 | 196 | } |
@@ -246,9 +257,10 @@ discard block |
||
246 | 257 | } |
247 | 258 | </script>'; |
248 | 259 | |
249 | - if (!empty($context['profile'])) |
|
250 | - echo ' |
|
260 | + if (!empty($context['profile'])) { |
|
261 | + echo ' |
|
251 | 262 | <input type="hidden" name="pid" value="', $context['profile']['id'], '">'; |
263 | + } |
|
252 | 264 | |
253 | 265 | echo ' |
254 | 266 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -293,9 +305,10 @@ discard block |
||
293 | 305 | <h3 class="subbg">', $category['name'], '</h3> |
294 | 306 | </div>'; |
295 | 307 | |
296 | - if (!empty($category['boards'])) |
|
297 | - echo ' |
|
308 | + if (!empty($category['boards'])) { |
|
309 | + echo ' |
|
298 | 310 | <ul class="perm_boards flow_hidden">'; |
311 | + } |
|
299 | 312 | |
300 | 313 | foreach ($category['boards'] as $board) |
301 | 314 | { |
@@ -312,33 +325,36 @@ discard block |
||
312 | 325 | echo ' |
313 | 326 | <select name="boardprofile[', $board['id'], ']">'; |
314 | 327 | |
315 | - foreach ($context['profiles'] as $id => $profile) |
|
316 | - echo ' |
|
328 | + foreach ($context['profiles'] as $id => $profile) { |
|
329 | + echo ' |
|
317 | 330 | <option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
331 | + } |
|
318 | 332 | |
319 | 333 | echo ' |
320 | 334 | </select>'; |
321 | - } |
|
322 | - else |
|
323 | - echo ' |
|
335 | + } else { |
|
336 | + echo ' |
|
324 | 337 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>'; |
338 | + } |
|
325 | 339 | |
326 | 340 | echo ' |
327 | 341 | </span> |
328 | 342 | </li>'; |
329 | 343 | } |
330 | 344 | |
331 | - if (!empty($category['boards'])) |
|
332 | - echo ' |
|
345 | + if (!empty($category['boards'])) { |
|
346 | + echo ' |
|
333 | 347 | </ul>'; |
348 | + } |
|
334 | 349 | } |
335 | 350 | |
336 | - if ($context['edit_all']) |
|
337 | - echo ' |
|
351 | + if ($context['edit_all']) { |
|
352 | + echo ' |
|
338 | 353 | <input type="submit" name="save_changes" value="', $txt['save'], '" class="button">'; |
339 | - else |
|
340 | - echo ' |
|
354 | + } else { |
|
355 | + echo ' |
|
341 | 356 | <a class="button" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>'; |
357 | + } |
|
342 | 358 | |
343 | 359 | echo ' |
344 | 360 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -378,12 +394,13 @@ discard block |
||
378 | 394 | <tr class="windowbg"> |
379 | 395 | <td>'; |
380 | 396 | |
381 | - if (!empty($context['show_rename_boxes']) && $profile['can_edit']) |
|
382 | - echo ' |
|
397 | + if (!empty($context['show_rename_boxes']) && $profile['can_edit']) { |
|
398 | + echo ' |
|
383 | 399 | <input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '">'; |
384 | - else |
|
385 | - echo ' |
|
400 | + } else { |
|
401 | + echo ' |
|
386 | 402 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>'; |
403 | + } |
|
387 | 404 | |
388 | 405 | echo ' |
389 | 406 | </td> |
@@ -403,9 +420,10 @@ discard block |
||
403 | 420 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
404 | 421 | <input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">'; |
405 | 422 | |
406 | - if ($context['can_edit_something']) |
|
407 | - echo ' |
|
423 | + if ($context['can_edit_something']) { |
|
424 | + echo ' |
|
408 | 425 | <input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button">'; |
426 | + } |
|
409 | 427 | |
410 | 428 | echo ' |
411 | 429 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '/> |
@@ -430,9 +448,10 @@ discard block |
||
430 | 448 | <dd> |
431 | 449 | <select name="copy_from">'; |
432 | 450 | |
433 | - foreach ($context['profiles'] as $id => $profile) |
|
434 | - echo ' |
|
451 | + foreach ($context['profiles'] as $id => $profile) { |
|
452 | + echo ' |
|
435 | 453 | <option value="', $id, '">', $profile['name'], '</option>'; |
454 | + } |
|
436 | 455 | |
437 | 456 | echo ' |
438 | 457 | </select> |
@@ -460,8 +479,7 @@ discard block |
||
460 | 479 | <div class="errorbox"> |
461 | 480 | ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' |
462 | 481 | </div>'; |
463 | - } |
|
464 | - else |
|
482 | + } else |
|
465 | 483 | { |
466 | 484 | echo ' |
467 | 485 | <script> |
@@ -481,21 +499,23 @@ discard block |
||
481 | 499 | <div id="admincenter"> |
482 | 500 | <form id="permissions" action="', $scripturl, '?action=admin;area=permissions;sa=modify2;group=', $context['group']['id'], ';pid=', $context['profile']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" onsubmit="return warnAboutDeny();">'; |
483 | 501 | |
484 | - if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) |
|
485 | - echo ' |
|
502 | + if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) { |
|
503 | + echo ' |
|
486 | 504 | <div class="information"> |
487 | 505 | ', $txt['permissions_option_desc'], ' |
488 | 506 | </div>'; |
507 | + } |
|
489 | 508 | |
490 | 509 | echo ' |
491 | 510 | <div class="cat_bar"> |
492 | 511 | <h3 class="catbg">'; |
493 | - if ($context['permission_type'] == 'board') |
|
494 | - echo ' |
|
512 | + if ($context['permission_type'] == 'board') { |
|
513 | + echo ' |
|
495 | 514 | ', $txt['permissions_local_for'], ' "', $context['group']['name'], '" ', $txt['permissions_on'], ' "', $context['profile']['name'], '"'; |
496 | - else |
|
497 | - echo ' |
|
515 | + } else { |
|
516 | + echo ' |
|
498 | 517 | ', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - "', $context['group']['name'], '"'; |
518 | + } |
|
499 | 519 | echo ' |
500 | 520 | </h3> |
501 | 521 | </div>'; |
@@ -518,15 +538,17 @@ discard block |
||
518 | 538 | template_modify_group_display('board'); |
519 | 539 | } |
520 | 540 | |
521 | - if ($context['profile']['can_modify']) |
|
522 | - echo ' |
|
541 | + if ($context['profile']['can_modify']) { |
|
542 | + echo ' |
|
523 | 543 | <div class="padding"> |
524 | 544 | <input type="submit" value="', $txt['permissions_commit'], '" class="button"> |
525 | 545 | </div>'; |
546 | + } |
|
526 | 547 | |
527 | - foreach ($context['hidden_perms'] as $hidden_perm) |
|
528 | - echo ' |
|
548 | + foreach ($context['hidden_perms'] as $hidden_perm) { |
|
549 | + echo ' |
|
529 | 550 | <input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">'; |
551 | + } |
|
530 | 552 | |
531 | 553 | echo ' |
532 | 554 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -554,17 +576,19 @@ discard block |
||
554 | 576 | |
555 | 577 | foreach ($column as $permissionGroup) |
556 | 578 | { |
557 | - if (empty($permissionGroup['permissions'])) |
|
558 | - continue; |
|
579 | + if (empty($permissionGroup['permissions'])) { |
|
580 | + continue; |
|
581 | + } |
|
559 | 582 | |
560 | 583 | // Are we likely to have something in this group to display or is it all hidden? |
561 | 584 | $has_display_content = false; |
562 | 585 | if (!$permissionGroup['hidden']) |
563 | 586 | { |
564 | 587 | // Before we go any further check we are going to have some data to print otherwise we just have a silly heading. |
565 | - foreach ($permissionGroup['permissions'] as $permission) |
|
566 | - if (!$permission['hidden']) |
|
588 | + foreach ($permissionGroup['permissions'] as $permission) { |
|
589 | + if (!$permission['hidden']) |
|
567 | 590 | $has_display_content = true; |
591 | + } |
|
568 | 592 | |
569 | 593 | if ($has_display_content) |
570 | 594 | { |
@@ -573,10 +597,11 @@ discard block |
||
573 | 597 | <th></th> |
574 | 598 | <th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>'; |
575 | 599 | |
576 | - if ($context['group']['id'] != -1) |
|
577 | - echo ' |
|
600 | + if ($context['group']['id'] != -1) { |
|
601 | + echo ' |
|
578 | 602 | <th>', $txt['permissions_option_own'], '</th> |
579 | 603 | <th>', $txt['permissions_option_any'], '</th>'; |
604 | + } |
|
580 | 605 | |
581 | 606 | echo ' |
582 | 607 | </tr>'; |
@@ -599,17 +624,18 @@ discard block |
||
599 | 624 | // Guests can't do their own thing. |
600 | 625 | if ($context['group']['id'] != -1) |
601 | 626 | { |
602 | - if (empty($modSettings['permission_enable_deny'])) |
|
603 | - echo ' |
|
627 | + if (empty($modSettings['permission_enable_deny'])) { |
|
628 | + echo ' |
|
604 | 629 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" ', $disable_field, '/>'; |
605 | - else |
|
630 | + } else |
|
606 | 631 | { |
607 | 632 | echo ' |
608 | 633 | <select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>'; |
609 | 634 | |
610 | - foreach (array('on', 'off', 'deny') as $c) |
|
611 | - echo ' |
|
635 | + foreach (array('on', 'off', 'deny') as $c) { |
|
636 | + echo ' |
|
612 | 637 | <option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
638 | + } |
|
613 | 639 | echo ' |
614 | 640 | </select>'; |
615 | 641 | } |
@@ -619,39 +645,41 @@ discard block |
||
619 | 645 | <td>'; |
620 | 646 | } |
621 | 647 | |
622 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
623 | - echo ' |
|
648 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
649 | + echo ' |
|
624 | 650 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '/>'; |
625 | - else |
|
651 | + } else |
|
626 | 652 | { |
627 | 653 | echo ' |
628 | 654 | <select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>'; |
629 | 655 | |
630 | - foreach (array('on', 'off', 'deny') as $c) |
|
631 | - echo ' |
|
656 | + foreach (array('on', 'off', 'deny') as $c) { |
|
657 | + echo ' |
|
632 | 658 | <option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
659 | + } |
|
633 | 660 | echo ' |
634 | 661 | </select>'; |
635 | 662 | } |
636 | - } |
|
637 | - else |
|
663 | + } else |
|
638 | 664 | { |
639 | - if ($context['group']['id'] != -1) |
|
640 | - echo ' |
|
665 | + if ($context['group']['id'] != -1) { |
|
666 | + echo ' |
|
641 | 667 | </td> |
642 | 668 | <td>'; |
669 | + } |
|
643 | 670 | |
644 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
645 | - echo ' |
|
671 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
672 | + echo ' |
|
646 | 673 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '/>'; |
647 | - else |
|
674 | + } else |
|
648 | 675 | { |
649 | 676 | echo ' |
650 | 677 | <select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>'; |
651 | 678 | |
652 | - foreach (array('on', 'off', 'deny') as $c) |
|
653 | - echo ' |
|
679 | + foreach (array('on', 'off', 'deny') as $c) { |
|
680 | + echo ' |
|
654 | 681 | <option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
682 | + } |
|
655 | 683 | echo ' |
656 | 684 | </select>'; |
657 | 685 | } |
@@ -681,11 +709,11 @@ discard block |
||
681 | 709 | echo ' |
682 | 710 | <fieldset id="', $context['current_permission'], '"> |
683 | 711 | <legend><a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'none\';document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'block\'; return false;" class="toggle_up"> ', $txt['avatar_select_permission'], '</a></legend>'; |
684 | - if (empty($modSettings['permission_enable_deny'])) |
|
685 | - echo ' |
|
712 | + if (empty($modSettings['permission_enable_deny'])) { |
|
713 | + echo ' |
|
686 | 714 | <ul>'; |
687 | - else |
|
688 | - echo ' |
|
715 | + } else { |
|
716 | + echo ' |
|
689 | 717 | <div class="information">', $txt['permissions_option_desc'], '</div> |
690 | 718 | <dl class="settings"> |
691 | 719 | <dt> |
@@ -695,46 +723,51 @@ discard block |
||
695 | 723 | </dt> |
696 | 724 | <dd> |
697 | 725 | </dd>'; |
726 | + } |
|
698 | 727 | foreach ($context['member_groups'] as $group) |
699 | 728 | { |
700 | - if (!empty($modSettings['permission_enable_deny'])) |
|
701 | - echo ' |
|
729 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
730 | + echo ' |
|
702 | 731 | <dt>'; |
703 | - else |
|
704 | - echo ' |
|
732 | + } else { |
|
733 | + echo ' |
|
705 | 734 | <li>'; |
735 | + } |
|
706 | 736 | |
707 | - if (empty($modSettings['permission_enable_deny'])) |
|
708 | - echo ' |
|
737 | + if (empty($modSettings['permission_enable_deny'])) { |
|
738 | + echo ' |
|
709 | 739 | <input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '>'; |
710 | - else |
|
711 | - echo ' |
|
740 | + } else { |
|
741 | + echo ' |
|
712 | 742 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '></span> |
713 | 743 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', '></span> |
714 | 744 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', '></span>'; |
745 | + } |
|
715 | 746 | |
716 | - if (!empty($modSettings['permission_enable_deny'])) |
|
717 | - echo ' |
|
747 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
748 | + echo ' |
|
718 | 749 | </dt> |
719 | 750 | <dd> |
720 | 751 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
721 | 752 | </dd>'; |
722 | - else |
|
723 | - echo ' |
|
753 | + } else { |
|
754 | + echo ' |
|
724 | 755 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
725 | 756 | </li>'; |
757 | + } |
|
726 | 758 | } |
727 | 759 | |
728 | - if (empty($modSettings['permission_enable_deny'])) |
|
729 | - echo ' |
|
760 | + if (empty($modSettings['permission_enable_deny'])) { |
|
761 | + echo ' |
|
730 | 762 | <li> |
731 | 763 | <input type="checkbox" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');"> |
732 | 764 | <span>', $txt['check_all'], '</span> |
733 | 765 | </li> |
734 | 766 | </ul>'; |
735 | - else |
|
736 | - echo ' |
|
767 | + } else { |
|
768 | + echo ' |
|
737 | 769 | </dl>'; |
770 | + } |
|
738 | 771 | |
739 | 772 | echo ' |
740 | 773 | </fieldset> |
@@ -774,9 +807,10 @@ discard block |
||
774 | 807 | if (!empty($modSettings['postmod_active'])) |
775 | 808 | { |
776 | 809 | // Got advanced permissions - if so warn! |
777 | - if (!empty($modSettings['permission_enable_deny'])) |
|
778 | - echo ' |
|
810 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
811 | + echo ' |
|
779 | 812 | <div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>'; |
813 | + } |
|
780 | 814 | |
781 | 815 | echo ' |
782 | 816 | <div class="padding"> |
@@ -791,10 +825,11 @@ discard block |
||
791 | 825 | ', $txt['permissions_post_moderation_select'], ': |
792 | 826 | <select name="pid" onchange="document.forms.postmodForm.submit();">'; |
793 | 827 | |
794 | - foreach ($context['profiles'] as $profile) |
|
795 | - if ($profile['can_modify']) |
|
828 | + foreach ($context['profiles'] as $profile) { |
|
829 | + if ($profile['can_modify']) |
|
796 | 830 | echo ' |
797 | 831 | <option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
832 | + } |
|
798 | 833 | |
799 | 834 | echo ' |
800 | 835 | </select> |
@@ -815,11 +850,12 @@ discard block |
||
815 | 850 | ', $txt['permissions_post_moderation_replies_any'], ' |
816 | 851 | </th>'; |
817 | 852 | |
818 | - if ($modSettings['attachmentEnable'] == 1) |
|
819 | - echo ' |
|
853 | + if ($modSettings['attachmentEnable'] == 1) { |
|
854 | + echo ' |
|
820 | 855 | <th class="centercol" colspan="3"> |
821 | 856 | ', $txt['permissions_post_moderation_attachments'], ' |
822 | 857 | </th>'; |
858 | + } |
|
823 | 859 | |
824 | 860 | echo ' |
825 | 861 | </tr> |
@@ -837,11 +873,12 @@ discard block |
||
837 | 873 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
838 | 874 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
839 | 875 | |
840 | - if ($modSettings['attachmentEnable'] == 1) |
|
841 | - echo ' |
|
876 | + if ($modSettings['attachmentEnable'] == 1) { |
|
877 | + echo ' |
|
842 | 878 | <th><span class="generic_icons post_moderation_allow"></span></th> |
843 | 879 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
844 | 880 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
881 | + } |
|
845 | 882 | |
846 | 883 | echo ' |
847 | 884 | </tr> |
@@ -854,9 +891,10 @@ discard block |
||
854 | 891 | <tr class="windowbg"> |
855 | 892 | <td class="half_table"> |
856 | 893 | <span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>'; |
857 | - if (!empty($group['children'])) |
|
858 | - echo ' |
|
894 | + if (!empty($group['children'])) { |
|
895 | + echo ' |
|
859 | 896 | <br><span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; |
897 | + } |
|
860 | 898 | |
861 | 899 | echo ' |
862 | 900 | </td> |
@@ -869,8 +907,7 @@ discard block |
||
869 | 907 | { |
870 | 908 | echo ' |
871 | 909 | <td colspan="3"></td>'; |
872 | - } |
|
873 | - else |
|
910 | + } else |
|
874 | 911 | { |
875 | 912 | echo ' |
876 | 913 | <td class="centercol"><input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', '></td> |