@@ -17,25 +17,29 @@ discard block |
||
17 | 17 | ); |
18 | 18 | |
19 | 19 | // No file? Thats bad. |
20 | -if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) |
|
20 | +if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) { |
|
21 | 21 | die('Error: No File specified' . "\n"); |
22 | +} |
|
22 | 23 | |
23 | 24 | // The file has to exist. |
24 | 25 | $currentFile = $_SERVER['argv'][1]; |
25 | -if (!file_exists($currentFile)) |
|
26 | +if (!file_exists($currentFile)) { |
|
26 | 27 | die('Error: File does not exist' . "\n"); |
28 | +} |
|
27 | 29 | |
28 | 30 | // Is this ignored? |
29 | -foreach ($ignoreFiles as $if) |
|
31 | +foreach ($ignoreFiles as $if) { |
|
30 | 32 | if (preg_match('~' . $if . '~i', $currentFile)) |
31 | 33 | die; |
34 | +} |
|
32 | 35 | |
33 | 36 | // Lets get the main index.php for $forum_version and $software_year. |
34 | 37 | $upgradeFile = fopen('./other/upgrade.php', 'r'); |
35 | 38 | $upgradeContents = fread($upgradeFile, 500); |
36 | 39 | |
37 | -if (!preg_match('~define\(\'SMF_LANG_VERSION\', \'([^\']+)\'\);~i', $upgradeContents, $versionResults)) |
|
40 | +if (!preg_match('~define\(\'SMF_LANG_VERSION\', \'([^\']+)\'\);~i', $upgradeContents, $versionResults)) { |
|
38 | 41 | die('Error: Could not locate SMF_LANG_VERSION' . "\n"); |
42 | +} |
|
39 | 43 | $currentVersion = $versionResults[1]; |
40 | 44 | |
41 | 45 | $file = fopen($currentFile, 'r'); |
@@ -44,15 +48,18 @@ discard block |
||
44 | 48 | |
45 | 49 | // Just see if the basic match is there. |
46 | 50 | $match = '// Version: ' . $currentVersion; |
47 | -if (!preg_match('~' . $match . '~i', $contents)) |
|
51 | +if (!preg_match('~' . $match . '~i', $contents)) { |
|
48 | 52 | die('Error: The version is missing or incorrect in ' . $currentFile . "\n"); |
53 | +} |
|
49 | 54 | |
50 | 55 | // Get the file prefix. |
51 | 56 | preg_match('~([A-Za-z]+)\.english\.php~i', $currentFile, $fileMatch); |
52 | -if (empty($fileMatch)) |
|
57 | +if (empty($fileMatch)) { |
|
53 | 58 | die('Error: Could not locate locate the file name in ' . $currentFile . "\n"); |
59 | +} |
|
54 | 60 | |
55 | 61 | // Now match that prefix in a more strict mode. |
56 | 62 | $match = '// Version: ' . $currentVersion . '; ' . $fileMatch[1]; |
57 | -if (!preg_match('~' . $match . '~i', $contents)) |
|
58 | - die('Error: The version with file name is missing or incorrect in ' . $currentFile . "\n"); |
|
59 | 63 | \ No newline at end of file |
64 | +if (!preg_match('~' . $match . '~i', $contents)) { |
|
65 | + die('Error: The version with file name is missing or incorrect in ' . $currentFile . "\n"); |
|
66 | +} |
@@ -72,9 +72,10 @@ discard block |
||
72 | 72 | |
73 | 73 | // Allow css/js files to be disable for this specific theme. |
74 | 74 | // Add the identifier as an array key. IE array('smf_script'); Some external files might not add identifiers, on those cases SMF uses its filename as reference. |
75 | - if (!isset($settings['disable_files'])) |
|
76 | - $settings['disable_files'] = array(); |
|
77 | -} |
|
75 | + if (!isset($settings['disable_files'])) { |
|
76 | + $settings['disable_files'] = array(); |
|
77 | + } |
|
78 | + } |
|
78 | 79 | |
79 | 80 | /** |
80 | 81 | * The main sub template above the content. |
@@ -111,8 +112,9 @@ discard block |
||
111 | 112 | echo ' |
112 | 113 | <meta'; |
113 | 114 | |
114 | - foreach ($meta_tag as $meta_key => $meta_value) |
|
115 | - echo ' ', $meta_key, '="', $meta_value, '"'; |
|
115 | + foreach ($meta_tag as $meta_key => $meta_value) { |
|
116 | + echo ' ', $meta_key, '="', $meta_value, '"'; |
|
117 | + } |
|
116 | 118 | |
117 | 119 | echo '>'; |
118 | 120 | } |
@@ -123,14 +125,16 @@ discard block |
||
123 | 125 | <meta name="theme-color" content="#557EA0">'; |
124 | 126 | |
125 | 127 | // Please don't index these Mr Robot. |
126 | - if (!empty($context['robot_no_index'])) |
|
127 | - echo ' |
|
128 | + if (!empty($context['robot_no_index'])) { |
|
129 | + echo ' |
|
128 | 130 | <meta name="robots" content="noindex">'; |
131 | + } |
|
129 | 132 | |
130 | 133 | // Present a canonical url for search engines to prevent duplicate content in their indices. |
131 | - if (!empty($context['canonical_url'])) |
|
132 | - echo ' |
|
134 | + if (!empty($context['canonical_url'])) { |
|
135 | + echo ' |
|
133 | 136 | <link rel="canonical" href="', $context['canonical_url'], '">'; |
137 | + } |
|
134 | 138 | |
135 | 139 | // Show all the relative links, such as help, search, contents, and the like. |
136 | 140 | echo ' |
@@ -139,10 +143,11 @@ discard block |
||
139 | 143 | <link rel="search" href="' . $scripturl . '?action=search">' : ''); |
140 | 144 | |
141 | 145 | // If RSS feeds are enabled, advertise the presence of one. |
142 | - if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) |
|
143 | - echo ' |
|
146 | + if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) { |
|
147 | + echo ' |
|
144 | 148 | <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss2;action=.xml"> |
145 | 149 | <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?type=atom;action=.xml">'; |
150 | + } |
|
146 | 151 | |
147 | 152 | // If we're viewing a topic, these should be the previous and next topics, respectively. |
148 | 153 | if (!empty($context['links']['next'])) |
@@ -158,9 +163,10 @@ discard block |
||
158 | 163 | } |
159 | 164 | |
160 | 165 | // If we're in a board, or a topic for that matter, the index will be the board's index. |
161 | - if (!empty($context['current_board'])) |
|
162 | - echo ' |
|
166 | + if (!empty($context['current_board'])) { |
|
167 | + echo ' |
|
163 | 168 | <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">'; |
169 | + } |
|
164 | 170 | |
165 | 171 | // Output any remaining HTML headers. (from mods, maybe?) |
166 | 172 | echo $context['html_headers']; |
@@ -191,8 +197,9 @@ discard block |
||
191 | 197 | <ul class="floatleft" id="top_info"> |
192 | 198 | <li> |
193 | 199 | <a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">'; |
194 | - if (!empty($context['user']['avatar'])) |
|
195 | - echo $context['user']['avatar']['image']; |
|
200 | + if (!empty($context['user']['avatar'])) { |
|
201 | + echo $context['user']['avatar']['image']; |
|
202 | + } |
|
196 | 203 | echo $context['user']['name'], '</a> |
197 | 204 | <div id="profile_menu" class="top_menu"></div> |
198 | 205 | </li>'; |
@@ -220,17 +227,18 @@ discard block |
||
220 | 227 | } |
221 | 228 | // Otherwise they're a guest. Ask them to either register or login. |
222 | 229 | else |
223 | - if (empty($maintenance)) |
|
224 | - echo ' |
|
230 | + if (empty($maintenance)) { |
|
231 | + echo ' |
|
225 | 232 | <ul class="floatleft welcome"> |
226 | 233 | <li>', sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'), '</li> |
227 | 234 | </ul>'; |
228 | - else |
|
229 | - //In maintenance mode, only login is allowed and don't show OverlayDiv |
|
235 | + } else { |
|
236 | + //In maintenance mode, only login is allowed and don't show OverlayDiv |
|
230 | 237 | echo ' |
231 | 238 | <ul class="floatleft welcome"> |
232 | 239 | <li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li> |
233 | 240 | </ul>'; |
241 | + } |
|
234 | 242 | |
235 | 243 | if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1) |
236 | 244 | { |
@@ -238,9 +246,10 @@ discard block |
||
238 | 246 | <form id="languages_form" method="get" class="floatright"> |
239 | 247 | <select id="language_select" name="language" onchange="this.form.submit()">'; |
240 | 248 | |
241 | - foreach ($context['languages'] as $language) |
|
242 | - echo ' |
|
249 | + foreach ($context['languages'] as $language) { |
|
250 | + echo ' |
|
243 | 251 | <option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>'; |
252 | + } |
|
244 | 253 | |
245 | 254 | echo ' |
246 | 255 | </select> |
@@ -264,31 +273,36 @@ discard block |
||
264 | 273 | <option value="all"', ($selected == 'all' ? ' selected' : ''), '>', $txt['search_entireforum'], ' </option>'; |
265 | 274 | |
266 | 275 | // Can't limit it to a specific topic if we are not in one |
267 | - if (!empty($context['current_topic'])) |
|
268 | - echo ' |
|
276 | + if (!empty($context['current_topic'])) { |
|
277 | + echo ' |
|
269 | 278 | <option value="topic"', ($selected == 'current_topic' ? ' selected' : ''), '>', $txt['search_thistopic'], '</option>'; |
279 | + } |
|
270 | 280 | |
271 | 281 | // Can't limit it to a specific board if we are not in one |
272 | - if (!empty($context['current_board'])) |
|
273 | - echo ' |
|
282 | + if (!empty($context['current_board'])) { |
|
283 | + echo ' |
|
274 | 284 | <option value="board"', ($selected == 'current_board' ? ' selected' : ''), '>', $txt['search_thisbrd'], '</option>'; |
285 | + } |
|
275 | 286 | |
276 | 287 | // Can't search for members if we can't see the memberlist |
277 | - if (!empty($context['allow_memberlist'])) |
|
278 | - echo ' |
|
288 | + if (!empty($context['allow_memberlist'])) { |
|
289 | + echo ' |
|
279 | 290 | <option value="members"', ($selected == 'members' ? ' selected' : ''), '>', $txt['search_members'], ' </option>'; |
291 | + } |
|
280 | 292 | |
281 | 293 | echo ' |
282 | 294 | </select>'; |
283 | 295 | |
284 | 296 | // Search within current topic? |
285 | - if (!empty($context['current_topic'])) |
|
286 | - echo ' |
|
297 | + if (!empty($context['current_topic'])) { |
|
298 | + echo ' |
|
287 | 299 | <input type="hidden" name="sd_topic" value="', $context['current_topic'], '">'; |
300 | + } |
|
288 | 301 | // If we're on a certain board, limit it to this board ;). |
289 | - elseif (!empty($context['current_board'])) |
|
290 | - echo ' |
|
302 | + elseif (!empty($context['current_board'])) { |
|
303 | + echo ' |
|
291 | 304 | <input type="hidden" name="sd_brd" value="', $context['current_board'], '">'; |
305 | + } |
|
292 | 306 | |
293 | 307 | echo ' |
294 | 308 | <input type="submit" name="search2" value="', $txt['search'], '" class="button_submit"> |
@@ -318,12 +332,13 @@ discard block |
||
318 | 332 | ', $context['current_time'], ' |
319 | 333 | </div>'; |
320 | 334 | // Show a random news item? (or you could pick one from news_lines...) |
321 | - if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) |
|
322 | - echo ' |
|
335 | + if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) { |
|
336 | + echo ' |
|
323 | 337 | <div class="news"> |
324 | 338 | <h2>', $txt['news'], ': </h2> |
325 | 339 | <p>', $context['random_news_line'], '</p> |
326 | 340 | </div>'; |
341 | + } |
|
327 | 342 | |
328 | 343 | echo ' |
329 | 344 | <hr class="clear"> |
@@ -386,9 +401,10 @@ discard block |
||
386 | 401 | </ul>'; |
387 | 402 | |
388 | 403 | // Show the load time? |
389 | - if ($context['show_load_time']) |
|
390 | - echo ' |
|
404 | + if ($context['show_load_time']) { |
|
405 | + echo ' |
|
391 | 406 | <p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>'; |
407 | + } |
|
392 | 408 | |
393 | 409 | echo ' |
394 | 410 | </div>'; |
@@ -418,19 +434,21 @@ discard block |
||
418 | 434 | global $context, $shown_linktree, $scripturl, $txt; |
419 | 435 | |
420 | 436 | // If linktree is empty, just return - also allow an override. |
421 | - if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) |
|
422 | - return; |
|
437 | + if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) { |
|
438 | + return; |
|
439 | + } |
|
423 | 440 | |
424 | 441 | echo ' |
425 | 442 | <div class="navigate_section"> |
426 | 443 | <ul>'; |
427 | 444 | |
428 | - if ($context['user']['is_logged']) |
|
429 | - echo ' |
|
445 | + if ($context['user']['is_logged']) { |
|
446 | + echo ' |
|
430 | 447 | <li class="unread_links"> |
431 | 448 | <a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a> |
432 | 449 | <a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a> |
433 | 450 | </li>'; |
451 | + } |
|
434 | 452 | |
435 | 453 | // Each tree item has a URL and name. Some may have extra_before and extra_after. |
436 | 454 | foreach ($context['linktree'] as $link_num => $tree) |
@@ -441,25 +459,29 @@ discard block |
||
441 | 459 | // Don't show a separator for the first one. |
442 | 460 | // Better here. Always points to the next level when the linktree breaks to a second line. |
443 | 461 | // Picked a better looking HTML entity, and added support for RTL plus a span for styling. |
444 | - if ($link_num != 0) |
|
445 | - echo ' |
|
462 | + if ($link_num != 0) { |
|
463 | + echo ' |
|
446 | 464 | <span class="dividers">', $context['right_to_left'] ? ' ◄ ' : ' ► ', '</span>'; |
465 | + } |
|
447 | 466 | |
448 | 467 | // Show something before the link? |
449 | - if (isset($tree['extra_before'])) |
|
450 | - echo $tree['extra_before'], ' '; |
|
468 | + if (isset($tree['extra_before'])) { |
|
469 | + echo $tree['extra_before'], ' '; |
|
470 | + } |
|
451 | 471 | |
452 | 472 | // Show the link, including a URL if it should have one. |
453 | - if (isset($tree['url'])) |
|
454 | - echo ' |
|
473 | + if (isset($tree['url'])) { |
|
474 | + echo ' |
|
455 | 475 | <a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>'; |
456 | - else |
|
457 | - echo ' |
|
476 | + } else { |
|
477 | + echo ' |
|
458 | 478 | <span>' . $tree['name'] . '</span>'; |
479 | + } |
|
459 | 480 | |
460 | 481 | // Show something after the link...? |
461 | - if (isset($tree['extra_after'])) |
|
462 | - echo ' ', $tree['extra_after']; |
|
482 | + if (isset($tree['extra_after'])) { |
|
483 | + echo ' ', $tree['extra_after']; |
|
484 | + } |
|
463 | 485 | |
464 | 486 | echo ' |
465 | 487 | </li>'; |
@@ -509,13 +531,14 @@ discard block |
||
509 | 531 | echo ' |
510 | 532 | <ul>'; |
511 | 533 | |
512 | - foreach ($childbutton['sub_buttons'] as $grandchildbutton) |
|
513 | - echo ' |
|
534 | + foreach ($childbutton['sub_buttons'] as $grandchildbutton) { |
|
535 | + echo ' |
|
514 | 536 | <li> |
515 | 537 | <a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '> |
516 | 538 | ', $grandchildbutton['title'], ' |
517 | 539 | </a> |
518 | 540 | </li>'; |
541 | + } |
|
519 | 542 | |
520 | 543 | echo ' |
521 | 544 | </ul>'; |
@@ -546,8 +569,9 @@ discard block |
||
546 | 569 | { |
547 | 570 | global $context, $txt; |
548 | 571 | |
549 | - if (!is_array($strip_options)) |
|
550 | - $strip_options = array(); |
|
572 | + if (!is_array($strip_options)) { |
|
573 | + $strip_options = array(); |
|
574 | + } |
|
551 | 575 | |
552 | 576 | // Create the buttons... |
553 | 577 | $buttons = array(); |
@@ -556,8 +580,9 @@ discard block |
||
556 | 580 | // As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!) |
557 | 581 | if (!isset($value['test']) || !empty($context[$value['test']])) |
558 | 582 | { |
559 | - if (!isset($value['id'])) |
|
560 | - $value['id'] = $key; |
|
583 | + if (!isset($value['id'])) { |
|
584 | + $value['id'] = $key; |
|
585 | + } |
|
561 | 586 | |
562 | 587 | $button = ' |
563 | 588 | <a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' ' . $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="' . $value['url'] . '"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>'; |
@@ -570,13 +595,15 @@ discard block |
||
570 | 595 | <div class="overview">'; |
571 | 596 | foreach ($value['sub_buttons'] as $element) |
572 | 597 | { |
573 | - if (isset($element['test']) && empty($context[$element['test']])) |
|
574 | - continue; |
|
598 | + if (isset($element['test']) && empty($context[$element['test']])) { |
|
599 | + continue; |
|
600 | + } |
|
575 | 601 | |
576 | 602 | $button .= ' |
577 | 603 | <a href="' . $element['url'] . '"><strong>' . $txt[$element['text']] . '</strong>'; |
578 | - if (isset($txt[$element['text'] . '_desc'])) |
|
579 | - $button .= '<br /><span>' . $txt[$element['text'] . '_desc'] . '</span>'; |
|
604 | + if (isset($txt[$element['text'] . '_desc'])) { |
|
605 | + $button .= '<br /><span>' . $txt[$element['text'] . '_desc'] . '</span>'; |
|
606 | + } |
|
580 | 607 | $button .= '</a>'; |
581 | 608 | } |
582 | 609 | $button .= ' |
@@ -590,8 +617,9 @@ discard block |
||
590 | 617 | } |
591 | 618 | |
592 | 619 | // No buttons? No button strip either. |
593 | - if (empty($buttons)) |
|
594 | - return; |
|
620 | + if (empty($buttons)) { |
|
621 | + return; |
|
622 | + } |
|
595 | 623 | |
596 | 624 | echo ' |
597 | 625 | <div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '> |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | * @version 2.1 Beta 3 |
16 | 16 | */ |
17 | 17 | |
18 | -if (!defined('SMF')) |
|
18 | +if (!defined('SMF')) { |
|
19 | 19 | die('No direct access...'); |
20 | +} |
|
20 | 21 | |
21 | 22 | /** |
22 | 23 | * This defines every profile field known to man. |
@@ -29,8 +30,9 @@ discard block |
||
29 | 30 | global $sourcedir, $profile_vars; |
30 | 31 | |
31 | 32 | // Don't load this twice! |
32 | - if (!empty($profile_fields) && !$force_reload) |
|
33 | - return; |
|
33 | + if (!empty($profile_fields) && !$force_reload) { |
|
34 | + return; |
|
35 | + } |
|
34 | 36 | |
35 | 37 | /* This horrific array defines all the profile fields in the whole world! |
36 | 38 | In general each "field" has one array - the key of which is the database column name associated with said field. Each item |
@@ -103,13 +105,14 @@ discard block |
||
103 | 105 | if (isset($_POST['bday2'], $_POST['bday3']) && $value > 0 && $_POST['bday2'] > 0) |
104 | 106 | { |
105 | 107 | // Set to blank? |
106 | - if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1) |
|
107 | - $value = '0001-01-01'; |
|
108 | - else |
|
109 | - $value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 4 ? 4 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 4 ? 4 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '0001-01-01'; |
|
108 | + if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1) { |
|
109 | + $value = '0001-01-01'; |
|
110 | + } else { |
|
111 | + $value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 4 ? 4 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 4 ? 4 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '0001-01-01'; |
|
112 | + } |
|
113 | + } else { |
|
114 | + $value = '0001-01-01'; |
|
110 | 115 | } |
111 | - else |
|
112 | - $value = '0001-01-01'; |
|
113 | 116 | |
114 | 117 | $profile_vars['birthdate'] = $value; |
115 | 118 | $cur_profile['birthdate'] = $value; |
@@ -127,8 +130,7 @@ discard block |
||
127 | 130 | { |
128 | 131 | $value = checkdate($dates[2], $dates[3], $dates[1] < 4 ? 4 : $dates[1]) ? sprintf('%04d-%02d-%02d', $dates[1] < 4 ? 4 : $dates[1], $dates[2], $dates[3]) : '0001-01-01'; |
129 | 132 | return true; |
130 | - } |
|
131 | - else |
|
133 | + } else |
|
132 | 134 | { |
133 | 135 | $value = empty($cur_profile['birthdate']) ? '0001-01-01' : $cur_profile['birthdate']; |
134 | 136 | return false; |
@@ -150,10 +152,11 @@ discard block |
||
150 | 152 | return $txt['invalid_registration'] . ' ' . strftime('%d %b %Y ' . (strpos($user_info['time_format'], '%H') !== false ? '%I:%M:%S %p' : '%H:%M:%S'), forum_time(false)); |
151 | 153 | } |
152 | 154 | // As long as it doesn't equal "N/A"... |
153 | - elseif ($value != $txt['not_applicable'] && $value != strtotime(strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))) |
|
154 | - $value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
155 | - else |
|
156 | - $value = $cur_profile['date_registered']; |
|
155 | + elseif ($value != $txt['not_applicable'] && $value != strtotime(strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))) { |
|
156 | + $value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
157 | + } else { |
|
158 | + $value = $cur_profile['date_registered']; |
|
159 | + } |
|
157 | 160 | |
158 | 161 | return true; |
159 | 162 | }, |
@@ -177,8 +180,9 @@ discard block |
||
177 | 180 | { |
178 | 181 | global $context, $old_profile, $profile_vars, $sourcedir, $modSettings; |
179 | 182 | |
180 | - if (strtolower($value) == strtolower($old_profile['email_address'])) |
|
181 | - return false; |
|
183 | + if (strtolower($value) == strtolower($old_profile['email_address'])) { |
|
184 | + return false; |
|
185 | + } |
|
182 | 186 | |
183 | 187 | $isValid = profileValidateEmail($value, $context['id_member']); |
184 | 188 | |
@@ -254,11 +258,11 @@ discard block |
||
254 | 258 | |
255 | 259 | if (isset($context['profile_languages'][$value])) |
256 | 260 | { |
257 | - if ($context['user']['is_owner'] && empty($context['password_auth_failed'])) |
|
258 | - $_SESSION['language'] = $value; |
|
261 | + if ($context['user']['is_owner'] && empty($context['password_auth_failed'])) { |
|
262 | + $_SESSION['language'] = $value; |
|
263 | + } |
|
259 | 264 | return true; |
260 | - } |
|
261 | - else |
|
265 | + } else |
|
262 | 266 | { |
263 | 267 | $value = $cur_profile['lngfile']; |
264 | 268 | return false; |
@@ -282,13 +286,14 @@ discard block |
||
282 | 286 | |
283 | 287 | // Maybe they are trying to change their password as well? |
284 | 288 | $resetPassword = true; |
285 | - if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '' && isset($_POST['passwrd2']) && $_POST['passwrd1'] == $_POST['passwrd2'] && validatePassword($_POST['passwrd1'], $value, array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])) == null) |
|
286 | - $resetPassword = false; |
|
289 | + if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '' && isset($_POST['passwrd2']) && $_POST['passwrd1'] == $_POST['passwrd2'] && validatePassword($_POST['passwrd1'], $value, array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])) == null) { |
|
290 | + $resetPassword = false; |
|
291 | + } |
|
287 | 292 | |
288 | 293 | // Do the reset... this will send them an email too. |
289 | - if ($resetPassword) |
|
290 | - resetPassword($context['id_member'], $value); |
|
291 | - elseif ($value !== null) |
|
294 | + if ($resetPassword) { |
|
295 | + resetPassword($context['id_member'], $value); |
|
296 | + } elseif ($value !== null) |
|
292 | 297 | { |
293 | 298 | validateUsername($context['id_member'], trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $value))); |
294 | 299 | updateMemberData($context['id_member'], array('member_name' => $value)); |
@@ -312,20 +317,23 @@ discard block |
||
312 | 317 | 'input_validate' => function(&$value) use ($sourcedir, $user_info, $smcFunc, $cur_profile) |
313 | 318 | { |
314 | 319 | // If we didn't try it then ignore it! |
315 | - if ($value == '') |
|
316 | - return false; |
|
320 | + if ($value == '') { |
|
321 | + return false; |
|
322 | + } |
|
317 | 323 | |
318 | 324 | // Do the two entries for the password even match? |
319 | - if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2']) |
|
320 | - return 'bad_new_password'; |
|
325 | + if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2']) { |
|
326 | + return 'bad_new_password'; |
|
327 | + } |
|
321 | 328 | |
322 | 329 | // Let's get the validation function into play... |
323 | 330 | require_once($sourcedir . '/Subs-Auth.php'); |
324 | 331 | $passwordErrors = validatePassword($value, $cur_profile['member_name'], array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])); |
325 | 332 | |
326 | 333 | // Were there errors? |
327 | - if ($passwordErrors != null) |
|
328 | - return 'password_' . $passwordErrors; |
|
334 | + if ($passwordErrors != null) { |
|
335 | + return 'password_' . $passwordErrors; |
|
336 | + } |
|
329 | 337 | |
330 | 338 | // Set up the new password variable... ready for storage. |
331 | 339 | $value = hash_password($cur_profile['member_name'], un_htmlspecialchars($value)); |
@@ -350,8 +358,9 @@ discard block |
||
350 | 358 | 'permission' => 'profile_blurb', |
351 | 359 | 'input_validate' => function(&$value) use ($smcFunc) |
352 | 360 | { |
353 | - if ($smcFunc['strlen']($value) > 50) |
|
354 | - return 'personal_text_too_long'; |
|
361 | + if ($smcFunc['strlen']($value) > 50) { |
|
362 | + return 'personal_text_too_long'; |
|
363 | + } |
|
355 | 364 | |
356 | 365 | return true; |
357 | 366 | }, |
@@ -386,10 +395,11 @@ discard block |
||
386 | 395 | 'permission' => 'moderate_forum', |
387 | 396 | 'input_validate' => function(&$value) |
388 | 397 | { |
389 | - if (!is_numeric($value)) |
|
390 | - return 'digits_only'; |
|
391 | - else |
|
392 | - $value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0; |
|
398 | + if (!is_numeric($value)) { |
|
399 | + return 'digits_only'; |
|
400 | + } else { |
|
401 | + $value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0; |
|
402 | + } |
|
393 | 403 | return true; |
394 | 404 | }, |
395 | 405 | ), |
@@ -405,15 +415,16 @@ discard block |
||
405 | 415 | { |
406 | 416 | $value = trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $value)); |
407 | 417 | |
408 | - if (trim($value) == '') |
|
409 | - return 'no_name'; |
|
410 | - elseif ($smcFunc['strlen']($value) > 60) |
|
411 | - return 'name_too_long'; |
|
412 | - elseif ($cur_profile['real_name'] != $value) |
|
418 | + if (trim($value) == '') { |
|
419 | + return 'no_name'; |
|
420 | + } elseif ($smcFunc['strlen']($value) > 60) { |
|
421 | + return 'name_too_long'; |
|
422 | + } elseif ($cur_profile['real_name'] != $value) |
|
413 | 423 | { |
414 | 424 | require_once($sourcedir . '/Subs-Members.php'); |
415 | - if (isReservedName($value, $context['id_member'])) |
|
416 | - return 'name_taken'; |
|
425 | + if (isReservedName($value, $context['id_member'])) { |
|
426 | + return 'name_taken'; |
|
427 | + } |
|
417 | 428 | } |
418 | 429 | return true; |
419 | 430 | }, |
@@ -471,8 +482,9 @@ discard block |
||
471 | 482 | 'selected' => $set == $context['member']['smiley_set']['id'] |
472 | 483 | ); |
473 | 484 | |
474 | - if ($context['smiley_sets'][$i]['selected']) |
|
475 | - $context['member']['smiley_set']['name'] = $set_names[$i]; |
|
485 | + if ($context['smiley_sets'][$i]['selected']) { |
|
486 | + $context['member']['smiley_set']['name'] = $set_names[$i]; |
|
487 | + } |
|
476 | 488 | } |
477 | 489 | return true; |
478 | 490 | }, |
@@ -481,8 +493,9 @@ discard block |
||
481 | 493 | global $modSettings; |
482 | 494 | |
483 | 495 | $smiley_sets = explode(',', $modSettings['smiley_sets_known']); |
484 | - if (!in_array($value, $smiley_sets) && $value != 'none') |
|
485 | - $value = ''; |
|
496 | + if (!in_array($value, $smiley_sets) && $value != 'none') { |
|
497 | + $value = ''; |
|
498 | + } |
|
486 | 499 | return true; |
487 | 500 | }, |
488 | 501 | ), |
@@ -497,8 +510,9 @@ discard block |
||
497 | 510 | loadLanguage('Settings'); |
498 | 511 | |
499 | 512 | $context['allow_no_censored'] = false; |
500 | - if ($user_info['is_admin'] || $context['user']['is_owner']) |
|
501 | - $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); |
|
513 | + if ($user_info['is_admin'] || $context['user']['is_owner']) { |
|
514 | + $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); |
|
515 | + } |
|
502 | 516 | |
503 | 517 | return true; |
504 | 518 | }, |
@@ -545,8 +559,9 @@ discard block |
||
545 | 559 | 'input_validate' => function($value) |
546 | 560 | { |
547 | 561 | $tz = smf_list_timezones(); |
548 | - if (!isset($tz[$value])) |
|
549 | - return 'bad_timezone'; |
|
562 | + if (!isset($tz[$value])) { |
|
563 | + return 'bad_timezone'; |
|
564 | + } |
|
550 | 565 | |
551 | 566 | return true; |
552 | 567 | }, |
@@ -561,8 +576,9 @@ discard block |
||
561 | 576 | 'enabled' => !empty($modSettings['titlesEnable']), |
562 | 577 | 'input_validate' => function(&$value) use ($smcFunc) |
563 | 578 | { |
564 | - if ($smcFunc['strlen']($value) > 50) |
|
565 | - return 'user_title_too_long'; |
|
579 | + if ($smcFunc['strlen']($value) > 50) { |
|
580 | + return 'user_title_too_long'; |
|
581 | + } |
|
566 | 582 | |
567 | 583 | return true; |
568 | 584 | }, |
@@ -584,10 +600,12 @@ discard block |
||
584 | 600 | // Fix the URL... |
585 | 601 | 'input_validate' => function(&$value) |
586 | 602 | { |
587 | - if (strlen(trim($value)) > 0 && strpos($value, '://') === false) |
|
588 | - $value = 'http://' . $value; |
|
589 | - if (strlen($value) < 8 || (substr($value, 0, 7) !== 'http://' && substr($value, 0, 8) !== 'https://')) |
|
590 | - $value = ''; |
|
603 | + if (strlen(trim($value)) > 0 && strpos($value, '://') === false) { |
|
604 | + $value = 'http://' . $value; |
|
605 | + } |
|
606 | + if (strlen($value) < 8 || (substr($value, 0, 7) !== 'http://' && substr($value, 0, 8) !== 'https://')) { |
|
607 | + $value = ''; |
|
608 | + } |
|
591 | 609 | return true; |
592 | 610 | }, |
593 | 611 | 'link_with' => 'website', |
@@ -601,16 +619,19 @@ discard block |
||
601 | 619 | foreach ($profile_fields as $key => $field) |
602 | 620 | { |
603 | 621 | // Do we have permission to do this? |
604 | - if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission'])) |
|
605 | - unset($profile_fields[$key]); |
|
622 | + if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission'])) { |
|
623 | + unset($profile_fields[$key]); |
|
624 | + } |
|
606 | 625 | |
607 | 626 | // Is it enabled? |
608 | - if (isset($field['enabled']) && !$field['enabled']) |
|
609 | - unset($profile_fields[$key]); |
|
627 | + if (isset($field['enabled']) && !$field['enabled']) { |
|
628 | + unset($profile_fields[$key]); |
|
629 | + } |
|
610 | 630 | |
611 | 631 | // Is it specifically disabled? |
612 | - if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields))) |
|
613 | - unset($profile_fields[$key]); |
|
632 | + if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields))) { |
|
633 | + unset($profile_fields[$key]); |
|
634 | + } |
|
614 | 635 | } |
615 | 636 | } |
616 | 637 | |
@@ -635,9 +656,10 @@ discard block |
||
635 | 656 | loadProfileFields(true); |
636 | 657 | |
637 | 658 | // First check for any linked sets. |
638 | - foreach ($profile_fields as $key => $field) |
|
639 | - if (isset($field['link_with']) && in_array($field['link_with'], $fields)) |
|
659 | + foreach ($profile_fields as $key => $field) { |
|
660 | + if (isset($field['link_with']) && in_array($field['link_with'], $fields)) |
|
640 | 661 | $fields[] = $key; |
662 | + } |
|
641 | 663 | |
642 | 664 | $i = 0; |
643 | 665 | $last_type = ''; |
@@ -649,38 +671,46 @@ discard block |
||
649 | 671 | $cur_field = &$profile_fields[$field]; |
650 | 672 | |
651 | 673 | // Does it have a preload and does that preload succeed? |
652 | - if (isset($cur_field['preload']) && !$cur_field['preload']()) |
|
653 | - continue; |
|
674 | + if (isset($cur_field['preload']) && !$cur_field['preload']()) { |
|
675 | + continue; |
|
676 | + } |
|
654 | 677 | |
655 | 678 | // If this is anything but complex we need to do more cleaning! |
656 | 679 | if ($cur_field['type'] != 'callback' && $cur_field['type'] != 'hidden') |
657 | 680 | { |
658 | - if (!isset($cur_field['label'])) |
|
659 | - $cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field; |
|
681 | + if (!isset($cur_field['label'])) { |
|
682 | + $cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field; |
|
683 | + } |
|
660 | 684 | |
661 | 685 | // Everything has a value! |
662 | - if (!isset($cur_field['value'])) |
|
663 | - $cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : ''; |
|
686 | + if (!isset($cur_field['value'])) { |
|
687 | + $cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : ''; |
|
688 | + } |
|
664 | 689 | |
665 | 690 | // Any input attributes? |
666 | 691 | $cur_field['input_attr'] = !empty($cur_field['input_attr']) ? implode(',', $cur_field['input_attr']) : ''; |
667 | 692 | } |
668 | 693 | |
669 | 694 | // Was there an error with this field on posting? |
670 | - if (isset($context['profile_errors'][$field])) |
|
671 | - $cur_field['is_error'] = true; |
|
695 | + if (isset($context['profile_errors'][$field])) { |
|
696 | + $cur_field['is_error'] = true; |
|
697 | + } |
|
672 | 698 | |
673 | 699 | // Any javascript stuff? |
674 | - if (!empty($cur_field['js_submit'])) |
|
675 | - $context['profile_onsubmit_javascript'] .= $cur_field['js_submit']; |
|
676 | - if (!empty($cur_field['js'])) |
|
677 | - $context['profile_javascript'] .= $cur_field['js']; |
|
700 | + if (!empty($cur_field['js_submit'])) { |
|
701 | + $context['profile_onsubmit_javascript'] .= $cur_field['js_submit']; |
|
702 | + } |
|
703 | + if (!empty($cur_field['js'])) { |
|
704 | + $context['profile_javascript'] .= $cur_field['js']; |
|
705 | + } |
|
678 | 706 | |
679 | 707 | // Any template stuff? |
680 | - if (!empty($cur_field['prehtml'])) |
|
681 | - $context['profile_prehtml'] .= $cur_field['prehtml']; |
|
682 | - if (!empty($cur_field['posthtml'])) |
|
683 | - $context['profile_posthtml'] .= $cur_field['posthtml']; |
|
708 | + if (!empty($cur_field['prehtml'])) { |
|
709 | + $context['profile_prehtml'] .= $cur_field['prehtml']; |
|
710 | + } |
|
711 | + if (!empty($cur_field['posthtml'])) { |
|
712 | + $context['profile_posthtml'] .= $cur_field['posthtml']; |
|
713 | + } |
|
684 | 714 | |
685 | 715 | // Finally put it into context? |
686 | 716 | if ($cur_field['type'] != 'hidden') |
@@ -713,12 +743,14 @@ discard block |
||
713 | 743 | }, false);' : ''), true); |
714 | 744 | |
715 | 745 | // Any onsubmit javascript? |
716 | - if (!empty($context['profile_onsubmit_javascript'])) |
|
717 | - addInlineJavaScript($context['profile_onsubmit_javascript'], true); |
|
746 | + if (!empty($context['profile_onsubmit_javascript'])) { |
|
747 | + addInlineJavaScript($context['profile_onsubmit_javascript'], true); |
|
748 | + } |
|
718 | 749 | |
719 | 750 | // Any totally custom stuff? |
720 | - if (!empty($context['profile_javascript'])) |
|
721 | - addInlineJavaScript($context['profile_javascript'], true); |
|
751 | + if (!empty($context['profile_javascript'])) { |
|
752 | + addInlineJavaScript($context['profile_javascript'], true); |
|
753 | + } |
|
722 | 754 | |
723 | 755 | // Free up some memory. |
724 | 756 | unset($profile_fields); |
@@ -739,8 +771,9 @@ discard block |
||
739 | 771 | |
740 | 772 | // This allows variables to call activities when they save - by default just to reload their settings |
741 | 773 | $context['profile_execute_on_save'] = array(); |
742 | - if ($context['user']['is_owner']) |
|
743 | - $context['profile_execute_on_save']['reload_user'] = 'profileReloadUser'; |
|
774 | + if ($context['user']['is_owner']) { |
|
775 | + $context['profile_execute_on_save']['reload_user'] = 'profileReloadUser'; |
|
776 | + } |
|
744 | 777 | |
745 | 778 | // Assume we log nothing. |
746 | 779 | $context['log_changes'] = array(); |
@@ -748,8 +781,9 @@ discard block |
||
748 | 781 | // Cycle through the profile fields working out what to do! |
749 | 782 | foreach ($profile_fields as $key => $field) |
750 | 783 | { |
751 | - if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key == 'signature')) |
|
752 | - continue; |
|
784 | + if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key == 'signature')) { |
|
785 | + continue; |
|
786 | + } |
|
753 | 787 | |
754 | 788 | // What gets updated? |
755 | 789 | $db_key = isset($field['save_key']) ? $field['save_key'] : $key; |
@@ -777,12 +811,13 @@ discard block |
||
777 | 811 | $field['cast_type'] = empty($field['cast_type']) ? $field['type'] : $field['cast_type']; |
778 | 812 | |
779 | 813 | // Finally, clean up certain types. |
780 | - if ($field['cast_type'] == 'int') |
|
781 | - $_POST[$key] = (int) $_POST[$key]; |
|
782 | - elseif ($field['cast_type'] == 'float') |
|
783 | - $_POST[$key] = (float) $_POST[$key]; |
|
784 | - elseif ($field['cast_type'] == 'check') |
|
785 | - $_POST[$key] = !empty($_POST[$key]) ? 1 : 0; |
|
814 | + if ($field['cast_type'] == 'int') { |
|
815 | + $_POST[$key] = (int) $_POST[$key]; |
|
816 | + } elseif ($field['cast_type'] == 'float') { |
|
817 | + $_POST[$key] = (float) $_POST[$key]; |
|
818 | + } elseif ($field['cast_type'] == 'check') { |
|
819 | + $_POST[$key] = !empty($_POST[$key]) ? 1 : 0; |
|
820 | + } |
|
786 | 821 | |
787 | 822 | // If we got here we're doing OK. |
788 | 823 | if ($field['type'] != 'hidden' && (!isset($old_profile[$key]) || $_POST[$key] != $old_profile[$key])) |
@@ -793,11 +828,12 @@ discard block |
||
793 | 828 | $cur_profile[$key] = $_POST[$key]; |
794 | 829 | |
795 | 830 | // Are we logging it? |
796 | - if (!empty($field['log_change']) && isset($old_profile[$key])) |
|
797 | - $context['log_changes'][$key] = array( |
|
831 | + if (!empty($field['log_change']) && isset($old_profile[$key])) { |
|
832 | + $context['log_changes'][$key] = array( |
|
798 | 833 | 'previous' => $old_profile[$key], |
799 | 834 | 'new' => $_POST[$key], |
800 | 835 | ); |
836 | + } |
|
801 | 837 | } |
802 | 838 | |
803 | 839 | // Logging group changes are a bit different... |
@@ -830,10 +866,11 @@ discard block |
||
830 | 866 | { |
831 | 867 | foreach ($groups as $id => $group) |
832 | 868 | { |
833 | - if (isset($context['member_groups'][$group])) |
|
834 | - $additional_groups[$type][$id] = $context['member_groups'][$group]['name']; |
|
835 | - else |
|
836 | - unset($additional_groups[$type][$id]); |
|
869 | + if (isset($context['member_groups'][$group])) { |
|
870 | + $additional_groups[$type][$id] = $context['member_groups'][$group]['name']; |
|
871 | + } else { |
|
872 | + unset($additional_groups[$type][$id]); |
|
873 | + } |
|
837 | 874 | } |
838 | 875 | $additional_groups[$type] = implode(', ', $additional_groups[$type]); |
839 | 876 | } |
@@ -844,10 +881,11 @@ discard block |
||
844 | 881 | } |
845 | 882 | |
846 | 883 | // @todo Temporary |
847 | - if ($context['user']['is_owner']) |
|
848 | - $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own')); |
|
849 | - else |
|
850 | - $changeOther = allowedTo('profile_extra_any'); |
|
884 | + if ($context['user']['is_owner']) { |
|
885 | + $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own')); |
|
886 | + } else { |
|
887 | + $changeOther = allowedTo('profile_extra_any'); |
|
888 | + } |
|
851 | 889 | if ($changeOther && empty($post_errors)) |
852 | 890 | { |
853 | 891 | makeThemeChanges($context['id_member'], isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']); |
@@ -855,8 +893,9 @@ discard block |
||
855 | 893 | { |
856 | 894 | $custom_fields_errors = makeCustomFieldChanges($context['id_member'], $_REQUEST['sa'], false, true); |
857 | 895 | |
858 | - if (!empty($custom_fields_errors)) |
|
859 | - $post_errors = array_merge($post_errors, $custom_fields_errors); |
|
896 | + if (!empty($custom_fields_errors)) { |
|
897 | + $post_errors = array_merge($post_errors, $custom_fields_errors); |
|
898 | + } |
|
860 | 899 | } |
861 | 900 | } |
862 | 901 | |
@@ -882,9 +921,9 @@ discard block |
||
882 | 921 | if ($context['user']['is_owner']) |
883 | 922 | { |
884 | 923 | $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own', 'profile_website_any', 'profile_website_own', 'profile_signature_any', 'profile_signature_own')); |
924 | + } else { |
|
925 | + $changeOther = allowedTo(array('profile_extra_any', 'profile_website_any', 'profile_signature_any')); |
|
885 | 926 | } |
886 | - else |
|
887 | - $changeOther = allowedTo(array('profile_extra_any', 'profile_website_any', 'profile_signature_any')); |
|
888 | 927 | |
889 | 928 | // Arrays of all the changes - makes things easier. |
890 | 929 | $profile_bools = array(); |
@@ -895,22 +934,25 @@ discard block |
||
895 | 934 | 'ignore_boards', |
896 | 935 | ); |
897 | 936 | |
898 | - if (isset($_POST['sa']) && $_POST['sa'] == 'ignoreboards' && empty($_POST['ignore_brd'])) |
|
899 | - $_POST['ignore_brd'] = array(); |
|
937 | + if (isset($_POST['sa']) && $_POST['sa'] == 'ignoreboards' && empty($_POST['ignore_brd'])) { |
|
938 | + $_POST['ignore_brd'] = array(); |
|
939 | + } |
|
900 | 940 | |
901 | 941 | unset($_POST['ignore_boards']); // Whatever it is set to is a dirty filthy thing. Kinda like our minds. |
902 | 942 | if (isset($_POST['ignore_brd'])) |
903 | 943 | { |
904 | - if (!is_array($_POST['ignore_brd'])) |
|
905 | - $_POST['ignore_brd'] = array($_POST['ignore_brd']); |
|
944 | + if (!is_array($_POST['ignore_brd'])) { |
|
945 | + $_POST['ignore_brd'] = array($_POST['ignore_brd']); |
|
946 | + } |
|
906 | 947 | |
907 | 948 | foreach ($_POST['ignore_brd'] as $k => $d) |
908 | 949 | { |
909 | 950 | $d = (int) $d; |
910 | - if ($d != 0) |
|
911 | - $_POST['ignore_brd'][$k] = $d; |
|
912 | - else |
|
913 | - unset($_POST['ignore_brd'][$k]); |
|
951 | + if ($d != 0) { |
|
952 | + $_POST['ignore_brd'][$k] = $d; |
|
953 | + } else { |
|
954 | + unset($_POST['ignore_brd'][$k]); |
|
955 | + } |
|
914 | 956 | } |
915 | 957 | $_POST['ignore_boards'] = implode(',', $_POST['ignore_brd']); |
916 | 958 | unset($_POST['ignore_brd']); |
@@ -923,21 +965,26 @@ discard block |
||
923 | 965 | makeThemeChanges($memID, isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']); |
924 | 966 | //makeAvatarChanges($memID, $post_errors); |
925 | 967 | |
926 | - if (!empty($_REQUEST['sa'])) |
|
927 | - makeCustomFieldChanges($memID, $_REQUEST['sa'], false); |
|
968 | + if (!empty($_REQUEST['sa'])) { |
|
969 | + makeCustomFieldChanges($memID, $_REQUEST['sa'], false); |
|
970 | + } |
|
928 | 971 | |
929 | - foreach ($profile_bools as $var) |
|
930 | - if (isset($_POST[$var])) |
|
972 | + foreach ($profile_bools as $var) { |
|
973 | + if (isset($_POST[$var])) |
|
931 | 974 | $profile_vars[$var] = empty($_POST[$var]) ? '0' : '1'; |
932 | - foreach ($profile_ints as $var) |
|
933 | - if (isset($_POST[$var])) |
|
975 | + } |
|
976 | + foreach ($profile_ints as $var) { |
|
977 | + if (isset($_POST[$var])) |
|
934 | 978 | $profile_vars[$var] = $_POST[$var] != '' ? (int) $_POST[$var] : ''; |
935 | - foreach ($profile_floats as $var) |
|
936 | - if (isset($_POST[$var])) |
|
979 | + } |
|
980 | + foreach ($profile_floats as $var) { |
|
981 | + if (isset($_POST[$var])) |
|
937 | 982 | $profile_vars[$var] = (float) $_POST[$var]; |
938 | - foreach ($profile_strings as $var) |
|
939 | - if (isset($_POST[$var])) |
|
983 | + } |
|
984 | + foreach ($profile_strings as $var) { |
|
985 | + if (isset($_POST[$var])) |
|
940 | 986 | $profile_vars[$var] = $_POST[$var]; |
987 | + } |
|
941 | 988 | } |
942 | 989 | } |
943 | 990 | |
@@ -971,8 +1018,9 @@ discard block |
||
971 | 1018 | ); |
972 | 1019 | |
973 | 1020 | // Can't change reserved vars. |
974 | - if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0)) |
|
975 | - fatal_lang_error('no_access', false); |
|
1021 | + if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0)) { |
|
1022 | + fatal_lang_error('no_access', false); |
|
1023 | + } |
|
976 | 1024 | |
977 | 1025 | // Don't allow any overriding of custom fields with default or non-default options. |
978 | 1026 | $request = $smcFunc['db_query']('', ' |
@@ -984,8 +1032,9 @@ discard block |
||
984 | 1032 | ) |
985 | 1033 | ); |
986 | 1034 | $custom_fields = array(); |
987 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
988 | - $custom_fields[] = $row['col_name']; |
|
1035 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1036 | + $custom_fields[] = $row['col_name']; |
|
1037 | + } |
|
989 | 1038 | $smcFunc['db_free_result']($request); |
990 | 1039 | |
991 | 1040 | // These are the theme changes... |
@@ -994,33 +1043,39 @@ discard block |
||
994 | 1043 | { |
995 | 1044 | foreach ($_POST['options'] as $opt => $val) |
996 | 1045 | { |
997 | - if (in_array($opt, $custom_fields)) |
|
998 | - continue; |
|
1046 | + if (in_array($opt, $custom_fields)) { |
|
1047 | + continue; |
|
1048 | + } |
|
999 | 1049 | |
1000 | 1050 | // These need to be controlled. |
1001 | - if ($opt == 'topics_per_page' || $opt == 'messages_per_page') |
|
1002 | - $val = max(0, min($val, 50)); |
|
1051 | + if ($opt == 'topics_per_page' || $opt == 'messages_per_page') { |
|
1052 | + $val = max(0, min($val, 50)); |
|
1053 | + } |
|
1003 | 1054 | // We don't set this per theme anymore. |
1004 | - elseif ($opt == 'allow_no_censored') |
|
1005 | - continue; |
|
1055 | + elseif ($opt == 'allow_no_censored') { |
|
1056 | + continue; |
|
1057 | + } |
|
1006 | 1058 | |
1007 | 1059 | $themeSetArray[] = array($memID, $id_theme, $opt, is_array($val) ? implode(',', $val) : $val); |
1008 | 1060 | } |
1009 | 1061 | } |
1010 | 1062 | |
1011 | 1063 | $erase_options = array(); |
1012 | - if (isset($_POST['default_options']) && is_array($_POST['default_options'])) |
|
1013 | - foreach ($_POST['default_options'] as $opt => $val) |
|
1064 | + if (isset($_POST['default_options']) && is_array($_POST['default_options'])) { |
|
1065 | + foreach ($_POST['default_options'] as $opt => $val) |
|
1014 | 1066 | { |
1015 | 1067 | if (in_array($opt, $custom_fields)) |
1016 | 1068 | continue; |
1069 | + } |
|
1017 | 1070 | |
1018 | 1071 | // These need to be controlled. |
1019 | - if ($opt == 'topics_per_page' || $opt == 'messages_per_page') |
|
1020 | - $val = max(0, min($val, 50)); |
|
1072 | + if ($opt == 'topics_per_page' || $opt == 'messages_per_page') { |
|
1073 | + $val = max(0, min($val, 50)); |
|
1074 | + } |
|
1021 | 1075 | // Only let admins and owners change the censor. |
1022 | - elseif ($opt == 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner']) |
|
1023 | - continue; |
|
1076 | + elseif ($opt == 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner']) { |
|
1077 | + continue; |
|
1078 | + } |
|
1024 | 1079 | |
1025 | 1080 | $themeSetArray[] = array($memID, 1, $opt, is_array($val) ? implode(',', $val) : $val); |
1026 | 1081 | $erase_options[] = $opt; |
@@ -1056,8 +1111,9 @@ discard block |
||
1056 | 1111 | |
1057 | 1112 | // Admins can choose any theme, even if it's not enabled... |
1058 | 1113 | $themes = allowedTo('admin_forum') ? explode(',', $modSettings['knownThemes']) : explode(',', $modSettings['enableThemes']); |
1059 | - foreach ($themes as $t) |
|
1060 | - cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60); |
|
1114 | + foreach ($themes as $t) { |
|
1115 | + cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60); |
|
1116 | + } |
|
1061 | 1117 | } |
1062 | 1118 | } |
1063 | 1119 | |
@@ -1076,8 +1132,9 @@ discard block |
||
1076 | 1132 | if (isset($_POST['edit_notify_boards']) && !empty($_POST['notify_boards'])) |
1077 | 1133 | { |
1078 | 1134 | // Make sure only integers are deleted. |
1079 | - foreach ($_POST['notify_boards'] as $index => $id) |
|
1080 | - $_POST['notify_boards'][$index] = (int) $id; |
|
1135 | + foreach ($_POST['notify_boards'] as $index => $id) { |
|
1136 | + $_POST['notify_boards'][$index] = (int) $id; |
|
1137 | + } |
|
1081 | 1138 | |
1082 | 1139 | // id_board = 0 is reserved for topic notifications. |
1083 | 1140 | $_POST['notify_boards'] = array_diff($_POST['notify_boards'], array(0)); |
@@ -1096,8 +1153,9 @@ discard block |
||
1096 | 1153 | // We are editing topic notifications...... |
1097 | 1154 | elseif (isset($_POST['edit_notify_topics']) && !empty($_POST['notify_topics'])) |
1098 | 1155 | { |
1099 | - foreach ($_POST['notify_topics'] as $index => $id) |
|
1100 | - $_POST['notify_topics'][$index] = (int) $id; |
|
1156 | + foreach ($_POST['notify_topics'] as $index => $id) { |
|
1157 | + $_POST['notify_topics'][$index] = (int) $id; |
|
1158 | + } |
|
1101 | 1159 | |
1102 | 1160 | // Make sure there are no zeros left. |
1103 | 1161 | $_POST['notify_topics'] = array_diff($_POST['notify_topics'], array(0)); |
@@ -1111,16 +1169,18 @@ discard block |
||
1111 | 1169 | 'selected_member' => $memID, |
1112 | 1170 | ) |
1113 | 1171 | ); |
1114 | - foreach ($_POST['notify_topics'] as $topic) |
|
1115 | - setNotifyPrefs($memID, array('topic_notify_' . $topic => 0)); |
|
1172 | + foreach ($_POST['notify_topics'] as $topic) { |
|
1173 | + setNotifyPrefs($memID, array('topic_notify_' . $topic => 0)); |
|
1174 | + } |
|
1116 | 1175 | } |
1117 | 1176 | |
1118 | 1177 | // We are removing topic preferences |
1119 | 1178 | elseif (isset($_POST['remove_notify_topics']) && !empty($_POST['notify_topics'])) |
1120 | 1179 | { |
1121 | 1180 | $prefs = array(); |
1122 | - foreach ($_POST['notify_topics'] as $topic) |
|
1123 | - $prefs[] = 'topic_notify_' . $topic; |
|
1181 | + foreach ($_POST['notify_topics'] as $topic) { |
|
1182 | + $prefs[] = 'topic_notify_' . $topic; |
|
1183 | + } |
|
1124 | 1184 | deleteNotifyPrefs($memID, $prefs); |
1125 | 1185 | } |
1126 | 1186 | |
@@ -1128,8 +1188,9 @@ discard block |
||
1128 | 1188 | elseif (isset($_POST['remove_notify_board']) && !empty($_POST['notify_boards'])) |
1129 | 1189 | { |
1130 | 1190 | $prefs = array(); |
1131 | - foreach ($_POST['notify_boards'] as $board) |
|
1132 | - $prefs[] = 'board_notify_' . $board; |
|
1191 | + foreach ($_POST['notify_boards'] as $board) { |
|
1192 | + $prefs[] = 'board_notify_' . $board; |
|
1193 | + } |
|
1133 | 1194 | deleteNotifyPrefs($memID, $prefs); |
1134 | 1195 | } |
1135 | 1196 | } |
@@ -1150,8 +1211,9 @@ discard block |
||
1150 | 1211 | |
1151 | 1212 | $errors = array(); |
1152 | 1213 | |
1153 | - if ($sanitize && isset($_POST['customfield'])) |
|
1154 | - $_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']); |
|
1214 | + if ($sanitize && isset($_POST['customfield'])) { |
|
1215 | + $_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']); |
|
1216 | + } |
|
1155 | 1217 | |
1156 | 1218 | $where = $area == 'register' ? 'show_reg != 0' : 'show_profile = {string:area}'; |
1157 | 1219 | |
@@ -1176,48 +1238,49 @@ discard block |
||
1176 | 1238 | - The data is not invisible to users but editable by the owner (or if it is the user is not the owner) |
1177 | 1239 | - The area isn't registration, and if it is that the field is not supposed to be shown there. |
1178 | 1240 | */ |
1179 | - if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0)) |
|
1180 | - continue; |
|
1241 | + if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0)) { |
|
1242 | + continue; |
|
1243 | + } |
|
1181 | 1244 | |
1182 | 1245 | // Validate the user data. |
1183 | - if ($row['field_type'] == 'check') |
|
1184 | - $value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0; |
|
1185 | - elseif ($row['field_type'] == 'select' || $row['field_type'] == 'radio') |
|
1246 | + if ($row['field_type'] == 'check') { |
|
1247 | + $value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0; |
|
1248 | + } elseif ($row['field_type'] == 'select' || $row['field_type'] == 'radio') |
|
1186 | 1249 | { |
1187 | 1250 | $value = $row['default_value']; |
1188 | - foreach (explode(',', $row['field_options']) as $k => $v) |
|
1189 | - if (isset($_POST['customfield'][$row['col_name']]) && $_POST['customfield'][$row['col_name']] == $k) |
|
1251 | + foreach (explode(',', $row['field_options']) as $k => $v) { |
|
1252 | + if (isset($_POST['customfield'][$row['col_name']]) && $_POST['customfield'][$row['col_name']] == $k) |
|
1190 | 1253 | $value = $v; |
1254 | + } |
|
1191 | 1255 | } |
1192 | 1256 | // Otherwise some form of text! |
1193 | 1257 | else |
1194 | 1258 | { |
1195 | 1259 | $value = isset($_POST['customfield'][$row['col_name']]) ? $_POST['customfield'][$row['col_name']] : ''; |
1196 | - if ($row['field_length']) |
|
1197 | - $value = $smcFunc['substr']($value, 0, $row['field_length']); |
|
1260 | + if ($row['field_length']) { |
|
1261 | + $value = $smcFunc['substr']($value, 0, $row['field_length']); |
|
1262 | + } |
|
1198 | 1263 | |
1199 | 1264 | // Any masks? |
1200 | 1265 | if ($row['field_type'] == 'text' && !empty($row['mask']) && $row['mask'] != 'none') |
1201 | 1266 | { |
1202 | 1267 | if ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255)) |
1203 | 1268 | { |
1204 | - if ($returnErrors) |
|
1205 | - $errors[] = 'custom_field_mail_fail'; |
|
1206 | - |
|
1207 | - else |
|
1208 | - $value = ''; |
|
1209 | - } |
|
1210 | - elseif ($row['mask'] == 'number') |
|
1269 | + if ($returnErrors) { |
|
1270 | + $errors[] = 'custom_field_mail_fail'; |
|
1271 | + } else { |
|
1272 | + $value = ''; |
|
1273 | + } |
|
1274 | + } elseif ($row['mask'] == 'number') |
|
1211 | 1275 | { |
1212 | 1276 | $value = (int) $value; |
1213 | - } |
|
1214 | - elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) |
|
1277 | + } elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) |
|
1215 | 1278 | { |
1216 | - if ($returnErrors) |
|
1217 | - $errors[] = 'custom_field_regex_fail'; |
|
1218 | - |
|
1219 | - else |
|
1220 | - $value = ''; |
|
1279 | + if ($returnErrors) { |
|
1280 | + $errors[] = 'custom_field_regex_fail'; |
|
1281 | + } else { |
|
1282 | + $value = ''; |
|
1283 | + } |
|
1221 | 1284 | } |
1222 | 1285 | } |
1223 | 1286 | } |
@@ -1243,8 +1306,9 @@ discard block |
||
1243 | 1306 | |
1244 | 1307 | $hook_errors = call_integration_hook('integrate_save_custom_profile_fields', array(&$changes, &$log_changes, &$errors, $returnErrors, $memID, $area, $sanitize)); |
1245 | 1308 | |
1246 | - if (!empty($hook_errors) && is_array($hook_errors)) |
|
1247 | - $errors = array_merge($errors, $hook_errors); |
|
1309 | + if (!empty($hook_errors) && is_array($hook_errors)) { |
|
1310 | + $errors = array_merge($errors, $hook_errors); |
|
1311 | + } |
|
1248 | 1312 | |
1249 | 1313 | // Make those changes! |
1250 | 1314 | if (!empty($changes) && empty($context['password_auth_failed']) && empty($errors)) |
@@ -1262,9 +1326,10 @@ discard block |
||
1262 | 1326 | } |
1263 | 1327 | } |
1264 | 1328 | |
1265 | - if ($returnErrors) |
|
1266 | - return $errors; |
|
1267 | -} |
|
1329 | + if ($returnErrors) { |
|
1330 | + return $errors; |
|
1331 | + } |
|
1332 | + } |
|
1268 | 1333 | |
1269 | 1334 | /** |
1270 | 1335 | * Show all the users buddies, as well as a add/delete interface. |
@@ -1276,8 +1341,9 @@ discard block |
||
1276 | 1341 | global $context, $txt, $modSettings; |
1277 | 1342 | |
1278 | 1343 | // Do a quick check to ensure people aren't getting here illegally! |
1279 | - if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) |
|
1280 | - fatal_lang_error('no_access', false); |
|
1344 | + if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) { |
|
1345 | + fatal_lang_error('no_access', false); |
|
1346 | + } |
|
1281 | 1347 | |
1282 | 1348 | // Can we email the user direct? |
1283 | 1349 | $context['can_moderate_forum'] = allowedTo('moderate_forum'); |
@@ -1307,9 +1373,10 @@ discard block |
||
1307 | 1373 | $context['sub_template'] = $subActions[$context['list_area']][0]; |
1308 | 1374 | $call = call_helper($subActions[$context['list_area']][0], true); |
1309 | 1375 | |
1310 | - if (!empty($call)) |
|
1311 | - call_user_func($call, $memID); |
|
1312 | -} |
|
1376 | + if (!empty($call)) { |
|
1377 | + call_user_func($call, $memID); |
|
1378 | + } |
|
1379 | + } |
|
1313 | 1380 | |
1314 | 1381 | /** |
1315 | 1382 | * Show all the users buddies, as well as a add/delete interface. |
@@ -1323,9 +1390,10 @@ discard block |
||
1323 | 1390 | |
1324 | 1391 | // For making changes! |
1325 | 1392 | $buddiesArray = explode(',', $user_profile[$memID]['buddy_list']); |
1326 | - foreach ($buddiesArray as $k => $dummy) |
|
1327 | - if ($dummy == '') |
|
1393 | + foreach ($buddiesArray as $k => $dummy) { |
|
1394 | + if ($dummy == '') |
|
1328 | 1395 | unset($buddiesArray[$k]); |
1396 | + } |
|
1329 | 1397 | |
1330 | 1398 | // Removing a buddy? |
1331 | 1399 | if (isset($_GET['remove'])) |
@@ -1337,10 +1405,11 @@ discard block |
||
1337 | 1405 | $_SESSION['prf-save'] = $txt['could_not_remove_person']; |
1338 | 1406 | |
1339 | 1407 | // Heh, I'm lazy, do it the easy way... |
1340 | - foreach ($buddiesArray as $key => $buddy) |
|
1341 | - if ($buddy == (int) $_GET['remove']) |
|
1408 | + foreach ($buddiesArray as $key => $buddy) { |
|
1409 | + if ($buddy == (int) $_GET['remove']) |
|
1342 | 1410 | { |
1343 | 1411 | unset($buddiesArray[$key]); |
1412 | + } |
|
1344 | 1413 | $_SESSION['prf-save'] = true; |
1345 | 1414 | } |
1346 | 1415 | |
@@ -1350,8 +1419,7 @@ discard block |
||
1350 | 1419 | |
1351 | 1420 | // Redirect off the page because we don't like all this ugly query stuff to stick in the history. |
1352 | 1421 | redirectexit('action=profile;area=lists;sa=buddies;u=' . $memID); |
1353 | - } |
|
1354 | - elseif (isset($_POST['new_buddy'])) |
|
1422 | + } elseif (isset($_POST['new_buddy'])) |
|
1355 | 1423 | { |
1356 | 1424 | checkSession(); |
1357 | 1425 | |
@@ -1364,8 +1432,9 @@ discard block |
||
1364 | 1432 | { |
1365 | 1433 | $new_buddies[$k] = strtr(trim($new_buddies[$k]), array('\'' => ''')); |
1366 | 1434 | |
1367 | - if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) |
|
1368 | - unset($new_buddies[$k]); |
|
1435 | + if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) { |
|
1436 | + unset($new_buddies[$k]); |
|
1437 | + } |
|
1369 | 1438 | } |
1370 | 1439 | |
1371 | 1440 | call_integration_hook('integrate_add_buddies', array($memID, &$new_buddies)); |
@@ -1385,16 +1454,18 @@ discard block |
||
1385 | 1454 | ) |
1386 | 1455 | ); |
1387 | 1456 | |
1388 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
1389 | - $_SESSION['prf-save'] = true; |
|
1457 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
1458 | + $_SESSION['prf-save'] = true; |
|
1459 | + } |
|
1390 | 1460 | |
1391 | 1461 | // Add the new member to the buddies array. |
1392 | 1462 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1393 | 1463 | { |
1394 | - if (in_array($row['id_member'], $buddiesArray)) |
|
1395 | - continue; |
|
1396 | - else |
|
1397 | - $buddiesArray[] = (int) $row['id_member']; |
|
1464 | + if (in_array($row['id_member'], $buddiesArray)) { |
|
1465 | + continue; |
|
1466 | + } else { |
|
1467 | + $buddiesArray[] = (int) $row['id_member']; |
|
1468 | + } |
|
1398 | 1469 | } |
1399 | 1470 | $smcFunc['db_free_result']($request); |
1400 | 1471 | |
@@ -1424,18 +1495,20 @@ discard block |
||
1424 | 1495 | |
1425 | 1496 | $context['custom_pf'] = array(); |
1426 | 1497 | $disabled_fields = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array(); |
1427 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1428 | - if (!isset($disabled_fields[$row['col_name']])) |
|
1498 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1499 | + if (!isset($disabled_fields[$row['col_name']])) |
|
1429 | 1500 | $context['custom_pf'][$row['col_name']] = array( |
1430 | 1501 | 'label' => $row['field_name'], |
1431 | 1502 | 'type' => $row['field_type'], |
1432 | 1503 | 'bbc' => !empty($row['bbc']), |
1433 | 1504 | 'enclose' => $row['enclose'], |
1434 | 1505 | ); |
1506 | + } |
|
1435 | 1507 | |
1436 | 1508 | // Gotta disable the gender option. |
1437 | - if (isset($context['custom_pf']['cust_gender']) && $context['custom_pf']['cust_gender'] == 'Disabled') |
|
1438 | - unset($context['custom_pf']['cust_gender']); |
|
1509 | + if (isset($context['custom_pf']['cust_gender']) && $context['custom_pf']['cust_gender'] == 'Disabled') { |
|
1510 | + unset($context['custom_pf']['cust_gender']); |
|
1511 | + } |
|
1439 | 1512 | |
1440 | 1513 | $smcFunc['db_free_result']($request); |
1441 | 1514 | |
@@ -1452,8 +1525,9 @@ discard block |
||
1452 | 1525 | 'buddy_list_count' => substr_count($user_profile[$memID]['buddy_list'], ',') + 1, |
1453 | 1526 | ) |
1454 | 1527 | ); |
1455 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
1456 | - $buddies[] = $row['id_member']; |
|
1528 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
1529 | + $buddies[] = $row['id_member']; |
|
1530 | + } |
|
1457 | 1531 | $smcFunc['db_free_result']($result); |
1458 | 1532 | } |
1459 | 1533 | |
@@ -1481,30 +1555,32 @@ discard block |
||
1481 | 1555 | continue; |
1482 | 1556 | } |
1483 | 1557 | |
1484 | - if ($column['bbc'] && !empty($context['buddies'][$buddy]['options'][$key])) |
|
1485 | - $context['buddies'][$buddy]['options'][$key] = strip_tags(parse_bbc($context['buddies'][$buddy]['options'][$key])); |
|
1486 | - |
|
1487 | - elseif ($column['type'] == 'check') |
|
1488 | - $context['buddies'][$buddy]['options'][$key] = $context['buddies'][$buddy]['options'][$key] == 0 ? $txt['no'] : $txt['yes']; |
|
1558 | + if ($column['bbc'] && !empty($context['buddies'][$buddy]['options'][$key])) { |
|
1559 | + $context['buddies'][$buddy]['options'][$key] = strip_tags(parse_bbc($context['buddies'][$buddy]['options'][$key])); |
|
1560 | + } elseif ($column['type'] == 'check') { |
|
1561 | + $context['buddies'][$buddy]['options'][$key] = $context['buddies'][$buddy]['options'][$key] == 0 ? $txt['no'] : $txt['yes']; |
|
1562 | + } |
|
1489 | 1563 | |
1490 | 1564 | // Enclosing the user input within some other text? |
1491 | - if (!empty($column['enclose']) && !empty($context['buddies'][$buddy]['options'][$key])) |
|
1492 | - $context['buddies'][$buddy]['options'][$key] = strtr($column['enclose'], array( |
|
1565 | + if (!empty($column['enclose']) && !empty($context['buddies'][$buddy]['options'][$key])) { |
|
1566 | + $context['buddies'][$buddy]['options'][$key] = strtr($column['enclose'], array( |
|
1493 | 1567 | '{SCRIPTURL}' => $scripturl, |
1494 | 1568 | '{IMAGES_URL}' => $settings['images_url'], |
1495 | 1569 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
1496 | 1570 | '{INPUT}' => $context['buddies'][$buddy]['options'][$key], |
1497 | 1571 | )); |
1572 | + } |
|
1498 | 1573 | } |
1499 | 1574 | } |
1500 | 1575 | } |
1501 | 1576 | |
1502 | 1577 | if (isset($_SESSION['prf-save'])) |
1503 | 1578 | { |
1504 | - if ($_SESSION['prf-save'] === true) |
|
1505 | - $context['saved_successful'] = true; |
|
1506 | - else |
|
1507 | - $context['saved_failed'] = $_SESSION['prf-save']; |
|
1579 | + if ($_SESSION['prf-save'] === true) { |
|
1580 | + $context['saved_successful'] = true; |
|
1581 | + } else { |
|
1582 | + $context['saved_failed'] = $_SESSION['prf-save']; |
|
1583 | + } |
|
1508 | 1584 | |
1509 | 1585 | unset($_SESSION['prf-save']); |
1510 | 1586 | } |
@@ -1524,9 +1600,10 @@ discard block |
||
1524 | 1600 | |
1525 | 1601 | // For making changes! |
1526 | 1602 | $ignoreArray = explode(',', $user_profile[$memID]['pm_ignore_list']); |
1527 | - foreach ($ignoreArray as $k => $dummy) |
|
1528 | - if ($dummy == '') |
|
1603 | + foreach ($ignoreArray as $k => $dummy) { |
|
1604 | + if ($dummy == '') |
|
1529 | 1605 | unset($ignoreArray[$k]); |
1606 | + } |
|
1530 | 1607 | |
1531 | 1608 | // Removing a member from the ignore list? |
1532 | 1609 | if (isset($_GET['remove'])) |
@@ -1536,10 +1613,11 @@ discard block |
||
1536 | 1613 | $_SESSION['prf-save'] = $txt['could_not_remove_person']; |
1537 | 1614 | |
1538 | 1615 | // Heh, I'm lazy, do it the easy way... |
1539 | - foreach ($ignoreArray as $key => $id_remove) |
|
1540 | - if ($id_remove == (int) $_GET['remove']) |
|
1616 | + foreach ($ignoreArray as $key => $id_remove) { |
|
1617 | + if ($id_remove == (int) $_GET['remove']) |
|
1541 | 1618 | { |
1542 | 1619 | unset($ignoreArray[$key]); |
1620 | + } |
|
1543 | 1621 | $_SESSION['prf-save'] = true; |
1544 | 1622 | } |
1545 | 1623 | |
@@ -1549,8 +1627,7 @@ discard block |
||
1549 | 1627 | |
1550 | 1628 | // Redirect off the page because we don't like all this ugly query stuff to stick in the history. |
1551 | 1629 | redirectexit('action=profile;area=lists;sa=ignore;u=' . $memID); |
1552 | - } |
|
1553 | - elseif (isset($_POST['new_ignore'])) |
|
1630 | + } elseif (isset($_POST['new_ignore'])) |
|
1554 | 1631 | { |
1555 | 1632 | checkSession(); |
1556 | 1633 | // Prepare the string for extraction... |
@@ -1562,8 +1639,9 @@ discard block |
||
1562 | 1639 | { |
1563 | 1640 | $new_entries[$k] = strtr(trim($new_entries[$k]), array('\'' => ''')); |
1564 | 1641 | |
1565 | - if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) |
|
1566 | - unset($new_entries[$k]); |
|
1642 | + if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) { |
|
1643 | + unset($new_entries[$k]); |
|
1644 | + } |
|
1567 | 1645 | } |
1568 | 1646 | |
1569 | 1647 | $_SESSION['prf-save'] = $txt['could_not_add_person']; |
@@ -1581,16 +1659,18 @@ discard block |
||
1581 | 1659 | ) |
1582 | 1660 | ); |
1583 | 1661 | |
1584 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
1585 | - $_SESSION['prf-save'] = true; |
|
1662 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
1663 | + $_SESSION['prf-save'] = true; |
|
1664 | + } |
|
1586 | 1665 | |
1587 | 1666 | // Add the new member to the buddies array. |
1588 | 1667 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1589 | 1668 | { |
1590 | - if (in_array($row['id_member'], $ignoreArray)) |
|
1591 | - continue; |
|
1592 | - else |
|
1593 | - $ignoreArray[] = (int) $row['id_member']; |
|
1669 | + if (in_array($row['id_member'], $ignoreArray)) { |
|
1670 | + continue; |
|
1671 | + } else { |
|
1672 | + $ignoreArray[] = (int) $row['id_member']; |
|
1673 | + } |
|
1594 | 1674 | } |
1595 | 1675 | $smcFunc['db_free_result']($request); |
1596 | 1676 | |
@@ -1619,8 +1699,9 @@ discard block |
||
1619 | 1699 | 'ignore_list_count' => substr_count($user_profile[$memID]['pm_ignore_list'], ',') + 1, |
1620 | 1700 | ) |
1621 | 1701 | ); |
1622 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
1623 | - $ignored[] = $row['id_member']; |
|
1702 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
1703 | + $ignored[] = $row['id_member']; |
|
1704 | + } |
|
1624 | 1705 | $smcFunc['db_free_result']($result); |
1625 | 1706 | } |
1626 | 1707 | |
@@ -1639,10 +1720,11 @@ discard block |
||
1639 | 1720 | |
1640 | 1721 | if (isset($_SESSION['prf-save'])) |
1641 | 1722 | { |
1642 | - if ($_SESSION['prf-save'] === true) |
|
1643 | - $context['saved_successful'] = true; |
|
1644 | - else |
|
1645 | - $context['saved_failed'] = $_SESSION['prf-save']; |
|
1723 | + if ($_SESSION['prf-save'] === true) { |
|
1724 | + $context['saved_successful'] = true; |
|
1725 | + } else { |
|
1726 | + $context['saved_failed'] = $_SESSION['prf-save']; |
|
1727 | + } |
|
1646 | 1728 | |
1647 | 1729 | unset($_SESSION['prf-save']); |
1648 | 1730 | } |
@@ -1658,8 +1740,9 @@ discard block |
||
1658 | 1740 | global $context, $txt; |
1659 | 1741 | |
1660 | 1742 | loadThemeOptions($memID); |
1661 | - if (allowedTo(array('profile_identity_own', 'profile_identity_any', 'profile_password_own', 'profile_password_any'))) |
|
1662 | - loadCustomFields($memID, 'account'); |
|
1743 | + if (allowedTo(array('profile_identity_own', 'profile_identity_any', 'profile_password_own', 'profile_password_any'))) { |
|
1744 | + loadCustomFields($memID, 'account'); |
|
1745 | + } |
|
1663 | 1746 | |
1664 | 1747 | $context['sub_template'] = 'edit_options'; |
1665 | 1748 | $context['page_desc'] = $txt['account_info']; |
@@ -1686,8 +1769,9 @@ discard block |
||
1686 | 1769 | global $context, $txt; |
1687 | 1770 | |
1688 | 1771 | loadThemeOptions($memID); |
1689 | - if (allowedTo(array('profile_forum_own', 'profile_forum_any'))) |
|
1690 | - loadCustomFields($memID, 'forumprofile'); |
|
1772 | + if (allowedTo(array('profile_forum_own', 'profile_forum_any'))) { |
|
1773 | + loadCustomFields($memID, 'forumprofile'); |
|
1774 | + } |
|
1691 | 1775 | |
1692 | 1776 | $context['sub_template'] = 'edit_options'; |
1693 | 1777 | $context['page_desc'] = $txt['forumProfile_info']; |
@@ -1720,18 +1804,21 @@ discard block |
||
1720 | 1804 | $dirs = array(); |
1721 | 1805 | $files = array(); |
1722 | 1806 | |
1723 | - if (!$dir) |
|
1724 | - return array(); |
|
1807 | + if (!$dir) { |
|
1808 | + return array(); |
|
1809 | + } |
|
1725 | 1810 | |
1726 | 1811 | while ($line = $dir->read()) |
1727 | 1812 | { |
1728 | - if (in_array($line, array('.', '..', 'blank.png', 'index.php'))) |
|
1729 | - continue; |
|
1813 | + if (in_array($line, array('.', '..', 'blank.png', 'index.php'))) { |
|
1814 | + continue; |
|
1815 | + } |
|
1730 | 1816 | |
1731 | - if (is_dir($modSettings['avatar_directory'] . '/' . $directory . (!empty($directory) ? '/' : '') . $line)) |
|
1732 | - $dirs[] = $line; |
|
1733 | - else |
|
1734 | - $files[] = $line; |
|
1817 | + if (is_dir($modSettings['avatar_directory'] . '/' . $directory . (!empty($directory) ? '/' : '') . $line)) { |
|
1818 | + $dirs[] = $line; |
|
1819 | + } else { |
|
1820 | + $files[] = $line; |
|
1821 | + } |
|
1735 | 1822 | } |
1736 | 1823 | $dir->close(); |
1737 | 1824 | |
@@ -1752,14 +1839,15 @@ discard block |
||
1752 | 1839 | foreach ($dirs as $line) |
1753 | 1840 | { |
1754 | 1841 | $tmp = getAvatars($directory . (!empty($directory) ? '/' : '') . $line, $level + 1); |
1755 | - if (!empty($tmp)) |
|
1756 | - $result[] = array( |
|
1842 | + if (!empty($tmp)) { |
|
1843 | + $result[] = array( |
|
1757 | 1844 | 'filename' => $smcFunc['htmlspecialchars']($line), |
1758 | 1845 | 'checked' => strpos($context['member']['avatar']['server_pic'], $line . '/') !== false, |
1759 | 1846 | 'name' => '[' . $smcFunc['htmlspecialchars'](str_replace('_', ' ', $line)) . ']', |
1760 | 1847 | 'is_dir' => true, |
1761 | 1848 | 'files' => $tmp |
1762 | 1849 | ); |
1850 | + } |
|
1763 | 1851 | unset($tmp); |
1764 | 1852 | } |
1765 | 1853 | |
@@ -1769,8 +1857,9 @@ discard block |
||
1769 | 1857 | $extension = substr(strrchr($line, '.'), 1); |
1770 | 1858 | |
1771 | 1859 | // Make sure it is an image. |
1772 | - if (strcasecmp($extension, 'gif') != 0 && strcasecmp($extension, 'jpg') != 0 && strcasecmp($extension, 'jpeg') != 0 && strcasecmp($extension, 'png') != 0 && strcasecmp($extension, 'bmp') != 0) |
|
1773 | - continue; |
|
1860 | + if (strcasecmp($extension, 'gif') != 0 && strcasecmp($extension, 'jpg') != 0 && strcasecmp($extension, 'jpeg') != 0 && strcasecmp($extension, 'png') != 0 && strcasecmp($extension, 'bmp') != 0) { |
|
1861 | + continue; |
|
1862 | + } |
|
1774 | 1863 | |
1775 | 1864 | $result[] = array( |
1776 | 1865 | 'filename' => $smcFunc['htmlspecialchars']($line), |
@@ -1778,8 +1867,9 @@ discard block |
||
1778 | 1867 | 'name' => $smcFunc['htmlspecialchars'](str_replace('_', ' ', $filename)), |
1779 | 1868 | 'is_dir' => false |
1780 | 1869 | ); |
1781 | - if ($level == 1) |
|
1782 | - $context['avatar_list'][] = $directory . '/' . $line; |
|
1870 | + if ($level == 1) { |
|
1871 | + $context['avatar_list'][] = $directory . '/' . $line; |
|
1872 | + } |
|
1783 | 1873 | } |
1784 | 1874 | |
1785 | 1875 | return $result; |
@@ -1795,8 +1885,9 @@ discard block |
||
1795 | 1885 | global $txt, $context; |
1796 | 1886 | |
1797 | 1887 | loadThemeOptions($memID); |
1798 | - if (allowedTo(array('profile_extra_own', 'profile_extra_any'))) |
|
1799 | - loadCustomFields($memID, 'theme'); |
|
1888 | + if (allowedTo(array('profile_extra_own', 'profile_extra_any'))) { |
|
1889 | + loadCustomFields($memID, 'theme'); |
|
1890 | + } |
|
1800 | 1891 | |
1801 | 1892 | $context['sub_template'] = 'edit_options'; |
1802 | 1893 | $context['page_desc'] = $txt['theme_info']; |
@@ -1850,16 +1941,19 @@ discard block |
||
1850 | 1941 | { |
1851 | 1942 | global $txt, $user_profile, $context, $modSettings, $smcFunc, $sourcedir; |
1852 | 1943 | |
1853 | - if (!isset($context['token_check'])) |
|
1854 | - $context['token_check'] = 'profile-nt' . $memID; |
|
1944 | + if (!isset($context['token_check'])) { |
|
1945 | + $context['token_check'] = 'profile-nt' . $memID; |
|
1946 | + } |
|
1855 | 1947 | |
1856 | 1948 | is_not_guest(); |
1857 | - if (!$context['user']['is_owner']) |
|
1858 | - isAllowedTo('profile_extra_any'); |
|
1949 | + if (!$context['user']['is_owner']) { |
|
1950 | + isAllowedTo('profile_extra_any'); |
|
1951 | + } |
|
1859 | 1952 | |
1860 | 1953 | // Set the post action if we're coming from the profile... |
1861 | - if (!isset($context['action'])) |
|
1862 | - $context['action'] = 'action=profile;area=notification;sa=alerts;u=' . $memID; |
|
1954 | + if (!isset($context['action'])) { |
|
1955 | + $context['action'] = 'action=profile;area=notification;sa=alerts;u=' . $memID; |
|
1956 | + } |
|
1863 | 1957 | |
1864 | 1958 | // What options are set |
1865 | 1959 | loadThemeOptions($memID); |
@@ -1946,28 +2040,34 @@ discard block |
||
1946 | 2040 | ); |
1947 | 2041 | |
1948 | 2042 | // There are certain things that are disabled at the group level. |
1949 | - if (empty($modSettings['cal_enabled'])) |
|
1950 | - unset($alert_types['calendar']); |
|
2043 | + if (empty($modSettings['cal_enabled'])) { |
|
2044 | + unset($alert_types['calendar']); |
|
2045 | + } |
|
1951 | 2046 | |
1952 | 2047 | // Disable paid subscriptions at group level if they're disabled |
1953 | - if (empty($modSettings['paid_enabled'])) |
|
1954 | - unset($alert_types['paidsubs']); |
|
2048 | + if (empty($modSettings['paid_enabled'])) { |
|
2049 | + unset($alert_types['paidsubs']); |
|
2050 | + } |
|
1955 | 2051 | |
1956 | 2052 | // Disable membergroup requests at group level if they're disabled |
1957 | - if (empty($modSettings['show_group_membership'])) |
|
1958 | - unset($alert_types['groupr'], $alert_types['members']['request_group']); |
|
2053 | + if (empty($modSettings['show_group_membership'])) { |
|
2054 | + unset($alert_types['groupr'], $alert_types['members']['request_group']); |
|
2055 | + } |
|
1959 | 2056 | |
1960 | 2057 | // Disable mentions if they're disabled |
1961 | - if (empty($modSettings['enable_mentions'])) |
|
1962 | - unset($alert_types['msg']['msg_mention']); |
|
2058 | + if (empty($modSettings['enable_mentions'])) { |
|
2059 | + unset($alert_types['msg']['msg_mention']); |
|
2060 | + } |
|
1963 | 2061 | |
1964 | 2062 | // Disable likes if they're disabled |
1965 | - if (empty($modSettings['enable_likes'])) |
|
1966 | - unset($alert_types['msg']['msg_like']); |
|
2063 | + if (empty($modSettings['enable_likes'])) { |
|
2064 | + unset($alert_types['msg']['msg_like']); |
|
2065 | + } |
|
1967 | 2066 | |
1968 | 2067 | // Disable buddy requests if they're disabled |
1969 | - if (empty($modSettings['enable_buddylist'])) |
|
1970 | - unset($alert_types['members']['buddy_request']); |
|
2068 | + if (empty($modSettings['enable_buddylist'])) { |
|
2069 | + unset($alert_types['members']['buddy_request']); |
|
2070 | + } |
|
1971 | 2071 | |
1972 | 2072 | // Now, now, we could pass this through global but we should really get into the habit of |
1973 | 2073 | // passing content to hooks, not expecting hooks to splatter everything everywhere. |
@@ -1995,15 +2095,17 @@ discard block |
||
1995 | 2095 | $perms_cache['manage_membergroups'] = in_array($memID, $members); |
1996 | 2096 | } |
1997 | 2097 | |
1998 | - if (!($perms_cache['manage_membergroups'] || $can_mod != 0)) |
|
1999 | - unset($alert_types['members']['request_group']); |
|
2098 | + if (!($perms_cache['manage_membergroups'] || $can_mod != 0)) { |
|
2099 | + unset($alert_types['members']['request_group']); |
|
2100 | + } |
|
2000 | 2101 | |
2001 | 2102 | foreach ($alert_types as $group => $items) |
2002 | 2103 | { |
2003 | 2104 | foreach ($items as $alert_key => $alert_value) |
2004 | 2105 | { |
2005 | - if (!isset($alert_value['permission'])) |
|
2006 | - continue; |
|
2106 | + if (!isset($alert_value['permission'])) { |
|
2107 | + continue; |
|
2108 | + } |
|
2007 | 2109 | if (!isset($perms_cache[$alert_value['permission']['name']])) |
2008 | 2110 | { |
2009 | 2111 | $in_board = !empty($alert_value['permission']['is_board']) ? 0 : null; |
@@ -2011,12 +2113,14 @@ discard block |
||
2011 | 2113 | $perms_cache[$alert_value['permission']['name']] = in_array($memID, $members); |
2012 | 2114 | } |
2013 | 2115 | |
2014 | - if (!$perms_cache[$alert_value['permission']['name']]) |
|
2015 | - unset ($alert_types[$group][$alert_key]); |
|
2116 | + if (!$perms_cache[$alert_value['permission']['name']]) { |
|
2117 | + unset ($alert_types[$group][$alert_key]); |
|
2118 | + } |
|
2016 | 2119 | } |
2017 | 2120 | |
2018 | - if (empty($alert_types[$group])) |
|
2019 | - unset ($alert_types[$group]); |
|
2121 | + if (empty($alert_types[$group])) { |
|
2122 | + unset ($alert_types[$group]); |
|
2123 | + } |
|
2020 | 2124 | } |
2021 | 2125 | } |
2022 | 2126 | |
@@ -2048,9 +2152,9 @@ discard block |
||
2048 | 2152 | $update_prefs[$this_option[1]] = !empty($_POST['opt_' . $this_option[1]]) ? 1 : 0; |
2049 | 2153 | break; |
2050 | 2154 | case 'select': |
2051 | - if (isset($_POST['opt_' . $this_option[1]], $this_option['opts'][$_POST['opt_' . $this_option[1]]])) |
|
2052 | - $update_prefs[$this_option[1]] = $_POST['opt_' . $this_option[1]]; |
|
2053 | - else |
|
2155 | + if (isset($_POST['opt_' . $this_option[1]], $this_option['opts'][$_POST['opt_' . $this_option[1]]])) { |
|
2156 | + $update_prefs[$this_option[1]] = $_POST['opt_' . $this_option[1]]; |
|
2157 | + } else |
|
2054 | 2158 | { |
2055 | 2159 | // We didn't have a sane value. Let's grab the first item from the possibles. |
2056 | 2160 | $keys = array_keys($this_option['opts']); |
@@ -2070,23 +2174,28 @@ discard block |
||
2070 | 2174 | $this_value = 0; |
2071 | 2175 | foreach ($context['alert_bits'] as $type => $bitvalue) |
2072 | 2176 | { |
2073 | - if ($this_options[$type] == 'yes' && !empty($_POST[$type . '_' . $item_key]) || $this_options[$type] == 'always') |
|
2074 | - $this_value |= $bitvalue; |
|
2177 | + if ($this_options[$type] == 'yes' && !empty($_POST[$type . '_' . $item_key]) || $this_options[$type] == 'always') { |
|
2178 | + $this_value |= $bitvalue; |
|
2179 | + } |
|
2180 | + } |
|
2181 | + if (!isset($context['alert_prefs'][$item_key]) || $context['alert_prefs'][$item_key] != $this_value) { |
|
2182 | + $update_prefs[$item_key] = $this_value; |
|
2075 | 2183 | } |
2076 | - if (!isset($context['alert_prefs'][$item_key]) || $context['alert_prefs'][$item_key] != $this_value) |
|
2077 | - $update_prefs[$item_key] = $this_value; |
|
2078 | 2184 | } |
2079 | 2185 | } |
2080 | 2186 | |
2081 | - if (!empty($_POST['opt_alert_timeout'])) |
|
2082 | - $update_prefs['alert_timeout'] = $context['member']['alert_timeout'] = (int) $_POST['opt_alert_timeout']; |
|
2187 | + if (!empty($_POST['opt_alert_timeout'])) { |
|
2188 | + $update_prefs['alert_timeout'] = $context['member']['alert_timeout'] = (int) $_POST['opt_alert_timeout']; |
|
2189 | + } |
|
2083 | 2190 | |
2084 | - if (!empty($_POST['notify_announcements'])) |
|
2085 | - $update_prefs['announcements'] = $context['member']['notify_announcements'] = (int) $_POST['notify_announcements']; |
|
2191 | + if (!empty($_POST['notify_announcements'])) { |
|
2192 | + $update_prefs['announcements'] = $context['member']['notify_announcements'] = (int) $_POST['notify_announcements']; |
|
2193 | + } |
|
2086 | 2194 | |
2087 | 2195 | setNotifyPrefs((int) $memID, $update_prefs); |
2088 | - foreach ($update_prefs as $pref => $value) |
|
2089 | - $context['alert_prefs'][$pref] = $value; |
|
2196 | + foreach ($update_prefs as $pref => $value) { |
|
2197 | + $context['alert_prefs'][$pref] = $value; |
|
2198 | + } |
|
2090 | 2199 | |
2091 | 2200 | makeNotificationChanges($memID); |
2092 | 2201 | |
@@ -2116,8 +2225,9 @@ discard block |
||
2116 | 2225 | |
2117 | 2226 | // Now we're all set up. |
2118 | 2227 | is_not_guest(); |
2119 | - if (!$context['user']['is_owner']) |
|
2120 | - fatal_error('no_access'); |
|
2228 | + if (!$context['user']['is_owner']) { |
|
2229 | + fatal_error('no_access'); |
|
2230 | + } |
|
2121 | 2231 | |
2122 | 2232 | checkSession('get'); |
2123 | 2233 | |
@@ -2149,8 +2259,9 @@ discard block |
||
2149 | 2259 | { |
2150 | 2260 | global $smcFunc; |
2151 | 2261 | |
2152 | - if (empty($toMark) || empty($memID)) |
|
2153 | - return false; |
|
2262 | + if (empty($toMark) || empty($memID)) { |
|
2263 | + return false; |
|
2264 | + } |
|
2154 | 2265 | |
2155 | 2266 | $toMark = (array) $toMark; |
2156 | 2267 | |
@@ -2184,8 +2295,9 @@ discard block |
||
2184 | 2295 | { |
2185 | 2296 | global $smcFunc; |
2186 | 2297 | |
2187 | - if (empty($toDelete)) |
|
2188 | - return false; |
|
2298 | + if (empty($toDelete)) { |
|
2299 | + return false; |
|
2300 | + } |
|
2189 | 2301 | |
2190 | 2302 | $toDelete = (array) $toDelete; |
2191 | 2303 | |
@@ -2220,8 +2332,9 @@ discard block |
||
2220 | 2332 | { |
2221 | 2333 | global $smcFunc; |
2222 | 2334 | |
2223 | - if (empty($memID)) |
|
2224 | - return false; |
|
2335 | + if (empty($memID)) { |
|
2336 | + return false; |
|
2337 | + } |
|
2225 | 2338 | |
2226 | 2339 | $request = $smcFunc['db_query']('', ' |
2227 | 2340 | SELECT id_alert |
@@ -2298,8 +2411,9 @@ discard block |
||
2298 | 2411 | { |
2299 | 2412 | $link = $topic['link']; |
2300 | 2413 | |
2301 | - if ($topic['new']) |
|
2302 | - $link .= ' <a href="' . $topic['new_href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
2414 | + if ($topic['new']) { |
|
2415 | + $link .= ' <a href="' . $topic['new_href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
2416 | + } |
|
2303 | 2417 | |
2304 | 2418 | $link .= '<br><span class="smalltext"><em>' . $txt['in'] . ' ' . $topic['board_link'] . '</em></span>'; |
2305 | 2419 | |
@@ -2450,8 +2564,9 @@ discard block |
||
2450 | 2564 | { |
2451 | 2565 | $link = $board['link']; |
2452 | 2566 | |
2453 | - if ($board['new']) |
|
2454 | - $link .= ' <a href="' . $board['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
2567 | + if ($board['new']) { |
|
2568 | + $link .= ' <a href="' . $board['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
2569 | + } |
|
2455 | 2570 | |
2456 | 2571 | return $link; |
2457 | 2572 | }, |
@@ -2651,8 +2766,8 @@ discard block |
||
2651 | 2766 | ) |
2652 | 2767 | ); |
2653 | 2768 | $notification_boards = array(); |
2654 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
2655 | - $notification_boards[] = array( |
|
2769 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
2770 | + $notification_boards[] = array( |
|
2656 | 2771 | 'id' => $row['id_board'], |
2657 | 2772 | 'name' => $row['name'], |
2658 | 2773 | 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', |
@@ -2660,6 +2775,7 @@ discard block |
||
2660 | 2775 | 'new' => $row['board_read'] < $row['id_msg_updated'], |
2661 | 2776 | 'notify_pref' => isset($prefs['board_notify_' . $row['id_board']]) ? $prefs['board_notify_' . $row['id_board']] : (!empty($prefs['board_notify']) ? $prefs['board_notify'] : 0), |
2662 | 2777 | ); |
2778 | + } |
|
2663 | 2779 | $smcFunc['db_free_result']($request); |
2664 | 2780 | |
2665 | 2781 | return $notification_boards; |
@@ -2674,17 +2790,18 @@ discard block |
||
2674 | 2790 | { |
2675 | 2791 | global $context, $options, $cur_profile, $smcFunc; |
2676 | 2792 | |
2677 | - if (isset($_POST['default_options'])) |
|
2678 | - $_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options']; |
|
2793 | + if (isset($_POST['default_options'])) { |
|
2794 | + $_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options']; |
|
2795 | + } |
|
2679 | 2796 | |
2680 | 2797 | if ($context['user']['is_owner']) |
2681 | 2798 | { |
2682 | 2799 | $context['member']['options'] = $options; |
2683 | - if (isset($_POST['options']) && is_array($_POST['options'])) |
|
2684 | - foreach ($_POST['options'] as $k => $v) |
|
2800 | + if (isset($_POST['options']) && is_array($_POST['options'])) { |
|
2801 | + foreach ($_POST['options'] as $k => $v) |
|
2685 | 2802 | $context['member']['options'][$k] = $v; |
2686 | - } |
|
2687 | - else |
|
2803 | + } |
|
2804 | + } else |
|
2688 | 2805 | { |
2689 | 2806 | $request = $smcFunc['db_query']('', ' |
2690 | 2807 | SELECT id_member, variable, value |
@@ -2705,8 +2822,9 @@ discard block |
||
2705 | 2822 | continue; |
2706 | 2823 | } |
2707 | 2824 | |
2708 | - if (isset($_POST['options'][$row['variable']])) |
|
2709 | - $row['value'] = $_POST['options'][$row['variable']]; |
|
2825 | + if (isset($_POST['options'][$row['variable']])) { |
|
2826 | + $row['value'] = $_POST['options'][$row['variable']]; |
|
2827 | + } |
|
2710 | 2828 | $context['member']['options'][$row['variable']] = $row['value']; |
2711 | 2829 | } |
2712 | 2830 | $smcFunc['db_free_result']($request); |
@@ -2714,8 +2832,9 @@ discard block |
||
2714 | 2832 | // Load up the default theme options for any missing. |
2715 | 2833 | foreach ($temp as $k => $v) |
2716 | 2834 | { |
2717 | - if (!isset($context['member']['options'][$k])) |
|
2718 | - $context['member']['options'][$k] = $v; |
|
2835 | + if (!isset($context['member']['options'][$k])) { |
|
2836 | + $context['member']['options'][$k] = $v; |
|
2837 | + } |
|
2719 | 2838 | } |
2720 | 2839 | } |
2721 | 2840 | } |
@@ -2730,8 +2849,9 @@ discard block |
||
2730 | 2849 | global $context, $modSettings, $smcFunc, $cur_profile, $sourcedir; |
2731 | 2850 | |
2732 | 2851 | // Have the admins enabled this option? |
2733 | - if (empty($modSettings['allow_ignore_boards'])) |
|
2734 | - fatal_lang_error('ignoreboards_disallowed', 'user'); |
|
2852 | + if (empty($modSettings['allow_ignore_boards'])) { |
|
2853 | + fatal_lang_error('ignoreboards_disallowed', 'user'); |
|
2854 | + } |
|
2735 | 2855 | |
2736 | 2856 | // Find all the boards this user is allowed to see. |
2737 | 2857 | $request = $smcFunc['db_query']('order_by_board_order', ' |
@@ -2751,12 +2871,13 @@ discard block |
||
2751 | 2871 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
2752 | 2872 | { |
2753 | 2873 | // This category hasn't been set up yet.. |
2754 | - if (!isset($context['categories'][$row['id_cat']])) |
|
2755 | - $context['categories'][$row['id_cat']] = array( |
|
2874 | + if (!isset($context['categories'][$row['id_cat']])) { |
|
2875 | + $context['categories'][$row['id_cat']] = array( |
|
2756 | 2876 | 'id' => $row['id_cat'], |
2757 | 2877 | 'name' => $row['cat_name'], |
2758 | 2878 | 'boards' => array() |
2759 | 2879 | ); |
2880 | + } |
|
2760 | 2881 | |
2761 | 2882 | // Set this board up, and let the template know when it's a child. (indent them..) |
2762 | 2883 | $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array( |
@@ -2786,18 +2907,20 @@ discard block |
||
2786 | 2907 | } |
2787 | 2908 | |
2788 | 2909 | $max_boards = ceil(count($temp_boards) / 2); |
2789 | - if ($max_boards == 1) |
|
2790 | - $max_boards = 2; |
|
2910 | + if ($max_boards == 1) { |
|
2911 | + $max_boards = 2; |
|
2912 | + } |
|
2791 | 2913 | |
2792 | 2914 | // Now, alternate them so they can be shown left and right ;). |
2793 | 2915 | $context['board_columns'] = array(); |
2794 | 2916 | for ($i = 0; $i < $max_boards; $i++) |
2795 | 2917 | { |
2796 | 2918 | $context['board_columns'][] = $temp_boards[$i]; |
2797 | - if (isset($temp_boards[$i + $max_boards])) |
|
2798 | - $context['board_columns'][] = $temp_boards[$i + $max_boards]; |
|
2799 | - else |
|
2800 | - $context['board_columns'][] = array(); |
|
2919 | + if (isset($temp_boards[$i + $max_boards])) { |
|
2920 | + $context['board_columns'][] = $temp_boards[$i + $max_boards]; |
|
2921 | + } else { |
|
2922 | + $context['board_columns'][] = array(); |
|
2923 | + } |
|
2801 | 2924 | } |
2802 | 2925 | |
2803 | 2926 | loadThemeOptions($memID); |
@@ -2866,8 +2989,9 @@ discard block |
||
2866 | 2989 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
2867 | 2990 | { |
2868 | 2991 | // We should skip the administrator group if they don't have the admin_forum permission! |
2869 | - if ($row['id_group'] == 1 && !allowedTo('admin_forum')) |
|
2870 | - continue; |
|
2992 | + if ($row['id_group'] == 1 && !allowedTo('admin_forum')) { |
|
2993 | + continue; |
|
2994 | + } |
|
2871 | 2995 | |
2872 | 2996 | $context['member_groups'][$row['id_group']] = array( |
2873 | 2997 | 'id' => $row['id_group'], |
@@ -2913,16 +3037,17 @@ discard block |
||
2913 | 3037 | $context['max_signature_length'] = $context['signature_limits']['max_length']; |
2914 | 3038 | // Warning message for signature image limits? |
2915 | 3039 | $context['signature_warning'] = ''; |
2916 | - if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height']) |
|
2917 | - $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']); |
|
2918 | - elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height']) |
|
2919 | - $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']); |
|
3040 | + if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height']) { |
|
3041 | + $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']); |
|
3042 | + } elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height']) { |
|
3043 | + $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']); |
|
3044 | + } |
|
2920 | 3045 | |
2921 | 3046 | $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && (function_exists('pspell_new') || (function_exists('enchant_broker_init') && ($txt['lang_charset'] == 'UTF-8' || function_exists('iconv')))); |
2922 | 3047 | |
2923 | - if (empty($context['do_preview'])) |
|
2924 | - $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br>', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']); |
|
2925 | - else |
|
3048 | + if (empty($context['do_preview'])) { |
|
3049 | + $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br>', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']); |
|
3050 | + } else |
|
2926 | 3051 | { |
2927 | 3052 | $signature = !empty($_POST['signature']) ? $_POST['signature'] : ''; |
2928 | 3053 | $validation = profileValidateSignature($signature); |
@@ -2932,8 +3057,9 @@ discard block |
||
2932 | 3057 | $context['post_errors'] = array(); |
2933 | 3058 | } |
2934 | 3059 | $context['post_errors'][] = 'signature_not_yet_saved'; |
2935 | - if ($validation !== true && $validation !== false) |
|
2936 | - $context['post_errors'][] = $validation; |
|
3060 | + if ($validation !== true && $validation !== false) { |
|
3061 | + $context['post_errors'][] = $validation; |
|
3062 | + } |
|
2937 | 3063 | |
2938 | 3064 | censorText($context['member']['signature']); |
2939 | 3065 | $context['member']['current_signature'] = $context['member']['signature']; |
@@ -2943,8 +3069,9 @@ discard block |
||
2943 | 3069 | } |
2944 | 3070 | |
2945 | 3071 | // Load the spell checker? |
2946 | - if ($context['show_spellchecking']) |
|
2947 | - loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
3072 | + if ($context['show_spellchecking']) { |
|
3073 | + loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
3074 | + } |
|
2948 | 3075 | |
2949 | 3076 | return true; |
2950 | 3077 | } |
@@ -2978,8 +3105,7 @@ discard block |
||
2978 | 3105 | 'external' => $cur_profile['avatar'] == 'gravatar://' || empty($modSettings['gravatarAllowExtraEmail']) || !empty($modSettings['gravatarOverride']) ? $cur_profile['email_address'] : substr($cur_profile['avatar'], 11) |
2979 | 3106 | ); |
2980 | 3107 | $context['member']['avatar']['href'] = get_gravatar_url($context['member']['avatar']['external']); |
2981 | - } |
|
2982 | - elseif ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload']) |
|
3108 | + } elseif ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload']) |
|
2983 | 3109 | { |
2984 | 3110 | $context['member']['avatar'] += array( |
2985 | 3111 | 'choice' => 'upload', |
@@ -2989,33 +3115,34 @@ discard block |
||
2989 | 3115 | $context['member']['avatar']['href'] = empty($cur_profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $cur_profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $cur_profile['filename']; |
2990 | 3116 | } |
2991 | 3117 | // Use "avatar_original" here so we show what the user entered even if the image proxy is enabled |
2992 | - elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external']) |
|
2993 | - $context['member']['avatar'] += array( |
|
3118 | + elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external']) { |
|
3119 | + $context['member']['avatar'] += array( |
|
2994 | 3120 | 'choice' => 'external', |
2995 | 3121 | 'server_pic' => 'blank.png', |
2996 | 3122 | 'external' => $cur_profile['avatar_original'] |
2997 | 3123 | ); |
2998 | - elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored']) |
|
2999 | - $context['member']['avatar'] += array( |
|
3124 | + } elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored']) { |
|
3125 | + $context['member']['avatar'] += array( |
|
3000 | 3126 | 'choice' => 'server_stored', |
3001 | 3127 | 'server_pic' => $cur_profile['avatar'] == '' ? 'blank.png' : $cur_profile['avatar'], |
3002 | 3128 | 'external' => 'http://' |
3003 | 3129 | ); |
3004 | - else |
|
3005 | - $context['member']['avatar'] += array( |
|
3130 | + } else { |
|
3131 | + $context['member']['avatar'] += array( |
|
3006 | 3132 | 'choice' => 'none', |
3007 | 3133 | 'server_pic' => 'blank.png', |
3008 | 3134 | 'external' => 'http://' |
3009 | 3135 | ); |
3136 | + } |
|
3010 | 3137 | |
3011 | 3138 | // Get a list of all the avatars. |
3012 | 3139 | if ($context['member']['avatar']['allow_server_stored']) |
3013 | 3140 | { |
3014 | 3141 | $context['avatar_list'] = array(); |
3015 | 3142 | $context['avatars'] = is_dir($modSettings['avatar_directory']) ? getAvatars('', 0) : array(); |
3143 | + } else { |
|
3144 | + $context['avatars'] = array(); |
|
3016 | 3145 | } |
3017 | - else |
|
3018 | - $context['avatars'] = array(); |
|
3019 | 3146 | |
3020 | 3147 | // Second level selected avatar... |
3021 | 3148 | $context['avatar_selected'] = substr(strrchr($context['member']['avatar']['server_pic'], '/'), 1); |
@@ -3044,19 +3171,22 @@ discard block |
||
3044 | 3171 | ) |
3045 | 3172 | ); |
3046 | 3173 | $protected_groups = array(1); |
3047 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
3048 | - $protected_groups[] = $row['id_group']; |
|
3174 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
3175 | + $protected_groups[] = $row['id_group']; |
|
3176 | + } |
|
3049 | 3177 | $smcFunc['db_free_result']($request); |
3050 | 3178 | |
3051 | 3179 | $protected_groups = array_unique($protected_groups); |
3052 | 3180 | } |
3053 | 3181 | |
3054 | 3182 | // The account page allows the change of your id_group - but not to a protected group! |
3055 | - if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) |
|
3056 | - $value = (int) $value; |
|
3183 | + if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) { |
|
3184 | + $value = (int) $value; |
|
3185 | + } |
|
3057 | 3186 | // ... otherwise it's the old group sir. |
3058 | - else |
|
3059 | - $value = $old_profile['id_group']; |
|
3187 | + else { |
|
3188 | + $value = $old_profile['id_group']; |
|
3189 | + } |
|
3060 | 3190 | |
3061 | 3191 | // Find the additional membergroups (if any) |
3062 | 3192 | if (isset($_POST['additional_groups']) && is_array($_POST['additional_groups'])) |
@@ -3065,16 +3195,18 @@ discard block |
||
3065 | 3195 | foreach ($_POST['additional_groups'] as $group_id) |
3066 | 3196 | { |
3067 | 3197 | $group_id = (int) $group_id; |
3068 | - if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups))) |
|
3069 | - $additional_groups[] = $group_id; |
|
3198 | + if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups))) { |
|
3199 | + $additional_groups[] = $group_id; |
|
3200 | + } |
|
3070 | 3201 | } |
3071 | 3202 | |
3072 | 3203 | // Put the protected groups back in there if you don't have permission to take them away. |
3073 | 3204 | $old_additional_groups = explode(',', $old_profile['additional_groups']); |
3074 | 3205 | foreach ($old_additional_groups as $group_id) |
3075 | 3206 | { |
3076 | - if (!empty($protected_groups) && in_array($group_id, $protected_groups)) |
|
3077 | - $additional_groups[] = $group_id; |
|
3207 | + if (!empty($protected_groups) && in_array($group_id, $protected_groups)) { |
|
3208 | + $additional_groups[] = $group_id; |
|
3209 | + } |
|
3078 | 3210 | } |
3079 | 3211 | |
3080 | 3212 | if (implode(',', $additional_groups) !== $old_profile['additional_groups']) |
@@ -3106,18 +3238,20 @@ discard block |
||
3106 | 3238 | list ($another) = $smcFunc['db_fetch_row']($request); |
3107 | 3239 | $smcFunc['db_free_result']($request); |
3108 | 3240 | |
3109 | - if (empty($another)) |
|
3110 | - fatal_lang_error('at_least_one_admin', 'critical'); |
|
3241 | + if (empty($another)) { |
|
3242 | + fatal_lang_error('at_least_one_admin', 'critical'); |
|
3243 | + } |
|
3111 | 3244 | } |
3112 | 3245 | } |
3113 | 3246 | |
3114 | 3247 | // If we are changing group status, update permission cache as necessary. |
3115 | 3248 | if ($value != $old_profile['id_group'] || isset($profile_vars['additional_groups'])) |
3116 | 3249 | { |
3117 | - if ($context['user']['is_owner']) |
|
3118 | - $_SESSION['mc']['time'] = 0; |
|
3119 | - else |
|
3120 | - updateSettings(array('settings_updated' => time())); |
|
3250 | + if ($context['user']['is_owner']) { |
|
3251 | + $_SESSION['mc']['time'] = 0; |
|
3252 | + } else { |
|
3253 | + updateSettings(array('settings_updated' => time())); |
|
3254 | + } |
|
3121 | 3255 | } |
3122 | 3256 | |
3123 | 3257 | // Announce to any hooks that we have changed groups, but don't allow them to change it. |
@@ -3138,8 +3272,9 @@ discard block |
||
3138 | 3272 | global $modSettings, $sourcedir, $smcFunc, $profile_vars, $cur_profile, $context; |
3139 | 3273 | |
3140 | 3274 | $memID = $context['id_member']; |
3141 | - if (empty($memID) && !empty($context['password_auth_failed'])) |
|
3142 | - return false; |
|
3275 | + if (empty($memID) && !empty($context['password_auth_failed'])) { |
|
3276 | + return false; |
|
3277 | + } |
|
3143 | 3278 | |
3144 | 3279 | require_once($sourcedir . '/ManageAttachments.php'); |
3145 | 3280 | |
@@ -3150,8 +3285,9 @@ discard block |
||
3150 | 3285 | $downloadedExternalAvatar = false; |
3151 | 3286 | if ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && strlen($_POST['userpicpersonal']) > 7 && !empty($modSettings['avatar_download_external'])) |
3152 | 3287 | { |
3153 | - if (!is_writable($uploadDir)) |
|
3154 | - fatal_lang_error('attachments_no_write', 'critical'); |
|
3288 | + if (!is_writable($uploadDir)) { |
|
3289 | + fatal_lang_error('attachments_no_write', 'critical'); |
|
3290 | + } |
|
3155 | 3291 | |
3156 | 3292 | require_once($sourcedir . '/Subs-Package.php'); |
3157 | 3293 | |
@@ -3195,19 +3331,18 @@ discard block |
||
3195 | 3331 | |
3196 | 3332 | // Get rid of their old avatar. (if uploaded.) |
3197 | 3333 | removeAttachments(array('id_member' => $memID)); |
3198 | - } |
|
3199 | - elseif ($value == 'gravatar' && !empty($modSettings['gravatarEnabled'])) |
|
3334 | + } elseif ($value == 'gravatar' && !empty($modSettings['gravatarEnabled'])) |
|
3200 | 3335 | { |
3201 | 3336 | // One wasn't specified, or it's not allowed to use extra email addresses, or it's not a valid one, reset to default Gravatar. |
3202 | - if (empty($_POST['gravatarEmail']) || empty($modSettings['gravatarAllowExtraEmail']) || !filter_var($_POST['gravatarEmail'], FILTER_VALIDATE_EMAIL)) |
|
3203 | - $profile_vars['avatar'] = 'gravatar://'; |
|
3204 | - else |
|
3205 | - $profile_vars['avatar'] = 'gravatar://' . ($_POST['gravatarEmail'] != $cur_profile['email_address'] ? $_POST['gravatarEmail'] : ''); |
|
3337 | + if (empty($_POST['gravatarEmail']) || empty($modSettings['gravatarAllowExtraEmail']) || !filter_var($_POST['gravatarEmail'], FILTER_VALIDATE_EMAIL)) { |
|
3338 | + $profile_vars['avatar'] = 'gravatar://'; |
|
3339 | + } else { |
|
3340 | + $profile_vars['avatar'] = 'gravatar://' . ($_POST['gravatarEmail'] != $cur_profile['email_address'] ? $_POST['gravatarEmail'] : ''); |
|
3341 | + } |
|
3206 | 3342 | |
3207 | 3343 | // Get rid of their old avatar. (if uploaded.) |
3208 | 3344 | removeAttachments(array('id_member' => $memID)); |
3209 | - } |
|
3210 | - elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external'])) |
|
3345 | + } elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external'])) |
|
3211 | 3346 | { |
3212 | 3347 | // We need these clean... |
3213 | 3348 | $cur_profile['id_attach'] = 0; |
@@ -3219,11 +3354,13 @@ discard block |
||
3219 | 3354 | |
3220 | 3355 | $profile_vars['avatar'] = str_replace(' ', '%20', preg_replace('~action(?:=|%3d)(?!dlattach)~i', 'action-', $_POST['userpicpersonal'])); |
3221 | 3356 | |
3222 | - if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///') |
|
3223 | - $profile_vars['avatar'] = ''; |
|
3357 | + if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///') { |
|
3358 | + $profile_vars['avatar'] = ''; |
|
3359 | + } |
|
3224 | 3360 | // Trying to make us do something we'll regret? |
3225 | - elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://') |
|
3226 | - return 'bad_avatar_invalid_url'; |
|
3361 | + elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://') { |
|
3362 | + return 'bad_avatar_invalid_url'; |
|
3363 | + } |
|
3227 | 3364 | // Should we check dimensions? |
3228 | 3365 | elseif (!empty($modSettings['avatar_max_height_external']) || !empty($modSettings['avatar_max_width_external'])) |
3229 | 3366 | { |
@@ -3233,9 +3370,9 @@ discard block |
||
3233 | 3370 | if (is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external'])))) |
3234 | 3371 | { |
3235 | 3372 | // Houston, we have a problem. The avatar is too large!! |
3236 | - if ($modSettings['avatar_action_too_large'] == 'option_refuse') |
|
3237 | - return 'bad_avatar_too_large'; |
|
3238 | - elseif ($modSettings['avatar_action_too_large'] == 'option_download_and_resize') |
|
3373 | + if ($modSettings['avatar_action_too_large'] == 'option_refuse') { |
|
3374 | + return 'bad_avatar_too_large'; |
|
3375 | + } elseif ($modSettings['avatar_action_too_large'] == 'option_download_and_resize') |
|
3239 | 3376 | { |
3240 | 3377 | // @todo remove this if appropriate |
3241 | 3378 | require_once($sourcedir . '/Subs-Graphics.php'); |
@@ -3245,26 +3382,27 @@ discard block |
||
3245 | 3382 | $cur_profile['id_attach'] = $modSettings['new_avatar_data']['id']; |
3246 | 3383 | $cur_profile['filename'] = $modSettings['new_avatar_data']['filename']; |
3247 | 3384 | $cur_profile['attachment_type'] = $modSettings['new_avatar_data']['type']; |
3385 | + } else { |
|
3386 | + return 'bad_avatar'; |
|
3248 | 3387 | } |
3249 | - else |
|
3250 | - return 'bad_avatar'; |
|
3251 | 3388 | } |
3252 | 3389 | } |
3253 | 3390 | } |
3254 | - } |
|
3255 | - elseif (($value == 'upload' && allowedTo('profile_upload_avatar')) || $downloadedExternalAvatar) |
|
3391 | + } elseif (($value == 'upload' && allowedTo('profile_upload_avatar')) || $downloadedExternalAvatar) |
|
3256 | 3392 | { |
3257 | 3393 | if ((isset($_FILES['attachment']['name']) && $_FILES['attachment']['name'] != '') || $downloadedExternalAvatar) |
3258 | 3394 | { |
3259 | 3395 | // Get the dimensions of the image. |
3260 | 3396 | if (!$downloadedExternalAvatar) |
3261 | 3397 | { |
3262 | - if (!is_writable($uploadDir)) |
|
3263 | - fatal_lang_error('attachments_no_write', 'critical'); |
|
3398 | + if (!is_writable($uploadDir)) { |
|
3399 | + fatal_lang_error('attachments_no_write', 'critical'); |
|
3400 | + } |
|
3264 | 3401 | |
3265 | 3402 | $new_filename = $uploadDir . '/' . getAttachmentFilename('avatar_tmp_' . $memID, false, null, true); |
3266 | - if (!move_uploaded_file($_FILES['attachment']['tmp_name'], $new_filename)) |
|
3267 | - fatal_lang_error('attach_timeout', 'critical'); |
|
3403 | + if (!move_uploaded_file($_FILES['attachment']['tmp_name'], $new_filename)) { |
|
3404 | + fatal_lang_error('attach_timeout', 'critical'); |
|
3405 | + } |
|
3268 | 3406 | |
3269 | 3407 | $_FILES['attachment']['tmp_name'] = $new_filename; |
3270 | 3408 | } |
@@ -3377,17 +3515,19 @@ discard block |
||
3377 | 3515 | $profile_vars['avatar'] = ''; |
3378 | 3516 | |
3379 | 3517 | // Delete any temporary file. |
3380 | - if (file_exists($_FILES['attachment']['tmp_name'])) |
|
3381 | - @unlink($_FILES['attachment']['tmp_name']); |
|
3518 | + if (file_exists($_FILES['attachment']['tmp_name'])) { |
|
3519 | + @unlink($_FILES['attachment']['tmp_name']); |
|
3520 | + } |
|
3382 | 3521 | } |
3383 | 3522 | // Selected the upload avatar option and had one already uploaded before or didn't upload one. |
3384 | - else |
|
3523 | + else { |
|
3524 | + $profile_vars['avatar'] = ''; |
|
3525 | + } |
|
3526 | + } elseif ($value == 'gravatar' && allowedTo('profile_gravatar_avatar')) { |
|
3527 | + $profile_vars['avatar'] = 'gravatar://www.gravatar.com/avatar/' . md5(strtolower(trim($cur_profile['email_address']))); |
|
3528 | + } else { |
|
3385 | 3529 | $profile_vars['avatar'] = ''; |
3386 | 3530 | } |
3387 | - elseif ($value == 'gravatar' && allowedTo('profile_gravatar_avatar')) |
|
3388 | - $profile_vars['avatar'] = 'gravatar://www.gravatar.com/avatar/' . md5(strtolower(trim($cur_profile['email_address']))); |
|
3389 | - else |
|
3390 | - $profile_vars['avatar'] = ''; |
|
3391 | 3531 | |
3392 | 3532 | // Setup the profile variables so it shows things right on display! |
3393 | 3533 | $cur_profile['avatar'] = $profile_vars['avatar']; |
@@ -3435,9 +3575,9 @@ discard block |
||
3435 | 3575 | $smiley_parsed = $unparsed_signature; |
3436 | 3576 | parsesmileys($smiley_parsed); |
3437 | 3577 | $smiley_count = substr_count(strtolower($smiley_parsed), '<img') - substr_count(strtolower($unparsed_signature), '<img'); |
3438 | - if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0) |
|
3439 | - return 'signature_allow_smileys'; |
|
3440 | - elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4]) |
|
3578 | + if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0) { |
|
3579 | + return 'signature_allow_smileys'; |
|
3580 | + } elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4]) |
|
3441 | 3581 | { |
3442 | 3582 | $txt['profile_error_signature_max_smileys'] = sprintf($txt['profile_error_signature_max_smileys'], $sig_limits[4]); |
3443 | 3583 | return 'signature_max_smileys'; |
@@ -3450,14 +3590,15 @@ discard block |
||
3450 | 3590 | { |
3451 | 3591 | $limit_broke = 0; |
3452 | 3592 | // Attempt to allow all sizes of abuse, so to speak. |
3453 | - if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) |
|
3454 | - $limit_broke = $sig_limits[7] . 'px'; |
|
3455 | - elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) |
|
3456 | - $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
3457 | - elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) |
|
3458 | - $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
3459 | - elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) |
|
3460 | - $limit_broke = 'large'; |
|
3593 | + if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) { |
|
3594 | + $limit_broke = $sig_limits[7] . 'px'; |
|
3595 | + } elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) { |
|
3596 | + $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
3597 | + } elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) { |
|
3598 | + $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
3599 | + } elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) { |
|
3600 | + $limit_broke = 'large'; |
|
3601 | + } |
|
3461 | 3602 | |
3462 | 3603 | if ($limit_broke) |
3463 | 3604 | { |
@@ -3499,24 +3640,26 @@ discard block |
||
3499 | 3640 | $width = -1; $height = -1; |
3500 | 3641 | |
3501 | 3642 | // Does it have predefined restraints? Width first. |
3502 | - if ($matches[6][$key]) |
|
3503 | - $matches[2][$key] = $matches[6][$key]; |
|
3643 | + if ($matches[6][$key]) { |
|
3644 | + $matches[2][$key] = $matches[6][$key]; |
|
3645 | + } |
|
3504 | 3646 | if ($matches[2][$key] && $sig_limits[5] && $matches[2][$key] > $sig_limits[5]) |
3505 | 3647 | { |
3506 | 3648 | $width = $sig_limits[5]; |
3507 | 3649 | $matches[4][$key] = $matches[4][$key] * ($width / $matches[2][$key]); |
3650 | + } elseif ($matches[2][$key]) { |
|
3651 | + $width = $matches[2][$key]; |
|
3508 | 3652 | } |
3509 | - elseif ($matches[2][$key]) |
|
3510 | - $width = $matches[2][$key]; |
|
3511 | 3653 | // ... and height. |
3512 | 3654 | if ($matches[4][$key] && $sig_limits[6] && $matches[4][$key] > $sig_limits[6]) |
3513 | 3655 | { |
3514 | 3656 | $height = $sig_limits[6]; |
3515 | - if ($width != -1) |
|
3516 | - $width = $width * ($height / $matches[4][$key]); |
|
3657 | + if ($width != -1) { |
|
3658 | + $width = $width * ($height / $matches[4][$key]); |
|
3659 | + } |
|
3660 | + } elseif ($matches[4][$key]) { |
|
3661 | + $height = $matches[4][$key]; |
|
3517 | 3662 | } |
3518 | - elseif ($matches[4][$key]) |
|
3519 | - $height = $matches[4][$key]; |
|
3520 | 3663 | |
3521 | 3664 | // If the dimensions are still not fixed - we need to check the actual image. |
3522 | 3665 | if (($width == -1 && $sig_limits[5]) || ($height == -1 && $sig_limits[6])) |
@@ -3534,21 +3677,24 @@ discard block |
||
3534 | 3677 | if ($sizes[1] > $sig_limits[6] && $sig_limits[6]) |
3535 | 3678 | { |
3536 | 3679 | $height = $sig_limits[6]; |
3537 | - if ($width == -1) |
|
3538 | - $width = $sizes[0]; |
|
3680 | + if ($width == -1) { |
|
3681 | + $width = $sizes[0]; |
|
3682 | + } |
|
3539 | 3683 | $width = $width * ($height / $sizes[1]); |
3684 | + } elseif ($width != -1) { |
|
3685 | + $height = $sizes[1]; |
|
3540 | 3686 | } |
3541 | - elseif ($width != -1) |
|
3542 | - $height = $sizes[1]; |
|
3543 | 3687 | } |
3544 | 3688 | } |
3545 | 3689 | |
3546 | 3690 | // Did we come up with some changes? If so remake the string. |
3547 | - if ($width != -1 || $height != -1) |
|
3548 | - $replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]'; |
|
3691 | + if ($width != -1 || $height != -1) { |
|
3692 | + $replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]'; |
|
3693 | + } |
|
3694 | + } |
|
3695 | + if (!empty($replaces)) { |
|
3696 | + $value = str_replace(array_keys($replaces), array_values($replaces), $value); |
|
3549 | 3697 | } |
3550 | - if (!empty($replaces)) |
|
3551 | - $value = str_replace(array_keys($replaces), array_values($replaces), $value); |
|
3552 | 3698 | } |
3553 | 3699 | } |
3554 | 3700 | |
@@ -3592,10 +3738,12 @@ discard block |
||
3592 | 3738 | $email = strtr($email, array(''' => '\'')); |
3593 | 3739 | |
3594 | 3740 | // Check the name and email for validity. |
3595 | - if (trim($email) == '') |
|
3596 | - return 'no_email'; |
|
3597 | - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) |
|
3598 | - return 'bad_email'; |
|
3741 | + if (trim($email) == '') { |
|
3742 | + return 'no_email'; |
|
3743 | + } |
|
3744 | + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
3745 | + return 'bad_email'; |
|
3746 | + } |
|
3599 | 3747 | |
3600 | 3748 | // Email addresses should be and stay unique. |
3601 | 3749 | $request = $smcFunc['db_query']('', ' |
@@ -3610,8 +3758,9 @@ discard block |
||
3610 | 3758 | ) |
3611 | 3759 | ); |
3612 | 3760 | |
3613 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
3614 | - return 'email_taken'; |
|
3761 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
3762 | + return 'email_taken'; |
|
3763 | + } |
|
3615 | 3764 | $smcFunc['db_free_result']($request); |
3616 | 3765 | |
3617 | 3766 | return true; |
@@ -3624,8 +3773,9 @@ discard block |
||
3624 | 3773 | { |
3625 | 3774 | global $modSettings, $context, $cur_profile; |
3626 | 3775 | |
3627 | - if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') |
|
3628 | - setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash_salt($_POST['passwrd1'], $cur_profile['password_salt'])); |
|
3776 | + if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') { |
|
3777 | + setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash_salt($_POST['passwrd1'], $cur_profile['password_salt'])); |
|
3778 | + } |
|
3629 | 3779 | |
3630 | 3780 | loadUserSettings(); |
3631 | 3781 | writeLog(); |
@@ -3641,8 +3791,9 @@ discard block |
||
3641 | 3791 | require_once($sourcedir . '/Subs-Post.php'); |
3642 | 3792 | |
3643 | 3793 | // Shouldn't happen but just in case. |
3644 | - if (empty($profile_vars['email_address'])) |
|
3645 | - return; |
|
3794 | + if (empty($profile_vars['email_address'])) { |
|
3795 | + return; |
|
3796 | + } |
|
3646 | 3797 | |
3647 | 3798 | $replacements = array( |
3648 | 3799 | 'ACTIVATIONLINK' => $scripturl . '?action=activate;u=' . $context['id_member'] . ';code=' . $profile_vars['validation_code'], |
@@ -3665,8 +3816,9 @@ discard block |
||
3665 | 3816 | $_SESSION['log_time'] = 0; |
3666 | 3817 | $_SESSION['login_' . $cookiename] = json_encode(array(0, '', 0)); |
3667 | 3818 | |
3668 | - if (isset($_COOKIE[$cookiename])) |
|
3669 | - $_COOKIE[$cookiename] = ''; |
|
3819 | + if (isset($_COOKIE[$cookiename])) { |
|
3820 | + $_COOKIE[$cookiename] = ''; |
|
3821 | + } |
|
3670 | 3822 | |
3671 | 3823 | loadUserSettings(); |
3672 | 3824 | |
@@ -3699,11 +3851,13 @@ discard block |
||
3699 | 3851 | $groups[] = $curMember['id_group']; |
3700 | 3852 | |
3701 | 3853 | // Ensure the query doesn't croak! |
3702 | - if (empty($groups)) |
|
3703 | - $groups = array(0); |
|
3854 | + if (empty($groups)) { |
|
3855 | + $groups = array(0); |
|
3856 | + } |
|
3704 | 3857 | // Just to be sure... |
3705 | - foreach ($groups as $k => $v) |
|
3706 | - $groups[$k] = (int) $v; |
|
3858 | + foreach ($groups as $k => $v) { |
|
3859 | + $groups[$k] = (int) $v; |
|
3860 | + } |
|
3707 | 3861 | |
3708 | 3862 | // Get all the membergroups they can join. |
3709 | 3863 | $request = $smcFunc['db_query']('', ' |
@@ -3733,12 +3887,14 @@ discard block |
||
3733 | 3887 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
3734 | 3888 | { |
3735 | 3889 | // Can they edit their primary group? |
3736 | - if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1) || ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $groups))) |
|
3737 | - $context['can_edit_primary'] = true; |
|
3890 | + if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1) || ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $groups))) { |
|
3891 | + $context['can_edit_primary'] = true; |
|
3892 | + } |
|
3738 | 3893 | |
3739 | 3894 | // If they can't manage (protected) groups, and it's not publically joinable or already assigned, they can't see it. |
3740 | - if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group']) |
|
3741 | - continue; |
|
3895 | + if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group']) { |
|
3896 | + continue; |
|
3897 | + } |
|
3742 | 3898 | |
3743 | 3899 | $context['groups'][in_array($row['id_group'], $groups) ? 'member' : 'available'][$row['id_group']] = array( |
3744 | 3900 | 'id' => $row['id_group'], |
@@ -3767,13 +3923,15 @@ discard block |
||
3767 | 3923 | ); |
3768 | 3924 | |
3769 | 3925 | // No changing primary one unless you have enough groups! |
3770 | - if (count($context['groups']['member']) < 2) |
|
3771 | - $context['can_edit_primary'] = false; |
|
3926 | + if (count($context['groups']['member']) < 2) { |
|
3927 | + $context['can_edit_primary'] = false; |
|
3928 | + } |
|
3772 | 3929 | |
3773 | 3930 | // In the special case that someone is requesting membership of a group, setup some special context vars. |
3774 | - if (isset($_REQUEST['request']) && isset($context['groups']['available'][(int) $_REQUEST['request']]) && $context['groups']['available'][(int) $_REQUEST['request']]['type'] == 2) |
|
3775 | - $context['group_request'] = $context['groups']['available'][(int) $_REQUEST['request']]; |
|
3776 | -} |
|
3931 | + if (isset($_REQUEST['request']) && isset($context['groups']['available'][(int) $_REQUEST['request']]) && $context['groups']['available'][(int) $_REQUEST['request']]['type'] == 2) { |
|
3932 | + $context['group_request'] = $context['groups']['available'][(int) $_REQUEST['request']]; |
|
3933 | + } |
|
3934 | + } |
|
3777 | 3935 | |
3778 | 3936 | /** |
3779 | 3937 | * This function actually makes all the group changes |
@@ -3788,10 +3946,12 @@ discard block |
||
3788 | 3946 | global $user_info, $context, $user_profile, $modSettings, $smcFunc; |
3789 | 3947 | |
3790 | 3948 | // Let's be extra cautious... |
3791 | - if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership'])) |
|
3792 | - isAllowedTo('manage_membergroups'); |
|
3793 | - if (!isset($_REQUEST['gid']) && !isset($_POST['primary'])) |
|
3794 | - fatal_lang_error('no_access', false); |
|
3949 | + if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership'])) { |
|
3950 | + isAllowedTo('manage_membergroups'); |
|
3951 | + } |
|
3952 | + if (!isset($_REQUEST['gid']) && !isset($_POST['primary'])) { |
|
3953 | + fatal_lang_error('no_access', false); |
|
3954 | + } |
|
3795 | 3955 | |
3796 | 3956 | checkSession(isset($_GET['gid']) ? 'get' : 'post'); |
3797 | 3957 | |
@@ -3810,8 +3970,9 @@ discard block |
||
3810 | 3970 | $foundTarget = $changeType == 'primary' && $group_id == 0 ? true : false; |
3811 | 3971 | |
3812 | 3972 | // Sanity check!! |
3813 | - if ($group_id == 1) |
|
3814 | - isAllowedTo('admin_forum'); |
|
3973 | + if ($group_id == 1) { |
|
3974 | + isAllowedTo('admin_forum'); |
|
3975 | + } |
|
3815 | 3976 | // Protected groups too! |
3816 | 3977 | else |
3817 | 3978 | { |
@@ -3828,8 +3989,9 @@ discard block |
||
3828 | 3989 | list ($is_protected) = $smcFunc['db_fetch_row']($request); |
3829 | 3990 | $smcFunc['db_free_result']($request); |
3830 | 3991 | |
3831 | - if ($is_protected == 1) |
|
3832 | - isAllowedTo('admin_forum'); |
|
3992 | + if ($is_protected == 1) { |
|
3993 | + isAllowedTo('admin_forum'); |
|
3994 | + } |
|
3833 | 3995 | } |
3834 | 3996 | |
3835 | 3997 | // What ever we are doing, we need to determine if changing primary is possible! |
@@ -3851,36 +4013,43 @@ discard block |
||
3851 | 4013 | $group_name = $row['group_name']; |
3852 | 4014 | |
3853 | 4015 | // Does the group type match what we're doing - are we trying to request a non-requestable group? |
3854 | - if ($changeType == 'request' && $row['group_type'] != 2) |
|
3855 | - fatal_lang_error('no_access', false); |
|
4016 | + if ($changeType == 'request' && $row['group_type'] != 2) { |
|
4017 | + fatal_lang_error('no_access', false); |
|
4018 | + } |
|
3856 | 4019 | // What about leaving a requestable group we are not a member of? |
3857 | - elseif ($changeType == 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']])) |
|
3858 | - fatal_lang_error('no_access', false); |
|
3859 | - elseif ($changeType == 'free' && $row['group_type'] != 3 && $row['group_type'] != 2) |
|
3860 | - fatal_lang_error('no_access', false); |
|
4020 | + elseif ($changeType == 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']])) { |
|
4021 | + fatal_lang_error('no_access', false); |
|
4022 | + } elseif ($changeType == 'free' && $row['group_type'] != 3 && $row['group_type'] != 2) { |
|
4023 | + fatal_lang_error('no_access', false); |
|
4024 | + } |
|
3861 | 4025 | |
3862 | 4026 | // We can't change the primary group if this is hidden! |
3863 | - if ($row['hidden'] == 2) |
|
3864 | - $canChangePrimary = false; |
|
4027 | + if ($row['hidden'] == 2) { |
|
4028 | + $canChangePrimary = false; |
|
4029 | + } |
|
3865 | 4030 | } |
3866 | 4031 | |
3867 | 4032 | // If this is their old primary, can we change it? |
3868 | - if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false) |
|
3869 | - $canChangePrimary = 1; |
|
4033 | + if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false) { |
|
4034 | + $canChangePrimary = 1; |
|
4035 | + } |
|
3870 | 4036 | |
3871 | 4037 | // If we are not doing a force primary move, don't do it automatically if current primary is not 0. |
3872 | - if ($changeType != 'primary' && $old_profile['id_group'] != 0) |
|
3873 | - $canChangePrimary = false; |
|
4038 | + if ($changeType != 'primary' && $old_profile['id_group'] != 0) { |
|
4039 | + $canChangePrimary = false; |
|
4040 | + } |
|
3874 | 4041 | |
3875 | 4042 | // If this is the one we are acting on, can we even act? |
3876 | - if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) |
|
3877 | - $canChangePrimary = false; |
|
4043 | + if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) { |
|
4044 | + $canChangePrimary = false; |
|
4045 | + } |
|
3878 | 4046 | } |
3879 | 4047 | $smcFunc['db_free_result']($request); |
3880 | 4048 | |
3881 | 4049 | // Didn't find the target? |
3882 | - if (!$foundTarget) |
|
3883 | - fatal_lang_error('no_access', false); |
|
4050 | + if (!$foundTarget) { |
|
4051 | + fatal_lang_error('no_access', false); |
|
4052 | + } |
|
3884 | 4053 | |
3885 | 4054 | // Final security check, don't allow users to promote themselves to admin. |
3886 | 4055 | if ($context['can_manage_membergroups'] && !allowedTo('admin_forum')) |
@@ -3900,8 +4069,9 @@ discard block |
||
3900 | 4069 | list ($disallow) = $smcFunc['db_fetch_row']($request); |
3901 | 4070 | $smcFunc['db_free_result']($request); |
3902 | 4071 | |
3903 | - if ($disallow) |
|
3904 | - isAllowedTo('admin_forum'); |
|
4072 | + if ($disallow) { |
|
4073 | + isAllowedTo('admin_forum'); |
|
4074 | + } |
|
3905 | 4075 | } |
3906 | 4076 | |
3907 | 4077 | // If we're requesting, add the note then return. |
@@ -3919,8 +4089,9 @@ discard block |
||
3919 | 4089 | 'status_open' => 0, |
3920 | 4090 | ) |
3921 | 4091 | ); |
3922 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
3923 | - fatal_lang_error('profile_error_already_requested_group'); |
|
4092 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
4093 | + fatal_lang_error('profile_error_already_requested_group'); |
|
4094 | + } |
|
3924 | 4095 | $smcFunc['db_free_result']($request); |
3925 | 4096 | |
3926 | 4097 | // Log the request. |
@@ -3954,10 +4125,11 @@ discard block |
||
3954 | 4125 | // Are we leaving? |
3955 | 4126 | if ($old_profile['id_group'] == $group_id || isset($addGroups[$group_id])) |
3956 | 4127 | { |
3957 | - if ($old_profile['id_group'] == $group_id) |
|
3958 | - $newPrimary = 0; |
|
3959 | - else |
|
3960 | - unset($addGroups[$group_id]); |
|
4128 | + if ($old_profile['id_group'] == $group_id) { |
|
4129 | + $newPrimary = 0; |
|
4130 | + } else { |
|
4131 | + unset($addGroups[$group_id]); |
|
4132 | + } |
|
3961 | 4133 | } |
3962 | 4134 | // ... if not, must be joining. |
3963 | 4135 | else |
@@ -3965,36 +4137,42 @@ discard block |
||
3965 | 4137 | // Can we change the primary, and do we want to? |
3966 | 4138 | if ($canChangePrimary) |
3967 | 4139 | { |
3968 | - if ($old_profile['id_group'] != 0) |
|
3969 | - $addGroups[$old_profile['id_group']] = -1; |
|
4140 | + if ($old_profile['id_group'] != 0) { |
|
4141 | + $addGroups[$old_profile['id_group']] = -1; |
|
4142 | + } |
|
3970 | 4143 | $newPrimary = $group_id; |
3971 | 4144 | } |
3972 | 4145 | // Otherwise it's an additional group... |
3973 | - else |
|
3974 | - $addGroups[$group_id] = -1; |
|
4146 | + else { |
|
4147 | + $addGroups[$group_id] = -1; |
|
4148 | + } |
|
3975 | 4149 | } |
3976 | 4150 | } |
3977 | 4151 | // Finally, we must be setting the primary. |
3978 | 4152 | elseif ($canChangePrimary) |
3979 | 4153 | { |
3980 | - if ($old_profile['id_group'] != 0) |
|
3981 | - $addGroups[$old_profile['id_group']] = -1; |
|
3982 | - if (isset($addGroups[$group_id])) |
|
3983 | - unset($addGroups[$group_id]); |
|
4154 | + if ($old_profile['id_group'] != 0) { |
|
4155 | + $addGroups[$old_profile['id_group']] = -1; |
|
4156 | + } |
|
4157 | + if (isset($addGroups[$group_id])) { |
|
4158 | + unset($addGroups[$group_id]); |
|
4159 | + } |
|
3984 | 4160 | $newPrimary = $group_id; |
3985 | 4161 | } |
3986 | 4162 | |
3987 | 4163 | // Finally, we can make the changes! |
3988 | - foreach ($addGroups as $id => $dummy) |
|
3989 | - if (empty($id)) |
|
4164 | + foreach ($addGroups as $id => $dummy) { |
|
4165 | + if (empty($id)) |
|
3990 | 4166 | unset($addGroups[$id]); |
4167 | + } |
|
3991 | 4168 | $addGroups = implode(',', array_flip($addGroups)); |
3992 | 4169 | |
3993 | 4170 | // Ensure that we don't cache permissions if the group is changing. |
3994 | - if ($context['user']['is_owner']) |
|
3995 | - $_SESSION['mc']['time'] = 0; |
|
3996 | - else |
|
3997 | - updateSettings(array('settings_updated' => time())); |
|
4171 | + if ($context['user']['is_owner']) { |
|
4172 | + $_SESSION['mc']['time'] = 0; |
|
4173 | + } else { |
|
4174 | + updateSettings(array('settings_updated' => time())); |
|
4175 | + } |
|
3998 | 4176 | |
3999 | 4177 | updateMemberData($memID, array('id_group' => $newPrimary, 'additional_groups' => $addGroups)); |
4000 | 4178 | |
@@ -4017,8 +4195,9 @@ discard block |
||
4017 | 4195 | if (empty($user_settings['tfa_secret']) && $context['user']['is_owner']) |
4018 | 4196 | { |
4019 | 4197 | // Check to ensure we're forcing SSL for authentication |
4020 | - if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) |
|
4021 | - fatal_lang_error('login_ssl_required'); |
|
4198 | + if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) { |
|
4199 | + fatal_lang_error('login_ssl_required'); |
|
4200 | + } |
|
4022 | 4201 | |
4023 | 4202 | // In some cases (forced 2FA or backup code) they would be forced to be redirected here, |
4024 | 4203 | // we do not want too much AJAX to confuse them. |
@@ -4055,8 +4234,7 @@ discard block |
||
4055 | 4234 | $context['sub_template'] = 'tfasetup_backup'; |
4056 | 4235 | |
4057 | 4236 | return; |
4058 | - } |
|
4059 | - else |
|
4237 | + } else |
|
4060 | 4238 | { |
4061 | 4239 | $context['tfa_secret'] = $_SESSION['tfa_secret']; |
4062 | 4240 | $context['tfa_error'] = !$valid_code; |
@@ -4064,8 +4242,7 @@ discard block |
||
4064 | 4242 | $context['tfa_pass_value'] = $_POST['passwd']; |
4065 | 4243 | $context['tfa_value'] = $_POST['tfa_code']; |
4066 | 4244 | } |
4067 | - } |
|
4068 | - else |
|
4245 | + } else |
|
4069 | 4246 | { |
4070 | 4247 | $totp = new \TOTP\Auth(); |
4071 | 4248 | $secret = $totp->generateCode(); |
@@ -4075,17 +4252,16 @@ discard block |
||
4075 | 4252 | } |
4076 | 4253 | |
4077 | 4254 | $context['tfa_qr_url'] = $totp->getQrCodeUrl($context['forum_name'] . ':' . $user_info['name'], $context['tfa_secret']); |
4078 | - } |
|
4079 | - elseif (isset($_REQUEST['disable'])) |
|
4255 | + } elseif (isset($_REQUEST['disable'])) |
|
4080 | 4256 | { |
4081 | 4257 | updateMemberData($memID, array( |
4082 | 4258 | 'tfa_secret' => '', |
4083 | 4259 | 'tfa_backup' => '', |
4084 | 4260 | )); |
4085 | 4261 | redirectexit('action=profile;area=account;u=' . $memID); |
4262 | + } else { |
|
4263 | + redirectexit('action=profile;area=account;u=' . $memID); |
|
4264 | + } |
|
4086 | 4265 | } |
4087 | - else |
|
4088 | - redirectexit('action=profile;area=account;u=' . $memID); |
|
4089 | -} |
|
4090 | 4266 | |
4091 | 4267 | ?> |
4092 | 4268 | \ No newline at end of file |
@@ -51,29 +51,34 @@ discard block |
||
51 | 51 | ); |
52 | 52 | |
53 | 53 | // No file? Thats bad. |
54 | -if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) |
|
54 | +if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) { |
|
55 | 55 | die('Error: No File specified' . "\n"); |
56 | +} |
|
56 | 57 | |
57 | 58 | // The file has to exist. |
58 | 59 | $currentFile = $_SERVER['argv'][1]; |
59 | -if (!file_exists($currentFile)) |
|
60 | +if (!file_exists($currentFile)) { |
|
60 | 61 | die('Error: File does not exist' . "\n"); |
62 | +} |
|
61 | 63 | |
62 | 64 | // Is this ignored? |
63 | -foreach ($ignoreFiles as $if) |
|
65 | +foreach ($ignoreFiles as $if) { |
|
64 | 66 | if (preg_match('~' . $if . '~i', $currentFile)) |
65 | 67 | die; |
68 | +} |
|
66 | 69 | |
67 | 70 | // Lets get the main index.php for $forum_version and $software_year. |
68 | 71 | $indexFile = fopen('./index.php', 'r'); |
69 | 72 | $indexContents = fread($indexFile, 850); |
70 | 73 | |
71 | -if (!preg_match('~\$forum_version = \'SMF ([^\']+)\';~i', $indexContents, $versionResults)) |
|
74 | +if (!preg_match('~\$forum_version = \'SMF ([^\']+)\';~i', $indexContents, $versionResults)) { |
|
72 | 75 | die('Error: Could not locate $forum_version' . "\n"); |
76 | +} |
|
73 | 77 | $currentVersion = $versionResults[1]; |
74 | 78 | |
75 | -if (!preg_match('~\$software_year = \'(\d{4})\';~i', $indexContents, $yearResults)) |
|
79 | +if (!preg_match('~\$software_year = \'(\d{4})\';~i', $indexContents, $yearResults)) { |
|
76 | 80 | die('Error: Could not locate $software_year' . "\n"); |
81 | +} |
|
77 | 82 | $currentSoftwareYear = (int) $yearResults[1]; |
78 | 83 | |
79 | 84 | $file = fopen($currentFile, 'r'); |
@@ -94,20 +99,23 @@ discard block |
||
94 | 99 | ); |
95 | 100 | |
96 | 101 | // Just see if the license is there. |
97 | -if (!preg_match('~' . implode('', $match) . '~i', $contents)) |
|
102 | +if (!preg_match('~' . implode('', $match) . '~i', $contents)) { |
|
98 | 103 | die('Error: License File is invalid or not found in ' . $currentFile . "\n"); |
104 | +} |
|
99 | 105 | |
100 | 106 | // Check the year is correct. |
101 | 107 | $yearMatch = $match; |
102 | 108 | $yearMatch[4] = ' \* @copyright ' . $currentSoftwareYear . ' Simple Machines and individual contributors' . '[\r]?\n'; |
103 | -if (!preg_match('~' . implode('', $yearMatch) . '~i', $contents)) |
|
109 | +if (!preg_match('~' . implode('', $yearMatch) . '~i', $contents)) { |
|
104 | 110 | die('Error: The software year is incorrect in ' . $currentFile . "\n"); |
111 | +} |
|
105 | 112 | |
106 | 113 | // Check the version is correct. |
107 | 114 | $versionMatch = $match; |
108 | 115 | $versionMatch[7] = ' \* @version ' . $currentVersion . '[\r]?\n'; |
109 | -if (!preg_match('~' . implode('', $versionMatch) . '~i', $contents)) |
|
116 | +if (!preg_match('~' . implode('', $versionMatch) . '~i', $contents)) { |
|
110 | 117 | die('Error: The version is incorrect in ' . $currentFile . "\n"); |
118 | +} |
|
111 | 119 | |
112 | 120 | // Special check, ugprade.php, install.php copyright templates. |
113 | 121 | if (in_array($currentFile, array('./other/upgrade.php', './other/install.php'))) |
@@ -115,9 +123,11 @@ discard block |
||
115 | 123 | // The code is fairly well into it, just get the entire contents. |
116 | 124 | $upgradeFile = file_get_contents($currentFile); |
117 | 125 | |
118 | - if (!preg_match('~<li class="copyright"><a href="http://www.simplemachines.org/" title="Simple Machines Forum" target="_blank" class="new_win">SMF © (\d{4}), Simple Machines</a></li>~i', $upgradeFile, $upgradeResults)) |
|
119 | - die('Error: Could not locate upgrade template copyright $software_year' . "\n"); |
|
126 | + if (!preg_match('~<li class="copyright"><a href="http://www.simplemachines.org/" title="Simple Machines Forum" target="_blank" class="new_win">SMF © (\d{4}), Simple Machines</a></li>~i', $upgradeFile, $upgradeResults)) { |
|
127 | + die('Error: Could not locate upgrade template copyright $software_year' . "\n"); |
|
128 | + } |
|
120 | 129 | |
121 | - if ((int) $upgradeResults[1] != $currentSoftwareYear) |
|
122 | - die('Error: Upgrade template copyright year is invalid' . "\n"); |
|
123 | -} |
|
124 | 130 | \ No newline at end of file |
131 | + if ((int) $upgradeResults[1] != $currentSoftwareYear) { |
|
132 | + die('Error: Upgrade template copyright year is invalid' . "\n"); |
|
133 | + } |
|
134 | + } |
|
125 | 135 | \ No newline at end of file |
@@ -53,14 +53,15 @@ discard block |
||
53 | 53 | foreach ($context['smileys'] as $location => $smileyRows) |
54 | 54 | { |
55 | 55 | $countLocations--; |
56 | - if ($location == 'postform') |
|
57 | - echo ' |
|
56 | + if ($location == 'postform') { |
|
57 | + echo ' |
|
58 | 58 | dropdown: |
59 | 59 | {'; |
60 | - elseif ($location == 'popup') |
|
61 | - echo ' |
|
60 | + } elseif ($location == 'popup') { |
|
61 | + echo ' |
|
62 | 62 | popup: |
63 | 63 | {'; |
64 | + } |
|
64 | 65 | |
65 | 66 | $numRows = count($smileyRows); |
66 | 67 | // This is needed because otherwise the editor will remove all the duplicate (empty) keys and leave only 1 additional line |
@@ -72,21 +73,22 @@ discard block |
||
72 | 73 | echo ' |
73 | 74 | ', JavaScriptEscape($smiley['code']), ': ', JavaScriptEscape($settings['smileys_url'] . '/' . $smiley['filename']), empty($smiley['isLast']) ? ',' : ''; |
74 | 75 | } |
75 | - if (empty($smileyRow['isLast']) && $numRows != 1) |
|
76 | - echo ', |
|
76 | + if (empty($smileyRow['isLast']) && $numRows != 1) { |
|
77 | + echo ', |
|
77 | 78 | \'-', $emptyPlaceholder++, '\': \'\','; |
79 | + } |
|
78 | 80 | } |
79 | 81 | echo ' |
80 | 82 | }', $countLocations != 0 ? ',' : ''; |
81 | 83 | } |
82 | 84 | echo ' |
83 | 85 | }'; |
84 | - } |
|
85 | - else |
|
86 | - echo ', |
|
86 | + } else { |
|
87 | + echo ', |
|
87 | 88 | emoticons: |
88 | 89 | {}, |
89 | 90 | emoticonsEnabled:false'; |
91 | + } |
|
90 | 92 | |
91 | 93 | if ($context['show_bbc'] && $bbcContainer !== null) |
92 | 94 | { |
@@ -97,15 +99,16 @@ discard block |
||
97 | 99 | { |
98 | 100 | echo implode('|', $buttonRow); |
99 | 101 | $count_tags--; |
100 | - if (!empty($count_tags)) |
|
101 | - echo '||'; |
|
102 | + if (!empty($count_tags)) { |
|
103 | + echo '||'; |
|
104 | + } |
|
102 | 105 | } |
103 | 106 | |
104 | 107 | echo '",'; |
105 | - } |
|
106 | - else |
|
107 | - echo ', |
|
108 | + } else { |
|
109 | + echo ', |
|
108 | 110 | toolbar: "",'; |
111 | + } |
|
109 | 112 | |
110 | 113 | echo ' |
111 | 114 | }); |
@@ -146,43 +149,48 @@ discard block |
||
146 | 149 | </span>'; |
147 | 150 | |
148 | 151 | $tempTab = $context['tabindex']; |
149 | - if (!empty($context['drafts_pm_save'])) |
|
150 | - $tempTab++; |
|
151 | - elseif (!empty($context['drafts_save'])) |
|
152 | - $tempTab++; |
|
153 | - elseif ($editor_context['preview_type']) |
|
154 | - $tempTab++; |
|
155 | - elseif ($context['show_spellchecking']) |
|
156 | - $tempTab++; |
|
152 | + if (!empty($context['drafts_pm_save'])) { |
|
153 | + $tempTab++; |
|
154 | + } elseif (!empty($context['drafts_save'])) { |
|
155 | + $tempTab++; |
|
156 | + } elseif ($editor_context['preview_type']) { |
|
157 | + $tempTab++; |
|
158 | + } elseif ($context['show_spellchecking']) { |
|
159 | + $tempTab++; |
|
160 | + } |
|
157 | 161 | |
158 | 162 | $tempTab++; |
159 | 163 | $context['tabindex'] = $tempTab; |
160 | 164 | |
161 | - if (!empty($context['drafts_pm_save'])) |
|
162 | - echo ' |
|
165 | + if (!empty($context['drafts_pm_save'])) { |
|
166 | + echo ' |
|
163 | 167 | <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="submitThisOnce(this);" accesskey="d" class="button_submit"> |
164 | 168 | <input type="hidden" id="id_pm_draft" name="id_pm_draft" value="', empty($context['id_pm_draft']) ? 0 : $context['id_pm_draft'], '">'; |
169 | + } |
|
165 | 170 | |
166 | - if (!empty($context['drafts_save'])) |
|
167 | - echo ' |
|
171 | + if (!empty($context['drafts_save'])) { |
|
172 | + echo ' |
|
168 | 173 | <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" class="button_submit"> |
169 | 174 | <input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '">'; |
175 | + } |
|
170 | 176 | |
171 | - if ($context['show_spellchecking']) |
|
172 | - echo ' |
|
177 | + if ($context['show_spellchecking']) { |
|
178 | + echo ' |
|
173 | 179 | <input type="button" value="', $txt['spell_check'], '" tabindex="', --$tempTab, '" onclick="oEditorHandle_', $editor_id, '.spellCheckStart();" class="button_submit">'; |
180 | + } |
|
174 | 181 | |
175 | - if ($editor_context['preview_type']) |
|
176 | - echo ' |
|
182 | + if ($editor_context['preview_type']) { |
|
183 | + echo ' |
|
177 | 184 | <input type="submit" name="preview" value="', isset($editor_context['labels']['preview_button']) ? $editor_context['labels']['preview_button'] : $txt['preview'], '" tabindex="', --$tempTab, '" onclick="', $editor_context['preview_type'] == 2 ? 'return event.ctrlKey || previewPost();' : 'return submitThisOnce(this);', '" accesskey="p" class="button_submit">'; |
185 | + } |
|
178 | 186 | |
179 | 187 | |
180 | 188 | echo ' |
181 | 189 | <input type="submit" value="', isset($editor_context['labels']['post_button']) ? $editor_context['labels']['post_button'] : $txt['post'], '" name="post" tabindex="', --$tempTab, '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit">'; |
182 | 190 | |
183 | 191 | // Load in the PM autosaver if it's enabled |
184 | - if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) |
|
185 | - echo ' |
|
192 | + if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) { |
|
193 | + echo ' |
|
186 | 194 | <span class="righttext padding" style="display: block"> |
187 | 195 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
188 | 196 | <span id="draft_lastautosave" ></span> |
@@ -200,10 +208,11 @@ discard block |
||
200 | 208 | iFreq: ', (empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000), ' |
201 | 209 | }); |
202 | 210 | </script>'; |
211 | + } |
|
203 | 212 | |
204 | 213 | // Start an instance of the auto saver if its enabled |
205 | - if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) |
|
206 | - echo ' |
|
214 | + if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) { |
|
215 | + echo ' |
|
207 | 216 | <span class="righttext padding" style="display: block"> |
208 | 217 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
209 | 218 | <span id="draft_lastautosave" ></span> |
@@ -220,7 +229,8 @@ discard block |
||
220 | 229 | iFreq: ', $context['drafts_autosave_frequency'], ' |
221 | 230 | }); |
222 | 231 | </script>'; |
223 | -} |
|
232 | + } |
|
233 | + } |
|
224 | 234 | |
225 | 235 | /** |
226 | 236 | * This template displays a verification form |
@@ -237,51 +247,57 @@ discard block |
||
237 | 247 | $verify_context = &$context['controls']['verification'][$verify_id]; |
238 | 248 | |
239 | 249 | // Keep track of where we are. |
240 | - if (empty($verify_context['tracking']) || $reset) |
|
241 | - $verify_context['tracking'] = 0; |
|
250 | + if (empty($verify_context['tracking']) || $reset) { |
|
251 | + $verify_context['tracking'] = 0; |
|
252 | + } |
|
242 | 253 | |
243 | 254 | // How many items are there to display in total. |
244 | 255 | $total_items = count($verify_context['questions']) + ($verify_context['show_visual'] || $verify_context['can_recaptcha'] ? 1 : 0); |
245 | 256 | |
246 | 257 | // If we've gone too far, stop. |
247 | - if ($verify_context['tracking'] > $total_items) |
|
248 | - return false; |
|
258 | + if ($verify_context['tracking'] > $total_items) { |
|
259 | + return false; |
|
260 | + } |
|
249 | 261 | |
250 | 262 | // Loop through each item to show them. |
251 | 263 | for ($i = 0; $i < $total_items; $i++) |
252 | 264 | { |
253 | 265 | // If we're after a single item only show it if we're in the right place. |
254 | - if ($display_type == 'single' && $verify_context['tracking'] != $i) |
|
255 | - continue; |
|
266 | + if ($display_type == 'single' && $verify_context['tracking'] != $i) { |
|
267 | + continue; |
|
268 | + } |
|
256 | 269 | |
257 | - if ($display_type != 'single') |
|
258 | - echo ' |
|
270 | + if ($display_type != 'single') { |
|
271 | + echo ' |
|
259 | 272 | <div id="verification_control_', $i, '" class="verification_control">'; |
273 | + } |
|
260 | 274 | |
261 | 275 | // Display empty field, but only if we have one, and it's the first time. |
262 | - if ($verify_context['empty_field'] && empty($i)) |
|
263 | - echo ' |
|
276 | + if ($verify_context['empty_field'] && empty($i)) { |
|
277 | + echo ' |
|
264 | 278 | <div class="smalltext vv_special"> |
265 | 279 | ', $txt['visual_verification_hidden'], ': |
266 | 280 | <input type="text" name="', $_SESSION[$verify_id . '_vv']['empty_field'], '" autocomplete="off" size="30" value=""> |
267 | 281 | </div>'; |
282 | + } |
|
268 | 283 | |
269 | 284 | // Do the actual stuff |
270 | 285 | if ($i == 0 && ($verify_context['show_visual'] || $verify_context['can_recaptcha'])) |
271 | 286 | { |
272 | 287 | if ($verify_context['show_visual']) |
273 | 288 | { |
274 | - if ($context['use_graphic_library']) |
|
275 | - echo ' |
|
289 | + if ($context['use_graphic_library']) { |
|
290 | + echo ' |
|
276 | 291 | <img src="', $verify_context['image_href'], '" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '">'; |
277 | - else |
|
278 | - echo ' |
|
292 | + } else { |
|
293 | + echo ' |
|
279 | 294 | <img src="', $verify_context['image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_1"> |
280 | 295 | <img src="', $verify_context['image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_2"> |
281 | 296 | <img src="', $verify_context['image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_3"> |
282 | 297 | <img src="', $verify_context['image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_4"> |
283 | 298 | <img src="', $verify_context['image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_5"> |
284 | 299 | <img src="', $verify_context['image_href'], ';letter=6" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_6">'; |
300 | + } |
|
285 | 301 | |
286 | 302 | echo ' |
287 | 303 | <div class="smalltext" style="margin: 4px 0 8px 0;"> |
@@ -297,8 +313,7 @@ discard block |
||
297 | 313 | <div class="g-recaptcha centertext" data-sitekey="' . $verify_context['recaptcha_site_key'] . '" data-theme="' . $verify_context['recaptcha_theme'] . '"></div><br> |
298 | 314 | <script type="text/javascript" src="https://www.google.com/recaptcha/api.js"></script>'; |
299 | 315 | } |
300 | - } |
|
301 | - else |
|
316 | + } else |
|
302 | 317 | { |
303 | 318 | // Where in the question array is this question? |
304 | 319 | $qIndex = $verify_context['show_visual'] ? $i - 1 : $i; |
@@ -310,21 +325,24 @@ discard block |
||
310 | 325 | </div>'; |
311 | 326 | } |
312 | 327 | |
313 | - if ($display_type != 'single') |
|
314 | - echo ' |
|
328 | + if ($display_type != 'single') { |
|
329 | + echo ' |
|
315 | 330 | </div>'; |
331 | + } |
|
316 | 332 | |
317 | 333 | // If we were displaying just one and we did it, break. |
318 | - if ($display_type == 'single' && $verify_context['tracking'] == $i) |
|
319 | - break; |
|
334 | + if ($display_type == 'single' && $verify_context['tracking'] == $i) { |
|
335 | + break; |
|
336 | + } |
|
320 | 337 | } |
321 | 338 | |
322 | 339 | // Assume we found something, always, |
323 | 340 | $verify_context['tracking']++; |
324 | 341 | |
325 | 342 | // Tell something displaying piecemeal to keep going. |
326 | - if ($display_type == 'single') |
|
327 | - return true; |
|
328 | -} |
|
343 | + if ($display_type == 'single') { |
|
344 | + return true; |
|
345 | + } |
|
346 | + } |
|
329 | 347 | |
330 | 348 | ?> |
331 | 349 | \ No newline at end of file |
@@ -64,9 +64,10 @@ discard block |
||
64 | 64 | <strong>', $txt['administrators'], ':</strong> |
65 | 65 | ', implode(', ', $context['administrators']); |
66 | 66 | // If we have lots of admins... don't show them all. |
67 | - if (!empty($context['more_admins_link'])) |
|
68 | - echo ' |
|
67 | + if (!empty($context['more_admins_link'])) { |
|
68 | + echo ' |
|
69 | 69 | (', $context['more_admins_link'], ')'; |
70 | + } |
|
70 | 71 | |
71 | 72 | echo ' |
72 | 73 | </div> |
@@ -83,16 +84,18 @@ discard block |
||
83 | 84 | foreach ($area['areas'] as $item_id => $item) |
84 | 85 | { |
85 | 86 | // No point showing the 'home' page here, we're already on it! |
86 | - if ($area_id == 'forum' && $item_id == 'index') |
|
87 | - continue; |
|
87 | + if ($area_id == 'forum' && $item_id == 'index') { |
|
88 | + continue; |
|
89 | + } |
|
88 | 90 | |
89 | 91 | $url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : ''); |
90 | - if (!empty($item['icon_file'])) |
|
91 | - echo ' |
|
92 | + if (!empty($item['icon_file'])) { |
|
93 | + echo ' |
|
92 | 94 | <a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>'; |
93 | - else |
|
94 | - echo ' |
|
95 | + } else { |
|
96 | + echo ' |
|
95 | 97 | <a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>'; |
98 | + } |
|
96 | 99 | } |
97 | 100 | |
98 | 101 | echo ' |
@@ -103,10 +106,11 @@ discard block |
||
103 | 106 | </div>'; |
104 | 107 | |
105 | 108 | // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization. |
106 | - if (empty($modSettings['disable_smf_js'])) |
|
107 | - echo ' |
|
109 | + if (empty($modSettings['disable_smf_js'])) { |
|
110 | + echo ' |
|
108 | 111 | <script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
109 | 112 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
113 | + } |
|
110 | 114 | |
111 | 115 | // This sets the announcements and current versions themselves ;). |
112 | 116 | echo ' |
@@ -185,9 +189,10 @@ discard block |
||
185 | 189 | <em>', $version['version'], '</em>'; |
186 | 190 | |
187 | 191 | // more details for this item, show them a link |
188 | - if ($context['can_admin'] && isset($version['more'])) |
|
189 | - echo |
|
192 | + if ($context['can_admin'] && isset($version['more'])) { |
|
193 | + echo |
|
190 | 194 | ' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>'; |
195 | + } |
|
191 | 196 | echo ' |
192 | 197 | <br>'; |
193 | 198 | } |
@@ -218,20 +223,22 @@ discard block |
||
218 | 223 | |
219 | 224 | foreach ($context['credits'] as $section) |
220 | 225 | { |
221 | - if (isset($section['pretext'])) |
|
222 | - echo ' |
|
226 | + if (isset($section['pretext'])) { |
|
227 | + echo ' |
|
223 | 228 | <p>', $section['pretext'], '</p><hr>'; |
229 | + } |
|
224 | 230 | |
225 | 231 | echo ' |
226 | 232 | <dl>'; |
227 | 233 | |
228 | 234 | foreach ($section['groups'] as $group) |
229 | 235 | { |
230 | - if (isset($group['title'])) |
|
231 | - echo ' |
|
236 | + if (isset($group['title'])) { |
|
237 | + echo ' |
|
232 | 238 | <dt> |
233 | 239 | <strong>', $group['title'], ':</strong> |
234 | 240 | </dt>'; |
241 | + } |
|
235 | 242 | |
236 | 243 | echo ' |
237 | 244 | <dd>', implode(', ', $group['members']), '</dd>'; |
@@ -240,10 +247,11 @@ discard block |
||
240 | 247 | echo ' |
241 | 248 | </dl>'; |
242 | 249 | |
243 | - if (isset($section['posttext'])) |
|
244 | - echo ' |
|
250 | + if (isset($section['posttext'])) { |
|
251 | + echo ' |
|
245 | 252 | <hr> |
246 | 253 | <p>', $section['posttext'], '</p>'; |
254 | + } |
|
247 | 255 | } |
248 | 256 | |
249 | 257 | echo ' |
@@ -259,9 +267,10 @@ discard block |
||
259 | 267 | smfSupportVersions.forum = "', $context['forum_version'], '";'; |
260 | 268 | |
261 | 269 | // Don't worry, none of this is logged, it's just used to give information that might be of use. |
262 | - foreach ($context['current_versions'] as $variable => $version) |
|
263 | - echo ' |
|
270 | + foreach ($context['current_versions'] as $variable => $version) { |
|
271 | + echo ' |
|
264 | 272 | smfSupportVersions.', $variable, ' = "', $version['version'], '";'; |
273 | + } |
|
265 | 274 | |
266 | 275 | // Now we just have to include the script and wait ;). |
267 | 276 | echo ' |
@@ -358,8 +367,8 @@ discard block |
||
358 | 367 | <tbody>'; |
359 | 368 | |
360 | 369 | // Loop through every source file displaying its version - using javascript. |
361 | - foreach ($context['file_versions'] as $filename => $version) |
|
362 | - echo ' |
|
370 | + foreach ($context['file_versions'] as $filename => $version) { |
|
371 | + echo ' |
|
363 | 372 | <tr class="windowbg"> |
364 | 373 | <td class="half_table"> |
365 | 374 | ', $filename, ' |
@@ -371,6 +380,7 @@ discard block |
||
371 | 380 | <em id="currentSources', $filename, '">??</em> |
372 | 381 | </td> |
373 | 382 | </tr>'; |
383 | + } |
|
374 | 384 | |
375 | 385 | // Default template files. |
376 | 386 | echo ' |
@@ -396,8 +406,8 @@ discard block |
||
396 | 406 | <table id="Default" class="table_grid"> |
397 | 407 | <tbody>'; |
398 | 408 | |
399 | - foreach ($context['default_template_versions'] as $filename => $version) |
|
400 | - echo ' |
|
409 | + foreach ($context['default_template_versions'] as $filename => $version) { |
|
410 | + echo ' |
|
401 | 411 | <tr class="windowbg"> |
402 | 412 | <td class="half_table"> |
403 | 413 | ', $filename, ' |
@@ -409,6 +419,7 @@ discard block |
||
409 | 419 | <em id="currentDefault', $filename, '">??</em> |
410 | 420 | </td> |
411 | 421 | </tr>'; |
422 | + } |
|
412 | 423 | |
413 | 424 | // Now the language files... |
414 | 425 | echo ' |
@@ -436,8 +447,8 @@ discard block |
||
436 | 447 | |
437 | 448 | foreach ($context['default_language_versions'] as $language => $files) |
438 | 449 | { |
439 | - foreach ($files as $filename => $version) |
|
440 | - echo ' |
|
450 | + foreach ($files as $filename => $version) { |
|
451 | + echo ' |
|
441 | 452 | <tr class="windowbg"> |
442 | 453 | <td class="half_table"> |
443 | 454 | ', $filename, '.<em>', $language, '</em>.php |
@@ -449,6 +460,7 @@ discard block |
||
449 | 460 | <em id="current', $filename, '.', $language, '">??</em> |
450 | 461 | </td> |
451 | 462 | </tr>'; |
463 | + } |
|
452 | 464 | } |
453 | 465 | |
454 | 466 | echo ' |
@@ -478,8 +490,8 @@ discard block |
||
478 | 490 | <table id="Templates" class="table_grid"> |
479 | 491 | <tbody>'; |
480 | 492 | |
481 | - foreach ($context['template_versions'] as $filename => $version) |
|
482 | - echo ' |
|
493 | + foreach ($context['template_versions'] as $filename => $version) { |
|
494 | + echo ' |
|
483 | 495 | <tr class="windowbg"> |
484 | 496 | <td class="half_table"> |
485 | 497 | ', $filename, ' |
@@ -491,6 +503,7 @@ discard block |
||
491 | 503 | <em id="currentTemplates', $filename, '">??</em> |
492 | 504 | </td> |
493 | 505 | </tr>'; |
506 | + } |
|
494 | 507 | |
495 | 508 | echo ' |
496 | 509 | </tbody> |
@@ -520,8 +533,8 @@ discard block |
||
520 | 533 | <table id="Tasks" class="table_grid"> |
521 | 534 | <tbody>'; |
522 | 535 | |
523 | - foreach ($context['tasks_versions'] as $filename => $version) |
|
524 | - echo ' |
|
536 | + foreach ($context['tasks_versions'] as $filename => $version) { |
|
537 | + echo ' |
|
525 | 538 | <tr class="windowbg"> |
526 | 539 | <td class="half_table"> |
527 | 540 | ', $filename, ' |
@@ -533,6 +546,7 @@ discard block |
||
533 | 546 | <em id="currentTasks', $filename, '">??</em> |
534 | 547 | </td> |
535 | 548 | </tr>'; |
549 | + } |
|
536 | 550 | |
537 | 551 | echo ' |
538 | 552 | </tbody> |
@@ -574,9 +588,10 @@ discard block |
||
574 | 588 | { |
575 | 589 | global $context, $scripturl, $txt, $modSettings; |
576 | 590 | |
577 | - if (!empty($context['saved_successful'])) |
|
578 | - echo ' |
|
591 | + if (!empty($context['saved_successful'])) { |
|
592 | + echo ' |
|
579 | 593 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
594 | + } |
|
580 | 595 | |
581 | 596 | // First section is for adding/removing words from the censored list. |
582 | 597 | echo ' |
@@ -591,11 +606,12 @@ discard block |
||
591 | 606 | <p>', $txt['admin_censored_where'], '</p>'; |
592 | 607 | |
593 | 608 | // Show text boxes for censoring [bad ] => [good ]. |
594 | - foreach ($context['censored_words'] as $vulgar => $proper) |
|
595 | - echo ' |
|
609 | + foreach ($context['censored_words'] as $vulgar => $proper) { |
|
610 | + echo ' |
|
596 | 611 | <div class="block"> |
597 | 612 | <input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30"> |
598 | 613 | </div>'; |
614 | + } |
|
599 | 615 | |
600 | 616 | // Now provide a way to censor more words. |
601 | 617 | echo ' |
@@ -669,19 +685,21 @@ discard block |
||
669 | 685 | <div class="windowbg2 noup"> |
670 | 686 | ', $txt['not_done_reason']; |
671 | 687 | |
672 | - if (!empty($context['continue_percent'])) |
|
673 | - echo ' |
|
688 | + if (!empty($context['continue_percent'])) { |
|
689 | + echo ' |
|
674 | 690 | <div class="progress_bar"> |
675 | 691 | <div class="full_bar">', $context['continue_percent'], '%</div> |
676 | 692 | <div class="green_percent" style="width: ', $context['continue_percent'], '%;"> </div> |
677 | 693 | </div>'; |
694 | + } |
|
678 | 695 | |
679 | - if (!empty($context['substep_enabled'])) |
|
680 | - echo ' |
|
696 | + if (!empty($context['substep_enabled'])) { |
|
697 | + echo ' |
|
681 | 698 | <div class="progress_bar"> |
682 | 699 | <div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div> |
683 | 700 | <div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;"> </div> |
684 | 701 | </div>'; |
702 | + } |
|
685 | 703 | |
686 | 704 | echo ' |
687 | 705 | <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit"> |
@@ -716,35 +734,40 @@ discard block |
||
716 | 734 | { |
717 | 735 | global $context, $txt, $settings, $scripturl; |
718 | 736 | |
719 | - if (!empty($context['saved_successful'])) |
|
720 | - echo ' |
|
737 | + if (!empty($context['saved_successful'])) { |
|
738 | + echo ' |
|
721 | 739 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
722 | - elseif (!empty($context['saved_failed'])) |
|
723 | - echo ' |
|
740 | + } elseif (!empty($context['saved_failed'])) { |
|
741 | + echo ' |
|
724 | 742 | <div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>'; |
743 | + } |
|
725 | 744 | |
726 | - if (!empty($context['settings_pre_javascript'])) |
|
727 | - echo ' |
|
745 | + if (!empty($context['settings_pre_javascript'])) { |
|
746 | + echo ' |
|
728 | 747 | <script>', $context['settings_pre_javascript'], '</script>'; |
748 | + } |
|
729 | 749 | |
730 | - if (!empty($context['settings_insert_above'])) |
|
731 | - echo $context['settings_insert_above']; |
|
750 | + if (!empty($context['settings_insert_above'])) { |
|
751 | + echo $context['settings_insert_above']; |
|
752 | + } |
|
732 | 753 | |
733 | 754 | echo ' |
734 | 755 | <div id="admincenter"> |
735 | 756 | <form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>'; |
736 | 757 | |
737 | 758 | // Is there a custom title? |
738 | - if (isset($context['settings_title'])) |
|
739 | - echo ' |
|
759 | + if (isset($context['settings_title'])) { |
|
760 | + echo ' |
|
740 | 761 | <div class="cat_bar"> |
741 | 762 | <h3 class="catbg">', $context['settings_title'], '</h3> |
742 | 763 | </div>'; |
764 | + } |
|
743 | 765 | |
744 | 766 | // Have we got a message to display? |
745 | - if (!empty($context['settings_message'])) |
|
746 | - echo ' |
|
767 | + if (!empty($context['settings_message'])) { |
|
768 | + echo ' |
|
747 | 769 | <div class="information">', $context['settings_message'], '</div>'; |
770 | + } |
|
748 | 771 | |
749 | 772 | // Now actually loop through all the variables. |
750 | 773 | $is_open = false; |
@@ -797,8 +820,9 @@ discard block |
||
797 | 820 | // Hang about? Are you pulling my leg - a callback?! |
798 | 821 | if (is_array($config_var) && $config_var['type'] == 'callback') |
799 | 822 | { |
800 | - if (function_exists('template_callback_' . $config_var['name'])) |
|
801 | - call_user_func('template_callback_' . $config_var['name']); |
|
823 | + if (function_exists('template_callback_' . $config_var['name'])) { |
|
824 | + call_user_func('template_callback_' . $config_var['name']); |
|
825 | + } |
|
802 | 826 | |
803 | 827 | continue; |
804 | 828 | } |
@@ -828,9 +852,10 @@ discard block |
||
828 | 852 | $text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'); |
829 | 853 | |
830 | 854 | // Show the [?] button. |
831 | - if ($config_var['help']) |
|
832 | - echo ' |
|
855 | + if ($config_var['help']) { |
|
856 | + echo ' |
|
833 | 857 | <a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> '; |
858 | + } |
|
834 | 859 | |
835 | 860 | echo ' |
836 | 861 | <a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span> |
@@ -839,22 +864,25 @@ discard block |
||
839 | 864 | $config_var['preinput']; |
840 | 865 | |
841 | 866 | // Show a check box. |
842 | - if ($config_var['type'] == 'check') |
|
843 | - echo ' |
|
867 | + if ($config_var['type'] == 'check') { |
|
868 | + echo ' |
|
844 | 869 | <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1" class="input_check">'; |
870 | + } |
|
845 | 871 | // Escape (via htmlspecialchars.) the text box. |
846 | - elseif ($config_var['type'] == 'password') |
|
847 | - echo ' |
|
872 | + elseif ($config_var['type'] == 'password') { |
|
873 | + echo ' |
|
848 | 874 | <input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;" class="input_password"><br> |
849 | 875 | <input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_password">'; |
876 | + } |
|
850 | 877 | // Show a selection box. |
851 | 878 | elseif ($config_var['type'] == 'select') |
852 | 879 | { |
853 | 880 | echo ' |
854 | 881 | <select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
855 | - foreach ($config_var['data'] as $option) |
|
856 | - echo ' |
|
882 | + foreach ($config_var['data'] as $option) { |
|
883 | + echo ' |
|
857 | 884 | <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>'; |
885 | + } |
|
858 | 886 | echo ' |
859 | 887 | </select>'; |
860 | 888 | } |
@@ -868,15 +896,17 @@ discard block |
||
868 | 896 | <legend class="board_selector"><a href="#">', $txt['select_boards_from_list'], '</a></legend>'; |
869 | 897 | foreach ($context['board_list'] as $id_cat => $cat) |
870 | 898 | { |
871 | - if (!$first) |
|
872 | - echo ' |
|
899 | + if (!$first) { |
|
900 | + echo ' |
|
873 | 901 | <hr>'; |
902 | + } |
|
874 | 903 | echo ' |
875 | 904 | <strong>', $cat['name'], '</strong> |
876 | 905 | <ul>'; |
877 | - foreach ($cat['boards'] as $id_board => $brd) |
|
878 | - echo ' |
|
906 | + foreach ($cat['boards'] as $id_board => $brd) { |
|
907 | + echo ' |
|
879 | 908 | <li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1" class="input_check"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat(' ', $brd['child_level']) : '', $brd['name'], '</label></li>'; |
909 | + } |
|
880 | 910 | |
881 | 911 | echo ' |
882 | 912 | </ul>'; |
@@ -886,12 +916,14 @@ discard block |
||
886 | 916 | </fieldset>'; |
887 | 917 | } |
888 | 918 | // Text area? |
889 | - elseif ($config_var['type'] == 'large_text') |
|
890 | - echo ' |
|
919 | + elseif ($config_var['type'] == 'large_text') { |
|
920 | + echo ' |
|
891 | 921 | <textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>'; |
922 | + } |
|
892 | 923 | // Permission group? |
893 | - elseif ($config_var['type'] == 'permissions') |
|
894 | - theme_inline_permissions($config_var['name']); |
|
924 | + elseif ($config_var['type'] == 'permissions') { |
|
925 | + theme_inline_permissions($config_var['name']); |
|
926 | + } |
|
895 | 927 | // BBC selection? |
896 | 928 | elseif ($config_var['type'] == 'bbc') |
897 | 929 | { |
@@ -902,20 +934,22 @@ discard block |
||
902 | 934 | |
903 | 935 | foreach ($context['bbc_columns'] as $bbcColumn) |
904 | 936 | { |
905 | - foreach ($bbcColumn as $bbcTag) |
|
906 | - echo ' |
|
937 | + foreach ($bbcColumn as $bbcTag) { |
|
938 | + echo ' |
|
907 | 939 | <li class="list_bbc floatleft"> |
908 | 940 | <input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', ' class="input_check"> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', ' |
909 | 941 | </li>'; |
942 | + } |
|
910 | 943 | } |
911 | 944 | echo ' </ul> |
912 | 945 | <input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', ' class="input_check"> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label> |
913 | 946 | </fieldset>'; |
914 | 947 | } |
915 | 948 | // A simple message? |
916 | - elseif ($config_var['type'] == 'var_message') |
|
917 | - echo ' |
|
949 | + elseif ($config_var['type'] == 'var_message') { |
|
950 | + echo ' |
|
918 | 951 | <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>'; |
952 | + } |
|
919 | 953 | // Assume it must be a text box |
920 | 954 | else |
921 | 955 | { |
@@ -940,63 +974,70 @@ discard block |
||
940 | 974 | ' . $config_var['postinput'] : '', |
941 | 975 | '</dd>'; |
942 | 976 | } |
943 | - } |
|
944 | - |
|
945 | - else |
|
977 | + } else |
|
946 | 978 | { |
947 | 979 | // Just show a separator. |
948 | - if ($config_var == '') |
|
949 | - echo ' |
|
980 | + if ($config_var == '') { |
|
981 | + echo ' |
|
950 | 982 | </dl> |
951 | 983 | <hr> |
952 | 984 | <dl class="settings">'; |
953 | - else |
|
954 | - echo ' |
|
985 | + } else { |
|
986 | + echo ' |
|
955 | 987 | <dd> |
956 | 988 | <strong>' . $config_var . '</strong> |
957 | 989 | </dd>'; |
990 | + } |
|
958 | 991 | } |
959 | 992 | } |
960 | 993 | |
961 | - if ($is_open) |
|
962 | - echo ' |
|
994 | + if ($is_open) { |
|
995 | + echo ' |
|
963 | 996 | </dl>'; |
997 | + } |
|
964 | 998 | |
965 | - if (empty($context['settings_save_dont_show'])) |
|
966 | - echo ' |
|
999 | + if (empty($context['settings_save_dont_show'])) { |
|
1000 | + echo ' |
|
967 | 1001 | <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button_submit">'; |
1002 | + } |
|
968 | 1003 | |
969 | - if ($is_open) |
|
970 | - echo ' |
|
1004 | + if ($is_open) { |
|
1005 | + echo ' |
|
971 | 1006 | </div>'; |
1007 | + } |
|
972 | 1008 | |
973 | 1009 | |
974 | 1010 | // At least one token has to be used! |
975 | - if (isset($context['admin-ssc_token'])) |
|
976 | - echo ' |
|
1011 | + if (isset($context['admin-ssc_token'])) { |
|
1012 | + echo ' |
|
977 | 1013 | <input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">'; |
1014 | + } |
|
978 | 1015 | |
979 | - if (isset($context['admin-dbsc_token'])) |
|
980 | - echo ' |
|
1016 | + if (isset($context['admin-dbsc_token'])) { |
|
1017 | + echo ' |
|
981 | 1018 | <input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">'; |
1019 | + } |
|
982 | 1020 | |
983 | - if (isset($context['admin-mp_token'])) |
|
984 | - echo ' |
|
1021 | + if (isset($context['admin-mp_token'])) { |
|
1022 | + echo ' |
|
985 | 1023 | <input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">'; |
1024 | + } |
|
986 | 1025 | |
987 | 1026 | echo ' |
988 | 1027 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
989 | 1028 | </form> |
990 | 1029 | </div>'; |
991 | 1030 | |
992 | - if (!empty($context['settings_post_javascript'])) |
|
993 | - echo ' |
|
1031 | + if (!empty($context['settings_post_javascript'])) { |
|
1032 | + echo ' |
|
994 | 1033 | <script> |
995 | 1034 | ', $context['settings_post_javascript'], ' |
996 | 1035 | </script>'; |
1036 | + } |
|
997 | 1037 | |
998 | - if (!empty($context['settings_insert_below'])) |
|
999 | - echo $context['settings_insert_below']; |
|
1038 | + if (!empty($context['settings_insert_below'])) { |
|
1039 | + echo $context['settings_insert_below']; |
|
1040 | + } |
|
1000 | 1041 | |
1001 | 1042 | // We may have added a board listing. If we did, we need to make it work. |
1002 | 1043 | addInlineJavascript(' |
@@ -1019,9 +1060,10 @@ discard block |
||
1019 | 1060 | { |
1020 | 1061 | global $context, $txt; |
1021 | 1062 | |
1022 | - if (!empty($context['saved_successful'])) |
|
1023 | - echo ' |
|
1063 | + if (!empty($context['saved_successful'])) { |
|
1064 | + echo ' |
|
1024 | 1065 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
1066 | + } |
|
1025 | 1067 | |
1026 | 1068 | // Standard fields. |
1027 | 1069 | template_show_list('standard_profile_fields'); |
@@ -1053,11 +1095,12 @@ discard block |
||
1053 | 1095 | if (isset($_GET['msg'])) |
1054 | 1096 | { |
1055 | 1097 | loadLanguage('Errors'); |
1056 | - if (isset($txt['custom_option_' . $_GET['msg']])) |
|
1057 | - echo ' |
|
1098 | + if (isset($txt['custom_option_' . $_GET['msg']])) { |
|
1099 | + echo ' |
|
1058 | 1100 | <div class="errorbox">', |
1059 | 1101 | $txt['custom_option_' . $_GET['msg']], ' |
1060 | 1102 | </div>'; |
1103 | + } |
|
1061 | 1104 | } |
1062 | 1105 | |
1063 | 1106 | echo ' |
@@ -1123,9 +1166,10 @@ discard block |
||
1123 | 1166 | <dd> |
1124 | 1167 | <select name="placement" id="placement">'; |
1125 | 1168 | |
1126 | - foreach ($context['cust_profile_fields_placement'] as $order => $name) |
|
1127 | - echo ' |
|
1169 | + foreach ($context['cust_profile_fields_placement'] as $order => $name) { |
|
1170 | + echo ' |
|
1128 | 1171 | <option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>'; |
1172 | + } |
|
1129 | 1173 | |
1130 | 1174 | echo ' |
1131 | 1175 | </select> |
@@ -1148,9 +1192,10 @@ discard block |
||
1148 | 1192 | </dt> |
1149 | 1193 | <dd> |
1150 | 1194 | <select name="field_type" id="field_type" onchange="updateInputBoxes();">'; |
1151 | - foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) |
|
1152 | - echo ' |
|
1195 | + foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) { |
|
1196 | + echo ' |
|
1153 | 1197 | <option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>'; |
1198 | + } |
|
1154 | 1199 | |
1155 | 1200 | echo ' |
1156 | 1201 | </select> |
@@ -1251,9 +1296,10 @@ discard block |
||
1251 | 1296 | </fieldset> |
1252 | 1297 | <input type="submit" name="save" value="', $txt['save'], '" class="button_submit">'; |
1253 | 1298 | |
1254 | - if ($context['fid']) |
|
1255 | - echo ' |
|
1299 | + if ($context['fid']) { |
|
1300 | + echo ' |
|
1256 | 1301 | <input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button_submit you_sure">'; |
1302 | + } |
|
1257 | 1303 | |
1258 | 1304 | echo ' |
1259 | 1305 | </div> |
@@ -1296,8 +1342,7 @@ discard block |
||
1296 | 1342 | { |
1297 | 1343 | echo ' |
1298 | 1344 | <p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>'; |
1299 | - } |
|
1300 | - else |
|
1345 | + } else |
|
1301 | 1346 | { |
1302 | 1347 | echo ' |
1303 | 1348 | <ol class="search_results">'; |
@@ -1323,9 +1368,10 @@ discard block |
||
1323 | 1368 | <li> |
1324 | 1369 | <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']'; |
1325 | 1370 | |
1326 | - if ($result['help']) |
|
1327 | - echo ' |
|
1371 | + if ($result['help']) { |
|
1372 | + echo ' |
|
1328 | 1373 | <p class="double_height">', $result['help'], '</p>'; |
1374 | + } |
|
1329 | 1375 | |
1330 | 1376 | echo ' |
1331 | 1377 | </li>'; |
@@ -1365,18 +1411,20 @@ discard block |
||
1365 | 1411 | <strong>', $txt['setup_verification_answer'], '</strong> |
1366 | 1412 | </dd>'; |
1367 | 1413 | |
1368 | - if (!empty($context['qa_by_lang'][$lang_id])) |
|
1369 | - foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1414 | + if (!empty($context['qa_by_lang'][$lang_id])) { |
|
1415 | + foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1370 | 1416 | { |
1371 | 1417 | $question = $context['question_answers'][$q_id]; |
1418 | + } |
|
1372 | 1419 | echo ' |
1373 | 1420 | <dt> |
1374 | 1421 | <input type="text" name="question[', $lang_id, '][', $q_id, ']" value="', $question['question'], '" size="50" class="input_text verification_question"> |
1375 | 1422 | </dt> |
1376 | 1423 | <dd>'; |
1377 | - foreach ($question['answers'] as $answer) |
|
1378 | - echo ' |
|
1424 | + foreach ($question['answers'] as $answer) { |
|
1425 | + echo ' |
|
1379 | 1426 | <input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="input_text verification_answer">'; |
1427 | + } |
|
1380 | 1428 | |
1381 | 1429 | echo ' |
1382 | 1430 | <div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div> |
@@ -1415,11 +1463,12 @@ discard block |
||
1415 | 1463 | ', $txt['errors_found'], ': |
1416 | 1464 | <ul>'; |
1417 | 1465 | |
1418 | - foreach ($context['repair_errors'] as $error) |
|
1419 | - echo ' |
|
1466 | + foreach ($context['repair_errors'] as $error) { |
|
1467 | + echo ' |
|
1420 | 1468 | <li> |
1421 | 1469 | ', $error, ' |
1422 | 1470 | </li>'; |
1471 | + } |
|
1423 | 1472 | |
1424 | 1473 | echo ' |
1425 | 1474 | </ul> |
@@ -1429,16 +1478,15 @@ discard block |
||
1429 | 1478 | <p class="padding"> |
1430 | 1479 | <strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong> |
1431 | 1480 | </p>'; |
1432 | - } |
|
1433 | - else |
|
1434 | - echo ' |
|
1481 | + } else { |
|
1482 | + echo ' |
|
1435 | 1483 | <p>', $txt['maintain_no_errors'], '</p> |
1436 | 1484 | <p class="padding"> |
1437 | 1485 | <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
1438 | 1486 | </p>'; |
1487 | + } |
|
1439 | 1488 | |
1440 | - } |
|
1441 | - else |
|
1489 | + } else |
|
1442 | 1490 | { |
1443 | 1491 | if (!empty($context['redirect_to_recount'])) |
1444 | 1492 | { |
@@ -1450,8 +1498,7 @@ discard block |
||
1450 | 1498 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1451 | 1499 | <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '"> |
1452 | 1500 | </form>'; |
1453 | - } |
|
1454 | - else |
|
1501 | + } else |
|
1455 | 1502 | { |
1456 | 1503 | echo ' |
1457 | 1504 | <p>', $txt['errors_fixed'], '</p> |
@@ -1603,8 +1650,8 @@ discard block |
||
1603 | 1650 | function template_admin_quick_search() |
1604 | 1651 | { |
1605 | 1652 | global $context, $txt, $scripturl; |
1606 | - if ($context['user']['is_admin']) |
|
1607 | - echo ' |
|
1653 | + if ($context['user']['is_admin']) { |
|
1654 | + echo ' |
|
1608 | 1655 | <span class="floatright"> |
1609 | 1656 | <span class="generic_icons filter centericon"></span> |
1610 | 1657 | <input type="search" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';" class="input_text"> |
@@ -1615,6 +1662,7 @@ discard block |
||
1615 | 1662 | </select> |
1616 | 1663 | <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button_submit"> |
1617 | 1664 | </span>'; |
1618 | -} |
|
1665 | + } |
|
1666 | + } |
|
1619 | 1667 | |
1620 | 1668 | ?> |
1621 | 1669 | \ No newline at end of file |
@@ -39,18 +39,21 @@ discard block |
||
39 | 39 | ); |
40 | 40 | |
41 | 41 | // No file? Thats bad. |
42 | -if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) |
|
42 | +if (!isset($_SERVER['argv'], $_SERVER['argv'][1])) { |
|
43 | 43 | die('Error: No File specified' . "\n"); |
44 | +} |
|
44 | 45 | |
45 | 46 | // The file has to exist. |
46 | 47 | $currentFile = $_SERVER['argv'][1]; |
47 | -if (!file_exists($currentFile)) |
|
48 | +if (!file_exists($currentFile)) { |
|
48 | 49 | die('Error: File does not exist' . "\n"); |
50 | +} |
|
49 | 51 | |
50 | 52 | // Is this ignored? |
51 | -foreach ($ignoreFiles as $if) |
|
53 | +foreach ($ignoreFiles as $if) { |
|
52 | 54 | if (preg_match('~' . $if . '~i', $currentFile)) |
53 | 55 | die; |
56 | +} |
|
54 | 57 | |
55 | 58 | // Less efficent than opening a file with fopen, but we want to be sure to get the right end of the file. file_get_contents |
56 | 59 | $file = fopen($currentFile, 'r'); |
@@ -60,17 +63,21 @@ discard block |
||
60 | 63 | $contents = fread($file, 100); |
61 | 64 | |
62 | 65 | // There is some white space here. |
63 | -if (preg_match('~\?>\s+$~', $contents, $matches)) |
|
66 | +if (preg_match('~\?>\s+$~', $contents, $matches)) { |
|
64 | 67 | die('Error: End of File contains extra spaces in ' . $currentFile . "\n"); |
68 | +} |
|
65 | 69 | |
66 | 70 | // Test to see if its there even, SMF 2.1 base package needs it there in our main files to allow package manager to properly handle end operations. Customizations do not need it. |
67 | -if (!preg_match('~\?>$~', $contents, $matches)) |
|
71 | +if (!preg_match('~\?>$~', $contents, $matches)) { |
|
68 | 72 | die('Error: End of File missing in ' . $currentFile . "\n"); |
73 | +} |
|
69 | 74 | |
70 | 75 | // Test to see if a function/class ending is here but with no return (because we are OCD). |
71 | -if (preg_match('~}([\r]?\n)?\?>~', $contents, $matches)) |
|
76 | +if (preg_match('~}([\r]?\n)?\?>~', $contents, $matches)) { |
|
72 | 77 | echo('Error: Incorrect return(s) after last function/class but before EOF in ' . $currentFile . "\n"); |
78 | +} |
|
73 | 79 | |
74 | 80 | // Test to see if a string ending is here but with no return (because we are OCD). |
75 | -if (preg_match('~;([\r]?\n)?\?>~', $contents, $matches)) |
|
76 | - echo('Error: Incorrect return(s) after last string but before EOF in ' . $currentFile . "\n"); |
|
77 | 81 | \ No newline at end of file |
82 | +if (preg_match('~;([\r]?\n)?\?>~', $contents, $matches)) { |
|
83 | + echo('Error: Incorrect return(s) after last string but before EOF in ' . $currentFile . "\n"); |
|
84 | +} |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | * @version 2.1 Beta 3 |
16 | 16 | */ |
17 | 17 | |
18 | -if (!defined('SMF')) |
|
18 | +if (!defined('SMF')) { |
|
19 | 19 | die('No direct access...'); |
20 | +} |
|
20 | 21 | |
21 | 22 | /** |
22 | 23 | * Main dispatcher. This function checks permissions and passes control through to the relevant section. |
@@ -245,8 +246,9 @@ discard block |
||
245 | 246 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
246 | 247 | { |
247 | 248 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
248 | - if (!empty($row['private'])) |
|
249 | - $row['subject'] = $txt['personal_message']; |
|
249 | + if (!empty($row['private'])) { |
|
250 | + $row['subject'] = $txt['personal_message']; |
|
251 | + } |
|
250 | 252 | |
251 | 253 | $mails[] = $row; |
252 | 254 | } |
@@ -300,8 +302,9 @@ discard block |
||
300 | 302 | $element = substr($key, strrpos($key, '_') + 1); |
301 | 303 | $processedBirthdayEmails[$index][$element] = $value; |
302 | 304 | } |
303 | - foreach ($processedBirthdayEmails as $index => $dummy) |
|
304 | - $emails[$index] = $index; |
|
305 | + foreach ($processedBirthdayEmails as $index => $dummy) { |
|
306 | + $emails[$index] = $index; |
|
307 | + } |
|
305 | 308 | |
306 | 309 | $config_vars = array( |
307 | 310 | // Mail queue stuff, this rocks ;) |
@@ -322,8 +325,9 @@ discard block |
||
322 | 325 | |
323 | 326 | call_integration_hook('integrate_modify_mail_settings', array(&$config_vars)); |
324 | 327 | |
325 | - if ($return_config) |
|
326 | - return $config_vars; |
|
328 | + if ($return_config) { |
|
329 | + return $config_vars; |
|
330 | + } |
|
327 | 331 | |
328 | 332 | // Saving? |
329 | 333 | if (isset($_GET['save'])) |
@@ -398,9 +402,9 @@ discard block |
||
398 | 402 | ); |
399 | 403 | list ($_GET['te']) = $smcFunc['db_fetch_row']($request); |
400 | 404 | $smcFunc['db_free_result']($request); |
405 | + } else { |
|
406 | + $_GET['te'] = (int) $_GET['te']; |
|
401 | 407 | } |
402 | - else |
|
403 | - $_GET['te'] = (int) $_GET['te']; |
|
404 | 408 | |
405 | 409 | $_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0; |
406 | 410 | |
@@ -424,12 +428,14 @@ discard block |
||
424 | 428 | |
425 | 429 | // Try get more time... |
426 | 430 | @set_time_limit(600); |
427 | - if (function_exists('apache_reset_timeout')) |
|
428 | - @apache_reset_timeout(); |
|
431 | + if (function_exists('apache_reset_timeout')) { |
|
432 | + @apache_reset_timeout(); |
|
433 | + } |
|
429 | 434 | |
430 | 435 | // Have we already used our maximum time? |
431 | - if (time() - array_sum(explode(' ', $time_start)) < 5) |
|
432 | - return; |
|
436 | + if (time() - array_sum(explode(' ', $time_start)) < 5) { |
|
437 | + return; |
|
438 | + } |
|
433 | 439 | |
434 | 440 | $context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
435 | 441 | $context['page_title'] = $txt['not_done_title']; |
@@ -459,8 +465,9 @@ discard block |
||
459 | 465 | { |
460 | 466 | global $txt; |
461 | 467 | |
462 | - if ($time_diff < 0) |
|
463 | - $time_diff = 0; |
|
468 | + if ($time_diff < 0) { |
|
469 | + $time_diff = 0; |
|
470 | + } |
|
464 | 471 | |
465 | 472 | // Just do a bit of an if fest... |
466 | 473 | if ($time_diff > 86400) |
@@ -481,8 +488,9 @@ discard block |
||
481 | 488 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
482 | 489 | } |
483 | 490 | // Otherwise must be second |
484 | - else |
|
485 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
486 | -} |
|
491 | + else { |
|
492 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
493 | + } |
|
494 | + } |
|
487 | 495 | |
488 | 496 | ?> |
489 | 497 | \ No newline at end of file |
@@ -58,15 +58,16 @@ |
||
58 | 58 | // Parent hash. |
59 | 59 | 'P' => shell_exec('git show -s --format=%P HEAD'), |
60 | 60 | ))); |
61 | -} |
|
62 | -else |
|
61 | +} else { |
|
63 | 62 | $debugSecondary = base64_encode(json_encode(array(NULL))); |
63 | +} |
|
64 | 64 | |
65 | 65 | $result = stripos($lastLine, 'Signed-off-by:'); |
66 | 66 | if ($result === false) |
67 | 67 | { |
68 | 68 | // Try 2. |
69 | 69 | $result2 = stripos($lastLine, 'Signed by'); |
70 | - if ($result2 === false) |
|
71 | - die('Error: Signed-off-by not found in commit message [' . $lastLine . ']' . '[' . $message . ']' . '[' . $debugSecondary . '][' . $debugMaster . ']' . "\n"); |
|
72 | -} |
|
73 | 70 | \ No newline at end of file |
71 | + if ($result2 === false) { |
|
72 | + die('Error: Signed-off-by not found in commit message [' . $lastLine . ']' . '[' . $message . ']' . '[' . $debugSecondary . '][' . $debugMaster . ']' . "\n"); |
|
73 | + } |
|
74 | + } |
|
74 | 75 | \ No newline at end of file |