@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Load the $modSettings array. |
@@ -25,13 +26,14 @@ discard block |
||
| 25 | 26 | global $cache_enable, $sourcedir, $context; |
| 26 | 27 | |
| 27 | 28 | // Most database systems have not set UTF-8 as their default input charset. |
| 28 | - if (!empty($db_character_set)) |
|
| 29 | - $smcFunc['db_query']('', ' |
|
| 29 | + if (!empty($db_character_set)) { |
|
| 30 | + $smcFunc['db_query']('', ' |
|
| 30 | 31 | SET NAMES {string:db_character_set}', |
| 31 | 32 | array( |
| 32 | 33 | 'db_character_set' => $db_character_set, |
| 33 | 34 | ) |
| 34 | 35 | ); |
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | // We need some caching support, maybe. |
| 37 | 39 | loadCacheAccelerator(); |
@@ -46,28 +48,36 @@ discard block |
||
| 46 | 48 | ) |
| 47 | 49 | ); |
| 48 | 50 | $modSettings = array(); |
| 49 | - if (!$request) |
|
| 50 | - display_db_error(); |
|
| 51 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 52 | - $modSettings[$row[0]] = $row[1]; |
|
| 51 | + if (!$request) { |
|
| 52 | + display_db_error(); |
|
| 53 | + } |
|
| 54 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 55 | + $modSettings[$row[0]] = $row[1]; |
|
| 56 | + } |
|
| 53 | 57 | $smcFunc['db_free_result']($request); |
| 54 | 58 | |
| 55 | 59 | // Do a few things to protect against missing settings or settings with invalid values... |
| 56 | - if (empty($modSettings['defaultMaxTopics']) || $modSettings['defaultMaxTopics'] <= 0 || $modSettings['defaultMaxTopics'] > 999) |
|
| 57 | - $modSettings['defaultMaxTopics'] = 20; |
|
| 58 | - if (empty($modSettings['defaultMaxMessages']) || $modSettings['defaultMaxMessages'] <= 0 || $modSettings['defaultMaxMessages'] > 999) |
|
| 59 | - $modSettings['defaultMaxMessages'] = 15; |
|
| 60 | - if (empty($modSettings['defaultMaxMembers']) || $modSettings['defaultMaxMembers'] <= 0 || $modSettings['defaultMaxMembers'] > 999) |
|
| 61 | - $modSettings['defaultMaxMembers'] = 30; |
|
| 62 | - if (empty($modSettings['defaultMaxListItems']) || $modSettings['defaultMaxListItems'] <= 0 || $modSettings['defaultMaxListItems'] > 999) |
|
| 63 | - $modSettings['defaultMaxListItems'] = 15; |
|
| 60 | + if (empty($modSettings['defaultMaxTopics']) || $modSettings['defaultMaxTopics'] <= 0 || $modSettings['defaultMaxTopics'] > 999) { |
|
| 61 | + $modSettings['defaultMaxTopics'] = 20; |
|
| 62 | + } |
|
| 63 | + if (empty($modSettings['defaultMaxMessages']) || $modSettings['defaultMaxMessages'] <= 0 || $modSettings['defaultMaxMessages'] > 999) { |
|
| 64 | + $modSettings['defaultMaxMessages'] = 15; |
|
| 65 | + } |
|
| 66 | + if (empty($modSettings['defaultMaxMembers']) || $modSettings['defaultMaxMembers'] <= 0 || $modSettings['defaultMaxMembers'] > 999) { |
|
| 67 | + $modSettings['defaultMaxMembers'] = 30; |
|
| 68 | + } |
|
| 69 | + if (empty($modSettings['defaultMaxListItems']) || $modSettings['defaultMaxListItems'] <= 0 || $modSettings['defaultMaxListItems'] > 999) { |
|
| 70 | + $modSettings['defaultMaxListItems'] = 15; |
|
| 71 | + } |
|
| 64 | 72 | |
| 65 | 73 | // We explicitly do not use $smcFunc['json_decode'] here yet, as $smcFunc is not fully loaded. |
| 66 | - if (!is_array($modSettings['attachmentUploadDir'])) |
|
| 67 | - $modSettings['attachmentUploadDir'] = smf_json_decode($modSettings['attachmentUploadDir'], true); |
|
| 74 | + if (!is_array($modSettings['attachmentUploadDir'])) { |
|
| 75 | + $modSettings['attachmentUploadDir'] = smf_json_decode($modSettings['attachmentUploadDir'], true); |
|
| 76 | + } |
|
| 68 | 77 | |
| 69 | - if (!empty($cache_enable)) |
|
| 70 | - cache_put_data('modSettings', $modSettings, 90); |
|
| 78 | + if (!empty($cache_enable)) { |
|
| 79 | + cache_put_data('modSettings', $modSettings, 90); |
|
| 80 | + } |
|
| 71 | 81 | } |
| 72 | 82 | |
| 73 | 83 | $modSettings['cache_enable'] = $cache_enable; |
@@ -87,8 +97,9 @@ discard block |
||
| 87 | 97 | }; |
| 88 | 98 | $fix_utf8mb4 = function($string) use ($utf8, $smcFunc) |
| 89 | 99 | { |
| 90 | - if (!$utf8 || $smcFunc['db_mb4']) |
|
| 91 | - return $string; |
|
| 100 | + if (!$utf8 || $smcFunc['db_mb4']) { |
|
| 101 | + return $string; |
|
| 102 | + } |
|
| 92 | 103 | |
| 93 | 104 | $i = 0; |
| 94 | 105 | $len = strlen($string); |
@@ -100,18 +111,15 @@ discard block |
||
| 100 | 111 | { |
| 101 | 112 | $new_string .= $string[$i]; |
| 102 | 113 | $i++; |
| 103 | - } |
|
| 104 | - elseif ($ord < 224) |
|
| 114 | + } elseif ($ord < 224) |
|
| 105 | 115 | { |
| 106 | 116 | $new_string .= $string[$i] . $string[$i + 1]; |
| 107 | 117 | $i += 2; |
| 108 | - } |
|
| 109 | - elseif ($ord < 240) |
|
| 118 | + } elseif ($ord < 240) |
|
| 110 | 119 | { |
| 111 | 120 | $new_string .= $string[$i] . $string[$i + 1] . $string[$i + 2]; |
| 112 | 121 | $i += 3; |
| 113 | - } |
|
| 114 | - elseif ($ord < 248) |
|
| 122 | + } elseif ($ord < 248) |
|
| 115 | 123 | { |
| 116 | 124 | // Magic happens. |
| 117 | 125 | $val = (ord($string[$i]) & 0x07) << 18; |
@@ -155,8 +163,7 @@ discard block |
||
| 155 | 163 | { |
| 156 | 164 | $result = array_search($needle, array_slice($haystack_arr, $offset)); |
| 157 | 165 | return is_int($result) ? $result + $offset : false; |
| 158 | - } |
|
| 159 | - else |
|
| 166 | + } else |
|
| 160 | 167 | { |
| 161 | 168 | $needle_arr = preg_split('~(' . $ent_list . '|.)~' . ($utf8 ? 'u' : '') . '', $ent_check($needle), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 162 | 169 | $needle_size = count($needle_arr); |
@@ -165,8 +172,9 @@ discard block |
||
| 165 | 172 | while ((int) $result === $result) |
| 166 | 173 | { |
| 167 | 174 | $offset += $result; |
| 168 | - if (array_slice($haystack_arr, $offset, $needle_size) === $needle_arr) |
|
| 169 | - return $offset; |
|
| 175 | + if (array_slice($haystack_arr, $offset, $needle_size) === $needle_arr) { |
|
| 176 | + return $offset; |
|
| 177 | + } |
|
| 170 | 178 | $result = array_search($needle_arr[0], array_slice($haystack_arr, ++$offset)); |
| 171 | 179 | } |
| 172 | 180 | return false; |
@@ -204,8 +212,9 @@ discard block |
||
| 204 | 212 | $string = $ent_check($string); |
| 205 | 213 | preg_match('~^(' . $ent_list . '|.){' . $smcFunc['strlen'](substr($string, 0, $length)) . '}~' . ($utf8 ? 'u' : ''), $string, $matches); |
| 206 | 214 | $string = $matches[0]; |
| 207 | - while (strlen($string) > $length) |
|
| 208 | - $string = preg_replace('~(?:' . $ent_list . '|.)$~' . ($utf8 ? 'u' : ''), '', $string); |
|
| 215 | + while (strlen($string) > $length) { |
|
| 216 | + $string = preg_replace('~(?:' . $ent_list . '|.)$~' . ($utf8 ? 'u' : ''), '', $string); |
|
| 217 | + } |
|
| 209 | 218 | return $string; |
| 210 | 219 | }, |
| 211 | 220 | 'ucfirst' => $utf8 ? function($string) use (&$smcFunc) |
@@ -215,8 +224,9 @@ discard block |
||
| 215 | 224 | 'ucwords' => $utf8 ? function($string) use (&$smcFunc) |
| 216 | 225 | { |
| 217 | 226 | $words = preg_split('~([\s\r\n\t]+)~', $string, -1, PREG_SPLIT_DELIM_CAPTURE); |
| 218 | - for ($i = 0, $n = count($words); $i < $n; $i += 2) |
|
| 219 | - $words[$i] = $smcFunc['ucfirst']($words[$i]); |
|
| 227 | + for ($i = 0, $n = count($words); $i < $n; $i += 2) { |
|
| 228 | + $words[$i] = $smcFunc['ucfirst']($words[$i]); |
|
| 229 | + } |
|
| 220 | 230 | return implode('', $words); |
| 221 | 231 | } : 'ucwords', |
| 222 | 232 | 'json_decode' => 'smf_json_decode', |
@@ -224,16 +234,17 @@ discard block |
||
| 224 | 234 | ); |
| 225 | 235 | |
| 226 | 236 | // Setting the timezone is a requirement for some functions. |
| 227 | - if (isset($modSettings['default_timezone']) && in_array($modSettings['default_timezone'], timezone_identifiers_list())) |
|
| 228 | - date_default_timezone_set($modSettings['default_timezone']); |
|
| 229 | - else |
|
| 237 | + if (isset($modSettings['default_timezone']) && in_array($modSettings['default_timezone'], timezone_identifiers_list())) { |
|
| 238 | + date_default_timezone_set($modSettings['default_timezone']); |
|
| 239 | + } else |
|
| 230 | 240 | { |
| 231 | 241 | // Get PHP's default timezone, if set |
| 232 | 242 | $ini_tz = ini_get('date.timezone'); |
| 233 | - if (!empty($ini_tz)) |
|
| 234 | - $modSettings['default_timezone'] = $ini_tz; |
|
| 235 | - else |
|
| 236 | - $modSettings['default_timezone'] = ''; |
|
| 243 | + if (!empty($ini_tz)) { |
|
| 244 | + $modSettings['default_timezone'] = $ini_tz; |
|
| 245 | + } else { |
|
| 246 | + $modSettings['default_timezone'] = ''; |
|
| 247 | + } |
|
| 237 | 248 | |
| 238 | 249 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
| 239 | 250 | if (!in_array($modSettings['default_timezone'], timezone_identifiers_list())) |
@@ -251,22 +262,26 @@ discard block |
||
| 251 | 262 | if (($modSettings['load_average'] = cache_get_data('loadavg', 90)) == null) |
| 252 | 263 | { |
| 253 | 264 | $modSettings['load_average'] = @file_get_contents('/proc/loadavg'); |
| 254 | - if (!empty($modSettings['load_average']) && preg_match('~^([^ ]+?) ([^ ]+?) ([^ ]+)~', $modSettings['load_average'], $matches) != 0) |
|
| 255 | - $modSettings['load_average'] = (float) $matches[1]; |
|
| 256 | - elseif (($modSettings['load_average'] = @`uptime`) != null && preg_match('~load average[s]?: (\d+\.\d+), (\d+\.\d+), (\d+\.\d+)~i', $modSettings['load_average'], $matches) != 0) |
|
| 257 | - $modSettings['load_average'] = (float) $matches[1]; |
|
| 258 | - else |
|
| 259 | - unset($modSettings['load_average']); |
|
| 265 | + if (!empty($modSettings['load_average']) && preg_match('~^([^ ]+?) ([^ ]+?) ([^ ]+)~', $modSettings['load_average'], $matches) != 0) { |
|
| 266 | + $modSettings['load_average'] = (float) $matches[1]; |
|
| 267 | + } elseif (($modSettings['load_average'] = @`uptime`) != null && preg_match('~load average[s]?: (\d+\.\d+), (\d+\.\d+), (\d+\.\d+)~i', $modSettings['load_average'], $matches) != 0) { |
|
| 268 | + $modSettings['load_average'] = (float) $matches[1]; |
|
| 269 | + } else { |
|
| 270 | + unset($modSettings['load_average']); |
|
| 271 | + } |
|
| 260 | 272 | |
| 261 | - if (!empty($modSettings['load_average']) || $modSettings['load_average'] === 0.0) |
|
| 262 | - cache_put_data('loadavg', $modSettings['load_average'], 90); |
|
| 273 | + if (!empty($modSettings['load_average']) || $modSettings['load_average'] === 0.0) { |
|
| 274 | + cache_put_data('loadavg', $modSettings['load_average'], 90); |
|
| 275 | + } |
|
| 263 | 276 | } |
| 264 | 277 | |
| 265 | - if (!empty($modSettings['load_average']) || $modSettings['load_average'] === 0.0) |
|
| 266 | - call_integration_hook('integrate_load_average', array($modSettings['load_average'])); |
|
| 278 | + if (!empty($modSettings['load_average']) || $modSettings['load_average'] === 0.0) { |
|
| 279 | + call_integration_hook('integrate_load_average', array($modSettings['load_average'])); |
|
| 280 | + } |
|
| 267 | 281 | |
| 268 | - if (!empty($modSettings['loadavg_forum']) && !empty($modSettings['load_average']) && $modSettings['load_average'] >= $modSettings['loadavg_forum']) |
|
| 269 | - display_loadavg_error(); |
|
| 282 | + if (!empty($modSettings['loadavg_forum']) && !empty($modSettings['load_average']) && $modSettings['load_average'] >= $modSettings['loadavg_forum']) { |
|
| 283 | + display_loadavg_error(); |
|
| 284 | + } |
|
| 270 | 285 | } |
| 271 | 286 | |
| 272 | 287 | // Is post moderation alive and well? Everywhere else assumes this has been defined, so let's make sure it is. |
@@ -287,8 +302,9 @@ discard block |
||
| 287 | 302 | if (defined('SMF_INTEGRATION_SETTINGS')) |
| 288 | 303 | { |
| 289 | 304 | $integration_settings = $smcFunc['json_decode'](SMF_INTEGRATION_SETTINGS, true); |
| 290 | - foreach ($integration_settings as $hook => $function) |
|
| 291 | - add_integration_function($hook, $function, '', false); |
|
| 305 | + foreach ($integration_settings as $hook => $function) { |
|
| 306 | + add_integration_function($hook, $function, '', false); |
|
| 307 | + } |
|
| 292 | 308 | } |
| 293 | 309 | |
| 294 | 310 | // Any files to pre include? |
@@ -298,8 +314,9 @@ discard block |
||
| 298 | 314 | foreach ($pre_includes as $include) |
| 299 | 315 | { |
| 300 | 316 | $include = strtr(trim($include), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir)); |
| 301 | - if (file_exists($include)) |
|
| 302 | - require_once($include); |
|
| 317 | + if (file_exists($include)) { |
|
| 318 | + require_once($include); |
|
| 319 | + } |
|
| 303 | 320 | } |
| 304 | 321 | } |
| 305 | 322 | |
@@ -410,9 +427,9 @@ discard block |
||
| 410 | 427 | break; |
| 411 | 428 | } |
| 412 | 429 | } |
| 430 | + } else { |
|
| 431 | + $id_member = 0; |
|
| 413 | 432 | } |
| 414 | - else |
|
| 415 | - $id_member = 0; |
|
| 416 | 433 | |
| 417 | 434 | if (empty($id_member) && isset($_COOKIE[$cookiename])) |
| 418 | 435 | { |
@@ -420,8 +437,9 @@ discard block |
||
| 420 | 437 | $cookie_data = $smcFunc['json_decode']($_COOKIE[$cookiename], true, false); |
| 421 | 438 | |
| 422 | 439 | // Legacy format (for recent 2.0 --> 2.1 upgrades) |
| 423 | - if (empty($cookie_data)) |
|
| 424 | - $cookie_data = safe_unserialize($_COOKIE[$cookiename]); |
|
| 440 | + if (empty($cookie_data)) { |
|
| 441 | + $cookie_data = safe_unserialize($_COOKIE[$cookiename]); |
|
| 442 | + } |
|
| 425 | 443 | |
| 426 | 444 | list($id_member, $password, $login_span, $cookie_domain, $cookie_path) = array_pad((array) $cookie_data, 5, ''); |
| 427 | 445 | |
@@ -429,16 +447,17 @@ discard block |
||
| 429 | 447 | |
| 430 | 448 | // Make sure the cookie is set to the correct domain and path |
| 431 | 449 | require_once($sourcedir . '/Subs-Auth.php'); |
| 432 | - if (array($cookie_domain, $cookie_path) !== url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']))) |
|
| 433 | - setLoginCookie((int) $login_span - time(), $id_member); |
|
| 434 | - } |
|
| 435 | - elseif (empty($id_member) && isset($_SESSION['login_' . $cookiename]) && ($_SESSION['USER_AGENT'] == $_SERVER['HTTP_USER_AGENT'] || !empty($modSettings['disableCheckUA']))) |
|
| 450 | + if (array($cookie_domain, $cookie_path) !== url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']))) { |
|
| 451 | + setLoginCookie((int) $login_span - time(), $id_member); |
|
| 452 | + } |
|
| 453 | + } elseif (empty($id_member) && isset($_SESSION['login_' . $cookiename]) && ($_SESSION['USER_AGENT'] == $_SERVER['HTTP_USER_AGENT'] || !empty($modSettings['disableCheckUA']))) |
|
| 436 | 454 | { |
| 437 | 455 | // @todo Perhaps we can do some more checking on this, such as on the first octet of the IP? |
| 438 | 456 | $cookie_data = $smcFunc['json_decode']($_SESSION['login_' . $cookiename], true); |
| 439 | 457 | |
| 440 | - if (empty($cookie_data)) |
|
| 441 | - $cookie_data = safe_unserialize($_SESSION['login_' . $cookiename]); |
|
| 458 | + if (empty($cookie_data)) { |
|
| 459 | + $cookie_data = safe_unserialize($_SESSION['login_' . $cookiename]); |
|
| 460 | + } |
|
| 442 | 461 | |
| 443 | 462 | list($id_member, $password, $login_span) = array_pad((array) $cookie_data, 3, ''); |
| 444 | 463 | $id_member = !empty($id_member) && strlen($password) == 128 && (int) $login_span > time() ? (int) $id_member : 0; |
@@ -463,30 +482,34 @@ discard block |
||
| 463 | 482 | $user_settings = $smcFunc['db_fetch_assoc']($request); |
| 464 | 483 | $smcFunc['db_free_result']($request); |
| 465 | 484 | |
| 466 | - if (!empty($modSettings['force_ssl']) && $image_proxy_enabled && stripos($user_settings['avatar'], 'http://') !== false && empty($user_info['possibly_robot'])) |
|
| 467 | - $user_settings['avatar'] = get_proxied_url($user_settings['avatar']); |
|
| 485 | + if (!empty($modSettings['force_ssl']) && $image_proxy_enabled && stripos($user_settings['avatar'], 'http://') !== false && empty($user_info['possibly_robot'])) { |
|
| 486 | + $user_settings['avatar'] = get_proxied_url($user_settings['avatar']); |
|
| 487 | + } |
|
| 468 | 488 | |
| 469 | - if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) |
|
| 470 | - cache_put_data('user_settings-' . $id_member, $user_settings, 60); |
|
| 489 | + if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) { |
|
| 490 | + cache_put_data('user_settings-' . $id_member, $user_settings, 60); |
|
| 491 | + } |
|
| 471 | 492 | } |
| 472 | 493 | |
| 473 | 494 | // Did we find 'im? If not, junk it. |
| 474 | 495 | if (!empty($user_settings)) |
| 475 | 496 | { |
| 476 | 497 | // As much as the password should be right, we can assume the integration set things up. |
| 477 | - if (!empty($already_verified) && $already_verified === true) |
|
| 478 | - $check = true; |
|
| 498 | + if (!empty($already_verified) && $already_verified === true) { |
|
| 499 | + $check = true; |
|
| 500 | + } |
|
| 479 | 501 | // SHA-512 hash should be 128 characters long. |
| 480 | - elseif (strlen($password) == 128) |
|
| 481 | - $check = hash_salt($user_settings['passwd'], $user_settings['password_salt']) == $password; |
|
| 482 | - else |
|
| 483 | - $check = false; |
|
| 502 | + elseif (strlen($password) == 128) { |
|
| 503 | + $check = hash_salt($user_settings['passwd'], $user_settings['password_salt']) == $password; |
|
| 504 | + } else { |
|
| 505 | + $check = false; |
|
| 506 | + } |
|
| 484 | 507 | |
| 485 | 508 | // Wrong password or not activated - either way, you're going nowhere. |
| 486 | 509 | $id_member = $check && ($user_settings['is_activated'] == 1 || $user_settings['is_activated'] == 11) ? (int) $user_settings['id_member'] : 0; |
| 510 | + } else { |
|
| 511 | + $id_member = 0; |
|
| 487 | 512 | } |
| 488 | - else |
|
| 489 | - $id_member = 0; |
|
| 490 | 513 | |
| 491 | 514 | // If we no longer have the member maybe they're being all hackey, stop brute force! |
| 492 | 515 | if (!$id_member) |
@@ -515,8 +538,9 @@ discard block |
||
| 515 | 538 | |
| 516 | 539 | list ($tfamember, $tfasecret) = array_pad((array) $tfa_data, 2, ''); |
| 517 | 540 | |
| 518 | - if (!isset($tfamember, $tfasecret) || (int) $tfamember != $id_member) |
|
| 519 | - $tfasecret = null; |
|
| 541 | + if (!isset($tfamember, $tfasecret) || (int) $tfamember != $id_member) { |
|
| 542 | + $tfasecret = null; |
|
| 543 | + } |
|
| 520 | 544 | } |
| 521 | 545 | |
| 522 | 546 | // They didn't finish logging in before coming here? Then they're no one to us. |
@@ -538,10 +562,12 @@ discard block |
||
| 538 | 562 | // Are we forcing 2FA? Need to check if the user groups actually require 2FA |
| 539 | 563 | elseif (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] >= 2 && $id_member && empty($user_settings['tfa_secret'])) |
| 540 | 564 | { |
| 541 | - if ($modSettings['tfa_mode'] == 2) //only do this if we are just forcing SOME membergroups |
|
| 565 | + if ($modSettings['tfa_mode'] == 2) { |
|
| 566 | + //only do this if we are just forcing SOME membergroups |
|
| 542 | 567 | { |
| 543 | 568 | //Build an array of ALL user membergroups. |
| 544 | 569 | $full_groups = array($user_settings['id_group']); |
| 570 | + } |
|
| 545 | 571 | if (!empty($user_settings['additional_groups'])) |
| 546 | 572 | { |
| 547 | 573 | $full_groups = array_merge($full_groups, explode(',', $user_settings['additional_groups'])); |
@@ -561,15 +587,17 @@ discard block |
||
| 561 | 587 | ); |
| 562 | 588 | $row = $smcFunc['db_fetch_assoc']($request); |
| 563 | 589 | $smcFunc['db_free_result']($request); |
| 590 | + } else { |
|
| 591 | + $row['total'] = 1; |
|
| 564 | 592 | } |
| 565 | - else |
|
| 566 | - $row['total'] = 1; //simplifies logics in the next "if" |
|
| 593 | + //simplifies logics in the next "if" |
|
| 567 | 594 | |
| 568 | 595 | $area = !empty($_REQUEST['area']) ? $_REQUEST['area'] : ''; |
| 569 | 596 | $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
| 570 | 597 | |
| 571 | - if ($row['total'] > 0 && !in_array($action, array('profile', 'logout')) || ($action == 'profile' && $area != 'tfasetup')) |
|
| 572 | - redirectexit('action=profile;area=tfasetup;forced'); |
|
| 598 | + if ($row['total'] > 0 && !in_array($action, array('profile', 'logout')) || ($action == 'profile' && $area != 'tfasetup')) { |
|
| 599 | + redirectexit('action=profile;area=tfasetup;forced'); |
|
| 600 | + } |
|
| 573 | 601 | } |
| 574 | 602 | } |
| 575 | 603 | |
@@ -606,29 +634,32 @@ discard block |
||
| 606 | 634 | updateMemberData($id_member, array('id_msg_last_visit' => (int) $modSettings['maxMsgID'], 'last_login' => time(), 'member_ip' => $_SERVER['REMOTE_ADDR'], 'member_ip2' => $_SERVER['BAN_CHECK_IP'])); |
| 607 | 635 | $user_settings['last_login'] = time(); |
| 608 | 636 | |
| 609 | - if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) |
|
| 610 | - cache_put_data('user_settings-' . $id_member, $user_settings, 60); |
|
| 637 | + if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) { |
|
| 638 | + cache_put_data('user_settings-' . $id_member, $user_settings, 60); |
|
| 639 | + } |
|
| 611 | 640 | |
| 612 | - if (!empty($modSettings['cache_enable'])) |
|
| 613 | - cache_put_data('user_last_visit-' . $id_member, $_SESSION['id_msg_last_visit'], 5 * 3600); |
|
| 641 | + if (!empty($modSettings['cache_enable'])) { |
|
| 642 | + cache_put_data('user_last_visit-' . $id_member, $_SESSION['id_msg_last_visit'], 5 * 3600); |
|
| 643 | + } |
|
| 614 | 644 | } |
| 645 | + } elseif (empty($_SESSION['id_msg_last_visit'])) { |
|
| 646 | + $_SESSION['id_msg_last_visit'] = $user_settings['id_msg_last_visit']; |
|
| 615 | 647 | } |
| 616 | - elseif (empty($_SESSION['id_msg_last_visit'])) |
|
| 617 | - $_SESSION['id_msg_last_visit'] = $user_settings['id_msg_last_visit']; |
|
| 618 | 648 | |
| 619 | 649 | $username = $user_settings['member_name']; |
| 620 | 650 | |
| 621 | - if (empty($user_settings['additional_groups'])) |
|
| 622 | - $user_info = array( |
|
| 651 | + if (empty($user_settings['additional_groups'])) { |
|
| 652 | + $user_info = array( |
|
| 623 | 653 | 'groups' => array($user_settings['id_group'], $user_settings['id_post_group']) |
| 624 | 654 | ); |
| 625 | - else |
|
| 626 | - $user_info = array( |
|
| 655 | + } else { |
|
| 656 | + $user_info = array( |
|
| 627 | 657 | 'groups' => array_merge( |
| 628 | 658 | array($user_settings['id_group'], $user_settings['id_post_group']), |
| 629 | 659 | explode(',', $user_settings['additional_groups']) |
| 630 | 660 | ) |
| 631 | 661 | ); |
| 662 | + } |
|
| 632 | 663 | |
| 633 | 664 | // Because history has proven that it is possible for groups to go bad - clean up in case. |
| 634 | 665 | $user_info['groups'] = array_map('intval', $user_info['groups']); |
@@ -645,8 +676,7 @@ discard block |
||
| 645 | 676 | $time_system = new DateTime('now', $tz_system); |
| 646 | 677 | $time_user = new DateTime('now', $tz_user); |
| 647 | 678 | $user_info['time_offset'] = ($tz_user->getOffset($time_user) - $tz_system->getOffset($time_system)) / 3600; |
| 648 | - } |
|
| 649 | - else |
|
| 679 | + } else |
|
| 650 | 680 | { |
| 651 | 681 | // !!! Compatibility. |
| 652 | 682 | $user_info['time_offset'] = empty($user_settings['time_offset']) ? 0 : $user_settings['time_offset']; |
@@ -660,8 +690,9 @@ discard block |
||
| 660 | 690 | $user_info = array('groups' => array(-1)); |
| 661 | 691 | $user_settings = array(); |
| 662 | 692 | |
| 663 | - if (isset($_COOKIE[$cookiename]) && empty($context['tfa_member'])) |
|
| 664 | - $_COOKIE[$cookiename] = ''; |
|
| 693 | + if (isset($_COOKIE[$cookiename]) && empty($context['tfa_member'])) { |
|
| 694 | + $_COOKIE[$cookiename] = ''; |
|
| 695 | + } |
|
| 665 | 696 | |
| 666 | 697 | // Expire the 2FA cookie |
| 667 | 698 | if (isset($_COOKIE[$cookiename . '_tfa']) && empty($context['tfa_member'])) |
@@ -678,19 +709,20 @@ discard block |
||
| 678 | 709 | } |
| 679 | 710 | |
| 680 | 711 | // Create a login token if it doesn't exist yet. |
| 681 | - if (!isset($_SESSION['token']['post-login'])) |
|
| 682 | - createToken('login'); |
|
| 683 | - else |
|
| 684 | - list ($context['login_token_var'],,, $context['login_token']) = $_SESSION['token']['post-login']; |
|
| 712 | + if (!isset($_SESSION['token']['post-login'])) { |
|
| 713 | + createToken('login'); |
|
| 714 | + } else { |
|
| 715 | + list ($context['login_token_var'],,, $context['login_token']) = $_SESSION['token']['post-login']; |
|
| 716 | + } |
|
| 685 | 717 | |
| 686 | 718 | // Do we perhaps think this is a search robot? Check every five minutes just in case... |
| 687 | 719 | if ((!empty($modSettings['spider_mode']) || !empty($modSettings['spider_group'])) && (!isset($_SESSION['robot_check']) || $_SESSION['robot_check'] < time() - 300)) |
| 688 | 720 | { |
| 689 | 721 | require_once($sourcedir . '/ManageSearchEngines.php'); |
| 690 | 722 | $user_info['possibly_robot'] = SpiderCheck(); |
| 723 | + } elseif (!empty($modSettings['spider_mode'])) { |
|
| 724 | + $user_info['possibly_robot'] = isset($_SESSION['id_robot']) ? $_SESSION['id_robot'] : 0; |
|
| 691 | 725 | } |
| 692 | - elseif (!empty($modSettings['spider_mode'])) |
|
| 693 | - $user_info['possibly_robot'] = isset($_SESSION['id_robot']) ? $_SESSION['id_robot'] : 0; |
|
| 694 | 726 | // If we haven't turned on proper spider hunts then have a guess! |
| 695 | 727 | else |
| 696 | 728 | { |
@@ -747,8 +779,9 @@ discard block |
||
| 747 | 779 | $user_info['groups'] = array_unique($user_info['groups']); |
| 748 | 780 | |
| 749 | 781 | // Make sure that the last item in the ignore boards array is valid. If the list was too long it could have an ending comma that could cause problems. |
| 750 | - if (!empty($user_info['ignoreboards']) && empty($user_info['ignoreboards'][$tmp = count($user_info['ignoreboards']) - 1])) |
|
| 751 | - unset($user_info['ignoreboards'][$tmp]); |
|
| 782 | + if (!empty($user_info['ignoreboards']) && empty($user_info['ignoreboards'][$tmp = count($user_info['ignoreboards']) - 1])) { |
|
| 783 | + unset($user_info['ignoreboards'][$tmp]); |
|
| 784 | + } |
|
| 752 | 785 | |
| 753 | 786 | // Allow the user to change their language. |
| 754 | 787 | if (!empty($modSettings['userLanguage'])) |
@@ -761,13 +794,14 @@ discard block |
||
| 761 | 794 | $user_info['language'] = strtr($_GET['language'], './\\:', '____'); |
| 762 | 795 | |
| 763 | 796 | // Make it permanent for members. |
| 764 | - if (!empty($user_info['id'])) |
|
| 765 | - updateMemberData($user_info['id'], array('lngfile' => $user_info['language'])); |
|
| 766 | - else |
|
| 767 | - $_SESSION['language'] = $user_info['language']; |
|
| 797 | + if (!empty($user_info['id'])) { |
|
| 798 | + updateMemberData($user_info['id'], array('lngfile' => $user_info['language'])); |
|
| 799 | + } else { |
|
| 800 | + $_SESSION['language'] = $user_info['language']; |
|
| 801 | + } |
|
| 802 | + } elseif (!empty($_SESSION['language']) && isset($languages[strtr($_SESSION['language'], './\\:', '____')])) { |
|
| 803 | + $user_info['language'] = strtr($_SESSION['language'], './\\:', '____'); |
|
| 768 | 804 | } |
| 769 | - elseif (!empty($_SESSION['language']) && isset($languages[strtr($_SESSION['language'], './\\:', '____')])) |
|
| 770 | - $user_info['language'] = strtr($_SESSION['language'], './\\:', '____'); |
|
| 771 | 805 | } |
| 772 | 806 | |
| 773 | 807 | $temp = build_query_board($user_info['id']); |
@@ -830,9 +864,9 @@ discard block |
||
| 830 | 864 | } |
| 831 | 865 | |
| 832 | 866 | // Remember redirection is the key to avoiding fallout from your bosses. |
| 833 | - if (!empty($topic)) |
|
| 834 | - redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg']); |
|
| 835 | - else |
|
| 867 | + if (!empty($topic)) { |
|
| 868 | + redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg']); |
|
| 869 | + } else |
|
| 836 | 870 | { |
| 837 | 871 | loadPermissions(); |
| 838 | 872 | loadTheme(); |
@@ -850,10 +884,11 @@ discard block |
||
| 850 | 884 | if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] >= 3)) |
| 851 | 885 | { |
| 852 | 886 | // @todo SLOW? |
| 853 | - if (!empty($topic)) |
|
| 854 | - $temp = cache_get_data('topic_board-' . $topic, 120); |
|
| 855 | - else |
|
| 856 | - $temp = cache_get_data('board-' . $board, 120); |
|
| 887 | + if (!empty($topic)) { |
|
| 888 | + $temp = cache_get_data('topic_board-' . $topic, 120); |
|
| 889 | + } else { |
|
| 890 | + $temp = cache_get_data('board-' . $board, 120); |
|
| 891 | + } |
|
| 857 | 892 | |
| 858 | 893 | if (!empty($temp)) |
| 859 | 894 | { |
@@ -891,8 +926,9 @@ discard block |
||
| 891 | 926 | $row = $smcFunc['db_fetch_assoc']($request); |
| 892 | 927 | |
| 893 | 928 | // Set the current board. |
| 894 | - if (!empty($row['id_board'])) |
|
| 895 | - $board = $row['id_board']; |
|
| 929 | + if (!empty($row['id_board'])) { |
|
| 930 | + $board = $row['id_board']; |
|
| 931 | + } |
|
| 896 | 932 | |
| 897 | 933 | // Basic operating information. (globals... :/) |
| 898 | 934 | $board_info = array( |
@@ -928,21 +964,23 @@ discard block |
||
| 928 | 964 | |
| 929 | 965 | do |
| 930 | 966 | { |
| 931 | - if (!empty($row['id_moderator'])) |
|
| 932 | - $board_info['moderators'][$row['id_moderator']] = array( |
|
| 967 | + if (!empty($row['id_moderator'])) { |
|
| 968 | + $board_info['moderators'][$row['id_moderator']] = array( |
|
| 933 | 969 | 'id' => $row['id_moderator'], |
| 934 | 970 | 'name' => $row['real_name'], |
| 935 | 971 | 'href' => $scripturl . '?action=profile;u=' . $row['id_moderator'], |
| 936 | 972 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_moderator'] . '">' . $row['real_name'] . '</a>' |
| 937 | 973 | ); |
| 974 | + } |
|
| 938 | 975 | |
| 939 | - if (!empty($row['id_moderator_group'])) |
|
| 940 | - $board_info['moderator_groups'][$row['id_moderator_group']] = array( |
|
| 976 | + if (!empty($row['id_moderator_group'])) { |
|
| 977 | + $board_info['moderator_groups'][$row['id_moderator_group']] = array( |
|
| 941 | 978 | 'id' => $row['id_moderator_group'], |
| 942 | 979 | 'name' => $row['group_name'], |
| 943 | 980 | 'href' => $scripturl . '?action=groups;sa=members;group=' . $row['id_moderator_group'], |
| 944 | 981 | 'link' => '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_moderator_group'] . '">' . $row['group_name'] . '</a>' |
| 945 | 982 | ); |
| 983 | + } |
|
| 946 | 984 | } |
| 947 | 985 | while ($row = $smcFunc['db_fetch_assoc']($request)); |
| 948 | 986 | |
@@ -974,12 +1012,12 @@ discard block |
||
| 974 | 1012 | if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] >= 3)) |
| 975 | 1013 | { |
| 976 | 1014 | // @todo SLOW? |
| 977 | - if (!empty($topic)) |
|
| 978 | - cache_put_data('topic_board-' . $topic, $board_info, 120); |
|
| 1015 | + if (!empty($topic)) { |
|
| 1016 | + cache_put_data('topic_board-' . $topic, $board_info, 120); |
|
| 1017 | + } |
|
| 979 | 1018 | cache_put_data('board-' . $board, $board_info, 120); |
| 980 | 1019 | } |
| 981 | - } |
|
| 982 | - else |
|
| 1020 | + } else |
|
| 983 | 1021 | { |
| 984 | 1022 | // Otherwise the topic is invalid, there are no moderators, etc. |
| 985 | 1023 | $board_info = array( |
@@ -993,8 +1031,9 @@ discard block |
||
| 993 | 1031 | $smcFunc['db_free_result']($request); |
| 994 | 1032 | } |
| 995 | 1033 | |
| 996 | - if (!empty($topic)) |
|
| 997 | - $_GET['board'] = (int) $board; |
|
| 1034 | + if (!empty($topic)) { |
|
| 1035 | + $_GET['board'] = (int) $board; |
|
| 1036 | + } |
|
| 998 | 1037 | |
| 999 | 1038 | if (!empty($board)) |
| 1000 | 1039 | { |
@@ -1004,10 +1043,12 @@ discard block |
||
| 1004 | 1043 | // Now check if the user is a moderator. |
| 1005 | 1044 | $user_info['is_mod'] = isset($board_info['moderators'][$user_info['id']]) || count(array_intersect($user_info['groups'], $moderator_groups)) != 0; |
| 1006 | 1045 | |
| 1007 | - if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin']) |
|
| 1008 | - $board_info['error'] = 'access'; |
|
| 1009 | - if (!empty($modSettings['deny_boards_access']) && count(array_intersect($user_info['groups'], $board_info['deny_groups'])) != 0 && !$user_info['is_admin']) |
|
| 1010 | - $board_info['error'] = 'access'; |
|
| 1046 | + if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin']) { |
|
| 1047 | + $board_info['error'] = 'access'; |
|
| 1048 | + } |
|
| 1049 | + if (!empty($modSettings['deny_boards_access']) && count(array_intersect($user_info['groups'], $board_info['deny_groups'])) != 0 && !$user_info['is_admin']) { |
|
| 1050 | + $board_info['error'] = 'access'; |
|
| 1051 | + } |
|
| 1011 | 1052 | |
| 1012 | 1053 | // Build up the linktree. |
| 1013 | 1054 | $context['linktree'] = array_merge( |
@@ -1030,8 +1071,9 @@ discard block |
||
| 1030 | 1071 | $context['current_board'] = $board; |
| 1031 | 1072 | |
| 1032 | 1073 | // No posting in redirection boards! |
| 1033 | - if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'post' && !empty($board_info['redirect'])) |
|
| 1034 | - $board_info['error'] == 'post_in_redirect'; |
|
| 1074 | + if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'post' && !empty($board_info['redirect'])) { |
|
| 1075 | + $board_info['error'] == 'post_in_redirect'; |
|
| 1076 | + } |
|
| 1035 | 1077 | |
| 1036 | 1078 | // Hacker... you can't see this topic, I'll tell you that. (but moderators can!) |
| 1037 | 1079 | if (!empty($board_info['error']) && (!empty($modSettings['deny_boards_access']) || $board_info['error'] != 'access' || !$user_info['is_mod'])) |
@@ -1057,24 +1099,23 @@ discard block |
||
| 1057 | 1099 | ob_end_clean(); |
| 1058 | 1100 | send_http_status(403); |
| 1059 | 1101 | die; |
| 1060 | - } |
|
| 1061 | - elseif ($board_info['error'] == 'post_in_redirect') |
|
| 1102 | + } elseif ($board_info['error'] == 'post_in_redirect') |
|
| 1062 | 1103 | { |
| 1063 | 1104 | // Slightly different error message here... |
| 1064 | 1105 | fatal_lang_error('cannot_post_redirect', false); |
| 1065 | - } |
|
| 1066 | - elseif ($user_info['is_guest']) |
|
| 1106 | + } elseif ($user_info['is_guest']) |
|
| 1067 | 1107 | { |
| 1068 | 1108 | loadLanguage('Errors'); |
| 1069 | 1109 | is_not_guest($txt['topic_gone']); |
| 1110 | + } else { |
|
| 1111 | + fatal_lang_error('topic_gone', false); |
|
| 1070 | 1112 | } |
| 1071 | - else |
|
| 1072 | - fatal_lang_error('topic_gone', false); |
|
| 1073 | 1113 | } |
| 1074 | 1114 | |
| 1075 | - if ($user_info['is_mod']) |
|
| 1076 | - $user_info['groups'][] = 3; |
|
| 1077 | -} |
|
| 1115 | + if ($user_info['is_mod']) { |
|
| 1116 | + $user_info['groups'][] = 3; |
|
| 1117 | + } |
|
| 1118 | + } |
|
| 1078 | 1119 | |
| 1079 | 1120 | /** |
| 1080 | 1121 | * Load this user's permissions. |
@@ -1095,8 +1136,9 @@ discard block |
||
| 1095 | 1136 | asort($cache_groups); |
| 1096 | 1137 | $cache_groups = implode(',', $cache_groups); |
| 1097 | 1138 | // If it's a spider then cache it different. |
| 1098 | - if ($user_info['possibly_robot']) |
|
| 1099 | - $cache_groups .= '-spider'; |
|
| 1139 | + if ($user_info['possibly_robot']) { |
|
| 1140 | + $cache_groups .= '-spider'; |
|
| 1141 | + } |
|
| 1100 | 1142 | |
| 1101 | 1143 | if ($modSettings['cache_enable'] >= 2 && !empty($board) && ($temp = cache_get_data('permissions:' . $cache_groups . ':' . $board, 240)) != null && time() - 240 > $modSettings['settings_updated']) |
| 1102 | 1144 | { |
@@ -1104,9 +1146,9 @@ discard block |
||
| 1104 | 1146 | banPermissions(); |
| 1105 | 1147 | |
| 1106 | 1148 | return; |
| 1149 | + } elseif (($temp = cache_get_data('permissions:' . $cache_groups, 240)) != null && time() - 240 > $modSettings['settings_updated']) { |
|
| 1150 | + list ($user_info['permissions'], $removals) = $temp; |
|
| 1107 | 1151 | } |
| 1108 | - elseif (($temp = cache_get_data('permissions:' . $cache_groups, 240)) != null && time() - 240 > $modSettings['settings_updated']) |
|
| 1109 | - list ($user_info['permissions'], $removals) = $temp; |
|
| 1110 | 1152 | } |
| 1111 | 1153 | |
| 1112 | 1154 | // If it is detected as a robot, and we are restricting permissions as a special group - then implement this. |
@@ -1128,23 +1170,26 @@ discard block |
||
| 1128 | 1170 | $removals = array(); |
| 1129 | 1171 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1130 | 1172 | { |
| 1131 | - if (empty($row['add_deny'])) |
|
| 1132 | - $removals[] = $row['permission']; |
|
| 1133 | - else |
|
| 1134 | - $user_info['permissions'][] = $row['permission']; |
|
| 1173 | + if (empty($row['add_deny'])) { |
|
| 1174 | + $removals[] = $row['permission']; |
|
| 1175 | + } else { |
|
| 1176 | + $user_info['permissions'][] = $row['permission']; |
|
| 1177 | + } |
|
| 1135 | 1178 | } |
| 1136 | 1179 | $smcFunc['db_free_result']($request); |
| 1137 | 1180 | |
| 1138 | - if (isset($cache_groups)) |
|
| 1139 | - cache_put_data('permissions:' . $cache_groups, array($user_info['permissions'], $removals), 240); |
|
| 1181 | + if (isset($cache_groups)) { |
|
| 1182 | + cache_put_data('permissions:' . $cache_groups, array($user_info['permissions'], $removals), 240); |
|
| 1183 | + } |
|
| 1140 | 1184 | } |
| 1141 | 1185 | |
| 1142 | 1186 | // Get the board permissions. |
| 1143 | 1187 | if (!empty($board)) |
| 1144 | 1188 | { |
| 1145 | 1189 | // Make sure the board (if any) has been loaded by loadBoard(). |
| 1146 | - if (!isset($board_info['profile'])) |
|
| 1147 | - fatal_lang_error('no_board'); |
|
| 1190 | + if (!isset($board_info['profile'])) { |
|
| 1191 | + fatal_lang_error('no_board'); |
|
| 1192 | + } |
|
| 1148 | 1193 | |
| 1149 | 1194 | $request = $smcFunc['db_query']('', ' |
| 1150 | 1195 | SELECT permission, add_deny |
@@ -1160,20 +1205,23 @@ discard block |
||
| 1160 | 1205 | ); |
| 1161 | 1206 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1162 | 1207 | { |
| 1163 | - if (empty($row['add_deny'])) |
|
| 1164 | - $removals[] = $row['permission']; |
|
| 1165 | - else |
|
| 1166 | - $user_info['permissions'][] = $row['permission']; |
|
| 1208 | + if (empty($row['add_deny'])) { |
|
| 1209 | + $removals[] = $row['permission']; |
|
| 1210 | + } else { |
|
| 1211 | + $user_info['permissions'][] = $row['permission']; |
|
| 1212 | + } |
|
| 1167 | 1213 | } |
| 1168 | 1214 | $smcFunc['db_free_result']($request); |
| 1169 | 1215 | } |
| 1170 | 1216 | |
| 1171 | 1217 | // Remove all the permissions they shouldn't have ;). |
| 1172 | - if (!empty($modSettings['permission_enable_deny'])) |
|
| 1173 | - $user_info['permissions'] = array_diff($user_info['permissions'], $removals); |
|
| 1218 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
| 1219 | + $user_info['permissions'] = array_diff($user_info['permissions'], $removals); |
|
| 1220 | + } |
|
| 1174 | 1221 | |
| 1175 | - if (isset($cache_groups) && !empty($board) && $modSettings['cache_enable'] >= 2) |
|
| 1176 | - cache_put_data('permissions:' . $cache_groups . ':' . $board, array($user_info['permissions'], null), 240); |
|
| 1222 | + if (isset($cache_groups) && !empty($board) && $modSettings['cache_enable'] >= 2) { |
|
| 1223 | + cache_put_data('permissions:' . $cache_groups . ':' . $board, array($user_info['permissions'], null), 240); |
|
| 1224 | + } |
|
| 1177 | 1225 | |
| 1178 | 1226 | // Banned? Watch, don't touch.. |
| 1179 | 1227 | banPermissions(); |
@@ -1185,17 +1233,18 @@ discard block |
||
| 1185 | 1233 | { |
| 1186 | 1234 | require_once($sourcedir . '/Subs-Auth.php'); |
| 1187 | 1235 | rebuildModCache(); |
| 1236 | + } else { |
|
| 1237 | + $user_info['mod_cache'] = $_SESSION['mc']; |
|
| 1188 | 1238 | } |
| 1189 | - else |
|
| 1190 | - $user_info['mod_cache'] = $_SESSION['mc']; |
|
| 1191 | 1239 | |
| 1192 | 1240 | // This is a useful phantom permission added to the current user, and only the current user while they are logged in. |
| 1193 | 1241 | // For example this drastically simplifies certain changes to the profile area. |
| 1194 | 1242 | $user_info['permissions'][] = 'is_not_guest'; |
| 1195 | 1243 | // And now some backwards compatibility stuff for mods and whatnot that aren't expecting the new permissions. |
| 1196 | 1244 | $user_info['permissions'][] = 'profile_view_own'; |
| 1197 | - if (in_array('profile_view', $user_info['permissions'])) |
|
| 1198 | - $user_info['permissions'][] = 'profile_view_any'; |
|
| 1245 | + if (in_array('profile_view', $user_info['permissions'])) { |
|
| 1246 | + $user_info['permissions'][] = 'profile_view_any'; |
|
| 1247 | + } |
|
| 1199 | 1248 | } |
| 1200 | 1249 | } |
| 1201 | 1250 | |
@@ -1213,8 +1262,9 @@ discard block |
||
| 1213 | 1262 | global $image_proxy_enabled, $user_info; |
| 1214 | 1263 | |
| 1215 | 1264 | // Can't just look for no users :P. |
| 1216 | - if (empty($users)) |
|
| 1217 | - return array(); |
|
| 1265 | + if (empty($users)) { |
|
| 1266 | + return array(); |
|
| 1267 | + } |
|
| 1218 | 1268 | |
| 1219 | 1269 | // Pass the set value |
| 1220 | 1270 | $context['loadMemberContext_set'] = $set; |
@@ -1229,8 +1279,9 @@ discard block |
||
| 1229 | 1279 | for ($i = 0, $n = count($users); $i < $n; $i++) |
| 1230 | 1280 | { |
| 1231 | 1281 | $data = cache_get_data('member_data-' . $set . '-' . $users[$i], 240); |
| 1232 | - if ($data == null) |
|
| 1233 | - continue; |
|
| 1282 | + if ($data == null) { |
|
| 1283 | + continue; |
|
| 1284 | + } |
|
| 1234 | 1285 | |
| 1235 | 1286 | $loaded_ids[] = $data['id_member']; |
| 1236 | 1287 | $user_profile[$data['id_member']] = $data; |
@@ -1297,16 +1348,19 @@ discard block |
||
| 1297 | 1348 | $row['avatar_original'] = !empty($row['avatar']) ? $row['avatar'] : ''; |
| 1298 | 1349 | |
| 1299 | 1350 | // Take care of proxying avatar if required, do this here for maximum reach |
| 1300 | - if ($image_proxy_enabled && !empty($row['avatar']) && stripos($row['avatar'], 'http://') !== false && empty($user_info['possibly_robot'])) |
|
| 1301 | - $row['avatar'] = get_proxied_url($row['avatar']); |
|
| 1351 | + if ($image_proxy_enabled && !empty($row['avatar']) && stripos($row['avatar'], 'http://') !== false && empty($user_info['possibly_robot'])) { |
|
| 1352 | + $row['avatar'] = get_proxied_url($row['avatar']); |
|
| 1353 | + } |
|
| 1302 | 1354 | |
| 1303 | 1355 | // Keep track of the member's normal member group |
| 1304 | 1356 | $row['primary_group'] = !empty($row['member_group']) ? $row['member_group'] : ''; |
| 1305 | 1357 | |
| 1306 | - if (isset($row['member_ip'])) |
|
| 1307 | - $row['member_ip'] = inet_dtop($row['member_ip']); |
|
| 1308 | - if (isset($row['member_ip2'])) |
|
| 1309 | - $row['member_ip2'] = inet_dtop($row['member_ip2']); |
|
| 1358 | + if (isset($row['member_ip'])) { |
|
| 1359 | + $row['member_ip'] = inet_dtop($row['member_ip']); |
|
| 1360 | + } |
|
| 1361 | + if (isset($row['member_ip2'])) { |
|
| 1362 | + $row['member_ip2'] = inet_dtop($row['member_ip2']); |
|
| 1363 | + } |
|
| 1310 | 1364 | $row['id_member'] = (int) $row['id_member']; |
| 1311 | 1365 | $new_loaded_ids[] = $row['id_member']; |
| 1312 | 1366 | $loaded_ids[] = $row['id_member']; |
@@ -1326,8 +1380,9 @@ discard block |
||
| 1326 | 1380 | 'loaded_ids' => $new_loaded_ids, |
| 1327 | 1381 | ) |
| 1328 | 1382 | ); |
| 1329 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1330 | - $user_profile[$row['id_member']]['options'][$row['variable']] = $row['value']; |
|
| 1383 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1384 | + $user_profile[$row['id_member']]['options'][$row['variable']] = $row['value']; |
|
| 1385 | + } |
|
| 1331 | 1386 | $smcFunc['db_free_result']($request); |
| 1332 | 1387 | } |
| 1333 | 1388 | |
@@ -1338,10 +1393,11 @@ discard block |
||
| 1338 | 1393 | { |
| 1339 | 1394 | foreach ($loaded_ids as $a_member) |
| 1340 | 1395 | { |
| 1341 | - if (!empty($user_profile[$a_member]['additional_groups'])) |
|
| 1342 | - $groups = array_merge(array($user_profile[$a_member]['id_group']), explode(',', $user_profile[$a_member]['additional_groups'])); |
|
| 1343 | - else |
|
| 1344 | - $groups = array($user_profile[$a_member]['id_group']); |
|
| 1396 | + if (!empty($user_profile[$a_member]['additional_groups'])) { |
|
| 1397 | + $groups = array_merge(array($user_profile[$a_member]['id_group']), explode(',', $user_profile[$a_member]['additional_groups'])); |
|
| 1398 | + } else { |
|
| 1399 | + $groups = array($user_profile[$a_member]['id_group']); |
|
| 1400 | + } |
|
| 1345 | 1401 | |
| 1346 | 1402 | $temp = array_intersect($groups, array_keys($board_info['moderator_groups'])); |
| 1347 | 1403 | |
@@ -1354,8 +1410,9 @@ discard block |
||
| 1354 | 1410 | |
| 1355 | 1411 | if (!empty($new_loaded_ids) && !empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 3) |
| 1356 | 1412 | { |
| 1357 | - for ($i = 0, $n = count($new_loaded_ids); $i < $n; $i++) |
|
| 1358 | - cache_put_data('member_data-' . $set . '-' . $new_loaded_ids[$i], $user_profile[$new_loaded_ids[$i]], 240); |
|
| 1413 | + for ($i = 0, $n = count($new_loaded_ids); $i < $n; $i++) { |
|
| 1414 | + cache_put_data('member_data-' . $set . '-' . $new_loaded_ids[$i], $user_profile[$new_loaded_ids[$i]], 240); |
|
| 1415 | + } |
|
| 1359 | 1416 | } |
| 1360 | 1417 | |
| 1361 | 1418 | // Are we loading any moderators? If so, fix their group data... |
@@ -1381,14 +1438,17 @@ discard block |
||
| 1381 | 1438 | foreach ($temp_mods as $id) |
| 1382 | 1439 | { |
| 1383 | 1440 | // By popular demand, don't show admins or global moderators as moderators. |
| 1384 | - if ($user_profile[$id]['id_group'] != 1 && $user_profile[$id]['id_group'] != 2) |
|
| 1385 | - $user_profile[$id]['member_group'] = $row['member_group']; |
|
| 1441 | + if ($user_profile[$id]['id_group'] != 1 && $user_profile[$id]['id_group'] != 2) { |
|
| 1442 | + $user_profile[$id]['member_group'] = $row['member_group']; |
|
| 1443 | + } |
|
| 1386 | 1444 | |
| 1387 | 1445 | // If the Moderator group has no color or icons, but their group does... don't overwrite. |
| 1388 | - if (!empty($row['icons'])) |
|
| 1389 | - $user_profile[$id]['icons'] = $row['icons']; |
|
| 1390 | - if (!empty($row['member_group_color'])) |
|
| 1391 | - $user_profile[$id]['member_group_color'] = $row['member_group_color']; |
|
| 1446 | + if (!empty($row['icons'])) { |
|
| 1447 | + $user_profile[$id]['icons'] = $row['icons']; |
|
| 1448 | + } |
|
| 1449 | + if (!empty($row['member_group_color'])) { |
|
| 1450 | + $user_profile[$id]['member_group_color'] = $row['member_group_color']; |
|
| 1451 | + } |
|
| 1392 | 1452 | } |
| 1393 | 1453 | } |
| 1394 | 1454 | |
@@ -1410,12 +1470,14 @@ discard block |
||
| 1410 | 1470 | static $loadedLanguages = array(); |
| 1411 | 1471 | |
| 1412 | 1472 | // If this person's data is already loaded, skip it. |
| 1413 | - if (isset($dataLoaded[$user])) |
|
| 1414 | - return true; |
|
| 1473 | + if (isset($dataLoaded[$user])) { |
|
| 1474 | + return true; |
|
| 1475 | + } |
|
| 1415 | 1476 | |
| 1416 | 1477 | // We can't load guests or members not loaded by loadMemberData()! |
| 1417 | - if ($user == 0) |
|
| 1418 | - return false; |
|
| 1478 | + if ($user == 0) { |
|
| 1479 | + return false; |
|
| 1480 | + } |
|
| 1419 | 1481 | if (!isset($user_profile[$user])) |
| 1420 | 1482 | { |
| 1421 | 1483 | trigger_error('loadMemberContext(): member id ' . $user . ' not previously loaded by loadMemberData()', E_USER_WARNING); |
@@ -1441,12 +1503,16 @@ discard block |
||
| 1441 | 1503 | $buddy_list = !empty($profile['buddy_list']) ? explode(',', $profile['buddy_list']) : array(); |
| 1442 | 1504 | |
| 1443 | 1505 | //We need a little fallback for the membergroup icons. If it doesn't exist in the current theme, fallback to default theme |
| 1444 | - if (isset($profile['icons'][1]) && file_exists($settings['actual_theme_dir'] . '/images/membericons/' . $profile['icons'][1])) //icon is set and exists |
|
| 1506 | + if (isset($profile['icons'][1]) && file_exists($settings['actual_theme_dir'] . '/images/membericons/' . $profile['icons'][1])) { |
|
| 1507 | + //icon is set and exists |
|
| 1445 | 1508 | $group_icon_url = $settings['images_url'] . '/membericons/' . $profile['icons'][1]; |
| 1446 | - elseif (isset($profile['icons'][1])) //icon is set and doesn't exist, fallback to default |
|
| 1509 | + } elseif (isset($profile['icons'][1])) { |
|
| 1510 | + //icon is set and doesn't exist, fallback to default |
|
| 1447 | 1511 | $group_icon_url = $settings['default_images_url'] . '/membericons/' . $profile['icons'][1]; |
| 1448 | - else //not set, bye bye |
|
| 1512 | + } else { |
|
| 1513 | + //not set, bye bye |
|
| 1449 | 1514 | $group_icon_url = ''; |
| 1515 | + } |
|
| 1450 | 1516 | |
| 1451 | 1517 | // These minimal values are always loaded |
| 1452 | 1518 | $memberContext[$user] = array( |
@@ -1465,8 +1531,9 @@ discard block |
||
| 1465 | 1531 | if ($context['loadMemberContext_set'] != 'minimal') |
| 1466 | 1532 | { |
| 1467 | 1533 | // Go the extra mile and load the user's native language name. |
| 1468 | - if (empty($loadedLanguages)) |
|
| 1469 | - $loadedLanguages = getLanguages(); |
|
| 1534 | + if (empty($loadedLanguages)) { |
|
| 1535 | + $loadedLanguages = getLanguages(); |
|
| 1536 | + } |
|
| 1470 | 1537 | |
| 1471 | 1538 | $memberContext[$user] += array( |
| 1472 | 1539 | 'username_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['member_name'] . '</span>', |
@@ -1521,31 +1588,33 @@ discard block |
||
| 1521 | 1588 | { |
| 1522 | 1589 | if (!empty($modSettings['gravatarOverride']) || (!empty($modSettings['gravatarEnabled']) && stristr($profile['avatar'], 'gravatar://'))) |
| 1523 | 1590 | { |
| 1524 | - if (!empty($modSettings['gravatarAllowExtraEmail']) && stristr($profile['avatar'], 'gravatar://') && strlen($profile['avatar']) > 11) |
|
| 1525 | - $image = get_gravatar_url($smcFunc['substr']($profile['avatar'], 11)); |
|
| 1526 | - else |
|
| 1527 | - $image = get_gravatar_url($profile['email_address']); |
|
| 1528 | - } |
|
| 1529 | - else |
|
| 1591 | + if (!empty($modSettings['gravatarAllowExtraEmail']) && stristr($profile['avatar'], 'gravatar://') && strlen($profile['avatar']) > 11) { |
|
| 1592 | + $image = get_gravatar_url($smcFunc['substr']($profile['avatar'], 11)); |
|
| 1593 | + } else { |
|
| 1594 | + $image = get_gravatar_url($profile['email_address']); |
|
| 1595 | + } |
|
| 1596 | + } else |
|
| 1530 | 1597 | { |
| 1531 | 1598 | // So it's stored in the member table? |
| 1532 | 1599 | if (!empty($profile['avatar'])) |
| 1533 | 1600 | { |
| 1534 | 1601 | $image = (stristr($profile['avatar'], 'http://') || stristr($profile['avatar'], 'https://')) ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']; |
| 1602 | + } elseif (!empty($profile['filename'])) { |
|
| 1603 | + $image = $modSettings['custom_avatar_url'] . '/' . $profile['filename']; |
|
| 1535 | 1604 | } |
| 1536 | - elseif (!empty($profile['filename'])) |
|
| 1537 | - $image = $modSettings['custom_avatar_url'] . '/' . $profile['filename']; |
|
| 1538 | 1605 | // Right... no avatar...use the default one |
| 1539 | - else |
|
| 1540 | - $image = $modSettings['avatar_url'] . '/default.png'; |
|
| 1606 | + else { |
|
| 1607 | + $image = $modSettings['avatar_url'] . '/default.png'; |
|
| 1608 | + } |
|
| 1541 | 1609 | } |
| 1542 | - if (!empty($image)) |
|
| 1543 | - $memberContext[$user]['avatar'] = array( |
|
| 1610 | + if (!empty($image)) { |
|
| 1611 | + $memberContext[$user]['avatar'] = array( |
|
| 1544 | 1612 | 'name' => $profile['avatar'], |
| 1545 | 1613 | 'image' => '<img class="avatar" src="' . $image . '" alt="avatar_' . $profile['member_name'] . '">', |
| 1546 | 1614 | 'href' => $image, |
| 1547 | 1615 | 'url' => $image, |
| 1548 | 1616 | ); |
| 1617 | + } |
|
| 1549 | 1618 | } |
| 1550 | 1619 | |
| 1551 | 1620 | // Are we also loading the members custom fields into context? |
@@ -1553,13 +1622,15 @@ discard block |
||
| 1553 | 1622 | { |
| 1554 | 1623 | $memberContext[$user]['custom_fields'] = array(); |
| 1555 | 1624 | |
| 1556 | - if (!isset($context['display_fields'])) |
|
| 1557 | - $context['display_fields'] = $smcFunc['json_decode']($modSettings['displayFields'], true); |
|
| 1625 | + if (!isset($context['display_fields'])) { |
|
| 1626 | + $context['display_fields'] = $smcFunc['json_decode']($modSettings['displayFields'], true); |
|
| 1627 | + } |
|
| 1558 | 1628 | |
| 1559 | 1629 | foreach ($context['display_fields'] as $custom) |
| 1560 | 1630 | { |
| 1561 | - if (!isset($custom['col_name']) || trim($custom['col_name']) == '' || empty($profile['options'][$custom['col_name']])) |
|
| 1562 | - continue; |
|
| 1631 | + if (!isset($custom['col_name']) || trim($custom['col_name']) == '' || empty($profile['options'][$custom['col_name']])) { |
|
| 1632 | + continue; |
|
| 1633 | + } |
|
| 1563 | 1634 | |
| 1564 | 1635 | $value = $profile['options'][$custom['col_name']]; |
| 1565 | 1636 | |
@@ -1567,31 +1638,36 @@ discard block |
||
| 1567 | 1638 | $currentKey = 0; |
| 1568 | 1639 | |
| 1569 | 1640 | // Create a key => value array for multiple options fields |
| 1570 | - if (!empty($custom['options'])) |
|
| 1571 | - foreach ($custom['options'] as $k => $v) |
|
| 1641 | + if (!empty($custom['options'])) { |
|
| 1642 | + foreach ($custom['options'] as $k => $v) |
|
| 1572 | 1643 | { |
| 1573 | 1644 | $fieldOptions[] = $v; |
| 1574 | - if (empty($currentKey)) |
|
| 1575 | - $currentKey = $v == $value ? $k : 0; |
|
| 1645 | + } |
|
| 1646 | + if (empty($currentKey)) { |
|
| 1647 | + $currentKey = $v == $value ? $k : 0; |
|
| 1648 | + } |
|
| 1576 | 1649 | } |
| 1577 | 1650 | |
| 1578 | 1651 | // BBC? |
| 1579 | - if ($custom['bbc']) |
|
| 1580 | - $value = parse_bbc($value); |
|
| 1652 | + if ($custom['bbc']) { |
|
| 1653 | + $value = parse_bbc($value); |
|
| 1654 | + } |
|
| 1581 | 1655 | |
| 1582 | 1656 | // ... or checkbox? |
| 1583 | - elseif (isset($custom['type']) && $custom['type'] == 'check') |
|
| 1584 | - $value = $value ? $txt['yes'] : $txt['no']; |
|
| 1657 | + elseif (isset($custom['type']) && $custom['type'] == 'check') { |
|
| 1658 | + $value = $value ? $txt['yes'] : $txt['no']; |
|
| 1659 | + } |
|
| 1585 | 1660 | |
| 1586 | 1661 | // Enclosing the user input within some other text? |
| 1587 | - if (!empty($custom['enclose'])) |
|
| 1588 | - $value = strtr($custom['enclose'], array( |
|
| 1662 | + if (!empty($custom['enclose'])) { |
|
| 1663 | + $value = strtr($custom['enclose'], array( |
|
| 1589 | 1664 | '{SCRIPTURL}' => $scripturl, |
| 1590 | 1665 | '{IMAGES_URL}' => $settings['images_url'], |
| 1591 | 1666 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
| 1592 | 1667 | '{INPUT}' => $value, |
| 1593 | 1668 | '{KEY}' => $currentKey, |
| 1594 | 1669 | )); |
| 1670 | + } |
|
| 1595 | 1671 | |
| 1596 | 1672 | $memberContext[$user]['custom_fields'][] = array( |
| 1597 | 1673 | 'title' => !empty($custom['title']) ? $custom['title'] : $custom['col_name'], |
@@ -1618,8 +1694,9 @@ discard block |
||
| 1618 | 1694 | global $smcFunc, $txt, $scripturl, $settings; |
| 1619 | 1695 | |
| 1620 | 1696 | // Do not waste my time... |
| 1621 | - if (empty($users) || empty($params)) |
|
| 1622 | - return false; |
|
| 1697 | + if (empty($users) || empty($params)) { |
|
| 1698 | + return false; |
|
| 1699 | + } |
|
| 1623 | 1700 | |
| 1624 | 1701 | // Make sure it's an array. |
| 1625 | 1702 | $users = !is_array($users) ? array($users) : array_unique($users); |
@@ -1646,41 +1723,48 @@ discard block |
||
| 1646 | 1723 | $currentKey = 0; |
| 1647 | 1724 | |
| 1648 | 1725 | // Create a key => value array for multiple options fields |
| 1649 | - if (!empty($row['field_options'])) |
|
| 1650 | - foreach (explode(',', $row['field_options']) as $k => $v) |
|
| 1726 | + if (!empty($row['field_options'])) { |
|
| 1727 | + foreach (explode(',', $row['field_options']) as $k => $v) |
|
| 1651 | 1728 | { |
| 1652 | 1729 | $fieldOptions[] = $v; |
| 1653 | - if (empty($currentKey)) |
|
| 1654 | - $currentKey = $v == $row['value'] ? $k : 0; |
|
| 1730 | + } |
|
| 1731 | + if (empty($currentKey)) { |
|
| 1732 | + $currentKey = $v == $row['value'] ? $k : 0; |
|
| 1733 | + } |
|
| 1655 | 1734 | } |
| 1656 | 1735 | |
| 1657 | 1736 | // BBC? |
| 1658 | - if (!empty($row['bbc'])) |
|
| 1659 | - $row['value'] = parse_bbc($row['value']); |
|
| 1737 | + if (!empty($row['bbc'])) { |
|
| 1738 | + $row['value'] = parse_bbc($row['value']); |
|
| 1739 | + } |
|
| 1660 | 1740 | |
| 1661 | 1741 | // ... or checkbox? |
| 1662 | - elseif (isset($row['type']) && $row['type'] == 'check') |
|
| 1663 | - $row['value'] = !empty($row['value']) ? $txt['yes'] : $txt['no']; |
|
| 1742 | + elseif (isset($row['type']) && $row['type'] == 'check') { |
|
| 1743 | + $row['value'] = !empty($row['value']) ? $txt['yes'] : $txt['no']; |
|
| 1744 | + } |
|
| 1664 | 1745 | |
| 1665 | 1746 | // Enclosing the user input within some other text? |
| 1666 | - if (!empty($row['enclose'])) |
|
| 1667 | - $row['value'] = strtr($row['enclose'], array( |
|
| 1747 | + if (!empty($row['enclose'])) { |
|
| 1748 | + $row['value'] = strtr($row['enclose'], array( |
|
| 1668 | 1749 | '{SCRIPTURL}' => $scripturl, |
| 1669 | 1750 | '{IMAGES_URL}' => $settings['images_url'], |
| 1670 | 1751 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
| 1671 | 1752 | '{INPUT}' => un_htmlspecialchars($row['value']), |
| 1672 | 1753 | '{KEY}' => $currentKey, |
| 1673 | 1754 | )); |
| 1755 | + } |
|
| 1674 | 1756 | |
| 1675 | 1757 | // Send a simple array if there is just 1 param |
| 1676 | - if (count($params) == 1) |
|
| 1677 | - $return[$row['id_member']] = $row; |
|
| 1758 | + if (count($params) == 1) { |
|
| 1759 | + $return[$row['id_member']] = $row; |
|
| 1760 | + } |
|
| 1678 | 1761 | |
| 1679 | 1762 | // More than 1? knock yourself out... |
| 1680 | 1763 | else |
| 1681 | 1764 | { |
| 1682 | - if (!isset($return[$row['id_member']])) |
|
| 1683 | - $return[$row['id_member']] = array(); |
|
| 1765 | + if (!isset($return[$row['id_member']])) { |
|
| 1766 | + $return[$row['id_member']] = array(); |
|
| 1767 | + } |
|
| 1684 | 1768 | |
| 1685 | 1769 | $return[$row['id_member']][$row['variable']] = $row; |
| 1686 | 1770 | } |
@@ -1714,8 +1798,9 @@ discard block |
||
| 1714 | 1798 | global $context; |
| 1715 | 1799 | |
| 1716 | 1800 | // Don't know any browser! |
| 1717 | - if (empty($context['browser'])) |
|
| 1718 | - detectBrowser(); |
|
| 1801 | + if (empty($context['browser'])) { |
|
| 1802 | + detectBrowser(); |
|
| 1803 | + } |
|
| 1719 | 1804 | |
| 1720 | 1805 | return !empty($context['browser'][$browser]) || !empty($context['browser']['is_' . $browser]) ? true : false; |
| 1721 | 1806 | } |
@@ -1733,8 +1818,9 @@ discard block |
||
| 1733 | 1818 | global $context, $settings, $options, $sourcedir, $ssi_theme, $smcFunc, $language, $board, $image_proxy_enabled; |
| 1734 | 1819 | |
| 1735 | 1820 | // The theme was specified by parameter. |
| 1736 | - if (!empty($id_theme)) |
|
| 1737 | - $id_theme = (int) $id_theme; |
|
| 1821 | + if (!empty($id_theme)) { |
|
| 1822 | + $id_theme = (int) $id_theme; |
|
| 1823 | + } |
|
| 1738 | 1824 | // The theme was specified by REQUEST. |
| 1739 | 1825 | elseif (!empty($_REQUEST['theme']) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum'))) |
| 1740 | 1826 | { |
@@ -1742,32 +1828,38 @@ discard block |
||
| 1742 | 1828 | $_SESSION['id_theme'] = $id_theme; |
| 1743 | 1829 | } |
| 1744 | 1830 | // The theme was specified by REQUEST... previously. |
| 1745 | - elseif (!empty($_SESSION['id_theme']) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum'))) |
|
| 1746 | - $id_theme = (int) $_SESSION['id_theme']; |
|
| 1831 | + elseif (!empty($_SESSION['id_theme']) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum'))) { |
|
| 1832 | + $id_theme = (int) $_SESSION['id_theme']; |
|
| 1833 | + } |
|
| 1747 | 1834 | // The theme is just the user's choice. (might use ?board=1;theme=0 to force board theme.) |
| 1748 | - elseif (!empty($user_info['theme']) && !isset($_REQUEST['theme'])) |
|
| 1749 | - $id_theme = $user_info['theme']; |
|
| 1835 | + elseif (!empty($user_info['theme']) && !isset($_REQUEST['theme'])) { |
|
| 1836 | + $id_theme = $user_info['theme']; |
|
| 1837 | + } |
|
| 1750 | 1838 | // The theme was specified by the board. |
| 1751 | - elseif (!empty($board_info['theme'])) |
|
| 1752 | - $id_theme = $board_info['theme']; |
|
| 1839 | + elseif (!empty($board_info['theme'])) { |
|
| 1840 | + $id_theme = $board_info['theme']; |
|
| 1841 | + } |
|
| 1753 | 1842 | // The theme is the forum's default. |
| 1754 | - else |
|
| 1755 | - $id_theme = $modSettings['theme_guests']; |
|
| 1843 | + else { |
|
| 1844 | + $id_theme = $modSettings['theme_guests']; |
|
| 1845 | + } |
|
| 1756 | 1846 | |
| 1757 | 1847 | // Verify the id_theme... no foul play. |
| 1758 | 1848 | // Always allow the board specific theme, if they are overriding. |
| 1759 | - if (!empty($board_info['theme']) && $board_info['override_theme']) |
|
| 1760 | - $id_theme = $board_info['theme']; |
|
| 1849 | + if (!empty($board_info['theme']) && $board_info['override_theme']) { |
|
| 1850 | + $id_theme = $board_info['theme']; |
|
| 1851 | + } |
|
| 1761 | 1852 | // If they have specified a particular theme to use with SSI allow it to be used. |
| 1762 | - elseif (!empty($ssi_theme) && $id_theme == $ssi_theme) |
|
| 1763 | - $id_theme = (int) $id_theme; |
|
| 1764 | - elseif (!empty($modSettings['enableThemes']) && !allowedTo('admin_forum')) |
|
| 1853 | + elseif (!empty($ssi_theme) && $id_theme == $ssi_theme) { |
|
| 1854 | + $id_theme = (int) $id_theme; |
|
| 1855 | + } elseif (!empty($modSettings['enableThemes']) && !allowedTo('admin_forum')) |
|
| 1765 | 1856 | { |
| 1766 | 1857 | $themes = explode(',', $modSettings['enableThemes']); |
| 1767 | - if (!in_array($id_theme, $themes)) |
|
| 1768 | - $id_theme = $modSettings['theme_guests']; |
|
| 1769 | - else |
|
| 1770 | - $id_theme = (int) $id_theme; |
|
| 1858 | + if (!in_array($id_theme, $themes)) { |
|
| 1859 | + $id_theme = $modSettings['theme_guests']; |
|
| 1860 | + } else { |
|
| 1861 | + $id_theme = (int) $id_theme; |
|
| 1862 | + } |
|
| 1771 | 1863 | } |
| 1772 | 1864 | |
| 1773 | 1865 | // Allow mod authors the option to override the theme id for custom page themes |
@@ -1779,18 +1871,19 @@ discard block |
||
| 1779 | 1871 | $member = empty($user_info['id']) ? -1 : $user_info['id']; |
| 1780 | 1872 | |
| 1781 | 1873 | // Disable image proxy if we don't have SSL enabled |
| 1782 | - if (empty($modSettings['force_ssl'])) |
|
| 1783 | - $image_proxy_enabled = false; |
|
| 1874 | + if (empty($modSettings['force_ssl'])) { |
|
| 1875 | + $image_proxy_enabled = false; |
|
| 1876 | + } |
|
| 1784 | 1877 | |
| 1785 | 1878 | if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2 && ($temp = cache_get_data('theme_settings-' . $id_theme . ':' . $member, 60)) != null && time() - 60 > $modSettings['settings_updated']) |
| 1786 | 1879 | { |
| 1787 | 1880 | $themeData = $temp; |
| 1788 | 1881 | $flag = true; |
| 1882 | + } elseif (($temp = cache_get_data('theme_settings-' . $id_theme, 90)) != null && time() - 60 > $modSettings['settings_updated']) { |
|
| 1883 | + $themeData = $temp + array($member => array()); |
|
| 1884 | + } else { |
|
| 1885 | + $themeData = array(-1 => array(), 0 => array(), $member => array()); |
|
| 1789 | 1886 | } |
| 1790 | - elseif (($temp = cache_get_data('theme_settings-' . $id_theme, 90)) != null && time() - 60 > $modSettings['settings_updated']) |
|
| 1791 | - $themeData = $temp + array($member => array()); |
|
| 1792 | - else |
|
| 1793 | - $themeData = array(-1 => array(), 0 => array(), $member => array()); |
|
| 1794 | 1887 | |
| 1795 | 1888 | if (empty($flag)) |
| 1796 | 1889 | { |
@@ -1810,31 +1903,37 @@ discard block |
||
| 1810 | 1903 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
| 1811 | 1904 | { |
| 1812 | 1905 | // There are just things we shouldn't be able to change as members. |
| 1813 | - if ($row['id_member'] != 0 && in_array($row['variable'], array('actual_theme_url', 'actual_images_url', 'base_theme_dir', 'base_theme_url', 'default_images_url', 'default_theme_dir', 'default_theme_url', 'default_template', 'images_url', 'number_recent_posts', 'smiley_sets_default', 'theme_dir', 'theme_id', 'theme_layers', 'theme_templates', 'theme_url'))) |
|
| 1814 | - continue; |
|
| 1906 | + if ($row['id_member'] != 0 && in_array($row['variable'], array('actual_theme_url', 'actual_images_url', 'base_theme_dir', 'base_theme_url', 'default_images_url', 'default_theme_dir', 'default_theme_url', 'default_template', 'images_url', 'number_recent_posts', 'smiley_sets_default', 'theme_dir', 'theme_id', 'theme_layers', 'theme_templates', 'theme_url'))) { |
|
| 1907 | + continue; |
|
| 1908 | + } |
|
| 1815 | 1909 | |
| 1816 | 1910 | // If this is the theme_dir of the default theme, store it. |
| 1817 | - if (in_array($row['variable'], array('theme_dir', 'theme_url', 'images_url')) && $row['id_theme'] == '1' && empty($row['id_member'])) |
|
| 1818 | - $themeData[0]['default_' . $row['variable']] = $row['value']; |
|
| 1911 | + if (in_array($row['variable'], array('theme_dir', 'theme_url', 'images_url')) && $row['id_theme'] == '1' && empty($row['id_member'])) { |
|
| 1912 | + $themeData[0]['default_' . $row['variable']] = $row['value']; |
|
| 1913 | + } |
|
| 1819 | 1914 | |
| 1820 | 1915 | // If this isn't set yet, is a theme option, or is not the default theme.. |
| 1821 | - if (!isset($themeData[$row['id_member']][$row['variable']]) || $row['id_theme'] != '1') |
|
| 1822 | - $themeData[$row['id_member']][$row['variable']] = substr($row['variable'], 0, 5) == 'show_' ? $row['value'] == '1' : $row['value']; |
|
| 1916 | + if (!isset($themeData[$row['id_member']][$row['variable']]) || $row['id_theme'] != '1') { |
|
| 1917 | + $themeData[$row['id_member']][$row['variable']] = substr($row['variable'], 0, 5) == 'show_' ? $row['value'] == '1' : $row['value']; |
|
| 1918 | + } |
|
| 1823 | 1919 | } |
| 1824 | 1920 | $smcFunc['db_free_result']($result); |
| 1825 | 1921 | |
| 1826 | - if (!empty($themeData[-1])) |
|
| 1827 | - foreach ($themeData[-1] as $k => $v) |
|
| 1922 | + if (!empty($themeData[-1])) { |
|
| 1923 | + foreach ($themeData[-1] as $k => $v) |
|
| 1828 | 1924 | { |
| 1829 | 1925 | if (!isset($themeData[$member][$k])) |
| 1830 | 1926 | $themeData[$member][$k] = $v; |
| 1927 | + } |
|
| 1831 | 1928 | } |
| 1832 | 1929 | |
| 1833 | - if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) |
|
| 1834 | - cache_put_data('theme_settings-' . $id_theme . ':' . $member, $themeData, 60); |
|
| 1930 | + if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) { |
|
| 1931 | + cache_put_data('theme_settings-' . $id_theme . ':' . $member, $themeData, 60); |
|
| 1932 | + } |
|
| 1835 | 1933 | // Only if we didn't already load that part of the cache... |
| 1836 | - elseif (!isset($temp)) |
|
| 1837 | - cache_put_data('theme_settings-' . $id_theme, array(-1 => $themeData[-1], 0 => $themeData[0]), 90); |
|
| 1934 | + elseif (!isset($temp)) { |
|
| 1935 | + cache_put_data('theme_settings-' . $id_theme, array(-1 => $themeData[-1], 0 => $themeData[0]), 90); |
|
| 1936 | + } |
|
| 1838 | 1937 | } |
| 1839 | 1938 | |
| 1840 | 1939 | $settings = $themeData[0]; |
@@ -1851,17 +1950,20 @@ discard block |
||
| 1851 | 1950 | $settings['template_dirs'][] = $settings['theme_dir']; |
| 1852 | 1951 | |
| 1853 | 1952 | // Based on theme (if there is one). |
| 1854 | - if (!empty($settings['base_theme_dir'])) |
|
| 1855 | - $settings['template_dirs'][] = $settings['base_theme_dir']; |
|
| 1953 | + if (!empty($settings['base_theme_dir'])) { |
|
| 1954 | + $settings['template_dirs'][] = $settings['base_theme_dir']; |
|
| 1955 | + } |
|
| 1856 | 1956 | |
| 1857 | 1957 | // Lastly the default theme. |
| 1858 | - if ($settings['theme_dir'] != $settings['default_theme_dir']) |
|
| 1859 | - $settings['template_dirs'][] = $settings['default_theme_dir']; |
|
| 1958 | + if ($settings['theme_dir'] != $settings['default_theme_dir']) { |
|
| 1959 | + $settings['template_dirs'][] = $settings['default_theme_dir']; |
|
| 1960 | + } |
|
| 1860 | 1961 | } |
| 1861 | 1962 | |
| 1862 | 1963 | |
| 1863 | - if (!$initialize) |
|
| 1864 | - return; |
|
| 1964 | + if (!$initialize) { |
|
| 1965 | + return; |
|
| 1966 | + } |
|
| 1865 | 1967 | |
| 1866 | 1968 | // Check to see if we're forcing SSL |
| 1867 | 1969 | if (!empty($modSettings['force_ssl']) && empty($maintenance) && |
@@ -1882,8 +1984,9 @@ discard block |
||
| 1882 | 1984 | $detected_url = httpsOn() ? 'https://' : 'http://'; |
| 1883 | 1985 | $detected_url .= empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] . (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']) : $_SERVER['HTTP_HOST']; |
| 1884 | 1986 | $temp = preg_replace('~/' . basename($scripturl) . '(/.+)?$~', '', strtr(dirname($_SERVER['PHP_SELF']), '\\', '/')); |
| 1885 | - if ($temp != '/') |
|
| 1886 | - $detected_url .= $temp; |
|
| 1987 | + if ($temp != '/') { |
|
| 1988 | + $detected_url .= $temp; |
|
| 1989 | + } |
|
| 1887 | 1990 | } |
| 1888 | 1991 | if (isset($detected_url) && $detected_url != $boardurl) |
| 1889 | 1992 | { |
@@ -1895,8 +1998,9 @@ discard block |
||
| 1895 | 1998 | foreach ($aliases as $alias) |
| 1896 | 1999 | { |
| 1897 | 2000 | // Rip off all the boring parts, spaces, etc. |
| 1898 | - if ($detected_url == trim($alias) || strtr($detected_url, array('http://' => '', 'https://' => '')) == trim($alias)) |
|
| 1899 | - $do_fix = true; |
|
| 2001 | + if ($detected_url == trim($alias) || strtr($detected_url, array('http://' => '', 'https://' => '')) == trim($alias)) { |
|
| 2002 | + $do_fix = true; |
|
| 2003 | + } |
|
| 1900 | 2004 | } |
| 1901 | 2005 | } |
| 1902 | 2006 | |
@@ -1904,21 +2008,23 @@ discard block |
||
| 1904 | 2008 | if (empty($do_fix) && strtr($detected_url, array('://' => '://www.')) == $boardurl && (empty($_GET) || count($_GET) == 1) && SMF != 'SSI') |
| 1905 | 2009 | { |
| 1906 | 2010 | // Okay, this seems weird, but we don't want an endless loop - this will make $_GET not empty ;). |
| 1907 | - if (empty($_GET)) |
|
| 1908 | - redirectexit('wwwRedirect'); |
|
| 1909 | - else |
|
| 2011 | + if (empty($_GET)) { |
|
| 2012 | + redirectexit('wwwRedirect'); |
|
| 2013 | + } else |
|
| 1910 | 2014 | { |
| 1911 | 2015 | $k = key($_GET); |
| 1912 | 2016 | $v = current($_GET); |
| 1913 | 2017 | |
| 1914 | - if ($k != 'wwwRedirect') |
|
| 1915 | - redirectexit('wwwRedirect;' . $k . '=' . $v); |
|
| 2018 | + if ($k != 'wwwRedirect') { |
|
| 2019 | + redirectexit('wwwRedirect;' . $k . '=' . $v); |
|
| 2020 | + } |
|
| 1916 | 2021 | } |
| 1917 | 2022 | } |
| 1918 | 2023 | |
| 1919 | 2024 | // #3 is just a check for SSL... |
| 1920 | - if (strtr($detected_url, array('https://' => 'http://')) == $boardurl) |
|
| 1921 | - $do_fix = true; |
|
| 2025 | + if (strtr($detected_url, array('https://' => 'http://')) == $boardurl) { |
|
| 2026 | + $do_fix = true; |
|
| 2027 | + } |
|
| 1922 | 2028 | |
| 1923 | 2029 | // Okay, #4 - perhaps it's an IP address? We're gonna want to use that one, then. (assuming it's the IP or something...) |
| 1924 | 2030 | if (!empty($do_fix) || preg_match('~^http[s]?://(?:[\d\.:]+|\[[\d:]+\](?::\d+)?)(?:$|/)~', $detected_url) == 1) |
@@ -1953,8 +2059,9 @@ discard block |
||
| 1953 | 2059 | $board_info['moderators'][$k]['link'] = strtr($dummy['link'], array('"' . $oldurl => '"' . $boardurl)); |
| 1954 | 2060 | } |
| 1955 | 2061 | } |
| 1956 | - foreach ($context['linktree'] as $k => $dummy) |
|
| 1957 | - $context['linktree'][$k]['url'] = strtr($dummy['url'], array($oldurl => $boardurl)); |
|
| 2062 | + foreach ($context['linktree'] as $k => $dummy) { |
|
| 2063 | + $context['linktree'][$k]['url'] = strtr($dummy['url'], array($oldurl => $boardurl)); |
|
| 2064 | + } |
|
| 1958 | 2065 | } |
| 1959 | 2066 | } |
| 1960 | 2067 | // Set up the contextual user array. |
@@ -1973,10 +2080,11 @@ discard block |
||
| 1973 | 2080 | 'email' => $user_info['email'], |
| 1974 | 2081 | 'ignoreusers' => $user_info['ignoreusers'], |
| 1975 | 2082 | ); |
| 1976 | - if (!$context['user']['is_guest']) |
|
| 1977 | - $context['user']['name'] = $user_info['name']; |
|
| 1978 | - elseif ($context['user']['is_guest'] && !empty($txt['guest_title'])) |
|
| 1979 | - $context['user']['name'] = $txt['guest_title']; |
|
| 2083 | + if (!$context['user']['is_guest']) { |
|
| 2084 | + $context['user']['name'] = $user_info['name']; |
|
| 2085 | + } elseif ($context['user']['is_guest'] && !empty($txt['guest_title'])) { |
|
| 2086 | + $context['user']['name'] = $txt['guest_title']; |
|
| 2087 | + } |
|
| 1980 | 2088 | |
| 1981 | 2089 | // Determine the current smiley set. |
| 1982 | 2090 | $smiley_sets_known = explode(',', $modSettings['smiley_sets_known']); |
@@ -1990,8 +2098,7 @@ discard block |
||
| 1990 | 2098 | |
| 1991 | 2099 | // Determine global default smiley set extension |
| 1992 | 2100 | $context['user']['smiley_set_default_ext'] = $smiley_sets_exts[array_search($modSettings['smiley_sets_default'], $smiley_sets_known)]; |
| 1993 | - } |
|
| 1994 | - else |
|
| 2101 | + } else |
|
| 1995 | 2102 | { |
| 1996 | 2103 | // What to do when there is no $user_info (e.g., an error very early in the login process) |
| 1997 | 2104 | $context['user'] = array( |
@@ -2025,18 +2132,24 @@ discard block |
||
| 2025 | 2132 | } |
| 2026 | 2133 | |
| 2027 | 2134 | // Some basic information... |
| 2028 | - if (!isset($context['html_headers'])) |
|
| 2029 | - $context['html_headers'] = ''; |
|
| 2030 | - if (!isset($context['javascript_files'])) |
|
| 2031 | - $context['javascript_files'] = array(); |
|
| 2032 | - if (!isset($context['css_files'])) |
|
| 2033 | - $context['css_files'] = array(); |
|
| 2034 | - if (!isset($context['css_header'])) |
|
| 2035 | - $context['css_header'] = array(); |
|
| 2036 | - if (!isset($context['javascript_inline'])) |
|
| 2037 | - $context['javascript_inline'] = array('standard' => array(), 'defer' => array()); |
|
| 2038 | - if (!isset($context['javascript_vars'])) |
|
| 2039 | - $context['javascript_vars'] = array(); |
|
| 2135 | + if (!isset($context['html_headers'])) { |
|
| 2136 | + $context['html_headers'] = ''; |
|
| 2137 | + } |
|
| 2138 | + if (!isset($context['javascript_files'])) { |
|
| 2139 | + $context['javascript_files'] = array(); |
|
| 2140 | + } |
|
| 2141 | + if (!isset($context['css_files'])) { |
|
| 2142 | + $context['css_files'] = array(); |
|
| 2143 | + } |
|
| 2144 | + if (!isset($context['css_header'])) { |
|
| 2145 | + $context['css_header'] = array(); |
|
| 2146 | + } |
|
| 2147 | + if (!isset($context['javascript_inline'])) { |
|
| 2148 | + $context['javascript_inline'] = array('standard' => array(), 'defer' => array()); |
|
| 2149 | + } |
|
| 2150 | + if (!isset($context['javascript_vars'])) { |
|
| 2151 | + $context['javascript_vars'] = array(); |
|
| 2152 | + } |
|
| 2040 | 2153 | |
| 2041 | 2154 | $context['login_url'] = $scripturl . '?action=login2'; |
| 2042 | 2155 | $context['menu_separator'] = !empty($settings['use_image_buttons']) ? ' ' : ' | '; |
@@ -2048,16 +2161,18 @@ discard block |
||
| 2048 | 2161 | $context['current_action'] = isset($_REQUEST['action']) ? $smcFunc['htmlspecialchars']($_REQUEST['action']) : null; |
| 2049 | 2162 | $context['current_subaction'] = isset($_REQUEST['sa']) ? $_REQUEST['sa'] : null; |
| 2050 | 2163 | $context['can_register'] = empty($modSettings['registration_method']) || $modSettings['registration_method'] != 3; |
| 2051 | - if (isset($modSettings['load_average'])) |
|
| 2052 | - $context['load_average'] = $modSettings['load_average']; |
|
| 2164 | + if (isset($modSettings['load_average'])) { |
|
| 2165 | + $context['load_average'] = $modSettings['load_average']; |
|
| 2166 | + } |
|
| 2053 | 2167 | |
| 2054 | 2168 | // Detect the browser. This is separated out because it's also used in attachment downloads |
| 2055 | 2169 | detectBrowser(); |
| 2056 | 2170 | |
| 2057 | 2171 | // Set the top level linktree up. |
| 2058 | 2172 | // Note that if we're dealing with certain very early errors (e.g., login) the linktree might not be set yet... |
| 2059 | - if (empty($context['linktree'])) |
|
| 2060 | - $context['linktree'] = array(); |
|
| 2173 | + if (empty($context['linktree'])) { |
|
| 2174 | + $context['linktree'] = array(); |
|
| 2175 | + } |
|
| 2061 | 2176 | array_unshift($context['linktree'], array( |
| 2062 | 2177 | 'url' => $scripturl, |
| 2063 | 2178 | 'name' => $context['forum_name_html_safe'] |
@@ -2066,8 +2181,9 @@ discard block |
||
| 2066 | 2181 | // This allows sticking some HTML on the page output - useful for controls. |
| 2067 | 2182 | $context['insert_after_template'] = ''; |
| 2068 | 2183 | |
| 2069 | - if (!isset($txt)) |
|
| 2070 | - $txt = array(); |
|
| 2184 | + if (!isset($txt)) { |
|
| 2185 | + $txt = array(); |
|
| 2186 | + } |
|
| 2071 | 2187 | |
| 2072 | 2188 | $simpleActions = array( |
| 2073 | 2189 | 'findmember', |
@@ -2113,9 +2229,10 @@ discard block |
||
| 2113 | 2229 | |
| 2114 | 2230 | // See if theres any extra param to check. |
| 2115 | 2231 | $requiresXML = false; |
| 2116 | - foreach ($extraParams as $key => $extra) |
|
| 2117 | - if (isset($_REQUEST[$extra])) |
|
| 2232 | + foreach ($extraParams as $key => $extra) { |
|
| 2233 | + if (isset($_REQUEST[$extra])) |
|
| 2118 | 2234 | $requiresXML = true; |
| 2235 | + } |
|
| 2119 | 2236 | |
| 2120 | 2237 | // Output is fully XML, so no need for the index template. |
| 2121 | 2238 | if (isset($_REQUEST['xml']) && (in_array($context['current_action'], $xmlActions) || $requiresXML)) |
@@ -2130,37 +2247,39 @@ discard block |
||
| 2130 | 2247 | { |
| 2131 | 2248 | loadLanguage('index+Modifications'); |
| 2132 | 2249 | $context['template_layers'] = array(); |
| 2133 | - } |
|
| 2134 | - |
|
| 2135 | - else |
|
| 2250 | + } else |
|
| 2136 | 2251 | { |
| 2137 | 2252 | // Custom templates to load, or just default? |
| 2138 | - if (isset($settings['theme_templates'])) |
|
| 2139 | - $templates = explode(',', $settings['theme_templates']); |
|
| 2140 | - else |
|
| 2141 | - $templates = array('index'); |
|
| 2253 | + if (isset($settings['theme_templates'])) { |
|
| 2254 | + $templates = explode(',', $settings['theme_templates']); |
|
| 2255 | + } else { |
|
| 2256 | + $templates = array('index'); |
|
| 2257 | + } |
|
| 2142 | 2258 | |
| 2143 | 2259 | // Load each template... |
| 2144 | - foreach ($templates as $template) |
|
| 2145 | - loadTemplate($template); |
|
| 2260 | + foreach ($templates as $template) { |
|
| 2261 | + loadTemplate($template); |
|
| 2262 | + } |
|
| 2146 | 2263 | |
| 2147 | 2264 | // ...and attempt to load their associated language files. |
| 2148 | 2265 | $required_files = implode('+', array_merge($templates, array('Modifications'))); |
| 2149 | 2266 | loadLanguage($required_files, '', false); |
| 2150 | 2267 | |
| 2151 | 2268 | // Custom template layers? |
| 2152 | - if (isset($settings['theme_layers'])) |
|
| 2153 | - $context['template_layers'] = explode(',', $settings['theme_layers']); |
|
| 2154 | - else |
|
| 2155 | - $context['template_layers'] = array('html', 'body'); |
|
| 2269 | + if (isset($settings['theme_layers'])) { |
|
| 2270 | + $context['template_layers'] = explode(',', $settings['theme_layers']); |
|
| 2271 | + } else { |
|
| 2272 | + $context['template_layers'] = array('html', 'body'); |
|
| 2273 | + } |
|
| 2156 | 2274 | } |
| 2157 | 2275 | |
| 2158 | 2276 | // Initialize the theme. |
| 2159 | 2277 | loadSubTemplate('init', 'ignore'); |
| 2160 | 2278 | |
| 2161 | 2279 | // Allow overriding the board wide time/number formats. |
| 2162 | - if (empty($user_settings['time_format']) && !empty($txt['time_format'])) |
|
| 2163 | - $user_info['time_format'] = $txt['time_format']; |
|
| 2280 | + if (empty($user_settings['time_format']) && !empty($txt['time_format'])) { |
|
| 2281 | + $user_info['time_format'] = $txt['time_format']; |
|
| 2282 | + } |
|
| 2164 | 2283 | |
| 2165 | 2284 | // Set the character set from the template. |
| 2166 | 2285 | $context['character_set'] = empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']; |
@@ -2168,12 +2287,14 @@ discard block |
||
| 2168 | 2287 | $context['right_to_left'] = !empty($txt['lang_rtl']); |
| 2169 | 2288 | |
| 2170 | 2289 | // Guests may still need a name. |
| 2171 | - if ($context['user']['is_guest'] && empty($context['user']['name'])) |
|
| 2172 | - $context['user']['name'] = $txt['guest_title']; |
|
| 2290 | + if ($context['user']['is_guest'] && empty($context['user']['name'])) { |
|
| 2291 | + $context['user']['name'] = $txt['guest_title']; |
|
| 2292 | + } |
|
| 2173 | 2293 | |
| 2174 | 2294 | // Any theme-related strings that need to be loaded? |
| 2175 | - if (!empty($settings['require_theme_strings'])) |
|
| 2176 | - loadLanguage('ThemeStrings', '', false); |
|
| 2295 | + if (!empty($settings['require_theme_strings'])) { |
|
| 2296 | + loadLanguage('ThemeStrings', '', false); |
|
| 2297 | + } |
|
| 2177 | 2298 | |
| 2178 | 2299 | // Make a special URL for the language. |
| 2179 | 2300 | $settings['lang_images_url'] = $settings['images_url'] . '/' . (!empty($txt['image_lang']) ? $txt['image_lang'] : $user_info['language']); |
@@ -2184,8 +2305,9 @@ discard block |
||
| 2184 | 2305 | // Here is my luvly Responsive CSS |
| 2185 | 2306 | loadCSSFile('responsive.css', array('force_current' => false, 'validate' => true, 'minimize' => true, 'order_pos' => 9000), 'smf_responsive'); |
| 2186 | 2307 | |
| 2187 | - if ($context['right_to_left']) |
|
| 2188 | - loadCSSFile('rtl.css', array('order_pos' => 200), 'smf_rtl'); |
|
| 2308 | + if ($context['right_to_left']) { |
|
| 2309 | + loadCSSFile('rtl.css', array('order_pos' => 200), 'smf_rtl'); |
|
| 2310 | + } |
|
| 2189 | 2311 | |
| 2190 | 2312 | // We allow theme variants, because we're cool. |
| 2191 | 2313 | $context['theme_variant'] = ''; |
@@ -2193,14 +2315,17 @@ discard block |
||
| 2193 | 2315 | if (!empty($settings['theme_variants'])) |
| 2194 | 2316 | { |
| 2195 | 2317 | // Overriding - for previews and that ilk. |
| 2196 | - if (!empty($_REQUEST['variant'])) |
|
| 2197 | - $_SESSION['id_variant'] = $_REQUEST['variant']; |
|
| 2318 | + if (!empty($_REQUEST['variant'])) { |
|
| 2319 | + $_SESSION['id_variant'] = $_REQUEST['variant']; |
|
| 2320 | + } |
|
| 2198 | 2321 | // User selection? |
| 2199 | - if (empty($settings['disable_user_variant']) || allowedTo('admin_forum')) |
|
| 2200 | - $context['theme_variant'] = !empty($_SESSION['id_variant']) ? $_SESSION['id_variant'] : (!empty($options['theme_variant']) ? $options['theme_variant'] : ''); |
|
| 2322 | + if (empty($settings['disable_user_variant']) || allowedTo('admin_forum')) { |
|
| 2323 | + $context['theme_variant'] = !empty($_SESSION['id_variant']) ? $_SESSION['id_variant'] : (!empty($options['theme_variant']) ? $options['theme_variant'] : ''); |
|
| 2324 | + } |
|
| 2201 | 2325 | // If not a user variant, select the default. |
| 2202 | - if ($context['theme_variant'] == '' || !in_array($context['theme_variant'], $settings['theme_variants'])) |
|
| 2203 | - $context['theme_variant'] = !empty($settings['default_variant']) && in_array($settings['default_variant'], $settings['theme_variants']) ? $settings['default_variant'] : $settings['theme_variants'][0]; |
|
| 2326 | + if ($context['theme_variant'] == '' || !in_array($context['theme_variant'], $settings['theme_variants'])) { |
|
| 2327 | + $context['theme_variant'] = !empty($settings['default_variant']) && in_array($settings['default_variant'], $settings['theme_variants']) ? $settings['default_variant'] : $settings['theme_variants'][0]; |
|
| 2328 | + } |
|
| 2204 | 2329 | |
| 2205 | 2330 | // Do this to keep things easier in the templates. |
| 2206 | 2331 | $context['theme_variant'] = '_' . $context['theme_variant']; |
@@ -2209,20 +2334,23 @@ discard block |
||
| 2209 | 2334 | if (!empty($context['theme_variant'])) |
| 2210 | 2335 | { |
| 2211 | 2336 | loadCSSFile('index' . $context['theme_variant'] . '.css', array('order_pos' => 300), 'smf_index' . $context['theme_variant']); |
| 2212 | - if ($context['right_to_left']) |
|
| 2213 | - loadCSSFile('rtl' . $context['theme_variant'] . '.css', array('order_pos' => 400), 'smf_rtl' . $context['theme_variant']); |
|
| 2337 | + if ($context['right_to_left']) { |
|
| 2338 | + loadCSSFile('rtl' . $context['theme_variant'] . '.css', array('order_pos' => 400), 'smf_rtl' . $context['theme_variant']); |
|
| 2339 | + } |
|
| 2214 | 2340 | } |
| 2215 | 2341 | } |
| 2216 | 2342 | |
| 2217 | 2343 | // Let's be compatible with old themes! |
| 2218 | - if (!function_exists('template_html_above') && in_array('html', $context['template_layers'])) |
|
| 2219 | - $context['template_layers'] = array('main'); |
|
| 2344 | + if (!function_exists('template_html_above') && in_array('html', $context['template_layers'])) { |
|
| 2345 | + $context['template_layers'] = array('main'); |
|
| 2346 | + } |
|
| 2220 | 2347 | |
| 2221 | 2348 | $context['tabindex'] = 1; |
| 2222 | 2349 | |
| 2223 | 2350 | // Compatibility. |
| 2224 | - if (!isset($settings['theme_version'])) |
|
| 2225 | - $modSettings['memberCount'] = $modSettings['totalMembers']; |
|
| 2351 | + if (!isset($settings['theme_version'])) { |
|
| 2352 | + $modSettings['memberCount'] = $modSettings['totalMembers']; |
|
| 2353 | + } |
|
| 2226 | 2354 | |
| 2227 | 2355 | // Default JS variables for use in every theme |
| 2228 | 2356 | $context['javascript_vars'] = array( |
@@ -2245,18 +2373,18 @@ discard block |
||
| 2245 | 2373 | ); |
| 2246 | 2374 | |
| 2247 | 2375 | // Add the JQuery library to the list of files to load. |
| 2248 | - if (isset($modSettings['jquery_source']) && $modSettings['jquery_source'] == 'cdn') |
|
| 2249 | - loadJavaScriptFile('https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', array('external' => true), 'smf_jquery'); |
|
| 2250 | - |
|
| 2251 | - elseif (isset($modSettings['jquery_source']) && $modSettings['jquery_source'] == 'local') |
|
| 2252 | - loadJavaScriptFile('jquery-3.2.1.min.js', array('seed' => false), 'smf_jquery'); |
|
| 2253 | - |
|
| 2254 | - elseif (isset($modSettings['jquery_source'], $modSettings['jquery_custom']) && $modSettings['jquery_source'] == 'custom') |
|
| 2255 | - loadJavaScriptFile($modSettings['jquery_custom'], array('external' => true), 'smf_jquery'); |
|
| 2376 | + if (isset($modSettings['jquery_source']) && $modSettings['jquery_source'] == 'cdn') { |
|
| 2377 | + loadJavaScriptFile('https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', array('external' => true), 'smf_jquery'); |
|
| 2378 | + } elseif (isset($modSettings['jquery_source']) && $modSettings['jquery_source'] == 'local') { |
|
| 2379 | + loadJavaScriptFile('jquery-3.2.1.min.js', array('seed' => false), 'smf_jquery'); |
|
| 2380 | + } elseif (isset($modSettings['jquery_source'], $modSettings['jquery_custom']) && $modSettings['jquery_source'] == 'custom') { |
|
| 2381 | + loadJavaScriptFile($modSettings['jquery_custom'], array('external' => true), 'smf_jquery'); |
|
| 2382 | + } |
|
| 2256 | 2383 | |
| 2257 | 2384 | // Auto loading? template_javascript() will take care of the local half of this. |
| 2258 | - else |
|
| 2259 | - loadJavaScriptFile('https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', array('external' => true), 'smf_jquery'); |
|
| 2385 | + else { |
|
| 2386 | + loadJavaScriptFile('https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', array('external' => true), 'smf_jquery'); |
|
| 2387 | + } |
|
| 2260 | 2388 | |
| 2261 | 2389 | // Queue our JQuery plugins! |
| 2262 | 2390 | loadJavaScriptFile('smf_jquery_plugins.js', array('minimize' => true), 'smf_jquery_plugins'); |
@@ -2279,12 +2407,12 @@ discard block |
||
| 2279 | 2407 | require_once($sourcedir . '/ScheduledTasks.php'); |
| 2280 | 2408 | |
| 2281 | 2409 | // What to do, what to do?! |
| 2282 | - if (empty($modSettings['next_task_time']) || $modSettings['next_task_time'] < time()) |
|
| 2283 | - AutoTask(); |
|
| 2284 | - else |
|
| 2285 | - ReduceMailQueue(); |
|
| 2286 | - } |
|
| 2287 | - else |
|
| 2410 | + if (empty($modSettings['next_task_time']) || $modSettings['next_task_time'] < time()) { |
|
| 2411 | + AutoTask(); |
|
| 2412 | + } else { |
|
| 2413 | + ReduceMailQueue(); |
|
| 2414 | + } |
|
| 2415 | + } else |
|
| 2288 | 2416 | { |
| 2289 | 2417 | $type = empty($modSettings['next_task_time']) || $modSettings['next_task_time'] < time() ? 'task' : 'mailq'; |
| 2290 | 2418 | $ts = $type == 'mailq' ? $modSettings['mail_next_send'] : $modSettings['next_task_time']; |
@@ -2335,8 +2463,9 @@ discard block |
||
| 2335 | 2463 | foreach ($theme_includes as $include) |
| 2336 | 2464 | { |
| 2337 | 2465 | $include = strtr(trim($include), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir'])); |
| 2338 | - if (file_exists($include)) |
|
| 2339 | - require_once($include); |
|
| 2466 | + if (file_exists($include)) { |
|
| 2467 | + require_once($include); |
|
| 2468 | + } |
|
| 2340 | 2469 | } |
| 2341 | 2470 | } |
| 2342 | 2471 | |
@@ -2366,16 +2495,19 @@ discard block |
||
| 2366 | 2495 | // Do any style sheets first, cause we're easy with those. |
| 2367 | 2496 | if (!empty($style_sheets)) |
| 2368 | 2497 | { |
| 2369 | - if (!is_array($style_sheets)) |
|
| 2370 | - $style_sheets = array($style_sheets); |
|
| 2498 | + if (!is_array($style_sheets)) { |
|
| 2499 | + $style_sheets = array($style_sheets); |
|
| 2500 | + } |
|
| 2371 | 2501 | |
| 2372 | - foreach ($style_sheets as $sheet) |
|
| 2373 | - loadCSSFile($sheet . '.css', array(), $sheet); |
|
| 2502 | + foreach ($style_sheets as $sheet) { |
|
| 2503 | + loadCSSFile($sheet . '.css', array(), $sheet); |
|
| 2504 | + } |
|
| 2374 | 2505 | } |
| 2375 | 2506 | |
| 2376 | 2507 | // No template to load? |
| 2377 | - if ($template_name === false) |
|
| 2378 | - return true; |
|
| 2508 | + if ($template_name === false) { |
|
| 2509 | + return true; |
|
| 2510 | + } |
|
| 2379 | 2511 | |
| 2380 | 2512 | $loaded = false; |
| 2381 | 2513 | foreach ($settings['template_dirs'] as $template_dir) |
@@ -2390,12 +2522,14 @@ discard block |
||
| 2390 | 2522 | |
| 2391 | 2523 | if ($loaded) |
| 2392 | 2524 | { |
| 2393 | - if ($db_show_debug === true) |
|
| 2394 | - $context['debug']['templates'][] = $template_name . ' (' . basename($template_dir) . ')'; |
|
| 2525 | + if ($db_show_debug === true) { |
|
| 2526 | + $context['debug']['templates'][] = $template_name . ' (' . basename($template_dir) . ')'; |
|
| 2527 | + } |
|
| 2395 | 2528 | |
| 2396 | 2529 | // If they have specified an initialization function for this template, go ahead and call it now. |
| 2397 | - if (function_exists('template_' . $template_name . '_init')) |
|
| 2398 | - call_user_func('template_' . $template_name . '_init'); |
|
| 2530 | + if (function_exists('template_' . $template_name . '_init')) { |
|
| 2531 | + call_user_func('template_' . $template_name . '_init'); |
|
| 2532 | + } |
|
| 2399 | 2533 | } |
| 2400 | 2534 | // Hmmm... doesn't exist?! I don't suppose the directory is wrong, is it? |
| 2401 | 2535 | elseif (!file_exists($settings['default_theme_dir']) && file_exists($boarddir . '/Themes/default')) |
@@ -2415,13 +2549,14 @@ discard block |
||
| 2415 | 2549 | loadTemplate($template_name); |
| 2416 | 2550 | } |
| 2417 | 2551 | // Cause an error otherwise. |
| 2418 | - elseif ($template_name != 'Errors' && $template_name != 'index' && $fatal) |
|
| 2419 | - fatal_lang_error('theme_template_error', 'template', array((string) $template_name)); |
|
| 2420 | - elseif ($fatal) |
|
| 2421 | - die(log_error(sprintf(isset($txt['theme_template_error']) ? $txt['theme_template_error'] : 'Unable to load Themes/default/%s.template.php!', (string) $template_name), 'template')); |
|
| 2422 | - else |
|
| 2423 | - return false; |
|
| 2424 | -} |
|
| 2552 | + elseif ($template_name != 'Errors' && $template_name != 'index' && $fatal) { |
|
| 2553 | + fatal_lang_error('theme_template_error', 'template', array((string) $template_name)); |
|
| 2554 | + } elseif ($fatal) { |
|
| 2555 | + die(log_error(sprintf(isset($txt['theme_template_error']) ? $txt['theme_template_error'] : 'Unable to load Themes/default/%s.template.php!', (string) $template_name), 'template')); |
|
| 2556 | + } else { |
|
| 2557 | + return false; |
|
| 2558 | + } |
|
| 2559 | + } |
|
| 2425 | 2560 | |
| 2426 | 2561 | /** |
| 2427 | 2562 | * Load a sub-template. |
@@ -2439,17 +2574,19 @@ discard block |
||
| 2439 | 2574 | { |
| 2440 | 2575 | global $context, $txt, $db_show_debug; |
| 2441 | 2576 | |
| 2442 | - if ($db_show_debug === true) |
|
| 2443 | - $context['debug']['sub_templates'][] = $sub_template_name; |
|
| 2577 | + if ($db_show_debug === true) { |
|
| 2578 | + $context['debug']['sub_templates'][] = $sub_template_name; |
|
| 2579 | + } |
|
| 2444 | 2580 | |
| 2445 | 2581 | // Figure out what the template function is named. |
| 2446 | 2582 | $theme_function = 'template_' . $sub_template_name; |
| 2447 | - if (function_exists($theme_function)) |
|
| 2448 | - $theme_function(); |
|
| 2449 | - elseif ($fatal === false) |
|
| 2450 | - fatal_lang_error('theme_template_error', 'template', array((string) $sub_template_name)); |
|
| 2451 | - elseif ($fatal !== 'ignore') |
|
| 2452 | - die(log_error(sprintf(isset($txt['theme_template_error']) ? $txt['theme_template_error'] : 'Unable to load the %s sub template!', (string) $sub_template_name), 'template')); |
|
| 2583 | + if (function_exists($theme_function)) { |
|
| 2584 | + $theme_function(); |
|
| 2585 | + } elseif ($fatal === false) { |
|
| 2586 | + fatal_lang_error('theme_template_error', 'template', array((string) $sub_template_name)); |
|
| 2587 | + } elseif ($fatal !== 'ignore') { |
|
| 2588 | + die(log_error(sprintf(isset($txt['theme_template_error']) ? $txt['theme_template_error'] : 'Unable to load the %s sub template!', (string) $sub_template_name), 'template')); |
|
| 2589 | + } |
|
| 2453 | 2590 | |
| 2454 | 2591 | // Are we showing debugging for templates? Just make sure not to do it before the doctype... |
| 2455 | 2592 | if (allowedTo('admin_forum') && isset($_REQUEST['debug']) && !in_array($sub_template_name, array('init', 'main_below')) && ob_get_length() > 0 && !isset($_REQUEST['xml'])) |
@@ -2479,8 +2616,9 @@ discard block |
||
| 2479 | 2616 | { |
| 2480 | 2617 | global $settings, $context, $modSettings; |
| 2481 | 2618 | |
| 2482 | - if (empty($context['css_files_order'])) |
|
| 2483 | - $context['css_files_order'] = array(); |
|
| 2619 | + if (empty($context['css_files_order'])) { |
|
| 2620 | + $context['css_files_order'] = array(); |
|
| 2621 | + } |
|
| 2484 | 2622 | |
| 2485 | 2623 | $params['seed'] = (!array_key_exists('seed', $params) || (array_key_exists('seed', $params) && $params['seed'] === true)) ? (array_key_exists('browser_cache', $modSettings) ? $modSettings['browser_cache'] : '') : (is_string($params['seed']) ? ($params['seed'] = $params['seed'][0] === '?' ? $params['seed'] : '?' . $params['seed']) : ''); |
| 2486 | 2624 | $params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false; |
@@ -2491,8 +2629,9 @@ discard block |
||
| 2491 | 2629 | $params['order_pos'] = isset($params['order_pos']) ? (int) $params['order_pos'] : 3000; |
| 2492 | 2630 | |
| 2493 | 2631 | // If this is an external file, automatically set this to false. |
| 2494 | - if (!empty($params['external'])) |
|
| 2495 | - $params['minimize'] = false; |
|
| 2632 | + if (!empty($params['external'])) { |
|
| 2633 | + $params['minimize'] = false; |
|
| 2634 | + } |
|
| 2496 | 2635 | |
| 2497 | 2636 | // Account for shorthand like admin.css?alp21 filenames |
| 2498 | 2637 | $has_seed = strpos($fileName, '.css?'); |
@@ -2509,16 +2648,12 @@ discard block |
||
| 2509 | 2648 | { |
| 2510 | 2649 | $fileUrl = $settings['default_theme_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2511 | 2650 | $filePath = $settings['default_theme_dir'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2512 | - } |
|
| 2513 | - |
|
| 2514 | - else |
|
| 2651 | + } else |
|
| 2515 | 2652 | { |
| 2516 | 2653 | $fileUrl = false; |
| 2517 | 2654 | $filePath = false; |
| 2518 | 2655 | } |
| 2519 | - } |
|
| 2520 | - |
|
| 2521 | - else |
|
| 2656 | + } else |
|
| 2522 | 2657 | { |
| 2523 | 2658 | $fileUrl = $settings[$themeRef . '_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2524 | 2659 | $filePath = $settings[$themeRef . '_dir'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
@@ -2536,16 +2671,18 @@ discard block |
||
| 2536 | 2671 | if (!empty($fileName)) |
| 2537 | 2672 | { |
| 2538 | 2673 | // find a free number/position |
| 2539 | - while (isset($context['css_files_order'][$params['order_pos']])) |
|
| 2540 | - $params['order_pos']++; |
|
| 2674 | + while (isset($context['css_files_order'][$params['order_pos']])) { |
|
| 2675 | + $params['order_pos']++; |
|
| 2676 | + } |
|
| 2541 | 2677 | $context['css_files_order'][$params['order_pos']] = $id; |
| 2542 | 2678 | |
| 2543 | 2679 | $context['css_files'][$id] = array('fileUrl' => $fileUrl, 'filePath' => $filePath, 'fileName' => $fileName, 'options' => $params); |
| 2544 | 2680 | } |
| 2545 | 2681 | |
| 2546 | - if (!empty($context['right_to_left']) && !empty($params['rtl'])) |
|
| 2547 | - loadCSSFile($params['rtl'], array_diff_key($params, array('rtl' => 0))); |
|
| 2548 | -} |
|
| 2682 | + if (!empty($context['right_to_left']) && !empty($params['rtl'])) { |
|
| 2683 | + loadCSSFile($params['rtl'], array_diff_key($params, array('rtl' => 0))); |
|
| 2684 | + } |
|
| 2685 | + } |
|
| 2549 | 2686 | |
| 2550 | 2687 | /** |
| 2551 | 2688 | * Add a block of inline css code to be executed later |
@@ -2562,8 +2699,9 @@ discard block |
||
| 2562 | 2699 | global $context; |
| 2563 | 2700 | |
| 2564 | 2701 | // Gotta add something... |
| 2565 | - if (empty($css)) |
|
| 2566 | - return false; |
|
| 2702 | + if (empty($css)) { |
|
| 2703 | + return false; |
|
| 2704 | + } |
|
| 2567 | 2705 | |
| 2568 | 2706 | $context['css_header'][] = $css; |
| 2569 | 2707 | } |
@@ -2599,8 +2737,9 @@ discard block |
||
| 2599 | 2737 | $params['validate'] = isset($params['validate']) ? $params['validate'] : true; |
| 2600 | 2738 | |
| 2601 | 2739 | // If this is an external file, automatically set this to false. |
| 2602 | - if (!empty($params['external'])) |
|
| 2603 | - $params['minimize'] = false; |
|
| 2740 | + if (!empty($params['external'])) { |
|
| 2741 | + $params['minimize'] = false; |
|
| 2742 | + } |
|
| 2604 | 2743 | |
| 2605 | 2744 | // Account for shorthand like admin.js?alp21 filenames |
| 2606 | 2745 | $has_seed = strpos($fileName, '.js?'); |
@@ -2617,16 +2756,12 @@ discard block |
||
| 2617 | 2756 | { |
| 2618 | 2757 | $fileUrl = $settings['default_theme_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2619 | 2758 | $filePath = $settings['default_theme_dir'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2620 | - } |
|
| 2621 | - |
|
| 2622 | - else |
|
| 2759 | + } else |
|
| 2623 | 2760 | { |
| 2624 | 2761 | $fileUrl = false; |
| 2625 | 2762 | $filePath = false; |
| 2626 | 2763 | } |
| 2627 | - } |
|
| 2628 | - |
|
| 2629 | - else |
|
| 2764 | + } else |
|
| 2630 | 2765 | { |
| 2631 | 2766 | $fileUrl = $settings[$themeRef . '_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2632 | 2767 | $filePath = $settings[$themeRef . '_dir'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
@@ -2641,9 +2776,10 @@ discard block |
||
| 2641 | 2776 | } |
| 2642 | 2777 | |
| 2643 | 2778 | // Add it to the array for use in the template |
| 2644 | - if (!empty($fileName)) |
|
| 2645 | - $context['javascript_files'][$id] = array('fileUrl' => $fileUrl, 'filePath' => $filePath, 'fileName' => $fileName, 'options' => $params); |
|
| 2646 | -} |
|
| 2779 | + if (!empty($fileName)) { |
|
| 2780 | + $context['javascript_files'][$id] = array('fileUrl' => $fileUrl, 'filePath' => $filePath, 'fileName' => $fileName, 'options' => $params); |
|
| 2781 | + } |
|
| 2782 | + } |
|
| 2647 | 2783 | |
| 2648 | 2784 | /** |
| 2649 | 2785 | * Add a Javascript variable for output later (for feeding text strings and similar to JS) |
@@ -2657,9 +2793,10 @@ discard block |
||
| 2657 | 2793 | { |
| 2658 | 2794 | global $context; |
| 2659 | 2795 | |
| 2660 | - if (!empty($key) && (!empty($value) || $value === '0')) |
|
| 2661 | - $context['javascript_vars'][$key] = !empty($escape) ? JavaScriptEscape($value) : $value; |
|
| 2662 | -} |
|
| 2796 | + if (!empty($key) && (!empty($value) || $value === '0')) { |
|
| 2797 | + $context['javascript_vars'][$key] = !empty($escape) ? JavaScriptEscape($value) : $value; |
|
| 2798 | + } |
|
| 2799 | + } |
|
| 2663 | 2800 | |
| 2664 | 2801 | /** |
| 2665 | 2802 | * Add a block of inline Javascript code to be executed later |
@@ -2676,8 +2813,9 @@ discard block |
||
| 2676 | 2813 | { |
| 2677 | 2814 | global $context; |
| 2678 | 2815 | |
| 2679 | - if (empty($javascript)) |
|
| 2680 | - return false; |
|
| 2816 | + if (empty($javascript)) { |
|
| 2817 | + return false; |
|
| 2818 | + } |
|
| 2681 | 2819 | |
| 2682 | 2820 | $context['javascript_inline'][($defer === true ? 'defer' : 'standard')][] = $javascript; |
| 2683 | 2821 | } |
@@ -2698,15 +2836,18 @@ discard block |
||
| 2698 | 2836 | static $already_loaded = array(); |
| 2699 | 2837 | |
| 2700 | 2838 | // Default to the user's language. |
| 2701 | - if ($lang == '') |
|
| 2702 | - $lang = isset($user_info['language']) ? $user_info['language'] : $language; |
|
| 2839 | + if ($lang == '') { |
|
| 2840 | + $lang = isset($user_info['language']) ? $user_info['language'] : $language; |
|
| 2841 | + } |
|
| 2703 | 2842 | |
| 2704 | 2843 | // Do we want the English version of language file as fallback? |
| 2705 | - if (empty($modSettings['disable_language_fallback']) && $lang != 'english') |
|
| 2706 | - loadLanguage($template_name, 'english', false); |
|
| 2844 | + if (empty($modSettings['disable_language_fallback']) && $lang != 'english') { |
|
| 2845 | + loadLanguage($template_name, 'english', false); |
|
| 2846 | + } |
|
| 2707 | 2847 | |
| 2708 | - if (!$force_reload && isset($already_loaded[$template_name]) && $already_loaded[$template_name] == $lang) |
|
| 2709 | - return $lang; |
|
| 2848 | + if (!$force_reload && isset($already_loaded[$template_name]) && $already_loaded[$template_name] == $lang) { |
|
| 2849 | + return $lang; |
|
| 2850 | + } |
|
| 2710 | 2851 | |
| 2711 | 2852 | // Make sure we have $settings - if not we're in trouble and need to find it! |
| 2712 | 2853 | if (empty($settings['default_theme_dir'])) |
@@ -2717,8 +2858,9 @@ discard block |
||
| 2717 | 2858 | |
| 2718 | 2859 | // What theme are we in? |
| 2719 | 2860 | $theme_name = basename($settings['theme_url']); |
| 2720 | - if (empty($theme_name)) |
|
| 2721 | - $theme_name = 'unknown'; |
|
| 2861 | + if (empty($theme_name)) { |
|
| 2862 | + $theme_name = 'unknown'; |
|
| 2863 | + } |
|
| 2722 | 2864 | |
| 2723 | 2865 | // For each file open it up and write it out! |
| 2724 | 2866 | foreach (explode('+', $template_name) as $template) |
@@ -2760,8 +2902,9 @@ discard block |
||
| 2760 | 2902 | $found = true; |
| 2761 | 2903 | |
| 2762 | 2904 | // setlocale is required for basename() & pathinfo() to work properly on the selected language |
| 2763 | - if (!empty($txt['lang_locale']) && !empty($modSettings['global_character_set'])) |
|
| 2764 | - setlocale(LC_CTYPE, $txt['lang_locale'] . '.' . $modSettings['global_character_set']); |
|
| 2905 | + if (!empty($txt['lang_locale']) && !empty($modSettings['global_character_set'])) { |
|
| 2906 | + setlocale(LC_CTYPE, $txt['lang_locale'] . '.' . $modSettings['global_character_set']); |
|
| 2907 | + } |
|
| 2765 | 2908 | |
| 2766 | 2909 | break; |
| 2767 | 2910 | } |
@@ -2801,8 +2944,9 @@ discard block |
||
| 2801 | 2944 | } |
| 2802 | 2945 | |
| 2803 | 2946 | // Keep track of what we're up to soldier. |
| 2804 | - if ($db_show_debug === true) |
|
| 2805 | - $context['debug']['language_files'][] = $template_name . '.' . $lang . ' (' . $theme_name . ')'; |
|
| 2947 | + if ($db_show_debug === true) { |
|
| 2948 | + $context['debug']['language_files'][] = $template_name . '.' . $lang . ' (' . $theme_name . ')'; |
|
| 2949 | + } |
|
| 2806 | 2950 | |
| 2807 | 2951 | // Remember what we have loaded, and in which language. |
| 2808 | 2952 | $already_loaded[$template_name] = $lang; |
@@ -2848,8 +2992,9 @@ discard block |
||
| 2848 | 2992 | ) |
| 2849 | 2993 | ); |
| 2850 | 2994 | // In the EXTREMELY unlikely event this happens, give an error message. |
| 2851 | - if ($smcFunc['db_num_rows']($result) == 0) |
|
| 2852 | - fatal_lang_error('parent_not_found', 'critical'); |
|
| 2995 | + if ($smcFunc['db_num_rows']($result) == 0) { |
|
| 2996 | + fatal_lang_error('parent_not_found', 'critical'); |
|
| 2997 | + } |
|
| 2853 | 2998 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
| 2854 | 2999 | { |
| 2855 | 3000 | if (!isset($boards[$row['id_board']])) |
@@ -2866,8 +3011,8 @@ discard block |
||
| 2866 | 3011 | ); |
| 2867 | 3012 | } |
| 2868 | 3013 | // If a moderator exists for this board, add that moderator for all children too. |
| 2869 | - if (!empty($row['id_moderator'])) |
|
| 2870 | - foreach ($boards as $id => $dummy) |
|
| 3014 | + if (!empty($row['id_moderator'])) { |
|
| 3015 | + foreach ($boards as $id => $dummy) |
|
| 2871 | 3016 | { |
| 2872 | 3017 | $boards[$id]['moderators'][$row['id_moderator']] = array( |
| 2873 | 3018 | 'id' => $row['id_moderator'], |
@@ -2875,11 +3020,12 @@ discard block |
||
| 2875 | 3020 | 'href' => $scripturl . '?action=profile;u=' . $row['id_moderator'], |
| 2876 | 3021 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_moderator'] . '">' . $row['real_name'] . '</a>' |
| 2877 | 3022 | ); |
| 3023 | + } |
|
| 2878 | 3024 | } |
| 2879 | 3025 | |
| 2880 | 3026 | // If a moderator group exists for this board, add that moderator group for all children too |
| 2881 | - if (!empty($row['id_moderator_group'])) |
|
| 2882 | - foreach ($boards as $id => $dummy) |
|
| 3027 | + if (!empty($row['id_moderator_group'])) { |
|
| 3028 | + foreach ($boards as $id => $dummy) |
|
| 2883 | 3029 | { |
| 2884 | 3030 | $boards[$id]['moderator_groups'][$row['id_moderator_group']] = array( |
| 2885 | 3031 | 'id' => $row['id_moderator_group'], |
@@ -2887,6 +3033,7 @@ discard block |
||
| 2887 | 3033 | 'href' => $scripturl . '?action=groups;sa=members;group=' . $row['id_moderator_group'], |
| 2888 | 3034 | 'link' => '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_moderator_group'] . '">' . $row['group_name'] . '</a>' |
| 2889 | 3035 | ); |
| 3036 | + } |
|
| 2890 | 3037 | } |
| 2891 | 3038 | } |
| 2892 | 3039 | $smcFunc['db_free_result']($result); |
@@ -2913,23 +3060,27 @@ discard block |
||
| 2913 | 3060 | if (!$use_cache || ($context['languages'] = cache_get_data('known_languages', !empty($modSettings['cache_enable']) && $modSettings['cache_enable'] < 1 ? 86400 : 3600)) == null) |
| 2914 | 3061 | { |
| 2915 | 3062 | // If we don't have our ucwords function defined yet, let's load the settings data. |
| 2916 | - if (empty($smcFunc['ucwords'])) |
|
| 2917 | - reloadSettings(); |
|
| 3063 | + if (empty($smcFunc['ucwords'])) { |
|
| 3064 | + reloadSettings(); |
|
| 3065 | + } |
|
| 2918 | 3066 | |
| 2919 | 3067 | // If we don't have our theme information yet, let's get it. |
| 2920 | - if (empty($settings['default_theme_dir'])) |
|
| 2921 | - loadTheme(0, false); |
|
| 3068 | + if (empty($settings['default_theme_dir'])) { |
|
| 3069 | + loadTheme(0, false); |
|
| 3070 | + } |
|
| 2922 | 3071 | |
| 2923 | 3072 | // Default language directories to try. |
| 2924 | 3073 | $language_directories = array( |
| 2925 | 3074 | $settings['default_theme_dir'] . '/languages', |
| 2926 | 3075 | ); |
| 2927 | - if (!empty($settings['actual_theme_dir']) && $settings['actual_theme_dir'] != $settings['default_theme_dir']) |
|
| 2928 | - $language_directories[] = $settings['actual_theme_dir'] . '/languages'; |
|
| 3076 | + if (!empty($settings['actual_theme_dir']) && $settings['actual_theme_dir'] != $settings['default_theme_dir']) { |
|
| 3077 | + $language_directories[] = $settings['actual_theme_dir'] . '/languages'; |
|
| 3078 | + } |
|
| 2929 | 3079 | |
| 2930 | 3080 | // We possibly have a base theme directory. |
| 2931 | - if (!empty($settings['base_theme_dir'])) |
|
| 2932 | - $language_directories[] = $settings['base_theme_dir'] . '/languages'; |
|
| 3081 | + if (!empty($settings['base_theme_dir'])) { |
|
| 3082 | + $language_directories[] = $settings['base_theme_dir'] . '/languages'; |
|
| 3083 | + } |
|
| 2933 | 3084 | |
| 2934 | 3085 | // Remove any duplicates. |
| 2935 | 3086 | $language_directories = array_unique($language_directories); |
@@ -2943,20 +3094,21 @@ discard block |
||
| 2943 | 3094 | foreach ($language_directories as $language_dir) |
| 2944 | 3095 | { |
| 2945 | 3096 | // Can't look in here... doesn't exist! |
| 2946 | - if (!file_exists($language_dir)) |
|
| 2947 | - continue; |
|
| 3097 | + if (!file_exists($language_dir)) { |
|
| 3098 | + continue; |
|
| 3099 | + } |
|
| 2948 | 3100 | |
| 2949 | 3101 | $dir = dir($language_dir); |
| 2950 | 3102 | while ($entry = $dir->read()) |
| 2951 | 3103 | { |
| 2952 | 3104 | // Look for the index language file... For good measure skip any "index.language-utf8.php" files |
| 2953 | - if (!preg_match('~^index\.(.+[^-utf8])\.php$~', $entry, $matches)) |
|
| 2954 | - continue; |
|
| 2955 | - |
|
| 2956 | - if (!empty($langList) && !empty($langList[$matches[1]])) |
|
| 2957 | - $langName = $langList[$matches[1]]; |
|
| 3105 | + if (!preg_match('~^index\.(.+[^-utf8])\.php$~', $entry, $matches)) { |
|
| 3106 | + continue; |
|
| 3107 | + } |
|
| 2958 | 3108 | |
| 2959 | - else |
|
| 3109 | + if (!empty($langList) && !empty($langList[$matches[1]])) { |
|
| 3110 | + $langName = $langList[$matches[1]]; |
|
| 3111 | + } else |
|
| 2960 | 3112 | { |
| 2961 | 3113 | $langName = $smcFunc['ucwords'](strtr($matches[1], array('_' => ' '))); |
| 2962 | 3114 | |
@@ -2997,12 +3149,14 @@ discard block |
||
| 2997 | 3149 | } |
| 2998 | 3150 | |
| 2999 | 3151 | // Do we need to store the lang list? |
| 3000 | - if (empty($langList)) |
|
| 3001 | - updateSettings(array('langList' => $smcFunc['json_encode']($catchLang))); |
|
| 3152 | + if (empty($langList)) { |
|
| 3153 | + updateSettings(array('langList' => $smcFunc['json_encode']($catchLang))); |
|
| 3154 | + } |
|
| 3002 | 3155 | |
| 3003 | 3156 | // Let's cash in on this deal. |
| 3004 | - if (!empty($modSettings['cache_enable'])) |
|
| 3005 | - cache_put_data('known_languages', $context['languages'], !empty($modSettings['cache_enable']) && $modSettings['cache_enable'] < 1 ? 86400 : 3600); |
|
| 3157 | + if (!empty($modSettings['cache_enable'])) { |
|
| 3158 | + cache_put_data('known_languages', $context['languages'], !empty($modSettings['cache_enable']) && $modSettings['cache_enable'] < 1 ? 86400 : 3600); |
|
| 3159 | + } |
|
| 3006 | 3160 | } |
| 3007 | 3161 | |
| 3008 | 3162 | return $context['languages']; |
@@ -3025,8 +3179,9 @@ discard block |
||
| 3025 | 3179 | global $modSettings, $options, $txt; |
| 3026 | 3180 | static $censor_vulgar = null, $censor_proper; |
| 3027 | 3181 | |
| 3028 | - if ((!empty($options['show_no_censored']) && !empty($modSettings['allow_no_censored']) && !$force) || empty($modSettings['censor_vulgar']) || trim($text) === '') |
|
| 3029 | - return $text; |
|
| 3182 | + if ((!empty($options['show_no_censored']) && !empty($modSettings['allow_no_censored']) && !$force) || empty($modSettings['censor_vulgar']) || trim($text) === '') { |
|
| 3183 | + return $text; |
|
| 3184 | + } |
|
| 3030 | 3185 | |
| 3031 | 3186 | // If they haven't yet been loaded, load them. |
| 3032 | 3187 | if ($censor_vulgar == null) |
@@ -3057,9 +3212,9 @@ discard block |
||
| 3057 | 3212 | { |
| 3058 | 3213 | $func = !empty($modSettings['censorIgnoreCase']) ? 'str_ireplace' : 'str_replace'; |
| 3059 | 3214 | $text = $func($censor_vulgar, $censor_proper, $text); |
| 3215 | + } else { |
|
| 3216 | + $text = preg_replace($censor_vulgar, $censor_proper, $text); |
|
| 3060 | 3217 | } |
| 3061 | - else |
|
| 3062 | - $text = preg_replace($censor_vulgar, $censor_proper, $text); |
|
| 3063 | 3218 | |
| 3064 | 3219 | return $text; |
| 3065 | 3220 | } |
@@ -3085,30 +3240,35 @@ discard block |
||
| 3085 | 3240 | @ini_set('track_errors', '1'); |
| 3086 | 3241 | |
| 3087 | 3242 | // Don't include the file more than once, if $once is true. |
| 3088 | - if ($once && in_array($filename, $templates)) |
|
| 3089 | - return; |
|
| 3243 | + if ($once && in_array($filename, $templates)) { |
|
| 3244 | + return; |
|
| 3245 | + } |
|
| 3090 | 3246 | // Add this file to the include list, whether $once is true or not. |
| 3091 | - else |
|
| 3092 | - $templates[] = $filename; |
|
| 3247 | + else { |
|
| 3248 | + $templates[] = $filename; |
|
| 3249 | + } |
|
| 3093 | 3250 | |
| 3094 | 3251 | |
| 3095 | 3252 | $file_found = file_exists($filename); |
| 3096 | 3253 | |
| 3097 | - if ($once && $file_found) |
|
| 3098 | - require_once($filename); |
|
| 3099 | - elseif ($file_found) |
|
| 3100 | - require($filename); |
|
| 3254 | + if ($once && $file_found) { |
|
| 3255 | + require_once($filename); |
|
| 3256 | + } elseif ($file_found) { |
|
| 3257 | + require($filename); |
|
| 3258 | + } |
|
| 3101 | 3259 | |
| 3102 | 3260 | if ($file_found !== true) |
| 3103 | 3261 | { |
| 3104 | 3262 | ob_end_clean(); |
| 3105 | - if (!empty($modSettings['enableCompressedOutput'])) |
|
| 3106 | - @ob_start('ob_gzhandler'); |
|
| 3107 | - else |
|
| 3108 | - ob_start(); |
|
| 3263 | + if (!empty($modSettings['enableCompressedOutput'])) { |
|
| 3264 | + @ob_start('ob_gzhandler'); |
|
| 3265 | + } else { |
|
| 3266 | + ob_start(); |
|
| 3267 | + } |
|
| 3109 | 3268 | |
| 3110 | - if (isset($_GET['debug'])) |
|
| 3111 | - header('content-type: application/xhtml+xml; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set'])); |
|
| 3269 | + if (isset($_GET['debug'])) { |
|
| 3270 | + header('content-type: application/xhtml+xml; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set'])); |
|
| 3271 | + } |
|
| 3112 | 3272 | |
| 3113 | 3273 | // Don't cache error pages!! |
| 3114 | 3274 | header('expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
@@ -3127,12 +3287,13 @@ discard block |
||
| 3127 | 3287 | echo '<!DOCTYPE html> |
| 3128 | 3288 | <html', !empty($context['right_to_left']) ? ' dir="rtl"' : '', '> |
| 3129 | 3289 | <head>'; |
| 3130 | - if (isset($context['character_set'])) |
|
| 3131 | - echo ' |
|
| 3290 | + if (isset($context['character_set'])) { |
|
| 3291 | + echo ' |
|
| 3132 | 3292 | <meta charset="', $context['character_set'], '">'; |
| 3293 | + } |
|
| 3133 | 3294 | |
| 3134 | - if (!empty($maintenance) && !allowedTo('admin_forum')) |
|
| 3135 | - echo ' |
|
| 3295 | + if (!empty($maintenance) && !allowedTo('admin_forum')) { |
|
| 3296 | + echo ' |
|
| 3136 | 3297 | <title>', $mtitle, '</title> |
| 3137 | 3298 | </head> |
| 3138 | 3299 | <body> |
@@ -3140,8 +3301,8 @@ discard block |
||
| 3140 | 3301 | ', $mmessage, ' |
| 3141 | 3302 | </body> |
| 3142 | 3303 | </html>'; |
| 3143 | - elseif (!allowedTo('admin_forum')) |
|
| 3144 | - echo ' |
|
| 3304 | + } elseif (!allowedTo('admin_forum')) { |
|
| 3305 | + echo ' |
|
| 3145 | 3306 | <title>', $txt['template_parse_error'], '</title> |
| 3146 | 3307 | </head> |
| 3147 | 3308 | <body> |
@@ -3149,14 +3310,16 @@ discard block |
||
| 3149 | 3310 | ', $txt['template_parse_error_message'], ' |
| 3150 | 3311 | </body> |
| 3151 | 3312 | </html>'; |
| 3152 | - else |
|
| 3313 | + } else |
|
| 3153 | 3314 | { |
| 3154 | 3315 | $error = fetch_web_data($boardurl . strtr($filename, array($boarddir => '', strtr($boarddir, '\\', '/') => ''))); |
| 3155 | 3316 | $error_array = error_get_last(); |
| 3156 | - if (empty($error) && ini_get('track_errors') && !empty($error_array)) |
|
| 3157 | - $error = $error_array['message']; |
|
| 3158 | - if (empty($error)) |
|
| 3159 | - $error = $txt['template_parse_errmsg']; |
|
| 3317 | + if (empty($error) && ini_get('track_errors') && !empty($error_array)) { |
|
| 3318 | + $error = $error_array['message']; |
|
| 3319 | + } |
|
| 3320 | + if (empty($error)) { |
|
| 3321 | + $error = $txt['template_parse_errmsg']; |
|
| 3322 | + } |
|
| 3160 | 3323 | |
| 3161 | 3324 | $error = strtr($error, array('<b>' => '<strong>', '</b>' => '</strong>')); |
| 3162 | 3325 | |
@@ -3167,11 +3330,12 @@ discard block |
||
| 3167 | 3330 | <h3>', $txt['template_parse_error'], '</h3> |
| 3168 | 3331 | ', sprintf($txt['template_parse_error_details'], strtr($filename, array($boarddir => '', strtr($boarddir, '\\', '/') => ''))); |
| 3169 | 3332 | |
| 3170 | - if (!empty($error)) |
|
| 3171 | - echo ' |
|
| 3333 | + if (!empty($error)) { |
|
| 3334 | + echo ' |
|
| 3172 | 3335 | <hr> |
| 3173 | 3336 | |
| 3174 | 3337 | <div style="margin: 0 20px;"><pre>', strtr(strtr($error, array('<strong>' . $boarddir => '<strong>...', '<strong>' . strtr($boarddir, '\\', '/') => '<strong>...')), '\\', '/'), '</pre></div>'; |
| 3338 | + } |
|
| 3175 | 3339 | |
| 3176 | 3340 | // I know, I know... this is VERY COMPLICATED. Still, it's good. |
| 3177 | 3341 | if (preg_match('~ <strong>(\d+)</strong><br( /)?' . '>$~i', $error, $match) != 0) |
@@ -3181,10 +3345,11 @@ discard block |
||
| 3181 | 3345 | $data2 = preg_split('~\<br( /)?\>~', $data2); |
| 3182 | 3346 | |
| 3183 | 3347 | // Fix the PHP code stuff... |
| 3184 | - if (!isBrowser('gecko')) |
|
| 3185 | - $data2 = str_replace("\t", '<span style="white-space: pre;">' . "\t" . '</span>', $data2); |
|
| 3186 | - else |
|
| 3187 | - $data2 = str_replace('<pre style="display: inline;">' . "\t" . '</pre>', "\t", $data2); |
|
| 3348 | + if (!isBrowser('gecko')) { |
|
| 3349 | + $data2 = str_replace("\t", '<span style="white-space: pre;">' . "\t" . '</span>', $data2); |
|
| 3350 | + } else { |
|
| 3351 | + $data2 = str_replace('<pre style="display: inline;">' . "\t" . '</pre>', "\t", $data2); |
|
| 3352 | + } |
|
| 3188 | 3353 | |
| 3189 | 3354 | // Now we get to work around a bug in PHP where it doesn't escape <br>s! |
| 3190 | 3355 | $j = -1; |
@@ -3192,8 +3357,9 @@ discard block |
||
| 3192 | 3357 | { |
| 3193 | 3358 | $j++; |
| 3194 | 3359 | |
| 3195 | - if (substr_count($line, '<br>') == 0) |
|
| 3196 | - continue; |
|
| 3360 | + if (substr_count($line, '<br>') == 0) { |
|
| 3361 | + continue; |
|
| 3362 | + } |
|
| 3197 | 3363 | |
| 3198 | 3364 | $n = substr_count($line, '<br>'); |
| 3199 | 3365 | for ($i = 0; $i < $n; $i++) |
@@ -3212,38 +3378,42 @@ discard block |
||
| 3212 | 3378 | // Figure out what the color coding was before... |
| 3213 | 3379 | $line = max($match[1] - 9, 1); |
| 3214 | 3380 | $last_line = ''; |
| 3215 | - for ($line2 = $line - 1; $line2 > 1; $line2--) |
|
| 3216 | - if (strpos($data2[$line2], '<') !== false) |
|
| 3381 | + for ($line2 = $line - 1; $line2 > 1; $line2--) { |
|
| 3382 | + if (strpos($data2[$line2], '<') !== false) |
|
| 3217 | 3383 | { |
| 3218 | 3384 | if (preg_match('~(<[^/>]+>)[^<]*$~', $data2[$line2], $color_match) != 0) |
| 3219 | 3385 | $last_line = $color_match[1]; |
| 3386 | + } |
|
| 3220 | 3387 | break; |
| 3221 | 3388 | } |
| 3222 | 3389 | |
| 3223 | 3390 | // Show the relevant lines... |
| 3224 | 3391 | for ($n = min($match[1] + 4, count($data2) + 1); $line <= $n; $line++) |
| 3225 | 3392 | { |
| 3226 | - if ($line == $match[1]) |
|
| 3227 | - echo '</pre><div style="background-color: #ffb0b5;"><pre style="margin: 0;">'; |
|
| 3393 | + if ($line == $match[1]) { |
|
| 3394 | + echo '</pre><div style="background-color: #ffb0b5;"><pre style="margin: 0;">'; |
|
| 3395 | + } |
|
| 3228 | 3396 | |
| 3229 | 3397 | echo '<span style="color: black;">', sprintf('%' . strlen($n) . 's', $line), ':</span> '; |
| 3230 | - if (isset($data2[$line]) && $data2[$line] != '') |
|
| 3231 | - echo substr($data2[$line], 0, 2) == '</' ? preg_replace('~^</[^>]+>~', '', $data2[$line]) : $last_line . $data2[$line]; |
|
| 3398 | + if (isset($data2[$line]) && $data2[$line] != '') { |
|
| 3399 | + echo substr($data2[$line], 0, 2) == '</' ? preg_replace('~^</[^>]+>~', '', $data2[$line]) : $last_line . $data2[$line]; |
|
| 3400 | + } |
|
| 3232 | 3401 | |
| 3233 | 3402 | if (isset($data2[$line]) && preg_match('~(<[^/>]+>)[^<]*$~', $data2[$line], $color_match) != 0) |
| 3234 | 3403 | { |
| 3235 | 3404 | $last_line = $color_match[1]; |
| 3236 | 3405 | echo '</', substr($last_line, 1, 4), '>'; |
| 3406 | + } elseif ($last_line != '' && strpos($data2[$line], '<') !== false) { |
|
| 3407 | + $last_line = ''; |
|
| 3408 | + } elseif ($last_line != '' && $data2[$line] != '') { |
|
| 3409 | + echo '</', substr($last_line, 1, 4), '>'; |
|
| 3237 | 3410 | } |
| 3238 | - elseif ($last_line != '' && strpos($data2[$line], '<') !== false) |
|
| 3239 | - $last_line = ''; |
|
| 3240 | - elseif ($last_line != '' && $data2[$line] != '') |
|
| 3241 | - echo '</', substr($last_line, 1, 4), '>'; |
|
| 3242 | 3411 | |
| 3243 | - if ($line == $match[1]) |
|
| 3244 | - echo '</pre></div><pre style="margin: 0;">'; |
|
| 3245 | - else |
|
| 3246 | - echo "\n"; |
|
| 3412 | + if ($line == $match[1]) { |
|
| 3413 | + echo '</pre></div><pre style="margin: 0;">'; |
|
| 3414 | + } else { |
|
| 3415 | + echo "\n"; |
|
| 3416 | + } |
|
| 3247 | 3417 | } |
| 3248 | 3418 | |
| 3249 | 3419 | echo '</pre></div>'; |
@@ -3267,8 +3437,9 @@ discard block |
||
| 3267 | 3437 | global $db_type, $db_name, $ssi_db_user, $ssi_db_passwd, $sourcedir, $db_prefix, $db_port, $db_mb4; |
| 3268 | 3438 | |
| 3269 | 3439 | // Figure out what type of database we are using. |
| 3270 | - if (empty($db_type) || !file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
|
| 3271 | - $db_type = 'mysql'; |
|
| 3440 | + if (empty($db_type) || !file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) { |
|
| 3441 | + $db_type = 'mysql'; |
|
| 3442 | + } |
|
| 3272 | 3443 | |
| 3273 | 3444 | // Load the file for the database. |
| 3274 | 3445 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
@@ -3276,11 +3447,13 @@ discard block |
||
| 3276 | 3447 | $db_options = array(); |
| 3277 | 3448 | |
| 3278 | 3449 | // Add in the port if needed |
| 3279 | - if (!empty($db_port)) |
|
| 3280 | - $db_options['port'] = $db_port; |
|
| 3450 | + if (!empty($db_port)) { |
|
| 3451 | + $db_options['port'] = $db_port; |
|
| 3452 | + } |
|
| 3281 | 3453 | |
| 3282 | - if (!empty($db_mb4)) |
|
| 3283 | - $db_options['db_mb4'] = $db_mb4; |
|
| 3454 | + if (!empty($db_mb4)) { |
|
| 3455 | + $db_options['db_mb4'] = $db_mb4; |
|
| 3456 | + } |
|
| 3284 | 3457 | |
| 3285 | 3458 | // If we are in SSI try them first, but don't worry if it doesn't work, we have the normal username and password we can use. |
| 3286 | 3459 | if (SMF == 'SSI' && !empty($ssi_db_user) && !empty($ssi_db_passwd)) |
@@ -3299,13 +3472,15 @@ discard block |
||
| 3299 | 3472 | } |
| 3300 | 3473 | |
| 3301 | 3474 | // Safe guard here, if there isn't a valid connection lets put a stop to it. |
| 3302 | - if (!$db_connection) |
|
| 3303 | - display_db_error(); |
|
| 3475 | + if (!$db_connection) { |
|
| 3476 | + display_db_error(); |
|
| 3477 | + } |
|
| 3304 | 3478 | |
| 3305 | 3479 | // If in SSI mode fix up the prefix. |
| 3306 | - if (SMF == 'SSI') |
|
| 3307 | - db_fix_prefix($db_prefix, $db_name); |
|
| 3308 | -} |
|
| 3480 | + if (SMF == 'SSI') { |
|
| 3481 | + db_fix_prefix($db_prefix, $db_name); |
|
| 3482 | + } |
|
| 3483 | + } |
|
| 3309 | 3484 | |
| 3310 | 3485 | /** |
| 3311 | 3486 | * Try to load up a supported caching method. This is saved in $cacheAPI if we are not overriding it. |
@@ -3319,14 +3494,16 @@ discard block |
||
| 3319 | 3494 | global $sourcedir, $cacheAPI, $cache_accelerator, $cache_enable; |
| 3320 | 3495 | |
| 3321 | 3496 | // is caching enabled? |
| 3322 | - if (empty($cache_enable) && empty($overrideCache)) |
|
| 3323 | - return false; |
|
| 3497 | + if (empty($cache_enable) && empty($overrideCache)) { |
|
| 3498 | + return false; |
|
| 3499 | + } |
|
| 3324 | 3500 | |
| 3325 | 3501 | // Not overriding this and we have a cacheAPI, send it back. |
| 3326 | - if (empty($overrideCache) && is_object($cacheAPI)) |
|
| 3327 | - return $cacheAPI; |
|
| 3328 | - elseif (is_null($cacheAPI)) |
|
| 3329 | - $cacheAPI = false; |
|
| 3502 | + if (empty($overrideCache) && is_object($cacheAPI)) { |
|
| 3503 | + return $cacheAPI; |
|
| 3504 | + } elseif (is_null($cacheAPI)) { |
|
| 3505 | + $cacheAPI = false; |
|
| 3506 | + } |
|
| 3330 | 3507 | |
| 3331 | 3508 | // Make sure our class is in session. |
| 3332 | 3509 | require_once($sourcedir . '/Class-CacheAPI.php'); |
@@ -3347,8 +3524,9 @@ discard block |
||
| 3347 | 3524 | if (!$testAPI->isSupported()) |
| 3348 | 3525 | { |
| 3349 | 3526 | // Can we save ourselves? |
| 3350 | - if (!empty($fallbackSMF) && is_null($overrideCache) && $tryAccelerator != 'smf') |
|
| 3351 | - return loadCacheAccelerator(null, false); |
|
| 3527 | + if (!empty($fallbackSMF) && is_null($overrideCache) && $tryAccelerator != 'smf') { |
|
| 3528 | + return loadCacheAccelerator(null, false); |
|
| 3529 | + } |
|
| 3352 | 3530 | return false; |
| 3353 | 3531 | } |
| 3354 | 3532 | |
@@ -3360,9 +3538,9 @@ discard block |
||
| 3360 | 3538 | { |
| 3361 | 3539 | $cacheAPI = $testAPI; |
| 3362 | 3540 | return $cacheAPI; |
| 3541 | + } else { |
|
| 3542 | + return $testAPI; |
|
| 3363 | 3543 | } |
| 3364 | - else |
|
| 3365 | - return $testAPI; |
|
| 3366 | 3544 | } |
| 3367 | 3545 | } |
| 3368 | 3546 | |
@@ -3382,8 +3560,9 @@ discard block |
||
| 3382 | 3560 | |
| 3383 | 3561 | // @todo Why are we doing this if caching is disabled? |
| 3384 | 3562 | |
| 3385 | - if (function_exists('call_integration_hook')) |
|
| 3386 | - call_integration_hook('pre_cache_quick_get', array(&$key, &$file, &$function, &$params, &$level)); |
|
| 3563 | + if (function_exists('call_integration_hook')) { |
|
| 3564 | + call_integration_hook('pre_cache_quick_get', array(&$key, &$file, &$function, &$params, &$level)); |
|
| 3565 | + } |
|
| 3387 | 3566 | |
| 3388 | 3567 | /* Refresh the cache if either: |
| 3389 | 3568 | 1. Caching is disabled. |
@@ -3397,16 +3576,19 @@ discard block |
||
| 3397 | 3576 | require_once($sourcedir . '/' . $file); |
| 3398 | 3577 | $cache_block = call_user_func_array($function, $params); |
| 3399 | 3578 | |
| 3400 | - if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= $level) |
|
| 3401 | - cache_put_data($key, $cache_block, $cache_block['expires'] - time()); |
|
| 3579 | + if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= $level) { |
|
| 3580 | + cache_put_data($key, $cache_block, $cache_block['expires'] - time()); |
|
| 3581 | + } |
|
| 3402 | 3582 | } |
| 3403 | 3583 | |
| 3404 | 3584 | // Some cached data may need a freshening up after retrieval. |
| 3405 | - if (!empty($cache_block['post_retri_eval'])) |
|
| 3406 | - eval($cache_block['post_retri_eval']); |
|
| 3585 | + if (!empty($cache_block['post_retri_eval'])) { |
|
| 3586 | + eval($cache_block['post_retri_eval']); |
|
| 3587 | + } |
|
| 3407 | 3588 | |
| 3408 | - if (function_exists('call_integration_hook')) |
|
| 3409 | - call_integration_hook('post_cache_quick_get', array(&$cache_block)); |
|
| 3589 | + if (function_exists('call_integration_hook')) { |
|
| 3590 | + call_integration_hook('post_cache_quick_get', array(&$cache_block)); |
|
| 3591 | + } |
|
| 3410 | 3592 | |
| 3411 | 3593 | return $cache_block['data']; |
| 3412 | 3594 | } |
@@ -3433,8 +3615,9 @@ discard block |
||
| 3433 | 3615 | global $smcFunc, $cache_enable, $cacheAPI; |
| 3434 | 3616 | global $cache_hits, $cache_count, $db_show_debug; |
| 3435 | 3617 | |
| 3436 | - if (empty($cache_enable) || empty($cacheAPI)) |
|
| 3437 | - return; |
|
| 3618 | + if (empty($cache_enable) || empty($cacheAPI)) { |
|
| 3619 | + return; |
|
| 3620 | + } |
|
| 3438 | 3621 | |
| 3439 | 3622 | $cache_count = isset($cache_count) ? $cache_count + 1 : 1; |
| 3440 | 3623 | if (isset($db_show_debug) && $db_show_debug === true) |
@@ -3447,12 +3630,14 @@ discard block |
||
| 3447 | 3630 | $value = $value === null ? null : (isset($smcFunc['json_encode']) ? $smcFunc['json_encode']($value) : json_encode($value)); |
| 3448 | 3631 | $cacheAPI->putData($key, $value, $ttl); |
| 3449 | 3632 | |
| 3450 | - if (function_exists('call_integration_hook')) |
|
| 3451 | - call_integration_hook('cache_put_data', array(&$key, &$value, &$ttl)); |
|
| 3633 | + if (function_exists('call_integration_hook')) { |
|
| 3634 | + call_integration_hook('cache_put_data', array(&$key, &$value, &$ttl)); |
|
| 3635 | + } |
|
| 3452 | 3636 | |
| 3453 | - if (isset($db_show_debug) && $db_show_debug === true) |
|
| 3454 | - $cache_hits[$cache_count]['t'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st)); |
|
| 3455 | -} |
|
| 3637 | + if (isset($db_show_debug) && $db_show_debug === true) { |
|
| 3638 | + $cache_hits[$cache_count]['t'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st)); |
|
| 3639 | + } |
|
| 3640 | + } |
|
| 3456 | 3641 | |
| 3457 | 3642 | /** |
| 3458 | 3643 | * Gets the value from the cache specified by key, so long as it is not older than ttl seconds. |
@@ -3468,8 +3653,9 @@ discard block |
||
| 3468 | 3653 | global $smcFunc, $cache_enable, $cacheAPI; |
| 3469 | 3654 | global $cache_hits, $cache_count, $cache_misses, $cache_count_misses, $db_show_debug; |
| 3470 | 3655 | |
| 3471 | - if (empty($cache_enable) || empty($cacheAPI)) |
|
| 3472 | - return; |
|
| 3656 | + if (empty($cache_enable) || empty($cacheAPI)) { |
|
| 3657 | + return; |
|
| 3658 | + } |
|
| 3473 | 3659 | |
| 3474 | 3660 | $cache_count = isset($cache_count) ? $cache_count + 1 : 1; |
| 3475 | 3661 | if (isset($db_show_debug) && $db_show_debug === true) |
@@ -3489,16 +3675,18 @@ discard block |
||
| 3489 | 3675 | |
| 3490 | 3676 | if (empty($value)) |
| 3491 | 3677 | { |
| 3492 | - if (!is_array($cache_misses)) |
|
| 3493 | - $cache_misses = array(); |
|
| 3678 | + if (!is_array($cache_misses)) { |
|
| 3679 | + $cache_misses = array(); |
|
| 3680 | + } |
|
| 3494 | 3681 | |
| 3495 | 3682 | $cache_count_misses = isset($cache_count_misses) ? $cache_count_misses + 1 : 1; |
| 3496 | 3683 | $cache_misses[$cache_count_misses] = array('k' => $original_key, 'd' => 'get'); |
| 3497 | 3684 | } |
| 3498 | 3685 | } |
| 3499 | 3686 | |
| 3500 | - if (function_exists('call_integration_hook') && isset($value)) |
|
| 3501 | - call_integration_hook('cache_get_data', array(&$key, &$ttl, &$value)); |
|
| 3687 | + if (function_exists('call_integration_hook') && isset($value)) { |
|
| 3688 | + call_integration_hook('cache_get_data', array(&$key, &$ttl, &$value)); |
|
| 3689 | + } |
|
| 3502 | 3690 | |
| 3503 | 3691 | return empty($value) ? null : (isset($smcFunc['json_decode']) ? $smcFunc['json_decode']($value, true) : smf_json_decode($value, true)); |
| 3504 | 3692 | } |
@@ -3520,8 +3708,9 @@ discard block |
||
| 3520 | 3708 | global $cacheAPI; |
| 3521 | 3709 | |
| 3522 | 3710 | // If we can't get to the API, can't do this. |
| 3523 | - if (empty($cacheAPI)) |
|
| 3524 | - return; |
|
| 3711 | + if (empty($cacheAPI)) { |
|
| 3712 | + return; |
|
| 3713 | + } |
|
| 3525 | 3714 | |
| 3526 | 3715 | // Ask the API to do the heavy lifting. cleanCache also calls invalidateCache to be sure. |
| 3527 | 3716 | $cacheAPI->cleanCache($type); |
@@ -3546,8 +3735,9 @@ discard block |
||
| 3546 | 3735 | global $modSettings, $smcFunc, $image_proxy_enabled, $user_info; |
| 3547 | 3736 | |
| 3548 | 3737 | // Come on! |
| 3549 | - if (empty($data)) |
|
| 3550 | - return array(); |
|
| 3738 | + if (empty($data)) { |
|
| 3739 | + return array(); |
|
| 3740 | + } |
|
| 3551 | 3741 | |
| 3552 | 3742 | // Set a nice default var. |
| 3553 | 3743 | $image = ''; |
@@ -3555,11 +3745,11 @@ discard block |
||
| 3555 | 3745 | // Gravatar has been set as mandatory! |
| 3556 | 3746 | if (!empty($modSettings['gravatarOverride'])) |
| 3557 | 3747 | { |
| 3558 | - if (!empty($modSettings['gravatarAllowExtraEmail']) && !empty($data['avatar']) && stristr($data['avatar'], 'gravatar://')) |
|
| 3559 | - $image = get_gravatar_url($smcFunc['substr']($data['avatar'], 11)); |
|
| 3560 | - |
|
| 3561 | - else if (!empty($data['email'])) |
|
| 3562 | - $image = get_gravatar_url($data['email']); |
|
| 3748 | + if (!empty($modSettings['gravatarAllowExtraEmail']) && !empty($data['avatar']) && stristr($data['avatar'], 'gravatar://')) { |
|
| 3749 | + $image = get_gravatar_url($smcFunc['substr']($data['avatar'], 11)); |
|
| 3750 | + } else if (!empty($data['email'])) { |
|
| 3751 | + $image = get_gravatar_url($data['email']); |
|
| 3752 | + } |
|
| 3563 | 3753 | } |
| 3564 | 3754 | |
| 3565 | 3755 | // Look if the user has a gravatar field or has set an external url as avatar. |
@@ -3571,54 +3761,60 @@ discard block |
||
| 3571 | 3761 | // Gravatar. |
| 3572 | 3762 | if (stristr($data['avatar'], 'gravatar://')) |
| 3573 | 3763 | { |
| 3574 | - if ($data['avatar'] == 'gravatar://') |
|
| 3575 | - $image = get_gravatar_url($data['email']); |
|
| 3576 | - |
|
| 3577 | - elseif (!empty($modSettings['gravatarAllowExtraEmail'])) |
|
| 3578 | - $image = get_gravatar_url($smcFunc['substr']($data['avatar'], 11)); |
|
| 3764 | + if ($data['avatar'] == 'gravatar://') { |
|
| 3765 | + $image = get_gravatar_url($data['email']); |
|
| 3766 | + } elseif (!empty($modSettings['gravatarAllowExtraEmail'])) { |
|
| 3767 | + $image = get_gravatar_url($smcFunc['substr']($data['avatar'], 11)); |
|
| 3768 | + } |
|
| 3579 | 3769 | } |
| 3580 | 3770 | |
| 3581 | 3771 | // External url. |
| 3582 | 3772 | else |
| 3583 | 3773 | { |
| 3584 | 3774 | // Using ssl? |
| 3585 | - if (!empty($modSettings['force_ssl']) && $image_proxy_enabled && stripos($data['avatar'], 'http://') !== false && empty($user_info['possibly_robot'])) |
|
| 3586 | - $image = get_proxied_url($data['avatar']); |
|
| 3775 | + if (!empty($modSettings['force_ssl']) && $image_proxy_enabled && stripos($data['avatar'], 'http://') !== false && empty($user_info['possibly_robot'])) { |
|
| 3776 | + $image = get_proxied_url($data['avatar']); |
|
| 3777 | + } |
|
| 3587 | 3778 | |
| 3588 | 3779 | // Just a plain external url. |
| 3589 | - else |
|
| 3590 | - $image = (stristr($data['avatar'], 'http://') || stristr($data['avatar'], 'https://')) ? $data['avatar'] : $modSettings['avatar_url'] . '/' . $data['avatar']; |
|
| 3780 | + else { |
|
| 3781 | + $image = (stristr($data['avatar'], 'http://') || stristr($data['avatar'], 'https://')) ? $data['avatar'] : $modSettings['avatar_url'] . '/' . $data['avatar']; |
|
| 3782 | + } |
|
| 3591 | 3783 | } |
| 3592 | 3784 | } |
| 3593 | 3785 | |
| 3594 | 3786 | // Perhaps this user has an attachment as avatar... |
| 3595 | - else if (!empty($data['filename'])) |
|
| 3596 | - $image = $modSettings['custom_avatar_url'] . '/' . $data['filename']; |
|
| 3787 | + else if (!empty($data['filename'])) { |
|
| 3788 | + $image = $modSettings['custom_avatar_url'] . '/' . $data['filename']; |
|
| 3789 | + } |
|
| 3597 | 3790 | |
| 3598 | 3791 | // Right... no avatar... use our default image. |
| 3599 | - else |
|
| 3600 | - $image = $modSettings['avatar_url'] . '/default.png'; |
|
| 3792 | + else { |
|
| 3793 | + $image = $modSettings['avatar_url'] . '/default.png'; |
|
| 3794 | + } |
|
| 3601 | 3795 | } |
| 3602 | 3796 | |
| 3603 | 3797 | call_integration_hook('integrate_set_avatar_data', array(&$image, &$data)); |
| 3604 | 3798 | |
| 3605 | 3799 | // At this point in time $image has to be filled unless you chose to force gravatar and the user doesn't have the needed data to retrieve it... thus a check for !empty() is still needed. |
| 3606 | - if (!empty($image)) |
|
| 3607 | - return array( |
|
| 3800 | + if (!empty($image)) { |
|
| 3801 | + return array( |
|
| 3608 | 3802 | 'name' => !empty($data['avatar']) ? $data['avatar'] : '', |
| 3609 | 3803 | 'image' => '<img class="avatar" src="' . $image . '" />', |
| 3610 | 3804 | 'href' => $image, |
| 3611 | 3805 | 'url' => $image, |
| 3612 | 3806 | ); |
| 3807 | + } |
|
| 3613 | 3808 | |
| 3614 | 3809 | // Fallback to make life easier for everyone... |
| 3615 | - else |
|
| 3616 | - return array( |
|
| 3810 | + else { |
|
| 3811 | + return array( |
|
| 3617 | 3812 | 'name' => '', |
| 3618 | 3813 | 'image' => '', |
| 3619 | 3814 | 'href' => '', |
| 3620 | 3815 | 'url' => '', |
| 3621 | 3816 | ); |
| 3622 | -} |
|
| 3817 | + } |
|
| 3818 | + } |
|
| 3623 | 3819 | |
| 3624 | 3820 | ?> |
| 3625 | 3821 | \ No newline at end of file |
@@ -18,23 +18,25 @@ discard block |
||
| 18 | 18 | global $context; |
| 19 | 19 | |
| 20 | 20 | // Prevent Chrome from auto completing fields when viewing/editing other members profiles |
| 21 | - if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
|
| 22 | - echo ' |
|
| 21 | + if (isBrowser('is_chrome') && !$context['user']['is_owner']) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <script> |
| 24 | 24 | disableAutoComplete(); |
| 25 | 25 | </script>'; |
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | // If an error occurred while trying to save previously, give the user a clue! |
| 28 | 29 | echo ' |
| 29 | 30 | ', template_error_message(); |
| 30 | 31 | |
| 31 | 32 | // If the profile was update successfully, let the user know this. |
| 32 | - if (!empty($context['profile_updated'])) |
|
| 33 | - echo ' |
|
| 33 | + if (!empty($context['profile_updated'])) { |
|
| 34 | + echo ' |
|
| 34 | 35 | <div class="infobox"> |
| 35 | 36 | ', $context['profile_updated'], ' |
| 36 | 37 | </div>'; |
| 37 | -} |
|
| 38 | + } |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | /** |
| 40 | 42 | * Template for any HTML needed below the profile (closing off divs/tables, etc.) |
@@ -99,19 +101,19 @@ discard block |
||
| 99 | 101 | </div> |
| 100 | 102 | <div class="alerts_unread">'; |
| 101 | 103 | |
| 102 | - if (empty($context['unread_alerts'])) |
|
| 103 | - template_alerts_all_read(); |
|
| 104 | - |
|
| 105 | - else |
|
| 104 | + if (empty($context['unread_alerts'])) { |
|
| 105 | + template_alerts_all_read(); |
|
| 106 | + } else |
|
| 106 | 107 | { |
| 107 | - foreach ($context['unread_alerts'] as $id_alert => $details) |
|
| 108 | - echo ' |
|
| 108 | + foreach ($context['unread_alerts'] as $id_alert => $details) { |
|
| 109 | + echo ' |
|
| 109 | 110 | <div class="unread"> |
| 110 | 111 | ', !empty($details['sender']) ? $details['sender']['avatar']['image'] : '', ' |
| 111 | 112 | <div class="details"> |
| 112 | 113 | ', !empty($details['icon']) ? $details['icon'] : '', '<span>', $details['text'], '</span> - ', $details['time'], ' |
| 113 | 114 | </div> |
| 114 | 115 | </div>'; |
| 116 | + } |
|
| 115 | 117 | } |
| 116 | 118 | |
| 117 | 119 | echo ' |
@@ -158,37 +160,41 @@ discard block |
||
| 158 | 160 | if (!empty($context['print_custom_fields']['above_member'])) |
| 159 | 161 | { |
| 160 | 162 | $fields = ''; |
| 161 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
| 162 | - if (!empty($field['output_html'])) |
|
| 163 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
| 164 | + if (!empty($field['output_html'])) |
|
| 163 | 165 | $fields .= ' |
| 164 | 166 | <li>' . $field['output_html'] . '</li>'; |
| 167 | + } |
|
| 165 | 168 | |
| 166 | - if (!empty($fields)) |
|
| 167 | - echo ' |
|
| 169 | + if (!empty($fields)) { |
|
| 170 | + echo ' |
|
| 168 | 171 | <div class="custom_fields_above_name"> |
| 169 | 172 | <ul>', $fields, ' |
| 170 | 173 | </ul> |
| 171 | 174 | </div>'; |
| 175 | + } |
|
| 172 | 176 | } |
| 173 | 177 | |
| 174 | 178 | echo ' |
| 175 | 179 | <div class="username clear"> |
| 176 | 180 | <h4>'; |
| 177 | 181 | |
| 178 | - if (!empty($context['print_custom_fields']['before_member'])) |
|
| 179 | - foreach ($context['print_custom_fields']['before_member'] as $field) |
|
| 182 | + if (!empty($context['print_custom_fields']['before_member'])) { |
|
| 183 | + foreach ($context['print_custom_fields']['before_member'] as $field) |
|
| 180 | 184 | if (!empty($field['output_html'])) |
| 181 | 185 | echo ' |
| 182 | 186 | <span>', $field['output_html'], '</span>'; |
| 187 | + } |
|
| 183 | 188 | |
| 184 | 189 | echo ' |
| 185 | 190 | ', $context['member']['name']; |
| 186 | 191 | |
| 187 | - if (!empty($context['print_custom_fields']['after_member'])) |
|
| 188 | - foreach ($context['print_custom_fields']['after_member'] as $field) |
|
| 192 | + if (!empty($context['print_custom_fields']['after_member'])) { |
|
| 193 | + foreach ($context['print_custom_fields']['after_member'] as $field) |
|
| 189 | 194 | if (!empty($field['output_html'])) |
| 190 | 195 | echo ' |
| 191 | 196 | <span>', $field['output_html'], '</span>'; |
| 197 | + } |
|
| 192 | 198 | |
| 193 | 199 | |
| 194 | 200 | echo ' |
@@ -201,39 +207,44 @@ discard block |
||
| 201 | 207 | if (!empty($context['print_custom_fields']['below_avatar'])) |
| 202 | 208 | { |
| 203 | 209 | $fields = ''; |
| 204 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
| 205 | - if (!empty($field['output_html'])) |
|
| 210 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
| 211 | + if (!empty($field['output_html'])) |
|
| 206 | 212 | $fields .= ' |
| 207 | 213 | <li>' . $field['output_html'] . '</li>'; |
| 214 | + } |
|
| 208 | 215 | |
| 209 | - if (!empty($fields)) |
|
| 210 | - echo ' |
|
| 216 | + if (!empty($fields)) { |
|
| 217 | + echo ' |
|
| 211 | 218 | <div class="custom_fields_below_avatar"> |
| 212 | 219 | <ul>', $fields, ' |
| 213 | 220 | </ul> |
| 214 | 221 | </div>'; |
| 222 | + } |
|
| 215 | 223 | } |
| 216 | 224 | |
| 217 | 225 | echo ' |
| 218 | 226 | <ul class="icon_fields clear">'; |
| 219 | 227 | |
| 220 | 228 | // Email is only visible if it's your profile or you have the moderate_forum permission |
| 221 | - if ($context['member']['show_email']) |
|
| 222 | - echo ' |
|
| 229 | + if ($context['member']['show_email']) { |
|
| 230 | + echo ' |
|
| 223 | 231 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
| 232 | + } |
|
| 224 | 233 | |
| 225 | 234 | // Don't show an icon if they haven't specified a website. |
| 226 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
| 227 | - echo ' |
|
| 235 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
| 236 | + echo ' |
|
| 228 | 237 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 238 | + } |
|
| 229 | 239 | |
| 230 | 240 | // Are there any custom profile fields as icons? |
| 231 | 241 | if (!empty($context['print_custom_fields']['icons'])) |
| 232 | 242 | { |
| 233 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
| 234 | - if (!empty($field['output_html'])) |
|
| 243 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
| 244 | + if (!empty($field['output_html'])) |
|
| 235 | 245 | echo ' |
| 236 | 246 | <li class="custom_field">', $field['output_html'], '</li>'; |
| 247 | + } |
|
| 237 | 248 | } |
| 238 | 249 | |
| 239 | 250 | echo ' |
@@ -242,24 +253,27 @@ discard block |
||
| 242 | 253 | ', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
| 243 | 254 | |
| 244 | 255 | // Can they add this member as a buddy? |
| 245 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
| 246 | - echo ' |
|
| 256 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
| 257 | + echo ' |
|
| 247 | 258 | <br> |
| 248 | 259 | <a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], '</a>'; |
| 260 | + } |
|
| 249 | 261 | |
| 250 | 262 | echo ' |
| 251 | 263 | </span>'; |
| 252 | 264 | |
| 253 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
| 254 | - echo ' |
|
| 265 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
| 266 | + echo ' |
|
| 255 | 267 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
| 268 | + } |
|
| 256 | 269 | |
| 257 | 270 | echo ' |
| 258 | 271 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
| 259 | 272 | |
| 260 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
| 261 | - echo ' |
|
| 273 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
| 274 | + echo ' |
|
| 262 | 275 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
| 276 | + } |
|
| 263 | 277 | |
| 264 | 278 | echo ' |
| 265 | 279 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -268,17 +282,19 @@ discard block |
||
| 268 | 282 | if (!empty($context['print_custom_fields']['bottom_poster'])) |
| 269 | 283 | { |
| 270 | 284 | $fields = ''; |
| 271 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
| 272 | - if (!empty($field['output_html'])) |
|
| 285 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
| 286 | + if (!empty($field['output_html'])) |
|
| 273 | 287 | $fields .= ' |
| 274 | 288 | <li>' . $field['output_html'] . '</li>'; |
| 289 | + } |
|
| 275 | 290 | |
| 276 | - if (!empty($fields)) |
|
| 277 | - echo ' |
|
| 291 | + if (!empty($fields)) { |
|
| 292 | + echo ' |
|
| 278 | 293 | <div class="custom_fields_bottom"> |
| 279 | 294 | <ul class="nolist">', $fields, ' |
| 280 | 295 | </ul> |
| 281 | 296 | </div>'; |
| 297 | + } |
|
| 282 | 298 | } |
| 283 | 299 | |
| 284 | 300 | echo ' |
@@ -287,30 +303,35 @@ discard block |
||
| 287 | 303 | <div id="detailedinfo"> |
| 288 | 304 | <dl class="settings">'; |
| 289 | 305 | |
| 290 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
| 291 | - echo ' |
|
| 306 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
| 307 | + echo ' |
|
| 292 | 308 | <dt>', $txt['username'], ': </dt> |
| 293 | 309 | <dd>', $context['member']['username'], '</dd>'; |
| 310 | + } |
|
| 294 | 311 | |
| 295 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 296 | - echo ' |
|
| 312 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 313 | + echo ' |
|
| 297 | 314 | <dt>', $txt['profile_posts'], ': </dt> |
| 298 | 315 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
| 316 | + } |
|
| 299 | 317 | |
| 300 | - if ($context['member']['show_email']) |
|
| 301 | - echo ' |
|
| 318 | + if ($context['member']['show_email']) { |
|
| 319 | + echo ' |
|
| 302 | 320 | <dt>', $txt['email'], ': </dt> |
| 303 | 321 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
| 322 | + } |
|
| 304 | 323 | |
| 305 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
| 306 | - echo ' |
|
| 324 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
| 325 | + echo ' |
|
| 307 | 326 | <dt>', $txt['custom_title'], ': </dt> |
| 308 | 327 | <dd>', $context['member']['title'], '</dd>'; |
| 328 | + } |
|
| 309 | 329 | |
| 310 | - if (!empty($context['member']['blurb'])) |
|
| 311 | - echo ' |
|
| 330 | + if (!empty($context['member']['blurb'])) { |
|
| 331 | + echo ' |
|
| 312 | 332 | <dt>', $txt['personal_text'], ': </dt> |
| 313 | 333 | <dd>', $context['member']['blurb'], '</dd>'; |
| 334 | + } |
|
| 314 | 335 | |
| 315 | 336 | echo ' |
| 316 | 337 | <dt>', $txt['age'], ':</dt> |
@@ -324,19 +345,21 @@ discard block |
||
| 324 | 345 | { |
| 325 | 346 | $fields = array(); |
| 326 | 347 | |
| 327 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
| 328 | - if (!empty($field['output_html'])) |
|
| 348 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
| 349 | + if (!empty($field['output_html'])) |
|
| 329 | 350 | $fields[] = $field; |
| 351 | + } |
|
| 330 | 352 | |
| 331 | 353 | if (count($fields) > 0) |
| 332 | 354 | { |
| 333 | 355 | echo ' |
| 334 | 356 | <dl class="settings">'; |
| 335 | 357 | |
| 336 | - foreach ($fields as $field) |
|
| 337 | - echo ' |
|
| 358 | + foreach ($fields as $field) { |
|
| 359 | + echo ' |
|
| 338 | 360 | <dt>', $field['name'], ':</dt> |
| 339 | 361 | <dd>', $field['output_html'], '</dd>'; |
| 362 | + } |
|
| 340 | 363 | |
| 341 | 364 | echo ' |
| 342 | 365 | </dl>'; |
@@ -355,9 +378,10 @@ discard block |
||
| 355 | 378 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
| 356 | 379 | |
| 357 | 380 | // Can we provide information on what this means? |
| 358 | - if (!empty($context['warning_status'])) |
|
| 359 | - echo ' |
|
| 381 | + if (!empty($context['warning_status'])) { |
|
| 382 | + echo ' |
|
| 360 | 383 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
| 384 | + } |
|
| 361 | 385 | |
| 362 | 386 | echo ' |
| 363 | 387 | </dd>'; |
@@ -367,11 +391,12 @@ discard block |
||
| 367 | 391 | if (!empty($context['activate_message']) || !empty($context['member']['bans'])) |
| 368 | 392 | { |
| 369 | 393 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
| 370 | - if (!empty($context['activate_message'])) |
|
| 371 | - echo ' |
|
| 394 | + if (!empty($context['activate_message'])) { |
|
| 395 | + echo ' |
|
| 372 | 396 | <dt class="clear"> |
| 373 | 397 | <span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>) |
| 374 | 398 | </dt>'; |
| 399 | + } |
|
| 375 | 400 | |
| 376 | 401 | // If the current member is banned, show a message and possibly a link to the ban. |
| 377 | 402 | if (!empty($context['member']['bans'])) |
@@ -383,10 +408,11 @@ discard block |
||
| 383 | 408 | <dt class="clear hidden" id="ban_info"> |
| 384 | 409 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
| 385 | 410 | |
| 386 | - foreach ($context['member']['bans'] as $ban) |
|
| 387 | - echo ' |
|
| 411 | + foreach ($context['member']['bans'] as $ban) { |
|
| 412 | + echo ' |
|
| 388 | 413 | <br> |
| 389 | 414 | <span class="smalltext">', $ban['explanation'], '</span>'; |
| 415 | + } |
|
| 390 | 416 | |
| 391 | 417 | echo ' |
| 392 | 418 | </dt>'; |
@@ -400,30 +426,34 @@ discard block |
||
| 400 | 426 | // If the person looking is allowed, they can check the members IP address and hostname. |
| 401 | 427 | if ($context['can_see_ip']) |
| 402 | 428 | { |
| 403 | - if (!empty($context['member']['ip'])) |
|
| 404 | - echo ' |
|
| 429 | + if (!empty($context['member']['ip'])) { |
|
| 430 | + echo ' |
|
| 405 | 431 | <dt>', $txt['ip'], ': </dt> |
| 406 | 432 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
| 433 | + } |
|
| 407 | 434 | |
| 408 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
| 409 | - echo ' |
|
| 435 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
| 436 | + echo ' |
|
| 410 | 437 | <dt>', $txt['hostname'], ': </dt> |
| 411 | 438 | <dd>', $context['member']['hostname'], '</dd>'; |
| 439 | + } |
|
| 412 | 440 | } |
| 413 | 441 | |
| 414 | 442 | echo ' |
| 415 | 443 | <dt>', $txt['local_time'], ':</dt> |
| 416 | 444 | <dd>', $context['member']['local_time'], '</dd>'; |
| 417 | 445 | |
| 418 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
| 419 | - echo ' |
|
| 446 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
| 447 | + echo ' |
|
| 420 | 448 | <dt>', $txt['language'], ':</dt> |
| 421 | 449 | <dd>', $context['member']['language'], '</dd>'; |
| 450 | + } |
|
| 422 | 451 | |
| 423 | - if ($context['member']['show_last_login']) |
|
| 424 | - echo ' |
|
| 452 | + if ($context['member']['show_last_login']) { |
|
| 453 | + echo ' |
|
| 425 | 454 | <dt>', $txt['lastLoggedIn'], ': </dt> |
| 426 | 455 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
| 456 | + } |
|
| 427 | 457 | |
| 428 | 458 | echo ' |
| 429 | 459 | </dl>'; |
@@ -432,42 +462,47 @@ discard block |
||
| 432 | 462 | if (!empty($context['print_custom_fields']['above_signature'])) |
| 433 | 463 | { |
| 434 | 464 | $fields = ''; |
| 435 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
| 436 | - if (!empty($field['output_html'])) |
|
| 465 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
| 466 | + if (!empty($field['output_html'])) |
|
| 437 | 467 | $fields .= ' |
| 438 | 468 | <li>' . $field['output_html'] . '</li>'; |
| 469 | + } |
|
| 439 | 470 | |
| 440 | - if (!empty($fields)) |
|
| 441 | - echo ' |
|
| 471 | + if (!empty($fields)) { |
|
| 472 | + echo ' |
|
| 442 | 473 | <div class="custom_fields_above_signature"> |
| 443 | 474 | <ul class="nolist">', $fields, ' |
| 444 | 475 | </ul> |
| 445 | 476 | </div>'; |
| 477 | + } |
|
| 446 | 478 | } |
| 447 | 479 | |
| 448 | 480 | // Show the users signature. |
| 449 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
| 450 | - echo ' |
|
| 481 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
| 482 | + echo ' |
|
| 451 | 483 | <div class="signature"> |
| 452 | 484 | <h5>', $txt['signature'], ':</h5> |
| 453 | 485 | ', $context['member']['signature'], ' |
| 454 | 486 | </div>'; |
| 487 | + } |
|
| 455 | 488 | |
| 456 | 489 | // Are there any custom profile fields for below the signature? |
| 457 | 490 | if (!empty($context['print_custom_fields']['below_signature'])) |
| 458 | 491 | { |
| 459 | 492 | $fields = ''; |
| 460 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
| 461 | - if (!empty($field['output_html'])) |
|
| 493 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
| 494 | + if (!empty($field['output_html'])) |
|
| 462 | 495 | $fields .= ' |
| 463 | 496 | <li>' . $field['output_html'] . '</li>'; |
| 497 | + } |
|
| 464 | 498 | |
| 465 | - if (!empty($fields)) |
|
| 466 | - echo ' |
|
| 499 | + if (!empty($fields)) { |
|
| 500 | + echo ' |
|
| 467 | 501 | <div class="custom_fields_below_signature"> |
| 468 | 502 | <ul class="nolist">', $fields, ' |
| 469 | 503 | </ul> |
| 470 | 504 | </div>'; |
| 505 | + } |
|
| 471 | 506 | } |
| 472 | 507 | |
| 473 | 508 | echo ' |
@@ -509,62 +544,70 @@ discard block |
||
| 509 | 544 | </div> |
| 510 | 545 | <div class="list_posts">'; |
| 511 | 546 | |
| 512 | - if (!$post['approved']) |
|
| 513 | - echo ' |
|
| 547 | + if (!$post['approved']) { |
|
| 548 | + echo ' |
|
| 514 | 549 | <div class="approve_post"> |
| 515 | 550 | <em>', $txt['post_awaiting_approval'], '</em> |
| 516 | 551 | </div>'; |
| 552 | + } |
|
| 517 | 553 | |
| 518 | 554 | echo ' |
| 519 | 555 | ', $post['body'], ' |
| 520 | 556 | </div>'; |
| 521 | 557 | |
| 522 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 523 | - echo ' |
|
| 558 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 559 | + echo ' |
|
| 524 | 560 | <div class="floatright"> |
| 525 | 561 | <ul class="quickbuttons">'; |
| 562 | + } |
|
| 526 | 563 | |
| 527 | 564 | // If they *can* reply? |
| 528 | - if ($post['can_reply']) |
|
| 529 | - echo ' |
|
| 565 | + if ($post['can_reply']) { |
|
| 566 | + echo ' |
|
| 530 | 567 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
| 568 | + } |
|
| 531 | 569 | |
| 532 | 570 | // If they *can* quote? |
| 533 | - if ($post['can_quote']) |
|
| 534 | - echo ' |
|
| 571 | + if ($post['can_quote']) { |
|
| 572 | + echo ' |
|
| 535 | 573 | <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
| 574 | + } |
|
| 536 | 575 | |
| 537 | 576 | // How about... even... remove it entirely?! |
| 538 | - if ($post['can_delete']) |
|
| 539 | - echo ' |
|
| 577 | + if ($post['can_delete']) { |
|
| 578 | + echo ' |
|
| 540 | 579 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 580 | + } |
|
| 541 | 581 | |
| 542 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 543 | - echo ' |
|
| 582 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 583 | + echo ' |
|
| 544 | 584 | </ul> |
| 545 | 585 | </div><!-- .floatright -->'; |
| 586 | + } |
|
| 546 | 587 | |
| 547 | 588 | echo ' |
| 548 | 589 | </div><!-- $post[css_class] -->'; |
| 549 | 590 | } |
| 591 | + } else { |
|
| 592 | + template_show_list('attachments'); |
|
| 550 | 593 | } |
| 551 | - else |
|
| 552 | - template_show_list('attachments'); |
|
| 553 | 594 | |
| 554 | 595 | // No posts? Just end with a informative message. |
| 555 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
| 556 | - echo ' |
|
| 596 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
| 597 | + echo ' |
|
| 557 | 598 | <div class="windowbg"> |
| 558 | 599 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
| 559 | 600 | </div>'; |
| 601 | + } |
|
| 560 | 602 | |
| 561 | 603 | // Show more page numbers. |
| 562 | - if (!empty($context['page_index'])) |
|
| 563 | - echo ' |
|
| 604 | + if (!empty($context['page_index'])) { |
|
| 605 | + echo ' |
|
| 564 | 606 | <div class="pagesection"> |
| 565 | 607 | <div class="pagelinks">', $context['page_index'], '</div> |
| 566 | 608 | </div>'; |
| 567 | -} |
|
| 609 | + } |
|
| 610 | + } |
|
| 568 | 611 | |
| 569 | 612 | /** |
| 570 | 613 | * Template for showing alerts within the alerts popup |
@@ -574,11 +617,12 @@ discard block |
||
| 574 | 617 | global $context, $txt, $scripturl; |
| 575 | 618 | |
| 576 | 619 | // Do we have an update message? |
| 577 | - if (!empty($context['update_message'])) |
|
| 578 | - echo ' |
|
| 620 | + if (!empty($context['update_message'])) { |
|
| 621 | + echo ' |
|
| 579 | 622 | <div class="infobox"> |
| 580 | 623 | ', $context['update_message'], ' |
| 581 | 624 | </div>'; |
| 625 | + } |
|
| 582 | 626 | |
| 583 | 627 | echo ' |
| 584 | 628 | <div class="cat_bar"> |
@@ -587,18 +631,18 @@ discard block |
||
| 587 | 631 | </h3> |
| 588 | 632 | </div>'; |
| 589 | 633 | |
| 590 | - if (empty($context['alerts'])) |
|
| 591 | - echo ' |
|
| 634 | + if (empty($context['alerts'])) { |
|
| 635 | + echo ' |
|
| 592 | 636 | <div class="information"> |
| 593 | 637 | ', $txt['alerts_none'], ' |
| 594 | 638 | </div>'; |
| 595 | - |
|
| 596 | - else |
|
| 639 | + } else |
|
| 597 | 640 | { |
| 598 | 641 | // Start the form if checkboxes are in use |
| 599 | - if ($context['showCheckboxes']) |
|
| 600 | - echo ' |
|
| 642 | + if ($context['showCheckboxes']) { |
|
| 643 | + echo ' |
|
| 601 | 644 | <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;save" method="post" accept-charset="', $context['character_set'], '" id="mark_all">'; |
| 645 | + } |
|
| 602 | 646 | |
| 603 | 647 | echo ' |
| 604 | 648 | <table id="alerts" class="table_grid">'; |
@@ -617,9 +661,10 @@ discard block |
||
| 617 | 661 | <li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=remove;aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li> |
| 618 | 662 | <li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=', ($alert['is_read'] != 0 ? 'unread' : 'read'), ';aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons ', $alert['is_read'] != 0 ? 'unread_button' : 'read_button', '"></span>', ($alert['is_read'] != 0 ? $txt['mark_unread'] : $txt['mark_read_short']), '</a></li>'; |
| 619 | 663 | |
| 620 | - if ($context['showCheckboxes']) |
|
| 621 | - echo ' |
|
| 664 | + if ($context['showCheckboxes']) { |
|
| 665 | + echo ' |
|
| 622 | 666 | <li><input type="checkbox" name="mark[', $id, ']" value="', $id, '"></li>'; |
| 667 | + } |
|
| 623 | 668 | |
| 624 | 669 | echo ' |
| 625 | 670 | </ul> |
@@ -634,8 +679,8 @@ discard block |
||
| 634 | 679 | ', $context['pagination'], ' |
| 635 | 680 | </div>'; |
| 636 | 681 | |
| 637 | - if ($context['showCheckboxes']) |
|
| 638 | - echo ' |
|
| 682 | + if ($context['showCheckboxes']) { |
|
| 683 | + echo ' |
|
| 639 | 684 | <div class="floatright"> |
| 640 | 685 | ', $txt['check_all'], ': <input type="checkbox" name="select_all" id="select_all"> |
| 641 | 686 | <select name="mark_as"> |
@@ -646,14 +691,16 @@ discard block |
||
| 646 | 691 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 647 | 692 | <input type="submit" name="req" value="', $txt['quick_mod_go'], '" class="button you_sure"> |
| 648 | 693 | </div>'; |
| 694 | + } |
|
| 649 | 695 | |
| 650 | 696 | echo ' |
| 651 | 697 | </div>'; |
| 652 | 698 | |
| 653 | - if ($context['showCheckboxes']) |
|
| 654 | - echo ' |
|
| 699 | + if ($context['showCheckboxes']) { |
|
| 700 | + echo ' |
|
| 655 | 701 | </form>'; |
| 656 | 702 | } |
| 703 | + } |
|
| 657 | 704 | } |
| 658 | 705 | |
| 659 | 706 | /** |
@@ -674,12 +721,12 @@ discard block |
||
| 674 | 721 | </div>' : ''; |
| 675 | 722 | |
| 676 | 723 | // No drafts? Just show an informative message. |
| 677 | - if (empty($context['drafts'])) |
|
| 678 | - echo ' |
|
| 724 | + if (empty($context['drafts'])) { |
|
| 725 | + echo ' |
|
| 679 | 726 | <div class="windowbg centertext"> |
| 680 | 727 | ', $txt['draft_none'], ' |
| 681 | 728 | </div>'; |
| 682 | - else |
|
| 729 | + } else |
|
| 683 | 730 | { |
| 684 | 731 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
| 685 | 732 | foreach ($context['drafts'] as $draft) |
@@ -691,13 +738,15 @@ discard block |
||
| 691 | 738 | <h5> |
| 692 | 739 | <strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
| 693 | 740 | |
| 694 | - if (!empty($draft['sticky'])) |
|
| 695 | - echo ' |
|
| 741 | + if (!empty($draft['sticky'])) { |
|
| 742 | + echo ' |
|
| 696 | 743 | <span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
| 744 | + } |
|
| 697 | 745 | |
| 698 | - if (!empty($draft['locked'])) |
|
| 699 | - echo ' |
|
| 746 | + if (!empty($draft['locked'])) { |
|
| 747 | + echo ' |
|
| 700 | 748 | <span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
| 749 | + } |
|
| 701 | 750 | |
| 702 | 751 | echo ' |
| 703 | 752 | </h5> |
@@ -730,13 +779,13 @@ discard block |
||
| 730 | 779 | { |
| 731 | 780 | global $context, $scripturl, $txt; |
| 732 | 781 | |
| 733 | - if (!empty($context['saved_successful'])) |
|
| 734 | - echo ' |
|
| 782 | + if (!empty($context['saved_successful'])) { |
|
| 783 | + echo ' |
|
| 735 | 784 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
| 736 | - |
|
| 737 | - elseif (!empty($context['saved_failed'])) |
|
| 738 | - echo ' |
|
| 785 | + } elseif (!empty($context['saved_failed'])) { |
|
| 786 | + echo ' |
|
| 739 | 787 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
| 788 | + } |
|
| 740 | 789 | |
| 741 | 790 | echo ' |
| 742 | 791 | <div id="edit_buddies"> |
@@ -751,14 +800,16 @@ discard block |
||
| 751 | 800 | <th scope="col" class="quarter_table buddy_link">', $txt['name'], '</th> |
| 752 | 801 | <th scope="col" class="buddy_status">', $txt['status'], '</th>'; |
| 753 | 802 | |
| 754 | - if ($context['can_moderate_forum']) |
|
| 755 | - echo ' |
|
| 803 | + if ($context['can_moderate_forum']) { |
|
| 804 | + echo ' |
|
| 756 | 805 | <th scope="col" class="buddy_email">', $txt['email'], '</th>'; |
| 806 | + } |
|
| 757 | 807 | |
| 758 | - if (!empty($context['custom_pf'])) |
|
| 759 | - foreach ($context['custom_pf'] as $column) |
|
| 808 | + if (!empty($context['custom_pf'])) { |
|
| 809 | + foreach ($context['custom_pf'] as $column) |
|
| 760 | 810 | echo ' |
| 761 | 811 | <th scope="col" class="buddy_custom_fields">', $column['label'], '</th>'; |
| 812 | + } |
|
| 762 | 813 | |
| 763 | 814 | echo ' |
| 764 | 815 | <th scope="col" class="buddy_remove">', $txt['remove'], '</th> |
@@ -767,13 +818,14 @@ discard block |
||
| 767 | 818 | <tbody>'; |
| 768 | 819 | |
| 769 | 820 | // If they don't have any buddies don't list them! |
| 770 | - if (empty($context['buddies'])) |
|
| 771 | - echo ' |
|
| 821 | + if (empty($context['buddies'])) { |
|
| 822 | + echo ' |
|
| 772 | 823 | <tr class="windowbg"> |
| 773 | 824 | <td colspan="', $context['can_moderate_forum'] ? '10' : '9', '"> |
| 774 | 825 | <strong>', $txt['no_buddies'], '</strong> |
| 775 | 826 | </td> |
| 776 | 827 | </tr>'; |
| 828 | + } |
|
| 777 | 829 | |
| 778 | 830 | // Now loop through each buddy showing info on each. |
| 779 | 831 | else |
@@ -787,17 +839,19 @@ discard block |
||
| 787 | 839 | <a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a> |
| 788 | 840 | </td>'; |
| 789 | 841 | |
| 790 | - if ($buddy['show_email']) |
|
| 791 | - echo ' |
|
| 842 | + if ($buddy['show_email']) { |
|
| 843 | + echo ' |
|
| 792 | 844 | <td class="buddy_email centertext"> |
| 793 | 845 | <a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a> |
| 794 | 846 | </td>'; |
| 847 | + } |
|
| 795 | 848 | |
| 796 | 849 | // Show the custom profile fields for this user. |
| 797 | - if (!empty($context['custom_pf'])) |
|
| 798 | - foreach ($context['custom_pf'] as $key => $column) |
|
| 850 | + if (!empty($context['custom_pf'])) { |
|
| 851 | + foreach ($context['custom_pf'] as $key => $column) |
|
| 799 | 852 | echo ' |
| 800 | 853 | <td class="lefttext buddy_custom_fields">', $buddy['options'][$key], '</td>'; |
| 854 | + } |
|
| 801 | 855 | |
| 802 | 856 | echo ' |
| 803 | 857 | <td class="centertext buddy_remove"> |
@@ -830,9 +884,10 @@ discard block |
||
| 830 | 884 | </dl> |
| 831 | 885 | </div>'; |
| 832 | 886 | |
| 833 | - if (!empty($context['token_check'])) |
|
| 834 | - echo ' |
|
| 887 | + if (!empty($context['token_check'])) { |
|
| 888 | + echo ' |
|
| 835 | 889 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 890 | + } |
|
| 836 | 891 | |
| 837 | 892 | echo ' |
| 838 | 893 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -858,13 +913,13 @@ discard block |
||
| 858 | 913 | { |
| 859 | 914 | global $context, $scripturl, $txt; |
| 860 | 915 | |
| 861 | - if (!empty($context['saved_successful'])) |
|
| 862 | - echo ' |
|
| 916 | + if (!empty($context['saved_successful'])) { |
|
| 917 | + echo ' |
|
| 863 | 918 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
| 864 | - |
|
| 865 | - elseif (!empty($context['saved_failed'])) |
|
| 866 | - echo ' |
|
| 919 | + } elseif (!empty($context['saved_failed'])) { |
|
| 920 | + echo ' |
|
| 867 | 921 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
| 922 | + } |
|
| 868 | 923 | |
| 869 | 924 | echo ' |
| 870 | 925 | <div id="edit_buddies"> |
@@ -879,9 +934,10 @@ discard block |
||
| 879 | 934 | <th scope="col" class="quarter_table buddy_link">', $txt['name'], '</th> |
| 880 | 935 | <th scope="col" class="buddy_status">', $txt['status'], '</th>'; |
| 881 | 936 | |
| 882 | - if ($context['can_moderate_forum']) |
|
| 883 | - echo ' |
|
| 937 | + if ($context['can_moderate_forum']) { |
|
| 938 | + echo ' |
|
| 884 | 939 | <th scope="col" class="buddy_email">', $txt['email'], '</th>'; |
| 940 | + } |
|
| 885 | 941 | |
| 886 | 942 | echo ' |
| 887 | 943 | <th scope="col" class="buddy_remove">', $txt['ignore_remove'], '</th> |
@@ -890,13 +946,14 @@ discard block |
||
| 890 | 946 | <tbody>'; |
| 891 | 947 | |
| 892 | 948 | // If they don't have anyone on their ignore list, don't list it! |
| 893 | - if (empty($context['ignore_list'])) |
|
| 894 | - echo ' |
|
| 949 | + if (empty($context['ignore_list'])) { |
|
| 950 | + echo ' |
|
| 895 | 951 | <tr class="windowbg"> |
| 896 | 952 | <td colspan="', $context['can_moderate_forum'] ? '4' : '3', '"> |
| 897 | 953 | <strong>', $txt['no_ignore'], '</strong> |
| 898 | 954 | </td> |
| 899 | 955 | </tr>'; |
| 956 | + } |
|
| 900 | 957 | |
| 901 | 958 | // Now loop through each buddy showing info on each. |
| 902 | 959 | foreach ($context['ignore_list'] as $member) |
@@ -908,11 +965,12 @@ discard block |
||
| 908 | 965 | <a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a> |
| 909 | 966 | </td>'; |
| 910 | 967 | |
| 911 | - if ($context['can_moderate_forum']) |
|
| 912 | - echo ' |
|
| 968 | + if ($context['can_moderate_forum']) { |
|
| 969 | + echo ' |
|
| 913 | 970 | <td class="centertext buddy_email"> |
| 914 | 971 | <a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a> |
| 915 | 972 | </td>'; |
| 973 | + } |
|
| 916 | 974 | echo ' |
| 917 | 975 | <td class="centertext buddy_remove"> |
| 918 | 976 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a> |
@@ -943,9 +1001,10 @@ discard block |
||
| 943 | 1001 | </dl> |
| 944 | 1002 | </div>'; |
| 945 | 1003 | |
| 946 | - if (!empty($context['token_check'])) |
|
| 947 | - echo ' |
|
| 1004 | + if (!empty($context['token_check'])) { |
|
| 1005 | + echo ' |
|
| 948 | 1006 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 1007 | + } |
|
| 949 | 1008 | |
| 950 | 1009 | echo ' |
| 951 | 1010 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -990,9 +1049,10 @@ discard block |
||
| 990 | 1049 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
| 991 | 1050 | |
| 992 | 1051 | // Second address detected? |
| 993 | - if (!empty($context['last_ip2'])) |
|
| 994 | - echo ' |
|
| 1052 | + if (!empty($context['last_ip2'])) { |
|
| 1053 | + echo ' |
|
| 995 | 1054 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
| 1055 | + } |
|
| 996 | 1056 | |
| 997 | 1057 | echo ' |
| 998 | 1058 | </dd>'; |
@@ -1058,9 +1118,10 @@ discard block |
||
| 1058 | 1118 | </div> |
| 1059 | 1119 | <div class="windowbg">'; |
| 1060 | 1120 | |
| 1061 | - foreach ($context['whois_servers'] as $server) |
|
| 1062 | - echo ' |
|
| 1121 | + foreach ($context['whois_servers'] as $server) { |
|
| 1122 | + echo ' |
|
| 1063 | 1123 | <a href="', $server['url'], '" target="_blank" rel="noopener"', '>', $server['name'], '</a><br>'; |
| 1124 | + } |
|
| 1064 | 1125 | echo ' |
| 1065 | 1126 | </div> |
| 1066 | 1127 | <br>'; |
@@ -1072,13 +1133,12 @@ discard block |
||
| 1072 | 1133 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
| 1073 | 1134 | </div>'; |
| 1074 | 1135 | |
| 1075 | - if (empty($context['ips'])) |
|
| 1076 | - echo ' |
|
| 1136 | + if (empty($context['ips'])) { |
|
| 1137 | + echo ' |
|
| 1077 | 1138 | <p class="windowbg description"> |
| 1078 | 1139 | <em>', $txt['no_members_from_ip'], '</em> |
| 1079 | 1140 | </p>'; |
| 1080 | - |
|
| 1081 | - else |
|
| 1141 | + } else |
|
| 1082 | 1142 | { |
| 1083 | 1143 | echo ' |
| 1084 | 1144 | <table class="table_grid"> |
@@ -1091,12 +1151,13 @@ discard block |
||
| 1091 | 1151 | <tbody>'; |
| 1092 | 1152 | |
| 1093 | 1153 | // Loop through each of the members and display them. |
| 1094 | - foreach ($context['ips'] as $ip => $memberlist) |
|
| 1095 | - echo ' |
|
| 1154 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
| 1155 | + echo ' |
|
| 1096 | 1156 | <tr class="windowbg"> |
| 1097 | 1157 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
| 1098 | 1158 | <td>', implode(', ', $memberlist), '</td> |
| 1099 | 1159 | </tr>'; |
| 1160 | + } |
|
| 1100 | 1161 | |
| 1101 | 1162 | echo ' |
| 1102 | 1163 | </tbody> |
@@ -1138,11 +1199,10 @@ discard block |
||
| 1138 | 1199 | </h3> |
| 1139 | 1200 | </div>'; |
| 1140 | 1201 | |
| 1141 | - if ($context['member']['has_all_permissions']) |
|
| 1142 | - echo ' |
|
| 1202 | + if ($context['member']['has_all_permissions']) { |
|
| 1203 | + echo ' |
|
| 1143 | 1204 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
| 1144 | - |
|
| 1145 | - else |
|
| 1205 | + } else |
|
| 1146 | 1206 | { |
| 1147 | 1207 | echo ' |
| 1148 | 1208 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1157,9 +1217,10 @@ discard block |
||
| 1157 | 1217 | <div class="windowbg smalltext"> |
| 1158 | 1218 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
| 1159 | 1219 | |
| 1160 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
| 1161 | - echo ' |
|
| 1220 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
| 1221 | + echo ' |
|
| 1162 | 1222 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
| 1223 | + } |
|
| 1163 | 1224 | echo ' |
| 1164 | 1225 | </div>'; |
| 1165 | 1226 | } |
@@ -1191,12 +1252,13 @@ discard block |
||
| 1191 | 1252 | </td> |
| 1192 | 1253 | <td class="smalltext">'; |
| 1193 | 1254 | |
| 1194 | - if ($permission['is_denied']) |
|
| 1195 | - echo ' |
|
| 1255 | + if ($permission['is_denied']) { |
|
| 1256 | + echo ' |
|
| 1196 | 1257 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
| 1197 | - else |
|
| 1198 | - echo ' |
|
| 1258 | + } else { |
|
| 1259 | + echo ' |
|
| 1199 | 1260 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
| 1261 | + } |
|
| 1200 | 1262 | |
| 1201 | 1263 | echo ' |
| 1202 | 1264 | </td> |
@@ -1207,10 +1269,10 @@ discard block |
||
| 1207 | 1269 | </table> |
| 1208 | 1270 | </div><!-- .tborder --> |
| 1209 | 1271 | <br>'; |
| 1210 | - } |
|
| 1211 | - else |
|
| 1212 | - echo ' |
|
| 1272 | + } else { |
|
| 1273 | + echo ' |
|
| 1213 | 1274 | <p class="windowbg">', $txt['showPermissions_none_general'], '</p>'; |
| 1275 | + } |
|
| 1214 | 1276 | |
| 1215 | 1277 | // Board permission section. |
| 1216 | 1278 | echo ' |
@@ -1221,14 +1283,16 @@ discard block |
||
| 1221 | 1283 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
| 1222 | 1284 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>'; |
| 1223 | 1285 | |
| 1224 | - if (!empty($context['boards'])) |
|
| 1225 | - echo ' |
|
| 1286 | + if (!empty($context['boards'])) { |
|
| 1287 | + echo ' |
|
| 1226 | 1288 | <option value="" disabled>---------------------------</option>'; |
| 1289 | + } |
|
| 1227 | 1290 | |
| 1228 | 1291 | // Fill the box with any local permission boards. |
| 1229 | - foreach ($context['boards'] as $board) |
|
| 1230 | - echo ' |
|
| 1292 | + foreach ($context['boards'] as $board) { |
|
| 1293 | + echo ' |
|
| 1231 | 1294 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
| 1295 | + } |
|
| 1232 | 1296 | |
| 1233 | 1297 | echo ' |
| 1234 | 1298 | </select> |
@@ -1257,13 +1321,13 @@ discard block |
||
| 1257 | 1321 | </td> |
| 1258 | 1322 | <td class="smalltext">'; |
| 1259 | 1323 | |
| 1260 | - if ($permission['is_denied']) |
|
| 1261 | - echo ' |
|
| 1324 | + if ($permission['is_denied']) { |
|
| 1325 | + echo ' |
|
| 1262 | 1326 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
| 1263 | - |
|
| 1264 | - else |
|
| 1265 | - echo ' |
|
| 1327 | + } else { |
|
| 1328 | + echo ' |
|
| 1266 | 1329 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
| 1330 | + } |
|
| 1267 | 1331 | |
| 1268 | 1332 | echo ' |
| 1269 | 1333 | </td> |
@@ -1272,10 +1336,10 @@ discard block |
||
| 1272 | 1336 | echo ' |
| 1273 | 1337 | </tbody> |
| 1274 | 1338 | </table>'; |
| 1275 | - } |
|
| 1276 | - else |
|
| 1277 | - echo ' |
|
| 1339 | + } else { |
|
| 1340 | + echo ' |
|
| 1278 | 1341 | <p class="windowbg">', $txt['showPermissions_none_board'], '</p>'; |
| 1342 | + } |
|
| 1279 | 1343 | echo ' |
| 1280 | 1344 | </div><!-- #permissions -->'; |
| 1281 | 1345 | } |
@@ -1299,12 +1363,13 @@ discard block |
||
| 1299 | 1363 | echo ' |
| 1300 | 1364 | <dt>', $txt['statPanel_' . $key], '</dt>'; |
| 1301 | 1365 | |
| 1302 | - if (!empty($stat['url'])) |
|
| 1303 | - echo ' |
|
| 1366 | + if (!empty($stat['url'])) { |
|
| 1367 | + echo ' |
|
| 1304 | 1368 | <dd><a href="', $stat['url'], '">', $stat['text'], '</a></dd>'; |
| 1305 | - else |
|
| 1306 | - echo ' |
|
| 1369 | + } else { |
|
| 1370 | + echo ' |
|
| 1307 | 1371 | <dd>', $stat['text'], '</dd>'; |
| 1372 | + } |
|
| 1308 | 1373 | } |
| 1309 | 1374 | |
| 1310 | 1375 | echo ' |
@@ -1321,9 +1386,10 @@ discard block |
||
| 1321 | 1386 | </div>'; |
| 1322 | 1387 | |
| 1323 | 1388 | // If they haven't post at all, don't draw the graph. |
| 1324 | - if (empty($context['posts_by_time'])) |
|
| 1325 | - echo ' |
|
| 1389 | + if (empty($context['posts_by_time'])) { |
|
| 1390 | + echo ' |
|
| 1326 | 1391 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1392 | + } |
|
| 1327 | 1393 | |
| 1328 | 1394 | // Otherwise do! |
| 1329 | 1395 | else |
@@ -1332,8 +1398,8 @@ discard block |
||
| 1332 | 1398 | <ul class="activity_stats flow_hidden">'; |
| 1333 | 1399 | |
| 1334 | 1400 | // The labels. |
| 1335 | - foreach ($context['posts_by_time'] as $time_of_day) |
|
| 1336 | - echo ' |
|
| 1401 | + foreach ($context['posts_by_time'] as $time_of_day) { |
|
| 1402 | + echo ' |
|
| 1337 | 1403 | <li> |
| 1338 | 1404 | <div class="generic_bar vertical"> |
| 1339 | 1405 | <div class="bar" style="height: ', (int) $time_of_day['relative_percent'], '%;"> |
@@ -1342,6 +1408,7 @@ discard block |
||
| 1342 | 1408 | </div> |
| 1343 | 1409 | <span class="stats_hour">', $time_of_day['hour_format'], '</span> |
| 1344 | 1410 | </li>'; |
| 1411 | + } |
|
| 1345 | 1412 | |
| 1346 | 1413 | echo ' |
| 1347 | 1414 | </ul>'; |
@@ -1360,11 +1427,10 @@ discard block |
||
| 1360 | 1427 | </h3> |
| 1361 | 1428 | </div>'; |
| 1362 | 1429 | |
| 1363 | - if (empty($context['popular_boards'])) |
|
| 1364 | - echo ' |
|
| 1430 | + if (empty($context['popular_boards'])) { |
|
| 1431 | + echo ' |
|
| 1365 | 1432 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1366 | - |
|
| 1367 | - else |
|
| 1433 | + } else |
|
| 1368 | 1434 | { |
| 1369 | 1435 | echo ' |
| 1370 | 1436 | <dl class="stats">'; |
@@ -1394,10 +1460,10 @@ discard block |
||
| 1394 | 1460 | </h3> |
| 1395 | 1461 | </div>'; |
| 1396 | 1462 | |
| 1397 | - if (empty($context['board_activity'])) |
|
| 1398 | - echo ' |
|
| 1463 | + if (empty($context['board_activity'])) { |
|
| 1464 | + echo ' |
|
| 1399 | 1465 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1400 | - else |
|
| 1466 | + } else |
|
| 1401 | 1467 | { |
| 1402 | 1468 | echo ' |
| 1403 | 1469 | <dl class="stats">'; |
@@ -1448,90 +1514,97 @@ discard block |
||
| 1448 | 1514 | <h3 class="catbg profile_hd">'; |
| 1449 | 1515 | |
| 1450 | 1516 | // Don't say "Profile" if this isn't the profile... |
| 1451 | - if (!empty($context['profile_header_text'])) |
|
| 1452 | - echo ' |
|
| 1517 | + if (!empty($context['profile_header_text'])) { |
|
| 1518 | + echo ' |
|
| 1453 | 1519 | ', $context['profile_header_text']; |
| 1454 | - else |
|
| 1455 | - echo ' |
|
| 1520 | + } else { |
|
| 1521 | + echo ' |
|
| 1456 | 1522 | ', $txt['profile']; |
| 1523 | + } |
|
| 1457 | 1524 | |
| 1458 | 1525 | echo ' |
| 1459 | 1526 | </h3> |
| 1460 | 1527 | </div>'; |
| 1461 | 1528 | |
| 1462 | 1529 | // Have we some description? |
| 1463 | - if ($context['page_desc']) |
|
| 1464 | - echo ' |
|
| 1530 | + if ($context['page_desc']) { |
|
| 1531 | + echo ' |
|
| 1465 | 1532 | <p class="information">', $context['page_desc'], '</p>'; |
| 1533 | + } |
|
| 1466 | 1534 | |
| 1467 | 1535 | echo ' |
| 1468 | 1536 | <div class="roundframe">'; |
| 1469 | 1537 | |
| 1470 | 1538 | // Any bits at the start? |
| 1471 | - if (!empty($context['profile_prehtml'])) |
|
| 1472 | - echo ' |
|
| 1539 | + if (!empty($context['profile_prehtml'])) { |
|
| 1540 | + echo ' |
|
| 1473 | 1541 | <div>', $context['profile_prehtml'], '</div>'; |
| 1542 | + } |
|
| 1474 | 1543 | |
| 1475 | - if (!empty($context['profile_fields'])) |
|
| 1476 | - echo ' |
|
| 1544 | + if (!empty($context['profile_fields'])) { |
|
| 1545 | + echo ' |
|
| 1477 | 1546 | <dl class="settings">'; |
| 1547 | + } |
|
| 1478 | 1548 | |
| 1479 | 1549 | // Start the big old loop 'of love. |
| 1480 | 1550 | $lastItem = 'hr'; |
| 1481 | 1551 | foreach ($context['profile_fields'] as $key => $field) |
| 1482 | 1552 | { |
| 1483 | 1553 | // We add a little hack to be sure we never get more than one hr in a row! |
| 1484 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
| 1485 | - continue; |
|
| 1554 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
| 1555 | + continue; |
|
| 1556 | + } |
|
| 1486 | 1557 | |
| 1487 | 1558 | $lastItem = $field['type']; |
| 1488 | - if ($field['type'] == 'hr') |
|
| 1489 | - echo ' |
|
| 1559 | + if ($field['type'] == 'hr') { |
|
| 1560 | + echo ' |
|
| 1490 | 1561 | </dl> |
| 1491 | 1562 | <hr> |
| 1492 | 1563 | <dl class="settings">'; |
| 1493 | - |
|
| 1494 | - elseif ($field['type'] == 'callback') |
|
| 1564 | + } elseif ($field['type'] == 'callback') |
|
| 1495 | 1565 | { |
| 1496 | 1566 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
| 1497 | 1567 | { |
| 1498 | 1568 | $callback_func = 'template_profile_' . $field['callback_func']; |
| 1499 | 1569 | $callback_func(); |
| 1500 | 1570 | } |
| 1501 | - } |
|
| 1502 | - else |
|
| 1571 | + } else |
|
| 1503 | 1572 | { |
| 1504 | 1573 | echo ' |
| 1505 | 1574 | <dt> |
| 1506 | 1575 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
| 1507 | 1576 | |
| 1508 | 1577 | // Does it have any subtext to show? |
| 1509 | - if (!empty($field['subtext'])) |
|
| 1510 | - echo ' |
|
| 1578 | + if (!empty($field['subtext'])) { |
|
| 1579 | + echo ' |
|
| 1511 | 1580 | <br> |
| 1512 | 1581 | <span class="smalltext">', $field['subtext'], '</span>'; |
| 1582 | + } |
|
| 1513 | 1583 | |
| 1514 | 1584 | echo ' |
| 1515 | 1585 | </dt> |
| 1516 | 1586 | <dd>'; |
| 1517 | 1587 | |
| 1518 | 1588 | // Want to put something infront of the box? |
| 1519 | - if (!empty($field['preinput'])) |
|
| 1520 | - echo ' |
|
| 1589 | + if (!empty($field['preinput'])) { |
|
| 1590 | + echo ' |
|
| 1521 | 1591 | ', $field['preinput']; |
| 1592 | + } |
|
| 1522 | 1593 | |
| 1523 | 1594 | // What type of data are we showing? |
| 1524 | - if ($field['type'] == 'label') |
|
| 1525 | - echo ' |
|
| 1595 | + if ($field['type'] == 'label') { |
|
| 1596 | + echo ' |
|
| 1526 | 1597 | ', $field['value']; |
| 1598 | + } |
|
| 1527 | 1599 | |
| 1528 | 1600 | // Maybe it's a text box - very likely! |
| 1529 | 1601 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
| 1530 | 1602 | { |
| 1531 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
| 1532 | - $type = 'number'; |
|
| 1533 | - else |
|
| 1534 | - $type = $field['type']; |
|
| 1603 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
| 1604 | + $type = 'number'; |
|
| 1605 | + } else { |
|
| 1606 | + $type = $field['type']; |
|
| 1607 | + } |
|
| 1535 | 1608 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
| 1536 | 1609 | |
| 1537 | 1610 | |
@@ -1539,10 +1612,11 @@ discard block |
||
| 1539 | 1612 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
| 1540 | 1613 | } |
| 1541 | 1614 | // You "checking" me out? ;) |
| 1542 | - elseif ($field['type'] == 'check') |
|
| 1543 | - echo ' |
|
| 1615 | + elseif ($field['type'] == 'check') { |
|
| 1616 | + echo ' |
|
| 1544 | 1617 | <input type="hidden" name="', $key, '" value="0"> |
| 1545 | 1618 | <input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
| 1619 | + } |
|
| 1546 | 1620 | |
| 1547 | 1621 | // Always fun - select boxes! |
| 1548 | 1622 | elseif ($field['type'] == 'select') |
@@ -1553,14 +1627,16 @@ discard block |
||
| 1553 | 1627 | if (isset($field['options'])) |
| 1554 | 1628 | { |
| 1555 | 1629 | // Is this some code to generate the options? |
| 1556 | - if (!is_array($field['options'])) |
|
| 1557 | - $field['options'] = $field['options'](); |
|
| 1630 | + if (!is_array($field['options'])) { |
|
| 1631 | + $field['options'] = $field['options'](); |
|
| 1632 | + } |
|
| 1558 | 1633 | |
| 1559 | 1634 | // Assuming we now have some! |
| 1560 | - if (is_array($field['options'])) |
|
| 1561 | - foreach ($field['options'] as $value => $name) |
|
| 1635 | + if (is_array($field['options'])) { |
|
| 1636 | + foreach ($field['options'] as $value => $name) |
|
| 1562 | 1637 | echo ' |
| 1563 | 1638 | <option', (!empty($field['disabled_options']) && is_array($field['disabled_options']) && in_array($value, $field['disabled_options']) ? ' disabled' : ''), ' value="' . $value . '"', $value === $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
| 1639 | + } |
|
| 1564 | 1640 | } |
| 1565 | 1641 | |
| 1566 | 1642 | echo ' |
@@ -1568,31 +1644,34 @@ discard block |
||
| 1568 | 1644 | } |
| 1569 | 1645 | |
| 1570 | 1646 | // Something to end with? |
| 1571 | - if (!empty($field['postinput'])) |
|
| 1572 | - echo ' |
|
| 1647 | + if (!empty($field['postinput'])) { |
|
| 1648 | + echo ' |
|
| 1573 | 1649 | ', $field['postinput']; |
| 1650 | + } |
|
| 1574 | 1651 | |
| 1575 | 1652 | echo ' |
| 1576 | 1653 | </dd>'; |
| 1577 | 1654 | } |
| 1578 | 1655 | } |
| 1579 | 1656 | |
| 1580 | - if (!empty($context['profile_fields'])) |
|
| 1581 | - echo ' |
|
| 1657 | + if (!empty($context['profile_fields'])) { |
|
| 1658 | + echo ' |
|
| 1582 | 1659 | </dl>'; |
| 1660 | + } |
|
| 1583 | 1661 | |
| 1584 | 1662 | // Are there any custom profile fields - if so print them! |
| 1585 | 1663 | if (!empty($context['custom_fields'])) |
| 1586 | 1664 | { |
| 1587 | - if ($lastItem != 'hr') |
|
| 1588 | - echo ' |
|
| 1665 | + if ($lastItem != 'hr') { |
|
| 1666 | + echo ' |
|
| 1589 | 1667 | <hr>'; |
| 1668 | + } |
|
| 1590 | 1669 | |
| 1591 | 1670 | echo ' |
| 1592 | 1671 | <dl class="settings">'; |
| 1593 | 1672 | |
| 1594 | - foreach ($context['custom_fields'] as $field) |
|
| 1595 | - echo ' |
|
| 1673 | + foreach ($context['custom_fields'] as $field) { |
|
| 1674 | + echo ' |
|
| 1596 | 1675 | <dt> |
| 1597 | 1676 | <strong>', $field['name'], ': </strong><br> |
| 1598 | 1677 | <span class="smalltext">', $field['desc'], '</span> |
@@ -1600,19 +1679,21 @@ discard block |
||
| 1600 | 1679 | <dd> |
| 1601 | 1680 | ', $field['input_html'], ' |
| 1602 | 1681 | </dd>'; |
| 1682 | + } |
|
| 1603 | 1683 | |
| 1604 | 1684 | echo ' |
| 1605 | 1685 | </dl>'; |
| 1606 | 1686 | } |
| 1607 | 1687 | |
| 1608 | 1688 | // Any closing HTML? |
| 1609 | - if (!empty($context['profile_posthtml'])) |
|
| 1610 | - echo ' |
|
| 1689 | + if (!empty($context['profile_posthtml'])) { |
|
| 1690 | + echo ' |
|
| 1611 | 1691 | <div>', $context['profile_posthtml'], '</div>'; |
| 1692 | + } |
|
| 1612 | 1693 | |
| 1613 | 1694 | // Only show the password box if it's actually needed. |
| 1614 | - if ($context['require_password']) |
|
| 1615 | - echo ' |
|
| 1695 | + if ($context['require_password']) { |
|
| 1696 | + echo ' |
|
| 1616 | 1697 | <dl class="settings"> |
| 1617 | 1698 | <dt> |
| 1618 | 1699 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1622,18 +1703,21 @@ discard block |
||
| 1622 | 1703 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20"> |
| 1623 | 1704 | </dd> |
| 1624 | 1705 | </dl>'; |
| 1706 | + } |
|
| 1625 | 1707 | |
| 1626 | 1708 | // The button shouldn't say "Change profile" unless we're changing the profile... |
| 1627 | - if (!empty($context['submit_button_text'])) |
|
| 1628 | - echo ' |
|
| 1709 | + if (!empty($context['submit_button_text'])) { |
|
| 1710 | + echo ' |
|
| 1629 | 1711 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button floatright">'; |
| 1630 | - else |
|
| 1631 | - echo ' |
|
| 1712 | + } else { |
|
| 1713 | + echo ' |
|
| 1632 | 1714 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button floatright">'; |
| 1715 | + } |
|
| 1633 | 1716 | |
| 1634 | - if (!empty($context['token_check'])) |
|
| 1635 | - echo ' |
|
| 1717 | + if (!empty($context['token_check'])) { |
|
| 1718 | + echo ' |
|
| 1636 | 1719 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 1720 | + } |
|
| 1637 | 1721 | |
| 1638 | 1722 | echo ' |
| 1639 | 1723 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1643,10 +1727,11 @@ discard block |
||
| 1643 | 1727 | </form>'; |
| 1644 | 1728 | |
| 1645 | 1729 | // Any final spellchecking stuff? |
| 1646 | - if (!empty($context['show_spellchecking'])) |
|
| 1647 | - echo ' |
|
| 1730 | + if (!empty($context['show_spellchecking'])) { |
|
| 1731 | + echo ' |
|
| 1648 | 1732 | <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
| 1649 | -} |
|
| 1733 | + } |
|
| 1734 | + } |
|
| 1650 | 1735 | |
| 1651 | 1736 | /** |
| 1652 | 1737 | * Personal Message settings. |
@@ -1683,10 +1768,11 @@ discard block |
||
| 1683 | 1768 | <select name="pm_receive_from" id="pm_receive_from"> |
| 1684 | 1769 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
| 1685 | 1770 | |
| 1686 | - if (!empty($modSettings['enable_buddylist'])) |
|
| 1687 | - echo ' |
|
| 1771 | + if (!empty($modSettings['enable_buddylist'])) { |
|
| 1772 | + echo ' |
|
| 1688 | 1773 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
| 1689 | 1774 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
| 1775 | + } |
|
| 1690 | 1776 | |
| 1691 | 1777 | echo ' |
| 1692 | 1778 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1729,11 +1815,12 @@ discard block |
||
| 1729 | 1815 | if (empty($setting) || !is_array($setting)) |
| 1730 | 1816 | { |
| 1731 | 1817 | // Insert a separator (unless this is the first item in the list) |
| 1732 | - if ($i !== $first_option_key) |
|
| 1733 | - echo ' |
|
| 1818 | + if ($i !== $first_option_key) { |
|
| 1819 | + echo ' |
|
| 1734 | 1820 | </dl> |
| 1735 | 1821 | <hr> |
| 1736 | 1822 | <dl class="settings">'; |
| 1823 | + } |
|
| 1737 | 1824 | |
| 1738 | 1825 | // Should we give a name to this section? |
| 1739 | 1826 | if (is_string($setting) && !empty($setting)) |
@@ -1742,51 +1829,55 @@ discard block |
||
| 1742 | 1829 | echo ' |
| 1743 | 1830 | <dt><strong>' . $setting . '</strong></dt> |
| 1744 | 1831 | <dd></dd>'; |
| 1832 | + } else { |
|
| 1833 | + $titled_section = false; |
|
| 1745 | 1834 | } |
| 1746 | - else |
|
| 1747 | - $titled_section = false; |
|
| 1748 | 1835 | |
| 1749 | 1836 | continue; |
| 1750 | 1837 | } |
| 1751 | 1838 | |
| 1752 | 1839 | // Is this disabled? |
| 1753 | - if (isset($setting['enabled']) && $setting['enabled'] === false) |
|
| 1754 | - continue; |
|
| 1840 | + if (isset($setting['enabled']) && $setting['enabled'] === false) { |
|
| 1841 | + continue; |
|
| 1842 | + } |
|
| 1755 | 1843 | |
| 1756 | 1844 | // Some of these may not be set... Set to defaults here |
| 1757 | 1845 | $opts = array('calendar_start_day', 'topics_per_page', 'messages_per_page', 'display_quick_mod'); |
| 1758 | - if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) |
|
| 1759 | - $context['member']['options'][$setting['id']] = 0; |
|
| 1760 | - |
|
| 1761 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
| 1762 | - $setting['type'] = 'checkbox'; |
|
| 1763 | - |
|
| 1764 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
| 1765 | - $setting['type'] = 'number'; |
|
| 1846 | + if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) { |
|
| 1847 | + $context['member']['options'][$setting['id']] = 0; |
|
| 1848 | + } |
|
| 1766 | 1849 | |
| 1767 | - elseif ($setting['type'] == 'string') |
|
| 1768 | - $setting['type'] = 'text'; |
|
| 1850 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
| 1851 | + $setting['type'] = 'checkbox'; |
|
| 1852 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
| 1853 | + $setting['type'] = 'number'; |
|
| 1854 | + } elseif ($setting['type'] == 'string') { |
|
| 1855 | + $setting['type'] = 'text'; |
|
| 1856 | + } |
|
| 1769 | 1857 | |
| 1770 | - if (isset($setting['options'])) |
|
| 1771 | - $setting['type'] = 'list'; |
|
| 1858 | + if (isset($setting['options'])) { |
|
| 1859 | + $setting['type'] = 'list'; |
|
| 1860 | + } |
|
| 1772 | 1861 | |
| 1773 | 1862 | echo ' |
| 1774 | 1863 | <dt> |
| 1775 | 1864 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
| 1776 | 1865 | |
| 1777 | - if (isset($setting['description'])) |
|
| 1778 | - echo ' |
|
| 1866 | + if (isset($setting['description'])) { |
|
| 1867 | + echo ' |
|
| 1779 | 1868 | <br> |
| 1780 | 1869 | <span class="smalltext">', $setting['description'], '</span>'; |
| 1870 | + } |
|
| 1781 | 1871 | echo ' |
| 1782 | 1872 | </dt> |
| 1783 | 1873 | <dd>'; |
| 1784 | 1874 | |
| 1785 | 1875 | // Display checkbox options |
| 1786 | - if ($setting['type'] == 'checkbox') |
|
| 1787 | - echo ' |
|
| 1876 | + if ($setting['type'] == 'checkbox') { |
|
| 1877 | + echo ' |
|
| 1788 | 1878 | <input type="hidden" name="default_options[' . $setting['id'] . ']" value="0"> |
| 1789 | 1879 | <input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">'; |
| 1880 | + } |
|
| 1790 | 1881 | |
| 1791 | 1882 | // How about selection lists, we all love them |
| 1792 | 1883 | elseif ($setting['type'] == 'list') |
@@ -1794,9 +1885,10 @@ discard block |
||
| 1794 | 1885 | echo ' |
| 1795 | 1886 | <select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>'; |
| 1796 | 1887 | |
| 1797 | - foreach ($setting['options'] as $value => $label) |
|
| 1798 | - echo ' |
|
| 1888 | + foreach ($setting['options'] as $value => $label) { |
|
| 1889 | + echo ' |
|
| 1799 | 1890 | <option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>'; |
| 1891 | + } |
|
| 1800 | 1892 | |
| 1801 | 1893 | echo ' |
| 1802 | 1894 | </select>'; |
@@ -1812,14 +1904,13 @@ discard block |
||
| 1812 | 1904 | |
| 1813 | 1905 | echo ' |
| 1814 | 1906 | <input type="number"', $min . $max . $step; |
| 1815 | - } |
|
| 1816 | - elseif (isset($setting['type']) && $setting['type'] == 'url') |
|
| 1817 | - echo' |
|
| 1907 | + } elseif (isset($setting['type']) && $setting['type'] == 'url') { |
|
| 1908 | + echo' |
|
| 1818 | 1909 | <input type="url"'; |
| 1819 | - |
|
| 1820 | - else |
|
| 1821 | - echo ' |
|
| 1910 | + } else { |
|
| 1911 | + echo ' |
|
| 1822 | 1912 | <input type="text"'; |
| 1913 | + } |
|
| 1823 | 1914 | |
| 1824 | 1915 | echo ' name="default_options[', $setting['id'], ']" id="', $setting['id'], '" value="', isset($context['member']['options'][$setting['id']]) ? $context['member']['options'][$setting['id']] : $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', '>'; |
| 1825 | 1916 | } |
@@ -1856,8 +1947,8 @@ discard block |
||
| 1856 | 1947 | <dl class="settings">'; |
| 1857 | 1948 | |
| 1858 | 1949 | // Allow notification on announcements to be disabled? |
| 1859 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
| 1860 | - echo ' |
|
| 1950 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
| 1951 | + echo ' |
|
| 1861 | 1952 | <dt> |
| 1862 | 1953 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
| 1863 | 1954 | </dt> |
@@ -1865,15 +1956,17 @@ discard block |
||
| 1865 | 1956 | <input type="hidden" name="notify_announcements" value="0"> |
| 1866 | 1957 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
| 1867 | 1958 | </dd>'; |
| 1959 | + } |
|
| 1868 | 1960 | |
| 1869 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
| 1870 | - echo ' |
|
| 1961 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
| 1962 | + echo ' |
|
| 1871 | 1963 | <dt> |
| 1872 | 1964 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
| 1873 | 1965 | </dt> |
| 1874 | 1966 | <dd> |
| 1875 | 1967 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
| 1876 | 1968 | </dd>'; |
| 1969 | + } |
|
| 1877 | 1970 | |
| 1878 | 1971 | echo ' |
| 1879 | 1972 | </dl> |
@@ -1905,9 +1998,10 @@ discard block |
||
| 1905 | 1998 | |
| 1906 | 1999 | $label = $txt['alert_opt_' . $opts[1]]; |
| 1907 | 2000 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
| 1908 | - if ($label_pos == 'before') |
|
| 1909 | - echo ' |
|
| 2001 | + if ($label_pos == 'before') { |
|
| 2002 | + echo ' |
|
| 1910 | 2003 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
| 2004 | + } |
|
| 1911 | 2005 | |
| 1912 | 2006 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
| 1913 | 2007 | switch ($opts[0]) |
@@ -1921,17 +2015,19 @@ discard block |
||
| 1921 | 2015 | echo ' |
| 1922 | 2016 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
| 1923 | 2017 | |
| 1924 | - foreach ($opts['opts'] as $k => $v) |
|
| 1925 | - echo ' |
|
| 2018 | + foreach ($opts['opts'] as $k => $v) { |
|
| 2019 | + echo ' |
|
| 1926 | 2020 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
| 2021 | + } |
|
| 1927 | 2022 | echo ' |
| 1928 | 2023 | </select>'; |
| 1929 | 2024 | break; |
| 1930 | 2025 | } |
| 1931 | 2026 | |
| 1932 | - if ($label_pos == 'after') |
|
| 1933 | - echo ' |
|
| 2027 | + if ($label_pos == 'after') { |
|
| 2028 | + echo ' |
|
| 1934 | 2029 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
| 2030 | + } |
|
| 1935 | 2031 | |
| 1936 | 2032 | echo ' |
| 1937 | 2033 | </td> |
@@ -2048,11 +2144,12 @@ discard block |
||
| 2048 | 2144 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
| 2049 | 2145 | |
| 2050 | 2146 | // Do we have an update message? |
| 2051 | - if (!empty($context['update_message'])) |
|
| 2052 | - echo ' |
|
| 2147 | + if (!empty($context['update_message'])) { |
|
| 2148 | + echo ' |
|
| 2053 | 2149 | <div class="infobox"> |
| 2054 | 2150 | ', $context['update_message'], '. |
| 2055 | 2151 | </div>'; |
| 2152 | + } |
|
| 2056 | 2153 | |
| 2057 | 2154 | echo ' |
| 2058 | 2155 | <div id="groups">'; |
@@ -2074,8 +2171,7 @@ discard block |
||
| 2074 | 2171 | </div> |
| 2075 | 2172 | </div> |
| 2076 | 2173 | </div><!-- .groupmembership -->'; |
| 2077 | - } |
|
| 2078 | - else |
|
| 2174 | + } else |
|
| 2079 | 2175 | { |
| 2080 | 2176 | echo ' |
| 2081 | 2177 | <div class="title_bar"> |
@@ -2087,27 +2183,30 @@ discard block |
||
| 2087 | 2183 | echo ' |
| 2088 | 2184 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
| 2089 | 2185 | |
| 2090 | - if ($context['can_edit_primary']) |
|
| 2091 | - echo ' |
|
| 2186 | + if ($context['can_edit_primary']) { |
|
| 2187 | + echo ' |
|
| 2092 | 2188 | <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>'; |
| 2189 | + } |
|
| 2093 | 2190 | |
| 2094 | 2191 | echo ' |
| 2095 | 2192 | <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
| 2096 | 2193 | |
| 2097 | 2194 | // Can they leave their group? |
| 2098 | - if ($group['can_leave']) |
|
| 2099 | - echo ' |
|
| 2195 | + if ($group['can_leave']) { |
|
| 2196 | + echo ' |
|
| 2100 | 2197 | <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
| 2198 | + } |
|
| 2101 | 2199 | |
| 2102 | 2200 | echo ' |
| 2103 | 2201 | </div><!-- .windowbg -->'; |
| 2104 | 2202 | } |
| 2105 | 2203 | |
| 2106 | - if ($context['can_edit_primary']) |
|
| 2107 | - echo ' |
|
| 2204 | + if ($context['can_edit_primary']) { |
|
| 2205 | + echo ' |
|
| 2108 | 2206 | <div class="padding righttext"> |
| 2109 | 2207 | <input type="submit" value="', $txt['make_primary'], '" class="button"> |
| 2110 | 2208 | </div>'; |
| 2209 | + } |
|
| 2111 | 2210 | |
| 2112 | 2211 | // Any groups they can join? |
| 2113 | 2212 | if (!empty($context['groups']['available'])) |
@@ -2123,17 +2222,16 @@ discard block |
||
| 2123 | 2222 | <div class="windowbg"> |
| 2124 | 2223 | <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
| 2125 | 2224 | |
| 2126 | - if ($group['type'] == 3) |
|
| 2127 | - echo ' |
|
| 2225 | + if ($group['type'] == 3) { |
|
| 2226 | + echo ' |
|
| 2128 | 2227 | <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
| 2129 | - |
|
| 2130 | - elseif ($group['type'] == 2 && $group['pending']) |
|
| 2131 | - echo ' |
|
| 2228 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
| 2229 | + echo ' |
|
| 2132 | 2230 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
| 2133 | - |
|
| 2134 | - elseif ($group['type'] == 2) |
|
| 2135 | - echo ' |
|
| 2231 | + } elseif ($group['type'] == 2) { |
|
| 2232 | + echo ' |
|
| 2136 | 2233 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
| 2234 | + } |
|
| 2137 | 2235 | |
| 2138 | 2236 | echo ' |
| 2139 | 2237 | </div><!-- .windowbg -->'; |
@@ -2156,9 +2254,10 @@ discard block |
||
| 2156 | 2254 | |
| 2157 | 2255 | prevDiv.className = "windowbg"; |
| 2158 | 2256 | }'; |
| 2159 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
| 2160 | - echo ' |
|
| 2257 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
| 2258 | + echo ' |
|
| 2161 | 2259 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
| 2260 | + } |
|
| 2162 | 2261 | |
| 2163 | 2262 | echo ' |
| 2164 | 2263 | </script>'; |
@@ -2167,9 +2266,10 @@ discard block |
||
| 2167 | 2266 | echo ' |
| 2168 | 2267 | </div><!-- #groups -->'; |
| 2169 | 2268 | |
| 2170 | - if (!empty($context['token_check'])) |
|
| 2171 | - echo ' |
|
| 2269 | + if (!empty($context['token_check'])) { |
|
| 2270 | + echo ' |
|
| 2172 | 2271 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2272 | + } |
|
| 2173 | 2273 | |
| 2174 | 2274 | echo ' |
| 2175 | 2275 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2247,10 +2347,11 @@ discard block |
||
| 2247 | 2347 | |
| 2248 | 2348 | // Work out the starting warning. |
| 2249 | 2349 | $context['current_warning_mode'] = $context['warning_mode'][0]; |
| 2250 | - foreach ($context['warning_mode'] as $limit => $warning) |
|
| 2251 | - if ($context['member']['warning'] >= $limit) |
|
| 2350 | + foreach ($context['warning_mode'] as $limit => $warning) { |
|
| 2351 | + if ($context['member']['warning'] >= $limit) |
|
| 2252 | 2352 | $context['current_warning_mode'] = $warning; |
| 2253 | -} |
|
| 2353 | + } |
|
| 2354 | + } |
|
| 2254 | 2355 | |
| 2255 | 2356 | // Show all warnings of a user? |
| 2256 | 2357 | function template_viewWarning() |
@@ -2285,14 +2386,15 @@ discard block |
||
| 2285 | 2386 | </dd>'; |
| 2286 | 2387 | |
| 2287 | 2388 | // There's some impact of this? |
| 2288 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
| 2289 | - echo ' |
|
| 2389 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
| 2390 | + echo ' |
|
| 2290 | 2391 | <dt> |
| 2291 | 2392 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
| 2292 | 2393 | </dt> |
| 2293 | 2394 | <dd> |
| 2294 | 2395 | ', $context['level_effects'][$context['current_level']], ' |
| 2295 | 2396 | </dd>'; |
| 2397 | + } |
|
| 2296 | 2398 | |
| 2297 | 2399 | echo ' |
| 2298 | 2400 | </dl> |
@@ -2330,10 +2432,11 @@ discard block |
||
| 2330 | 2432 | |
| 2331 | 2433 | // Otherwise see what we can do...'; |
| 2332 | 2434 | |
| 2333 | - foreach ($context['notification_templates'] as $k => $type) |
|
| 2334 | - echo ' |
|
| 2435 | + foreach ($context['notification_templates'] as $k => $type) { |
|
| 2436 | + echo ' |
|
| 2335 | 2437 | if (index == ', $k, ') |
| 2336 | 2438 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
| 2439 | + } |
|
| 2337 | 2440 | |
| 2338 | 2441 | echo ' |
| 2339 | 2442 | } |
@@ -2343,10 +2446,11 @@ discard block |
||
| 2343 | 2446 | // Also set the right effect. |
| 2344 | 2447 | effectText = "";'; |
| 2345 | 2448 | |
| 2346 | - foreach ($context['level_effects'] as $limit => $text) |
|
| 2347 | - echo ' |
|
| 2449 | + foreach ($context['level_effects'] as $limit => $text) { |
|
| 2450 | + echo ' |
|
| 2348 | 2451 | if (slideAmount >= ', $limit, ') |
| 2349 | 2452 | effectText = "', $text, '";'; |
| 2453 | + } |
|
| 2350 | 2454 | |
| 2351 | 2455 | echo ' |
| 2352 | 2456 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2361,32 +2465,35 @@ discard block |
||
| 2361 | 2465 | </h3> |
| 2362 | 2466 | </div>'; |
| 2363 | 2467 | |
| 2364 | - if (!$context['user']['is_owner']) |
|
| 2365 | - echo ' |
|
| 2468 | + if (!$context['user']['is_owner']) { |
|
| 2469 | + echo ' |
|
| 2366 | 2470 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
| 2471 | + } |
|
| 2367 | 2472 | |
| 2368 | 2473 | echo ' |
| 2369 | 2474 | <div class="windowbg"> |
| 2370 | 2475 | <dl class="settings">'; |
| 2371 | 2476 | |
| 2372 | - if (!$context['user']['is_owner']) |
|
| 2373 | - echo ' |
|
| 2477 | + if (!$context['user']['is_owner']) { |
|
| 2478 | + echo ' |
|
| 2374 | 2479 | <dt> |
| 2375 | 2480 | <strong>', $txt['profile_warning_name'], ':</strong> |
| 2376 | 2481 | </dt> |
| 2377 | 2482 | <dd> |
| 2378 | 2483 | <strong>', $context['member']['name'], '</strong> |
| 2379 | 2484 | </dd>'; |
| 2485 | + } |
|
| 2380 | 2486 | |
| 2381 | 2487 | echo ' |
| 2382 | 2488 | <dt> |
| 2383 | 2489 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
| 2384 | 2490 | |
| 2385 | 2491 | // Is there only so much they can apply? |
| 2386 | - if ($context['warning_limit']) |
|
| 2387 | - echo ' |
|
| 2492 | + if ($context['warning_limit']) { |
|
| 2493 | + echo ' |
|
| 2388 | 2494 | <br> |
| 2389 | 2495 | <span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
| 2496 | + } |
|
| 2390 | 2497 | |
| 2391 | 2498 | echo ' |
| 2392 | 2499 | </dt> |
@@ -2441,9 +2548,10 @@ discard block |
||
| 2441 | 2548 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
| 2442 | 2549 | <option value="-1" disabled>------------------------------</option>'; |
| 2443 | 2550 | |
| 2444 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
| 2445 | - echo ' |
|
| 2551 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
| 2552 | + echo ' |
|
| 2446 | 2553 | <option value="', $id_template, '">', $template['title'], '</option>'; |
| 2554 | + } |
|
| 2447 | 2555 | |
| 2448 | 2556 | echo ' |
| 2449 | 2557 | </select> |
@@ -2456,9 +2564,10 @@ discard block |
||
| 2456 | 2564 | </dl> |
| 2457 | 2565 | <div class="righttext">'; |
| 2458 | 2566 | |
| 2459 | - if (!empty($context['token_check'])) |
|
| 2460 | - echo ' |
|
| 2567 | + if (!empty($context['token_check'])) { |
|
| 2568 | + echo ' |
|
| 2461 | 2569 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2570 | + } |
|
| 2462 | 2571 | |
| 2463 | 2572 | echo ' |
| 2464 | 2573 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2474,8 +2583,8 @@ discard block |
||
| 2474 | 2583 | echo ' |
| 2475 | 2584 | <script>'; |
| 2476 | 2585 | |
| 2477 | - if (!$context['user']['is_owner']) |
|
| 2478 | - echo ' |
|
| 2586 | + if (!$context['user']['is_owner']) { |
|
| 2587 | + echo ' |
|
| 2479 | 2588 | modifyWarnNotify(); |
| 2480 | 2589 | $(document).ready(function() { |
| 2481 | 2590 | $("#preview_button").click(function() { |
@@ -2514,6 +2623,7 @@ discard block |
||
| 2514 | 2623 | }); |
| 2515 | 2624 | return false; |
| 2516 | 2625 | }'; |
| 2626 | + } |
|
| 2517 | 2627 | |
| 2518 | 2628 | echo ' |
| 2519 | 2629 | </script>'; |
@@ -2536,17 +2646,19 @@ discard block |
||
| 2536 | 2646 | </div>'; |
| 2537 | 2647 | |
| 2538 | 2648 | // If deleting another account give them a lovely info box. |
| 2539 | - if (!$context['user']['is_owner']) |
|
| 2540 | - echo ' |
|
| 2649 | + if (!$context['user']['is_owner']) { |
|
| 2650 | + echo ' |
|
| 2541 | 2651 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
| 2652 | + } |
|
| 2542 | 2653 | |
| 2543 | 2654 | echo ' |
| 2544 | 2655 | <div class="windowbg">'; |
| 2545 | 2656 | |
| 2546 | 2657 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
| 2547 | - if ($context['needs_approval']) |
|
| 2548 | - echo ' |
|
| 2658 | + if ($context['needs_approval']) { |
|
| 2659 | + echo ' |
|
| 2549 | 2660 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
| 2661 | + } |
|
| 2550 | 2662 | |
| 2551 | 2663 | // If the user is deleting their own account warn them first - and require a password! |
| 2552 | 2664 | if ($context['user']['is_owner']) |
@@ -2558,9 +2670,10 @@ discard block |
||
| 2558 | 2670 | <input type="password" name="oldpasswrd" size="20"> |
| 2559 | 2671 | <input type="submit" value="', $txt['yes'], '" class="button">'; |
| 2560 | 2672 | |
| 2561 | - if (!empty($context['token_check'])) |
|
| 2562 | - echo ' |
|
| 2673 | + if (!empty($context['token_check'])) { |
|
| 2674 | + echo ' |
|
| 2563 | 2675 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2676 | + } |
|
| 2564 | 2677 | |
| 2565 | 2678 | echo ' |
| 2566 | 2679 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2590,10 +2703,11 @@ discard block |
||
| 2590 | 2703 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
| 2591 | 2704 | </select>'; |
| 2592 | 2705 | |
| 2593 | - if ($context['show_perma_delete']) |
|
| 2594 | - echo ' |
|
| 2706 | + if ($context['show_perma_delete']) { |
|
| 2707 | + echo ' |
|
| 2595 | 2708 | <br> |
| 2596 | 2709 | <label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
| 2710 | + } |
|
| 2597 | 2711 | |
| 2598 | 2712 | echo ' |
| 2599 | 2713 | </div>'; |
@@ -2606,9 +2720,10 @@ discard block |
||
| 2606 | 2720 | <div> |
| 2607 | 2721 | <input type="submit" value="', $txt['delete'], '" class="button">'; |
| 2608 | 2722 | |
| 2609 | - if (!empty($context['token_check'])) |
|
| 2610 | - echo ' |
|
| 2723 | + if (!empty($context['token_check'])) { |
|
| 2724 | + echo ' |
|
| 2611 | 2725 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2726 | + } |
|
| 2612 | 2727 | |
| 2613 | 2728 | echo ' |
| 2614 | 2729 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2634,8 +2749,8 @@ discard block |
||
| 2634 | 2749 | <hr>'; |
| 2635 | 2750 | |
| 2636 | 2751 | // Only show the password box if it's actually needed. |
| 2637 | - if ($context['require_password']) |
|
| 2638 | - echo ' |
|
| 2752 | + if ($context['require_password']) { |
|
| 2753 | + echo ' |
|
| 2639 | 2754 | <dl class="settings"> |
| 2640 | 2755 | <dt> |
| 2641 | 2756 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2645,13 +2760,15 @@ discard block |
||
| 2645 | 2760 | <input type="password" name="oldpasswrd" size="20"> |
| 2646 | 2761 | </dd> |
| 2647 | 2762 | </dl>'; |
| 2763 | + } |
|
| 2648 | 2764 | |
| 2649 | 2765 | echo ' |
| 2650 | 2766 | <div class="righttext">'; |
| 2651 | 2767 | |
| 2652 | - if (!empty($context['token_check'])) |
|
| 2653 | - echo ' |
|
| 2768 | + if (!empty($context['token_check'])) { |
|
| 2769 | + echo ' |
|
| 2654 | 2770 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2771 | + } |
|
| 2655 | 2772 | |
| 2656 | 2773 | echo ' |
| 2657 | 2774 | <input type="submit" value="', $txt['change_profile'], '" class="button"> |
@@ -2678,9 +2795,10 @@ discard block |
||
| 2678 | 2795 | <ul id="list_errors">'; |
| 2679 | 2796 | |
| 2680 | 2797 | // Cycle through each error and display an error message. |
| 2681 | - foreach ($context['post_errors'] as $error) |
|
| 2682 | - echo ' |
|
| 2798 | + foreach ($context['post_errors'] as $error) { |
|
| 2799 | + echo ' |
|
| 2683 | 2800 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
| 2801 | + } |
|
| 2684 | 2802 | |
| 2685 | 2803 | echo ' |
| 2686 | 2804 | </ul>'; |
@@ -2706,12 +2824,13 @@ discard block |
||
| 2706 | 2824 | <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
| 2707 | 2825 | |
| 2708 | 2826 | // Fill the select box with all primary member groups that can be assigned to a member. |
| 2709 | - foreach ($context['member_groups'] as $member_group) |
|
| 2710 | - if (!empty($member_group['can_be_primary'])) |
|
| 2827 | + foreach ($context['member_groups'] as $member_group) { |
|
| 2828 | + if (!empty($member_group['can_be_primary'])) |
|
| 2711 | 2829 | echo ' |
| 2712 | 2830 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
| 2713 | 2831 | ', $member_group['name'], ' |
| 2714 | 2832 | </option>'; |
| 2833 | + } |
|
| 2715 | 2834 | |
| 2716 | 2835 | echo ' |
| 2717 | 2836 | </select> |
@@ -2724,10 +2843,11 @@ discard block |
||
| 2724 | 2843 | <input type="hidden" name="additional_groups[]" value="0">'; |
| 2725 | 2844 | |
| 2726 | 2845 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
| 2727 | - foreach ($context['member_groups'] as $member_group) |
|
| 2728 | - if ($member_group['can_be_additional']) |
|
| 2846 | + foreach ($context['member_groups'] as $member_group) { |
|
| 2847 | + if ($member_group['can_be_additional']) |
|
| 2729 | 2848 | echo ' |
| 2730 | 2849 | <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>'; |
| 2850 | + } |
|
| 2731 | 2851 | |
| 2732 | 2852 | echo ' |
| 2733 | 2853 | </span> |
@@ -2787,9 +2907,10 @@ discard block |
||
| 2787 | 2907 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
| 2788 | 2908 | <br>'; |
| 2789 | 2909 | |
| 2790 | - if ($context['show_spellchecking']) |
|
| 2791 | - echo ' |
|
| 2910 | + if ($context['show_spellchecking']) { |
|
| 2911 | + echo ' |
|
| 2792 | 2912 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
| 2913 | + } |
|
| 2793 | 2914 | |
| 2794 | 2915 | echo ' |
| 2795 | 2916 | </dt> |
@@ -2797,17 +2918,20 @@ discard block |
||
| 2797 | 2918 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>'; |
| 2798 | 2919 | |
| 2799 | 2920 | // If there is a limit at all! |
| 2800 | - if (!empty($context['signature_limits']['max_length'])) |
|
| 2801 | - echo ' |
|
| 2921 | + if (!empty($context['signature_limits']['max_length'])) { |
|
| 2922 | + echo ' |
|
| 2802 | 2923 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
| 2924 | + } |
|
| 2803 | 2925 | |
| 2804 | - if (!empty($context['show_preview_button'])) |
|
| 2805 | - echo ' |
|
| 2926 | + if (!empty($context['show_preview_button'])) { |
|
| 2927 | + echo ' |
|
| 2806 | 2928 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button floatright">'; |
| 2929 | + } |
|
| 2807 | 2930 | |
| 2808 | - if ($context['signature_warning']) |
|
| 2809 | - echo ' |
|
| 2931 | + if ($context['signature_warning']) { |
|
| 2932 | + echo ' |
|
| 2810 | 2933 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
| 2934 | + } |
|
| 2811 | 2935 | |
| 2812 | 2936 | // Some javascript used to count how many characters have been used so far in the signature. |
| 2813 | 2937 | echo ' |
@@ -2838,38 +2962,43 @@ discard block |
||
| 2838 | 2962 | <label for="avatar_upload_box">', $txt['personal_picture'], '</label> |
| 2839 | 2963 | </strong>'; |
| 2840 | 2964 | |
| 2841 | - if (empty($modSettings['gravatarOverride'])) |
|
| 2842 | - echo ' |
|
| 2965 | + if (empty($modSettings['gravatarOverride'])) { |
|
| 2966 | + echo ' |
|
| 2843 | 2967 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_none" value="none"' . ($context['member']['avatar']['choice'] == 'none' ? ' checked="checked"' : '') . '> |
| 2844 | 2968 | <label for="avatar_choice_none"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
| 2845 | 2969 | ' . $txt['no_avatar'] . ' |
| 2846 | 2970 | </label><br>'; |
| 2971 | + } |
|
| 2847 | 2972 | |
| 2848 | - if (!empty($context['member']['avatar']['allow_server_stored'])) |
|
| 2849 | - echo ' |
|
| 2973 | + if (!empty($context['member']['avatar']['allow_server_stored'])) { |
|
| 2974 | + echo ' |
|
| 2850 | 2975 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_server_stored" value="server_stored"' . ($context['member']['avatar']['choice'] == 'server_stored' ? ' checked="checked"' : '') . '> |
| 2851 | 2976 | <label for="avatar_choice_server_stored"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
| 2852 | 2977 | ', $txt['choose_avatar_gallery'], ' |
| 2853 | 2978 | </label><br>'; |
| 2979 | + } |
|
| 2854 | 2980 | |
| 2855 | - if (!empty($context['member']['avatar']['allow_external'])) |
|
| 2856 | - echo ' |
|
| 2981 | + if (!empty($context['member']['avatar']['allow_external'])) { |
|
| 2982 | + echo ' |
|
| 2857 | 2983 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_external" value="external"' . ($context['member']['avatar']['choice'] == 'external' ? ' checked="checked"' : '') . '> |
| 2858 | 2984 | <label for="avatar_choice_external"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
| 2859 | 2985 | ', $txt['my_own_pic'], ' |
| 2860 | 2986 | </label><br>'; |
| 2987 | + } |
|
| 2861 | 2988 | |
| 2862 | - if (!empty($context['member']['avatar']['allow_upload'])) |
|
| 2863 | - echo ' |
|
| 2989 | + if (!empty($context['member']['avatar']['allow_upload'])) { |
|
| 2990 | + echo ' |
|
| 2864 | 2991 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_upload" value="upload"' . ($context['member']['avatar']['choice'] == 'upload' ? ' checked="checked"' : '') . '> |
| 2865 | 2992 | <label for="avatar_choice_upload"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
| 2866 | 2993 | ', $txt['avatar_will_upload'], ' |
| 2867 | 2994 | </label><br>'; |
| 2995 | + } |
|
| 2868 | 2996 | |
| 2869 | - if (!empty($context['member']['avatar']['allow_gravatar'])) |
|
| 2870 | - echo ' |
|
| 2997 | + if (!empty($context['member']['avatar']['allow_gravatar'])) { |
|
| 2998 | + echo ' |
|
| 2871 | 2999 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_gravatar" value="gravatar"' . ($context['member']['avatar']['choice'] == 'gravatar' ? ' checked="checked"' : '') . '> |
| 2872 | 3000 | <label for="avatar_choice_gravatar"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['use_gravatar'] . '</label>'; |
| 3001 | + } |
|
| 2873 | 3002 | |
| 2874 | 3003 | echo ' |
| 2875 | 3004 | </dt> |
@@ -2884,9 +3013,10 @@ discard block |
||
| 2884 | 3013 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
| 2885 | 3014 | |
| 2886 | 3015 | // This lists all the file categories. |
| 2887 | - foreach ($context['avatars'] as $avatar) |
|
| 2888 | - echo ' |
|
| 3016 | + foreach ($context['avatars'] as $avatar) { |
|
| 3017 | + echo ' |
|
| 2889 | 3018 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
| 3019 | + } |
|
| 2890 | 3020 | |
| 2891 | 3021 | echo ' |
| 2892 | 3022 | </select> |
@@ -2918,20 +3048,22 @@ discard block |
||
| 2918 | 3048 | } |
| 2919 | 3049 | |
| 2920 | 3050 | // If the user can link to an off server avatar, show them a box to input the address. |
| 2921 | - if (!empty($context['member']['avatar']['allow_external'])) |
|
| 2922 | - echo ' |
|
| 3051 | + if (!empty($context['member']['avatar']['allow_external'])) { |
|
| 3052 | + echo ' |
|
| 2923 | 3053 | <div id="avatar_external"> |
| 2924 | 3054 | <div class="smalltext">', $txt['avatar_by_url'], '</div>', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', ' |
| 2925 | 3055 | <input type="text" name="userpicpersonal" size="45" value="', ((stristr($context['member']['avatar']['external'], 'http://') || stristr($context['member']['avatar']['external'], 'https://')) ? $context['member']['avatar']['external'] : 'http://'), '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);"> |
| 2926 | 3056 | </div>'; |
| 3057 | + } |
|
| 2927 | 3058 | |
| 2928 | 3059 | // If the user is able to upload avatars to the server show them an upload box. |
| 2929 | - if (!empty($context['member']['avatar']['allow_upload'])) |
|
| 2930 | - echo ' |
|
| 3060 | + if (!empty($context['member']['avatar']['allow_upload'])) { |
|
| 3061 | + echo ' |
|
| 2931 | 3062 | <div id="avatar_upload"> |
| 2932 | 3063 | <input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), ' |
| 2933 | 3064 | ', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), ' |
| 2934 | 3065 | </div>'; |
| 3066 | + } |
|
| 2935 | 3067 | |
| 2936 | 3068 | // if the user is able to use Gravatar avatars show then the image preview |
| 2937 | 3069 | if (!empty($context['member']['avatar']['allow_gravatar'])) |
@@ -2940,16 +3072,17 @@ discard block |
||
| 2940 | 3072 | <div id="avatar_gravatar"> |
| 2941 | 3073 | <img src="' . $context['member']['avatar']['href'] . '" alt="">'; |
| 2942 | 3074 | |
| 2943 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
| 2944 | - echo ' |
|
| 3075 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
| 3076 | + echo ' |
|
| 2945 | 3077 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
| 2946 | - else |
|
| 3078 | + } else |
|
| 2947 | 3079 | { |
| 2948 | 3080 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
| 2949 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
| 2950 | - $textbox_value = ''; |
|
| 2951 | - else |
|
| 2952 | - $textbox_value = $context['member']['avatar']['external']; |
|
| 3081 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
| 3082 | + $textbox_value = ''; |
|
| 3083 | + } else { |
|
| 3084 | + $textbox_value = $context['member']['avatar']['external']; |
|
| 3085 | + } |
|
| 2953 | 3086 | |
| 2954 | 3087 | echo ' |
| 2955 | 3088 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -3021,8 +3154,9 @@ discard block |
||
| 3021 | 3154 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
| 3022 | 3155 | |
| 3023 | 3156 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
| 3024 | - if (empty($suffix)) |
|
| 3025 | - return; |
|
| 3157 | + if (empty($suffix)) { |
|
| 3158 | + return; |
|
| 3159 | + } |
|
| 3026 | 3160 | |
| 3027 | 3161 | echo ' |
| 3028 | 3162 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -3047,9 +3181,10 @@ discard block |
||
| 3047 | 3181 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">'; |
| 3048 | 3182 | |
| 3049 | 3183 | // Help the user by showing a list of common time formats. |
| 3050 | - foreach ($context['easy_timeformats'] as $time_format) |
|
| 3051 | - echo ' |
|
| 3184 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
| 3185 | + echo ' |
|
| 3052 | 3186 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
| 3187 | + } |
|
| 3053 | 3188 | |
| 3054 | 3189 | echo ' |
| 3055 | 3190 | </select> |
@@ -3087,9 +3222,10 @@ discard block |
||
| 3087 | 3222 | <dd> |
| 3088 | 3223 | <select name="smiley_set" id="smiley_set">'; |
| 3089 | 3224 | |
| 3090 | - foreach ($context['smiley_sets'] as $set) |
|
| 3091 | - echo ' |
|
| 3225 | + foreach ($context['smiley_sets'] as $set) { |
|
| 3226 | + echo ' |
|
| 3092 | 3227 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
| 3228 | + } |
|
| 3093 | 3229 | |
| 3094 | 3230 | echo ' |
| 3095 | 3231 | </select> |
@@ -3111,17 +3247,17 @@ discard block |
||
| 3111 | 3247 | <div class="roundframe"> |
| 3112 | 3248 | <div>'; |
| 3113 | 3249 | |
| 3114 | - if (!empty($context['tfa_backup'])) |
|
| 3115 | - echo ' |
|
| 3250 | + if (!empty($context['tfa_backup'])) { |
|
| 3251 | + echo ' |
|
| 3116 | 3252 | <div class="smalltext error"> |
| 3117 | 3253 | ', $txt['tfa_backup_used_desc'], ' |
| 3118 | 3254 | </div>'; |
| 3119 | - |
|
| 3120 | - elseif ($modSettings['tfa_mode'] == 2) |
|
| 3121 | - echo ' |
|
| 3255 | + } elseif ($modSettings['tfa_mode'] == 2) { |
|
| 3256 | + echo ' |
|
| 3122 | 3257 | <div class="smalltext"> |
| 3123 | 3258 | <strong>', $txt['tfa_forced_desc'], '</strong> |
| 3124 | 3259 | </div>'; |
| 3260 | + } |
|
| 3125 | 3261 | |
| 3126 | 3262 | echo ' |
| 3127 | 3263 | <div class="smalltext"> |
@@ -3132,11 +3268,12 @@ discard block |
||
| 3132 | 3268 | <div class="block"> |
| 3133 | 3269 | <strong>', $txt['tfa_step1'], '</strong><br>'; |
| 3134 | 3270 | |
| 3135 | - if (!empty($context['tfa_pass_error'])) |
|
| 3136 | - echo ' |
|
| 3271 | + if (!empty($context['tfa_pass_error'])) { |
|
| 3272 | + echo ' |
|
| 3137 | 3273 | <div class="error smalltext"> |
| 3138 | 3274 | ', $txt['tfa_pass_invalid'], ' |
| 3139 | 3275 | </div>'; |
| 3276 | + } |
|
| 3140 | 3277 | |
| 3141 | 3278 | echo ' |
| 3142 | 3279 | <input type="password" name="passwd" size="25"', !empty($context['tfa_pass_error']) ? ' class="error"' : '', !empty($context['tfa_pass_value']) ? ' value="' . $context['tfa_pass_value'] . '"' : '', '> |
@@ -3149,11 +3286,12 @@ discard block |
||
| 3149 | 3286 | <div class="block"> |
| 3150 | 3287 | <strong>', $txt['tfa_step3'], '</strong><br>'; |
| 3151 | 3288 | |
| 3152 | - if (!empty($context['tfa_error'])) |
|
| 3153 | - echo ' |
|
| 3289 | + if (!empty($context['tfa_error'])) { |
|
| 3290 | + echo ' |
|
| 3154 | 3291 | <div class="error smalltext"> |
| 3155 | 3292 | ', $txt['tfa_code_invalid'], ' |
| 3156 | 3293 | </div>'; |
| 3294 | + } |
|
| 3157 | 3295 | |
| 3158 | 3296 | echo ' |
| 3159 | 3297 | <input type="text" name="tfa_code" size="25"', !empty($context['tfa_error']) ? ' class="error"' : '', !empty($context['tfa_value']) ? ' value="' . $context['tfa_value'] . '"' : '', '> |
@@ -3167,10 +3305,11 @@ discard block |
||
| 3167 | 3305 | <img src="', $context['tfa_qr_url'], '" alt=""> |
| 3168 | 3306 | </div>'; |
| 3169 | 3307 | |
| 3170 | - if (!empty($context['from_ajax'])) |
|
| 3171 | - echo ' |
|
| 3308 | + if (!empty($context['from_ajax'])) { |
|
| 3309 | + echo ' |
|
| 3172 | 3310 | <br> |
| 3173 | 3311 | <a href="javascript:self.close();"></a>'; |
| 3312 | + } |
|
| 3174 | 3313 | |
| 3175 | 3314 | echo ' |
| 3176 | 3315 | </div> |
@@ -3210,17 +3349,16 @@ discard block |
||
| 3210 | 3349 | </dt> |
| 3211 | 3350 | <dd>'; |
| 3212 | 3351 | |
| 3213 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
| 3214 | - echo ' |
|
| 3352 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
| 3353 | + echo ' |
|
| 3215 | 3354 | <a href="', !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
| 3216 | - |
|
| 3217 | - elseif (!$context['tfa_enabled']) |
|
| 3218 | - echo ' |
|
| 3355 | + } elseif (!$context['tfa_enabled']) { |
|
| 3356 | + echo ' |
|
| 3219 | 3357 | ', $txt['tfa_profile_disabled']; |
| 3220 | - |
|
| 3221 | - else |
|
| 3222 | - echo ' |
|
| 3358 | + } else { |
|
| 3359 | + echo ' |
|
| 3223 | 3360 | ', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
| 3361 | + } |
|
| 3224 | 3362 | |
| 3225 | 3363 | echo ' |
| 3226 | 3364 | </dd>'; |
@@ -28,14 +28,15 @@ discard block |
||
| 28 | 28 | <div id="confirm_buttons">'; |
| 29 | 29 | |
| 30 | 30 | // Age restriction in effect? |
| 31 | - if ($context['show_coppa']) |
|
| 32 | - echo ' |
|
| 31 | + if ($context['show_coppa']) { |
|
| 32 | + echo ' |
|
| 33 | 33 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br> |
| 34 | 34 | <br> |
| 35 | 35 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">'; |
| 36 | - else |
|
| 37 | - echo ' |
|
| 36 | + } else { |
|
| 37 | + echo ' |
|
| 38 | 38 | <input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button">'; |
| 39 | + } |
|
| 39 | 40 | |
| 40 | 41 | echo ' |
| 41 | 42 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -78,9 +79,10 @@ discard block |
||
| 78 | 79 | <ul>'; |
| 79 | 80 | |
| 80 | 81 | // Cycle through each error and display an error message. |
| 81 | - foreach ($context['registration_errors'] as $error) |
|
| 82 | - echo ' |
|
| 82 | + foreach ($context['registration_errors'] as $error) { |
|
| 83 | + echo ' |
|
| 83 | 84 | <li>', $error, '</li>'; |
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | echo ' |
| 86 | 88 | </ul> |
@@ -149,14 +151,15 @@ discard block |
||
| 149 | 151 | echo ' |
| 150 | 152 | <dl class="register_form">'; |
| 151 | 153 | |
| 152 | - foreach ($context['custom_fields'] as $field) |
|
| 153 | - if ($field['show_reg'] > 1) |
|
| 154 | + foreach ($context['custom_fields'] as $field) { |
|
| 155 | + if ($field['show_reg'] > 1) |
|
| 154 | 156 | echo ' |
| 155 | 157 | <dt> |
| 156 | 158 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
| 157 | 159 | <span class="smalltext">', $field['desc'], '</span> |
| 158 | 160 | </dt> |
| 159 | 161 | <dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>'; |
| 162 | + } |
|
| 160 | 163 | |
| 161 | 164 | echo ' |
| 162 | 165 | </dl>'; |
@@ -167,14 +170,15 @@ discard block |
||
| 167 | 170 | </div><!-- .roundframe -->'; |
| 168 | 171 | |
| 169 | 172 | // If we have either of these, show the extra group. |
| 170 | - if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) |
|
| 171 | - echo ' |
|
| 173 | + if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) { |
|
| 174 | + echo ' |
|
| 172 | 175 | <div class="title_bar"> |
| 173 | 176 | <h3 class="titlebg">', $txt['additional_information'], '</h3> |
| 174 | 177 | </div> |
| 175 | 178 | <div class="roundframe noup"> |
| 176 | 179 | <fieldset> |
| 177 | 180 | <dl class="register_form" id="custom_group">'; |
| 181 | + } |
|
| 178 | 182 | |
| 179 | 183 | if (!empty($context['profile_fields'])) |
| 180 | 184 | { |
@@ -188,41 +192,45 @@ discard block |
||
| 188 | 192 | $callback_func = 'template_profile_' . $field['callback_func']; |
| 189 | 193 | $callback_func(); |
| 190 | 194 | } |
| 191 | - } |
|
| 192 | - else |
|
| 195 | + } else |
|
| 193 | 196 | { |
| 194 | 197 | echo ' |
| 195 | 198 | <dt> |
| 196 | 199 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>'; |
| 197 | 200 | |
| 198 | 201 | // Does it have any subtext to show? |
| 199 | - if (!empty($field['subtext'])) |
|
| 200 | - echo ' |
|
| 202 | + if (!empty($field['subtext'])) { |
|
| 203 | + echo ' |
|
| 201 | 204 | <span class="smalltext">', $field['subtext'], '</span>'; |
| 205 | + } |
|
| 202 | 206 | |
| 203 | 207 | echo ' |
| 204 | 208 | </dt> |
| 205 | 209 | <dd>'; |
| 206 | 210 | |
| 207 | 211 | // Want to put something infront of the box? |
| 208 | - if (!empty($field['preinput'])) |
|
| 209 | - echo ' |
|
| 212 | + if (!empty($field['preinput'])) { |
|
| 213 | + echo ' |
|
| 210 | 214 | ', $field['preinput']; |
| 215 | + } |
|
| 211 | 216 | |
| 212 | 217 | // What type of data are we showing? |
| 213 | - if ($field['type'] == 'label') |
|
| 214 | - echo ' |
|
| 218 | + if ($field['type'] == 'label') { |
|
| 219 | + echo ' |
|
| 215 | 220 | ', $field['value']; |
| 221 | + } |
|
| 216 | 222 | |
| 217 | 223 | // Maybe it's a text box - very likely! |
| 218 | - elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url'))) |
|
| 219 | - echo ' |
|
| 224 | + elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'url'))) { |
|
| 225 | + echo ' |
|
| 220 | 226 | <input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>'; |
| 227 | + } |
|
| 221 | 228 | |
| 222 | 229 | // You "checking" me out? ;) |
| 223 | - elseif ($field['type'] == 'check') |
|
| 224 | - echo ' |
|
| 230 | + elseif ($field['type'] == 'check') { |
|
| 231 | + echo ' |
|
| 225 | 232 | <input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>'; |
| 233 | + } |
|
| 226 | 234 | |
| 227 | 235 | // Always fun - select boxes! |
| 228 | 236 | elseif ($field['type'] == 'select') |
@@ -233,14 +241,16 @@ discard block |
||
| 233 | 241 | if (isset($field['options'])) |
| 234 | 242 | { |
| 235 | 243 | // Is this some code to generate the options? |
| 236 | - if (!is_array($field['options'])) |
|
| 237 | - $field['options'] = eval($field['options']); |
|
| 244 | + if (!is_array($field['options'])) { |
|
| 245 | + $field['options'] = eval($field['options']); |
|
| 246 | + } |
|
| 238 | 247 | |
| 239 | 248 | // Assuming we now have some! |
| 240 | - if (is_array($field['options'])) |
|
| 241 | - foreach ($field['options'] as $value => $name) |
|
| 249 | + if (is_array($field['options'])) { |
|
| 250 | + foreach ($field['options'] as $value => $name) |
|
| 242 | 251 | echo ' |
| 243 | 252 | <option', (!empty($field['disabled_options']) && is_array($field['disabled_options']) && in_array($value, $field['disabled_options']) ? ' disabled' : ''), ' value="' . $value . '"', $value === $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
| 253 | + } |
|
| 244 | 254 | } |
| 245 | 255 | |
| 246 | 256 | echo ' |
@@ -248,9 +258,10 @@ discard block |
||
| 248 | 258 | } |
| 249 | 259 | |
| 250 | 260 | // Something to end with? |
| 251 | - if (!empty($field['postinput'])) |
|
| 252 | - echo ' |
|
| 261 | + if (!empty($field['postinput'])) { |
|
| 262 | + echo ' |
|
| 253 | 263 | ', $field['postinput']; |
| 264 | + } |
|
| 254 | 265 | |
| 255 | 266 | echo ' |
| 256 | 267 | </dd>'; |
@@ -261,25 +272,27 @@ discard block |
||
| 261 | 272 | // Are there any custom fields? |
| 262 | 273 | if (!empty($context['custom_fields'])) |
| 263 | 274 | { |
| 264 | - foreach ($context['custom_fields'] as $field) |
|
| 265 | - if ($field['show_reg'] < 2) |
|
| 275 | + foreach ($context['custom_fields'] as $field) { |
|
| 276 | + if ($field['show_reg'] < 2) |
|
| 266 | 277 | echo ' |
| 267 | 278 | <dt> |
| 268 | 279 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
| 269 | 280 | <span class="smalltext">', $field['desc'], '</span> |
| 270 | 281 | </dt> |
| 271 | 282 | <dd>', $field['input_html'], '</dd>'; |
| 283 | + } |
|
| 272 | 284 | } |
| 273 | 285 | |
| 274 | 286 | // If we have either of these, close the list like a proper gent. |
| 275 | - if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) |
|
| 276 | - echo ' |
|
| 287 | + if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) { |
|
| 288 | + echo ' |
|
| 277 | 289 | </dl> |
| 278 | 290 | </fieldset> |
| 279 | 291 | </div><!-- .roundframe -->'; |
| 292 | + } |
|
| 280 | 293 | |
| 281 | - if ($context['visual_verification']) |
|
| 282 | - echo ' |
|
| 294 | + if ($context['visual_verification']) { |
|
| 295 | + echo ' |
|
| 283 | 296 | <div class="title_bar"> |
| 284 | 297 | <h3 class="titlebg">', $txt['verification'], '</h3> |
| 285 | 298 | </div> |
@@ -288,19 +301,21 @@ discard block |
||
| 288 | 301 | ', template_control_verification($context['visual_verification_id'], 'all'), ' |
| 289 | 302 | </fieldset> |
| 290 | 303 | </div>'; |
| 304 | + } |
|
| 291 | 305 | |
| 292 | 306 | echo ' |
| 293 | 307 | <div id="confirm_buttons" class="flow_auto">'; |
| 294 | 308 | |
| 295 | 309 | // Age restriction in effect? |
| 296 | - if (!$context['require_agreement'] && $context['show_coppa']) |
|
| 297 | - echo ' |
|
| 310 | + if (!$context['require_agreement'] && $context['show_coppa']) { |
|
| 311 | + echo ' |
|
| 298 | 312 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br> |
| 299 | 313 | <br> |
| 300 | 314 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">'; |
| 301 | - else |
|
| 302 | - echo ' |
|
| 315 | + } else { |
|
| 316 | + echo ' |
|
| 303 | 317 | <input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">'; |
| 318 | + } |
|
| 304 | 319 | |
| 305 | 320 | echo ' |
| 306 | 321 | </div> |
@@ -362,25 +377,28 @@ discard block |
||
| 362 | 377 | <p>', $context['coppa']['many_options'] ? $txt['coppa_send_to_two_options'] : $txt['coppa_send_to_one_option'], '</p>'; |
| 363 | 378 | |
| 364 | 379 | // Can they send by post? |
| 365 | - if (!empty($context['coppa']['post'])) |
|
| 366 | - echo ' |
|
| 380 | + if (!empty($context['coppa']['post'])) { |
|
| 381 | + echo ' |
|
| 367 | 382 | <h4>1) ', $txt['coppa_send_by_post'], '</h4> |
| 368 | 383 | <div class="coppa_contact"> |
| 369 | 384 | ', $context['coppa']['post'], ' |
| 370 | 385 | </div>'; |
| 386 | + } |
|
| 371 | 387 | |
| 372 | 388 | // Can they send by fax?? |
| 373 | - if (!empty($context['coppa']['fax'])) |
|
| 374 | - echo ' |
|
| 389 | + if (!empty($context['coppa']['fax'])) { |
|
| 390 | + echo ' |
|
| 375 | 391 | <h4>', !empty($context['coppa']['post']) ? '2' : '1', ') ', $txt['coppa_send_by_fax'], '</h4> |
| 376 | 392 | <div class="coppa_contact"> |
| 377 | 393 | ', $context['coppa']['fax'], ' |
| 378 | 394 | </div>'; |
| 395 | + } |
|
| 379 | 396 | |
| 380 | 397 | // Offer an alternative Phone Number? |
| 381 | - if ($context['coppa']['phone']) |
|
| 382 | - echo ' |
|
| 398 | + if ($context['coppa']['phone']) { |
|
| 399 | + echo ' |
|
| 383 | 400 | <p>', $context['coppa']['phone'], '</p>'; |
| 401 | + } |
|
| 384 | 402 | |
| 385 | 403 | echo ' |
| 386 | 404 | </div><!-- #coppa -->'; |
@@ -445,19 +463,20 @@ discard block |
||
| 445 | 463 | <body style="margin: 1ex;"> |
| 446 | 464 | <div class="windowbg description" style="text-align: center;">'; |
| 447 | 465 | |
| 448 | - if (isBrowser('is_ie') || isBrowser('is_ie11')) |
|
| 449 | - echo ' |
|
| 466 | + if (isBrowser('is_ie') || isBrowser('is_ie11')) { |
|
| 467 | + echo ' |
|
| 450 | 468 | <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav"> |
| 451 | 469 | <param name="AutoStart" value="1"> |
| 452 | 470 | <param name="FileName" value="', $context['verification_sound_href'], '"> |
| 453 | 471 | </object>'; |
| 454 | - else |
|
| 455 | - echo ' |
|
| 472 | + } else { |
|
| 473 | + echo ' |
|
| 456 | 474 | <audio src="', $context['verification_sound_href'], '" controls> |
| 457 | 475 | <object type="audio/x-wav" data="', $context['verification_sound_href'], '"> |
| 458 | 476 | <a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a> |
| 459 | 477 | </object> |
| 460 | 478 | </audio>'; |
| 479 | + } |
|
| 461 | 480 | |
| 462 | 481 | echo ' |
| 463 | 482 | <br> |
@@ -484,11 +503,12 @@ discard block |
||
| 484 | 503 | </div> |
| 485 | 504 | <div id="register_screen" class="windowbg">'; |
| 486 | 505 | |
| 487 | - if (!empty($context['registration_done'])) |
|
| 488 | - echo ' |
|
| 506 | + if (!empty($context['registration_done'])) { |
|
| 507 | + echo ' |
|
| 489 | 508 | <div class="infobox"> |
| 490 | 509 | ', $context['registration_done'], ' |
| 491 | 510 | </div>'; |
| 511 | + } |
|
| 492 | 512 | |
| 493 | 513 | echo ' |
| 494 | 514 | <dl class="register_form" id="admin_register_form"> |
@@ -524,9 +544,10 @@ discard block |
||
| 524 | 544 | <dd> |
| 525 | 545 | <select name="group" id="group_select" tabindex="', $context['tabindex']++, '">'; |
| 526 | 546 | |
| 527 | - foreach ($context['member_groups'] as $id => $name) |
|
| 528 | - echo ' |
|
| 547 | + foreach ($context['member_groups'] as $id => $name) { |
|
| 548 | + echo ' |
|
| 529 | 549 | <option value="', $id, '">', $name, '</option>'; |
| 550 | + } |
|
| 530 | 551 | |
| 531 | 552 | echo ' |
| 532 | 553 | </select> |
@@ -534,8 +555,8 @@ discard block |
||
| 534 | 555 | } |
| 535 | 556 | |
| 536 | 557 | // If there is any field marked as required, show it here! |
| 537 | - if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) |
|
| 538 | - foreach ($context['custom_fields'] as $field) |
|
| 558 | + if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) { |
|
| 559 | + foreach ($context['custom_fields'] as $field) |
|
| 539 | 560 | if ($field['show_reg'] > 1) |
| 540 | 561 | echo ' |
| 541 | 562 | <dt> |
@@ -545,6 +566,7 @@ discard block |
||
| 545 | 566 | <dd> |
| 546 | 567 | ', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), ' |
| 547 | 568 | </dd>'; |
| 569 | + } |
|
| 548 | 570 | |
| 549 | 571 | echo ' |
| 550 | 572 | <dt> |
@@ -580,18 +602,19 @@ discard block |
||
| 580 | 602 | { |
| 581 | 603 | global $context, $scripturl, $txt; |
| 582 | 604 | |
| 583 | - if (!empty($context['saved_successful'])) |
|
| 584 | - echo ' |
|
| 605 | + if (!empty($context['saved_successful'])) { |
|
| 606 | + echo ' |
|
| 585 | 607 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 586 | - |
|
| 587 | - elseif (!empty($context['could_not_save'])) |
|
| 588 | - echo ' |
|
| 608 | + } elseif (!empty($context['could_not_save'])) { |
|
| 609 | + echo ' |
|
| 589 | 610 | <div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>'; |
| 611 | + } |
|
| 590 | 612 | |
| 591 | 613 | // Warning for if the file isn't writable. |
| 592 | - if (!empty($context['warning'])) |
|
| 593 | - echo ' |
|
| 614 | + if (!empty($context['warning'])) { |
|
| 615 | + echo ' |
|
| 594 | 616 | <div class="errorbox">', $context['warning'], '</div>'; |
| 617 | + } |
|
| 595 | 618 | |
| 596 | 619 | // Just a big box to edit the text file ;) |
| 597 | 620 | echo ' |
@@ -613,9 +636,10 @@ discard block |
||
| 613 | 636 | <strong>', $txt['admin_agreement_select_language'], ':</strong> |
| 614 | 637 | <select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">'; |
| 615 | 638 | |
| 616 | - foreach ($context['editable_agreements'] as $file => $name) |
|
| 617 | - echo ' |
|
| 639 | + foreach ($context['editable_agreements'] as $file => $name) { |
|
| 640 | + echo ' |
|
| 618 | 641 | <option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>'; |
| 642 | + } |
|
| 619 | 643 | |
| 620 | 644 | echo ' |
| 621 | 645 | </select> |
@@ -655,9 +679,10 @@ discard block |
||
| 655 | 679 | { |
| 656 | 680 | global $context, $scripturl, $txt; |
| 657 | 681 | |
| 658 | - if (!empty($context['saved_successful'])) |
|
| 659 | - echo ' |
|
| 682 | + if (!empty($context['saved_successful'])) { |
|
| 683 | + echo ' |
|
| 660 | 684 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 685 | + } |
|
| 661 | 686 | |
| 662 | 687 | echo ' |
| 663 | 688 | <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '"> |