@@ -28,14 +28,15 @@ discard block |
||
28 | 28 | <div id="confirm_buttons">'; |
29 | 29 | |
30 | 30 | // Age restriction in effect? |
31 | - if ($context['show_coppa']) |
|
32 | - echo ' |
|
31 | + if ($context['show_coppa']) { |
|
32 | + echo ' |
|
33 | 33 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br> |
34 | 34 | <br> |
35 | 35 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">'; |
36 | - else |
|
37 | - echo ' |
|
36 | + } else { |
|
37 | + echo ' |
|
38 | 38 | <input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button">'; |
39 | + } |
|
39 | 40 | |
40 | 41 | echo ' |
41 | 42 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -78,9 +79,10 @@ discard block |
||
78 | 79 | <ul>'; |
79 | 80 | |
80 | 81 | // Cycle through each error and display an error message. |
81 | - foreach ($context['registration_errors'] as $error) |
|
82 | - echo ' |
|
82 | + foreach ($context['registration_errors'] as $error) { |
|
83 | + echo ' |
|
83 | 84 | <li>', $error, '</li>'; |
85 | + } |
|
84 | 86 | |
85 | 87 | echo ' |
86 | 88 | </ul> |
@@ -150,14 +152,15 @@ discard block |
||
150 | 152 | |
151 | 153 | <dl class="register_form">'; |
152 | 154 | |
153 | - foreach ($context['custom_fields'] as $field) |
|
154 | - if ($field['show_reg'] > 1) |
|
155 | + foreach ($context['custom_fields'] as $field) { |
|
156 | + if ($field['show_reg'] > 1) |
|
155 | 157 | echo ' |
156 | 158 | <dt> |
157 | 159 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
158 | 160 | <span class="smalltext">', $field['desc'], '</span> |
159 | 161 | </dt> |
160 | 162 | <dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>'; |
163 | + } |
|
161 | 164 | |
162 | 165 | echo ' |
163 | 166 | </dl>'; |
@@ -191,41 +194,45 @@ discard block |
||
191 | 194 | $callback_func = 'template_profile_' . $field['callback_func']; |
192 | 195 | $callback_func(); |
193 | 196 | } |
194 | - } |
|
195 | - else |
|
197 | + } else |
|
196 | 198 | { |
197 | 199 | echo ' |
198 | 200 | <dt> |
199 | 201 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>'; |
200 | 202 | |
201 | 203 | // Does it have any subtext to show? |
202 | - if (!empty($field['subtext'])) |
|
203 | - echo ' |
|
204 | + if (!empty($field['subtext'])) { |
|
205 | + echo ' |
|
204 | 206 | <span class="smalltext">', $field['subtext'], '</span>'; |
207 | + } |
|
205 | 208 | |
206 | 209 | echo ' |
207 | 210 | </dt> |
208 | 211 | <dd>'; |
209 | 212 | |
210 | 213 | // Want to put something infront of the box? |
211 | - if (!empty($field['preinput'])) |
|
212 | - echo ' |
|
214 | + if (!empty($field['preinput'])) { |
|
215 | + echo ' |
|
213 | 216 | ', $field['preinput']; |
217 | + } |
|
214 | 218 | |
215 | 219 | // What type of data are we showing? |
216 | - if ($field['type'] == 'label') |
|
217 | - echo ' |
|
220 | + if ($field['type'] == 'label') { |
|
221 | + echo ' |
|
218 | 222 | ', $field['value']; |
223 | + } |
|
219 | 224 | |
220 | 225 | // Maybe it's a text box - very likely! |
221 | - elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) |
|
222 | - echo ' |
|
226 | + elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) { |
|
227 | + echo ' |
|
223 | 228 | <input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>'; |
229 | + } |
|
224 | 230 | |
225 | 231 | // You "checking" me out? ;) |
226 | - elseif ($field['type'] == 'check') |
|
227 | - echo ' |
|
232 | + elseif ($field['type'] == 'check') { |
|
233 | + echo ' |
|
228 | 234 | <input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>'; |
235 | + } |
|
229 | 236 | |
230 | 237 | // Always fun - select boxes! |
231 | 238 | elseif ($field['type'] == 'select') |
@@ -236,14 +243,16 @@ discard block |
||
236 | 243 | if (isset($field['options'])) |
237 | 244 | { |
238 | 245 | // Is this some code to generate the options? |
239 | - if (!is_array($field['options'])) |
|
240 | - $field['options'] = eval($field['options']); |
|
246 | + if (!is_array($field['options'])) { |
|
247 | + $field['options'] = eval($field['options']); |
|
248 | + } |
|
241 | 249 | |
242 | 250 | // Assuming we now have some! |
243 | - if (is_array($field['options'])) |
|
244 | - foreach ($field['options'] as $value => $name) |
|
251 | + if (is_array($field['options'])) { |
|
252 | + foreach ($field['options'] as $value => $name) |
|
245 | 253 | echo ' |
246 | 254 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
255 | + } |
|
247 | 256 | } |
248 | 257 | |
249 | 258 | echo ' |
@@ -251,9 +260,10 @@ discard block |
||
251 | 260 | } |
252 | 261 | |
253 | 262 | // Something to end with? |
254 | - if (!empty($field['postinput'])) |
|
255 | - echo ' |
|
263 | + if (!empty($field['postinput'])) { |
|
264 | + echo ' |
|
256 | 265 | ', $field['postinput']; |
266 | + } |
|
257 | 267 | |
258 | 268 | echo ' |
259 | 269 | </dd>'; |
@@ -266,13 +276,14 @@ discard block |
||
266 | 276 | { |
267 | 277 | foreach ($context['custom_fields'] as $field) |
268 | 278 | { |
269 | - if ($field['show_reg'] < 2) |
|
270 | - echo ' |
|
279 | + if ($field['show_reg'] < 2) { |
|
280 | + echo ' |
|
271 | 281 | <dt> |
272 | 282 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
273 | 283 | <span class="smalltext">', $field['desc'], '</span> |
274 | 284 | </dt> |
275 | 285 | <dd>', $field['input_html'], '</dd>'; |
286 | + } |
|
276 | 287 | } |
277 | 288 | } |
278 | 289 | |
@@ -302,14 +313,15 @@ discard block |
||
302 | 313 | <div id="confirm_buttons" class="flow_auto">'; |
303 | 314 | |
304 | 315 | // Age restriction in effect? |
305 | - if (!$context['require_agreement'] && $context['show_coppa']) |
|
306 | - echo ' |
|
316 | + if (!$context['require_agreement'] && $context['show_coppa']) { |
|
317 | + echo ' |
|
307 | 318 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br> |
308 | 319 | <br> |
309 | 320 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">'; |
310 | - else |
|
311 | - echo ' |
|
321 | + } else { |
|
322 | + echo ' |
|
312 | 323 | <input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">'; |
324 | + } |
|
313 | 325 | echo ' |
314 | 326 | </div> |
315 | 327 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -457,19 +469,20 @@ discard block |
||
457 | 469 | </head> |
458 | 470 | <body style="margin: 1ex;"> |
459 | 471 | <div class="windowbg description" style="text-align: center;">'; |
460 | - if (isBrowser('is_ie') || isBrowser('is_ie11')) |
|
461 | - echo ' |
|
472 | + if (isBrowser('is_ie') || isBrowser('is_ie11')) { |
|
473 | + echo ' |
|
462 | 474 | <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav"> |
463 | 475 | <param name="AutoStart" value="1"> |
464 | 476 | <param name="FileName" value="', $context['verification_sound_href'], '"> |
465 | 477 | </object>'; |
466 | - else |
|
467 | - echo ' |
|
478 | + } else { |
|
479 | + echo ' |
|
468 | 480 | <audio src="', $context['verification_sound_href'], '" controls> |
469 | 481 | <object type="audio/x-wav" data="', $context['verification_sound_href'], '"> |
470 | 482 | <a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a> |
471 | 483 | </object> |
472 | 484 | </audio>'; |
485 | + } |
|
473 | 486 | echo ' |
474 | 487 | <br> |
475 | 488 | <a href="', $context['verification_sound_href'], ';sound" rel="nofollow">', $txt['visual_verification_sound_again'], '</a><br> |
@@ -496,11 +509,12 @@ discard block |
||
496 | 509 | </div> |
497 | 510 | <div id="register_screen" class="windowbg2 noup">'; |
498 | 511 | |
499 | - if (!empty($context['registration_done'])) |
|
500 | - echo ' |
|
512 | + if (!empty($context['registration_done'])) { |
|
513 | + echo ' |
|
501 | 514 | <div class="infobox"> |
502 | 515 | ', $context['registration_done'], ' |
503 | 516 | </div>'; |
517 | + } |
|
504 | 518 | |
505 | 519 | echo ' |
506 | 520 | <dl class="register_form" id="admin_register_form"> |
@@ -536,9 +550,10 @@ discard block |
||
536 | 550 | <dd> |
537 | 551 | <select name="group" id="group_select" tabindex="', $context['tabindex']++, '">'; |
538 | 552 | |
539 | - foreach ($context['member_groups'] as $id => $name) |
|
540 | - echo ' |
|
553 | + foreach ($context['member_groups'] as $id => $name) { |
|
554 | + echo ' |
|
541 | 555 | <option value="', $id, '">', $name, '</option>'; |
556 | + } |
|
542 | 557 | |
543 | 558 | echo ' |
544 | 559 | </select> |
@@ -546,8 +561,8 @@ discard block |
||
546 | 561 | } |
547 | 562 | |
548 | 563 | // If there is any field marked as required, show it here! |
549 | - if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) |
|
550 | - foreach ($context['custom_fields'] as $field) |
|
564 | + if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) { |
|
565 | + foreach ($context['custom_fields'] as $field) |
|
551 | 566 | if ($field['show_reg'] > 1) |
552 | 567 | echo ' |
553 | 568 | <dt> |
@@ -557,6 +572,7 @@ discard block |
||
557 | 572 | <dd> |
558 | 573 | ', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), ' |
559 | 574 | </dd>'; |
575 | + } |
|
560 | 576 | |
561 | 577 | echo ' |
562 | 578 | <dt> |
@@ -593,12 +609,13 @@ discard block |
||
593 | 609 | { |
594 | 610 | global $context, $scripturl, $txt; |
595 | 611 | |
596 | - if (!empty($context['saved_successful'])) |
|
597 | - echo ' |
|
612 | + if (!empty($context['saved_successful'])) { |
|
613 | + echo ' |
|
598 | 614 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
599 | - elseif (!empty($context['could_not_save'])) |
|
600 | - echo ' |
|
615 | + } elseif (!empty($context['could_not_save'])) { |
|
616 | + echo ' |
|
601 | 617 | <div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>'; |
618 | + } |
|
602 | 619 | |
603 | 620 | // Just a big box to edit the text file ;) |
604 | 621 | echo ' |
@@ -608,9 +625,10 @@ discard block |
||
608 | 625 | </div>'; |
609 | 626 | |
610 | 627 | // Warning for if the file isn't writable. |
611 | - if (!empty($context['warning'])) |
|
612 | - echo ' |
|
628 | + if (!empty($context['warning'])) { |
|
629 | + echo ' |
|
613 | 630 | <p class="error">', $context['warning'], '</p>'; |
631 | + } |
|
614 | 632 | |
615 | 633 | echo ' |
616 | 634 | <div class="windowbg2 noup" id="registration_agreement">'; |
@@ -627,9 +645,10 @@ discard block |
||
627 | 645 | <strong>', $txt['admin_agreement_select_language'], ':</strong> |
628 | 646 | <select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">'; |
629 | 647 | |
630 | - foreach ($context['editable_agreements'] as $file => $name) |
|
631 | - echo ' |
|
648 | + foreach ($context['editable_agreements'] as $file => $name) { |
|
649 | + echo ' |
|
632 | 650 | <option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>'; |
651 | + } |
|
633 | 652 | |
634 | 653 | echo ' |
635 | 654 | </select> |
@@ -669,9 +688,10 @@ discard block |
||
669 | 688 | { |
670 | 689 | global $context, $scripturl, $txt; |
671 | 690 | |
672 | - if (!empty($context['saved_successful'])) |
|
673 | - echo ' |
|
691 | + if (!empty($context['saved_successful'])) { |
|
692 | + echo ' |
|
674 | 693 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
694 | + } |
|
675 | 695 | |
676 | 696 | echo ' |
677 | 697 | <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '"> |
@@ -144,11 +144,12 @@ discard block |
||
144 | 144 | <div class="question">', $txt['poll_question'], ': <strong>', $context['poll']['question'], '</strong>'; |
145 | 145 | |
146 | 146 | $options = 1; |
147 | - foreach ($context['poll']['options'] as $option) |
|
148 | - echo ' |
|
147 | + foreach ($context['poll']['options'] as $option) { |
|
148 | + echo ' |
|
149 | 149 | <div class="', $option['voted_this'] ? 'voted' : '', '">', $txt['option'], ' ', $options++, ': <strong>', $option['option'], '</strong> |
150 | 150 | ', $context['allow_poll_view'] ? $txt['votes'] . ': ' . $option['votes'] . '' : '', ' |
151 | 151 | </div>'; |
152 | + } |
|
152 | 153 | |
153 | 154 | echo ' |
154 | 155 | </div>'; |
@@ -170,9 +171,10 @@ discard block |
||
170 | 171 | echo ' |
171 | 172 | <hr>'; |
172 | 173 | |
173 | - foreach ($context['printattach'][$post['id_msg']] as $attach) |
|
174 | - echo ' |
|
174 | + foreach ($context['printattach'][$post['id_msg']] as $attach) { |
|
175 | + echo ' |
|
175 | 176 | <img width="' . $attach['width'] . '" height="' . $attach['height'] . '" src="', $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attach['id_attach'] . '" alt="">'; |
177 | + } |
|
176 | 178 | } |
177 | 179 | |
178 | 180 | echo ' |
@@ -207,12 +209,13 @@ discard block |
||
207 | 209 | <div class="print_options">'; |
208 | 210 | |
209 | 211 | // Which option is set, text or text&images |
210 | - if (isset($_REQUEST['images'])) |
|
211 | - echo ' |
|
212 | + if (isset($_REQUEST['images'])) { |
|
213 | + echo ' |
|
212 | 214 | <a href="', $url_text, '">', $txt['print_page_text'], '</a> | <strong><a href="', $url_images, '">', $txt['print_page_images'], '</a></strong>'; |
213 | - else |
|
214 | - echo ' |
|
215 | + } else { |
|
216 | + echo ' |
|
215 | 217 | <strong><a href="', $url_text, '">', $txt['print_page_text'], '</a></strong> | <a href="', $url_images, '">', $txt['print_page_images'], '</a>'; |
218 | + } |
|
216 | 219 | |
217 | 220 | echo ' |
218 | 221 | </div><!-- .print_options -->'; |
@@ -25,15 +25,17 @@ 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"> |
35 | 36 | ', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), ' |
36 | 37 | </p>'; |
38 | + } |
|
37 | 39 | |
38 | 40 | echo ' |
39 | 41 | <div id="advanced_search" class="roundframe"> |
@@ -44,9 +46,10 @@ discard block |
||
44 | 46 | <dd> |
45 | 47 | <input type="search" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40">'; |
46 | 48 | |
47 | - if (empty($modSettings['search_simple_fulltext'])) |
|
48 | - echo ' |
|
49 | + if (empty($modSettings['search_simple_fulltext'])) { |
|
50 | + echo ' |
|
49 | 51 | <br><em class="smalltext">', $txt['search_example'], '</em>'; |
52 | + } |
|
50 | 53 | |
51 | 54 | echo ' |
52 | 55 | </dd> |
@@ -120,13 +123,14 @@ discard block |
||
120 | 123 | } |
121 | 124 | |
122 | 125 | // If $context['search_params']['topic'] is set, that means we're searching just one topic. |
123 | - if (!empty($context['search_params']['topic'])) |
|
124 | - echo ' |
|
126 | + if (!empty($context['search_params']['topic'])) { |
|
127 | + echo ' |
|
125 | 128 | <p> |
126 | 129 | ', $txt['search_specific_topic'], ' "', $context['search_topic']['link'], '". |
127 | 130 | </p> |
128 | 131 | <input type="hidden" name="topic" value="', $context['search_topic']['id'], '"> |
129 | 132 | <input type="submit" name="b_search" value="', $txt['search'], '" class="button">'; |
133 | + } |
|
130 | 134 | |
131 | 135 | echo ' |
132 | 136 | </div>'; |
@@ -156,14 +160,15 @@ discard block |
||
156 | 160 | |
157 | 161 | foreach ($category['boards'] as $board) |
158 | 162 | { |
159 | - if ($i == $limit) |
|
160 | - echo ' |
|
163 | + if ($i == $limit) { |
|
164 | + echo ' |
|
161 | 165 | </ul> |
162 | 166 | </li> |
163 | 167 | </ul> |
164 | 168 | <ul class="ignoreboards floatright"> |
165 | 169 | <li class="category"> |
166 | 170 | <ul>'; |
171 | + } |
|
167 | 172 | |
168 | 173 | echo ' |
169 | 174 | <li class="board"> |
@@ -251,17 +256,19 @@ discard block |
||
251 | 256 | <div class="roundframe">'; |
252 | 257 | |
253 | 258 | // Did they make any typos or mistakes, perhaps? |
254 | - if (isset($context['did_you_mean'])) |
|
255 | - echo ' |
|
259 | + if (isset($context['did_you_mean'])) { |
|
260 | + echo ' |
|
256 | 261 | <p> |
257 | 262 | ', $txt['search_did_you_mean'], ' <a href="', $scripturl, '?action=search2;params=', $context['did_you_mean_params'], '">', $context['did_you_mean'], '</a>. |
258 | 263 | </p>'; |
264 | + } |
|
259 | 265 | |
260 | - if (!empty($context['search_ignored'])) |
|
261 | - echo ' |
|
266 | + if (!empty($context['search_ignored'])) { |
|
267 | + echo ' |
|
262 | 268 | <p> |
263 | 269 | ', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), ' |
264 | 270 | </p>'; |
271 | + } |
|
265 | 272 | |
266 | 273 | echo ' |
267 | 274 | <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
@@ -284,10 +291,11 @@ discard block |
||
284 | 291 | <input type="hidden" name="sort" value="', !empty($context['search_params']['sort']) ? $context['search_params']['sort'] : 'relevance', '"> |
285 | 292 | </div>'; |
286 | 293 | |
287 | - if (!empty($context['search_params']['brd'])) |
|
288 | - foreach ($context['search_params']['brd'] as $board_id) |
|
294 | + if (!empty($context['search_params']['brd'])) { |
|
295 | + foreach ($context['search_params']['brd'] as $board_id) |
|
289 | 296 | echo ' |
290 | 297 | <input type="hidden" name="brd[', $board_id, ']" value="', $board_id, '">'; |
298 | + } |
|
291 | 299 | |
292 | 300 | echo ' |
293 | 301 | </form> |
@@ -299,18 +307,20 @@ discard block |
||
299 | 307 | if ($context['compact']) |
300 | 308 | { |
301 | 309 | // Quick moderation set to checkboxes? Oh, how fun :/ |
302 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
303 | - echo ' |
|
310 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
311 | + echo ' |
|
304 | 312 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="topicForm">'; |
313 | + } |
|
305 | 314 | |
306 | 315 | echo ' |
307 | 316 | <div class="cat_bar"> |
308 | 317 | <h3 class="catbg"> |
309 | 318 | <span class="floatright">'; |
310 | 319 | |
311 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
312 | - echo ' |
|
320 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
321 | + echo ' |
|
313 | 322 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">'; |
323 | + } |
|
314 | 324 | echo ' |
315 | 325 | </span> |
316 | 326 | <span class="generic_icons filter"></span> ', $txt['mlist_search_results'], ': ', $context['search_params']['search'], ' |
@@ -318,15 +328,15 @@ discard block |
||
318 | 328 | </div>'; |
319 | 329 | |
320 | 330 | // Was anything even found? |
321 | - if (!empty($context['topics'])) |
|
322 | - echo ' |
|
331 | + if (!empty($context['topics'])) { |
|
332 | + echo ' |
|
323 | 333 | <div class="pagesection"> |
324 | 334 | <span>', $context['page_index'], '</span> |
325 | 335 | </div>'; |
326 | - |
|
327 | - else |
|
328 | - echo ' |
|
336 | + } else { |
|
337 | + echo ' |
|
329 | 338 | <div class="roundframe">', $txt['find_no_results'], '</div>'; |
339 | + } |
|
330 | 340 | |
331 | 341 | // While we have results to show ... |
332 | 342 | while ($topic = $context['get_topics']()) |
@@ -354,38 +364,43 @@ discard block |
||
354 | 364 | { |
355 | 365 | echo ' |
356 | 366 | <input type="checkbox" name="topics[]" value="', $topic['id'], '">'; |
357 | - } |
|
358 | - else |
|
367 | + } else |
|
359 | 368 | { |
360 | - if ($topic['quick_mod']['remove']) |
|
361 | - echo ' |
|
369 | + if ($topic['quick_mod']['remove']) { |
|
370 | + echo ' |
|
362 | 371 | <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>'; |
372 | + } |
|
363 | 373 | |
364 | - if ($topic['quick_mod']['lock']) |
|
365 | - echo ' |
|
374 | + if ($topic['quick_mod']['lock']) { |
|
375 | + echo ' |
|
366 | 376 | <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>'; |
377 | + } |
|
367 | 378 | |
368 | - if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) |
|
369 | - echo ' |
|
379 | + if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) { |
|
380 | + echo ' |
|
370 | 381 | <br>'; |
382 | + } |
|
371 | 383 | |
372 | - if ($topic['quick_mod']['sticky']) |
|
373 | - echo ' |
|
384 | + if ($topic['quick_mod']['sticky']) { |
|
385 | + echo ' |
|
374 | 386 | <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>'; |
387 | + } |
|
375 | 388 | |
376 | - if ($topic['quick_mod']['move']) |
|
377 | - echo ' |
|
389 | + if ($topic['quick_mod']['move']) { |
|
390 | + echo ' |
|
378 | 391 | <a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
392 | + } |
|
379 | 393 | } |
380 | 394 | |
381 | 395 | echo ' |
382 | 396 | </div><!-- .floatright -->'; |
383 | 397 | } |
384 | 398 | |
385 | - if ($message['body_highlighted'] != '') |
|
386 | - echo ' |
|
399 | + if ($message['body_highlighted'] != '') { |
|
400 | + echo ' |
|
387 | 401 | <br class="clear"> |
388 | 402 | <div class="list_posts double_height">', $message['body_highlighted'], '</div>'; |
403 | + } |
|
389 | 404 | } |
390 | 405 | |
391 | 406 | echo ' |
@@ -393,11 +408,12 @@ discard block |
||
393 | 408 | </div><!-- $topic[css_class] -->'; |
394 | 409 | |
395 | 410 | } |
396 | - if (!empty($context['topics'])) |
|
397 | - echo ' |
|
411 | + if (!empty($context['topics'])) { |
|
412 | + echo ' |
|
398 | 413 | <div class="pagesection"> |
399 | 414 | <span>', $context['page_index'], '</span> |
400 | 415 | </div>'; |
416 | + } |
|
401 | 417 | |
402 | 418 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
403 | 419 | { |
@@ -407,17 +423,19 @@ discard block |
||
407 | 423 | <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> |
408 | 424 | <option value="">--------</option>'; |
409 | 425 | |
410 | - foreach ($context['qmod_actions'] as $qmod_action) |
|
411 | - if ($context['can_' . $qmod_action]) |
|
426 | + foreach ($context['qmod_actions'] as $qmod_action) { |
|
427 | + if ($context['can_' . $qmod_action]) |
|
412 | 428 | echo ' |
413 | 429 | <option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>'; |
430 | + } |
|
414 | 431 | |
415 | 432 | echo ' |
416 | 433 | </select>'; |
417 | 434 | |
418 | - if ($context['can_move']) |
|
419 | - echo ' |
|
435 | + if ($context['can_move']) { |
|
436 | + echo ' |
|
420 | 437 | <span id="quick_mod_jump_to"> </span>'; |
438 | + } |
|
421 | 439 | |
422 | 440 | echo ' |
423 | 441 | <input type="hidden" name="redirect_url" value="', $scripturl . '?action=search2;params=' . $context['params'], '"> |
@@ -427,13 +445,13 @@ discard block |
||
427 | 445 | } |
428 | 446 | |
429 | 447 | |
430 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
|
431 | - echo ' |
|
448 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) { |
|
449 | + echo ' |
|
432 | 450 | <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '"> |
433 | 451 | </form>'; |
452 | + } |
|
434 | 453 | |
435 | - } |
|
436 | - else |
|
454 | + } else |
|
437 | 455 | { |
438 | 456 | echo ' |
439 | 457 | <div class="cat_bar"> |
@@ -445,9 +463,10 @@ discard block |
||
445 | 463 | <span>', $context['page_index'], '</span> |
446 | 464 | </div>'; |
447 | 465 | |
448 | - if (empty($context['topics'])) |
|
449 | - echo ' |
|
466 | + if (empty($context['topics'])) { |
|
467 | + echo ' |
|
450 | 468 | <div class="information">(', $txt['search_no_results'], ')</div>'; |
469 | + } |
|
451 | 470 | |
452 | 471 | while ($topic = $context['get_topics']()) |
453 | 472 | { |
@@ -464,23 +483,27 @@ discard block |
||
464 | 483 | </div> |
465 | 484 | <div class="list_posts">', $message['body_highlighted'], '</div>'; |
466 | 485 | |
467 | - if ($topic['can_reply']) |
|
468 | - echo ' |
|
486 | + if ($topic['can_reply']) { |
|
487 | + echo ' |
|
469 | 488 | <ul class="quickbuttons">'; |
489 | + } |
|
470 | 490 | |
471 | 491 | // If they *can* reply? |
472 | - if ($topic['can_reply']) |
|
473 | - echo ' |
|
492 | + if ($topic['can_reply']) { |
|
493 | + echo ' |
|
474 | 494 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
495 | + } |
|
475 | 496 | |
476 | 497 | // If they *can* quote? |
477 | - if ($topic['can_quote']) |
|
478 | - echo ' |
|
498 | + if ($topic['can_quote']) { |
|
499 | + echo ' |
|
479 | 500 | <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>'; |
501 | + } |
|
480 | 502 | |
481 | - if ($topic['can_reply']) |
|
482 | - echo ' |
|
503 | + if ($topic['can_reply']) { |
|
504 | + echo ' |
|
483 | 505 | </ul>'; |
506 | + } |
|
484 | 507 | echo ' |
485 | 508 | <br class="clear"> |
486 | 509 | </div><!-- $topic[css_class] -->'; |
@@ -499,8 +522,8 @@ discard block |
||
499 | 522 | <div class="smalltext righttext" id="search_jump_to"> </div> |
500 | 523 | <script>'; |
501 | 524 | |
502 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) |
|
503 | - echo ' |
|
525 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { |
|
526 | + echo ' |
|
504 | 527 | if (typeof(window.XMLHttpRequest) != "undefined") |
505 | 528 | aJumpTo[aJumpTo.length] = new JumpTo({ |
506 | 529 | sContainerId: "quick_mod_jump_to", |
@@ -515,6 +538,7 @@ discard block |
||
515 | 538 | bDisabled: true, |
516 | 539 | sCustomName: "move_to" |
517 | 540 | });'; |
541 | + } |
|
518 | 542 | |
519 | 543 | echo ' |
520 | 544 | if (typeof(window.XMLHttpRequest) != "undefined") |
@@ -54,9 +54,10 @@ discard block |
||
54 | 54 | <dd> |
55 | 55 | <div id="known_themes_list">'; |
56 | 56 | |
57 | - foreach ($context['themes'] as $theme) |
|
58 | - echo ' |
|
57 | + foreach ($context['themes'] as $theme) { |
|
58 | + echo ' |
|
59 | 59 | <label for="options-known_themes_', $theme['id'], '"><input type="checkbox" name="options[known_themes][]" id="options-known_themes_', $theme['id'], '" value="', $theme['id'], '"', $theme['known'] ? ' checked' : '', '> ', $theme['name'], '</label><br>'; |
60 | + } |
|
60 | 61 | |
61 | 62 | echo ' |
62 | 63 | </div> |
@@ -73,9 +74,10 @@ discard block |
||
73 | 74 | <select name="options[theme_guests]" id="theme_guests">'; |
74 | 75 | |
75 | 76 | // Put an option for each theme in the select box. |
76 | - foreach ($context['themes'] as $theme) |
|
77 | - echo ' |
|
77 | + foreach ($context['themes'] as $theme) { |
|
78 | + echo ' |
|
78 | 79 | <option value="', $theme['id'], '"', $modSettings['theme_guests'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>'; |
80 | + } |
|
79 | 81 | |
80 | 82 | echo ' |
81 | 83 | </select> |
@@ -90,9 +92,10 @@ discard block |
||
90 | 92 | <option value="0">', $txt['theme_forum_default'], '</option>'; |
91 | 93 | |
92 | 94 | // Same thing, this time for changing the theme of everyone. |
93 | - foreach ($context['themes'] as $theme) |
|
94 | - echo ' |
|
95 | + foreach ($context['themes'] as $theme) { |
|
96 | + echo ' |
|
95 | 97 | <option value="', $theme['id'], '">', $theme['name'], '</option>'; |
98 | + } |
|
96 | 99 | |
97 | 100 | echo ' |
98 | 101 | </select> |
@@ -189,11 +192,12 @@ discard block |
||
189 | 192 | global $context, $scripturl, $txt; |
190 | 193 | |
191 | 194 | // Show a nice confirmation message. |
192 | - if (isset($_GET['done'])) |
|
193 | - echo ' |
|
195 | + if (isset($_GET['done'])) { |
|
196 | + echo ' |
|
194 | 197 | <div class="infobox"> |
195 | 198 | ', $txt['theme_confirmed_' . $_GET['done']], ' |
196 | 199 | </div>'; |
200 | + } |
|
197 | 201 | |
198 | 202 | echo ' |
199 | 203 | <div id="admincenter">'; |
@@ -358,11 +362,12 @@ discard block |
||
358 | 362 | if (empty($setting) || !is_array($setting)) |
359 | 363 | { |
360 | 364 | // Insert a separator (unless this is the first item in the list) |
361 | - if ($i !== $first_option_key) |
|
362 | - echo ' |
|
365 | + if ($i !== $first_option_key) { |
|
366 | + echo ' |
|
363 | 367 | </dl> |
364 | 368 | <hr> |
365 | 369 | <dl class="settings">'; |
370 | + } |
|
366 | 371 | |
367 | 372 | // Should we give a name to this section? |
368 | 373 | if (is_string($setting) && !empty($setting)) |
@@ -371,9 +376,9 @@ discard block |
||
371 | 376 | echo ' |
372 | 377 | <dt><strong>' . $setting . '</strong></dt> |
373 | 378 | <dd></dd>'; |
379 | + } else { |
|
380 | + $titled_section = false; |
|
374 | 381 | } |
375 | - else |
|
376 | - $titled_section = false; |
|
377 | 382 | |
378 | 383 | continue; |
379 | 384 | } |
@@ -382,8 +387,8 @@ discard block |
||
382 | 387 | <dt>'; |
383 | 388 | |
384 | 389 | // Show the change option box? |
385 | - if ($context['theme_options_reset']) |
|
386 | - echo ' |
|
390 | + if ($context['theme_options_reset']) { |
|
391 | + echo ' |
|
387 | 392 | <span class="floatleft"> |
388 | 393 | <select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;"> |
389 | 394 | <option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option> |
@@ -391,14 +396,16 @@ discard block |
||
391 | 396 | <option value="2">', $txt['themeadmin_reset_options_default'], '</option> |
392 | 397 | </select> |
393 | 398 | </span>'; |
399 | + } |
|
394 | 400 | |
395 | 401 | echo ' |
396 | 402 | <label for="options_', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
397 | 403 | |
398 | - if (isset($setting['description'])) |
|
399 | - echo ' |
|
404 | + if (isset($setting['description'])) { |
|
405 | + echo ' |
|
400 | 406 | <br> |
401 | 407 | <span class="smalltext">', $setting['description'], '</span>'; |
408 | + } |
|
402 | 409 | echo ' |
403 | 410 | </dt>'; |
404 | 411 | |
@@ -440,13 +447,11 @@ discard block |
||
440 | 447 | |
441 | 448 | echo ' |
442 | 449 | <input type="number"', $min . $max . $step; |
443 | - } |
|
444 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
450 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
445 | 451 | { |
446 | 452 | echo' |
447 | 453 | <input type="url"'; |
448 | - } |
|
449 | - else |
|
454 | + } else |
|
450 | 455 | { |
451 | 456 | echo ' |
452 | 457 | <input type="text"'; |
@@ -490,8 +495,8 @@ discard block |
||
490 | 495 | <br>'; |
491 | 496 | |
492 | 497 | // @todo Why can't I edit the default theme popup. |
493 | - if ($context['theme_settings']['theme_id'] != 1) |
|
494 | - echo ' |
|
498 | + if ($context['theme_settings']['theme_id'] != 1) { |
|
499 | + echo ' |
|
495 | 500 | <div class="cat_bar"> |
496 | 501 | <h3 class="catbg config_hd"> |
497 | 502 | ', $txt['theme_edit'], ' |
@@ -507,6 +512,7 @@ discard block |
||
507 | 512 | </li> |
508 | 513 | </ul> |
509 | 514 | </div>'; |
515 | + } |
|
510 | 516 | |
511 | 517 | echo ' |
512 | 518 | <div class="cat_bar"> |
@@ -560,9 +566,10 @@ discard block |
||
560 | 566 | <dd> |
561 | 567 | <select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">'; |
562 | 568 | |
563 | - foreach ($context['theme_variants'] as $key => $variant) |
|
564 | - echo ' |
|
569 | + foreach ($context['theme_variants'] as $key => $variant) { |
|
570 | + echo ' |
|
565 | 571 | <option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>'; |
572 | + } |
|
566 | 573 | |
567 | 574 | echo ' |
568 | 575 | </select> |
@@ -598,11 +605,12 @@ discard block |
||
598 | 605 | if (empty($setting) || !is_array($setting)) |
599 | 606 | { |
600 | 607 | // We don't need a separator before the first list element |
601 | - if ($i !== $first_setting_key) |
|
602 | - echo ' |
|
608 | + if ($i !== $first_setting_key) { |
|
609 | + echo ' |
|
603 | 610 | </dl> |
604 | 611 | <hr> |
605 | 612 | <dl class="settings">'; |
613 | + } |
|
606 | 614 | |
607 | 615 | // Add a fake heading? |
608 | 616 | if (is_string($setting) && !empty($setting)) |
@@ -611,9 +619,9 @@ discard block |
||
611 | 619 | echo ' |
612 | 620 | <dt><strong>' . $setting . '</strong></dt> |
613 | 621 | <dd></dd>'; |
622 | + } else { |
|
623 | + $titled_section = false; |
|
614 | 624 | } |
615 | - else |
|
616 | - $titled_section = false; |
|
617 | 625 | |
618 | 626 | continue; |
619 | 627 | } |
@@ -622,9 +630,10 @@ discard block |
||
622 | 630 | <dt> |
623 | 631 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>:'; |
624 | 632 | |
625 | - if (isset($setting['description'])) |
|
626 | - echo '<br> |
|
633 | + if (isset($setting['description'])) { |
|
634 | + echo '<br> |
|
627 | 635 | <span class="smalltext">', $setting['description'], '</span>'; |
636 | + } |
|
628 | 637 | |
629 | 638 | echo ' |
630 | 639 | </dt>'; |
@@ -645,9 +654,10 @@ discard block |
||
645 | 654 | <dd> |
646 | 655 | <select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">'; |
647 | 656 | |
648 | - foreach ($setting['options'] as $value => $label) |
|
649 | - echo ' |
|
657 | + foreach ($setting['options'] as $value => $label) { |
|
658 | + echo ' |
|
650 | 659 | <option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>'; |
660 | + } |
|
651 | 661 | |
652 | 662 | echo ' |
653 | 663 | </select> |
@@ -676,13 +686,11 @@ discard block |
||
676 | 686 | |
677 | 687 | echo ' |
678 | 688 | <input type="number"', $min . $max . $step; |
679 | - } |
|
680 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
689 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
681 | 690 | { |
682 | 691 | echo' |
683 | 692 | <input type="url"'; |
684 | - } |
|
685 | - else |
|
693 | + } else |
|
686 | 694 | { |
687 | 695 | echo ' |
688 | 696 | <input type="text"'; |
@@ -839,21 +847,23 @@ discard block |
||
839 | 847 | <div class="windowbg">'; |
840 | 848 | |
841 | 849 | // Oops! there was an error :( |
842 | - if (!empty($context['error_message'])) |
|
843 | - echo ' |
|
850 | + if (!empty($context['error_message'])) { |
|
851 | + echo ' |
|
844 | 852 | <p> |
845 | 853 | ', $context['error_message'], ' |
846 | 854 | </p>'; |
855 | + } |
|
847 | 856 | |
848 | 857 | // Not much to show except a link back... |
849 | - else |
|
850 | - echo ' |
|
858 | + else { |
|
859 | + echo ' |
|
851 | 860 | <p> |
852 | 861 | <a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_' . (isset($context['installed_theme']['updated']) ? 'updated' : 'installed') . '_message'], ' |
853 | 862 | </p> |
854 | 863 | <p> |
855 | 864 | <a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a> |
856 | 865 | </p>'; |
866 | + } |
|
857 | 867 | |
858 | 868 | echo ' |
859 | 869 | </div><!-- .windowbg --> |
@@ -920,11 +930,12 @@ discard block |
||
920 | 930 | <span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span> |
921 | 931 | <span class="floatright">'; |
922 | 932 | |
923 | - if ($template['can_copy']) |
|
924 | - echo ' |
|
933 | + if ($template['can_copy']) { |
|
934 | + echo ' |
|
925 | 935 | <a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>'; |
926 | - else |
|
927 | - echo $txt['themeadmin_edit_no_copy']; |
|
936 | + } else { |
|
937 | + echo $txt['themeadmin_edit_no_copy']; |
|
938 | + } |
|
928 | 939 | |
929 | 940 | echo ' |
930 | 941 | </span> |
@@ -947,11 +958,12 @@ discard block |
||
947 | 958 | echo ' |
948 | 959 | <div id="admincenter">'; |
949 | 960 | |
950 | - if (!empty($context['browse_title'])) |
|
951 | - echo ' |
|
961 | + if (!empty($context['browse_title'])) { |
|
962 | + echo ' |
|
952 | 963 | <div class="cat_bar"> |
953 | 964 | <h3 class="catbg">', $context['browse_title'], '</h3> |
954 | 965 | </div>'; |
966 | + } |
|
955 | 967 | |
956 | 968 | echo ' |
957 | 969 | <table class="table_grid tborder"> |
@@ -971,16 +983,15 @@ discard block |
||
971 | 983 | <tr class="windowbg"> |
972 | 984 | <td>'; |
973 | 985 | |
974 | - if ($file['is_editable']) |
|
975 | - echo ' |
|
986 | + if ($file['is_editable']) { |
|
987 | + echo ' |
|
976 | 988 | <a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
977 | - |
|
978 | - elseif ($file['is_directory']) |
|
979 | - echo ' |
|
989 | + } elseif ($file['is_directory']) { |
|
990 | + echo ' |
|
980 | 991 | <a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
981 | - |
|
982 | - else |
|
983 | - echo $file['filename']; |
|
992 | + } else { |
|
993 | + echo $file['filename']; |
|
994 | + } |
|
984 | 995 | |
985 | 996 | echo ' |
986 | 997 | </td> |
@@ -1002,11 +1013,12 @@ discard block |
||
1002 | 1013 | { |
1003 | 1014 | global $context, $settings, $scripturl, $txt; |
1004 | 1015 | |
1005 | - if ($context['session_error']) |
|
1006 | - echo ' |
|
1016 | + if ($context['session_error']) { |
|
1017 | + echo ' |
|
1007 | 1018 | <div class="errorbox"> |
1008 | 1019 | ', $txt['error_session_timeout'], ' |
1009 | 1020 | </div>'; |
1021 | + } |
|
1010 | 1022 | |
1011 | 1023 | // From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com. |
1012 | 1024 | echo ' |
@@ -1069,17 +1081,18 @@ discard block |
||
1069 | 1081 | try |
1070 | 1082 | { |
1071 | 1083 | '; |
1072 | - if (isBrowser('is_ie')) |
|
1073 | - echo ' |
|
1084 | + if (isBrowser('is_ie')) { |
|
1085 | + echo ' |
|
1074 | 1086 | var sheets = frames["css_preview_box"].document.styleSheets; |
1075 | 1087 | for (var j = 0; j < sheets.length; j++) |
1076 | 1088 | { |
1077 | 1089 | if (sheets[j].id == "css_preview_box") |
1078 | 1090 | sheets[j].cssText = document.forms.stylesheetForm.entire_file.value; |
1079 | 1091 | }'; |
1080 | - else |
|
1081 | - echo ' |
|
1092 | + } else { |
|
1093 | + echo ' |
|
1082 | 1094 | setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);'; |
1095 | + } |
|
1083 | 1096 | echo ' |
1084 | 1097 | } |
1085 | 1098 | catch (e) |
@@ -1131,9 +1144,10 @@ discard block |
||
1131 | 1144 | </div> |
1132 | 1145 | <div class="windowbg">'; |
1133 | 1146 | |
1134 | - if (!$context['allow_save']) |
|
1135 | - echo ' |
|
1147 | + if (!$context['allow_save']) { |
|
1148 | + echo ' |
|
1136 | 1149 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
1150 | + } |
|
1137 | 1151 | |
1138 | 1152 | echo ' |
1139 | 1153 | <textarea class="edit_file" name="entire_file" cols="80" rows="20" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea> |
@@ -1147,9 +1161,10 @@ discard block |
||
1147 | 1161 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
1148 | 1162 | |
1149 | 1163 | // Hopefully it exists. |
1150 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
1151 | - echo ' |
|
1164 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
1165 | + echo ' |
|
1152 | 1166 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
1167 | + } |
|
1153 | 1168 | |
1154 | 1169 | echo ' |
1155 | 1170 | </form> |
@@ -1163,18 +1178,20 @@ discard block |
||
1163 | 1178 | { |
1164 | 1179 | global $context, $scripturl, $txt; |
1165 | 1180 | |
1166 | - if ($context['session_error']) |
|
1167 | - echo ' |
|
1181 | + if ($context['session_error']) { |
|
1182 | + echo ' |
|
1168 | 1183 | <div class="errorbox"> |
1169 | 1184 | ', $txt['error_session_timeout'], ' |
1170 | 1185 | </div>'; |
1186 | + } |
|
1171 | 1187 | |
1172 | - if (isset($context['parse_error'])) |
|
1173 | - echo ' |
|
1188 | + if (isset($context['parse_error'])) { |
|
1189 | + echo ' |
|
1174 | 1190 | <div class="errorbox"> |
1175 | 1191 | ', $txt['themeadmin_edit_error'], ' |
1176 | 1192 | <div><pre>', $context['parse_error'], '</pre></div> |
1177 | 1193 | </div>'; |
1194 | + } |
|
1178 | 1195 | |
1179 | 1196 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
1180 | 1197 | echo ' |
@@ -1185,16 +1202,18 @@ discard block |
||
1185 | 1202 | </div> |
1186 | 1203 | <div class="windowbg">'; |
1187 | 1204 | |
1188 | - if (!$context['allow_save']) |
|
1189 | - echo ' |
|
1205 | + if (!$context['allow_save']) { |
|
1206 | + echo ' |
|
1190 | 1207 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
1208 | + } |
|
1191 | 1209 | |
1192 | - foreach ($context['file_parts'] as $part) |
|
1193 | - echo ' |
|
1210 | + foreach ($context['file_parts'] as $part) { |
|
1211 | + echo ' |
|
1194 | 1212 | <label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br> |
1195 | 1213 | <div class="centertext"> |
1196 | 1214 | <textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea> |
1197 | 1215 | </div>'; |
1216 | + } |
|
1198 | 1217 | |
1199 | 1218 | echo ' |
1200 | 1219 | <div class="padding righttext"> |
@@ -1203,9 +1222,10 @@ discard block |
||
1203 | 1222 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
1204 | 1223 | |
1205 | 1224 | // Hopefully it exists. |
1206 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
1207 | - echo ' |
|
1225 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
1226 | + echo ' |
|
1208 | 1227 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
1228 | + } |
|
1209 | 1229 | |
1210 | 1230 | echo ' |
1211 | 1231 | </div><!-- .righttext --> |
@@ -1221,18 +1241,20 @@ discard block |
||
1221 | 1241 | { |
1222 | 1242 | global $context, $scripturl, $txt; |
1223 | 1243 | |
1224 | - if ($context['session_error']) |
|
1225 | - echo ' |
|
1244 | + if ($context['session_error']) { |
|
1245 | + echo ' |
|
1226 | 1246 | <div class="errorbox"> |
1227 | 1247 | ', $txt['error_session_timeout'], ' |
1228 | 1248 | </div>'; |
1249 | + } |
|
1229 | 1250 | |
1230 | 1251 | // Is this file writeable? |
1231 | - if (!$context['allow_save']) |
|
1232 | - echo ' |
|
1252 | + if (!$context['allow_save']) { |
|
1253 | + echo ' |
|
1233 | 1254 | <div class="errorbox"> |
1234 | 1255 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], ' |
1235 | 1256 | </div>'; |
1257 | + } |
|
1236 | 1258 | |
1237 | 1259 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
1238 | 1260 | echo ' |
@@ -1248,9 +1270,10 @@ discard block |
||
1248 | 1270 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
1249 | 1271 | |
1250 | 1272 | // Hopefully it exists. |
1251 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
1252 | - echo ' |
|
1273 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
1274 | + echo ' |
|
1253 | 1275 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
1276 | + } |
|
1254 | 1277 | |
1255 | 1278 | echo ' |
1256 | 1279 | </div><!-- .windowbg --> |
@@ -48,17 +48,19 @@ discard block |
||
48 | 48 | </a>'; |
49 | 49 | |
50 | 50 | // Has it outstanding posts for approval? |
51 | - if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) |
|
52 | - echo ' |
|
51 | + if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) { |
|
52 | + echo ' |
|
53 | 53 | <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>'; |
54 | + } |
|
54 | 55 | |
55 | 56 | echo ' |
56 | 57 | <p class="board_description">', $board['description'], '</p>'; |
57 | 58 | |
58 | 59 | // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
59 | - if (!empty($board['moderators']) || !empty($board['moderator_groups'])) |
|
60 | - echo ' |
|
60 | + if (!empty($board['moderators']) || !empty($board['moderator_groups'])) { |
|
61 | + echo ' |
|
61 | 62 | <p class="moderators">', count($board['link_moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>'; |
63 | + } |
|
62 | 64 | |
63 | 65 | // Show some basic information about the number of posts, etc. |
64 | 66 | echo ' |
@@ -70,9 +72,10 @@ discard block |
||
70 | 72 | </div> |
71 | 73 | <div class="lastpost lpr_border">'; |
72 | 74 | |
73 | - if (!empty($board['last_post']['id'])) |
|
74 | - echo ' |
|
75 | + if (!empty($board['last_post']['id'])) { |
|
76 | + echo ' |
|
75 | 77 | <p>', $board['last_post']['last_post_message'], '</p>'; |
78 | + } |
|
76 | 79 | |
77 | 80 | echo ' |
78 | 81 | </div>'; |
@@ -87,14 +90,16 @@ discard block |
||
87 | 90 | |
88 | 91 | foreach ($board['children'] as $child) |
89 | 92 | { |
90 | - if (!$child['is_redirect']) |
|
91 | - $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>'; |
|
92 | - else |
|
93 | - $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>'; |
|
93 | + if (!$child['is_redirect']) { |
|
94 | + $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>'; |
|
95 | + } else { |
|
96 | + $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>'; |
|
97 | + } |
|
94 | 98 | |
95 | 99 | // Has it posts awaiting approval? |
96 | - if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics'])) |
|
97 | - $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>'; |
|
100 | + if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics'])) { |
|
101 | + $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>'; |
|
102 | + } |
|
98 | 103 | |
99 | 104 | $children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>'; |
100 | 105 | } |
@@ -114,8 +119,9 @@ discard block |
||
114 | 119 | } |
115 | 120 | |
116 | 121 | // They can only mark read if they are logged in and it's enabled! |
117 | - if (!$context['user']['is_logged']) |
|
118 | - unset($context['normal_buttons']['markread']); |
|
122 | + if (!$context['user']['is_logged']) { |
|
123 | + unset($context['normal_buttons']['markread']); |
|
124 | + } |
|
119 | 125 | |
120 | 126 | if (!$context['no_topic_listing']) |
121 | 127 | { |
@@ -142,13 +148,15 @@ discard block |
||
142 | 148 | <h3>', $context['name'], '</h3> |
143 | 149 | <p>'; |
144 | 150 | |
145 | - if ($context['description'] != '') |
|
146 | - echo ' |
|
151 | + if ($context['description'] != '') { |
|
152 | + echo ' |
|
147 | 153 | ', $context['description'], ' '; |
154 | + } |
|
148 | 155 | |
149 | - if (!empty($context['moderators'])) |
|
150 | - echo ' |
|
156 | + if (!empty($context['moderators'])) { |
|
157 | + echo ' |
|
151 | 158 | ', count($context['moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $context['link_moderators']), '.'; |
159 | + } |
|
152 | 160 | |
153 | 161 | echo ' |
154 | 162 | </p> |
@@ -156,9 +164,10 @@ discard block |
||
156 | 164 | } |
157 | 165 | |
158 | 166 | // If Quick Moderation is enabled start the form. |
159 | - if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) |
|
160 | - echo ' |
|
167 | + if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) { |
|
168 | + echo ' |
|
161 | 169 | <form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" class="clear" name="quickModForm" id="quickModForm">'; |
170 | + } |
|
162 | 171 | |
163 | 172 | echo ' |
164 | 173 | <div id="messageindex">'; |
@@ -168,11 +177,11 @@ discard block |
||
168 | 177 | echo ' |
169 | 178 | <div class="information">'; |
170 | 179 | |
171 | - if ($settings['display_who_viewing'] == 1) |
|
172 | - echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members']; |
|
173 | - |
|
174 | - else |
|
175 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
180 | + if ($settings['display_who_viewing'] == 1) { |
|
181 | + echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members']; |
|
182 | + } else { |
|
183 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
184 | + } |
|
176 | 185 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board']; |
177 | 186 | |
178 | 187 | echo ' |
@@ -192,22 +201,25 @@ discard block |
||
192 | 201 | <div class="lastpost">', $context['topics_headers']['last_post'], '</div>'; |
193 | 202 | |
194 | 203 | // Show a "select all" box for quick moderation? |
195 | - if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1) |
|
196 | - echo ' |
|
204 | + if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
205 | + echo ' |
|
197 | 206 | <div class="moderation"> |
198 | 207 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
199 | 208 | </div>'; |
209 | + } |
|
200 | 210 | |
201 | 211 | // If it's on in "image" mode, don't show anything but the column. |
202 | - elseif (!empty($context['can_quick_mod'])) |
|
203 | - echo ' |
|
212 | + elseif (!empty($context['can_quick_mod'])) { |
|
213 | + echo ' |
|
204 | 214 | <div class="moderation"> </div>'; |
215 | + } |
|
205 | 216 | } |
206 | 217 | |
207 | 218 | // No topics.... just say, "sorry bub". |
208 | - else |
|
209 | - echo ' |
|
219 | + else { |
|
220 | + echo ' |
|
210 | 221 | <h3 class="titlebg">', $txt['topic_alert_none'], '</h3>'; |
222 | + } |
|
211 | 223 | |
212 | 224 | echo ' |
213 | 225 | </div><!-- #topic_header -->'; |
@@ -240,21 +252,26 @@ discard block |
||
240 | 252 | echo ' |
241 | 253 | <div class="icons floatright">'; |
242 | 254 | |
243 | - if ($topic['is_watched']) |
|
244 | - echo ' |
|
255 | + if ($topic['is_watched']) { |
|
256 | + echo ' |
|
245 | 257 | <span class="generic_icons watch" title="', $txt['watching_this_topic'], '"></span>'; |
246 | - if ($topic['is_locked']) |
|
247 | - echo ' |
|
258 | + } |
|
259 | + if ($topic['is_locked']) { |
|
260 | + echo ' |
|
248 | 261 | <span class="generic_icons lock"></span>'; |
249 | - if ($topic['is_sticky']) |
|
250 | - echo ' |
|
262 | + } |
|
263 | + if ($topic['is_sticky']) { |
|
264 | + echo ' |
|
251 | 265 | <span class="generic_icons sticky"></span>'; |
252 | - if ($topic['is_redirect']) |
|
253 | - echo ' |
|
266 | + } |
|
267 | + if ($topic['is_redirect']) { |
|
268 | + echo ' |
|
254 | 269 | <span class="generic_icons move"></span>'; |
255 | - if ($topic['is_poll']) |
|
256 | - echo ' |
|
270 | + } |
|
271 | + if ($topic['is_poll']) { |
|
272 | + echo ' |
|
257 | 273 | <span class="generic_icons poll"></span>'; |
274 | + } |
|
258 | 275 | |
259 | 276 | echo ' |
260 | 277 | </div>'; |
@@ -284,26 +301,31 @@ discard block |
||
284 | 301 | echo ' |
285 | 302 | <div class="moderation">'; |
286 | 303 | |
287 | - if ($options['display_quick_mod'] == 1) |
|
288 | - echo ' |
|
304 | + if ($options['display_quick_mod'] == 1) { |
|
305 | + echo ' |
|
289 | 306 | <input type="checkbox" name="topics[]" value="', $topic['id'], '">'; |
290 | - else |
|
307 | + } else |
|
291 | 308 | { |
292 | 309 | // Check permissions on each and show only the ones they are allowed to use. |
293 | - if ($topic['quick_mod']['remove']) |
|
294 | - echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';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>'; |
|
310 | + if ($topic['quick_mod']['remove']) { |
|
311 | + echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';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>'; |
|
312 | + } |
|
295 | 313 | |
296 | - if ($topic['quick_mod']['lock']) |
|
297 | - echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';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>'; |
|
314 | + if ($topic['quick_mod']['lock']) { |
|
315 | + echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';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>'; |
|
316 | + } |
|
298 | 317 | |
299 | - if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) |
|
300 | - echo '<br>'; |
|
318 | + if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) { |
|
319 | + echo '<br>'; |
|
320 | + } |
|
301 | 321 | |
302 | - if ($topic['quick_mod']['sticky']) |
|
303 | - echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';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>'; |
|
322 | + if ($topic['quick_mod']['sticky']) { |
|
323 | + echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';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>'; |
|
324 | + } |
|
304 | 325 | |
305 | - if ($topic['quick_mod']['move']) |
|
306 | - echo '<a href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
|
326 | + if ($topic['quick_mod']['move']) { |
|
327 | + echo '<a href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
|
328 | + } |
|
307 | 329 | } |
308 | 330 | echo ' |
309 | 331 | </div><!-- .moderation -->'; |
@@ -321,18 +343,20 @@ discard block |
||
321 | 343 | <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> |
322 | 344 | <option value="">--------</option>'; |
323 | 345 | |
324 | - foreach ($context['qmod_actions'] as $qmod_action) |
|
325 | - if ($context['can_' . $qmod_action]) |
|
346 | + foreach ($context['qmod_actions'] as $qmod_action) { |
|
347 | + if ($context['can_' . $qmod_action]) |
|
326 | 348 | echo ' |
327 | 349 | <option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>'; |
350 | + } |
|
328 | 351 | |
329 | 352 | echo ' |
330 | 353 | </select>'; |
331 | 354 | |
332 | 355 | // Show a list of boards they can move the topic to. |
333 | - if ($context['can_move']) |
|
334 | - echo ' |
|
356 | + if ($context['can_move']) { |
|
357 | + echo ' |
|
335 | 358 | <span id="quick_mod_jump_to"> </span>'; |
359 | + } |
|
336 | 360 | |
337 | 361 | echo ' |
338 | 362 | <input type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.quickModForm.qaction.value != \'\' && confirm(\'', $txt['quickmod_confirm'], '\');" class="button qaction"> |
@@ -343,10 +367,11 @@ discard block |
||
343 | 367 | </div><!-- #messageindex -->'; |
344 | 368 | |
345 | 369 | // Finish off the form - again. |
346 | - if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) |
|
347 | - echo ' |
|
370 | + if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) { |
|
371 | + echo ' |
|
348 | 372 | <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '"> |
349 | 373 | </form>'; |
374 | + } |
|
350 | 375 | |
351 | 376 | // Mobile action buttons (bottom) |
352 | 377 | echo ' |
@@ -368,8 +393,8 @@ discard block |
||
368 | 393 | // Show breadcrumbs at the bottom too. |
369 | 394 | theme_linktree(); |
370 | 395 | |
371 | - if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) |
|
372 | - echo ' |
|
396 | + if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { |
|
397 | + echo ' |
|
373 | 398 | <script> |
374 | 399 | if (typeof(window.XMLHttpRequest) != "undefined") |
375 | 400 | aJumpTo[aJumpTo.length] = new JumpTo({ |
@@ -388,6 +413,7 @@ discard block |
||
388 | 413 | sCustomName: "move_to" |
389 | 414 | }); |
390 | 415 | </script>'; |
416 | + } |
|
391 | 417 | |
392 | 418 | // Javascript for inline editing. |
393 | 419 | echo ' |
@@ -424,8 +450,8 @@ discard block |
||
424 | 450 | <div class="information"> |
425 | 451 | <p class="floatright" id="message_index_jump_to"> </p>'; |
426 | 452 | |
427 | - if (empty($context['no_topic_listing'])) |
|
428 | - echo ' |
|
453 | + if (empty($context['no_topic_listing'])) { |
|
454 | + echo ' |
|
429 | 455 | <p class="floatleft">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? ' |
430 | 456 | <img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="" class="centericon"> ' . $txt['participation_caption'] . '<br>' : '', ' |
431 | 457 | '. ($modSettings['pollMode'] == '1' ? '<span class="generic_icons poll centericon"></span> ' . $txt['poll'] : '') . '<br> |
@@ -435,9 +461,10 @@ discard block |
||
435 | 461 | <span class="generic_icons lock centericon"></span> ' . $txt['locked_topic'] . '<br> |
436 | 462 | <span class="generic_icons sticky centericon"></span> ' . $txt['sticky_topic'] . '<br> |
437 | 463 | </p>'; |
464 | + } |
|
438 | 465 | |
439 | - if (!empty($context['jump_to'])) |
|
440 | - echo ' |
|
466 | + if (!empty($context['jump_to'])) { |
|
467 | + echo ' |
|
441 | 468 | <script> |
442 | 469 | if (typeof(window.XMLHttpRequest) != "undefined") |
443 | 470 | aJumpTo[aJumpTo.length] = new JumpTo({ |
@@ -453,6 +480,7 @@ discard block |
||
453 | 480 | sGoButtonLabel: "', $txt['quick_mod_go'], '" |
454 | 481 | }); |
455 | 482 | </script>'; |
483 | + } |
|
456 | 484 | |
457 | 485 | echo ' |
458 | 486 | <br class="clear"> |
@@ -26,9 +26,10 @@ discard block |
||
26 | 26 | </h3> |
27 | 27 | </div>'; |
28 | 28 | |
29 | - if ($context['ban']['is_new']) |
|
30 | - echo ' |
|
29 | + if ($context['ban']['is_new']) { |
|
30 | + echo ' |
|
31 | 31 | <div class="information noup">', $txt['ban_add_notes'], '</div>'; |
32 | + } |
|
32 | 33 | |
33 | 34 | // If there were errors creating the ban, show them. |
34 | 35 | if (!empty($context['error_messages'])) |
@@ -38,9 +39,10 @@ discard block |
||
38 | 39 | <strong>', $txt['ban_errors_detected'], '</strong> |
39 | 40 | <ul>'; |
40 | 41 | |
41 | - foreach ($context['error_messages'] as $error) |
|
42 | - echo ' |
|
42 | + foreach ($context['error_messages'] as $error) { |
|
43 | + echo ' |
|
43 | 44 | <li class="error">', $error, '</li>'; |
45 | + } |
|
44 | 46 | |
45 | 47 | echo ' |
46 | 48 | </ul> |
@@ -57,8 +59,8 @@ discard block |
||
57 | 59 | <input type="text" id="ban_name" name="ban_name" value="', $context['ban']['name'], '" size="45" maxlength="60"> |
58 | 60 | </dd>'; |
59 | 61 | |
60 | - if (isset($context['ban']['reason'])) |
|
61 | - echo ' |
|
62 | + if (isset($context['ban']['reason'])) { |
|
63 | + echo ' |
|
62 | 64 | <dt> |
63 | 65 | <strong><label for="reason">', $txt['ban_reason'], ':</label></strong><br> |
64 | 66 | <span class="smalltext">', $txt['ban_reason_desc'], '</span> |
@@ -66,9 +68,10 @@ discard block |
||
66 | 68 | <dd> |
67 | 69 | <textarea name="reason" id="reason" cols="40" rows="3" style="min-height: 64px; max-height: 64px; min-width: 50%; max-width: 99%;">', $context['ban']['reason'], '</textarea> |
68 | 70 | </dd>'; |
71 | + } |
|
69 | 72 | |
70 | - if (isset($context['ban']['notes'])) |
|
71 | - echo ' |
|
73 | + if (isset($context['ban']['notes'])) { |
|
74 | + echo ' |
|
72 | 75 | <dt> |
73 | 76 | <strong><label for="ban_notes">', $txt['ban_notes'], ':</label></strong><br> |
74 | 77 | <span class="smalltext">', $txt['ban_notes_desc'], '</span> |
@@ -76,6 +79,7 @@ discard block |
||
76 | 79 | <dd> |
77 | 80 | <textarea name="notes" id="ban_notes" cols="40" rows="3" style="min-height: 64px; max-height: 64px; min-width: 50%; max-width: 99%;">', $context['ban']['notes'], '</textarea> |
78 | 81 | </dd>'; |
82 | + } |
|
79 | 83 | |
80 | 84 | echo ' |
81 | 85 | </dl> |
@@ -115,8 +119,8 @@ discard block |
||
115 | 119 | <input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;"> |
116 | 120 | </dd>'; |
117 | 121 | |
118 | - if (empty($modSettings['disableHostnameLookup'])) |
|
119 | - echo ' |
|
122 | + if (empty($modSettings['disableHostnameLookup'])) { |
|
123 | + echo ' |
|
120 | 124 | <dt> |
121 | 125 | <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', !empty($context['ban_suggestions']['hostname']) ? ' checked' : '', '> |
122 | 126 | <label for="hostname_check">', $txt['ban_on_hostname'], '</label> |
@@ -124,6 +128,7 @@ discard block |
||
124 | 128 | <dd> |
125 | 129 | <input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;"> |
126 | 130 | </dd>'; |
131 | + } |
|
127 | 132 | |
128 | 133 | echo ' |
129 | 134 | <dt> |
@@ -153,14 +158,15 @@ discard block |
||
153 | 158 | <dl class="settings">'; |
154 | 159 | |
155 | 160 | $count = 0; |
156 | - foreach ($ban_ips as $ip) |
|
157 | - echo ' |
|
161 | + foreach ($ban_ips as $ip) { |
|
162 | + echo ' |
|
158 | 163 | <dt> |
159 | 164 | <input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]"', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? ' checked' : '', ' value="', $ip, '"> |
160 | 165 | </dt> |
161 | 166 | <dd> |
162 | 167 | <label for="suggestions_', $key, '_', $count++, '">', $ip, '</label> |
163 | 168 | </dd>'; |
169 | + } |
|
164 | 170 | |
165 | 171 | echo ' |
166 | 172 | </dl>'; |
@@ -202,8 +208,8 @@ discard block |
||
202 | 208 | addLoadEvent(fUpdateStatus);'; |
203 | 209 | |
204 | 210 | // Auto suggest only needed for adding new bans, not editing |
205 | - if ($context['ban']['is_new'] && empty($_REQUEST['u'])) |
|
206 | - echo ' |
|
211 | + if ($context['ban']['is_new'] && empty($_REQUEST['u'])) { |
|
212 | + echo ' |
|
207 | 213 | var oAddMemberSuggest = new smc_AutoSuggest({ |
208 | 214 | sSelf: \'oAddMemberSuggest\', |
209 | 215 | sSessionId: smf_session_id, |
@@ -221,6 +227,7 @@ discard block |
||
221 | 227 | return true; |
222 | 228 | } |
223 | 229 | oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\');'; |
230 | + } |
|
224 | 231 | |
225 | 232 | echo ' |
226 | 233 | function confirmBan(aForm) |
@@ -269,8 +276,8 @@ discard block |
||
269 | 276 | <input type="text" name="main_ip" value="', $context['ban_trigger']['ip']['value'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;"> |
270 | 277 | </dd>'; |
271 | 278 | |
272 | - if (empty($modSettings['disableHostnameLookup'])) |
|
273 | - echo ' |
|
279 | + if (empty($modSettings['disableHostnameLookup'])) { |
|
280 | + echo ' |
|
274 | 281 | <dt> |
275 | 282 | <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', $context['ban_trigger']['hostname']['selected'] ? ' checked' : '', '> |
276 | 283 | <label for="hostname_check">', $txt['ban_on_hostname'], '</label> |
@@ -278,6 +285,7 @@ discard block |
||
278 | 285 | <dd> |
279 | 286 | <input type="text" name="hostname" value="', $context['ban_trigger']['hostname']['value'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;"> |
280 | 287 | </dd>'; |
288 | + } |
|
281 | 289 | |
282 | 290 | echo ' |
283 | 291 | <dt> |
@@ -55,9 +55,10 @@ discard block |
||
55 | 55 | <legend>', $txt['membergroups_edit_select_group_type'], '</legend> |
56 | 56 | <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" checked onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>'; |
57 | 57 | |
58 | - if ($context['allow_protected']) |
|
59 | - echo ' |
|
58 | + if ($context['allow_protected']) { |
|
59 | + echo ' |
|
60 | 60 | <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>'; |
61 | + } |
|
61 | 62 | |
62 | 63 | echo ' |
63 | 64 | <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br> |
@@ -67,14 +68,15 @@ discard block |
||
67 | 68 | </dd>'; |
68 | 69 | } |
69 | 70 | |
70 | - if ($context['post_group'] || $context['undefined_group']) |
|
71 | - echo ' |
|
71 | + if ($context['post_group'] || $context['undefined_group']) { |
|
72 | + echo ' |
|
72 | 73 | <dt id="min_posts_text"> |
73 | 74 | <strong>', $txt['membergroups_min_posts'], ':</strong> |
74 | 75 | </dt> |
75 | 76 | <dd> |
76 | 77 | <input type="number" name="min_posts" id="min_posts_input" size="5"> |
77 | 78 | </dd>'; |
79 | + } |
|
78 | 80 | |
79 | 81 | if (!$context['post_group'] || !empty($modSettings['permission_enable_postgroups'])) |
80 | 82 | { |
@@ -92,9 +94,10 @@ discard block |
||
92 | 94 | <option value="-1">', $txt['membergroups_guests'], '</option> |
93 | 95 | <option value="0" selected>', $txt['membergroups_members'], '</option>'; |
94 | 96 | |
95 | - foreach ($context['groups'] as $group) |
|
96 | - echo ' |
|
97 | + foreach ($context['groups'] as $group) { |
|
98 | + echo ' |
|
97 | 99 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
100 | + } |
|
98 | 101 | |
99 | 102 | echo ' |
100 | 103 | </select> |
@@ -105,9 +108,10 @@ discard block |
||
105 | 108 | <option value="-1">', $txt['membergroups_guests'], '</option> |
106 | 109 | <option value="0" selected>', $txt['membergroups_members'], '</option>'; |
107 | 110 | |
108 | - foreach ($context['groups'] as $group) |
|
109 | - echo ' |
|
111 | + foreach ($context['groups'] as $group) { |
|
112 | + echo ' |
|
110 | 113 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
114 | + } |
|
111 | 115 | |
112 | 116 | echo ' |
113 | 117 | </select> |
@@ -183,8 +187,8 @@ discard block |
||
183 | 187 | <input type="text" name="group_name" id="group_name_input" value="', $context['group']['editable_name'], '" size="30"> |
184 | 188 | </dd>'; |
185 | 189 | |
186 | - if ($context['group']['id'] != 3 && $context['group']['id'] != 4) |
|
187 | - echo ' |
|
190 | + if ($context['group']['id'] != 3 && $context['group']['id'] != 4) { |
|
191 | + echo ' |
|
188 | 192 | |
189 | 193 | <dt id="group_desc_text"> |
190 | 194 | <label for="group_desc_input"><strong>', $txt['membergroups_edit_desc'], ':</strong></label> |
@@ -192,6 +196,7 @@ discard block |
||
192 | 196 | <dd> |
193 | 197 | <textarea name="group_desc" id="group_desc_input" rows="4" cols="40">', $context['group']['description'], '</textarea> |
194 | 198 | </dd>'; |
199 | + } |
|
195 | 200 | |
196 | 201 | // Group type... |
197 | 202 | if ($context['group']['allow_post_group']) |
@@ -205,9 +210,10 @@ discard block |
||
205 | 210 | <legend>', $txt['membergroups_edit_select_group_type'], '</legend> |
206 | 211 | <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0"', !$context['group']['is_post_group'] && $context['group']['type'] == 0 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>'; |
207 | 212 | |
208 | - if ($context['group']['allow_protected']) |
|
209 | - echo ' |
|
213 | + if ($context['group']['allow_protected']) { |
|
214 | + echo ' |
|
210 | 215 | <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1"', $context['group']['type'] == 1 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>'; |
216 | + } |
|
211 | 217 | |
212 | 218 | echo ' |
213 | 219 | <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2"', $context['group']['type'] == 2 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br> |
@@ -217,8 +223,8 @@ discard block |
||
217 | 223 | </dd>'; |
218 | 224 | } |
219 | 225 | |
220 | - if ($context['group']['id'] != 3 && $context['group']['id'] != 4) |
|
221 | - echo ' |
|
226 | + if ($context['group']['id'] != 3 && $context['group']['id'] != 4) { |
|
227 | + echo ' |
|
222 | 228 | <dt id="group_moderators_text"> |
223 | 229 | <label for="group_moderators"><strong>', $txt['moderators'], ':</strong></label> |
224 | 230 | </dt> |
@@ -236,6 +242,7 @@ discard block |
||
236 | 242 | <option value="2"', $context['group']['hidden'] == 2 ? ' selected' : '', '>', $txt['membergroups_edit_hidden_all'], '</option> |
237 | 243 | </select> |
238 | 244 | </dd>'; |
245 | + } |
|
239 | 246 | |
240 | 247 | // Can they inherit permissions? |
241 | 248 | if ($context['group']['id'] > 1 && $context['group']['id'] != 3) |
@@ -252,9 +259,10 @@ discard block |
||
252 | 259 | <option value="0"', $context['group']['inherited_from'] == 0 ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_members'], '</option>'; |
253 | 260 | |
254 | 261 | // For all the inheritable groups show an option. |
255 | - foreach ($context['inheritable_groups'] as $id => $group) |
|
256 | - echo ' |
|
262 | + foreach ($context['inheritable_groups'] as $id => $group) { |
|
263 | + echo ' |
|
257 | 264 | <option value="', $id, '"', $context['group']['inherited_from'] == $id ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $group, '</option>'; |
265 | + } |
|
258 | 266 | |
259 | 267 | echo ' |
260 | 268 | </select> |
@@ -262,8 +270,8 @@ discard block |
||
262 | 270 | </dd>'; |
263 | 271 | } |
264 | 272 | |
265 | - if ($context['group']['allow_post_group']) |
|
266 | - echo ' |
|
273 | + if ($context['group']['allow_post_group']) { |
|
274 | + echo ' |
|
267 | 275 | |
268 | 276 | <dt id="min_posts_text"> |
269 | 277 | <label for="min_posts_input"><strong>', $txt['membergroups_min_posts'], ':</strong></label> |
@@ -271,6 +279,7 @@ discard block |
||
271 | 279 | <dd> |
272 | 280 | <input type="number" name="min_posts" id="min_posts_input"', $context['group']['is_post_group'] ? ' value="' . $context['group']['min_posts'] . '"' : '', ' size="6"> |
273 | 281 | </dd>'; |
282 | + } |
|
274 | 283 | |
275 | 284 | echo ' |
276 | 285 | <dt> |
@@ -313,9 +322,10 @@ discard block |
||
313 | 322 | } |
314 | 323 | |
315 | 324 | // No? Hide the entire control. |
316 | - else |
|
317 | - echo ' |
|
325 | + else { |
|
326 | + echo ' |
|
318 | 327 | <input type="hidden" name="icon_image" value="">'; |
328 | + } |
|
319 | 329 | |
320 | 330 | echo ' |
321 | 331 | <dt> |
@@ -327,8 +337,8 @@ discard block |
||
327 | 337 | </dd>'; |
328 | 338 | |
329 | 339 | // Force 2FA for this membergroup? |
330 | - if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) |
|
331 | - echo ' |
|
340 | + if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) { |
|
341 | + echo ' |
|
332 | 342 | <dt> |
333 | 343 | <label for="group_tfa_force_input"><strong>', $txt['membergroups_tfa_force'], ':</strong></label><br> |
334 | 344 | <span class="smalltext">', $txt['membergroups_tfa_force_note'], '</span> |
@@ -336,6 +346,7 @@ discard block |
||
336 | 346 | <dd> |
337 | 347 | <input type="checkbox" name="group_tfa_force"', $context['group']['tfa_required'] ? ' checked' : '', '> |
338 | 348 | </dd>'; |
349 | + } |
|
339 | 350 | |
340 | 351 | if (!empty($context['categories'])) |
341 | 352 | { |
@@ -346,11 +357,11 @@ discard block |
||
346 | 357 | </dt> |
347 | 358 | <dd>'; |
348 | 359 | |
349 | - if (!empty($context['can_manage_boards'])) |
|
350 | - echo $txt['membergroups_can_manage_access']; |
|
351 | - |
|
352 | - else |
|
353 | - template_add_edit_group_boards_list(); |
|
360 | + if (!empty($context['can_manage_boards'])) { |
|
361 | + echo $txt['membergroups_can_manage_access']; |
|
362 | + } else { |
|
363 | + template_add_edit_group_boards_list(); |
|
364 | + } |
|
354 | 365 | |
355 | 366 | echo ' |
356 | 367 | </dd>'; |
@@ -379,20 +390,21 @@ discard block |
||
379 | 390 | sItemListContainerId: \'moderator_container\', |
380 | 391 | aListItems: ['; |
381 | 392 | |
382 | - foreach ($context['group']['moderators'] as $id_member => $member_name) |
|
383 | - echo ' |
|
393 | + foreach ($context['group']['moderators'] as $id_member => $member_name) { |
|
394 | + echo ' |
|
384 | 395 | { |
385 | 396 | sItemId: ', JavaScriptEscape($id_member), ', |
386 | 397 | sItemName: ', JavaScriptEscape($member_name), ' |
387 | 398 | }', $id_member == $context['group']['last_moderator_id'] ? '' : ','; |
399 | + } |
|
388 | 400 | |
389 | 401 | echo ' |
390 | 402 | ] |
391 | 403 | }); |
392 | 404 | </script>'; |
393 | 405 | |
394 | - if ($context['group']['allow_post_group']) |
|
395 | - echo ' |
|
406 | + if ($context['group']['allow_post_group']) { |
|
407 | + echo ' |
|
396 | 408 | <script> |
397 | 409 | function swapPostGroup(isChecked) |
398 | 410 | { |
@@ -440,7 +452,8 @@ discard block |
||
440 | 452 | |
441 | 453 | swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', '); |
442 | 454 | </script>'; |
443 | -} |
|
455 | + } |
|
456 | + } |
|
444 | 457 | |
445 | 458 | /** |
446 | 459 | * The template for determining which boards a group has access to. |
@@ -458,13 +471,13 @@ discard block |
||
458 | 471 | |
459 | 472 | foreach ($context['categories'] as $category) |
460 | 473 | { |
461 | - if (empty($modSettings['deny_boards_access'])) |
|
462 | - echo ' |
|
474 | + if (empty($modSettings['deny_boards_access'])) { |
|
475 | + echo ' |
|
463 | 476 | <li class="category"> |
464 | 477 | <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'new_group\'); return false;"><strong>', $category['name'], '</strong></a> |
465 | 478 | <ul style="width:100%">'; |
466 | - else |
|
467 | - echo ' |
|
479 | + } else { |
|
480 | + echo ' |
|
468 | 481 | <li class="category"> |
469 | 482 | <strong>', $category['name'], '</strong> |
470 | 483 | <span class="select_all_box"> |
@@ -477,16 +490,17 @@ discard block |
||
477 | 490 | </select> |
478 | 491 | </span> |
479 | 492 | <ul style="width:100%" id="boards_list_', $category['id'], '">'; |
493 | + } |
|
480 | 494 | |
481 | 495 | foreach ($category['boards'] as $board) |
482 | 496 | { |
483 | - if (empty($modSettings['deny_boards_access'])) |
|
484 | - echo ' |
|
497 | + if (empty($modSettings['deny_boards_access'])) { |
|
498 | + echo ' |
|
485 | 499 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
486 | 500 | <input type="checkbox" name="boardaccess[', $board['id'], ']" id="brd', $board['id'], '" value="allow"', $board['allow'] ? ' checked' : '', '> <label for="brd', $board['id'], '">', $board['name'], '</label> |
487 | 501 | </li>'; |
488 | - else |
|
489 | - echo ' |
|
502 | + } else { |
|
503 | + echo ' |
|
490 | 504 | <li class="board" style="width:100%"> |
491 | 505 | <span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span> |
492 | 506 | <span style="width:50%;float:right"> |
@@ -495,6 +509,7 @@ discard block |
||
495 | 509 | <input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny"', $board['deny'] ? ' checked' : '', '> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label> |
496 | 510 | </span> |
497 | 511 | </li>'; |
512 | + } |
|
498 | 513 | } |
499 | 514 | |
500 | 515 | echo ' |
@@ -505,14 +520,14 @@ discard block |
||
505 | 520 | echo ' |
506 | 521 | </ul>'; |
507 | 522 | |
508 | - if (empty($modSettings['deny_boards_access'])) |
|
509 | - echo ' |
|
523 | + if (empty($modSettings['deny_boards_access'])) { |
|
524 | + echo ' |
|
510 | 525 | <br class="clear"><br> |
511 | 526 | <input type="checkbox" id="checkall_check" onclick="invertAll(this, this.form, \'boardaccess\');"> |
512 | 527 | <label for="checkall_check"><em>', $txt['check_all'], '</em></label> |
513 | 528 | </fieldset>'; |
514 | - else |
|
515 | - echo ' |
|
529 | + } else { |
|
530 | + echo ' |
|
516 | 531 | <br class="clear"> |
517 | 532 | <span class="select_all_box"> |
518 | 533 | <em>', $txt['all'], ': </em> |
@@ -528,15 +543,17 @@ discard block |
||
528 | 543 | }); |
529 | 544 | }); |
530 | 545 | </script>'; |
546 | + } |
|
531 | 547 | |
532 | - if ($collapse) |
|
533 | - echo ' |
|
548 | + if ($collapse) { |
|
549 | + echo ' |
|
534 | 550 | <a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'block\'; document.getElementById(\'visible_boards_link\').style.display = \'none\'; return false;" id="visible_boards_link" style="display: none;">[ ', $txt['membergroups_select_visible_boards'], ' ]</a> |
535 | 551 | <script> |
536 | 552 | document.getElementById("visible_boards_link").style.display = ""; |
537 | 553 | document.getElementById("visible_boards").style.display = "none"; |
538 | 554 | </script>'; |
539 | -} |
|
555 | + } |
|
556 | + } |
|
540 | 557 | |
541 | 558 | /** |
542 | 559 | * Templatine for viewing the members of a group. |
@@ -561,14 +578,15 @@ discard block |
||
561 | 578 | </dd>'; |
562 | 579 | |
563 | 580 | // Any description to show? |
564 | - if (!empty($context['group']['description'])) |
|
565 | - echo ' |
|
581 | + if (!empty($context['group']['description'])) { |
|
582 | + echo ' |
|
566 | 583 | <dt> |
567 | 584 | <strong>' . $txt['membergroups_members_description'] . ':</strong> |
568 | 585 | </dt> |
569 | 586 | <dd> |
570 | 587 | ', $context['group']['description'], ' |
571 | 588 | </dd>'; |
589 | + } |
|
572 | 590 | |
573 | 591 | echo ' |
574 | 592 | <dt> |
@@ -582,8 +600,9 @@ discard block |
||
582 | 600 | if (!empty($context['group']['moderators'])) |
583 | 601 | { |
584 | 602 | $moderators = array(); |
585 | - foreach ($context['group']['moderators'] as $moderator) |
|
586 | - $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>'; |
|
603 | + foreach ($context['group']['moderators'] as $moderator) { |
|
604 | + $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>'; |
|
605 | + } |
|
587 | 606 | |
588 | 607 | echo ' |
589 | 608 | <dt> |
@@ -608,9 +627,10 @@ discard block |
||
608 | 627 | <tr class="title_bar"> |
609 | 628 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>'; |
610 | 629 | |
611 | - if ($context['can_send_email']) |
|
612 | - echo ' |
|
630 | + if ($context['can_send_email']) { |
|
631 | + echo ' |
|
613 | 632 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>'; |
633 | + } |
|
614 | 634 | |
615 | 635 | echo ' |
616 | 636 | <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? '<span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th> |
@@ -619,19 +639,21 @@ discard block |
||
619 | 639 | <a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
620 | 640 | </th>'; |
621 | 641 | |
622 | - if (!empty($context['group']['assignable'])) |
|
623 | - echo ' |
|
642 | + if (!empty($context['group']['assignable'])) { |
|
643 | + echo ' |
|
624 | 644 | <th style="width: 4%"><input type="checkbox" onclick="invertAll(this, this.form);"></th>'; |
645 | + } |
|
625 | 646 | echo ' |
626 | 647 | </tr> |
627 | 648 | </thead> |
628 | 649 | <tbody>'; |
629 | 650 | |
630 | - if (empty($context['members'])) |
|
631 | - echo ' |
|
651 | + if (empty($context['members'])) { |
|
652 | + echo ' |
|
632 | 653 | <tr class="windowbg"> |
633 | 654 | <td colspan="6">', $txt['membergroups_members_no_members'], '</td> |
634 | 655 | </tr>'; |
656 | + } |
|
635 | 657 | |
636 | 658 | foreach ($context['members'] as $member) |
637 | 659 | { |
@@ -652,9 +674,10 @@ discard block |
||
652 | 674 | <td>', $member['registered'], '</td> |
653 | 675 | <td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>'; |
654 | 676 | |
655 | - if (!empty($context['group']['assignable'])) |
|
656 | - echo ' |
|
677 | + if (!empty($context['group']['assignable'])) { |
|
678 | + echo ' |
|
657 | 679 | <td style="width: 4%"><input type="checkbox" name="rem[]" value="', $member['id'], '" ', ($context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : ''), '/></td>'; |
680 | + } |
|
658 | 681 | echo ' |
659 | 682 | </tr>'; |
660 | 683 | } |
@@ -663,11 +686,12 @@ discard block |
||
663 | 686 | </tbody> |
664 | 687 | </table>'; |
665 | 688 | |
666 | - if (!empty($context['group']['assignable'])) |
|
667 | - echo ' |
|
689 | + if (!empty($context['group']['assignable'])) { |
|
690 | + echo ' |
|
668 | 691 | <div class="floatright"> |
669 | 692 | <input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button "> |
670 | 693 | </div>'; |
694 | + } |
|
671 | 695 | |
672 | 696 | echo ' |
673 | 697 | <div class="pagesection flow_hidden"> |
@@ -701,8 +725,8 @@ discard block |
||
701 | 725 | </form> |
702 | 726 | </div><!-- #admincenter -->'; |
703 | 727 | |
704 | - if (!empty($context['group']['assignable'])) |
|
705 | - echo ' |
|
728 | + if (!empty($context['group']['assignable'])) { |
|
729 | + echo ' |
|
706 | 730 | <script> |
707 | 731 | var oAddMemberSuggest = new smc_AutoSuggest({ |
708 | 732 | sSelf: \'oAddMemberSuggest\', |
@@ -718,7 +742,8 @@ discard block |
||
718 | 742 | sItemListContainerId: \'toAddItemContainer\' |
719 | 743 | }); |
720 | 744 | </script>'; |
721 | -} |
|
745 | + } |
|
746 | + } |
|
722 | 747 | |
723 | 748 | /** |
724 | 749 | * Allow the moderator to enter a reason to each user being rejected. |
@@ -738,8 +763,8 @@ discard block |
||
738 | 763 | <dl class="settings">'; |
739 | 764 | |
740 | 765 | // Loop through and print out a reason box for each... |
741 | - foreach ($context['group_requests'] as $request) |
|
742 | - echo ' |
|
766 | + foreach ($context['group_requests'] as $request) { |
|
767 | + echo ' |
|
743 | 768 | <dt> |
744 | 769 | <strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong> |
745 | 770 | </dt> |
@@ -747,6 +772,7 @@ discard block |
||
747 | 772 | <input type="hidden" name="groupr[]" value="', $request['id'], '"> |
748 | 773 | <textarea name="groupreason[', $request['id'], ']" rows="3" cols="40" style="min-width: 80%; max-width: 99%;"></textarea> |
749 | 774 | </dd>'; |
775 | + } |
|
750 | 776 | |
751 | 777 | echo ' |
752 | 778 | </dl> |
@@ -39,15 +39,13 @@ discard block |
||
39 | 39 | <div id="main_grid"> |
40 | 40 | ', template_show_upcoming_list('main'), ' |
41 | 41 | </div>'; |
42 | - } |
|
43 | - elseif ($context['calendar_view'] == 'viewweek') |
|
42 | + } elseif ($context['calendar_view'] == 'viewweek') |
|
44 | 43 | { |
45 | 44 | echo ' |
46 | 45 | <div id="main_grid"> |
47 | 46 | ', template_show_week_grid('main'), ' |
48 | 47 | </div>'; |
49 | - } |
|
50 | - else |
|
48 | + } else |
|
51 | 49 | { |
52 | 50 | echo ' |
53 | 51 | <div id="main_grid"> |
@@ -72,8 +70,9 @@ discard block |
||
72 | 70 | global $context, $scripturl, $txt; |
73 | 71 | |
74 | 72 | // Bail out if we have nothing to work with |
75 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
76 | - return false; |
|
73 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
74 | + return false; |
|
75 | + } |
|
77 | 76 | |
78 | 77 | // Protect programmer sanity |
79 | 78 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
@@ -110,11 +109,13 @@ discard block |
||
110 | 109 | <li class="windowbg"> |
111 | 110 | <strong class="event_title">', $event['link'], '</strong>'; |
112 | 111 | |
113 | - if ($event['can_edit']) |
|
114 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
112 | + if ($event['can_edit']) { |
|
113 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
114 | + } |
|
115 | 115 | |
116 | - if ($event['can_export']) |
|
117 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
116 | + if ($event['can_export']) { |
|
117 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
118 | + } |
|
118 | 119 | |
119 | 120 | echo ' |
120 | 121 | <br>'; |
@@ -122,14 +123,14 @@ discard block |
||
122 | 123 | if (!empty($event['allday'])) |
123 | 124 | { |
124 | 125 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
125 | - } |
|
126 | - else |
|
126 | + } else |
|
127 | 127 | { |
128 | 128 | // Display event info relative to user's local timezone |
129 | 129 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
130 | 130 | |
131 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
132 | - echo trim($event['end_date_local']) . ', '; |
|
131 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
132 | + echo trim($event['end_date_local']) . ', '; |
|
133 | + } |
|
133 | 134 | |
134 | 135 | echo trim($event['end_time_local']); |
135 | 136 | |
@@ -138,23 +139,27 @@ discard block |
||
138 | 139 | { |
139 | 140 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
140 | 141 | |
141 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
142 | - echo trim($event['start_date_orig']), ', '; |
|
142 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
143 | + echo trim($event['start_date_orig']), ', '; |
|
144 | + } |
|
143 | 145 | |
144 | 146 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
145 | 147 | |
146 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
147 | - echo trim($event['end_date_orig']) . ', '; |
|
148 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
149 | + echo trim($event['end_date_orig']) . ', '; |
|
150 | + } |
|
148 | 151 | |
149 | 152 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
150 | 153 | } |
151 | 154 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
152 | - else |
|
153 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
155 | + else { |
|
156 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
157 | + } |
|
154 | 158 | } |
155 | 159 | |
156 | - if (!empty($event['location'])) |
|
157 | - echo '<br>', $event['location']; |
|
160 | + if (!empty($event['location'])) { |
|
161 | + echo '<br>', $event['location']; |
|
162 | + } |
|
158 | 163 | |
159 | 164 | echo ' |
160 | 165 | </li>'; |
@@ -186,8 +191,9 @@ discard block |
||
186 | 191 | |
187 | 192 | $birthdays = array(); |
188 | 193 | |
189 | - foreach ($date as $member) |
|
190 | - $birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>'; |
|
194 | + foreach ($date as $member) { |
|
195 | + $birthdays[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>'; |
|
196 | + } |
|
191 | 197 | |
192 | 198 | echo implode(', ', $birthdays); |
193 | 199 | |
@@ -218,8 +224,9 @@ discard block |
||
218 | 224 | $date_local = $date['date_local']; |
219 | 225 | unset($date['date_local']); |
220 | 226 | |
221 | - foreach ($date as $holiday) |
|
222 | - $holidays[] = $holiday . ' (' . $date_local . ')'; |
|
227 | + foreach ($date as $holiday) { |
|
228 | + $holidays[] = $holiday . ' (' . $date_local . ')'; |
|
229 | + } |
|
223 | 230 | } |
224 | 231 | |
225 | 232 | echo implode(', ', $holidays); |
@@ -243,17 +250,19 @@ discard block |
||
243 | 250 | global $context, $txt, $scripturl, $modSettings; |
244 | 251 | |
245 | 252 | // If the grid doesn't exist, no point in proceeding. |
246 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
247 | - return false; |
|
253 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
254 | + return false; |
|
255 | + } |
|
248 | 256 | |
249 | 257 | // A handy little pointer variable. |
250 | 258 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
251 | 259 | |
252 | 260 | // Some conditions for whether or not we should show the week links *here*. |
253 | - if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) |
|
254 | - $show_week_links = true; |
|
255 | - else |
|
256 | - $show_week_links = false; |
|
261 | + if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false))) { |
|
262 | + $show_week_links = true; |
|
263 | + } else { |
|
264 | + $show_week_links = false; |
|
265 | + } |
|
257 | 266 | |
258 | 267 | // Assuming that we've not disabled it, show the title block! |
259 | 268 | if (empty($calendar_data['disable_title'])) |
@@ -288,8 +297,9 @@ discard block |
||
288 | 297 | } |
289 | 298 | |
290 | 299 | // Show the controls on main grids |
291 | - if ($is_mini === false) |
|
292 | - template_calendar_top($calendar_data); |
|
300 | + if ($is_mini === false) { |
|
301 | + template_calendar_top($calendar_data); |
|
302 | + } |
|
293 | 303 | |
294 | 304 | // Finally, the main calendar table. |
295 | 305 | echo ' |
@@ -302,9 +312,10 @@ discard block |
||
302 | 312 | <tr>'; |
303 | 313 | |
304 | 314 | // If we're showing week links, there's an extra column ahead of the week links, so let's think ahead and be prepared! |
305 | - if ($show_week_links === true) |
|
306 | - echo ' |
|
315 | + if ($show_week_links === true) { |
|
316 | + echo ' |
|
307 | 317 | <th> </th>'; |
318 | + } |
|
308 | 319 | |
309 | 320 | // Now, loop through each actual day of the week. |
310 | 321 | foreach ($calendar_data['week_days'] as $day) |
@@ -353,27 +364,29 @@ discard block |
||
353 | 364 | // Additional classes are given for events, holidays, and birthdays. |
354 | 365 | if (!empty($day['events']) && !empty($calendar_data['highlight']['events'])) |
355 | 366 | { |
356 | - if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) |
|
357 | - $classes[] = 'events'; |
|
358 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) |
|
359 | - $classes[] = 'events'; |
|
367 | + if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1, 3))) { |
|
368 | + $classes[] = 'events'; |
|
369 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2, 3))) { |
|
370 | + $classes[] = 'events'; |
|
371 | + } |
|
360 | 372 | } |
361 | 373 | if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays'])) |
362 | 374 | { |
363 | - if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) |
|
364 | - $classes[] = 'holidays'; |
|
365 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) |
|
366 | - $classes[] = 'holidays'; |
|
375 | + if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1, 3))) { |
|
376 | + $classes[] = 'holidays'; |
|
377 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2, 3))) { |
|
378 | + $classes[] = 'holidays'; |
|
379 | + } |
|
367 | 380 | } |
368 | 381 | if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays'])) |
369 | 382 | { |
370 | - if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) |
|
371 | - $classes[] = 'birthdays'; |
|
372 | - elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) |
|
373 | - $classes[] = 'birthdays'; |
|
383 | + if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1, 3))) { |
|
384 | + $classes[] = 'birthdays'; |
|
385 | + } elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2, 3))) { |
|
386 | + $classes[] = 'birthdays'; |
|
387 | + } |
|
374 | 388 | } |
375 | - } |
|
376 | - else |
|
389 | + } else |
|
377 | 390 | { |
378 | 391 | // Default Classes (either compact or comfortable and disabled). |
379 | 392 | $classes[] = !empty($calendar_data['size']) && $calendar_data['size'] == 'small' ? 'compact' : 'comfortable'; |
@@ -392,25 +405,27 @@ discard block |
||
392 | 405 | $title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : ''; |
393 | 406 | |
394 | 407 | // The actual day number - be it a link, or just plain old text! |
395 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
396 | - echo ' |
|
408 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
409 | + echo ' |
|
397 | 410 | <a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
398 | - elseif ($is_mini) |
|
399 | - echo ' |
|
411 | + } elseif ($is_mini) { |
|
412 | + echo ' |
|
400 | 413 | <a href="', $scripturl, '?action=calendar;', $context['calendar_view'], ';year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>'; |
401 | - else |
|
402 | - echo ' |
|
414 | + } else { |
|
415 | + echo ' |
|
403 | 416 | <span class="day_text">', $title_prefix, $day['day'], '</span>'; |
417 | + } |
|
404 | 418 | |
405 | 419 | // A lot of stuff, we're not showing on mini-calendars to conserve space. |
406 | 420 | if ($is_mini === false) |
407 | 421 | { |
408 | 422 | // Holidays are always fun, let's show them! |
409 | - if (!empty($day['holidays'])) |
|
410 | - echo ' |
|
423 | + if (!empty($day['holidays'])) { |
|
424 | + echo ' |
|
411 | 425 | <div class="smalltext holiday"> |
412 | 426 | <span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), ' |
413 | 427 | </div>'; |
428 | + } |
|
414 | 429 | |
415 | 430 | // Happy Birthday Dear Member! |
416 | 431 | if (!empty($day['birthdays'])) |
@@ -428,15 +443,17 @@ discard block |
||
428 | 443 | echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] || ($count == 10 && $use_js_hide) ? '' : ', '; |
429 | 444 | |
430 | 445 | // 9...10! Let's stop there. |
431 | - if ($birthday_count == 10 && $use_js_hide) |
|
432 | - // !!TODO - Inline CSS and JavaScript should be moved. |
|
446 | + if ($birthday_count == 10 && $use_js_hide) { |
|
447 | + // !!TODO - Inline CSS and JavaScript should be moved. |
|
433 | 448 | echo '<span class="hidelink" id="bdhidelink_', $day['day'], '">...<br><a href="', $scripturl, '?action=calendar;month=', $calendar_data['current_month'], ';year=', $calendar_data['current_year'], ';showbd" onclick="document.getElementById(\'bdhide_', $day['day'], '\').style.display = \'\'; document.getElementById(\'bdhidelink_', $day['day'], '\').style.display = \'none\'; return false;">(', sprintf($txt['calendar_click_all'], count($day['birthdays'])), ')</a></span><span id="bdhide_', $day['day'], '" style="display: none;">, '; |
449 | + } |
|
434 | 450 | |
435 | 451 | ++$birthday_count; |
436 | 452 | } |
437 | - if ($use_js_hide) |
|
438 | - echo ' |
|
453 | + if ($use_js_hide) { |
|
454 | + echo ' |
|
439 | 455 | </span>'; |
456 | + } |
|
440 | 457 | |
441 | 458 | echo ' |
442 | 459 | </div><!-- .smalltext -->'; |
@@ -447,8 +464,9 @@ discard block |
||
447 | 464 | { |
448 | 465 | // Sort events by start time (all day events will be listed first) |
449 | 466 | uasort($day['events'], function($a, $b) { |
450 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
451 | - return 0; |
|
467 | + if ($a['start_timestamp'] == $b['start_timestamp']) { |
|
468 | + return 0; |
|
469 | + } |
|
452 | 470 | |
453 | 471 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
454 | 472 | }); |
@@ -468,20 +486,22 @@ discard block |
||
468 | 486 | ', $event['link'], '<br> |
469 | 487 | <span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">'; |
470 | 488 | |
471 | - if (!empty($event['start_time_local']) && $event['starts_today'] == true) |
|
472 | - echo trim(str_replace(':00 ', ' ', $event['start_time_local'])); |
|
473 | - elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) |
|
474 | - echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local'])); |
|
475 | - elseif (!empty($event['allday'])) |
|
476 | - echo $txt['calendar_allday']; |
|
489 | + if (!empty($event['start_time_local']) && $event['starts_today'] == true) { |
|
490 | + echo trim(str_replace(':00 ', ' ', $event['start_time_local'])); |
|
491 | + } elseif (!empty($event['end_time_local']) && $event['ends_today'] == true) { |
|
492 | + echo strtolower($txt['ends']), ' ', trim(str_replace(':00 ', ' ', $event['end_time_local'])); |
|
493 | + } elseif (!empty($event['allday'])) { |
|
494 | + echo $txt['calendar_allday']; |
|
495 | + } |
|
477 | 496 | |
478 | 497 | echo ' |
479 | 498 | </span>'; |
480 | 499 | |
481 | - if (!empty($event['location'])) |
|
482 | - echo ' |
|
500 | + if (!empty($event['location'])) { |
|
501 | + echo ' |
|
483 | 502 | <br> |
484 | 503 | <span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
504 | + } |
|
485 | 505 | |
486 | 506 | if ($event['can_edit'] || $event['can_export']) |
487 | 507 | { |
@@ -522,10 +542,11 @@ discard block |
||
522 | 542 | // Otherwise, assuming it's not a mini-calendar, we can show previous / next month days! |
523 | 543 | elseif ($is_mini === false) |
524 | 544 | { |
525 | - if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) |
|
526 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
527 | - elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) |
|
528 | - echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
545 | + if (empty($current_month_started) && !empty($context['calendar_grid_prev'])) { |
|
546 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- +1, '</a>'; |
|
547 | + } elseif (!empty($current_month_started) && !empty($context['calendar_grid_next'])) { |
|
548 | + echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>'; |
|
549 | + } |
|
529 | 550 | } |
530 | 551 | |
531 | 552 | // Close this day and increase var count. |
@@ -555,8 +576,9 @@ discard block |
||
555 | 576 | global $context, $txt, $scripturl, $modSettings; |
556 | 577 | |
557 | 578 | // We might have no reason to proceed, if the variable isn't there. |
558 | - if (!isset($context['calendar_grid_' . $grid_name])) |
|
559 | - return false; |
|
579 | + if (!isset($context['calendar_grid_' . $grid_name])) { |
|
580 | + return false; |
|
581 | + } |
|
560 | 582 | |
561 | 583 | // Handy pointer. |
562 | 584 | $calendar_data = &$context['calendar_grid_' . $grid_name]; |
@@ -591,8 +613,9 @@ discard block |
||
591 | 613 | } |
592 | 614 | |
593 | 615 | // The Month Title + Week Number... |
594 | - if (!empty($calendar_data['week_title'])) |
|
595 | - echo $calendar_data['week_title']; |
|
616 | + if (!empty($calendar_data['week_title'])) { |
|
617 | + echo $calendar_data['week_title']; |
|
618 | + } |
|
596 | 619 | |
597 | 620 | echo ' |
598 | 621 | </h3> |
@@ -633,11 +656,12 @@ discard block |
||
633 | 656 | <td class="', implode(' ', $classes), ' act_day">'; |
634 | 657 | |
635 | 658 | // Should the day number be a link? |
636 | - if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) |
|
637 | - echo ' |
|
659 | + if (!empty($modSettings['cal_daysaslink']) && $context['can_post']) { |
|
660 | + echo ' |
|
638 | 661 | <a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>'; |
639 | - else |
|
640 | - echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
662 | + } else { |
|
663 | + echo $txt['days'][$day['day_of_week']], ' - ', $day['day']; |
|
664 | + } |
|
641 | 665 | |
642 | 666 | echo ' |
643 | 667 | </td> |
@@ -648,8 +672,9 @@ discard block |
||
648 | 672 | { |
649 | 673 | // Sort events by start time (all day events will be listed first) |
650 | 674 | uasort($day['events'], function($a, $b) { |
651 | - if ($a['start_timestamp'] == $b['start_timestamp']) |
|
652 | - return 0; |
|
675 | + if ($a['start_timestamp'] == $b['start_timestamp']) { |
|
676 | + return 0; |
|
677 | + } |
|
653 | 678 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |
654 | 679 | }); |
655 | 680 | |
@@ -663,17 +688,19 @@ discard block |
||
663 | 688 | echo $event['link'], '<br> |
664 | 689 | <span class="event_time', empty($event_icons_needed) ? ' floatright' : '', '">'; |
665 | 690 | |
666 | - if (!empty($event['start_time_local'])) |
|
667 | - echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' – ' . trim($event['end_time_local']) : ''; |
|
668 | - else |
|
669 | - echo $txt['calendar_allday']; |
|
691 | + if (!empty($event['start_time_local'])) { |
|
692 | + echo trim($event['start_time_local']), !empty($event['end_time_local']) ? ' – ' . trim($event['end_time_local']) : ''; |
|
693 | + } else { |
|
694 | + echo $txt['calendar_allday']; |
|
695 | + } |
|
670 | 696 | |
671 | 697 | echo ' |
672 | 698 | </span>'; |
673 | 699 | |
674 | - if (!empty($event['location'])) |
|
675 | - echo '<br> |
|
700 | + if (!empty($event['location'])) { |
|
701 | + echo '<br> |
|
676 | 702 | <span class="event_location', empty($event_icons_needed) ? ' floatright' : '', '">' . $event['location'] . '</span>'; |
703 | + } |
|
677 | 704 | |
678 | 705 | if (!empty($event_icons_needed)) |
679 | 706 | { |
@@ -712,8 +739,7 @@ discard block |
||
712 | 739 | </div> |
713 | 740 | <br class="clear">'; |
714 | 741 | } |
715 | - } |
|
716 | - else |
|
742 | + } else |
|
717 | 743 | { |
718 | 744 | if (!empty($context['can_post'])) |
719 | 745 | { |
@@ -728,8 +754,9 @@ discard block |
||
728 | 754 | <td class="', implode(' ', $classes), !empty($day['holidays']) ? ' holidays' : ' disabled', ' holiday_col" data-css-prefix="' . $txt['calendar_prompt'] . ' ">'; |
729 | 755 | |
730 | 756 | // Show any holidays! |
731 | - if (!empty($day['holidays'])) |
|
732 | - echo implode('<br>', $day['holidays']); |
|
757 | + if (!empty($day['holidays'])) { |
|
758 | + echo implode('<br>', $day['holidays']); |
|
759 | + } |
|
733 | 760 | |
734 | 761 | echo ' |
735 | 762 | </td> |
@@ -790,8 +817,7 @@ discard block |
||
790 | 817 | <input type="text" name="end_date" id="end_date" maxlength="10" value="', $calendar_data['end_date'], '" tabindex="', $context['tabindex']++, '" class="date_input end" data-type="date"> |
791 | 818 | <input type="submit" class="button" style="float:none" id="view_button" value="', $txt['view'], '"> |
792 | 819 | </form>'; |
793 | - } |
|
794 | - else |
|
820 | + } else |
|
795 | 821 | { |
796 | 822 | echo' |
797 | 823 | <form action="', $scripturl, '?action=calendar" id="calendar_navigation" method="post" accept-charset="', $context['character_set'], '"> |
@@ -835,9 +861,10 @@ discard block |
||
835 | 861 | echo ' |
836 | 862 | <form action="', $scripturl, '?action=calendar;sa=post" method="post" name="postevent" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);" style="margin: 0;">'; |
837 | 863 | |
838 | - if (!empty($context['event']['new'])) |
|
839 | - echo ' |
|
864 | + if (!empty($context['event']['new'])) { |
|
865 | + echo ' |
|
840 | 866 | <input type="hidden" name="eventid" value="', $context['event']['eventid'], '">'; |
867 | + } |
|
841 | 868 | |
842 | 869 | // Start the main table. |
843 | 870 | echo ' |
@@ -889,9 +916,10 @@ discard block |
||
889 | 916 | echo ' |
890 | 917 | <optgroup label="', $category['name'], '">'; |
891 | 918 | |
892 | - foreach ($category['boards'] as $board) |
|
893 | - echo ' |
|
919 | + foreach ($category['boards'] as $board) { |
|
920 | + echo ' |
|
894 | 921 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], ' </option>'; |
922 | + } |
|
895 | 923 | echo ' |
896 | 924 | </optgroup>'; |
897 | 925 | } |
@@ -927,9 +955,10 @@ discard block |
||
927 | 955 | <span class="label">', $txt['calendar_timezone'], '</span> |
928 | 956 | <select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>'; |
929 | 957 | |
930 | - foreach ($context['all_timezones'] as $tz => $tzname) |
|
931 | - echo ' |
|
958 | + foreach ($context['all_timezones'] as $tz => $tzname) { |
|
959 | + echo ' |
|
932 | 960 | <option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>'; |
961 | + } |
|
933 | 962 | |
934 | 963 | echo ' |
935 | 964 | </select> |
@@ -945,9 +974,10 @@ discard block |
||
945 | 974 | <input type="submit" value="', empty($context['event']['new']) ? $txt['save'] : $txt['post'], '" class="button">'; |
946 | 975 | |
947 | 976 | // Delete button? |
948 | - if (empty($context['event']['new'])) |
|
949 | - echo ' |
|
977 | + if (empty($context['event']['new'])) { |
|
978 | + echo ' |
|
950 | 979 | <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['calendar_confirm_delete'], '" class="button you_sure">'; |
980 | + } |
|
951 | 981 | |
952 | 982 | echo ' |
953 | 983 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -999,9 +1029,10 @@ discard block |
||
999 | 1029 | |
1000 | 1030 | foreach ($context['clockicons'] as $t => $v) |
1001 | 1031 | { |
1002 | - foreach ($v as $i) |
|
1003 | - echo ' |
|
1032 | + foreach ($v as $i) { |
|
1033 | + echo ' |
|
1004 | 1034 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1035 | + } |
|
1005 | 1036 | } |
1006 | 1037 | |
1007 | 1038 | echo ' |
@@ -1026,13 +1057,14 @@ discard block |
||
1026 | 1057 | |
1027 | 1058 | foreach ($context['clockicons'] as $t => $v) |
1028 | 1059 | { |
1029 | - foreach ($v as $i) |
|
1030 | - echo ' |
|
1060 | + foreach ($v as $i) { |
|
1061 | + echo ' |
|
1031 | 1062 | if (', $t, ' >= ', $i, ') |
1032 | 1063 | { |
1033 | 1064 | turnon.push("', $t, '_', $i, '"); |
1034 | 1065 | ', $t, ' -= ', $i, '; |
1035 | 1066 | }'; |
1067 | + } |
|
1036 | 1068 | } |
1037 | 1069 | |
1038 | 1070 | echo ' |
@@ -1100,9 +1132,10 @@ discard block |
||
1100 | 1132 | |
1101 | 1133 | foreach ($context['clockicons'] as $t => $v) |
1102 | 1134 | { |
1103 | - foreach ($v as $i) |
|
1104 | - echo ' |
|
1135 | + foreach ($v as $i) { |
|
1136 | + echo ' |
|
1105 | 1137 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1138 | + } |
|
1106 | 1139 | } |
1107 | 1140 | |
1108 | 1141 | echo ' |
@@ -1119,13 +1152,14 @@ discard block |
||
1119 | 1152 | |
1120 | 1153 | foreach ($context['clockicons'] as $t => $v) |
1121 | 1154 | { |
1122 | - foreach ($v as $i) |
|
1123 | - echo ' |
|
1155 | + foreach ($v as $i) { |
|
1156 | + echo ' |
|
1124 | 1157 | if (', $t, ' >= ', $i, ') |
1125 | 1158 | { |
1126 | 1159 | turnon.push("', $t, '_', $i, '"); |
1127 | 1160 | ', $t, ' -= ', $i, '; |
1128 | 1161 | }'; |
1162 | + } |
|
1129 | 1163 | } |
1130 | 1164 | |
1131 | 1165 | echo ' |
@@ -1188,9 +1222,10 @@ discard block |
||
1188 | 1222 | |
1189 | 1223 | foreach ($context['clockicons'] as $t => $v) |
1190 | 1224 | { |
1191 | - foreach ($v as $i) |
|
1192 | - echo ' |
|
1225 | + foreach ($v as $i) { |
|
1226 | + echo ' |
|
1193 | 1227 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
1228 | + } |
|
1194 | 1229 | } |
1195 | 1230 | |
1196 | 1231 | echo ' |
@@ -1211,13 +1246,14 @@ discard block |
||
1211 | 1246 | |
1212 | 1247 | foreach ($context['clockicons'] as $t => $v) |
1213 | 1248 | { |
1214 | - foreach ($v as $i) |
|
1215 | - echo ' |
|
1249 | + foreach ($v as $i) { |
|
1250 | + echo ' |
|
1216 | 1251 | if (', $t, ' >= ', $i, ') |
1217 | 1252 | { |
1218 | 1253 | turnon.push("', $t, '_', $i, '"); |
1219 | 1254 | ', $t, ' -= ', $i, '; |
1220 | 1255 | }'; |
1256 | + } |
|
1221 | 1257 | } |
1222 | 1258 | |
1223 | 1259 | echo ' |
@@ -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 | * Downloads an avatar or attachment based on $_GET['attach'], and increments the download count. |
@@ -40,11 +41,11 @@ discard block |
||
40 | 41 | |
41 | 42 | if (!empty($modSettings['enableCompressedOutput']) && !headers_sent() && ob_get_length() == 0) |
42 | 43 | { |
43 | - if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') |
|
44 | - $modSettings['enableCompressedOutput'] = 0; |
|
45 | - |
|
46 | - else |
|
47 | - ob_start('ob_gzhandler'); |
|
44 | + if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') { |
|
45 | + $modSettings['enableCompressedOutput'] = 0; |
|
46 | + } else { |
|
47 | + ob_start('ob_gzhandler'); |
|
48 | + } |
|
48 | 49 | } |
49 | 50 | |
50 | 51 | if (empty($modSettings['enableCompressedOutput'])) |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | } |
77 | 78 | |
78 | 79 | // Use cache when possible. |
79 | - if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) |
|
80 | - list($file, $thumbFile) = $cache; |
|
80 | + if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) { |
|
81 | + list($file, $thumbFile) = $cache; |
|
82 | + } |
|
81 | 83 | |
82 | 84 | // Get the info from the DB. |
83 | 85 | if (empty($file) || empty($thumbFile) && !empty($file['id_thumb'])) |
@@ -85,10 +87,9 @@ discard block |
||
85 | 87 | // Do we have a hook wanting to use our attachment system? We use $attachRequest to prevent accidental usage of $request. |
86 | 88 | $attachRequest = null; |
87 | 89 | call_integration_hook('integrate_download_request', array(&$attachRequest)); |
88 | - if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) |
|
89 | - $request = $attachRequest; |
|
90 | - |
|
91 | - else |
|
90 | + if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) { |
|
91 | + $request = $attachRequest; |
|
92 | + } else |
|
92 | 93 | { |
93 | 94 | // Make sure this attachment is on this board and load its info while we are at it. |
94 | 95 | $request = $smcFunc['db_query']('', ' |
@@ -181,13 +182,15 @@ discard block |
||
181 | 182 | } |
182 | 183 | |
183 | 184 | // Cache it. |
184 | - if (!empty($file) || !empty($thumbFile)) |
|
185 | - cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900)); |
|
185 | + if (!empty($file) || !empty($thumbFile)) { |
|
186 | + cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900)); |
|
187 | + } |
|
186 | 188 | } |
187 | 189 | |
188 | 190 | // Replace the normal file with its thumbnail if it has one! |
189 | - if (!empty($showThumb) && !empty($thumbFile)) |
|
190 | - $file = $thumbFile; |
|
191 | + if (!empty($showThumb) && !empty($thumbFile)) { |
|
192 | + $file = $thumbFile; |
|
193 | + } |
|
191 | 194 | |
192 | 195 | // No point in a nicer message, because this is supposed to be an attachment anyway... |
193 | 196 | if (!file_exists($file['filePath'])) |
@@ -237,8 +240,8 @@ discard block |
||
237 | 240 | } |
238 | 241 | |
239 | 242 | // Update the download counter (unless it's a thumbnail or resuming an incomplete download). |
240 | - if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) |
|
241 | - $smcFunc['db_query']('', ' |
|
243 | + if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) { |
|
244 | + $smcFunc['db_query']('', ' |
|
242 | 245 | UPDATE {db_prefix}attachments |
243 | 246 | SET downloads = downloads + 1 |
244 | 247 | WHERE id_attach = {int:id_attach}', |
@@ -246,12 +249,14 @@ discard block |
||
246 | 249 | 'id_attach' => $attachId, |
247 | 250 | ) |
248 | 251 | ); |
252 | + } |
|
249 | 253 | |
250 | 254 | // Send the attachment headers. |
251 | 255 | header('Pragma: '); |
252 | 256 | |
253 | - if (!isBrowser('gecko')) |
|
254 | - header('Content-Transfer-Encoding: binary'); |
|
257 | + if (!isBrowser('gecko')) { |
|
258 | + header('Content-Transfer-Encoding: binary'); |
|
259 | + } |
|
255 | 260 | |
256 | 261 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT'); |
257 | 262 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file['filePath'])) . ' GMT'); |
@@ -260,18 +265,19 @@ discard block |
||
260 | 265 | header('ETag: ' . $eTag); |
261 | 266 | |
262 | 267 | // Make sure the mime type warrants an inline display. |
263 | - if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) |
|
264 | - unset($_REQUEST['image']); |
|
268 | + if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) { |
|
269 | + unset($_REQUEST['image']); |
|
270 | + } |
|
265 | 271 | |
266 | 272 | // Does this have a mime type? |
267 | - elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) |
|
268 | - header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp'))); |
|
269 | - |
|
270 | - else |
|
273 | + elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) { |
|
274 | + header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp'))); |
|
275 | + } else |
|
271 | 276 | { |
272 | 277 | header('Content-Type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream')); |
273 | - if (isset($_REQUEST['image'])) |
|
274 | - unset($_REQUEST['image']); |
|
278 | + if (isset($_REQUEST['image'])) { |
|
279 | + unset($_REQUEST['image']); |
|
280 | + } |
|
275 | 281 | } |
276 | 282 | |
277 | 283 | // Convert the file to UTF-8, cuz most browsers dig that. |
@@ -279,24 +285,22 @@ discard block |
||
279 | 285 | $disposition = !isset($_REQUEST['image']) ? 'attachment' : 'inline'; |
280 | 286 | |
281 | 287 | // Different browsers like different standards... |
282 | - if (isBrowser('firefox')) |
|
283 | - header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name))); |
|
284 | - |
|
285 | - elseif (isBrowser('opera')) |
|
286 | - header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"'); |
|
287 | - |
|
288 | - elseif (isBrowser('ie')) |
|
289 | - header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"'); |
|
290 | - |
|
291 | - else |
|
292 | - header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"'); |
|
288 | + if (isBrowser('firefox')) { |
|
289 | + header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name))); |
|
290 | + } elseif (isBrowser('opera')) { |
|
291 | + header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"'); |
|
292 | + } elseif (isBrowser('ie')) { |
|
293 | + header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"'); |
|
294 | + } else { |
|
295 | + header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"'); |
|
296 | + } |
|
293 | 297 | |
294 | 298 | // If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE. |
295 | - if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) |
|
296 | - header('Cache-Control: no-cache'); |
|
297 | - |
|
298 | - else |
|
299 | - header('Cache-Control: max-age=' . (525600 * 60) . ', private'); |
|
299 | + if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) { |
|
300 | + header('Cache-Control: no-cache'); |
|
301 | + } else { |
|
302 | + header('Cache-Control: max-age=' . (525600 * 60) . ', private'); |
|
303 | + } |
|
300 | 304 | |
301 | 305 | // Multipart and resuming support |
302 | 306 | if (isset($_SERVER['HTTP_RANGE'])) |
@@ -304,9 +308,9 @@ discard block |
||
304 | 308 | header("HTTP/1.1 206 Partial Content"); |
305 | 309 | header("Content-Length: $new_length"); |
306 | 310 | header("Content-Range: bytes $range-$range_end/$size"); |
311 | + } else { |
|
312 | + header("Content-Length: " . $size); |
|
307 | 313 | } |
308 | - else |
|
309 | - header("Content-Length: " . $size); |
|
310 | 314 | |
311 | 315 | |
312 | 316 | // Try to buy some time... |
@@ -315,8 +319,9 @@ discard block |
||
315 | 319 | // For multipart/resumable downloads, send the requested chunk(s) of the file |
316 | 320 | if (isset($_SERVER['HTTP_RANGE'])) |
317 | 321 | { |
318 | - while (@ob_get_level() > 0) |
|
319 | - @ob_end_clean(); |
|
322 | + while (@ob_get_level() > 0) { |
|
323 | + @ob_end_clean(); |
|
324 | + } |
|
320 | 325 | |
321 | 326 | // 40 kilobytes is a good-ish amount |
322 | 327 | $chunksize = 40 * 1024; |
@@ -340,8 +345,9 @@ discard block |
||
340 | 345 | elseif ($size > 4194304) |
341 | 346 | { |
342 | 347 | // Forcibly end any output buffering going on. |
343 | - while (@ob_get_level() > 0) |
|
344 | - @ob_end_clean(); |
|
348 | + while (@ob_get_level() > 0) { |
|
349 | + @ob_end_clean(); |
|
350 | + } |
|
345 | 351 | |
346 | 352 | $fp = fopen($file['filePath'], 'rb'); |
347 | 353 | while (!feof($fp)) |
@@ -353,8 +359,9 @@ discard block |
||
353 | 359 | } |
354 | 360 | |
355 | 361 | // On some of the less-bright hosts, readfile() is disabled. It's just a faster, more byte safe, version of what's in the if. |
356 | - elseif (@readfile($file['filePath']) === null) |
|
357 | - echo file_get_contents($file['filePath']); |
|
362 | + elseif (@readfile($file['filePath']) === null) { |
|
363 | + echo file_get_contents($file['filePath']); |
|
364 | + } |
|
358 | 365 | |
359 | 366 | die(); |
360 | 367 | } |