@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | <meta charset="', $context['character_set'], '"> |
25 | 25 | <meta name="robots" content="noindex"> |
26 | 26 | <title>', $context['page_title'], '</title> |
27 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'"> |
|
28 | - <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'] ,'"></script> |
|
27 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '"> |
|
28 | + <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'], '"></script> |
|
29 | 29 | </head> |
30 | 30 | <body id="help_popup"> |
31 | 31 | <div class="windowbg description"> |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | <title>', $txt['find_members'], '</title> |
51 | 51 | <meta charset="', $context['character_set'], '"> |
52 | 52 | <meta name="robots" content="noindex"> |
53 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'"> |
|
54 | - <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'] ,'"></script> |
|
53 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '"> |
|
54 | + <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'], '"></script> |
|
55 | 55 | <script> |
56 | 56 | var membersAdded = []; |
57 | 57 | function addMember(name) |
@@ -86,9 +86,10 @@ discard block |
||
86 | 86 | <span class="smalltext"><em>', $txt['find_wildcards'], '</em></span><br>'; |
87 | 87 | |
88 | 88 | // Only offer to search for buddies if we have some! |
89 | - if (!empty($context['show_buddies'])) |
|
90 | - echo ' |
|
89 | + if (!empty($context['show_buddies'])) { |
|
90 | + echo ' |
|
91 | 91 | <span class="smalltext"><label for="buddies"><input type="checkbox" class="input_check" name="buddies" id="buddies"', !empty($context['buddy_search']) ? ' checked' : '', '> ', $txt['find_buddies'], '</label></span><br>'; |
92 | + } |
|
92 | 93 | |
93 | 94 | echo ' |
94 | 95 | <div class="padding righttext"> |
@@ -103,10 +104,10 @@ discard block |
||
103 | 104 | <h3 class="catbg">', $txt['find_results'], '</h3> |
104 | 105 | </div>'; |
105 | 106 | |
106 | - if (empty($context['results'])) |
|
107 | - echo ' |
|
107 | + if (empty($context['results'])) { |
|
108 | + echo ' |
|
108 | 109 | <p class="error">', $txt['find_no_results'], '</p>'; |
109 | - else |
|
110 | + } else |
|
110 | 111 | { |
111 | 112 | echo ' |
112 | 113 | <ul class="padding">'; |
@@ -135,11 +136,12 @@ discard block |
||
135 | 136 | <input type="hidden" name="quote" value="', $context['quote_results'] ? '1' : '0', '"> |
136 | 137 | </form>'; |
137 | 138 | |
138 | - if (empty($context['results'])) |
|
139 | - echo ' |
|
139 | + if (empty($context['results'])) { |
|
140 | + echo ' |
|
140 | 141 | <script> |
141 | 142 | document.getElementById("search").focus(); |
142 | 143 | </script>'; |
144 | + } |
|
143 | 145 | |
144 | 146 | echo ' |
145 | 147 | </body> |
@@ -183,8 +185,8 @@ discard block |
||
183 | 185 | { |
184 | 186 | global $txt, $context, $modSettings; |
185 | 187 | |
186 | - if (!empty($modSettings['requireAgreement'])) |
|
187 | - echo ' |
|
188 | + if (!empty($modSettings['requireAgreement'])) { |
|
189 | + echo ' |
|
188 | 190 | <div class="cat_bar"> |
189 | 191 | <h3 class="catbg"> |
190 | 192 | ', $txt['terms_and_rules'], ' - ', $context['forum_name_html_safe'], ' |
@@ -193,11 +195,12 @@ discard block |
||
193 | 195 | <div class="roundframe"> |
194 | 196 | ', $context['agreement'], ' |
195 | 197 | </div>'; |
196 | - else |
|
197 | - echo ' |
|
198 | + } else { |
|
199 | + echo ' |
|
198 | 200 | <div class="noticebox"> |
199 | 201 | ', $txt['agreement_disabled'], ' |
200 | 202 | </div>'; |
201 | -} |
|
203 | + } |
|
204 | + } |
|
202 | 205 | |
203 | 206 | ?> |
204 | 207 | \ No newline at end of file |
@@ -18,11 +18,12 @@ discard block |
||
18 | 18 | global $context, $txt, $scripturl, $modSettings; |
19 | 19 | |
20 | 20 | // If maintenance has finished tell the user. |
21 | - if (!empty($context['maintenance_finished'])) |
|
22 | - echo ' |
|
21 | + if (!empty($context['maintenance_finished'])) { |
|
22 | + echo ' |
|
23 | 23 | <div class="infobox"> |
24 | 24 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
25 | 25 | </div>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | echo ' |
28 | 29 | <div id="manage_maintenance"> |
@@ -107,11 +108,12 @@ discard block |
||
107 | 108 | <div id="manage_maintenance">'; |
108 | 109 | |
109 | 110 | // If maintenance has finished tell the user. |
110 | - if (!empty($context['maintenance_finished'])) |
|
111 | - echo ' |
|
111 | + if (!empty($context['maintenance_finished'])) { |
|
112 | + echo ' |
|
112 | 113 | <div class="infobox"> |
113 | 114 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
114 | 115 | </div>'; |
116 | + } |
|
115 | 117 | |
116 | 118 | echo ' |
117 | 119 | <div class="cat_bar"> |
@@ -238,11 +240,12 @@ discard block |
||
238 | 240 | <div id="manage_maintenance">'; |
239 | 241 | |
240 | 242 | // If maintenance has finished tell the user. |
241 | - if (!empty($context['maintenance_finished'])) |
|
242 | - echo ' |
|
243 | + if (!empty($context['maintenance_finished'])) { |
|
244 | + echo ' |
|
243 | 245 | <div class="infobox"> |
244 | 246 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
245 | 247 | </div>'; |
248 | + } |
|
246 | 249 | |
247 | 250 | echo ' |
248 | 251 | <div class="cat_bar"> |
@@ -300,9 +303,10 @@ discard block |
||
300 | 303 | <p><a href="#membersLink" onclick="swapMembers();"><img src="', $settings['images_url'], '/selected.png" alt="+" id="membersIcon"></a> <a href="#membersLink" onclick="swapMembers();" id="membersText" style="font-weight: bold;">', $txt['maintain_members_all'], '</a></p> |
301 | 304 | <div style="display: none; padding: 3px" id="membersPanel">'; |
302 | 305 | |
303 | - foreach ($context['membergroups'] as $group) |
|
304 | - echo ' |
|
306 | + foreach ($context['membergroups'] as $group) { |
|
307 | + echo ' |
|
305 | 308 | <label for="groups', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups', $group['id'], '" checked class="input_check"> ', $group['name'], '</label><br>'; |
309 | + } |
|
306 | 310 | |
307 | 311 | echo ' |
308 | 312 | </div> |
@@ -346,11 +350,12 @@ discard block |
||
346 | 350 | global $scripturl, $txt, $context, $settings, $modSettings; |
347 | 351 | |
348 | 352 | // If maintenance has finished tell the user. |
349 | - if (!empty($context['maintenance_finished'])) |
|
350 | - echo ' |
|
353 | + if (!empty($context['maintenance_finished'])) { |
|
354 | + echo ' |
|
351 | 355 | <div class="infobox"> |
352 | 356 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
353 | 357 | </div>'; |
358 | + } |
|
354 | 359 | |
355 | 360 | // Bit of javascript for showing which boards to prune in an otherwise hidden list. |
356 | 361 | echo ' |
@@ -418,19 +423,21 @@ discard block |
||
418 | 423 | <ul>'; |
419 | 424 | |
420 | 425 | // Display a checkbox with every board. |
421 | - foreach ($category['boards'] as $board) |
|
422 | - echo ' |
|
426 | + foreach ($category['boards'] as $board) { |
|
427 | + echo ' |
|
423 | 428 | <li style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'] * 1.5, 'em;"><label for="boards_', $board['id'], '"><input type="checkbox" name="boards[', $board['id'], ']" id="boards_', $board['id'], '" checked class="input_check">', $board['name'], '</label></li>'; |
429 | + } |
|
424 | 430 | |
425 | 431 | echo ' |
426 | 432 | </ul> |
427 | 433 | </fieldset>'; |
428 | 434 | |
429 | 435 | // Increase $i, and check if we're at the middle yet. |
430 | - if (++$i == $middle) |
|
431 | - echo ' |
|
436 | + if (++$i == $middle) { |
|
437 | + echo ' |
|
432 | 438 | </div> |
433 | 439 | <div class="floatright" style="width: 49%;">'; |
440 | + } |
|
434 | 441 | } |
435 | 442 | |
436 | 443 | echo ' |
@@ -469,9 +476,10 @@ discard block |
||
469 | 476 | echo ' |
470 | 477 | <optgroup label="', $category['name'], '">'; |
471 | 478 | |
472 | - foreach ($category['boards'] as $board) |
|
473 | - echo ' |
|
479 | + foreach ($category['boards'] as $board) { |
|
480 | + echo ' |
|
474 | 481 | <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=> ', $board['name'], '</option>'; |
482 | + } |
|
475 | 483 | |
476 | 484 | echo ' |
477 | 485 | </optgroup>'; |
@@ -489,9 +497,10 @@ discard block |
||
489 | 497 | echo ' |
490 | 498 | <optgroup label="', $category['name'], '">'; |
491 | 499 | |
492 | - foreach ($category['boards'] as $board) |
|
493 | - echo ' |
|
500 | + foreach ($category['boards'] as $board) { |
|
501 | + echo ' |
|
494 | 502 | <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=> ', $board['name'], '</option>'; |
503 | + } |
|
495 | 504 | |
496 | 505 | echo ' |
497 | 506 | </optgroup>'; |
@@ -531,9 +540,10 @@ discard block |
||
531 | 540 | ', $txt['database_optimize_attempt'], '<br>'; |
532 | 541 | |
533 | 542 | // List each table being optimized... |
534 | - foreach ($context['optimized_tables'] as $table) |
|
535 | - echo ' |
|
543 | + foreach ($context['optimized_tables'] as $table) { |
|
544 | + echo ' |
|
536 | 545 | ', sprintf($txt['database_optimizing'], $table['name'], $table['data_freed']), '<br>'; |
546 | + } |
|
537 | 547 | |
538 | 548 | // How did we go? |
539 | 549 | echo ' |
@@ -590,13 +600,14 @@ discard block |
||
590 | 600 | ', implode('</li><li>', $context['exceeding_messages']), ' |
591 | 601 | </li> |
592 | 602 | </ul>'; |
593 | - if (!empty($context['exceeding_messages_morethan'])) |
|
594 | - echo ' |
|
603 | + if (!empty($context['exceeding_messages_morethan'])) { |
|
604 | + echo ' |
|
595 | 605 | <p>', $context['exceeding_messages_morethan'], '</p>'; |
596 | - } |
|
597 | - else |
|
598 | - echo ' |
|
606 | + } |
|
607 | + } else { |
|
608 | + echo ' |
|
599 | 609 | <p class="infobox">', $txt['convert_to_text'], '</p>'; |
610 | + } |
|
600 | 611 | |
601 | 612 | echo ' |
602 | 613 | <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertmsgbody" method="post" accept-charset="', $context['character_set'], '"> |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | </div> |
102 | 102 | <ul id="messages_not_selected" class="split_messages smalltext">'; |
103 | 103 | |
104 | - foreach ($context['not_selected']['messages'] as $message) |
|
105 | - echo ' |
|
104 | + foreach ($context['not_selected']['messages'] as $message) { |
|
105 | + echo ' |
|
106 | 106 | <li class="windowbg" id="not_selected_', $message['id'], '"> |
107 | 107 | <div class="message_header"> |
108 | 108 | <a class="split_icon floatright" href="', $scripturl, '?action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=down;msg=', $message['id'], '" onclick="return select(\'down\', ', $message['id'], ');"><span class="generic_icons split_sel" title="->"></span></a> |
@@ -111,6 +111,7 @@ discard block |
||
111 | 111 | </div> |
112 | 112 | <div class="post">', $message['body'], '</div> |
113 | 113 | </li>'; |
114 | + } |
|
114 | 115 | |
115 | 116 | echo ' |
116 | 117 | <li class="dummy"> |
@@ -130,8 +131,8 @@ discard block |
||
130 | 131 | </div> |
131 | 132 | <ul id="messages_selected" class="split_messages smalltext">'; |
132 | 133 | |
133 | - if (!empty($context['selected']['messages'])) |
|
134 | - foreach ($context['selected']['messages'] as $message) |
|
134 | + if (!empty($context['selected']['messages'])) { |
|
135 | + foreach ($context['selected']['messages'] as $message) |
|
135 | 136 | echo ' |
136 | 137 | <li class="windowbg" id="selected_', $message['id'], '"> |
137 | 138 | <div class="message_header"> |
@@ -141,6 +142,7 @@ discard block |
||
141 | 142 | </div> |
142 | 143 | <div class="post">', $message['body'], '</div> |
143 | 144 | </li>'; |
145 | + } |
|
144 | 146 | |
145 | 147 | echo ' |
146 | 148 | <li class="dummy"> |
@@ -28,14 +28,16 @@ discard block |
||
28 | 28 | <form class="login" action="', $context['login_url'], '" name="frmLogin" id="frmLogin" method="post" accept-charset="', $context['character_set'], '">'; |
29 | 29 | |
30 | 30 | // Did they make a mistake last time? |
31 | - if (!empty($context['login_errors'])) |
|
32 | - echo ' |
|
31 | + if (!empty($context['login_errors'])) { |
|
32 | + echo ' |
|
33 | 33 | <div class="errorbox">', implode('<br>', $context['login_errors']), '</div><br>'; |
34 | + } |
|
34 | 35 | |
35 | 36 | // Or perhaps there's some special description for this time? |
36 | - if (isset($context['description'])) |
|
37 | - echo ' |
|
37 | + if (isset($context['description'])) { |
|
38 | + echo ' |
|
38 | 39 | <div class="information">', $context['description'], '</div>'; |
40 | + } |
|
39 | 41 | |
40 | 42 | // Now just get the basic information - username, password, etc. |
41 | 43 | echo ' |
@@ -51,10 +53,11 @@ discard block |
||
51 | 53 | <dt>', $txt['always_logged_in'], ':</dt> |
52 | 54 | <dd><input type="checkbox" name="cookieneverexp"', $context['never_expire'] ? ' checked' : '', ' class="input_check" onclick="this.form.cookielength.disabled = this.checked;"></dd>'; |
53 | 55 | // If they have deleted their account, give them a chance to change their mind. |
54 | - if (isset($context['login_show_undelete'])) |
|
55 | - echo ' |
|
56 | + if (isset($context['login_show_undelete'])) { |
|
57 | + echo ' |
|
56 | 58 | <dt class="alert">', $txt['undelete_account'], ':</dt> |
57 | 59 | <dd><input type="checkbox" name="undelete" class="input_check"></dd>'; |
60 | + } |
|
58 | 61 | echo ' |
59 | 62 | </dl> |
60 | 63 | <p><input type="submit" value="', $txt['login'], '" class="button_submit"></p> |
@@ -66,8 +69,8 @@ discard block |
||
66 | 69 | setTimeout(function() { |
67 | 70 | document.getElementById("', !empty($context['from_ajax']) ? 'ajax_' : '', isset($context['default_username']) && $context['default_username'] != '' ? 'loginpass' : 'loginuser', '").focus(); |
68 | 71 | }, 150);'; |
69 | - if (!empty($context['from_ajax']) && (empty($modSettings['force_ssl']) || $modSettings['force_ssl'] == 2)) |
|
70 | - echo ' |
|
72 | + if (!empty($context['from_ajax']) && (empty($modSettings['force_ssl']) || $modSettings['force_ssl'] == 2)) { |
|
73 | + echo ' |
|
71 | 74 | form = $("#frmLogin"); |
72 | 75 | form.submit(function(e) { |
73 | 76 | e.preventDefault(); |
@@ -100,16 +103,18 @@ discard block |
||
100 | 103 | |
101 | 104 | return false; |
102 | 105 | });'; |
106 | + } |
|
103 | 107 | |
104 | 108 | echo ' |
105 | 109 | </script> |
106 | 110 | </form>'; |
107 | 111 | |
108 | 112 | // It is a long story as to why we have this when we're clearly not going to use it. |
109 | - if (!empty($context['from_ajax'])) |
|
110 | - echo ' |
|
113 | + if (!empty($context['from_ajax'])) { |
|
114 | + echo ' |
|
111 | 115 | <br> |
112 | 116 | <a href="javascript:self.close();"></a>'; |
117 | + } |
|
113 | 118 | echo ' |
114 | 119 | </div> |
115 | 120 | </div>'; |
@@ -130,9 +135,10 @@ discard block |
||
130 | 135 | </h3> |
131 | 136 | </div> |
132 | 137 | <div class="roundframe noup">'; |
133 | - if (!empty($context['tfa_error']) || !empty($context['tfa_backup_error'])) |
|
134 | - echo ' |
|
138 | + if (!empty($context['tfa_error']) || !empty($context['tfa_backup_error'])) { |
|
139 | + echo ' |
|
135 | 140 | <div class="error">', $txt['tfa_' . (!empty($context['tfa_error']) ? 'code_' : 'backup_') . 'invalid'], '</div>'; |
141 | + } |
|
136 | 142 | echo ' |
137 | 143 | <form action="', $context['tfa_url'], '" method="post" id="frmTfa"> |
138 | 144 | <div id="tfaCode"> |
@@ -155,8 +161,8 @@ discard block |
||
155 | 161 | </form> |
156 | 162 | <script> |
157 | 163 | form = $("#frmTfa");'; |
158 | - if (!empty($context['from_ajax'])) |
|
159 | - echo ' |
|
164 | + if (!empty($context['from_ajax'])) { |
|
165 | + echo ' |
|
160 | 166 | form.submit(function(e) { |
161 | 167 | // If we are submitting backup code, let normal workflow follow since it redirects a couple times into a different page |
162 | 168 | if (form.find("input[name=tfa_backup]:first").val().length > 0) |
@@ -175,6 +181,7 @@ discard block |
||
175 | 181 | |
176 | 182 | return false; |
177 | 183 | });'; |
184 | + } |
|
178 | 185 | echo ' |
179 | 186 | form.find("input[name=backup]").click(function(e) { |
180 | 187 | $("#tfaBackup").show(); |
@@ -206,10 +213,11 @@ discard block |
||
206 | 213 | ', empty($context['kick_message']) ? $txt['only_members_can_access'] : $context['kick_message'], '<br>'; |
207 | 214 | |
208 | 215 | |
209 | - if ($context['can_register']) |
|
210 | - echo sprintf($txt['login_below_or_register'], $scripturl . '?action=signup', $context['forum_name_html_safe']); |
|
211 | - else |
|
212 | - echo $txt['login_below']; |
|
216 | + if ($context['can_register']) { |
|
217 | + echo sprintf($txt['login_below_or_register'], $scripturl . '?action=signup', $context['forum_name_html_safe']); |
|
218 | + } else { |
|
219 | + echo $txt['login_below']; |
|
220 | + } |
|
213 | 221 | |
214 | 222 | // And now the login information. |
215 | 223 | echo ' |
@@ -305,9 +313,10 @@ discard block |
||
305 | 313 | </div> |
306 | 314 | <div class="roundframe centertext noup">'; |
307 | 315 | |
308 | - if (!empty($context['incorrect_password'])) |
|
309 | - echo ' |
|
316 | + if (!empty($context['incorrect_password'])) { |
|
317 | + echo ' |
|
310 | 318 | <div class="error">', $txt['admin_incorrect_password'], '</div>'; |
319 | + } |
|
311 | 320 | |
312 | 321 | echo ' |
313 | 322 | <strong>', $txt['password'], ':</strong> |
@@ -347,11 +356,12 @@ discard block |
||
347 | 356 | <div class="roundframe">'; |
348 | 357 | |
349 | 358 | // You didn't even have an ID? |
350 | - if (empty($context['member_id'])) |
|
351 | - echo ' |
|
359 | + if (empty($context['member_id'])) { |
|
360 | + echo ' |
|
352 | 361 | <dl> |
353 | 362 | <dt>', $txt['invalid_activation_username'], ':</dt> |
354 | 363 | <dd><input type="text" name="user" size="30" class="input_text"></dd>'; |
364 | + } |
|
355 | 365 | |
356 | 366 | echo ' |
357 | 367 | <dt>', $txt['invalid_activation_retry'], ':</dt> |
@@ -388,13 +398,14 @@ discard block |
||
388 | 398 | <dd><input type="password" name="passwd" size="30" class="input_password"></dd> |
389 | 399 | </dl>'; |
390 | 400 | |
391 | - if ($context['can_activate']) |
|
392 | - echo ' |
|
401 | + if ($context['can_activate']) { |
|
402 | + echo ' |
|
393 | 403 | <p>', $txt['invalid_activation_known'], '</p> |
394 | 404 | <dl> |
395 | 405 | <dt>', $txt['invalid_activation_retry'], ':</dt> |
396 | 406 | <dd><input type="text" name="code" size="30" class="input_text"></dd> |
397 | 407 | </dl>'; |
408 | + } |
|
398 | 409 | |
399 | 410 | echo ' |
400 | 411 | <p><input type="submit" value="', $txt['invalid_activation_resend'], '" class="button_submit"></p> |
@@ -20,12 +20,12 @@ |
||
20 | 20 | // We completed some tasks? |
21 | 21 | if (!empty($context['tasks_were_run'])) |
22 | 22 | { |
23 | - if (empty($context['scheduled_errors'])) |
|
24 | - echo ' |
|
23 | + if (empty($context['scheduled_errors'])) { |
|
24 | + echo ' |
|
25 | 25 | <div class="infobox"> |
26 | 26 | ', $txt['scheduled_tasks_were_run'], ' |
27 | 27 | </div>'; |
28 | - else |
|
28 | + } else |
|
29 | 29 | { |
30 | 30 | echo ' |
31 | 31 | <div class="errorbox" id="errors"> |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | <subject is_first="', $context['message']['first_in_topic'] ? '1' : '0', '"><![CDATA[', cleanXml($context['message']['subject']), ']]></subject> |
75 | 75 | <body><![CDATA[', $context['message']['body'], ']]></body> |
76 | 76 | <success><![CDATA[', $txt['quick_modify_message'], ']]></success>'; |
77 | - } |
|
78 | - else |
|
79 | - echo ' |
|
77 | + } else { |
|
78 | + echo ' |
|
80 | 79 | <error in_subject="', $context['message']['error_in_subject'] ? '1' : '0', '" in_body="', cleanXml($context['message']['error_in_body']) ? '1' : '0', '"><![CDATA[', implode('<br />', $context['message']['errors']), ']]></error>'; |
80 | + } |
|
81 | 81 | echo ' |
82 | 82 | </message> |
83 | 83 | </smf>'; |
@@ -101,13 +101,14 @@ discard block |
||
101 | 101 | |
102 | 102 | echo ' |
103 | 103 | <modified><![CDATA[', empty($modified) ? '' : cleanXml('« <em>' . $modified . '</em>»'), ']]></modified>'; |
104 | - if (!empty($context['message']['subject'])) |
|
105 | - echo ' |
|
104 | + if (!empty($context['message']['subject'])) { |
|
105 | + echo ' |
|
106 | 106 | <subject><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>'; |
107 | - } |
|
108 | - else |
|
109 | - echo ' |
|
107 | + } |
|
108 | + } else { |
|
109 | + echo ' |
|
110 | 110 | <error in_subject="', $context['message']['error_in_subject'] ? '1' : '0', '"><![CDATA[', cleanXml(implode('<br />', $context['message']['errors'])), ']]></error>'; |
111 | + } |
|
111 | 112 | echo ' |
112 | 113 | </message> |
113 | 114 | </smf>'; |
@@ -127,10 +128,11 @@ discard block |
||
127 | 128 | <body><![CDATA[', $context['preview_message'], ']]></body> |
128 | 129 | </preview> |
129 | 130 | <errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '" topic_locked="', $context['locked'] ? '1' : '0', '">'; |
130 | - if (!empty($context['post_error'])) |
|
131 | - foreach ($context['post_error'] as $message) |
|
131 | + if (!empty($context['post_error'])) { |
|
132 | + foreach ($context['post_error'] as $message) |
|
132 | 133 | echo ' |
133 | 134 | <error><![CDATA[', cleanXml($message), ']]></error>'; |
135 | + } |
|
134 | 136 | echo ' |
135 | 137 | <caption name="guestname" class="', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? 'error' : '', '" /> |
136 | 138 | <caption name="email" class="', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? 'error' : '', '" /> |
@@ -145,14 +147,15 @@ discard block |
||
145 | 147 | { |
146 | 148 | echo ' |
147 | 149 | <new_posts>'; |
148 | - foreach ($context['previous_posts'] as $post) |
|
149 | - echo ' |
|
150 | + foreach ($context['previous_posts'] as $post) { |
|
151 | + echo ' |
|
150 | 152 | <post id="', $post['id'], '"> |
151 | 153 | <time><![CDATA[', $post['time'], ']]></time> |
152 | 154 | <poster><![CDATA[', cleanXml($post['poster']), ']]></poster> |
153 | 155 | <message><![CDATA[', cleanXml($post['message']), ']]></message> |
154 | 156 | <is_ignored>', $post['is_ignored'] ? '1' : '0', '</is_ignored> |
155 | 157 | </post>'; |
158 | + } |
|
156 | 159 | echo ' |
157 | 160 | </new_posts>'; |
158 | 161 | } |
@@ -176,10 +179,11 @@ discard block |
||
176 | 179 | <body><![CDATA[', $context['preview_message'], ']]></body> |
177 | 180 | </preview> |
178 | 181 | <errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '">'; |
179 | - if (!empty($context['post_error']['messages'])) |
|
180 | - foreach ($context['post_error']['messages'] as $message) |
|
182 | + if (!empty($context['post_error']['messages'])) { |
|
183 | + foreach ($context['post_error']['messages'] as $message) |
|
181 | 184 | echo ' |
182 | 185 | <error><![CDATA[', cleanXml($message), ']]></error>'; |
186 | + } |
|
183 | 187 | |
184 | 188 | echo ' |
185 | 189 | <caption name="to" class="', isset($context['post_error']['no_to']) ? 'error' : '', '" /> |
@@ -208,10 +212,11 @@ discard block |
||
208 | 212 | <body><![CDATA[', $context['preview_message'], ']]></body> |
209 | 213 | </preview> |
210 | 214 | <errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '">'; |
211 | - if (!empty($context['post_error']['messages'])) |
|
212 | - foreach ($context['post_error']['messages'] as $message) |
|
215 | + if (!empty($context['post_error']['messages'])) { |
|
216 | + foreach ($context['post_error']['messages'] as $message) |
|
213 | 217 | echo ' |
214 | 218 | <error><![CDATA[', cleanXml($message), ']]></error>'; |
219 | + } |
|
215 | 220 | |
216 | 221 | echo ' |
217 | 222 | </errors>'; |
@@ -227,19 +232,22 @@ discard block |
||
227 | 232 | { |
228 | 233 | global $context, $modSettings; |
229 | 234 | |
230 | - if (empty($context['yearly'])) |
|
231 | - return; |
|
235 | + if (empty($context['yearly'])) { |
|
236 | + return; |
|
237 | + } |
|
232 | 238 | |
233 | 239 | echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '> |
234 | 240 | <smf>'; |
235 | - foreach ($context['yearly'] as $year) |
|
236 | - foreach ($year['months'] as $month) |
|
241 | + foreach ($context['yearly'] as $year) { |
|
242 | + foreach ($year['months'] as $month) |
|
237 | 243 | { |
238 | 244 | echo ' |
239 | 245 | <month id="', $month['date']['year'], $month['date']['month'], '">'; |
240 | - foreach ($month['days'] as $day) |
|
241 | - echo ' |
|
246 | + } |
|
247 | + foreach ($month['days'] as $day) { |
|
248 | + echo ' |
|
242 | 249 | <day date="', $day['year'], '-', $day['month'], '-', $day['day'], '" new_topics="', $day['new_topics'], '" new_posts="', $day['new_posts'], '" new_members="', $day['new_members'], '" most_members_online="', $day['most_members_online'], '"', empty($modSettings['hitStats']) ? '' : ' hits="' . $day['hits'] . '"', ' />'; |
250 | + } |
|
243 | 251 | echo ' |
244 | 252 | </month>'; |
245 | 253 | } |
@@ -260,17 +268,18 @@ discard block |
||
260 | 268 | <pageIndex section="selected" startFrom="', $context['selected']['start'], '"><![CDATA[', $context['selected']['page_index'], ']]></pageIndex>'; |
261 | 269 | foreach ($context['changes'] as $change) |
262 | 270 | { |
263 | - if ($change['type'] == 'remove') |
|
264 | - echo ' |
|
271 | + if ($change['type'] == 'remove') { |
|
272 | + echo ' |
|
265 | 273 | <change id="', $change['id'], '" curAction="remove" section="', $change['section'], '" />'; |
266 | - else |
|
267 | - echo ' |
|
274 | + } else { |
|
275 | + echo ' |
|
268 | 276 | <change id="', $change['id'], '" curAction="insert" section="', $change['section'], '"> |
269 | 277 | <subject><![CDATA[', cleanXml($change['insert_value']['subject']), ']]></subject> |
270 | 278 | <time><![CDATA[', cleanXml($change['insert_value']['time']), ']]></time> |
271 | 279 | <body><![CDATA[', cleanXml($change['insert_value']['body']), ']]></body> |
272 | 280 | <poster><![CDATA[', cleanXml($change['insert_value']['poster']), ']]></poster> |
273 | 281 | </change>'; |
282 | + } |
|
274 | 283 | } |
275 | 284 | echo ' |
276 | 285 | </smf>'; |
@@ -301,10 +310,10 @@ discard block |
||
301 | 310 | echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '> |
302 | 311 | <smf>'; |
303 | 312 | |
304 | - if (empty($context['topics'])) |
|
305 | - echo ' |
|
313 | + if (empty($context['topics'])) { |
|
314 | + echo ' |
|
306 | 315 | <noresults>', $txt['search_no_results'], '</noresults>'; |
307 | - else |
|
316 | + } else |
|
308 | 317 | { |
309 | 318 | echo ' |
310 | 319 | <results>'; |
@@ -370,9 +379,10 @@ discard block |
||
370 | 379 | { |
371 | 380 | echo ' |
372 | 381 | <item type="category" id="', $category['id'], '"><![CDATA[', cleanXml($category['name']), ']]></item>'; |
373 | - foreach ($category['boards'] as $board) |
|
374 | - echo ' |
|
382 | + foreach ($category['boards'] as $board) { |
|
383 | + echo ' |
|
375 | 384 | <item type="board" id="', $board['id'], '" childlevel="', $board['child_level'], '"><![CDATA[', cleanXml($board['name']), ']]></item>'; |
385 | + } |
|
376 | 386 | } |
377 | 387 | echo ' |
378 | 388 | </smf>'; |
@@ -387,9 +397,10 @@ discard block |
||
387 | 397 | |
388 | 398 | echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '> |
389 | 399 | <smf>'; |
390 | - foreach ($context['icons'] as $icon) |
|
391 | - echo ' |
|
400 | + foreach ($context['icons'] as $icon) { |
|
401 | + echo ' |
|
392 | 402 | <icon value="', $icon['value'], '" url="', $icon['url'], '"><![CDATA[', cleanXml($icon['name']), ']]></icon>'; |
403 | + } |
|
393 | 404 | echo ' |
394 | 405 | </smf>'; |
395 | 406 | } |
@@ -438,16 +449,18 @@ discard block |
||
438 | 449 | foreach ($xml_data as $key => $data) |
439 | 450 | { |
440 | 451 | // A group? |
441 | - if (is_array($data) && isset($data['identifier'])) |
|
442 | - template_generic_xml_recursive($data['children'], $key, $data['identifier'], $level); |
|
452 | + if (is_array($data) && isset($data['identifier'])) { |
|
453 | + template_generic_xml_recursive($data['children'], $key, $data['identifier'], $level); |
|
454 | + } |
|
443 | 455 | // An item... |
444 | 456 | elseif (is_array($data) && isset($data['value'])) |
445 | 457 | { |
446 | 458 | echo "\n", str_repeat("\t", $level), '<', $child_ident; |
447 | 459 | |
448 | - if (!empty($data['attributes'])) |
|
449 | - foreach ($data['attributes'] as $k => $v) |
|
460 | + if (!empty($data['attributes'])) { |
|
461 | + foreach ($data['attributes'] as $k => $v) |
|
450 | 462 | echo ' ' . $k . '="' . $v . '"'; |
463 | + } |
|
451 | 464 | echo '><![CDATA[', cleanXml($data['value']), ']]></', $child_ident, '>'; |
452 | 465 | } |
453 | 466 |
@@ -31,9 +31,10 @@ discard block |
||
31 | 31 | <div class="selectbox floatright" id="upper_show">', $txt['who_show1'], ' |
32 | 32 | <select name="show_top" onchange="document.forms.whoFilter.show.value = this.value; document.forms.whoFilter.submit();">'; |
33 | 33 | |
34 | - foreach ($context['show_methods'] as $value => $label) |
|
35 | - echo ' |
|
34 | + foreach ($context['show_methods'] as $value => $label) { |
|
35 | + echo ' |
|
36 | 36 | <option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>'; |
37 | + } |
|
37 | 38 | echo ' |
38 | 39 | </select> |
39 | 40 | <noscript> |
@@ -71,9 +72,10 @@ discard block |
||
71 | 72 | ', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', ' |
72 | 73 | </span>'; |
73 | 74 | |
74 | - if (!empty($member['ip'])) |
|
75 | - echo ' |
|
75 | + if (!empty($member['ip'])) { |
|
76 | + echo ' |
|
76 | 77 | (<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)'; |
78 | + } |
|
77 | 79 | |
78 | 80 | echo ' |
79 | 81 | </td> |
@@ -103,9 +105,10 @@ discard block |
||
103 | 105 | <div class="selectbox floatright">', $txt['who_show1'], ' |
104 | 106 | <select name="show" onchange="document.forms.whoFilter.submit();">'; |
105 | 107 | |
106 | - foreach ($context['show_methods'] as $value => $label) |
|
107 | - echo ' |
|
108 | + foreach ($context['show_methods'] as $value => $label) { |
|
109 | + echo ' |
|
108 | 110 | <option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>'; |
111 | + } |
|
109 | 112 | echo ' |
110 | 113 | </select> |
111 | 114 | <noscript> |
@@ -134,17 +137,19 @@ discard block |
||
134 | 137 | |
135 | 138 | foreach ($context['credits'] as $section) |
136 | 139 | { |
137 | - if (isset($section['pretext'])) |
|
138 | - echo ' |
|
140 | + if (isset($section['pretext'])) { |
|
141 | + echo ' |
|
139 | 142 | <div class="windowbg noup"> |
140 | 143 | <p>', $section['pretext'], '</p> |
141 | 144 | </div>'; |
145 | + } |
|
142 | 146 | |
143 | - if (isset($section['title'])) |
|
144 | - echo ' |
|
147 | + if (isset($section['title'])) { |
|
148 | + echo ' |
|
145 | 149 | <div class="cat_bar"> |
146 | 150 | <h3 class="catbg">', $section['title'], '</h3> |
147 | 151 | </div>'; |
152 | + } |
|
148 | 153 | |
149 | 154 | echo ' |
150 | 155 | <div class="windowbg2 noup"> |
@@ -152,17 +157,18 @@ discard block |
||
152 | 157 | |
153 | 158 | foreach ($section['groups'] as $group) |
154 | 159 | { |
155 | - if (isset($group['title'])) |
|
156 | - echo ' |
|
160 | + if (isset($group['title'])) { |
|
161 | + echo ' |
|
157 | 162 | <dt> |
158 | 163 | <strong>', $group['title'], '</strong> |
159 | 164 | </dt> |
160 | 165 | <dd>'; |
166 | + } |
|
161 | 167 | |
162 | 168 | // Try to make this read nicely. |
163 | - if (count($group['members']) <= 2) |
|
164 | - echo implode(' ' . $txt['credits_and'] . ' ', $group['members']); |
|
165 | - else |
|
169 | + if (count($group['members']) <= 2) { |
|
170 | + echo implode(' ' . $txt['credits_and'] . ' ', $group['members']); |
|
171 | + } else |
|
166 | 172 | { |
167 | 173 | $last_peep = array_pop($group['members']); |
168 | 174 | echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep; |
@@ -175,9 +181,10 @@ discard block |
||
175 | 181 | echo ' |
176 | 182 | </dl>'; |
177 | 183 | |
178 | - if (isset($section['posttext'])) |
|
179 | - echo ' |
|
184 | + if (isset($section['posttext'])) { |
|
185 | + echo ' |
|
180 | 186 | <p class="posttext">', $section['posttext'], '</p>'; |
187 | + } |
|
181 | 188 | |
182 | 189 | echo ' |
183 | 190 | </div>'; |
@@ -192,26 +199,29 @@ discard block |
||
192 | 199 | </div> |
193 | 200 | <div class="windowbg noup">'; |
194 | 201 | |
195 | - if (!empty($context['credits_software_graphics']['graphics'])) |
|
196 | - echo ' |
|
202 | + if (!empty($context['credits_software_graphics']['graphics'])) { |
|
203 | + echo ' |
|
197 | 204 | <dl> |
198 | 205 | <dt><strong>', $txt['credits_graphics'], '</strong></dt> |
199 | 206 | <dd>', implode('</dd><dd>', $context['credits_software_graphics']['graphics']), '</dd> |
200 | 207 | </dl>'; |
208 | + } |
|
201 | 209 | |
202 | - if (!empty($context['credits_software_graphics']['software'])) |
|
203 | - echo ' |
|
210 | + if (!empty($context['credits_software_graphics']['software'])) { |
|
211 | + echo ' |
|
204 | 212 | <dl> |
205 | 213 | <dt><strong>', $txt['credits_software'], '</strong></dt> |
206 | 214 | <dd>', implode('</dd><dd>', $context['credits_software_graphics']['software']), '</dd> |
207 | 215 | </dl>'; |
216 | + } |
|
208 | 217 | |
209 | - if (!empty($context['credits_software_graphics']['fonts'])) |
|
210 | - echo ' |
|
218 | + if (!empty($context['credits_software_graphics']['fonts'])) { |
|
219 | + echo ' |
|
211 | 220 | <dl> |
212 | 221 | <dt><strong>', $txt['credits_fonts'], '</strong></dt> |
213 | 222 | <dd>', implode('</dd><dd>', $context['credits_software_graphics']['fonts']), '</dd> |
214 | 223 | </dl>'; |
224 | + } |
|
215 | 225 | echo ' |
216 | 226 | </div>'; |
217 | 227 | } |
@@ -226,16 +236,18 @@ discard block |
||
226 | 236 | <div class="windowbg noup">'; |
227 | 237 | |
228 | 238 | // Display the credits. |
229 | - if (!empty($context['credits_modifications'])) |
|
230 | - echo ' |
|
239 | + if (!empty($context['credits_modifications'])) { |
|
240 | + echo ' |
|
231 | 241 | ', implode(' |
232 | 242 | <br>', $context['credits_modifications']); |
243 | + } |
|
233 | 244 | |
234 | 245 | // Legacy. |
235 | - if (!empty($context['copyrights']['mods'])) |
|
236 | - echo (empty($context['credits_modifications']) ? '<br>' : ''), |
|
246 | + if (!empty($context['copyrights']['mods'])) { |
|
247 | + echo (empty($context['credits_modifications']) ? '<br>' : ''), |
|
237 | 248 | implode(' |
238 | 249 | <br>', $context['copyrights']['mods']); |
250 | + } |
|
239 | 251 | |
240 | 252 | echo ' |
241 | 253 | </div>'; |
@@ -44,10 +44,11 @@ discard block |
||
44 | 44 | <dt>', $txt['users_online_today'], ':</dt> |
45 | 45 | <dd>', $context['online_today'], '</dd>'; |
46 | 46 | |
47 | - if (!empty($modSettings['hitStats'])) |
|
48 | - echo ' |
|
47 | + if (!empty($modSettings['hitStats'])) { |
|
48 | + echo ' |
|
49 | 49 | <dt>', $txt['num_hits'], ':</dt> |
50 | 50 | <dd>', $context['num_hits'], '</dd>'; |
51 | + } |
|
51 | 52 | |
52 | 53 | echo ' |
53 | 54 | </dl> |
@@ -71,17 +72,19 @@ discard block |
||
71 | 72 | <dt>', $txt['gender_stats'], ':</dt> |
72 | 73 | <dd>'; |
73 | 74 | |
74 | - foreach ($context['gender'] as $g => $n) |
|
75 | - echo $g, ': ', $n, '<br>'; |
|
75 | + foreach ($context['gender'] as $g => $n) { |
|
76 | + echo $g, ': ', $n, '<br>'; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | echo ' |
78 | 80 | </dd>'; |
79 | 81 | } |
80 | 82 | |
81 | - if (!empty($modSettings['hitStats'])) |
|
82 | - echo ' |
|
83 | + if (!empty($modSettings['hitStats'])) { |
|
84 | + echo ' |
|
83 | 85 | <dt>', $txt['average_hits'], ':</dt> |
84 | 86 | <dd>', $context['average_hits'], '</dd>'; |
87 | + } |
|
85 | 88 | |
86 | 89 | echo ' |
87 | 90 | </dl>'; |
@@ -105,14 +108,15 @@ discard block |
||
105 | 108 | </dt> |
106 | 109 | <dd class="statsbar">'; |
107 | 110 | |
108 | - if (!empty($item['percent'])) |
|
109 | - echo ' |
|
111 | + if (!empty($item['percent'])) { |
|
112 | + echo ' |
|
110 | 113 | <div class="bar" style="width: ', $item['percent'], '%;"> |
111 | 114 | <span class="righttext">', $item['num'], '</span> |
112 | 115 | </div>'; |
113 | - else |
|
114 | - echo ' |
|
116 | + } else { |
|
117 | + echo ' |
|
115 | 118 | <div class="bar empty"><span class="righttext">', $item['num'], '</span></div>'; |
119 | + } |
|
116 | 120 | |
117 | 121 | echo ' |
118 | 122 | </dd>'; |
@@ -144,9 +148,10 @@ discard block |
||
144 | 148 | <th>', $txt['stats_new_members'], '</th> |
145 | 149 | <th>', $txt['most_online'], '</th>'; |
146 | 150 | |
147 | - if (!empty($modSettings['hitStats'])) |
|
148 | - echo ' |
|
151 | + if (!empty($modSettings['hitStats'])) { |
|
152 | + echo ' |
|
149 | 153 | <th>', $txt['page_views'], '</th>'; |
154 | + } |
|
150 | 155 | |
151 | 156 | echo ' |
152 | 157 | </tr> |
@@ -165,9 +170,10 @@ discard block |
||
165 | 170 | <th>', $year['new_members'], '</th> |
166 | 171 | <th>', $year['most_members_online'], '</th>'; |
167 | 172 | |
168 | - if (!empty($modSettings['hitStats'])) |
|
169 | - echo ' |
|
173 | + if (!empty($modSettings['hitStats'])) { |
|
174 | + echo ' |
|
170 | 175 | <th>', $year['hits'], '</th>'; |
176 | + } |
|
171 | 177 | |
172 | 178 | echo ' |
173 | 179 | </tr>'; |
@@ -184,9 +190,10 @@ discard block |
||
184 | 190 | <th>', $month['new_members'], '</th> |
185 | 191 | <th>', $month['most_members_online'], '</th>'; |
186 | 192 | |
187 | - if (!empty($modSettings['hitStats'])) |
|
188 | - echo ' |
|
193 | + if (!empty($modSettings['hitStats'])) { |
|
194 | + echo ' |
|
189 | 195 | <th>', $month['hits'], '</th>'; |
196 | + } |
|
190 | 197 | |
191 | 198 | echo ' |
192 | 199 | </tr>'; |
@@ -203,9 +210,10 @@ discard block |
||
203 | 210 | <td>', $day['new_members'], '</td> |
204 | 211 | <td>', $day['most_members_online'], '</td>'; |
205 | 212 | |
206 | - if (!empty($modSettings['hitStats'])) |
|
207 | - echo ' |
|
213 | + if (!empty($modSettings['hitStats'])) { |
|
214 | + echo ' |
|
208 | 215 | <td>', $day['hits'], '</td>'; |
216 | + } |
|
209 | 217 | |
210 | 218 | echo ' |
211 | 219 | </tr>'; |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | { |
182 | 182 | collapsedDiv.show(\'slow\'); |
183 | 183 | icon.removeClass(\'toggle_down\').addClass(\'toggle_up\'); |
184 | - icon.prop(\'title\', '. JavaScriptEscape($txt['hide']) .'); |
|
184 | + icon.prop(\'title\', '. JavaScriptEscape($txt['hide']) . '); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | else |
188 | 188 | { |
189 | 189 | collapsedDiv.hide(\'slow\'); |
190 | 190 | icon.removeClass(\'toggle_up\').addClass(\'toggle_down\'); |
191 | - icon.prop(\'title\', '. JavaScriptEscape($txt['show']) .'); |
|
191 | + icon.prop(\'title\', '. JavaScriptEscape($txt['show']) . '); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | });', true); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | |
642 | 642 | // Setup the correct template, even though I'll admit we ain't downloading ;) |
643 | 643 | $context['sub_template'] = 'downloaded'; |
644 | - $allowext = array('.zip','.tgz','.gz'); |
|
644 | + $allowext = array('.zip', '.tgz', '.gz'); |
|
645 | 645 | // @todo Use FTP if the Packages directory is not writable. |
646 | 646 | |
647 | 647 | // Check the file was even sent! |
@@ -653,13 +653,13 @@ discard block |
||
653 | 653 | // Make sure it has a sane filename. |
654 | 654 | $_FILES['package']['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['package']['name']); |
655 | 655 | $extension = substr(strrchr(strtolower($_FILES['package']['name']), '.'), 0); |
656 | - if(!in_array($extension, $allowext)) |
|
656 | + if (!in_array($extension, $allowext)) |
|
657 | 657 | { |
658 | 658 | fatal_lang_error('package_upload_error_supports', false, array('zip, tgz, tar.gz')); |
659 | 659 | } |
660 | 660 | |
661 | 661 | // We only need the filename... |
662 | - $extension = ($extension == '.gz') ? '.tar.gz' : $extension ; |
|
662 | + $extension = ($extension == '.gz') ? '.tar.gz' : $extension; |
|
663 | 663 | $packageName = time() . $extension; |
664 | 664 | |
665 | 665 | // Setup the destination and throw an error if the file is already there! |
@@ -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 | * Browse the list of package servers, add servers... |
@@ -43,13 +44,15 @@ discard block |
||
43 | 44 | ); |
44 | 45 | |
45 | 46 | // Now let's decide where we are taking this... |
46 | - if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) |
|
47 | - $context['sub_action'] = $_REQUEST['sa']; |
|
47 | + if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { |
|
48 | + $context['sub_action'] = $_REQUEST['sa']; |
|
49 | + } |
|
48 | 50 | // We need to support possible old javascript links... |
49 | - elseif (isset($_GET['pgdownload'])) |
|
50 | - $context['sub_action'] = 'download'; |
|
51 | - else |
|
52 | - $context['sub_action'] = 'servers'; |
|
51 | + elseif (isset($_GET['pgdownload'])) { |
|
52 | + $context['sub_action'] = 'download'; |
|
53 | + } else { |
|
54 | + $context['sub_action'] = 'servers'; |
|
55 | + } |
|
53 | 56 | |
54 | 57 | // We need to force the "Download" tab as selected. |
55 | 58 | $context['menu_data_' . $context['admin_menu_id']]['current_subsection'] = 'packageget'; |
@@ -141,17 +144,19 @@ discard block |
||
141 | 144 | { |
142 | 145 | require_once($sourcedir . '/Class-Package.php'); |
143 | 146 | $ftp = new ftp_connection(null); |
147 | + } elseif ($ftp->error !== false && !isset($ftp_error)) { |
|
148 | + $ftp_error = $ftp->last_message === null ? '' : $ftp->last_message; |
|
144 | 149 | } |
145 | - elseif ($ftp->error !== false && !isset($ftp_error)) |
|
146 | - $ftp_error = $ftp->last_message === null ? '' : $ftp->last_message; |
|
147 | 150 | |
148 | 151 | list ($username, $detect_path, $found_path) = $ftp->detect_path($packagesdir); |
149 | 152 | |
150 | - if ($found_path || !isset($_POST['ftp_path'])) |
|
151 | - $_POST['ftp_path'] = $detect_path; |
|
153 | + if ($found_path || !isset($_POST['ftp_path'])) { |
|
154 | + $_POST['ftp_path'] = $detect_path; |
|
155 | + } |
|
152 | 156 | |
153 | - if (!isset($_POST['ftp_username'])) |
|
154 | - $_POST['ftp_username'] = $username; |
|
157 | + if (!isset($_POST['ftp_username'])) { |
|
158 | + $_POST['ftp_username'] = $username; |
|
159 | + } |
|
155 | 160 | |
156 | 161 | $context['package_ftp'] = array( |
157 | 162 | 'server' => isset($_POST['ftp_server']) ? $_POST['ftp_server'] : (isset($modSettings['package_server']) ? $modSettings['package_server'] : 'localhost'), |
@@ -160,8 +165,7 @@ discard block |
||
160 | 165 | 'path' => $_POST['ftp_path'], |
161 | 166 | 'error' => empty($ftp_error) ? null : $ftp_error, |
162 | 167 | ); |
163 | - } |
|
164 | - else |
|
168 | + } else |
|
165 | 169 | { |
166 | 170 | $context['package_download_broken'] = false; |
167 | 171 | |
@@ -203,8 +207,9 @@ discard block |
||
203 | 207 | |
204 | 208 | if (isset($_GET['server'])) |
205 | 209 | { |
206 | - if ($_GET['server'] == '') |
|
207 | - redirectexit('action=admin;area=packages;get'); |
|
210 | + if ($_GET['server'] == '') { |
|
211 | + redirectexit('action=admin;area=packages;get'); |
|
212 | + } |
|
208 | 213 | |
209 | 214 | $server = (int) $_GET['server']; |
210 | 215 | |
@@ -222,17 +227,18 @@ discard block |
||
222 | 227 | $smcFunc['db_free_result']($request); |
223 | 228 | |
224 | 229 | // If the server does not exist, dump out. |
225 | - if (empty($url)) |
|
226 | - fatal_lang_error('couldnt_connect', false); |
|
230 | + if (empty($url)) { |
|
231 | + fatal_lang_error('couldnt_connect', false); |
|
232 | + } |
|
227 | 233 | |
228 | 234 | // If there is a relative link, append to the stored server url. |
229 | - if (isset($_GET['relative'])) |
|
230 | - $url = $url . (substr($url, -1) == '/' ? '' : '/') . $_GET['relative']; |
|
235 | + if (isset($_GET['relative'])) { |
|
236 | + $url = $url . (substr($url, -1) == '/' ? '' : '/') . $_GET['relative']; |
|
237 | + } |
|
231 | 238 | |
232 | 239 | // Clear any "absolute" URL. Since "server" is present, "absolute" is garbage. |
233 | 240 | unset($_GET['absolute']); |
234 | - } |
|
235 | - elseif (isset($_GET['absolute']) && $_GET['absolute'] != '') |
|
241 | + } elseif (isset($_GET['absolute']) && $_GET['absolute'] != '') |
|
236 | 242 | { |
237 | 243 | // Initialize the requried variables. |
238 | 244 | $server = ''; |
@@ -256,16 +262,19 @@ discard block |
||
256 | 262 | } |
257 | 263 | } |
258 | 264 | // Minimum required parameter did not exist so dump out. |
259 | - else |
|
260 | - fatal_lang_error('couldnt_connect', false); |
|
265 | + else { |
|
266 | + fatal_lang_error('couldnt_connect', false); |
|
267 | + } |
|
261 | 268 | |
262 | 269 | // Attempt to connect. If unsuccessful... try the URL. |
263 | - if (!isset($_GET['package']) || file_exists($_GET['package'])) |
|
264 | - $_GET['package'] = $url . '/packages.xml?language=' . $context['user']['language']; |
|
270 | + if (!isset($_GET['package']) || file_exists($_GET['package'])) { |
|
271 | + $_GET['package'] = $url . '/packages.xml?language=' . $context['user']['language']; |
|
272 | + } |
|
265 | 273 | |
266 | 274 | // Check to be sure the packages.xml file actually exists where it is should be... or dump out. |
267 | - if ((isset($_GET['absolute']) || isset($_GET['relative'])) && !url_exists($_GET['package'])) |
|
268 | - fatal_lang_error('packageget_unable', false, array($url . '/index.php')); |
|
275 | + if ((isset($_GET['absolute']) || isset($_GET['relative'])) && !url_exists($_GET['package'])) { |
|
276 | + fatal_lang_error('packageget_unable', false, array($url . '/index.php')); |
|
277 | + } |
|
269 | 278 | |
270 | 279 | // Might take some time. |
271 | 280 | @set_time_limit(600); |
@@ -275,8 +284,9 @@ discard block |
||
275 | 284 | $listing = new xmlArray(fetch_web_data($_GET['package']), true); |
276 | 285 | |
277 | 286 | // Errm.... empty file? Try the URL.... |
278 | - if (!$listing->exists('package-list')) |
|
279 | - fatal_lang_error('packageget_unable', false, array($url . '/index.php')); |
|
287 | + if (!$listing->exists('package-list')) { |
|
288 | + fatal_lang_error('packageget_unable', false, array($url . '/index.php')); |
|
289 | + } |
|
280 | 290 | |
281 | 291 | // List out the packages... |
282 | 292 | $context['package_list'] = array(); |
@@ -284,8 +294,9 @@ discard block |
||
284 | 294 | $listing = $listing->path('package-list[0]'); |
285 | 295 | |
286 | 296 | // Use the package list's name if it exists. |
287 | - if ($listing->exists('list-title')) |
|
288 | - $name = $smcFunc['htmlspecialchars']($listing->fetch('list-title')); |
|
297 | + if ($listing->exists('list-title')) { |
|
298 | + $name = $smcFunc['htmlspecialchars']($listing->fetch('list-title')); |
|
299 | + } |
|
289 | 300 | |
290 | 301 | // Pick the correct template. |
291 | 302 | $context['sub_template'] = 'package_list'; |
@@ -300,28 +311,32 @@ discard block |
||
300 | 311 | |
301 | 312 | $installed_mods = array(); |
302 | 313 | // Look through the list of installed mods... |
303 | - foreach ($instmods as $installed_mod) |
|
304 | - $installed_mods[$installed_mod['package_id']] = $installed_mod['version']; |
|
314 | + foreach ($instmods as $installed_mod) { |
|
315 | + $installed_mods[$installed_mod['package_id']] = $installed_mod['version']; |
|
316 | + } |
|
305 | 317 | |
306 | 318 | // Get default author and email if they exist. |
307 | 319 | if ($listing->exists('default-author')) |
308 | 320 | { |
309 | 321 | $default_author = $smcFunc['htmlspecialchars']($listing->fetch('default-author')); |
310 | - if ($listing->exists('default-author/@email') && filter_var($listing->fetch('default-author/@email'), FILTER_VALIDATE_EMAIL)) |
|
311 | - $default_email = $smcFunc['htmlspecialchars']($listing->fetch('default-author/@email')); |
|
322 | + if ($listing->exists('default-author/@email') && filter_var($listing->fetch('default-author/@email'), FILTER_VALIDATE_EMAIL)) { |
|
323 | + $default_email = $smcFunc['htmlspecialchars']($listing->fetch('default-author/@email')); |
|
324 | + } |
|
312 | 325 | } |
313 | 326 | |
314 | 327 | // Get default web site if it exists. |
315 | 328 | if ($listing->exists('default-website')) |
316 | 329 | { |
317 | 330 | $default_website = $smcFunc['htmlspecialchars']($listing->fetch('default-website')); |
318 | - if ($listing->exists('default-website/@title')) |
|
319 | - $default_title = $smcFunc['htmlspecialchars']($listing->fetch('default-website/@title')); |
|
331 | + if ($listing->exists('default-website/@title')) { |
|
332 | + $default_title = $smcFunc['htmlspecialchars']($listing->fetch('default-website/@title')); |
|
333 | + } |
|
320 | 334 | } |
321 | 335 | |
322 | 336 | $the_version = strtr($forum_version, array('SMF ' => '')); |
323 | - if (!empty($_SESSION['version_emulate'])) |
|
324 | - $the_version = $_SESSION['version_emulate']; |
|
337 | + if (!empty($_SESSION['version_emulate'])) { |
|
338 | + $the_version = $_SESSION['version_emulate']; |
|
339 | + } |
|
325 | 340 | |
326 | 341 | $packageNum = 0; |
327 | 342 | $packageSection = 0; |
@@ -342,11 +357,13 @@ discard block |
||
342 | 357 | 'type' => $thisPackage->name(), |
343 | 358 | ); |
344 | 359 | |
345 | - if (in_array($package['type'], array('title', 'text'))) |
|
346 | - $context['package_list'][$packageSection][$package['type']] = $smcFunc['htmlspecialchars']($thisPackage->fetch('.')); |
|
360 | + if (in_array($package['type'], array('title', 'text'))) { |
|
361 | + $context['package_list'][$packageSection][$package['type']] = $smcFunc['htmlspecialchars']($thisPackage->fetch('.')); |
|
362 | + } |
|
347 | 363 | // It's a Title, Heading, Rule or Text. |
348 | - elseif (in_array($package['type'], array('heading', 'rule'))) |
|
349 | - $package['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('.')); |
|
364 | + elseif (in_array($package['type'], array('heading', 'rule'))) { |
|
365 | + $package['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('.')); |
|
366 | + } |
|
350 | 367 | // It's a Remote link. |
351 | 368 | elseif ($package['type'] == 'remote') |
352 | 369 | { |
@@ -354,20 +371,21 @@ discard block |
||
354 | 371 | |
355 | 372 | if ($remote_type == 'relative' && substr($thisPackage->fetch('@href'), 0, 7) != 'http://' && substr($thisPackage->fetch('@href'), 0, 8) != 'https://') |
356 | 373 | { |
357 | - if (isset($_GET['absolute'])) |
|
358 | - $current_url = $_GET['absolute'] . '/'; |
|
359 | - elseif (isset($_GET['relative'])) |
|
360 | - $current_url = $_GET['relative'] . '/'; |
|
361 | - else |
|
362 | - $current_url = ''; |
|
374 | + if (isset($_GET['absolute'])) { |
|
375 | + $current_url = $_GET['absolute'] . '/'; |
|
376 | + } elseif (isset($_GET['relative'])) { |
|
377 | + $current_url = $_GET['relative'] . '/'; |
|
378 | + } else { |
|
379 | + $current_url = ''; |
|
380 | + } |
|
363 | 381 | |
364 | 382 | $current_url .= $thisPackage->fetch('@href'); |
365 | - if (isset($_GET['absolute'])) |
|
366 | - $package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;absolute=' . $current_url; |
|
367 | - else |
|
368 | - $package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $context['package_server'] . ';relative=' . $current_url; |
|
369 | - } |
|
370 | - else |
|
383 | + if (isset($_GET['absolute'])) { |
|
384 | + $package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;absolute=' . $current_url; |
|
385 | + } else { |
|
386 | + $package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $context['package_server'] . ';relative=' . $current_url; |
|
387 | + } |
|
388 | + } else |
|
371 | 389 | { |
372 | 390 | $current_url = $thisPackage->fetch('@href'); |
373 | 391 | $package['href'] = $scripturl . '?action=admin;area=packages;get;sa=browse;absolute=' . $current_url; |
@@ -379,25 +397,28 @@ discard block |
||
379 | 397 | // It's a package... |
380 | 398 | else |
381 | 399 | { |
382 | - if (isset($_GET['absolute'])) |
|
383 | - $current_url = $_GET['absolute'] . '/'; |
|
384 | - elseif (isset($_GET['relative'])) |
|
385 | - $current_url = $_GET['relative'] . '/'; |
|
386 | - else |
|
387 | - $current_url = ''; |
|
400 | + if (isset($_GET['absolute'])) { |
|
401 | + $current_url = $_GET['absolute'] . '/'; |
|
402 | + } elseif (isset($_GET['relative'])) { |
|
403 | + $current_url = $_GET['relative'] . '/'; |
|
404 | + } else { |
|
405 | + $current_url = ''; |
|
406 | + } |
|
388 | 407 | |
389 | 408 | $server_att = $server != '' ? ';server=' . $server : ''; |
390 | 409 | |
391 | 410 | $package += $thisPackage->to_array(); |
392 | 411 | |
393 | - if (isset($package['website'])) |
|
394 | - unset($package['website']); |
|
412 | + if (isset($package['website'])) { |
|
413 | + unset($package['website']); |
|
414 | + } |
|
395 | 415 | $package['author'] = array(); |
396 | 416 | |
397 | - if ($package['description'] == '') |
|
398 | - $package['description'] = $txt['package_no_description']; |
|
399 | - else |
|
400 | - $package['description'] = parse_bbc(preg_replace('~\[[/]?html\]~i', '', $smcFunc['htmlspecialchars']($package['description']))); |
|
417 | + if ($package['description'] == '') { |
|
418 | + $package['description'] = $txt['package_no_description']; |
|
419 | + } else { |
|
420 | + $package['description'] = parse_bbc(preg_replace('~\[[/]?html\]~i', '', $smcFunc['htmlspecialchars']($package['description']))); |
|
421 | + } |
|
401 | 422 | |
402 | 423 | $package['is_installed'] = isset($installed_mods[$package['id']]); |
403 | 424 | $package['is_current'] = $package['is_installed'] && ($installed_mods[$package['id']] == $package['version']); |
@@ -406,12 +427,14 @@ discard block |
||
406 | 427 | // This package is either not installed, or installed but old. Is it supported on this version of SMF? |
407 | 428 | if (!$package['is_installed'] || (!$package['is_current'] && !$package['is_newer'])) |
408 | 429 | { |
409 | - if ($thisPackage->exists('version/@for')) |
|
410 | - $package['can_install'] = matchPackageVersion($the_version, $thisPackage->fetch('version/@for')); |
|
430 | + if ($thisPackage->exists('version/@for')) { |
|
431 | + $package['can_install'] = matchPackageVersion($the_version, $thisPackage->fetch('version/@for')); |
|
432 | + } |
|
411 | 433 | } |
412 | 434 | // Okay, it's already installed AND up to date. |
413 | - else |
|
414 | - $package['can_install'] = false; |
|
435 | + else { |
|
436 | + $package['can_install'] = false; |
|
437 | + } |
|
415 | 438 | |
416 | 439 | $already_exists = getPackageInfo(basename($package['filename'])); |
417 | 440 | $package['download_conflict'] = is_array($already_exists) && $already_exists['id'] == $package['id'] && $already_exists['version'] != $package['version']; |
@@ -423,40 +446,44 @@ discard block |
||
423 | 446 | |
424 | 447 | if ($thisPackage->exists('author') || isset($default_author)) |
425 | 448 | { |
426 | - if ($thisPackage->exists('author/@email') && filter_var($thisPackage->fetch('author/@email'), FILTER_VALIDATE_EMAIL)) |
|
427 | - $package['author']['email'] = $thisPackage->fetch('author/@email'); |
|
428 | - elseif (isset($default_email)) |
|
429 | - $package['author']['email'] = $default_email; |
|
430 | - |
|
431 | - if ($thisPackage->exists('author') && $thisPackage->fetch('author') != '') |
|
432 | - $package['author']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('author')); |
|
433 | - else |
|
434 | - $package['author']['name'] = $default_author; |
|
435 | - |
|
436 | - if (!empty($package['author']['email'])) |
|
437 | - $package['author']['link'] = '<a href="mailto:' . $package['author']['email'] . '">' . $package['author']['name'] . '</a>'; |
|
449 | + if ($thisPackage->exists('author/@email') && filter_var($thisPackage->fetch('author/@email'), FILTER_VALIDATE_EMAIL)) { |
|
450 | + $package['author']['email'] = $thisPackage->fetch('author/@email'); |
|
451 | + } elseif (isset($default_email)) { |
|
452 | + $package['author']['email'] = $default_email; |
|
453 | + } |
|
454 | + |
|
455 | + if ($thisPackage->exists('author') && $thisPackage->fetch('author') != '') { |
|
456 | + $package['author']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('author')); |
|
457 | + } else { |
|
458 | + $package['author']['name'] = $default_author; |
|
459 | + } |
|
460 | + |
|
461 | + if (!empty($package['author']['email'])) { |
|
462 | + $package['author']['link'] = '<a href="mailto:' . $package['author']['email'] . '">' . $package['author']['name'] . '</a>'; |
|
463 | + } |
|
438 | 464 | } |
439 | 465 | |
440 | 466 | if ($thisPackage->exists('website') || isset($default_website)) |
441 | 467 | { |
442 | - if ($thisPackage->exists('website') && $thisPackage->exists('website/@title')) |
|
443 | - $package['author']['website']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('website/@title')); |
|
444 | - elseif (isset($default_title)) |
|
445 | - $package['author']['website']['name'] = $default_title; |
|
446 | - elseif ($thisPackage->exists('website')) |
|
447 | - $package['author']['website']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('website')); |
|
448 | - else |
|
449 | - $package['author']['website']['name'] = $default_website; |
|
450 | - |
|
451 | - if ($thisPackage->exists('website') && $thisPackage->fetch('website') != '') |
|
452 | - $authorhompage = $smcFunc['htmlspecialchars']($thisPackage->fetch('website')); |
|
453 | - else |
|
454 | - $authorhompage = $default_website; |
|
468 | + if ($thisPackage->exists('website') && $thisPackage->exists('website/@title')) { |
|
469 | + $package['author']['website']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('website/@title')); |
|
470 | + } elseif (isset($default_title)) { |
|
471 | + $package['author']['website']['name'] = $default_title; |
|
472 | + } elseif ($thisPackage->exists('website')) { |
|
473 | + $package['author']['website']['name'] = $smcFunc['htmlspecialchars']($thisPackage->fetch('website')); |
|
474 | + } else { |
|
475 | + $package['author']['website']['name'] = $default_website; |
|
476 | + } |
|
477 | + |
|
478 | + if ($thisPackage->exists('website') && $thisPackage->fetch('website') != '') { |
|
479 | + $authorhompage = $smcFunc['htmlspecialchars']($thisPackage->fetch('website')); |
|
480 | + } else { |
|
481 | + $authorhompage = $default_website; |
|
482 | + } |
|
455 | 483 | |
456 | 484 | $package['author']['website']['href'] = $authorhompage; |
457 | 485 | $package['author']['website']['link'] = '<a href="' . $authorhompage . '">' . $package['author']['website']['name'] . '</a>'; |
458 | - } |
|
459 | - else |
|
486 | + } else |
|
460 | 487 | { |
461 | 488 | $package['author']['website']['href'] = ''; |
462 | 489 | $package['author']['website']['link'] = ''; |
@@ -472,11 +499,13 @@ discard block |
||
472 | 499 | $packageNum = in_array($package['type'], array('title', 'heading', 'text', 'remote', 'rule')) ? 0 : $packageNum + 1; |
473 | 500 | $package['count'] = $packageNum; |
474 | 501 | |
475 | - if (!in_array($package['type'], array('title', 'text'))) |
|
476 | - $context['package_list'][$packageSection]['items'][] = $package; |
|
502 | + if (!in_array($package['type'], array('title', 'text'))) { |
|
503 | + $context['package_list'][$packageSection]['items'][] = $package; |
|
504 | + } |
|
477 | 505 | |
478 | - if ($package['count'] > 1) |
|
479 | - $context['list_type'] = 'ol'; |
|
506 | + if ($package['count'] > 1) { |
|
507 | + $context['list_type'] = 'ol'; |
|
508 | + } |
|
480 | 509 | } |
481 | 510 | |
482 | 511 | $packageSection++; |
@@ -489,8 +518,9 @@ discard block |
||
489 | 518 | { |
490 | 519 | foreach ($packageSection['items'] as $i => $package) |
491 | 520 | { |
492 | - if ($package['count'] == 0 || isset($package['can_install'])) |
|
493 | - continue; |
|
521 | + if ($package['count'] == 0 || isset($package['can_install'])) { |
|
522 | + continue; |
|
523 | + } |
|
494 | 524 | |
495 | 525 | $context['package_list'][$ps_id]['items'][$i]['can_install'] = false; |
496 | 526 | |
@@ -539,8 +569,9 @@ discard block |
||
539 | 569 | checkSession('get'); |
540 | 570 | |
541 | 571 | // To download something, we need a valid server or url. |
542 | - if (empty($_GET['server']) && (!empty($_GET['get']) && !empty($_REQUEST['package']))) |
|
543 | - fatal_lang_error('package_get_error_is_zero', false); |
|
572 | + if (empty($_GET['server']) && (!empty($_GET['get']) && !empty($_REQUEST['package']))) { |
|
573 | + fatal_lang_error('package_get_error_is_zero', false); |
|
574 | + } |
|
544 | 575 | |
545 | 576 | if (isset($_GET['server'])) |
546 | 577 | { |
@@ -560,22 +591,23 @@ discard block |
||
560 | 591 | $smcFunc['db_free_result']($request); |
561 | 592 | |
562 | 593 | // If server does not exist then dump out. |
563 | - if (empty($url)) |
|
564 | - fatal_lang_error('couldnt_connect', false); |
|
594 | + if (empty($url)) { |
|
595 | + fatal_lang_error('couldnt_connect', false); |
|
596 | + } |
|
565 | 597 | |
566 | 598 | $url = $url . '/'; |
567 | - } |
|
568 | - else |
|
599 | + } else |
|
569 | 600 | { |
570 | 601 | // Initialize the requried variables. |
571 | 602 | $server = ''; |
572 | 603 | $url = ''; |
573 | 604 | } |
574 | 605 | |
575 | - if (isset($_REQUEST['byurl']) && !empty($_POST['filename'])) |
|
576 | - $package_name = basename($_REQUEST['filename']); |
|
577 | - else |
|
578 | - $package_name = basename($_REQUEST['package']); |
|
606 | + if (isset($_REQUEST['byurl']) && !empty($_POST['filename'])) { |
|
607 | + $package_name = basename($_REQUEST['filename']); |
|
608 | + } else { |
|
609 | + $package_name = basename($_REQUEST['package']); |
|
610 | + } |
|
579 | 611 | |
580 | 612 | if (isset($_REQUEST['conflict']) || (isset($_REQUEST['auto']) && file_exists($packagesdir . '/' . $package_name))) |
581 | 613 | { |
@@ -584,14 +616,15 @@ discard block |
||
584 | 616 | { |
585 | 617 | $ext = substr($package_name, strrpos(substr($package_name, 0, -3), '.')); |
586 | 618 | $package_name = substr($package_name, 0, strrpos(substr($package_name, 0, -3), '.')) . '_'; |
619 | + } else { |
|
620 | + $ext = ''; |
|
587 | 621 | } |
588 | - else |
|
589 | - $ext = ''; |
|
590 | 622 | |
591 | 623 | // Find the first available. |
592 | 624 | $i = 1; |
593 | - while (file_exists($packagesdir . '/' . $package_name . $i . $ext)) |
|
594 | - $i++; |
|
625 | + while (file_exists($packagesdir . '/' . $package_name . $i . $ext)) { |
|
626 | + $i++; |
|
627 | + } |
|
595 | 628 | |
596 | 629 | $package_name = $package_name . $i . $ext; |
597 | 630 | } |
@@ -602,25 +635,28 @@ discard block |
||
602 | 635 | |
603 | 636 | // Done! Did we get this package automatically? |
604 | 637 | // @ TODO: These are usually update packages. Allowing both for now until more testing has been done. |
605 | - if (preg_match('~^https?://[\w_\-]+\.simplemachines\.org/~', $_REQUEST['package']) == 1 && strpos($_REQUEST['package'], 'dlattach') === false && isset($_REQUEST['auto'])) |
|
606 | - redirectexit('action=admin;area=packages;sa=install;package=' . $package_name); |
|
638 | + if (preg_match('~^https?://[\w_\-]+\.simplemachines\.org/~', $_REQUEST['package']) == 1 && strpos($_REQUEST['package'], 'dlattach') === false && isset($_REQUEST['auto'])) { |
|
639 | + redirectexit('action=admin;area=packages;sa=install;package=' . $package_name); |
|
640 | + } |
|
607 | 641 | |
608 | 642 | // You just downloaded a mod from SERVER_NAME_GOES_HERE. |
609 | 643 | $context['package_server'] = $server; |
610 | 644 | |
611 | 645 | $context['package'] = getPackageInfo($package_name); |
612 | 646 | |
613 | - if (!is_array($context['package'])) |
|
614 | - fatal_lang_error('package_cant_download', false); |
|
647 | + if (!is_array($context['package'])) { |
|
648 | + fatal_lang_error('package_cant_download', false); |
|
649 | + } |
|
615 | 650 | |
616 | - if ($context['package']['type'] == 'modification') |
|
617 | - $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>'; |
|
618 | - elseif ($context['package']['type'] == 'avatar') |
|
619 | - $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['use_avatars'] . ' ]</a>'; |
|
620 | - elseif ($context['package']['type'] == 'language') |
|
621 | - $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['add_languages'] . ' ]</a>'; |
|
622 | - else |
|
623 | - $context['package']['install']['link'] = ''; |
|
651 | + if ($context['package']['type'] == 'modification') { |
|
652 | + $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>'; |
|
653 | + } elseif ($context['package']['type'] == 'avatar') { |
|
654 | + $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['use_avatars'] . ' ]</a>'; |
|
655 | + } elseif ($context['package']['type'] == 'language') { |
|
656 | + $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['add_languages'] . ' ]</a>'; |
|
657 | + } else { |
|
658 | + $context['package']['install']['link'] = ''; |
|
659 | + } |
|
624 | 660 | |
625 | 661 | // Does a 3rd party hook want to do some additional changes? |
626 | 662 | call_integration_hook('integrate_package_download'); |
@@ -646,10 +682,11 @@ discard block |
||
646 | 682 | // @todo Use FTP if the Packages directory is not writable. |
647 | 683 | |
648 | 684 | // Check the file was even sent! |
649 | - if (!isset($_FILES['package']['name']) || $_FILES['package']['name'] == '') |
|
650 | - fatal_lang_error('package_upload_error_nofile'); |
|
651 | - elseif (!is_uploaded_file($_FILES['package']['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['package']['tmp_name']))) |
|
652 | - fatal_lang_error('package_upload_error_failed'); |
|
685 | + if (!isset($_FILES['package']['name']) || $_FILES['package']['name'] == '') { |
|
686 | + fatal_lang_error('package_upload_error_nofile'); |
|
687 | + } elseif (!is_uploaded_file($_FILES['package']['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['package']['tmp_name']))) { |
|
688 | + fatal_lang_error('package_upload_error_failed'); |
|
689 | + } |
|
653 | 690 | |
654 | 691 | // Make sure it has a sane filename. |
655 | 692 | $_FILES['package']['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['package']['name']); |
@@ -666,8 +703,9 @@ discard block |
||
666 | 703 | // Setup the destination and throw an error if the file is already there! |
667 | 704 | $destination = $packagesdir . '/' . $packageName; |
668 | 705 | // @todo Maybe just roll it like we do for downloads? |
669 | - if (file_exists($destination)) |
|
670 | - fatal_lang_error('package_upload_error_exists'); |
|
706 | + if (file_exists($destination)) { |
|
707 | + fatal_lang_error('package_upload_error_exists'); |
|
708 | + } |
|
671 | 709 | |
672 | 710 | // Now move the file. |
673 | 711 | move_uploaded_file($_FILES['package']['tmp_name'], $destination); |
@@ -690,12 +728,14 @@ discard block |
||
690 | 728 | { |
691 | 729 | while ($package = readdir($dir)) |
692 | 730 | { |
693 | - if ($package == '.' || $package == '..' || $package == 'temp' || $package == $packageName || (!(is_dir($packagesdir . '/' . $package) && file_exists($packagesdir . '/' . $package . '/package-info.xml')) && substr(strtolower($package), -7) != '.tar.gz' && substr(strtolower($package), -4) != '.tgz' && substr(strtolower($package), -4) != '.zip')) |
|
694 | - continue; |
|
731 | + if ($package == '.' || $package == '..' || $package == 'temp' || $package == $packageName || (!(is_dir($packagesdir . '/' . $package) && file_exists($packagesdir . '/' . $package . '/package-info.xml')) && substr(strtolower($package), -7) != '.tar.gz' && substr(strtolower($package), -4) != '.tgz' && substr(strtolower($package), -4) != '.zip')) { |
|
732 | + continue; |
|
733 | + } |
|
695 | 734 | |
696 | 735 | $packageInfo = getPackageInfo($package); |
697 | - if (!is_array($packageInfo)) |
|
698 | - continue; |
|
736 | + if (!is_array($packageInfo)) { |
|
737 | + continue; |
|
738 | + } |
|
699 | 739 | |
700 | 740 | if ($packageInfo['id'] == $context['package']['id'] && $packageInfo['version'] == $context['package']['version']) |
701 | 741 | { |
@@ -707,14 +747,15 @@ discard block |
||
707 | 747 | closedir($dir); |
708 | 748 | } |
709 | 749 | |
710 | - if ($context['package']['type'] == 'modification') |
|
711 | - $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>'; |
|
712 | - elseif ($context['package']['type'] == 'avatar') |
|
713 | - $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['use_avatars'] . ' ]</a>'; |
|
714 | - elseif ($context['package']['type'] == 'language') |
|
715 | - $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['add_languages'] . ' ]</a>'; |
|
716 | - else |
|
717 | - $context['package']['install']['link'] = ''; |
|
750 | + if ($context['package']['type'] == 'modification') { |
|
751 | + $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['install_mod'] . ' ]</a>'; |
|
752 | + } elseif ($context['package']['type'] == 'avatar') { |
|
753 | + $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['use_avatars'] . ' ]</a>'; |
|
754 | + } elseif ($context['package']['type'] == 'language') { |
|
755 | + $context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['add_languages'] . ' ]</a>'; |
|
756 | + } else { |
|
757 | + $context['package']['install']['link'] = ''; |
|
758 | + } |
|
718 | 759 | |
719 | 760 | // Does a 3rd party hook want to do some additional changes? |
720 | 761 | call_integration_hook('integrate_package_upload'); |
@@ -737,16 +778,18 @@ discard block |
||
737 | 778 | checkSession(); |
738 | 779 | |
739 | 780 | // If they put a slash on the end, get rid of it. |
740 | - if (substr($_POST['serverurl'], -1) == '/') |
|
741 | - $_POST['serverurl'] = substr($_POST['serverurl'], 0, -1); |
|
781 | + if (substr($_POST['serverurl'], -1) == '/') { |
|
782 | + $_POST['serverurl'] = substr($_POST['serverurl'], 0, -1); |
|
783 | + } |
|
742 | 784 | |
743 | 785 | // Are they both nice and clean? |
744 | 786 | $servername = trim($smcFunc['htmlspecialchars']($_POST['servername'])); |
745 | 787 | $serverurl = trim($smcFunc['htmlspecialchars']($_POST['serverurl'])); |
746 | 788 | |
747 | 789 | // Make sure the URL has the correct prefix. |
748 | - if (strpos($serverurl, 'http://') !== 0 && strpos($serverurl, 'https://') !== 0) |
|
749 | - $serverurl = 'http://' . $serverurl; |
|
790 | + if (strpos($serverurl, 'http://') !== 0 && strpos($serverurl, 'https://') !== 0) { |
|
791 | + $serverurl = 'http://' . $serverurl; |
|
792 | + } |
|
750 | 793 | |
751 | 794 | $smcFunc['db_insert']('', |
752 | 795 | '{db_prefix}package_servers', |