@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | if (isset($_POST['censortest'])) |
| 140 | 140 | { |
| 141 | - require_once($sourcedir . '/Subs-Post.php'); |
|
| 141 | + require_once($sourcedir.'/Subs-Post.php'); |
|
| 142 | 142 | $censorText = $smcFunc['htmlspecialchars']($_POST['censortest'], ENT_QUOTES); |
| 143 | 143 | preparsecode($censorText); |
| 144 | 144 | $context['censor_test'] = strtr(censorText($censorText), array('"' => '"')); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | return $config_vars; |
| 224 | 224 | |
| 225 | 225 | // We'll want this for our easy save. |
| 226 | - require_once($sourcedir . '/ManageServer.php'); |
|
| 226 | + require_once($sourcedir.'/ManageServer.php'); |
|
| 227 | 227 | |
| 228 | 228 | // Setup the template. |
| 229 | 229 | $context['page_title'] = $txt['manageposts_settings']; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $body_type = $column['type']; |
| 246 | 246 | |
| 247 | 247 | if (isset($body_type) && ($_POST['max_messageLength'] > 65535 || $_POST['max_messageLength'] == 0) && $body_type == 'text') |
| 248 | - fatal_lang_error('convert_to_mediumtext', false, array($scripturl . '?action=admin;area=maintain;sa=database')); |
|
| 248 | + fatal_lang_error('convert_to_mediumtext', false, array($scripturl.'?action=admin;area=maintain;sa=database')); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // If we're changing the post preview length let's check its valid |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // Final settings... |
| 263 | - $context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=posts'; |
|
| 263 | + $context['post_url'] = $scripturl.'?action=admin;area=postsettings;save;sa=posts'; |
|
| 264 | 264 | $context['settings_title'] = $txt['manageposts_settings']; |
| 265 | 265 | |
| 266 | 266 | // Prepare the settings... |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | return $config_vars; |
| 316 | 316 | |
| 317 | 317 | // Get the settings template ready. |
| 318 | - require_once($sourcedir . '/ManageServer.php'); |
|
| 318 | + require_once($sourcedir.'/ManageServer.php'); |
|
| 319 | 319 | |
| 320 | 320 | // Setup the template. |
| 321 | 321 | $context['page_title'] = $txt['manageposts_topic_settings']; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | // Final settings... |
| 336 | - $context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=topics'; |
|
| 336 | + $context['post_url'] = $scripturl.'?action=admin;area=postsettings;save;sa=topics'; |
|
| 337 | 337 | $context['settings_title'] = $txt['manageposts_topic_settings']; |
| 338 | 338 | |
| 339 | 339 | // Prepare the settings... |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | return $config_vars; |
| 370 | 370 | |
| 371 | 371 | // Get the settings template ready. |
| 372 | - require_once($sourcedir . '/ManageServer.php'); |
|
| 372 | + require_once($sourcedir.'/ManageServer.php'); |
|
| 373 | 373 | |
| 374 | 374 | // Setup the template. |
| 375 | 375 | $context['page_title'] = $txt['managedrafts_settings']; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | 'task' => 'remove_old_drafts', |
| 394 | 394 | ) |
| 395 | 395 | ); |
| 396 | - require_once($sourcedir . '/ScheduledTasks.php'); |
|
| 396 | + require_once($sourcedir.'/ScheduledTasks.php'); |
|
| 397 | 397 | CalculateNextTrigger(); |
| 398 | 398 | |
| 399 | 399 | // Save everything else and leave. |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | '; |
| 415 | 415 | |
| 416 | 416 | // Final settings... |
| 417 | - $context['post_url'] = $scripturl . '?action=admin;area=postsettings;sa=drafts;save'; |
|
| 417 | + $context['post_url'] = $scripturl.'?action=admin;area=postsettings;sa=drafts;save'; |
|
| 418 | 418 | $context['settings_title'] = $txt['managedrafts_settings']; |
| 419 | 419 | |
| 420 | 420 | // Prepare the settings... |
@@ -302,7 +302,6 @@ discard block |
||
| 302 | 302 | $condition = 'id_member IN ({array_int:members})'; |
| 303 | 303 | $parameters['members'] = $members; |
| 304 | 304 | } |
| 305 | - |
|
| 306 | 305 | elseif ($members === null) |
| 307 | 306 | $condition = '1=1'; |
| 308 | 307 | |
@@ -1739,7 +1738,7 @@ discard block |
||
| 1739 | 1738 | 'before' => '<span style="text-shadow: $1 $2">', |
| 1740 | 1739 | 'after' => '</span>', |
| 1741 | 1740 | 'validate' => function(&$tag, &$data, $disabled) |
| 1742 | - { |
|
| 1741 | + { |
|
| 1743 | 1742 | |
| 1744 | 1743 | if ($data[1] == 'top' || (is_numeric($data[1]) && $data[1] < 50)) |
| 1745 | 1744 | $data[1] = '0 -2px 1px'; |
@@ -1901,7 +1900,8 @@ discard block |
||
| 1901 | 1900 | { |
| 1902 | 1901 | if (isset($temp_bbc)) |
| 1903 | 1902 | $bbc_codes = $temp_bbc; |
| 1904 | - usort($codes, function ($a, $b) { |
|
| 1903 | + usort($codes, function ($a, $b) |
|
| 1904 | + { |
|
| 1905 | 1905 | return strcmp($a['tag'], $b['tag']); |
| 1906 | 1906 | }); |
| 1907 | 1907 | return $codes; |
@@ -2185,7 +2185,8 @@ discard block |
||
| 2185 | 2185 | )? |
| 2186 | 2186 | '; |
| 2187 | 2187 | |
| 2188 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 2188 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) |
|
| 2189 | + { |
|
| 2189 | 2190 | $url = array_shift($matches); |
| 2190 | 2191 | |
| 2191 | 2192 | // If this isn't a clean URL, bail out |
@@ -2274,7 +2275,9 @@ discard block |
||
| 2274 | 2275 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
| 2275 | 2276 | |
| 2276 | 2277 | // A closing tag that doesn't match any open tags? Skip it. |
| 2277 | - if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags))) |
|
| 2278 | + if (!in_array($look_for, array_map(function($code) |
|
| 2279 | + { |
|
| 2280 | +return $code['tag'];}, $open_tags))) |
|
| 2278 | 2281 | continue; |
| 2279 | 2282 | |
| 2280 | 2283 | $to_close = array(); |
@@ -3759,7 +3762,6 @@ discard block |
||
| 3759 | 3762 | if (!isset($minSeed) && isset($js_file['options']['seed'])) |
| 3760 | 3763 | $minSeed = $js_file['options']['seed']; |
| 3761 | 3764 | } |
| 3762 | - |
|
| 3763 | 3765 | else |
| 3764 | 3766 | echo ' |
| 3765 | 3767 | <script src="', $js_file['fileUrl'], '"', !empty($js_file['options']['async']) ? ' async' : '', !empty($js_file['options']['defer']) ? ' defer' : '', '></script>'; |
@@ -3909,7 +3911,9 @@ discard block |
||
| 3909 | 3911 | return $data; |
| 3910 | 3912 | |
| 3911 | 3913 | // Different pages include different files, so we use a hash to label the different combinations |
| 3912 | - $hash = md5(implode(' ', array_map(function($file) { return $file['filePath'] . (int) @filesize($file['filePath']) . (int) @filemtime($file['filePath']); }, $data))); |
|
| 3914 | + $hash = md5(implode(' ', array_map(function($file) |
|
| 3915 | + { |
|
| 3916 | +return $file['filePath'] . (int) @filesize($file['filePath']) . (int) @filemtime($file['filePath']); }, $data))); |
|
| 3913 | 3917 | |
| 3914 | 3918 | // Did we already do this? |
| 3915 | 3919 | list($toCache, $async, $defer) = array_pad((array) cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type . '_' . $hash, 86400), 3, null); |
@@ -5914,7 +5918,6 @@ discard block |
||
| 5914 | 5918 | $isWritable = true; |
| 5915 | 5919 | break; |
| 5916 | 5920 | } |
| 5917 | - |
|
| 5918 | 5921 | else |
| 5919 | 5922 | @chmod($file, $val); |
| 5920 | 5923 | } |
@@ -6084,7 +6087,8 @@ discard block |
||
| 6084 | 6087 | if (!empty($tlds)) |
| 6085 | 6088 | { |
| 6086 | 6089 | // Clean $tlds and convert it to an array |
| 6087 | - $tlds = array_filter(explode("\n", strtolower($tlds)), function($line) { |
|
| 6090 | + $tlds = array_filter(explode("\n", strtolower($tlds)), function($line) |
|
| 6091 | + { |
|
| 6088 | 6092 | $line = trim($line); |
| 6089 | 6093 | if (empty($line) || strpos($line, '#') !== false || strpos($line, ' ') !== false) |
| 6090 | 6094 | return false; |
@@ -6095,7 +6099,9 @@ discard block |
||
| 6095 | 6099 | // Convert Punycode to Unicode |
| 6096 | 6100 | require_once($sourcedir . '/Class-Punycode.php'); |
| 6097 | 6101 | $Punycode = new Punycode(); |
| 6098 | - $tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
| 6102 | + $tlds = array_map(function ($input) use ($Punycode) |
|
| 6103 | + { |
|
| 6104 | +return $Punycode->decode($input); }, $tlds); |
|
| 6099 | 6105 | } |
| 6100 | 6106 | // Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update |
| 6101 | 6107 | else |
@@ -6262,7 +6268,8 @@ discard block |
||
| 6262 | 6268 | } |
| 6263 | 6269 | |
| 6264 | 6270 | // Sort by key length and then alphabetically |
| 6265 | - uksort($regex, function($k1, $k2) use (&$strlen) { |
|
| 6271 | + uksort($regex, function($k1, $k2) use (&$strlen) |
|
| 6272 | + { |
|
| 6266 | 6273 | $l1 = $strlen($k1); |
| 6267 | 6274 | $l2 = $strlen($k2); |
| 6268 | 6275 | |
@@ -6516,7 +6523,8 @@ discard block |
||
| 6516 | 6523 | function sanitize_iri($iri) |
| 6517 | 6524 | { |
| 6518 | 6525 | // Encode any non-ASCII characters (but not space or control characters of any sort) |
| 6519 | - $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) { |
|
| 6526 | + $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) |
|
| 6527 | + { |
|
| 6520 | 6528 | return rawurlencode($matches[0]); |
| 6521 | 6529 | }, $iri); |
| 6522 | 6530 | |
@@ -2932,7 +2932,7 @@ |
||
| 2932 | 2932 | } |
| 2933 | 2933 | |
| 2934 | 2934 | // Set proper extensions; do this post caching so cache doesn't become extension-specific |
| 2935 | - foreach($smileysto AS $ix=>$file) |
|
| 2935 | + foreach($smileysto as $ix=>$file) |
|
| 2936 | 2936 | // Need to use the default if user selection is disabled |
| 2937 | 2937 | if (empty($modSettings['smiley_sets_enable'])) |
| 2938 | 2938 | $smileysto[$ix] = $file . $context['user']['smiley_set_default_ext']; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | foreach ($postgroups as $id => $min_posts) |
| 251 | 251 | { |
| 252 | 252 | $conditions .= ' |
| 253 | - WHEN posts >= ' . $min_posts . (!empty($lastMin) ? ' AND posts <= ' . $lastMin : '') . ' THEN ' . $id; |
|
| 253 | + WHEN posts >= ' . $min_posts.(!empty($lastMin) ? ' AND posts <= '.$lastMin : '').' THEN '.$id; |
|
| 254 | 254 | |
| 255 | 255 | $lastMin = $min_posts; |
| 256 | 256 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | // A big fat CASE WHEN... END is faster than a zillion UPDATE's ;). |
| 259 | 259 | $smcFunc['db_query']('', ' |
| 260 | 260 | UPDATE {db_prefix}members |
| 261 | - SET id_post_group = CASE ' . $conditions . ' |
|
| 261 | + SET id_post_group = CASE ' . $conditions.' |
|
| 262 | 262 | ELSE 0 |
| 263 | 263 | END' . ($parameter1 != null ? ' |
| 264 | 264 | WHERE ' . (is_array($parameter1) ? 'id_member IN ({array_int:members})' : 'id_member = {int:members}') : ''), |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | break; |
| 270 | 270 | |
| 271 | 271 | default: |
| 272 | - trigger_error('updateStats(): Invalid statistic type \'' . $type . '\'', E_USER_NOTICE); |
|
| 272 | + trigger_error('updateStats(): Invalid statistic type \''.$type.'\'', E_USER_NOTICE); |
|
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | |
@@ -386,13 +386,13 @@ discard block |
||
| 386 | 386 | // Doing an increment? |
| 387 | 387 | if ($var == 'alerts' && ($val === '+' || $val === '-')) |
| 388 | 388 | { |
| 389 | - include_once($sourcedir . '/Profile-View.php'); |
|
| 389 | + include_once($sourcedir.'/Profile-View.php'); |
|
| 390 | 390 | if (is_array($members)) |
| 391 | 391 | { |
| 392 | 392 | $val = 'CASE '; |
| 393 | 393 | foreach ($members as $k => $v) |
| 394 | - $val .= 'WHEN id_member = ' . $v . ' THEN '. count(fetch_alerts($v, false, 0, array(), false)) . ' '; |
|
| 395 | - $val = $val . ' END'; |
|
| 394 | + $val .= 'WHEN id_member = '.$v.' THEN '.count(fetch_alerts($v, false, 0, array(), false)).' '; |
|
| 395 | + $val = $val.' END'; |
|
| 396 | 396 | $type = 'raw'; |
| 397 | 397 | } |
| 398 | 398 | else |
@@ -403,28 +403,28 @@ discard block |
||
| 403 | 403 | } |
| 404 | 404 | else if ($type == 'int' && ($val === '+' || $val === '-')) |
| 405 | 405 | { |
| 406 | - $val = $var . ' ' . $val . ' 1'; |
|
| 406 | + $val = $var.' '.$val.' 1'; |
|
| 407 | 407 | $type = 'raw'; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | // Ensure posts, instant_messages, and unread_messages don't overflow or underflow. |
| 411 | 411 | if (in_array($var, array('posts', 'instant_messages', 'unread_messages'))) |
| 412 | 412 | { |
| 413 | - if (preg_match('~^' . $var . ' (\+ |- |\+ -)([\d]+)~', $val, $match)) |
|
| 413 | + if (preg_match('~^'.$var.' (\+ |- |\+ -)([\d]+)~', $val, $match)) |
|
| 414 | 414 | { |
| 415 | 415 | if ($match[1] != '+ ') |
| 416 | - $val = 'CASE WHEN ' . $var . ' <= ' . abs($match[2]) . ' THEN 0 ELSE ' . $val . ' END'; |
|
| 416 | + $val = 'CASE WHEN '.$var.' <= '.abs($match[2]).' THEN 0 ELSE '.$val.' END'; |
|
| 417 | 417 | $type = 'raw'; |
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - $setString .= ' ' . $var . ' = {' . $type . ':p_' . $var . '},'; |
|
| 422 | - $parameters['p_' . $var] = $val; |
|
| 421 | + $setString .= ' '.$var.' = {'.$type.':p_'.$var.'},'; |
|
| 422 | + $parameters['p_'.$var] = $val; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | $smcFunc['db_query']('', ' |
| 426 | 426 | UPDATE {db_prefix}members |
| 427 | - SET' . substr($setString, 0, -1) . ' |
|
| 427 | + SET' . substr($setString, 0, -1).' |
|
| 428 | 428 | WHERE ' . $condition, |
| 429 | 429 | $parameters |
| 430 | 430 | ); |
@@ -441,11 +441,11 @@ discard block |
||
| 441 | 441 | { |
| 442 | 442 | if ($modSettings['cache_enable'] >= 3) |
| 443 | 443 | { |
| 444 | - cache_put_data('member_data-profile-' . $member, null, 120); |
|
| 445 | - cache_put_data('member_data-normal-' . $member, null, 120); |
|
| 446 | - cache_put_data('member_data-minimal-' . $member, null, 120); |
|
| 444 | + cache_put_data('member_data-profile-'.$member, null, 120); |
|
| 445 | + cache_put_data('member_data-normal-'.$member, null, 120); |
|
| 446 | + cache_put_data('member_data-minimal-'.$member, null, 120); |
|
| 447 | 447 | } |
| 448 | - cache_put_data('user_settings-' . $member, null, 60); |
|
| 448 | + cache_put_data('user_settings-'.$member, null, 60); |
|
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | } |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | { |
| 500 | 500 | $smcFunc['db_query']('', ' |
| 501 | 501 | UPDATE {db_prefix}settings |
| 502 | - SET value = {' . ($value === false || $value === true ? 'raw' : 'string') . ':value} |
|
| 502 | + SET value = {' . ($value === false || $value === true ? 'raw' : 'string').':value} |
|
| 503 | 503 | WHERE variable = {string:variable}', |
| 504 | 504 | array( |
| 505 | 505 | 'value' => $value === true ? 'value + 1' : ($value === false ? 'value - 1' : $value), |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | { |
| 594 | 594 | // This defines the formatting for the page indexes used throughout the forum. |
| 595 | 595 | $settings['page_index'] = array( |
| 596 | - 'extra_before' => '<span class="pages">' . $txt['pages'] . '</span>', |
|
| 596 | + 'extra_before' => '<span class="pages">'.$txt['pages'].'</span>', |
|
| 597 | 597 | 'previous_page' => '<span class="generic_icons previous_page"></span>', |
| 598 | 598 | 'current_page' => '<span class="current_page">%1$d</span> ', |
| 599 | 599 | 'page' => '<a class="navPages" href="{URL}">%2$s</a> ', |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | ); |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - $base_link = strtr($settings['page_index']['page'], array('{URL}' => $flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%1$d')); |
|
| 606 | + $base_link = strtr($settings['page_index']['page'], array('{URL}' => $flexible_start ? $base_url : strtr($base_url, array('%' => '%%')).';start=%1$d')); |
|
| 607 | 607 | $pageindex = $settings['page_index']['extra_before']; |
| 608 | 608 | |
| 609 | 609 | // Compact pages is off or on? |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | static $non_twelve_hour, $locale_cache; |
| 745 | 745 | static $unsupportedFormats, $finalizedFormats; |
| 746 | 746 | |
| 747 | - $unsupportedFormatsWindows = array('z','Z'); |
|
| 747 | + $unsupportedFormatsWindows = array('z', 'Z'); |
|
| 748 | 748 | |
| 749 | 749 | // Ensure required values are set |
| 750 | 750 | $user_info['time_offset'] = !empty($user_info['time_offset']) ? $user_info['time_offset'] : 0; |
@@ -778,18 +778,18 @@ discard block |
||
| 778 | 778 | if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false) |
| 779 | 779 | { |
| 780 | 780 | $h = strpos($user_info['time_format'], '%l') === false ? '%I' : '%l'; |
| 781 | - $today_fmt = $h . ':%M' . $s . ' %p'; |
|
| 781 | + $today_fmt = $h.':%M'.$s.' %p'; |
|
| 782 | 782 | } |
| 783 | 783 | else |
| 784 | - $today_fmt = '%H:%M' . $s; |
|
| 784 | + $today_fmt = '%H:%M'.$s; |
|
| 785 | 785 | |
| 786 | 786 | // Same day of the year, same year.... Today! |
| 787 | 787 | if ($then['yday'] == $now['yday'] && $then['year'] == $now['year']) |
| 788 | - return $txt['today'] . timeformat($log_time, $today_fmt, $offset_type); |
|
| 788 | + return $txt['today'].timeformat($log_time, $today_fmt, $offset_type); |
|
| 789 | 789 | |
| 790 | 790 | // Day-of-year is one less and same year, or it's the first of the year and that's the last of the year... |
| 791 | 791 | if ($modSettings['todayMod'] == '2' && (($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year']) || ($now['yday'] == 0 && $then['year'] == $now['year'] - 1) && $then['mon'] == 12 && $then['mday'] == 31)) |
| 792 | - return $txt['yesterday'] . timeformat($log_time, $today_fmt, $offset_type); |
|
| 792 | + return $txt['yesterday'].timeformat($log_time, $today_fmt, $offset_type); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | $str = !is_bool($show_today) ? $show_today : $user_info['time_format']; |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | $unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400); |
| 830 | 830 | if (empty($unsupportedFormats)) |
| 831 | 831 | { |
| 832 | - foreach($strftimeFormatSubstitutions as $format => $substitution) |
|
| 832 | + foreach ($strftimeFormatSubstitutions as $format => $substitution) |
|
| 833 | 833 | { |
| 834 | 834 | // Avoid a crashing bug with PHP 7 on certain versions of Windows |
| 835 | 835 | if ($context['server']['is_windows'] && in_array($format, $unsupportedFormatsWindows)) |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | continue; |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | - $value = @strftime('%' . $format); |
|
| 841 | + $value = @strftime('%'.$format); |
|
| 842 | 842 | |
| 843 | 843 | // Windows will return false for unsupported formats |
| 844 | 844 | // Other operating systems return the format string as a literal |
@@ -850,11 +850,11 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | // Windows needs extra help if $timeformat contains something completely invalid, e.g. '%Q' |
| 852 | 852 | if (DIRECTORY_SEPARATOR === '\\') |
| 853 | - $timeformat = preg_replace('~%(?!' . implode('|', array_keys($strftimeFormatSubstitutions)) . ')~', '%', $timeformat); |
|
| 853 | + $timeformat = preg_replace('~%(?!'.implode('|', array_keys($strftimeFormatSubstitutions)).')~', '%', $timeformat); |
|
| 854 | 854 | |
| 855 | 855 | // Substitute unsupported formats with supported ones |
| 856 | 856 | if (!empty($unsupportedFormats)) |
| 857 | - while (preg_match('~%(' . implode('|', $unsupportedFormats) . ')~', $timeformat, $matches)) |
|
| 857 | + while (preg_match('~%('.implode('|', $unsupportedFormats).')~', $timeformat, $matches)) |
|
| 858 | 858 | $timeformat = str_replace($matches[0], $strftimeFormatSubstitutions[$matches[1]], $timeformat); |
| 859 | 859 | |
| 860 | 860 | // Remember this so we don't need to do it again |
@@ -865,13 +865,13 @@ discard block |
||
| 865 | 865 | $str = $finalizedFormats[$str]; |
| 866 | 866 | |
| 867 | 867 | if (!isset($locale_cache)) |
| 868 | - $locale_cache = setlocale(LC_TIME, $txt['lang_locale'] . !empty($modSettings['global_character_set']) ? '.' . $modSettings['global_character_set'] : ''); |
|
| 868 | + $locale_cache = setlocale(LC_TIME, $txt['lang_locale'].!empty($modSettings['global_character_set']) ? '.'.$modSettings['global_character_set'] : ''); |
|
| 869 | 869 | |
| 870 | 870 | if ($locale_cache !== false) |
| 871 | 871 | { |
| 872 | 872 | // Check if another process changed the locale |
| 873 | 873 | if ($process_safe === true && setlocale(LC_TIME, '0') != $locale_cache) |
| 874 | - setlocale(LC_TIME, $txt['lang_locale'] . !empty($modSettings['global_character_set']) ? '.' . $modSettings['global_character_set'] : ''); |
|
| 874 | + setlocale(LC_TIME, $txt['lang_locale'].!empty($modSettings['global_character_set']) ? '.'.$modSettings['global_character_set'] : ''); |
|
| 875 | 875 | |
| 876 | 876 | if (!isset($non_twelve_hour)) |
| 877 | 877 | $non_twelve_hour = trim(strftime('%p')) === ''; |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | return $subject; |
| 948 | 948 | |
| 949 | 949 | // Shorten it by the length it was too long, and strip off junk from the end. |
| 950 | - return $smcFunc['substr']($subject, 0, $len) . '...'; |
|
| 950 | + return $smcFunc['substr']($subject, 0, $len).'...'; |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | /** |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | |
| 1086 | 1086 | // The YouTube bbc needs this for its origin parameter |
| 1087 | 1087 | $scripturl_parts = parse_url($scripturl); |
| 1088 | - $hosturl = $scripturl_parts['scheme'] . '://' . $scripturl_parts['host']; |
|
| 1088 | + $hosturl = $scripturl_parts['scheme'].'://'.$scripturl_parts['host']; |
|
| 1089 | 1089 | |
| 1090 | 1090 | /* The following bbc are formatted as an array, with keys as follows: |
| 1091 | 1091 | |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
| 1210 | 1210 | ), |
| 1211 | 1211 | 'content' => '$1', |
| 1212 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1212 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1213 | 1213 | { |
| 1214 | 1214 | $returnContext = ''; |
| 1215 | 1215 | |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | $attachID = $data; |
| 1222 | 1222 | |
| 1223 | 1223 | // Kinda need this. |
| 1224 | - require_once($sourcedir . '/Subs-Attachments.php'); |
|
| 1224 | + require_once($sourcedir.'/Subs-Attachments.php'); |
|
| 1225 | 1225 | |
| 1226 | 1226 | $currentAttachment = parseAttachBBC($attachID); |
| 1227 | 1227 | |
@@ -1231,22 +1231,22 @@ discard block |
||
| 1231 | 1231 | |
| 1232 | 1232 | if (!empty($currentAttachment['is_image'])) |
| 1233 | 1233 | { |
| 1234 | - $alt = ' alt="' . (!empty($params['{alt}']) ? $params['{alt}'] : $currentAttachment['name']) . '"'; |
|
| 1235 | - $title = !empty($params['{title}']) ? ' title="' . $params['{title}'] . '"' : ''; |
|
| 1234 | + $alt = ' alt="'.(!empty($params['{alt}']) ? $params['{alt}'] : $currentAttachment['name']).'"'; |
|
| 1235 | + $title = !empty($params['{title}']) ? ' title="'.$params['{title}'].'"' : ''; |
|
| 1236 | 1236 | |
| 1237 | - $width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"' : ''; |
|
| 1238 | - $height = !empty($params['{height}']) ? ' height="' . $params['{height}'] . '"' : ''; |
|
| 1237 | + $width = !empty($params['{width}']) ? ' width="'.$params['{width}'].'"' : ''; |
|
| 1238 | + $height = !empty($params['{height}']) ? ' height="'.$params['{height}'].'"' : ''; |
|
| 1239 | 1239 | |
| 1240 | 1240 | if (empty($width) && empty($height)) |
| 1241 | 1241 | { |
| 1242 | - $width = ' width="' . $currentAttachment['width'] . '"'; |
|
| 1243 | - $height = ' height="' . $currentAttachment['height'] . '"'; |
|
| 1242 | + $width = ' width="'.$currentAttachment['width'].'"'; |
|
| 1243 | + $height = ' height="'.$currentAttachment['height'].'"'; |
|
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | 1246 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
| 1247 | - $returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>'; |
|
| 1247 | + $returnContext .= '<a href="'.$currentAttachment['href'].';image" id="link_'.$currentAttachment['id'].'" onclick="'.$currentAttachment['thumbnail']['javascript'].'"><img src="'.$currentAttachment['thumbnail']['href'].'"'.$alt.$title.' id="thumb_'.$currentAttachment['id'].'" class="atc_img"></a>'; |
|
| 1248 | 1248 | else |
| 1249 | - $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>'; |
|
| 1249 | + $returnContext .= '<img src="'.$currentAttachment['href'].';image"'.$alt.$title.$width.$height.' class="bbc_img"/>'; |
|
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | 1252 | // No image. Show a link. |
@@ -1294,9 +1294,9 @@ discard block |
||
| 1294 | 1294 | array( |
| 1295 | 1295 | 'tag' => 'code', |
| 1296 | 1296 | 'type' => 'unparsed_content', |
| 1297 | - 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
|
| 1297 | + 'content' => '<div class="codeheader"><span class="code floatleft">'.$txt['code'].'</span> <a class="codeoperation smf_select_text">'.$txt['code_select'].'</a></div><code class="bbc_code">$1</code>', |
|
| 1298 | 1298 | // @todo Maybe this can be simplified? |
| 1299 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1299 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1300 | 1300 | { |
| 1301 | 1301 | if (!isset($disabled['code'])) |
| 1302 | 1302 | { |
@@ -1314,7 +1314,7 @@ discard block |
||
| 1314 | 1314 | $php_string .= $php_parts[$php_i]; |
| 1315 | 1315 | $php_parts[$php_i++] = ''; |
| 1316 | 1316 | } |
| 1317 | - $php_parts[$php_i] = highlight_php_code($php_string . $php_parts[$php_i]); |
|
| 1317 | + $php_parts[$php_i] = highlight_php_code($php_string.$php_parts[$php_i]); |
|
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | 1320 | // Fix the PHP code stuff... |
@@ -1331,9 +1331,9 @@ discard block |
||
| 1331 | 1331 | array( |
| 1332 | 1332 | 'tag' => 'code', |
| 1333 | 1333 | 'type' => 'unparsed_equals_content', |
| 1334 | - 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
|
| 1334 | + 'content' => '<div class="codeheader"><span class="code floatleft">'.$txt['code'].'</span> ($2) <a class="codeoperation smf_select_text">'.$txt['code_select'].'</a></div><code class="bbc_code">$1</code>', |
|
| 1335 | 1335 | // @todo Maybe this can be simplified? |
| 1336 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1336 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1337 | 1337 | { |
| 1338 | 1338 | if (!isset($disabled['code'])) |
| 1339 | 1339 | { |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | $php_string .= $php_parts[$php_i]; |
| 1352 | 1352 | $php_parts[$php_i++] = ''; |
| 1353 | 1353 | } |
| 1354 | - $php_parts[$php_i] = highlight_php_code($php_string . $php_parts[$php_i]); |
|
| 1354 | + $php_parts[$php_i] = highlight_php_code($php_string.$php_parts[$php_i]); |
|
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | // Fix the PHP code stuff... |
@@ -1377,7 +1377,7 @@ discard block |
||
| 1377 | 1377 | 'type' => 'unparsed_content', |
| 1378 | 1378 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
| 1379 | 1379 | // @todo Should this respect guest_hideContacts? |
| 1380 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1380 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1381 | 1381 | { |
| 1382 | 1382 | $data = strtr($data, array('<br>' => '')); |
| 1383 | 1383 | }, |
@@ -1397,16 +1397,16 @@ discard block |
||
| 1397 | 1397 | 'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]', |
| 1398 | 1398 | 'before' => '<div $1>', |
| 1399 | 1399 | 'after' => '</div>', |
| 1400 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1400 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1401 | 1401 | { |
| 1402 | - $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; |
|
| 1402 | + $class = 'class="bbc_float float'.(strpos($data, 'left') === 0 ? 'left' : 'right').'"'; |
|
| 1403 | 1403 | |
| 1404 | 1404 | if (preg_match('~\bmax=(\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)~', $data, $matches)) |
| 1405 | - $css = ' style="max-width:' . $matches[1] . (is_numeric($matches[1]) ? 'px' : '') . '"'; |
|
| 1405 | + $css = ' style="max-width:'.$matches[1].(is_numeric($matches[1]) ? 'px' : '').'"'; |
|
| 1406 | 1406 | else |
| 1407 | 1407 | $css = ''; |
| 1408 | 1408 | |
| 1409 | - $data = $class . $css; |
|
| 1409 | + $data = $class.$css; |
|
| 1410 | 1410 | }, |
| 1411 | 1411 | 'trim' => 'outside', |
| 1412 | 1412 | 'block_level' => true, |
@@ -1420,7 +1420,7 @@ discard block |
||
| 1420 | 1420 | $data = strtr($data, array('<br />' => '')); |
| 1421 | 1421 | |
| 1422 | 1422 | if (strpos($data, 'ftp://') !== 0 && strpos($data, 'ftps://') !== 0) |
| 1423 | - $data = 'ftp://' . $data; |
|
| 1423 | + $data = 'ftp://'.$data; |
|
| 1424 | 1424 | }, |
| 1425 | 1425 | ), |
| 1426 | 1426 | array( |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | 'validate' => function(&$tag, &$data, $disabled) |
| 1432 | 1432 | { |
| 1433 | 1433 | if (strpos($data, 'ftp://') !== 0 && strpos($data, 'ftps://') !== 0) |
| 1434 | - $data = 'ftp://' . $data; |
|
| 1434 | + $data = 'ftp://'.$data; |
|
| 1435 | 1435 | }, |
| 1436 | 1436 | 'disallow_children' => array('email', 'ftp', 'url', 'iurl'), |
| 1437 | 1437 | 'disabled_after' => ' ($1)', |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
| 1484 | 1484 | ), |
| 1485 | 1485 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
| 1486 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1486 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1487 | 1487 | { |
| 1488 | 1488 | global $image_proxy_enabled, $user_info; |
| 1489 | 1489 | |
@@ -1495,13 +1495,13 @@ discard block |
||
| 1495 | 1495 | return; |
| 1496 | 1496 | |
| 1497 | 1497 | if (empty($scheme)) |
| 1498 | - $data = 'http://' . ltrim($data, ':/'); |
|
| 1498 | + $data = 'http://'.ltrim($data, ':/'); |
|
| 1499 | 1499 | |
| 1500 | 1500 | if ($scheme != 'https') |
| 1501 | 1501 | $data = get_proxied_url($data); |
| 1502 | 1502 | } |
| 1503 | 1503 | elseif (empty($scheme)) |
| 1504 | - $data = '//' . ltrim($data, ':/'); |
|
| 1504 | + $data = '//'.ltrim($data, ':/'); |
|
| 1505 | 1505 | }, |
| 1506 | 1506 | 'disabled_content' => '($1)', |
| 1507 | 1507 | ), |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | 'tag' => 'img', |
| 1510 | 1510 | 'type' => 'unparsed_content', |
| 1511 | 1511 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1512 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1512 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1513 | 1513 | { |
| 1514 | 1514 | global $image_proxy_enabled, $user_info; |
| 1515 | 1515 | |
@@ -1521,13 +1521,13 @@ discard block |
||
| 1521 | 1521 | return; |
| 1522 | 1522 | |
| 1523 | 1523 | if (empty($scheme)) |
| 1524 | - $data = 'http://' . ltrim($data, ':/'); |
|
| 1524 | + $data = 'http://'.ltrim($data, ':/'); |
|
| 1525 | 1525 | |
| 1526 | 1526 | if ($scheme != 'https') |
| 1527 | 1527 | $data = get_proxied_url($data); |
| 1528 | 1528 | } |
| 1529 | 1529 | elseif (empty($scheme)) |
| 1530 | - $data = '//' . ltrim($data, ':/'); |
|
| 1530 | + $data = '//'.ltrim($data, ':/'); |
|
| 1531 | 1531 | }, |
| 1532 | 1532 | 'disabled_content' => '($1)', |
| 1533 | 1533 | ), |
@@ -1535,12 +1535,12 @@ discard block |
||
| 1535 | 1535 | 'tag' => 'iurl', |
| 1536 | 1536 | 'type' => 'unparsed_content', |
| 1537 | 1537 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1538 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1538 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1539 | 1539 | { |
| 1540 | 1540 | $data = strtr($data, array('<br>' => '')); |
| 1541 | 1541 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1542 | 1542 | if (empty($scheme)) |
| 1543 | - $data = '//' . ltrim($data, ':/'); |
|
| 1543 | + $data = '//'.ltrim($data, ':/'); |
|
| 1544 | 1544 | }, |
| 1545 | 1545 | ), |
| 1546 | 1546 | array( |
@@ -1549,15 +1549,15 @@ discard block |
||
| 1549 | 1549 | 'quoted' => 'optional', |
| 1550 | 1550 | 'before' => '<a href="$1" class="bbc_link">', |
| 1551 | 1551 | 'after' => '</a>', |
| 1552 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1552 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1553 | 1553 | { |
| 1554 | 1554 | if (substr($data, 0, 1) == '#') |
| 1555 | - $data = '#post_' . substr($data, 1); |
|
| 1555 | + $data = '#post_'.substr($data, 1); |
|
| 1556 | 1556 | else |
| 1557 | 1557 | { |
| 1558 | 1558 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1559 | 1559 | if (empty($scheme)) |
| 1560 | - $data = '//' . ltrim($data, ':/'); |
|
| 1560 | + $data = '//'.ltrim($data, ':/'); |
|
| 1561 | 1561 | } |
| 1562 | 1562 | }, |
| 1563 | 1563 | 'disallow_children' => array('email', 'ftp', 'url', 'iurl'), |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | array( |
| 1624 | 1624 | 'tag' => 'member', |
| 1625 | 1625 | 'type' => 'unparsed_equals', |
| 1626 | - 'before' => '<a href="' . $scripturl . '?action=profile;u=$1" class="mention" data-mention="$1">@', |
|
| 1626 | + 'before' => '<a href="'.$scripturl.'?action=profile;u=$1" class="mention" data-mention="$1">@', |
|
| 1627 | 1627 | 'after' => '</a>', |
| 1628 | 1628 | ), |
| 1629 | 1629 | array( |
@@ -1642,12 +1642,12 @@ discard block |
||
| 1642 | 1642 | 'tag' => 'php', |
| 1643 | 1643 | 'type' => 'unparsed_content', |
| 1644 | 1644 | 'content' => '<span class="phpcode">$1</span>', |
| 1645 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1645 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1646 | 1646 | { |
| 1647 | 1647 | if (!isset($disabled['php'])) |
| 1648 | 1648 | { |
| 1649 | 1649 | $add_begin = substr(trim($data), 0, 5) != '<?'; |
| 1650 | - $data = highlight_php_code($add_begin ? '<?php ' . $data . '?>' : $data); |
|
| 1650 | + $data = highlight_php_code($add_begin ? '<?php '.$data.'?>' : $data); |
|
| 1651 | 1651 | if ($add_begin) |
| 1652 | 1652 | $data = preg_replace(array('~^(.+?)<\?.{0,40}?php(?: |\s)~', '~\?>((?:</(font|span)>)*)$~'), '$1', $data, 2); |
| 1653 | 1653 | } |
@@ -1662,7 +1662,7 @@ discard block |
||
| 1662 | 1662 | ), |
| 1663 | 1663 | array( |
| 1664 | 1664 | 'tag' => 'quote', |
| 1665 | - 'before' => '<blockquote><cite>' . $txt['quote'] . '</cite>', |
|
| 1665 | + 'before' => '<blockquote><cite>'.$txt['quote'].'</cite>', |
|
| 1666 | 1666 | 'after' => '</blockquote>', |
| 1667 | 1667 | 'trim' => 'both', |
| 1668 | 1668 | 'block_level' => true, |
@@ -1672,7 +1672,7 @@ discard block |
||
| 1672 | 1672 | 'parameters' => array( |
| 1673 | 1673 | 'author' => array('match' => '(.{1,192}?)', 'quoted' => true), |
| 1674 | 1674 | ), |
| 1675 | - 'before' => '<blockquote><cite>' . $txt['quote_from'] . ': {author}</cite>', |
|
| 1675 | + 'before' => '<blockquote><cite>'.$txt['quote_from'].': {author}</cite>', |
|
| 1676 | 1676 | 'after' => '</blockquote>', |
| 1677 | 1677 | 'trim' => 'both', |
| 1678 | 1678 | 'block_level' => true, |
@@ -1680,7 +1680,7 @@ discard block |
||
| 1680 | 1680 | array( |
| 1681 | 1681 | 'tag' => 'quote', |
| 1682 | 1682 | 'type' => 'parsed_equals', |
| 1683 | - 'before' => '<blockquote><cite>' . $txt['quote_from'] . ': $1</cite>', |
|
| 1683 | + 'before' => '<blockquote><cite>'.$txt['quote_from'].': $1</cite>', |
|
| 1684 | 1684 | 'after' => '</blockquote>', |
| 1685 | 1685 | 'trim' => 'both', |
| 1686 | 1686 | 'quoted' => 'optional', |
@@ -1695,7 +1695,7 @@ discard block |
||
| 1695 | 1695 | 'link' => array('match' => '(?:board=\d+;)?((?:topic|threadid)=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?|msg=\d+?|action=profile;u=\d+)'), |
| 1696 | 1696 | 'date' => array('match' => '(\d+)', 'validate' => 'timeformat'), |
| 1697 | 1697 | ), |
| 1698 | - 'before' => '<blockquote><cite><a href="' . $scripturl . '?{link}">' . $txt['quote_from'] . ': {author} ' . $txt['search_on'] . ' {date}</a></cite>', |
|
| 1698 | + 'before' => '<blockquote><cite><a href="'.$scripturl.'?{link}">'.$txt['quote_from'].': {author} '.$txt['search_on'].' {date}</a></cite>', |
|
| 1699 | 1699 | 'after' => '</blockquote>', |
| 1700 | 1700 | 'trim' => 'both', |
| 1701 | 1701 | 'block_level' => true, |
@@ -1705,7 +1705,7 @@ discard block |
||
| 1705 | 1705 | 'parameters' => array( |
| 1706 | 1706 | 'author' => array('match' => '(.{1,192}?)'), |
| 1707 | 1707 | ), |
| 1708 | - 'before' => '<blockquote><cite>' . $txt['quote_from'] . ': {author}</cite>', |
|
| 1708 | + 'before' => '<blockquote><cite>'.$txt['quote_from'].': {author}</cite>', |
|
| 1709 | 1709 | 'after' => '</blockquote>', |
| 1710 | 1710 | 'trim' => 'both', |
| 1711 | 1711 | 'block_level' => true, |
@@ -1770,10 +1770,10 @@ discard block |
||
| 1770 | 1770 | 'test' => '[1-7]\]', |
| 1771 | 1771 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1772 | 1772 | 'after' => '</span>', |
| 1773 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1773 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1774 | 1774 | { |
| 1775 | 1775 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1776 | - $data = $sizes[$data] . 'em'; |
|
| 1776 | + $data = $sizes[$data].'em'; |
|
| 1777 | 1777 | }, |
| 1778 | 1778 | ), |
| 1779 | 1779 | array( |
@@ -1808,7 +1808,7 @@ discard block |
||
| 1808 | 1808 | 'tag' => 'time', |
| 1809 | 1809 | 'type' => 'unparsed_content', |
| 1810 | 1810 | 'content' => '$1', |
| 1811 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1811 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1812 | 1812 | { |
| 1813 | 1813 | if (is_numeric($data)) |
| 1814 | 1814 | $data = timeformat($data); |
@@ -1841,12 +1841,12 @@ discard block |
||
| 1841 | 1841 | 'tag' => 'url', |
| 1842 | 1842 | 'type' => 'unparsed_content', |
| 1843 | 1843 | 'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>', |
| 1844 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1844 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1845 | 1845 | { |
| 1846 | 1846 | $data = strtr($data, array('<br>' => '')); |
| 1847 | 1847 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1848 | 1848 | if (empty($scheme)) |
| 1849 | - $data = '//' . ltrim($data, ':/'); |
|
| 1849 | + $data = '//'.ltrim($data, ':/'); |
|
| 1850 | 1850 | }, |
| 1851 | 1851 | ), |
| 1852 | 1852 | array( |
@@ -1855,11 +1855,11 @@ discard block |
||
| 1855 | 1855 | 'quoted' => 'optional', |
| 1856 | 1856 | 'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">', |
| 1857 | 1857 | 'after' => '</a>', |
| 1858 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1858 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1859 | 1859 | { |
| 1860 | 1860 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1861 | 1861 | if (empty($scheme)) |
| 1862 | - $data = '//' . ltrim($data, ':/'); |
|
| 1862 | + $data = '//'.ltrim($data, ':/'); |
|
| 1863 | 1863 | }, |
| 1864 | 1864 | 'disallow_children' => array('email', 'ftp', 'url', 'iurl'), |
| 1865 | 1865 | 'disabled_after' => ' ($1)', |
@@ -1872,7 +1872,7 @@ discard block |
||
| 1872 | 1872 | array( |
| 1873 | 1873 | 'tag' => 'youtube', |
| 1874 | 1874 | 'type' => 'unparsed_content', |
| 1875 | - 'content' => '<div class="videocontainer"><div><iframe frameborder="0" src="https://www.youtube.com/embed/$1?origin=' . $hosturl . '&wmode=opaque" data-youtube-id="$1" allowfullscreen></iframe></div></div>', |
|
| 1875 | + 'content' => '<div class="videocontainer"><div><iframe frameborder="0" src="https://www.youtube.com/embed/$1?origin='.$hosturl.'&wmode=opaque" data-youtube-id="$1" allowfullscreen></iframe></div></div>', |
|
| 1876 | 1876 | 'disabled_content' => '<a href="https://www.youtube.com/watch?v=$1" target="_blank" rel="noopener">https://www.youtube.com/watch?v=$1</a>', |
| 1877 | 1877 | 'block_level' => true, |
| 1878 | 1878 | ), |
@@ -1901,7 +1901,7 @@ discard block |
||
| 1901 | 1901 | { |
| 1902 | 1902 | if (isset($temp_bbc)) |
| 1903 | 1903 | $bbc_codes = $temp_bbc; |
| 1904 | - usort($codes, function ($a, $b) { |
|
| 1904 | + usort($codes, function($a, $b) { |
|
| 1905 | 1905 | return strcmp($a['tag'], $b['tag']); |
| 1906 | 1906 | }); |
| 1907 | 1907 | return $codes; |
@@ -1956,7 +1956,7 @@ discard block |
||
| 1956 | 1956 | if ($cache_id != '' && !empty($modSettings['cache_enable']) && (($modSettings['cache_enable'] >= 2 && isset($message[1000])) || isset($message[2400])) && empty($parse_tags)) |
| 1957 | 1957 | { |
| 1958 | 1958 | // It's likely this will change if the message is modified. |
| 1959 | - $cache_key = 'parse:' . $cache_id . '-' . md5(md5($message) . '-' . $smileys . (empty($disabled) ? '' : implode(',', array_keys($disabled))) . $smcFunc['json_encode']($context['browser']) . $txt['lang_locale'] . $user_info['time_offset'] . $user_info['time_format']); |
|
| 1959 | + $cache_key = 'parse:'.$cache_id.'-'.md5(md5($message).'-'.$smileys.(empty($disabled) ? '' : implode(',', array_keys($disabled))).$smcFunc['json_encode']($context['browser']).$txt['lang_locale'].$user_info['time_offset'].$user_info['time_format']); |
|
| 1960 | 1960 | |
| 1961 | 1961 | if (($temp = cache_get_data($cache_key, 240)) != null) |
| 1962 | 1962 | return $temp; |
@@ -2006,13 +2006,13 @@ discard block |
||
| 2006 | 2006 | foreach ($section as $code) |
| 2007 | 2007 | $alltags[] = $code['tag']; |
| 2008 | 2008 | } |
| 2009 | - $alltags_regex = '\b' . implode("\b|\b", array_unique($alltags)) . '\b'; |
|
| 2009 | + $alltags_regex = '\b'.implode("\b|\b", array_unique($alltags)).'\b'; |
|
| 2010 | 2010 | |
| 2011 | 2011 | $pos = -1; |
| 2012 | 2012 | while ($pos !== false) |
| 2013 | 2013 | { |
| 2014 | 2014 | $last_pos = isset($last_pos) ? max($pos, $last_pos) : $pos; |
| 2015 | - preg_match('~\[/?(?=' . $alltags_regex . ')~i', $message, $matches, PREG_OFFSET_CAPTURE, $pos + 1); |
|
| 2015 | + preg_match('~\[/?(?='.$alltags_regex.')~i', $message, $matches, PREG_OFFSET_CAPTURE, $pos + 1); |
|
| 2016 | 2016 | $pos = isset($matches[0][1]) ? $matches[0][1] : false; |
| 2017 | 2017 | |
| 2018 | 2018 | // Failsafe. |
@@ -2036,17 +2036,17 @@ discard block |
||
| 2036 | 2036 | // <br> should be empty. |
| 2037 | 2037 | $empty_tags = array('br', 'hr'); |
| 2038 | 2038 | foreach ($empty_tags as $tag) |
| 2039 | - $data = str_replace(array('<' . $tag . '>', '<' . $tag . '/>', '<' . $tag . ' />'), '<' . $tag . '>', $data); |
|
| 2039 | + $data = str_replace(array('<'.$tag.'>', '<'.$tag.'/>', '<'.$tag.' />'), '<'.$tag.'>', $data); |
|
| 2040 | 2040 | |
| 2041 | 2041 | // b, u, i, s, pre... basic tags. |
| 2042 | 2042 | $closable_tags = array('b', 'u', 'i', 's', 'em', 'ins', 'del', 'pre', 'blockquote', 'strong'); |
| 2043 | 2043 | foreach ($closable_tags as $tag) |
| 2044 | 2044 | { |
| 2045 | - $diff = substr_count($data, '<' . $tag . '>') - substr_count($data, '</' . $tag . '>'); |
|
| 2046 | - $data = strtr($data, array('<' . $tag . '>' => '<' . $tag . '>', '</' . $tag . '>' => '</' . $tag . '>')); |
|
| 2045 | + $diff = substr_count($data, '<'.$tag.'>') - substr_count($data, '</'.$tag.'>'); |
|
| 2046 | + $data = strtr($data, array('<'.$tag.'>' => '<'.$tag.'>', '</'.$tag.'>' => '</'.$tag.'>')); |
|
| 2047 | 2047 | |
| 2048 | 2048 | if ($diff > 0) |
| 2049 | - $data = substr($data, 0, -1) . str_repeat('</' . $tag . '>', $diff) . substr($data, -1); |
|
| 2049 | + $data = substr($data, 0, -1).str_repeat('</'.$tag.'>', $diff).substr($data, -1); |
|
| 2050 | 2050 | } |
| 2051 | 2051 | |
| 2052 | 2052 | // Do <img ...> - with security... action= -> action-. |
@@ -2056,13 +2056,13 @@ discard block |
||
| 2056 | 2056 | $replaces = array(); |
| 2057 | 2057 | foreach ($matches[2] as $match => $imgtag) |
| 2058 | 2058 | { |
| 2059 | - $alt = empty($matches[3][$match]) ? '' : ' alt=' . preg_replace('~^"|"$~', '', $matches[3][$match]); |
|
| 2059 | + $alt = empty($matches[3][$match]) ? '' : ' alt='.preg_replace('~^"|"$~', '', $matches[3][$match]); |
|
| 2060 | 2060 | |
| 2061 | 2061 | // Remove action= from the URL - no funny business, now. |
| 2062 | 2062 | if (preg_match('~action(=|%3d)(?!dlattach)~i', $imgtag) != 0) |
| 2063 | 2063 | $imgtag = preg_replace('~action(?:=|%3d)(?!dlattach)~i', 'action-', $imgtag); |
| 2064 | 2064 | |
| 2065 | - $replaces[$matches[0][$match]] = '[img' . $alt . ']' . $imgtag . '[/img]'; |
|
| 2065 | + $replaces[$matches[0][$match]] = '[img'.$alt.']'.$imgtag.'[/img]'; |
|
| 2066 | 2066 | } |
| 2067 | 2067 | |
| 2068 | 2068 | $data = strtr($data, $replaces); |
@@ -2117,7 +2117,7 @@ discard block |
||
| 2117 | 2117 | # a run of Unicode domain name characters and a dot |
| 2118 | 2118 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 2119 | 2119 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 2120 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 2120 | + (?:'. $modSettings['tld_regex'].'|local) |
|
| 2121 | 2121 | ) |
| 2122 | 2122 | # followed by a non-domain character or end of line |
| 2123 | 2123 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -2141,7 +2141,7 @@ discard block |
||
| 2141 | 2141 | # A run of Unicode domain name characters (excluding [:@]) |
| 2142 | 2142 | [\p{L}\p{N}][\p{L}\p{M}\p{N}\-.]+[\p{L}\p{M}\p{N}] |
| 2143 | 2143 | # and then a dot and a valid TLD |
| 2144 | - \.' . $modSettings['tld_regex'] . ' |
|
| 2144 | + \.' . $modSettings['tld_regex'].' |
|
| 2145 | 2145 | |
| 2146 | 2146 | # Followed by either: |
| 2147 | 2147 | (?= |
@@ -2185,7 +2185,7 @@ discard block |
||
| 2185 | 2185 | )? |
| 2186 | 2186 | '; |
| 2187 | 2187 | |
| 2188 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 2188 | + $data = preg_replace_callback('~'.$url_regex.'~xi'.($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 2189 | 2189 | $url = array_shift($matches); |
| 2190 | 2190 | |
| 2191 | 2191 | // If this isn't a clean URL, bail out |
@@ -2198,22 +2198,22 @@ discard block |
||
| 2198 | 2198 | { |
| 2199 | 2199 | $email_address = str_replace('mailto:', '', $url); |
| 2200 | 2200 | if (!isset($disabled['email']) && filter_var($email_address, FILTER_VALIDATE_EMAIL) !== false) |
| 2201 | - return '[email=' . $email_address . ']' . $url . '[/email]'; |
|
| 2201 | + return '[email='.$email_address.']'.$url.'[/email]'; |
|
| 2202 | 2202 | else |
| 2203 | 2203 | return $url; |
| 2204 | 2204 | } |
| 2205 | 2205 | |
| 2206 | 2206 | // Are we linking a schemeless URL or naked domain name (e.g. "example.com")? |
| 2207 | 2207 | if (empty($scheme)) |
| 2208 | - $fullUrl = '//' . ltrim($url, ':/'); |
|
| 2208 | + $fullUrl = '//'.ltrim($url, ':/'); |
|
| 2209 | 2209 | else |
| 2210 | 2210 | $fullUrl = $url; |
| 2211 | 2211 | |
| 2212 | 2212 | // Make sure that $fullUrl really is valid |
| 2213 | - if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '' ) . $fullUrl) === false) |
|
| 2213 | + if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '').$fullUrl) === false) |
|
| 2214 | 2214 | return $url; |
| 2215 | 2215 | |
| 2216 | - return '[url="' . str_replace(array('[', ']'), array('[', ']'), $fullUrl) . '"]' . $url . '[/url]'; |
|
| 2216 | + return '[url="'.str_replace(array('[', ']'), array('[', ']'), $fullUrl).'"]'.$url.'[/url]'; |
|
| 2217 | 2217 | }, $data); |
| 2218 | 2218 | } |
| 2219 | 2219 | |
@@ -2229,7 +2229,7 @@ discard block |
||
| 2229 | 2229 | @ |
| 2230 | 2230 | [\p{L}\p{M}\p{N}\-.]+ |
| 2231 | 2231 | \. |
| 2232 | - '. $modSettings['tld_regex'] . ' |
|
| 2232 | + '. $modSettings['tld_regex'].' |
|
| 2233 | 2233 | |
| 2234 | 2234 | # Followed by either: |
| 2235 | 2235 | (?= |
@@ -2240,7 +2240,7 @@ discard block |
||
| 2240 | 2240 | \.(?=$|[^\p{L}\p{M}\p{N}\-]) |
| 2241 | 2241 | )'; |
| 2242 | 2242 | |
| 2243 | - $data = preg_replace('~' . $email_regex . '~xi' . ($context['utf8'] ? 'u' : ''), '[email]$0[/email]', $data); |
|
| 2243 | + $data = preg_replace('~'.$email_regex.'~xi'.($context['utf8'] ? 'u' : ''), '[email]$0[/email]', $data); |
|
| 2244 | 2244 | } |
| 2245 | 2245 | } |
| 2246 | 2246 | } |
@@ -2250,7 +2250,7 @@ discard block |
||
| 2250 | 2250 | // If it wasn't changed, no copying or other boring stuff has to happen! |
| 2251 | 2251 | if ($data != substr($message, $last_pos, $pos - $last_pos)) |
| 2252 | 2252 | { |
| 2253 | - $message = substr($message, 0, $last_pos) . $data . substr($message, $pos); |
|
| 2253 | + $message = substr($message, 0, $last_pos).$data.substr($message, $pos); |
|
| 2254 | 2254 | |
| 2255 | 2255 | // Since we changed it, look again in case we added or removed a tag. But we don't want to skip any. |
| 2256 | 2256 | $old_pos = strlen($data) + $last_pos; |
@@ -2274,7 +2274,7 @@ discard block |
||
| 2274 | 2274 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
| 2275 | 2275 | |
| 2276 | 2276 | // A closing tag that doesn't match any open tags? Skip it. |
| 2277 | - if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags))) |
|
| 2277 | + if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags))) |
|
| 2278 | 2278 | continue; |
| 2279 | 2279 | |
| 2280 | 2280 | $to_close = array(); |
@@ -2347,7 +2347,7 @@ discard block |
||
| 2347 | 2347 | |
| 2348 | 2348 | foreach ($to_close as $tag) |
| 2349 | 2349 | { |
| 2350 | - $message = substr($message, 0, $pos) . "\n" . $tag['after'] . "\n" . substr($message, $pos2 + 1); |
|
| 2350 | + $message = substr($message, 0, $pos)."\n".$tag['after']."\n".substr($message, $pos2 + 1); |
|
| 2351 | 2351 | $pos += strlen($tag['after']) + 2; |
| 2352 | 2352 | $pos2 = $pos - 1; |
| 2353 | 2353 | |
@@ -2359,8 +2359,8 @@ discard block |
||
| 2359 | 2359 | if (!empty($tag['trim']) && $tag['trim'] != 'inside') |
| 2360 | 2360 | $whitespace_regex .= empty($tag['require_parents']) ? '( |\s)*' : '(<br>| |\s)*'; |
| 2361 | 2361 | |
| 2362 | - if (!empty($whitespace_regex) && preg_match('~' . $whitespace_regex . '~', substr($message, $pos), $matches) != 0) |
|
| 2363 | - $message = substr($message, 0, $pos) . substr($message, $pos + strlen($matches[0])); |
|
| 2362 | + if (!empty($whitespace_regex) && preg_match('~'.$whitespace_regex.'~', substr($message, $pos), $matches) != 0) |
|
| 2363 | + $message = substr($message, 0, $pos).substr($message, $pos + strlen($matches[0])); |
|
| 2364 | 2364 | } |
| 2365 | 2365 | |
| 2366 | 2366 | if (!empty($to_close)) |
@@ -2393,7 +2393,7 @@ discard block |
||
| 2393 | 2393 | break; |
| 2394 | 2394 | |
| 2395 | 2395 | // A test validation? |
| 2396 | - if (isset($possible['test']) && preg_match('~^' . $possible['test'] . '~', substr($message, $pos + 1 + $pt_strlen + 1)) === 0) |
|
| 2396 | + if (isset($possible['test']) && preg_match('~^'.$possible['test'].'~', substr($message, $pos + 1 + $pt_strlen + 1)) === 0) |
|
| 2397 | 2397 | continue; |
| 2398 | 2398 | // Do we want parameters? |
| 2399 | 2399 | elseif (!empty($possible['parameters'])) |
@@ -2440,7 +2440,7 @@ discard block |
||
| 2440 | 2440 | $quote_alt = !$quote_alt; |
| 2441 | 2441 | } |
| 2442 | 2442 | // Add a class to the quote to style alternating blockquotes |
| 2443 | - $possible['before'] = strtr($possible['before'], array('<blockquote>' => '<blockquote class="bbc_' . ($quote_alt ? 'alternate' : 'standard') . '_quote">')); |
|
| 2443 | + $possible['before'] = strtr($possible['before'], array('<blockquote>' => '<blockquote class="bbc_'.($quote_alt ? 'alternate' : 'standard').'_quote">')); |
|
| 2444 | 2444 | } |
| 2445 | 2445 | |
| 2446 | 2446 | // This is long, but it makes things much easier and cleaner. |
@@ -2449,13 +2449,13 @@ discard block |
||
| 2449 | 2449 | // Build a regular expression for each parameter for the current tag. |
| 2450 | 2450 | $preg = array(); |
| 2451 | 2451 | foreach ($possible['parameters'] as $p => $info) |
| 2452 | - $preg[] = '(\s+' . $p . '=' . (empty($info['quoted']) ? '' : '"') . (isset($info['match']) ? $info['match'] : '(.+?)') . (empty($info['quoted']) ? '' : '"') . '\s*)' . (empty($info['optional']) ? '' : '?'); |
|
| 2452 | + $preg[] = '(\s+'.$p.'='.(empty($info['quoted']) ? '' : '"').(isset($info['match']) ? $info['match'] : '(.+?)').(empty($info['quoted']) ? '' : '"').'\s*)'.(empty($info['optional']) ? '' : '?'); |
|
| 2453 | 2453 | |
| 2454 | 2454 | // Extract the string that potentially holds our parameters. |
| 2455 | - $blob = preg_split('~\[/?(?:' . $alltags_regex . ')~i', substr($message, $pos)); |
|
| 2455 | + $blob = preg_split('~\[/?(?:'.$alltags_regex.')~i', substr($message, $pos)); |
|
| 2456 | 2456 | $blobs = preg_split('~\]~i', $blob[1]); |
| 2457 | 2457 | |
| 2458 | - $splitters = implode('=|', array_keys($possible['parameters'])) . '='; |
|
| 2458 | + $splitters = implode('=|', array_keys($possible['parameters'])).'='; |
|
| 2459 | 2459 | |
| 2460 | 2460 | // Progressively append more blobs until we find our parameters or run out of blobs |
| 2461 | 2461 | $blob_counter = 1; |
@@ -2463,10 +2463,10 @@ discard block |
||
| 2463 | 2463 | { |
| 2464 | 2464 | $given_param_string = implode(']', array_slice($blobs, 0, $blob_counter++)); |
| 2465 | 2465 | |
| 2466 | - $given_params = preg_split('~\s(?=(' . $splitters . '))~i', $given_param_string); |
|
| 2466 | + $given_params = preg_split('~\s(?=('.$splitters.'))~i', $given_param_string); |
|
| 2467 | 2467 | sort($given_params, SORT_STRING); |
| 2468 | 2468 | |
| 2469 | - $match = preg_match('~^' . implode('', $preg) . '$~i', implode(' ', $given_params), $matches) !== 0; |
|
| 2469 | + $match = preg_match('~^'.implode('', $preg).'$~i', implode(' ', $given_params), $matches) !== 0; |
|
| 2470 | 2470 | |
| 2471 | 2471 | if ($match) |
| 2472 | 2472 | $blob_counter = count($blobs) + 1; |
@@ -2481,20 +2481,20 @@ discard block |
||
| 2481 | 2481 | { |
| 2482 | 2482 | $key = strtok(ltrim($matches[$i]), '='); |
| 2483 | 2483 | if (isset($possible['parameters'][$key]['value'])) |
| 2484 | - $params['{' . $key . '}'] = strtr($possible['parameters'][$key]['value'], array('$1' => $matches[$i + 1])); |
|
| 2484 | + $params['{'.$key.'}'] = strtr($possible['parameters'][$key]['value'], array('$1' => $matches[$i + 1])); |
|
| 2485 | 2485 | elseif (isset($possible['parameters'][$key]['validate'])) |
| 2486 | - $params['{' . $key . '}'] = $possible['parameters'][$key]['validate']($matches[$i + 1]); |
|
| 2486 | + $params['{'.$key.'}'] = $possible['parameters'][$key]['validate']($matches[$i + 1]); |
|
| 2487 | 2487 | else |
| 2488 | - $params['{' . $key . '}'] = $matches[$i + 1]; |
|
| 2488 | + $params['{'.$key.'}'] = $matches[$i + 1]; |
|
| 2489 | 2489 | |
| 2490 | 2490 | // Just to make sure: replace any $ or { so they can't interpolate wrongly. |
| 2491 | - $params['{' . $key . '}'] = strtr($params['{' . $key . '}'], array('$' => '$', '{' => '{')); |
|
| 2491 | + $params['{'.$key.'}'] = strtr($params['{'.$key.'}'], array('$' => '$', '{' => '{')); |
|
| 2492 | 2492 | } |
| 2493 | 2493 | |
| 2494 | 2494 | foreach ($possible['parameters'] as $p => $info) |
| 2495 | 2495 | { |
| 2496 | - if (!isset($params['{' . $p . '}'])) |
|
| 2497 | - $params['{' . $p . '}'] = ''; |
|
| 2496 | + if (!isset($params['{'.$p.'}'])) |
|
| 2497 | + $params['{'.$p.'}'] = ''; |
|
| 2498 | 2498 | } |
| 2499 | 2499 | |
| 2500 | 2500 | $tag = $possible; |
@@ -2556,8 +2556,8 @@ discard block |
||
| 2556 | 2556 | ); |
| 2557 | 2557 | |
| 2558 | 2558 | // First, open the tag... |
| 2559 | - $code .= '<li' . ($tag == '' ? '' : ' type="' . $tag . '"') . '>'; |
|
| 2560 | - $message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos + 3); |
|
| 2559 | + $code .= '<li'.($tag == '' ? '' : ' type="'.$tag.'"').'>'; |
|
| 2560 | + $message = substr($message, 0, $pos)."\n".$code."\n".substr($message, $pos + 3); |
|
| 2561 | 2561 | $pos += strlen($code) - 1 + 2; |
| 2562 | 2562 | |
| 2563 | 2563 | // Next, find the next break (if any.) If there's more itemcode after it, keep it going - otherwise close! |
@@ -2566,7 +2566,7 @@ discard block |
||
| 2566 | 2566 | if ($pos2 !== false && ($pos2 <= $pos3 || $pos3 === false)) |
| 2567 | 2567 | { |
| 2568 | 2568 | preg_match('~^(<br>| |\s|\[)+~', substr($message, $pos2 + 4), $matches); |
| 2569 | - $message = substr($message, 0, $pos2) . (!empty($matches[0]) && substr($matches[0], -1) == '[' ? '[/li]' : '[/li][/list]') . substr($message, $pos2); |
|
| 2569 | + $message = substr($message, 0, $pos2).(!empty($matches[0]) && substr($matches[0], -1) == '[' ? '[/li]' : '[/li][/list]').substr($message, $pos2); |
|
| 2570 | 2570 | |
| 2571 | 2571 | $open_tags[count($open_tags) - 2]['after'] = '</ul>'; |
| 2572 | 2572 | } |
@@ -2586,7 +2586,7 @@ discard block |
||
| 2586 | 2586 | { |
| 2587 | 2587 | array_pop($open_tags); |
| 2588 | 2588 | |
| 2589 | - $message = substr($message, 0, $pos) . "\n" . $inside['after'] . "\n" . substr($message, $pos); |
|
| 2589 | + $message = substr($message, 0, $pos)."\n".$inside['after']."\n".substr($message, $pos); |
|
| 2590 | 2590 | $pos += strlen($inside['after']) - 1 + 2; |
| 2591 | 2591 | } |
| 2592 | 2592 | |
@@ -2629,7 +2629,7 @@ discard block |
||
| 2629 | 2629 | // Close all the non block level tags so this tag isn't surrounded by them. |
| 2630 | 2630 | for ($i = count($open_tags) - 1; $i > $n; $i--) |
| 2631 | 2631 | { |
| 2632 | - $message = substr($message, 0, $pos) . "\n" . $open_tags[$i]['after'] . "\n" . substr($message, $pos); |
|
| 2632 | + $message = substr($message, 0, $pos)."\n".$open_tags[$i]['after']."\n".substr($message, $pos); |
|
| 2633 | 2633 | $ot_strlen = strlen($open_tags[$i]['after']); |
| 2634 | 2634 | $pos += $ot_strlen + 2; |
| 2635 | 2635 | $pos1 += $ot_strlen + 2; |
@@ -2640,8 +2640,8 @@ discard block |
||
| 2640 | 2640 | $whitespace_regex .= '( |\s)*(<br>)?'; |
| 2641 | 2641 | if (!empty($tag['trim']) && $tag['trim'] != 'inside') |
| 2642 | 2642 | $whitespace_regex .= empty($tag['require_parents']) ? '( |\s)*' : '(<br>| |\s)*'; |
| 2643 | - if (!empty($whitespace_regex) && preg_match('~' . $whitespace_regex . '~', substr($message, $pos), $matches) != 0) |
|
| 2644 | - $message = substr($message, 0, $pos) . substr($message, $pos + strlen($matches[0])); |
|
| 2643 | + if (!empty($whitespace_regex) && preg_match('~'.$whitespace_regex.'~', substr($message, $pos), $matches) != 0) |
|
| 2644 | + $message = substr($message, 0, $pos).substr($message, $pos + strlen($matches[0])); |
|
| 2645 | 2645 | |
| 2646 | 2646 | array_pop($open_tags); |
| 2647 | 2647 | } |
@@ -2655,13 +2655,13 @@ discard block |
||
| 2655 | 2655 | { |
| 2656 | 2656 | // @todo Check for end tag first, so people can say "I like that [i] tag"? |
| 2657 | 2657 | $open_tags[] = $tag; |
| 2658 | - $message = substr($message, 0, $pos) . "\n" . $tag['before'] . "\n" . substr($message, $pos1); |
|
| 2658 | + $message = substr($message, 0, $pos)."\n".$tag['before']."\n".substr($message, $pos1); |
|
| 2659 | 2659 | $pos += strlen($tag['before']) - 1 + 2; |
| 2660 | 2660 | } |
| 2661 | 2661 | // Don't parse the content, just skip it. |
| 2662 | 2662 | elseif ($tag['type'] == 'unparsed_content') |
| 2663 | 2663 | { |
| 2664 | - $pos2 = stripos($message, '[/' . substr($message, $pos + 1, $tag_strlen) . ']', $pos1); |
|
| 2664 | + $pos2 = stripos($message, '[/'.substr($message, $pos + 1, $tag_strlen).']', $pos1); |
|
| 2665 | 2665 | if ($pos2 === false) |
| 2666 | 2666 | continue; |
| 2667 | 2667 | |
@@ -2674,7 +2674,7 @@ discard block |
||
| 2674 | 2674 | $tag['validate']($tag, $data, $disabled, $params); |
| 2675 | 2675 | |
| 2676 | 2676 | $code = strtr($tag['content'], array('$1' => $data)); |
| 2677 | - $message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos2 + 3 + $tag_strlen); |
|
| 2677 | + $message = substr($message, 0, $pos)."\n".$code."\n".substr($message, $pos2 + 3 + $tag_strlen); |
|
| 2678 | 2678 | |
| 2679 | 2679 | $pos += strlen($code) - 1 + 2; |
| 2680 | 2680 | $last_pos = $pos + 1; |
@@ -2699,7 +2699,7 @@ discard block |
||
| 2699 | 2699 | if ($pos2 === false) |
| 2700 | 2700 | continue; |
| 2701 | 2701 | |
| 2702 | - $pos3 = stripos($message, '[/' . substr($message, $pos + 1, $tag_strlen) . ']', $pos2); |
|
| 2702 | + $pos3 = stripos($message, '[/'.substr($message, $pos + 1, $tag_strlen).']', $pos2); |
|
| 2703 | 2703 | if ($pos3 === false) |
| 2704 | 2704 | continue; |
| 2705 | 2705 | |
@@ -2716,14 +2716,14 @@ discard block |
||
| 2716 | 2716 | $tag['validate']($tag, $data, $disabled, $params); |
| 2717 | 2717 | |
| 2718 | 2718 | $code = strtr($tag['content'], array('$1' => $data[0], '$2' => $data[1])); |
| 2719 | - $message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos3 + 3 + $tag_strlen); |
|
| 2719 | + $message = substr($message, 0, $pos)."\n".$code."\n".substr($message, $pos3 + 3 + $tag_strlen); |
|
| 2720 | 2720 | $pos += strlen($code) - 1 + 2; |
| 2721 | 2721 | } |
| 2722 | 2722 | // A closed tag, with no content or value. |
| 2723 | 2723 | elseif ($tag['type'] == 'closed') |
| 2724 | 2724 | { |
| 2725 | 2725 | $pos2 = strpos($message, ']', $pos); |
| 2726 | - $message = substr($message, 0, $pos) . "\n" . $tag['content'] . "\n" . substr($message, $pos2 + 1); |
|
| 2726 | + $message = substr($message, 0, $pos)."\n".$tag['content']."\n".substr($message, $pos2 + 1); |
|
| 2727 | 2727 | $pos += strlen($tag['content']) - 1 + 2; |
| 2728 | 2728 | } |
| 2729 | 2729 | // This one is sorta ugly... :/. Unfortunately, it's needed for flash. |
@@ -2733,12 +2733,12 @@ discard block |
||
| 2733 | 2733 | if ($pos2 === false) |
| 2734 | 2734 | continue; |
| 2735 | 2735 | |
| 2736 | - $pos3 = stripos($message, '[/' . substr($message, $pos + 1, $tag_strlen) . ']', $pos2); |
|
| 2736 | + $pos3 = stripos($message, '[/'.substr($message, $pos + 1, $tag_strlen).']', $pos2); |
|
| 2737 | 2737 | if ($pos3 === false) |
| 2738 | 2738 | continue; |
| 2739 | 2739 | |
| 2740 | 2740 | // We want $1 to be the content, and the rest to be csv. |
| 2741 | - $data = explode(',', ',' . substr($message, $pos1, $pos2 - $pos1)); |
|
| 2741 | + $data = explode(',', ','.substr($message, $pos1, $pos2 - $pos1)); |
|
| 2742 | 2742 | $data[0] = substr($message, $pos2 + 1, $pos3 - $pos2 - 1); |
| 2743 | 2743 | |
| 2744 | 2744 | if (isset($tag['validate'])) |
@@ -2746,8 +2746,8 @@ discard block |
||
| 2746 | 2746 | |
| 2747 | 2747 | $code = $tag['content']; |
| 2748 | 2748 | foreach ($data as $k => $d) |
| 2749 | - $code = strtr($code, array('$' . ($k + 1) => trim($d))); |
|
| 2750 | - $message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos3 + 3 + $tag_strlen); |
|
| 2749 | + $code = strtr($code, array('$'.($k + 1) => trim($d))); |
|
| 2750 | + $message = substr($message, 0, $pos)."\n".$code."\n".substr($message, $pos3 + 3 + $tag_strlen); |
|
| 2751 | 2751 | $pos += strlen($code) - 1 + 2; |
| 2752 | 2752 | } |
| 2753 | 2753 | // This has parsed content, and a csv value which is unparsed. |
@@ -2764,15 +2764,15 @@ discard block |
||
| 2764 | 2764 | |
| 2765 | 2765 | // Fix after, for disabled code mainly. |
| 2766 | 2766 | foreach ($data as $k => $d) |
| 2767 | - $tag['after'] = strtr($tag['after'], array('$' . ($k + 1) => trim($d))); |
|
| 2767 | + $tag['after'] = strtr($tag['after'], array('$'.($k + 1) => trim($d))); |
|
| 2768 | 2768 | |
| 2769 | 2769 | $open_tags[] = $tag; |
| 2770 | 2770 | |
| 2771 | 2771 | // Replace them out, $1, $2, $3, $4, etc. |
| 2772 | 2772 | $code = $tag['before']; |
| 2773 | 2773 | foreach ($data as $k => $d) |
| 2774 | - $code = strtr($code, array('$' . ($k + 1) => trim($d))); |
|
| 2775 | - $message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos2 + 1); |
|
| 2774 | + $code = strtr($code, array('$'.($k + 1) => trim($d))); |
|
| 2775 | + $message = substr($message, 0, $pos)."\n".$code."\n".substr($message, $pos2 + 1); |
|
| 2776 | 2776 | $pos += strlen($code) - 1 + 2; |
| 2777 | 2777 | } |
| 2778 | 2778 | // A tag set to a value, parsed or not. |
@@ -2810,22 +2810,22 @@ discard block |
||
| 2810 | 2810 | $open_tags[] = $tag; |
| 2811 | 2811 | |
| 2812 | 2812 | $code = strtr($tag['before'], array('$1' => $data)); |
| 2813 | - $message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos2 + ($quoted == false ? 1 : 7)); |
|
| 2813 | + $message = substr($message, 0, $pos)."\n".$code."\n".substr($message, $pos2 + ($quoted == false ? 1 : 7)); |
|
| 2814 | 2814 | $pos += strlen($code) - 1 + 2; |
| 2815 | 2815 | } |
| 2816 | 2816 | |
| 2817 | 2817 | // If this is block level, eat any breaks after it. |
| 2818 | 2818 | if (!empty($tag['block_level']) && substr($message, $pos + 1, 4) == '<br>') |
| 2819 | - $message = substr($message, 0, $pos + 1) . substr($message, $pos + 5); |
|
| 2819 | + $message = substr($message, 0, $pos + 1).substr($message, $pos + 5); |
|
| 2820 | 2820 | |
| 2821 | 2821 | // Are we trimming outside this tag? |
| 2822 | 2822 | if (!empty($tag['trim']) && $tag['trim'] != 'outside' && preg_match('~(<br>| |\s)*~', substr($message, $pos + 1), $matches) != 0) |
| 2823 | - $message = substr($message, 0, $pos + 1) . substr($message, $pos + 1 + strlen($matches[0])); |
|
| 2823 | + $message = substr($message, 0, $pos + 1).substr($message, $pos + 1 + strlen($matches[0])); |
|
| 2824 | 2824 | } |
| 2825 | 2825 | |
| 2826 | 2826 | // Close any remaining tags. |
| 2827 | 2827 | while ($tag = array_pop($open_tags)) |
| 2828 | - $message .= "\n" . $tag['after'] . "\n"; |
|
| 2828 | + $message .= "\n".$tag['after']."\n"; |
|
| 2829 | 2829 | |
| 2830 | 2830 | // Parse the smileys within the parts where it can be done safely. |
| 2831 | 2831 | if ($smileys === true) |
@@ -2842,7 +2842,7 @@ discard block |
||
| 2842 | 2842 | $message = strtr($message, array("\n" => '')); |
| 2843 | 2843 | |
| 2844 | 2844 | if ($message !== '' && $message[0] === ' ') |
| 2845 | - $message = ' ' . substr($message, 1); |
|
| 2845 | + $message = ' '.substr($message, 1); |
|
| 2846 | 2846 | |
| 2847 | 2847 | // Cleanup whitespace. |
| 2848 | 2848 | $message = strtr($message, array(' ' => ' ', "\r" => '', "\n" => '<br>', '<br> ' => '<br> ', ' ' => "\n")); |
@@ -2932,12 +2932,12 @@ discard block |
||
| 2932 | 2932 | } |
| 2933 | 2933 | |
| 2934 | 2934 | // Set proper extensions; do this post caching so cache doesn't become extension-specific |
| 2935 | - foreach($smileysto AS $ix=>$file) |
|
| 2935 | + foreach ($smileysto AS $ix=>$file) |
|
| 2936 | 2936 | // Need to use the default if user selection is disabled |
| 2937 | 2937 | if (empty($modSettings['smiley_sets_enable'])) |
| 2938 | - $smileysto[$ix] = $file . $context['user']['smiley_set_default_ext']; |
|
| 2938 | + $smileysto[$ix] = $file.$context['user']['smiley_set_default_ext']; |
|
| 2939 | 2939 | else |
| 2940 | - $smileysto[$ix] = $file . $user_info['smiley_set_ext']; |
|
| 2940 | + $smileysto[$ix] = $file.$user_info['smiley_set_ext']; |
|
| 2941 | 2941 | |
| 2942 | 2942 | // The non-breaking-space is a complex thing... |
| 2943 | 2943 | $non_breaking_space = $context['utf8'] ? '\x{A0}' : '\xA0'; |
@@ -2945,12 +2945,12 @@ discard block |
||
| 2945 | 2945 | // This smiley regex makes sure it doesn't parse smileys within code tags (so [url=mailto:[email protected]] doesn't parse the :D smiley) |
| 2946 | 2946 | $smileyPregReplacements = array(); |
| 2947 | 2947 | $searchParts = array(); |
| 2948 | - $smileys_path = $smcFunc['htmlspecialchars']($modSettings['smileys_url'] . '/' . $user_info['smiley_set'] . '/'); |
|
| 2948 | + $smileys_path = $smcFunc['htmlspecialchars']($modSettings['smileys_url'].'/'.$user_info['smiley_set'].'/'); |
|
| 2949 | 2949 | |
| 2950 | 2950 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2951 | 2951 | { |
| 2952 | 2952 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2953 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2953 | + $smileyCode = '<img src="'.$smileys_path.$smileysto[$i].'" alt="'.strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')).'" title="'.strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')).'" class="smiley">'; |
|
| 2954 | 2954 | |
| 2955 | 2955 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2956 | 2956 | |
@@ -2970,12 +2970,12 @@ discard block |
||
| 2970 | 2970 | } |
| 2971 | 2971 | } |
| 2972 | 2972 | |
| 2973 | - $smileyPregSearch = '~(?<=[>:\?\.\s' . $non_breaking_space . '[\]()*\\\;]|(?<![a-zA-Z0-9])\(|^)(' . build_regex($searchParts, '~') . ')(?=[^[:alpha:]0-9]|$)~' . ($context['utf8'] ? 'u' : ''); |
|
| 2973 | + $smileyPregSearch = '~(?<=[>:\?\.\s'.$non_breaking_space.'[\]()*\\\;]|(?<![a-zA-Z0-9])\(|^)('.build_regex($searchParts, '~').')(?=[^[:alpha:]0-9]|$)~'.($context['utf8'] ? 'u' : ''); |
|
| 2974 | 2974 | } |
| 2975 | 2975 | |
| 2976 | 2976 | // Replace away! |
| 2977 | 2977 | $message = preg_replace_callback($smileyPregSearch, |
| 2978 | - function ($matches) use ($smileyPregReplacements) |
|
| 2978 | + function($matches) use ($smileyPregReplacements) |
|
| 2979 | 2979 | { |
| 2980 | 2980 | return $smileyPregReplacements[$matches[1]]; |
| 2981 | 2981 | }, $message); |
@@ -3003,7 +3003,7 @@ discard block |
||
| 3003 | 3003 | error_reporting($oldlevel); |
| 3004 | 3004 | |
| 3005 | 3005 | // Yes, I know this is kludging it, but this is the best way to preserve tabs from PHP :P. |
| 3006 | - $buffer = preg_replace('~SMF_TAB(?:</(?:font|span)><(?:font color|span style)="[^"]*?">)?\\(\\);~', '<pre style="display: inline;">' . "\t" . '</pre>', $buffer); |
|
| 3006 | + $buffer = preg_replace('~SMF_TAB(?:</(?:font|span)><(?:font color|span style)="[^"]*?">)?\\(\\);~', '<pre style="display: inline;">'."\t".'</pre>', $buffer); |
|
| 3007 | 3007 | |
| 3008 | 3008 | return strtr($buffer, array('\'' => ''', '<code>' => '', '</code>' => '')); |
| 3009 | 3009 | } |
@@ -3030,7 +3030,7 @@ discard block |
||
| 3030 | 3030 | return strtr($url, array('http://' => 'https://')); |
| 3031 | 3031 | |
| 3032 | 3032 | // By default, use SMF's own image proxy script |
| 3033 | - $proxied_url = strtr($boardurl, array('http://' => 'https://')) . '/proxy.php?request=' . urlencode($url) . '&hash=' . md5($url . $image_proxy_secret); |
|
| 3033 | + $proxied_url = strtr($boardurl, array('http://' => 'https://')).'/proxy.php?request='.urlencode($url).'&hash='.md5($url.$image_proxy_secret); |
|
| 3034 | 3034 | |
| 3035 | 3035 | // Allow mods to easily implement an alternative proxy |
| 3036 | 3036 | // MOD AUTHORS: To add settings UI for your proxy, use the integrate_general_settings hook. |
@@ -3059,28 +3059,28 @@ discard block |
||
| 3059 | 3059 | $add = preg_match('~^(ftp|http)[s]?://~', $setLocation) == 0 && substr($setLocation, 0, 6) != 'about:'; |
| 3060 | 3060 | |
| 3061 | 3061 | if ($add) |
| 3062 | - $setLocation = $scripturl . ($setLocation != '' ? '?' . $setLocation : ''); |
|
| 3062 | + $setLocation = $scripturl.($setLocation != '' ? '?'.$setLocation : ''); |
|
| 3063 | 3063 | |
| 3064 | 3064 | // Put the session ID in. |
| 3065 | 3065 | if (defined('SID') && SID != '') |
| 3066 | - $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '(?!\?' . preg_quote(SID, '/') . ')\\??/', $scripturl . '?' . SID . ';', $setLocation); |
|
| 3066 | + $setLocation = preg_replace('/^'.preg_quote($scripturl, '/').'(?!\?'.preg_quote(SID, '/').')\\??/', $scripturl.'?'.SID.';', $setLocation); |
|
| 3067 | 3067 | // Keep that debug in their for template debugging! |
| 3068 | 3068 | elseif (isset($_GET['debug'])) |
| 3069 | - $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\\??/', $scripturl . '?debug;', $setLocation); |
|
| 3069 | + $setLocation = preg_replace('/^'.preg_quote($scripturl, '/').'\\??/', $scripturl.'?debug;', $setLocation); |
|
| 3070 | 3070 | |
| 3071 | 3071 | if (!empty($modSettings['queryless_urls']) && (empty($context['server']['is_cgi']) || ini_get('cgi.fix_pathinfo') == 1 || @get_cfg_var('cgi.fix_pathinfo') == 1) && (!empty($context['server']['is_apache']) || !empty($context['server']['is_lighttpd']) || !empty($context['server']['is_litespeed']))) |
| 3072 | 3072 | { |
| 3073 | 3073 | if (defined('SID') && SID != '') |
| 3074 | - $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
|
| 3075 | - function ($m) use ($scripturl) |
|
| 3074 | + $setLocation = preg_replace_callback('~^'.preg_quote($scripturl, '~').'\?(?:'.SID.'(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
|
| 3075 | + function($m) use ($scripturl) |
|
| 3076 | 3076 | { |
| 3077 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 3077 | + return $scripturl.'/'.strtr("$m[1]", '&;=', '//,').'.html?'.SID.(isset($m[2]) ? "$m[2]" : ""); |
|
| 3078 | 3078 | }, $setLocation); |
| 3079 | 3079 | else |
| 3080 | - $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
|
| 3081 | - function ($m) use ($scripturl) |
|
| 3080 | + $setLocation = preg_replace_callback('~^'.preg_quote($scripturl, '~').'\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
|
| 3081 | + function($m) use ($scripturl) |
|
| 3082 | 3082 | { |
| 3083 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
|
| 3083 | + return $scripturl.'/'.strtr("$m[1]", '&;=', '//,').'.html'.(isset($m[2]) ? "$m[2]" : ""); |
|
| 3084 | 3084 | }, $setLocation); |
| 3085 | 3085 | } |
| 3086 | 3086 | |
@@ -3088,7 +3088,7 @@ discard block |
||
| 3088 | 3088 | call_integration_hook('integrate_redirect', array(&$setLocation, &$refresh, &$permanent)); |
| 3089 | 3089 | |
| 3090 | 3090 | // Set the header. |
| 3091 | - header('location: ' . str_replace(' ', '%20', $setLocation), true, $permanent ? 301 : 302); |
|
| 3091 | + header('location: '.str_replace(' ', '%20', $setLocation), true, $permanent ? 301 : 302); |
|
| 3092 | 3092 | |
| 3093 | 3093 | // Debugging. |
| 3094 | 3094 | if (isset($db_show_debug) && $db_show_debug === true) |
@@ -3133,7 +3133,7 @@ discard block |
||
| 3133 | 3133 | { |
| 3134 | 3134 | // Was the page title set last minute? Also update the HTML safe one. |
| 3135 | 3135 | if (!empty($context['page_title']) && empty($context['page_title_html_safe'])) |
| 3136 | - $context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : ''); |
|
| 3136 | + $context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])).(!empty($context['current_page']) ? ' - '.$txt['page'].' '.($context['current_page'] + 1) : ''); |
|
| 3137 | 3137 | |
| 3138 | 3138 | // Start up the session URL fixer. |
| 3139 | 3139 | ob_start('ob_sessrewrite'); |
@@ -3214,7 +3214,7 @@ discard block |
||
| 3214 | 3214 | $url = str_replace(' ', '%20', $url); |
| 3215 | 3215 | |
| 3216 | 3216 | // Can we pull this from the cache... please please? |
| 3217 | - if (($temp = cache_get_data('url_image_size-' . md5($url), 240)) !== null) |
|
| 3217 | + if (($temp = cache_get_data('url_image_size-'.md5($url), 240)) !== null) |
|
| 3218 | 3218 | return $temp; |
| 3219 | 3219 | $t = microtime(true); |
| 3220 | 3220 | |
@@ -3240,7 +3240,7 @@ discard block |
||
| 3240 | 3240 | if ($fp != false) |
| 3241 | 3241 | { |
| 3242 | 3242 | // Send the HEAD request (since we don't have to worry about chunked, HTTP/1.1 is fine here.) |
| 3243 | - fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'User-Agent: PHP/SMF' . "\r\n" . 'Connection: close' . "\r\n\r\n"); |
|
| 3243 | + fwrite($fp, 'HEAD /'.$match[2].' HTTP/1.1'."\r\n".'Host: '.$match[1]."\r\n".'User-Agent: PHP/SMF'."\r\n".'Connection: close'."\r\n\r\n"); |
|
| 3244 | 3244 | |
| 3245 | 3245 | // Read in the HTTP/1.1 or whatever. |
| 3246 | 3246 | $test = substr(fgets($fp, 11), -1); |
@@ -3272,7 +3272,7 @@ discard block |
||
| 3272 | 3272 | |
| 3273 | 3273 | // If this took a long time, we may never have to do it again, but then again we might... |
| 3274 | 3274 | if (microtime(true) - $t > 0.8) |
| 3275 | - cache_put_data('url_image_size-' . md5($url), $size, 240); |
|
| 3275 | + cache_put_data('url_image_size-'.md5($url), $size, 240); |
|
| 3276 | 3276 | |
| 3277 | 3277 | // Didn't work. |
| 3278 | 3278 | return $size; |
@@ -3307,7 +3307,7 @@ discard block |
||
| 3307 | 3307 | continue; |
| 3308 | 3308 | |
| 3309 | 3309 | // Clean it up for presentation ;). |
| 3310 | - $context['news_lines'][$i] = parse_bbc(stripslashes(trim($context['news_lines'][$i])), true, 'news' . $i); |
|
| 3310 | + $context['news_lines'][$i] = parse_bbc(stripslashes(trim($context['news_lines'][$i])), true, 'news'.$i); |
|
| 3311 | 3311 | } |
| 3312 | 3312 | if (!empty($context['news_lines'])) |
| 3313 | 3313 | $context['random_news_line'] = $context['news_lines'][mt_rand(0, count($context['news_lines']) - 1)]; |
@@ -3340,19 +3340,19 @@ discard block |
||
| 3340 | 3340 | } |
| 3341 | 3341 | // Uploaded? |
| 3342 | 3342 | elseif ($user_info['avatar']['url'] == '' && !empty($user_info['avatar']['id_attach'])) |
| 3343 | - $context['user']['avatar']['href'] = $user_info['avatar']['custom_dir'] ? $modSettings['custom_avatar_url'] . '/' . $user_info['avatar']['filename'] : $scripturl . '?action=dlattach;attach=' . $user_info['avatar']['id_attach'] . ';type=avatar'; |
|
| 3343 | + $context['user']['avatar']['href'] = $user_info['avatar']['custom_dir'] ? $modSettings['custom_avatar_url'].'/'.$user_info['avatar']['filename'] : $scripturl.'?action=dlattach;attach='.$user_info['avatar']['id_attach'].';type=avatar'; |
|
| 3344 | 3344 | // Full URL? |
| 3345 | 3345 | elseif (strpos($user_info['avatar']['url'], 'http://') === 0 || strpos($user_info['avatar']['url'], 'https://') === 0) |
| 3346 | 3346 | $context['user']['avatar']['href'] = $user_info['avatar']['url']; |
| 3347 | 3347 | // Otherwise we assume it's server stored. |
| 3348 | 3348 | elseif ($user_info['avatar']['url'] != '') |
| 3349 | - $context['user']['avatar']['href'] = $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($user_info['avatar']['url']); |
|
| 3349 | + $context['user']['avatar']['href'] = $modSettings['avatar_url'].'/'.$smcFunc['htmlspecialchars']($user_info['avatar']['url']); |
|
| 3350 | 3350 | // No avatar at all? Fine, we have a big fat default avatar ;) |
| 3351 | 3351 | else |
| 3352 | - $context['user']['avatar']['href'] = $modSettings['avatar_url'] . '/default.png'; |
|
| 3352 | + $context['user']['avatar']['href'] = $modSettings['avatar_url'].'/default.png'; |
|
| 3353 | 3353 | |
| 3354 | 3354 | if (!empty($context['user']['avatar'])) |
| 3355 | - $context['user']['avatar']['image'] = '<img src="' . $context['user']['avatar']['href'] . '" alt="" class="avatar">'; |
|
| 3355 | + $context['user']['avatar']['image'] = '<img src="'.$context['user']['avatar']['href'].'" alt="" class="avatar">'; |
|
| 3356 | 3356 | |
| 3357 | 3357 | // Figure out how long they've been logged in. |
| 3358 | 3358 | $context['user']['total_time_logged_in'] = array( |
@@ -3391,36 +3391,36 @@ discard block |
||
| 3391 | 3391 | addInlineJavaScript(' |
| 3392 | 3392 | jQuery(document).ready(function($) { |
| 3393 | 3393 | new smc_Popup({ |
| 3394 | - heading: ' . JavaScriptEscape($txt['show_personal_messages_heading']) . ', |
|
| 3395 | - content: ' . JavaScriptEscape(sprintf($txt['show_personal_messages'], $context['user']['unread_messages'], $scripturl . '?action=pm')) . ', |
|
| 3394 | + heading: ' . JavaScriptEscape($txt['show_personal_messages_heading']).', |
|
| 3395 | + content: ' . JavaScriptEscape(sprintf($txt['show_personal_messages'], $context['user']['unread_messages'], $scripturl.'?action=pm')).', |
|
| 3396 | 3396 | icon_class: \'generic_icons mail_new\' |
| 3397 | 3397 | }); |
| 3398 | 3398 | });'); |
| 3399 | 3399 | |
| 3400 | 3400 | // Add a generic "Are you sure?" confirmation message. |
| 3401 | 3401 | addInlineJavaScript(' |
| 3402 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3402 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']).';'); |
|
| 3403 | 3403 | |
| 3404 | 3404 | // Now add the capping code for avatars. |
| 3405 | 3405 | if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize') |
| 3406 | 3406 | addInlineCss(' |
| 3407 | - img.avatar { max-width: ' . $modSettings['avatar_max_width_external'] . 'px; max-height: ' . $modSettings['avatar_max_height_external'] . 'px; }'); |
|
| 3407 | + img.avatar { max-width: ' . $modSettings['avatar_max_width_external'].'px; max-height: '.$modSettings['avatar_max_height_external'].'px; }'); |
|
| 3408 | 3408 | |
| 3409 | 3409 | // Add max image limits |
| 3410 | 3410 | if (!empty($modSettings['max_image_width'])) |
| 3411 | 3411 | addInlineCss(' |
| 3412 | - .postarea .bbc_img { max-width: ' . $modSettings['max_image_width'] . 'px; }'); |
|
| 3412 | + .postarea .bbc_img { max-width: ' . $modSettings['max_image_width'].'px; }'); |
|
| 3413 | 3413 | |
| 3414 | 3414 | if (!empty($modSettings['max_image_height'])) |
| 3415 | 3415 | addInlineCss(' |
| 3416 | - .postarea .bbc_img { max-height: ' . $modSettings['max_image_height'] . 'px; }'); |
|
| 3416 | + .postarea .bbc_img { max-height: ' . $modSettings['max_image_height'].'px; }'); |
|
| 3417 | 3417 | |
| 3418 | 3418 | // This looks weird, but it's because BoardIndex.php references the variable. |
| 3419 | 3419 | $context['common_stats']['latest_member'] = array( |
| 3420 | 3420 | 'id' => $modSettings['latestMember'], |
| 3421 | 3421 | 'name' => $modSettings['latestRealName'], |
| 3422 | - 'href' => $scripturl . '?action=profile;u=' . $modSettings['latestMember'], |
|
| 3423 | - 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $modSettings['latestMember'] . '">' . $modSettings['latestRealName'] . '</a>', |
|
| 3422 | + 'href' => $scripturl.'?action=profile;u='.$modSettings['latestMember'], |
|
| 3423 | + 'link' => '<a href="'.$scripturl.'?action=profile;u='.$modSettings['latestMember'].'">'.$modSettings['latestRealName'].'</a>', |
|
| 3424 | 3424 | ); |
| 3425 | 3425 | $context['common_stats'] = array( |
| 3426 | 3426 | 'total_posts' => comma_format($modSettings['totalMessages']), |
@@ -3437,7 +3437,7 @@ discard block |
||
| 3437 | 3437 | $context['page_title'] = ''; |
| 3438 | 3438 | |
| 3439 | 3439 | // Set some specific vars. |
| 3440 | - $context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : ''); |
|
| 3440 | + $context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])).(!empty($context['current_page']) ? ' - '.$txt['page'].' '.($context['current_page'] + 1) : ''); |
|
| 3441 | 3441 | $context['meta_keywords'] = !empty($modSettings['meta_keywords']) ? $smcFunc['htmlspecialchars']($modSettings['meta_keywords']) : ''; |
| 3442 | 3442 | |
| 3443 | 3443 | // Content related meta tags, including Open Graph |
@@ -3489,7 +3489,7 @@ discard block |
||
| 3489 | 3489 | // if more is needed, request it |
| 3490 | 3490 | if ($memory_current < $memory_needed) |
| 3491 | 3491 | { |
| 3492 | - @ini_set('memory_limit', ceil($memory_needed / 1048576) . 'M'); |
|
| 3492 | + @ini_set('memory_limit', ceil($memory_needed / 1048576).'M'); |
|
| 3493 | 3493 | $memory_current = memoryReturnBytes(ini_get('memory_limit')); |
| 3494 | 3494 | } |
| 3495 | 3495 | |
@@ -3541,16 +3541,16 @@ discard block |
||
| 3541 | 3541 | if (empty($context['no_last_modified'])) |
| 3542 | 3542 | { |
| 3543 | 3543 | header('expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 3544 | - header('last-modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 3544 | + header('last-modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 3545 | 3545 | |
| 3546 | 3546 | // Are we debugging the template/html content? |
| 3547 | 3547 | if (!isset($_REQUEST['xml']) && isset($_GET['debug']) && !isBrowser('ie')) |
| 3548 | 3548 | header('content-type: application/xhtml+xml'); |
| 3549 | 3549 | elseif (!isset($_REQUEST['xml'])) |
| 3550 | - header('content-type: text/html; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set'])); |
|
| 3550 | + header('content-type: text/html; charset='.(empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set'])); |
|
| 3551 | 3551 | } |
| 3552 | 3552 | |
| 3553 | - header('content-type: text/' . (isset($_REQUEST['xml']) ? 'xml' : 'html') . '; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set'])); |
|
| 3553 | + header('content-type: text/'.(isset($_REQUEST['xml']) ? 'xml' : 'html').'; charset='.(empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set'])); |
|
| 3554 | 3554 | |
| 3555 | 3555 | // We need to splice this in after the body layer, or after the main layer for older stuff. |
| 3556 | 3556 | if ($context['in_maintenance'] && $context['user']['is_admin']) |
@@ -3571,7 +3571,7 @@ discard block |
||
| 3571 | 3571 | $showed_banned = false; |
| 3572 | 3572 | foreach ($context['template_layers'] as $layer) |
| 3573 | 3573 | { |
| 3574 | - loadSubTemplate($layer . '_above', true); |
|
| 3574 | + loadSubTemplate($layer.'_above', true); |
|
| 3575 | 3575 | |
| 3576 | 3576 | // May seem contrived, but this is done in case the body and main layer aren't there... |
| 3577 | 3577 | if (in_array($layer, array('body', 'main')) && allowedTo('admin_forum') && !$user_info['is_guest'] && !$checked_securityFiles) |
@@ -3585,7 +3585,7 @@ discard block |
||
| 3585 | 3585 | |
| 3586 | 3586 | foreach ($securityFiles as $i => $securityFile) |
| 3587 | 3587 | { |
| 3588 | - if (!file_exists($boarddir . '/' . $securityFile)) |
|
| 3588 | + if (!file_exists($boarddir.'/'.$securityFile)) |
|
| 3589 | 3589 | unset($securityFiles[$i]); |
| 3590 | 3590 | } |
| 3591 | 3591 | |
@@ -3601,7 +3601,7 @@ discard block |
||
| 3601 | 3601 | |
| 3602 | 3602 | // If agreement is enabled, at least the english version shall exists |
| 3603 | 3603 | if ($modSettings['requireAgreement']) |
| 3604 | - $agreement = !file_exists($boarddir . '/agreement.txt'); |
|
| 3604 | + $agreement = !file_exists($boarddir.'/agreement.txt'); |
|
| 3605 | 3605 | |
| 3606 | 3606 | if (!empty($securityFiles) || (!empty($modSettings['cache_enable']) && !is_writable($cachedir)) || !empty($agreement)) |
| 3607 | 3607 | { |
@@ -3687,7 +3687,7 @@ discard block |
||
| 3687 | 3687 | $context['load_queries'] = $db_count; |
| 3688 | 3688 | |
| 3689 | 3689 | foreach (array_reverse($context['template_layers']) as $layer) |
| 3690 | - loadSubTemplate($layer . '_below', true); |
|
| 3690 | + loadSubTemplate($layer.'_below', true); |
|
| 3691 | 3691 | } |
| 3692 | 3692 | |
| 3693 | 3693 | /** |
@@ -3865,12 +3865,12 @@ discard block |
||
| 3865 | 3865 | if (!empty($normal)) |
| 3866 | 3866 | foreach ($normal as $nf) |
| 3867 | 3867 | echo ' |
| 3868 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3868 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3869 | 3869 | |
| 3870 | 3870 | if ($db_show_debug === true) |
| 3871 | 3871 | { |
| 3872 | 3872 | // Try to keep only what's useful. |
| 3873 | - $repl = array($boardurl . '/Themes/' => '', $boardurl . '/' => ''); |
|
| 3873 | + $repl = array($boardurl.'/Themes/' => '', $boardurl.'/' => ''); |
|
| 3874 | 3874 | foreach ($context['css_files'] as $file) |
| 3875 | 3875 | $context['debug']['sheets'][] = strtr($file['fileName'], $repl); |
| 3876 | 3876 | } |
@@ -3881,7 +3881,7 @@ discard block |
||
| 3881 | 3881 | <style>'; |
| 3882 | 3882 | |
| 3883 | 3883 | foreach ($context['css_header'] as $css) |
| 3884 | - echo $css .' |
|
| 3884 | + echo $css.' |
|
| 3885 | 3885 | '; |
| 3886 | 3886 | |
| 3887 | 3887 | echo' |
@@ -3909,15 +3909,15 @@ discard block |
||
| 3909 | 3909 | return $data; |
| 3910 | 3910 | |
| 3911 | 3911 | // Different pages include different files, so we use a hash to label the different combinations |
| 3912 | - $hash = md5(implode(' ', array_map(function($file) { return $file['filePath'] . (int) @filesize($file['filePath']) . (int) @filemtime($file['filePath']); }, $data))); |
|
| 3912 | + $hash = md5(implode(' ', array_map(function($file) { return $file['filePath'].(int) @filesize($file['filePath']).(int) @filemtime($file['filePath']); }, $data))); |
|
| 3913 | 3913 | |
| 3914 | 3914 | // Did we already do this? |
| 3915 | - list($toCache, $async, $defer) = array_pad((array) cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type . '_' . $hash, 86400), 3, null); |
|
| 3915 | + list($toCache, $async, $defer) = array_pad((array) cache_get_data('minimized_'.$settings['theme_id'].'_'.$type.'_'.$hash, 86400), 3, null); |
|
| 3916 | 3916 | |
| 3917 | 3917 | // Already done? |
| 3918 | 3918 | if (!empty($toCache)) |
| 3919 | 3919 | return array('smf_minified' => array( |
| 3920 | - 'fileUrl' => $settings['theme_url'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/' . basename($toCache), |
|
| 3920 | + 'fileUrl' => $settings['theme_url'].'/'.($type == 'css' ? 'css' : 'scripts').'/'.basename($toCache), |
|
| 3921 | 3921 | 'filePath' => $toCache, |
| 3922 | 3922 | 'fileName' => basename($toCache), |
| 3923 | 3923 | 'options' => array('async' => !empty($async), 'defer' => !empty($defer)), |
@@ -3925,20 +3925,20 @@ discard block |
||
| 3925 | 3925 | |
| 3926 | 3926 | |
| 3927 | 3927 | // No namespaces, sorry! |
| 3928 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3928 | + $classType = 'MatthiasMullie\\Minify\\'.strtoupper($type); |
|
| 3929 | 3929 | |
| 3930 | 3930 | // Temp path. |
| 3931 | - $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
|
| 3931 | + $cTempPath = $settings['theme_dir'].'/'.($type == 'css' ? 'css' : 'scripts').'/'; |
|
| 3932 | 3932 | |
| 3933 | 3933 | // What kind of file are we going to create? |
| 3934 | - $toCreate = $cTempPath . 'minified_' . $hash . '.' . $type; |
|
| 3934 | + $toCreate = $cTempPath.'minified_'.$hash.'.'.$type; |
|
| 3935 | 3935 | |
| 3936 | 3936 | // File has to exist. If it doesn't, try to create it. |
| 3937 | 3937 | if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate)) |
| 3938 | 3938 | { |
| 3939 | 3939 | loadLanguage('Errors'); |
| 3940 | 3940 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3941 | - cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type . '_' . $hash, null); |
|
| 3941 | + cache_put_data('minimized_'.$settings['theme_id'].'_'.$type.'_'.$hash, null); |
|
| 3942 | 3942 | |
| 3943 | 3943 | // The process failed, so roll back to print each individual file. |
| 3944 | 3944 | return $data; |
@@ -3990,17 +3990,17 @@ discard block |
||
| 3990 | 3990 | { |
| 3991 | 3991 | loadLanguage('Errors'); |
| 3992 | 3992 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3993 | - cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type . '_' . $hash, null); |
|
| 3993 | + cache_put_data('minimized_'.$settings['theme_id'].'_'.$type.'_'.$hash, null); |
|
| 3994 | 3994 | |
| 3995 | 3995 | // The process failed so roll back to print each individual file. |
| 3996 | 3996 | return $data; |
| 3997 | 3997 | } |
| 3998 | 3998 | |
| 3999 | 3999 | // And create a one day cache entry. |
| 4000 | - cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type . '_' . $hash, array($toCache, $async, $defer), 86400); |
|
| 4000 | + cache_put_data('minimized_'.$settings['theme_id'].'_'.$type.'_'.$hash, array($toCache, $async, $defer), 86400); |
|
| 4001 | 4001 | |
| 4002 | 4002 | return array('smf_minified' => array( |
| 4003 | - 'fileUrl' => $settings['theme_url'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/' . basename($toCreate), |
|
| 4003 | + 'fileUrl' => $settings['theme_url'].'/'.($type == 'css' ? 'css' : 'scripts').'/'.basename($toCreate), |
|
| 4004 | 4004 | 'filePath' => $toCreate, |
| 4005 | 4005 | 'fileName' => basename($toCreate), |
| 4006 | 4006 | 'options' => array('async' => $async, 'defer' => $defer), |
@@ -4029,11 +4029,11 @@ discard block |
||
| 4029 | 4029 | { |
| 4030 | 4030 | foreach (array('css', 'js') as $type) |
| 4031 | 4031 | { |
| 4032 | - foreach (glob(rtrim($theme['dir'], '/') . '/' . ($type == 'css' ? 'css' : 'scripts') . '/minified*.' . $type) as $filename) |
|
| 4032 | + foreach (glob(rtrim($theme['dir'], '/').'/'.($type == 'css' ? 'css' : 'scripts').'/minified*.'.$type) as $filename) |
|
| 4033 | 4033 | { |
| 4034 | 4034 | // Remove the cache entry |
| 4035 | - if (preg_match('~([a-zA-Z0-9]+)\.' . $type . '$~', $filename, $matches)) |
|
| 4036 | - cache_put_data('minimized_' . $theme['id'] . '_' . $type . '_' . $matches[1], null); |
|
| 4035 | + if (preg_match('~([a-zA-Z0-9]+)\.'.$type.'$~', $filename, $matches)) |
|
| 4036 | + cache_put_data('minimized_'.$theme['id'].'_'.$type.'_'.$matches[1], null); |
|
| 4037 | 4037 | |
| 4038 | 4038 | // Try to delete the file. Add it to our error list if it fails. |
| 4039 | 4039 | if (!@unlink($filename)) |
@@ -4070,7 +4070,7 @@ discard block |
||
| 4070 | 4070 | |
| 4071 | 4071 | // Just make up a nice hash... |
| 4072 | 4072 | if ($new) |
| 4073 | - return sha1(md5($filename . time()) . mt_rand()); |
|
| 4073 | + return sha1(md5($filename.time()).mt_rand()); |
|
| 4074 | 4074 | |
| 4075 | 4075 | // Just make sure that attachment id is only a int |
| 4076 | 4076 | $attachment_id = (int) $attachment_id; |
@@ -4096,7 +4096,7 @@ discard block |
||
| 4096 | 4096 | |
| 4097 | 4097 | // Still no hash? mmm... |
| 4098 | 4098 | if (empty($file_hash)) |
| 4099 | - $file_hash = sha1(md5($filename . time()) . mt_rand()); |
|
| 4099 | + $file_hash = sha1(md5($filename.time()).mt_rand()); |
|
| 4100 | 4100 | |
| 4101 | 4101 | // Are we using multiple directories? |
| 4102 | 4102 | if (is_array($modSettings['attachmentUploadDir'])) |
@@ -4105,7 +4105,7 @@ discard block |
||
| 4105 | 4105 | else |
| 4106 | 4106 | $path = $modSettings['attachmentUploadDir']; |
| 4107 | 4107 | |
| 4108 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 4108 | + return $path.'/'.$attachment_id.'_'.$file_hash.'.dat'; |
|
| 4109 | 4109 | } |
| 4110 | 4110 | |
| 4111 | 4111 | /** |
@@ -4149,16 +4149,16 @@ discard block |
||
| 4149 | 4149 | $valid_low = isValidIP($ip_parts[0]); |
| 4150 | 4150 | $valid_high = isValidIP($ip_parts[1]); |
| 4151 | 4151 | $count = 0; |
| 4152 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 4152 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 4153 | 4153 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 4154 | 4154 | $min = 0; |
| 4155 | - if(!$valid_low) |
|
| 4155 | + if (!$valid_low) |
|
| 4156 | 4156 | { |
| 4157 | 4157 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 4158 | 4158 | $valid_low = isValidIP($ip_parts[0]); |
| 4159 | 4159 | while (!$valid_low) |
| 4160 | 4160 | { |
| 4161 | - $ip_parts[0] .= $mode . $min; |
|
| 4161 | + $ip_parts[0] .= $mode.$min; |
|
| 4162 | 4162 | $valid_low = isValidIP($ip_parts[0]); |
| 4163 | 4163 | $count++; |
| 4164 | 4164 | if ($count > 9) break; |
@@ -4166,20 +4166,20 @@ discard block |
||
| 4166 | 4166 | } |
| 4167 | 4167 | |
| 4168 | 4168 | $count = 0; |
| 4169 | - if(!$valid_high) |
|
| 4169 | + if (!$valid_high) |
|
| 4170 | 4170 | { |
| 4171 | 4171 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 4172 | 4172 | $valid_high = isValidIP($ip_parts[1]); |
| 4173 | 4173 | while (!$valid_high) |
| 4174 | 4174 | { |
| 4175 | - $ip_parts[1] .= $mode . $max; |
|
| 4175 | + $ip_parts[1] .= $mode.$max; |
|
| 4176 | 4176 | $valid_high = isValidIP($ip_parts[1]); |
| 4177 | 4177 | $count++; |
| 4178 | 4178 | if ($count > 9) break; |
| 4179 | 4179 | } |
| 4180 | 4180 | } |
| 4181 | 4181 | |
| 4182 | - if($valid_high && $valid_low) |
|
| 4182 | + if ($valid_high && $valid_low) |
|
| 4183 | 4183 | { |
| 4184 | 4184 | $ip_array['low'] = $ip_parts[0]; |
| 4185 | 4185 | $ip_array['high'] = $ip_parts[1]; |
@@ -4199,7 +4199,7 @@ discard block |
||
| 4199 | 4199 | { |
| 4200 | 4200 | global $modSettings; |
| 4201 | 4201 | |
| 4202 | - if (($host = cache_get_data('hostlookup-' . $ip, 600)) !== null) |
|
| 4202 | + if (($host = cache_get_data('hostlookup-'.$ip, 600)) !== null) |
|
| 4203 | 4203 | return $host; |
| 4204 | 4204 | $t = microtime(true); |
| 4205 | 4205 | |
@@ -4207,9 +4207,9 @@ discard block |
||
| 4207 | 4207 | if (!isset($host) && (strpos(strtolower(PHP_OS), 'win') === false || strpos(strtolower(PHP_OS), 'darwin') !== false) && mt_rand(0, 1) == 1) |
| 4208 | 4208 | { |
| 4209 | 4209 | if (!isset($modSettings['host_to_dis'])) |
| 4210 | - $test = @shell_exec('host -W 1 ' . @escapeshellarg($ip)); |
|
| 4210 | + $test = @shell_exec('host -W 1 '.@escapeshellarg($ip)); |
|
| 4211 | 4211 | else |
| 4212 | - $test = @shell_exec('host ' . @escapeshellarg($ip)); |
|
| 4212 | + $test = @shell_exec('host '.@escapeshellarg($ip)); |
|
| 4213 | 4213 | |
| 4214 | 4214 | // Did host say it didn't find anything? |
| 4215 | 4215 | if (strpos($test, 'not found') !== false) |
@@ -4225,7 +4225,7 @@ discard block |
||
| 4225 | 4225 | // This is nslookup; usually only Windows, but possibly some Unix? |
| 4226 | 4226 | if (!isset($host) && stripos(PHP_OS, 'win') !== false && strpos(strtolower(PHP_OS), 'darwin') === false && mt_rand(0, 1) == 1) |
| 4227 | 4227 | { |
| 4228 | - $test = @shell_exec('nslookup -timeout=1 ' . @escapeshellarg($ip)); |
|
| 4228 | + $test = @shell_exec('nslookup -timeout=1 '.@escapeshellarg($ip)); |
|
| 4229 | 4229 | if (strpos($test, 'Non-existent domain') !== false) |
| 4230 | 4230 | $host = ''; |
| 4231 | 4231 | elseif (preg_match('~Name:\s+([^\s]+)~', $test, $match) == 1) |
@@ -4238,7 +4238,7 @@ discard block |
||
| 4238 | 4238 | |
| 4239 | 4239 | // It took a long time, so let's cache it! |
| 4240 | 4240 | if (microtime(true) - $t > 0.5) |
| 4241 | - cache_put_data('hostlookup-' . $ip, $host, 600); |
|
| 4241 | + cache_put_data('hostlookup-'.$ip, $host, 600); |
|
| 4242 | 4242 | |
| 4243 | 4243 | return $host; |
| 4244 | 4244 | } |
@@ -4256,7 +4256,7 @@ discard block |
||
| 4256 | 4256 | global $smcFunc, $context; |
| 4257 | 4257 | |
| 4258 | 4258 | // Step 1: Remove entities/things we don't consider words: |
| 4259 | - $words = preg_replace('~(?:[\x0B\0' . ($context['utf8'] ? '\x{A0}' : '\xA0') . '\t\r\s\n(){}\\[\\]<>!@$%^*.,:+=`\~\?/\\\\]+|&(?:amp|lt|gt|quot);)+~' . ($context['utf8'] ? 'u' : ''), ' ', strtr($text, array('<br>' => ' '))); |
|
| 4259 | + $words = preg_replace('~(?:[\x0B\0'.($context['utf8'] ? '\x{A0}' : '\xA0').'\t\r\s\n(){}\\[\\]<>!@$%^*.,:+=`\~\?/\\\\]+|&(?:amp|lt|gt|quot);)+~'.($context['utf8'] ? 'u' : ''), ' ', strtr($text, array('<br>' => ' '))); |
|
| 4260 | 4260 | |
| 4261 | 4261 | // Step 2: Entities we left to letters, where applicable, lowercase. |
| 4262 | 4262 | $words = un_htmlspecialchars($smcFunc['strtolower']($words)); |
@@ -4315,9 +4315,9 @@ discard block |
||
| 4315 | 4315 | if (!$settings['use_image_buttons']) |
| 4316 | 4316 | return $txt[$alt]; |
| 4317 | 4317 | elseif (!empty($settings['use_buttons'])) |
| 4318 | - return '<span class="generic_icons ' . $name . '" alt="' . $txt[$alt] . '"></span>' . ($label != '' ? ' <strong>' . $txt[$label] . '</strong>' : ''); |
|
| 4318 | + return '<span class="generic_icons '.$name.'" alt="'.$txt[$alt].'"></span>'.($label != '' ? ' <strong>'.$txt[$label].'</strong>' : ''); |
|
| 4319 | 4319 | else |
| 4320 | - return '<img src="' . $settings['lang_images_url'] . '/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . '>'; |
|
| 4320 | + return '<img src="'.$settings['lang_images_url'].'/'.$name.'" alt="'.$txt[$alt].'" '.$custom.'>'; |
|
| 4321 | 4321 | } |
| 4322 | 4322 | |
| 4323 | 4323 | /** |
@@ -4359,28 +4359,28 @@ discard block |
||
| 4359 | 4359 | { |
| 4360 | 4360 | addInlineJavaScript(' |
| 4361 | 4361 | var user_menus = new smc_PopupMenu(); |
| 4362 | - user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
|
| 4363 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 4362 | + user_menus.add("profile", "' . $scripturl.'?action=profile;area=popup"); |
|
| 4363 | + user_menus.add("alerts", "' . $scripturl.'?action=profile;area=alerts_popup;u='.$context['user']['id'].'");', true); |
|
| 4364 | 4364 | if ($context['allow_pm']) |
| 4365 | 4365 | addInlineJavaScript(' |
| 4366 | - user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
|
| 4366 | + user_menus.add("pm", "' . $scripturl.'?action=pm;sa=popup");', true); |
|
| 4367 | 4367 | |
| 4368 | 4368 | if (!empty($modSettings['enable_ajax_alerts'])) |
| 4369 | 4369 | { |
| 4370 | - require_once($sourcedir . '/Subs-Notify.php'); |
|
| 4370 | + require_once($sourcedir.'/Subs-Notify.php'); |
|
| 4371 | 4371 | |
| 4372 | 4372 | $timeout = getNotifyPrefs($context['user']['id'], 'alert_timeout', true); |
| 4373 | 4373 | $timeout = empty($timeout) ? 10000 : $timeout[$context['user']['id']]['alert_timeout'] * 1000; |
| 4374 | 4374 | |
| 4375 | 4375 | addInlineJavaScript(' |
| 4376 | - var new_alert_title = "' . $context['forum_name'] . '"; |
|
| 4377 | - var alert_timeout = ' . $timeout . ';'); |
|
| 4376 | + var new_alert_title = "' . $context['forum_name'].'"; |
|
| 4377 | + var alert_timeout = ' . $timeout.';'); |
|
| 4378 | 4378 | loadJavaScriptFile('alerts.js', array('minimize' => true), 'smf_alerts'); |
| 4379 | 4379 | } |
| 4380 | 4380 | } |
| 4381 | 4381 | |
| 4382 | 4382 | // All the buttons we can possible want and then some, try pulling the final list of buttons from cache first. |
| 4383 | - if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated']) |
|
| 4383 | + if (($menu_buttons = cache_get_data('menu_buttons-'.implode('_', $user_info['groups']).'-'.$user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated']) |
|
| 4384 | 4384 | { |
| 4385 | 4385 | $buttons = array( |
| 4386 | 4386 | 'home' => array( |
@@ -4393,39 +4393,39 @@ discard block |
||
| 4393 | 4393 | ), |
| 4394 | 4394 | 'search' => array( |
| 4395 | 4395 | 'title' => $txt['search'], |
| 4396 | - 'href' => $scripturl . '?action=search', |
|
| 4396 | + 'href' => $scripturl.'?action=search', |
|
| 4397 | 4397 | 'show' => $context['allow_search'], |
| 4398 | 4398 | 'sub_buttons' => array( |
| 4399 | 4399 | ), |
| 4400 | 4400 | ), |
| 4401 | 4401 | 'admin' => array( |
| 4402 | 4402 | 'title' => $txt['admin'], |
| 4403 | - 'href' => $scripturl . '?action=admin', |
|
| 4403 | + 'href' => $scripturl.'?action=admin', |
|
| 4404 | 4404 | 'show' => $context['allow_admin'], |
| 4405 | 4405 | 'sub_buttons' => array( |
| 4406 | 4406 | 'featuresettings' => array( |
| 4407 | 4407 | 'title' => $txt['modSettings_title'], |
| 4408 | - 'href' => $scripturl . '?action=admin;area=featuresettings', |
|
| 4408 | + 'href' => $scripturl.'?action=admin;area=featuresettings', |
|
| 4409 | 4409 | 'show' => allowedTo('admin_forum'), |
| 4410 | 4410 | ), |
| 4411 | 4411 | 'packages' => array( |
| 4412 | 4412 | 'title' => $txt['package'], |
| 4413 | - 'href' => $scripturl . '?action=admin;area=packages', |
|
| 4413 | + 'href' => $scripturl.'?action=admin;area=packages', |
|
| 4414 | 4414 | 'show' => allowedTo('admin_forum'), |
| 4415 | 4415 | ), |
| 4416 | 4416 | 'errorlog' => array( |
| 4417 | 4417 | 'title' => $txt['errlog'], |
| 4418 | - 'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc', |
|
| 4418 | + 'href' => $scripturl.'?action=admin;area=logs;sa=errorlog;desc', |
|
| 4419 | 4419 | 'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']), |
| 4420 | 4420 | ), |
| 4421 | 4421 | 'permissions' => array( |
| 4422 | 4422 | 'title' => $txt['edit_permissions'], |
| 4423 | - 'href' => $scripturl . '?action=admin;area=permissions', |
|
| 4423 | + 'href' => $scripturl.'?action=admin;area=permissions', |
|
| 4424 | 4424 | 'show' => allowedTo('manage_permissions'), |
| 4425 | 4425 | ), |
| 4426 | 4426 | 'memberapprove' => array( |
| 4427 | 4427 | 'title' => $txt['approve_members_waiting'], |
| 4428 | - 'href' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=approve', |
|
| 4428 | + 'href' => $scripturl.'?action=admin;area=viewmembers;sa=browse;type=approve', |
|
| 4429 | 4429 | 'show' => !empty($context['unapproved_members']), |
| 4430 | 4430 | 'is_last' => true, |
| 4431 | 4431 | ), |
@@ -4433,32 +4433,32 @@ discard block |
||
| 4433 | 4433 | ), |
| 4434 | 4434 | 'moderate' => array( |
| 4435 | 4435 | 'title' => $txt['moderate'], |
| 4436 | - 'href' => $scripturl . '?action=moderate', |
|
| 4436 | + 'href' => $scripturl.'?action=moderate', |
|
| 4437 | 4437 | 'show' => $context['allow_moderation_center'], |
| 4438 | 4438 | 'sub_buttons' => array( |
| 4439 | 4439 | 'modlog' => array( |
| 4440 | 4440 | 'title' => $txt['modlog_view'], |
| 4441 | - 'href' => $scripturl . '?action=moderate;area=modlog', |
|
| 4441 | + 'href' => $scripturl.'?action=moderate;area=modlog', |
|
| 4442 | 4442 | 'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1', |
| 4443 | 4443 | ), |
| 4444 | 4444 | 'poststopics' => array( |
| 4445 | 4445 | 'title' => $txt['mc_unapproved_poststopics'], |
| 4446 | - 'href' => $scripturl . '?action=moderate;area=postmod;sa=posts', |
|
| 4446 | + 'href' => $scripturl.'?action=moderate;area=postmod;sa=posts', |
|
| 4447 | 4447 | 'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']), |
| 4448 | 4448 | ), |
| 4449 | 4449 | 'attachments' => array( |
| 4450 | 4450 | 'title' => $txt['mc_unapproved_attachments'], |
| 4451 | - 'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments', |
|
| 4451 | + 'href' => $scripturl.'?action=moderate;area=attachmod;sa=attachments', |
|
| 4452 | 4452 | 'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']), |
| 4453 | 4453 | ), |
| 4454 | 4454 | 'reports' => array( |
| 4455 | 4455 | 'title' => $txt['mc_reported_posts'], |
| 4456 | - 'href' => $scripturl . '?action=moderate;area=reportedposts', |
|
| 4456 | + 'href' => $scripturl.'?action=moderate;area=reportedposts', |
|
| 4457 | 4457 | 'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1', |
| 4458 | 4458 | ), |
| 4459 | 4459 | 'reported_members' => array( |
| 4460 | 4460 | 'title' => $txt['mc_reported_members'], |
| 4461 | - 'href' => $scripturl . '?action=moderate;area=reportedmembers', |
|
| 4461 | + 'href' => $scripturl.'?action=moderate;area=reportedmembers', |
|
| 4462 | 4462 | 'show' => allowedTo('moderate_forum'), |
| 4463 | 4463 | 'is_last' => true, |
| 4464 | 4464 | ) |
@@ -4466,17 +4466,17 @@ discard block |
||
| 4466 | 4466 | ), |
| 4467 | 4467 | 'calendar' => array( |
| 4468 | 4468 | 'title' => $txt['calendar'], |
| 4469 | - 'href' => $scripturl . '?action=calendar', |
|
| 4469 | + 'href' => $scripturl.'?action=calendar', |
|
| 4470 | 4470 | 'show' => $context['allow_calendar'], |
| 4471 | 4471 | 'sub_buttons' => array( |
| 4472 | 4472 | 'view' => array( |
| 4473 | 4473 | 'title' => $txt['calendar_menu'], |
| 4474 | - 'href' => $scripturl . '?action=calendar', |
|
| 4474 | + 'href' => $scripturl.'?action=calendar', |
|
| 4475 | 4475 | 'show' => $context['allow_calendar_event'], |
| 4476 | 4476 | ), |
| 4477 | 4477 | 'post' => array( |
| 4478 | 4478 | 'title' => $txt['calendar_post_event'], |
| 4479 | - 'href' => $scripturl . '?action=calendar;sa=post', |
|
| 4479 | + 'href' => $scripturl.'?action=calendar;sa=post', |
|
| 4480 | 4480 | 'show' => $context['allow_calendar_event'], |
| 4481 | 4481 | 'is_last' => true, |
| 4482 | 4482 | ), |
@@ -4484,17 +4484,17 @@ discard block |
||
| 4484 | 4484 | ), |
| 4485 | 4485 | 'mlist' => array( |
| 4486 | 4486 | 'title' => $txt['members_title'], |
| 4487 | - 'href' => $scripturl . '?action=mlist', |
|
| 4487 | + 'href' => $scripturl.'?action=mlist', |
|
| 4488 | 4488 | 'show' => $context['allow_memberlist'], |
| 4489 | 4489 | 'sub_buttons' => array( |
| 4490 | 4490 | 'mlist_view' => array( |
| 4491 | 4491 | 'title' => $txt['mlist_menu_view'], |
| 4492 | - 'href' => $scripturl . '?action=mlist', |
|
| 4492 | + 'href' => $scripturl.'?action=mlist', |
|
| 4493 | 4493 | 'show' => true, |
| 4494 | 4494 | ), |
| 4495 | 4495 | 'mlist_search' => array( |
| 4496 | 4496 | 'title' => $txt['mlist_search'], |
| 4497 | - 'href' => $scripturl . '?action=mlist;sa=search', |
|
| 4497 | + 'href' => $scripturl.'?action=mlist;sa=search', |
|
| 4498 | 4498 | 'show' => true, |
| 4499 | 4499 | 'is_last' => true, |
| 4500 | 4500 | ), |
@@ -4502,7 +4502,7 @@ discard block |
||
| 4502 | 4502 | ), |
| 4503 | 4503 | 'signup' => array( |
| 4504 | 4504 | 'title' => $txt['register'], |
| 4505 | - 'href' => $scripturl . '?action=signup', |
|
| 4505 | + 'href' => $scripturl.'?action=signup', |
|
| 4506 | 4506 | 'show' => $user_info['is_guest'] && $context['can_register'], |
| 4507 | 4507 | 'sub_buttons' => array( |
| 4508 | 4508 | ), |
@@ -4510,7 +4510,7 @@ discard block |
||
| 4510 | 4510 | ), |
| 4511 | 4511 | 'logout' => array( |
| 4512 | 4512 | 'title' => $txt['logout'], |
| 4513 | - 'href' => $scripturl . '?action=logout;%1$s=%2$s', |
|
| 4513 | + 'href' => $scripturl.'?action=logout;%1$s=%2$s', |
|
| 4514 | 4514 | 'show' => !$user_info['is_guest'], |
| 4515 | 4515 | 'sub_buttons' => array( |
| 4516 | 4516 | ), |
@@ -4559,20 +4559,20 @@ discard block |
||
| 4559 | 4559 | } |
| 4560 | 4560 | |
| 4561 | 4561 | // Does this button have its own icon? |
| 4562 | - if (isset($button['icon']) && file_exists($settings['theme_dir'] . '/images/' . $button['icon'])) |
|
| 4563 | - $button['icon'] = '<img src="' . $settings['images_url'] . '/' . $button['icon'] . '" alt="">'; |
|
| 4564 | - elseif (isset($button['icon']) && file_exists($settings['default_theme_dir'] . '/images/' . $button['icon'])) |
|
| 4565 | - $button['icon'] = '<img src="' . $settings['default_images_url'] . '/' . $button['icon'] . '" alt="">'; |
|
| 4562 | + if (isset($button['icon']) && file_exists($settings['theme_dir'].'/images/'.$button['icon'])) |
|
| 4563 | + $button['icon'] = '<img src="'.$settings['images_url'].'/'.$button['icon'].'" alt="">'; |
|
| 4564 | + elseif (isset($button['icon']) && file_exists($settings['default_theme_dir'].'/images/'.$button['icon'])) |
|
| 4565 | + $button['icon'] = '<img src="'.$settings['default_images_url'].'/'.$button['icon'].'" alt="">'; |
|
| 4566 | 4566 | elseif (isset($button['icon'])) |
| 4567 | - $button['icon'] = '<span class="generic_icons ' . $button['icon'] . '"></span>'; |
|
| 4567 | + $button['icon'] = '<span class="generic_icons '.$button['icon'].'"></span>'; |
|
| 4568 | 4568 | else |
| 4569 | - $button['icon'] = '<span class="generic_icons ' . $act . '"></span>'; |
|
| 4569 | + $button['icon'] = '<span class="generic_icons '.$act.'"></span>'; |
|
| 4570 | 4570 | |
| 4571 | 4571 | $menu_buttons[$act] = $button; |
| 4572 | 4572 | } |
| 4573 | 4573 | |
| 4574 | 4574 | if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) |
| 4575 | - cache_put_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $menu_buttons, $cacheTime); |
|
| 4575 | + cache_put_data('menu_buttons-'.implode('_', $user_info['groups']).'-'.$user_info['language'], $menu_buttons, $cacheTime); |
|
| 4576 | 4576 | } |
| 4577 | 4577 | |
| 4578 | 4578 | $context['menu_buttons'] = $menu_buttons; |
@@ -4655,7 +4655,7 @@ discard block |
||
| 4655 | 4655 | $context['total_admin_reports'] += $context['unapproved_members']; |
| 4656 | 4656 | } |
| 4657 | 4657 | |
| 4658 | - if($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin'])) |
|
| 4658 | + if ($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin'])) |
|
| 4659 | 4659 | { |
| 4660 | 4660 | $context['menu_buttons']['admin']['amt'] = $context['total_admin_reports']; |
| 4661 | 4661 | } |
@@ -4759,11 +4759,11 @@ discard block |
||
| 4759 | 4759 | |
| 4760 | 4760 | // Any objects? |
| 4761 | 4761 | if ($object) |
| 4762 | - $function = $function . '#'; |
|
| 4762 | + $function = $function.'#'; |
|
| 4763 | 4763 | |
| 4764 | 4764 | // Any files to load? |
| 4765 | 4765 | if (!empty($file) && is_string($file)) |
| 4766 | - $function = $file . (!empty($function) ? '|' . $function : ''); |
|
| 4766 | + $function = $file.(!empty($function) ? '|'.$function : ''); |
|
| 4767 | 4767 | |
| 4768 | 4768 | // Get the correct string. |
| 4769 | 4769 | $integration_call = $function; |
@@ -4825,11 +4825,11 @@ discard block |
||
| 4825 | 4825 | |
| 4826 | 4826 | // Any objects? |
| 4827 | 4827 | if ($object) |
| 4828 | - $function = $function . '#'; |
|
| 4828 | + $function = $function.'#'; |
|
| 4829 | 4829 | |
| 4830 | 4830 | // Any files to load? |
| 4831 | 4831 | if (!empty($file) && is_string($file)) |
| 4832 | - $function = $file . '|' . $function; |
|
| 4832 | + $function = $file.'|'.$function; |
|
| 4833 | 4833 | |
| 4834 | 4834 | // Get the correct string. |
| 4835 | 4835 | $integration_call = $function; |
@@ -5002,7 +5002,7 @@ discard block |
||
| 5002 | 5002 | // No? try a fallback to $sourcedir |
| 5003 | 5003 | else |
| 5004 | 5004 | { |
| 5005 | - $absPath = $sourcedir .'/'. $file; |
|
| 5005 | + $absPath = $sourcedir.'/'.$file; |
|
| 5006 | 5006 | |
| 5007 | 5007 | if (file_exists($absPath)) |
| 5008 | 5008 | require_once($absPath); |
@@ -5051,15 +5051,15 @@ discard block |
||
| 5051 | 5051 | elseif ($match[1] == 'ftp') |
| 5052 | 5052 | { |
| 5053 | 5053 | // Include the file containing the ftp_connection class. |
| 5054 | - require_once($sourcedir . '/Class-Package.php'); |
|
| 5054 | + require_once($sourcedir.'/Class-Package.php'); |
|
| 5055 | 5055 | |
| 5056 | 5056 | // Establish a connection and attempt to enable passive mode. |
| 5057 | - $ftp = new ftp_connection(($match[2] ? 'ssl://' : '') . $match[3], empty($match[5]) ? 21 : $match[5], 'anonymous', $webmaster_email); |
|
| 5057 | + $ftp = new ftp_connection(($match[2] ? 'ssl://' : '').$match[3], empty($match[5]) ? 21 : $match[5], 'anonymous', $webmaster_email); |
|
| 5058 | 5058 | if ($ftp->error !== false || !$ftp->passive()) |
| 5059 | 5059 | return false; |
| 5060 | 5060 | |
| 5061 | 5061 | // I want that one *points*! |
| 5062 | - fwrite($ftp->connection, 'RETR ' . $match[6] . "\r\n"); |
|
| 5062 | + fwrite($ftp->connection, 'RETR '.$match[6]."\r\n"); |
|
| 5063 | 5063 | |
| 5064 | 5064 | // Since passive mode worked (or we would have returned already!) open the connection. |
| 5065 | 5065 | $fp = @fsockopen($ftp->pasv['ip'], $ftp->pasv['port'], $err, $err, 5); |
@@ -5088,7 +5088,7 @@ discard block |
||
| 5088 | 5088 | if (empty($fp)) |
| 5089 | 5089 | { |
| 5090 | 5090 | // Open the socket on the port we want... |
| 5091 | - $fp = @fsockopen(($match[2] ? 'ssl://' : '') . $match[3], empty($match[5]) ? ($match[2] ? 443 : 80) : $match[5], $err, $err, 5); |
|
| 5091 | + $fp = @fsockopen(($match[2] ? 'ssl://' : '').$match[3], empty($match[5]) ? ($match[2] ? 443 : 80) : $match[5], $err, $err, 5); |
|
| 5092 | 5092 | } |
| 5093 | 5093 | if (!empty($fp)) |
| 5094 | 5094 | { |
@@ -5101,25 +5101,25 @@ discard block |
||
| 5101 | 5101 | // I want this, from there, and I'm not going to be bothering you for more (probably.) |
| 5102 | 5102 | if (empty($post_data)) |
| 5103 | 5103 | { |
| 5104 | - fwrite($fp, 'GET ' . ($match[6] !== '/' ? str_replace(' ', '%20', $match[6]) : '') . ' HTTP/1.0' . "\r\n"); |
|
| 5105 | - fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n"); |
|
| 5106 | - fwrite($fp, 'user-agent: PHP/SMF' . "\r\n"); |
|
| 5104 | + fwrite($fp, 'GET '.($match[6] !== '/' ? str_replace(' ', '%20', $match[6]) : '').' HTTP/1.0'."\r\n"); |
|
| 5105 | + fwrite($fp, 'Host: '.$match[3].(empty($match[5]) ? ($match[2] ? ':443' : '') : ':'.$match[5])."\r\n"); |
|
| 5106 | + fwrite($fp, 'user-agent: PHP/SMF'."\r\n"); |
|
| 5107 | 5107 | if ($keep_alive) |
| 5108 | - fwrite($fp, 'connection: Keep-Alive' . "\r\n\r\n"); |
|
| 5108 | + fwrite($fp, 'connection: Keep-Alive'."\r\n\r\n"); |
|
| 5109 | 5109 | else |
| 5110 | - fwrite($fp, 'connection: close' . "\r\n\r\n"); |
|
| 5110 | + fwrite($fp, 'connection: close'."\r\n\r\n"); |
|
| 5111 | 5111 | } |
| 5112 | 5112 | else |
| 5113 | 5113 | { |
| 5114 | - fwrite($fp, 'POST ' . ($match[6] !== '/' ? $match[6] : '') . ' HTTP/1.0' . "\r\n"); |
|
| 5115 | - fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n"); |
|
| 5116 | - fwrite($fp, 'user-agent: PHP/SMF' . "\r\n"); |
|
| 5114 | + fwrite($fp, 'POST '.($match[6] !== '/' ? $match[6] : '').' HTTP/1.0'."\r\n"); |
|
| 5115 | + fwrite($fp, 'Host: '.$match[3].(empty($match[5]) ? ($match[2] ? ':443' : '') : ':'.$match[5])."\r\n"); |
|
| 5116 | + fwrite($fp, 'user-agent: PHP/SMF'."\r\n"); |
|
| 5117 | 5117 | if ($keep_alive) |
| 5118 | - fwrite($fp, 'connection: Keep-Alive' . "\r\n"); |
|
| 5118 | + fwrite($fp, 'connection: Keep-Alive'."\r\n"); |
|
| 5119 | 5119 | else |
| 5120 | - fwrite($fp, 'connection: close' . "\r\n"); |
|
| 5121 | - fwrite($fp, 'content-type: application/x-www-form-urlencoded' . "\r\n"); |
|
| 5122 | - fwrite($fp, 'content-length: ' . strlen($post_data) . "\r\n\r\n"); |
|
| 5120 | + fwrite($fp, 'connection: close'."\r\n"); |
|
| 5121 | + fwrite($fp, 'content-type: application/x-www-form-urlencoded'."\r\n"); |
|
| 5122 | + fwrite($fp, 'content-length: '.strlen($post_data)."\r\n\r\n"); |
|
| 5123 | 5123 | fwrite($fp, $post_data); |
| 5124 | 5124 | } |
| 5125 | 5125 | |
@@ -5182,7 +5182,7 @@ discard block |
||
| 5182 | 5182 | elseif (function_exists('curl_init')) |
| 5183 | 5183 | { |
| 5184 | 5184 | // Include the file containing the curl_fetch_web_data class. |
| 5185 | - require_once($sourcedir . '/Class-CurlFetchWeb.php'); |
|
| 5185 | + require_once($sourcedir.'/Class-CurlFetchWeb.php'); |
|
| 5186 | 5186 | |
| 5187 | 5187 | $fetch_data = new curl_fetch_web_data(); |
| 5188 | 5188 | $fetch_data->get_url_data($url, $post_data); |
@@ -5224,7 +5224,7 @@ discard block |
||
| 5224 | 5224 | |
| 5225 | 5225 | // We already know the number of likes per message, we just want to know whether the current user liked it or not. |
| 5226 | 5226 | $user = $user_info['id']; |
| 5227 | - $cache_key = 'likes_topic_' . $topic . '_' . $user; |
|
| 5227 | + $cache_key = 'likes_topic_'.$topic.'_'.$user; |
|
| 5228 | 5228 | $ttl = 180; |
| 5229 | 5229 | |
| 5230 | 5230 | if (($temp = cache_get_data($cache_key, $ttl)) === null) |
@@ -5269,15 +5269,15 @@ discard block |
||
| 5269 | 5269 | |
| 5270 | 5270 | // UTF-8 occurences of MS special characters |
| 5271 | 5271 | $findchars_utf8 = array( |
| 5272 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 5273 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 5274 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 5275 | - "\xe2\x80\x98", // left single curly quote |
|
| 5276 | - "\xe2\x80\x99", // right single curly quote |
|
| 5277 | - "\xe2\x80\x9c", // left double curly quote |
|
| 5278 | - "\xe2\x80\x9d", // right double curly quote |
|
| 5279 | - "\xe2\x80\x93", // en dash |
|
| 5280 | - "\xe2\x80\x94", // em dash |
|
| 5272 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 5273 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 5274 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 5275 | + "\xe2\x80\x98", // left single curly quote |
|
| 5276 | + "\xe2\x80\x99", // right single curly quote |
|
| 5277 | + "\xe2\x80\x9c", // left double curly quote |
|
| 5278 | + "\xe2\x80\x9d", // right double curly quote |
|
| 5279 | + "\xe2\x80\x93", // en dash |
|
| 5280 | + "\xe2\x80\x94", // em dash |
|
| 5281 | 5281 | ); |
| 5282 | 5282 | |
| 5283 | 5283 | // windows 1252 / iso equivalents |
@@ -5295,15 +5295,15 @@ discard block |
||
| 5295 | 5295 | |
| 5296 | 5296 | // safe replacements |
| 5297 | 5297 | $replacechars = array( |
| 5298 | - ',', // ‚ |
|
| 5299 | - ',,', // „ |
|
| 5300 | - '...', // … |
|
| 5301 | - "'", // ‘ |
|
| 5302 | - "'", // ’ |
|
| 5303 | - '"', // “ |
|
| 5304 | - '"', // ” |
|
| 5305 | - '-', // – |
|
| 5306 | - '--', // — |
|
| 5298 | + ',', // ‚ |
|
| 5299 | + ',,', // „ |
|
| 5300 | + '...', // … |
|
| 5301 | + "'", // ‘ |
|
| 5302 | + "'", // ’ |
|
| 5303 | + '"', // “ |
|
| 5304 | + '"', // ” |
|
| 5305 | + '-', // – |
|
| 5306 | + '--', // — |
|
| 5307 | 5307 | ); |
| 5308 | 5308 | |
| 5309 | 5309 | if ($context['utf8']) |
@@ -5339,7 +5339,7 @@ discard block |
||
| 5339 | 5339 | |
| 5340 | 5340 | // Quote, Ampersand, Apostrophe, Less/Greater Than get html replaced |
| 5341 | 5341 | if (in_array($num, array(0x22, 0x26, 0x27, 0x3C, 0x3E))) |
| 5342 | - return '&#' . $num . ';'; |
|
| 5342 | + return '&#'.$num.';'; |
|
| 5343 | 5343 | |
| 5344 | 5344 | if (empty($context['utf8'])) |
| 5345 | 5345 | { |
@@ -5351,7 +5351,7 @@ discard block |
||
| 5351 | 5351 | return chr($num); |
| 5352 | 5352 | // all others get html-ised |
| 5353 | 5353 | else |
| 5354 | - return '&#' . $matches[2] . ';'; |
|
| 5354 | + return '&#'.$matches[2].';'; |
|
| 5355 | 5355 | } |
| 5356 | 5356 | else |
| 5357 | 5357 | { |
@@ -5364,13 +5364,13 @@ discard block |
||
| 5364 | 5364 | return chr($num); |
| 5365 | 5365 | // <0x800 (2048) |
| 5366 | 5366 | elseif ($num < 0x800) |
| 5367 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 5367 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 5368 | 5368 | // < 0x10000 (65536) |
| 5369 | 5369 | elseif ($num < 0x10000) |
| 5370 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 5370 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 5371 | 5371 | // <= 0x10FFFF (1114111) |
| 5372 | 5372 | else |
| 5373 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 5373 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 5374 | 5374 | } |
| 5375 | 5375 | } |
| 5376 | 5376 | |
@@ -5400,13 +5400,13 @@ discard block |
||
| 5400 | 5400 | return chr($num); |
| 5401 | 5401 | // <0x800 (2048) |
| 5402 | 5402 | elseif ($num < 0x800) |
| 5403 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 5403 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 5404 | 5404 | // < 0x10000 (65536) |
| 5405 | 5405 | elseif ($num < 0x10000) |
| 5406 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 5406 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 5407 | 5407 | // <= 0x10FFFF (1114111) |
| 5408 | 5408 | else |
| 5409 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 5409 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 5410 | 5410 | } |
| 5411 | 5411 | |
| 5412 | 5412 | /** |
@@ -5429,7 +5429,7 @@ discard block |
||
| 5429 | 5429 | if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202D || $num == 0x202E) |
| 5430 | 5430 | return ''; |
| 5431 | 5431 | else |
| 5432 | - return '&#' . $num . ';'; |
|
| 5432 | + return '&#'.$num.';'; |
|
| 5433 | 5433 | } |
| 5434 | 5434 | |
| 5435 | 5435 | /** |
@@ -5455,9 +5455,9 @@ discard block |
||
| 5455 | 5455 | $defaults = array('mm', 'identicon', 'monsterid', 'wavatar', 'retro', 'blank'); |
| 5456 | 5456 | $url_params = array(); |
| 5457 | 5457 | if (!empty($modSettings['gravatarMaxRating']) && in_array($modSettings['gravatarMaxRating'], $ratings)) |
| 5458 | - $url_params[] = 'rating=' . $modSettings['gravatarMaxRating']; |
|
| 5458 | + $url_params[] = 'rating='.$modSettings['gravatarMaxRating']; |
|
| 5459 | 5459 | if (!empty($modSettings['gravatarDefault']) && in_array($modSettings['gravatarDefault'], $defaults)) |
| 5460 | - $url_params[] = 'default=' . $modSettings['gravatarDefault']; |
|
| 5460 | + $url_params[] = 'default='.$modSettings['gravatarDefault']; |
|
| 5461 | 5461 | if (!empty($modSettings['avatar_max_width_external'])) |
| 5462 | 5462 | $size_string = (int) $modSettings['avatar_max_width_external']; |
| 5463 | 5463 | if (!empty($modSettings['avatar_max_height_external']) && !empty($size_string)) |
@@ -5465,11 +5465,11 @@ discard block |
||
| 5465 | 5465 | $size_string = $modSettings['avatar_max_height_external']; |
| 5466 | 5466 | |
| 5467 | 5467 | if (!empty($size_string)) |
| 5468 | - $url_params[] = 's=' . $size_string; |
|
| 5468 | + $url_params[] = 's='.$size_string; |
|
| 5469 | 5469 | } |
| 5470 | 5470 | $http_method = !empty($modSettings['force_ssl']) ? 'https://secure' : 'http://www'; |
| 5471 | 5471 | |
| 5472 | - return $http_method . '.gravatar.com/avatar/' . md5($smcFunc['strtolower']($email_address)) . '?' . implode('&', $url_params); |
|
| 5472 | + return $http_method.'.gravatar.com/avatar/'.md5($smcFunc['strtolower']($email_address)).'?'.implode('&', $url_params); |
|
| 5473 | 5473 | } |
| 5474 | 5474 | |
| 5475 | 5475 | /** |
@@ -5502,7 +5502,7 @@ discard block |
||
| 5502 | 5502 | $when = time(); |
| 5503 | 5503 | |
| 5504 | 5504 | // We'll need these too |
| 5505 | - $date_when = date_create('@' . $when); |
|
| 5505 | + $date_when = date_create('@'.$when); |
|
| 5506 | 5506 | $later = (int) date_format(date_add($date_when, date_interval_create_from_date_string('1 year')), 'U'); |
| 5507 | 5507 | |
| 5508 | 5508 | // Load up any custom time zone descriptions we might have |
@@ -5581,10 +5581,10 @@ discard block |
||
| 5581 | 5581 | $desc = $tztxt[$tzvalue['tzid']]; |
| 5582 | 5582 | // Otherwise, use the list of locations (max 5, so things don't get silly) |
| 5583 | 5583 | else |
| 5584 | - $desc = implode(', ', array_slice(array_unique($tzvalue['locations']), 0, 5)) . (count($tzvalue['locations']) > 5 ? ', ' . $txt['etc'] : ''); |
|
| 5584 | + $desc = implode(', ', array_slice(array_unique($tzvalue['locations']), 0, 5)).(count($tzvalue['locations']) > 5 ? ', '.$txt['etc'] : ''); |
|
| 5585 | 5585 | |
| 5586 | 5586 | // Show the UTC offset and the abbreviation, if it's something like 'MST' and not '-06' |
| 5587 | - $desc = '[UTC' . date_format($date_when, 'P') . '] - ' . (!strspn($tzvalue['abbr'], '+-') ? $tzvalue['abbr'] . ' - ' : '') . $desc; |
|
| 5587 | + $desc = '[UTC'.date_format($date_when, 'P').'] - '.(!strspn($tzvalue['abbr'], '+-') ? $tzvalue['abbr'].' - ' : '').$desc; |
|
| 5588 | 5588 | |
| 5589 | 5589 | if (isset($priority_zones[$tzkey])) |
| 5590 | 5590 | $priority_timezones[$tzvalue['tzid']] = $desc; |
@@ -5597,7 +5597,7 @@ discard block |
||
| 5597 | 5597 | |
| 5598 | 5598 | $timezones = array_merge( |
| 5599 | 5599 | $priority_timezones, |
| 5600 | - array('' => '(Forum Default)', 'UTC' => 'UTC - ' . $tztxt['UTC'], '-----'), |
|
| 5600 | + array('' => '(Forum Default)', 'UTC' => 'UTC - '.$tztxt['UTC'], '-----'), |
|
| 5601 | 5601 | $timezones |
| 5602 | 5602 | ); |
| 5603 | 5603 | |
@@ -5623,7 +5623,7 @@ discard block |
||
| 5623 | 5623 | */ |
| 5624 | 5624 | function inet_dtop($bin) |
| 5625 | 5625 | { |
| 5626 | - if(empty($bin)) |
|
| 5626 | + if (empty($bin)) |
|
| 5627 | 5627 | return ''; |
| 5628 | 5628 | |
| 5629 | 5629 | global $db_type; |
@@ -5654,28 +5654,28 @@ discard block |
||
| 5654 | 5654 | */ |
| 5655 | 5655 | function _safe_serialize($value) |
| 5656 | 5656 | { |
| 5657 | - if(is_null($value)) |
|
| 5657 | + if (is_null($value)) |
|
| 5658 | 5658 | return 'N;'; |
| 5659 | 5659 | |
| 5660 | - if(is_bool($value)) |
|
| 5661 | - return 'b:'. (int) $value .';'; |
|
| 5660 | + if (is_bool($value)) |
|
| 5661 | + return 'b:'.(int) $value.';'; |
|
| 5662 | 5662 | |
| 5663 | - if(is_int($value)) |
|
| 5664 | - return 'i:'. $value .';'; |
|
| 5663 | + if (is_int($value)) |
|
| 5664 | + return 'i:'.$value.';'; |
|
| 5665 | 5665 | |
| 5666 | - if(is_float($value)) |
|
| 5667 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5666 | + if (is_float($value)) |
|
| 5667 | + return 'd:'.str_replace(',', '.', $value).';'; |
|
| 5668 | 5668 | |
| 5669 | - if(is_string($value)) |
|
| 5670 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5669 | + if (is_string($value)) |
|
| 5670 | + return 's:'.strlen($value).':"'.$value.'";'; |
|
| 5671 | 5671 | |
| 5672 | - if(is_array($value)) |
|
| 5672 | + if (is_array($value)) |
|
| 5673 | 5673 | { |
| 5674 | 5674 | $out = ''; |
| 5675 | - foreach($value as $k => $v) |
|
| 5676 | - $out .= _safe_serialize($k) . _safe_serialize($v); |
|
| 5675 | + foreach ($value as $k => $v) |
|
| 5676 | + $out .= _safe_serialize($k)._safe_serialize($v); |
|
| 5677 | 5677 | |
| 5678 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5678 | + return 'a:'.count($value).':{'.$out.'}'; |
|
| 5679 | 5679 | } |
| 5680 | 5680 | |
| 5681 | 5681 | // safe_serialize cannot serialize resources or objects. |
@@ -5717,7 +5717,7 @@ discard block |
||
| 5717 | 5717 | function _safe_unserialize($str) |
| 5718 | 5718 | { |
| 5719 | 5719 | // Input is not a string. |
| 5720 | - if(empty($str) || !is_string($str)) |
|
| 5720 | + if (empty($str) || !is_string($str)) |
|
| 5721 | 5721 | return false; |
| 5722 | 5722 | |
| 5723 | 5723 | $stack = array(); |
@@ -5731,40 +5731,40 @@ discard block |
||
| 5731 | 5731 | * 3 - in array, expecting value or another array |
| 5732 | 5732 | */ |
| 5733 | 5733 | $state = 0; |
| 5734 | - while($state != 1) |
|
| 5734 | + while ($state != 1) |
|
| 5735 | 5735 | { |
| 5736 | 5736 | $type = isset($str[0]) ? $str[0] : ''; |
| 5737 | - if($type == '}') |
|
| 5737 | + if ($type == '}') |
|
| 5738 | 5738 | $str = substr($str, 1); |
| 5739 | 5739 | |
| 5740 | - else if($type == 'N' && $str[1] == ';') |
|
| 5740 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5741 | 5741 | { |
| 5742 | 5742 | $value = null; |
| 5743 | 5743 | $str = substr($str, 2); |
| 5744 | 5744 | } |
| 5745 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5745 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5746 | 5746 | { |
| 5747 | 5747 | $value = $matches[1] == '1' ? true : false; |
| 5748 | 5748 | $str = substr($str, 4); |
| 5749 | 5749 | } |
| 5750 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5750 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5751 | 5751 | { |
| 5752 | - $value = (int)$matches[1]; |
|
| 5752 | + $value = (int) $matches[1]; |
|
| 5753 | 5753 | $str = $matches[2]; |
| 5754 | 5754 | } |
| 5755 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5755 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5756 | 5756 | { |
| 5757 | - $value = (float)$matches[1]; |
|
| 5757 | + $value = (float) $matches[1]; |
|
| 5758 | 5758 | $str = $matches[3]; |
| 5759 | 5759 | } |
| 5760 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5760 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5761 | 5761 | { |
| 5762 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5763 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5762 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5763 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5764 | 5764 | } |
| 5765 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5765 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5766 | 5766 | { |
| 5767 | - $expectedLength = (int)$matches[1]; |
|
| 5767 | + $expectedLength = (int) $matches[1]; |
|
| 5768 | 5768 | $str = $matches[2]; |
| 5769 | 5769 | } |
| 5770 | 5770 | |
@@ -5772,10 +5772,10 @@ discard block |
||
| 5772 | 5772 | else |
| 5773 | 5773 | return false; |
| 5774 | 5774 | |
| 5775 | - switch($state) |
|
| 5775 | + switch ($state) |
|
| 5776 | 5776 | { |
| 5777 | 5777 | case 3: // In array, expecting value or another array. |
| 5778 | - if($type == 'a') |
|
| 5778 | + if ($type == 'a') |
|
| 5779 | 5779 | { |
| 5780 | 5780 | $stack[] = &$list; |
| 5781 | 5781 | $list[$key] = array(); |
@@ -5784,7 +5784,7 @@ discard block |
||
| 5784 | 5784 | $state = 2; |
| 5785 | 5785 | break; |
| 5786 | 5786 | } |
| 5787 | - if($type != '}') |
|
| 5787 | + if ($type != '}') |
|
| 5788 | 5788 | { |
| 5789 | 5789 | $list[$key] = $value; |
| 5790 | 5790 | $state = 2; |
@@ -5795,29 +5795,29 @@ discard block |
||
| 5795 | 5795 | return false; |
| 5796 | 5796 | |
| 5797 | 5797 | case 2: // in array, expecting end of array or a key |
| 5798 | - if($type == '}') |
|
| 5798 | + if ($type == '}') |
|
| 5799 | 5799 | { |
| 5800 | 5800 | // Array size is less than expected. |
| 5801 | - if(count($list) < end($expected)) |
|
| 5801 | + if (count($list) < end($expected)) |
|
| 5802 | 5802 | return false; |
| 5803 | 5803 | |
| 5804 | 5804 | unset($list); |
| 5805 | - $list = &$stack[count($stack)-1]; |
|
| 5805 | + $list = &$stack[count($stack) - 1]; |
|
| 5806 | 5806 | array_pop($stack); |
| 5807 | 5807 | |
| 5808 | 5808 | // Go to terminal state if we're at the end of the root array. |
| 5809 | 5809 | array_pop($expected); |
| 5810 | 5810 | |
| 5811 | - if(count($expected) == 0) |
|
| 5811 | + if (count($expected) == 0) |
|
| 5812 | 5812 | $state = 1; |
| 5813 | 5813 | |
| 5814 | 5814 | break; |
| 5815 | 5815 | } |
| 5816 | 5816 | |
| 5817 | - if($type == 'i' || $type == 's') |
|
| 5817 | + if ($type == 'i' || $type == 's') |
|
| 5818 | 5818 | { |
| 5819 | 5819 | // Array size exceeds expected length. |
| 5820 | - if(count($list) >= end($expected)) |
|
| 5820 | + if (count($list) >= end($expected)) |
|
| 5821 | 5821 | return false; |
| 5822 | 5822 | |
| 5823 | 5823 | $key = $value; |
@@ -5830,7 +5830,7 @@ discard block |
||
| 5830 | 5830 | |
| 5831 | 5831 | // Expecting array or value. |
| 5832 | 5832 | case 0: |
| 5833 | - if($type == 'a') |
|
| 5833 | + if ($type == 'a') |
|
| 5834 | 5834 | { |
| 5835 | 5835 | $data = array(); |
| 5836 | 5836 | $list = &$data; |
@@ -5839,7 +5839,7 @@ discard block |
||
| 5839 | 5839 | break; |
| 5840 | 5840 | } |
| 5841 | 5841 | |
| 5842 | - if($type != '}') |
|
| 5842 | + if ($type != '}') |
|
| 5843 | 5843 | { |
| 5844 | 5844 | $data = $value; |
| 5845 | 5845 | $state = 1; |
@@ -5852,7 +5852,7 @@ discard block |
||
| 5852 | 5852 | } |
| 5853 | 5853 | |
| 5854 | 5854 | // Trailing data in input. |
| 5855 | - if(!empty($str)) |
|
| 5855 | + if (!empty($str)) |
|
| 5856 | 5856 | return false; |
| 5857 | 5857 | |
| 5858 | 5858 | return $data; |
@@ -5906,7 +5906,7 @@ discard block |
||
| 5906 | 5906 | // Set different modes. |
| 5907 | 5907 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5908 | 5908 | |
| 5909 | - foreach($chmodValues as $val) |
|
| 5909 | + foreach ($chmodValues as $val) |
|
| 5910 | 5910 | { |
| 5911 | 5911 | // If it's writable, break out of the loop. |
| 5912 | 5912 | if (is_writable($file)) |
@@ -5941,13 +5941,13 @@ discard block |
||
| 5941 | 5941 | $returnArray = @json_decode($json, $returnAsArray); |
| 5942 | 5942 | |
| 5943 | 5943 | // PHP 5.3 so no json_last_error_msg() |
| 5944 | - switch(json_last_error()) |
|
| 5944 | + switch (json_last_error()) |
|
| 5945 | 5945 | { |
| 5946 | 5946 | case JSON_ERROR_NONE: |
| 5947 | 5947 | $jsonError = false; |
| 5948 | 5948 | break; |
| 5949 | 5949 | case JSON_ERROR_DEPTH: |
| 5950 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5950 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5951 | 5951 | break; |
| 5952 | 5952 | case JSON_ERROR_STATE_MISMATCH: |
| 5953 | 5953 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5975,10 +5975,10 @@ discard block |
||
| 5975 | 5975 | loadLanguage('Errors'); |
| 5976 | 5976 | |
| 5977 | 5977 | if (!empty($jsonDebug)) |
| 5978 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5978 | + log_error($txt['json_'.$jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5979 | 5979 | |
| 5980 | 5980 | else |
| 5981 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5981 | + log_error($txt['json_'.$jsonError], 'critical'); |
|
| 5982 | 5982 | |
| 5983 | 5983 | // Everyone expects an array. |
| 5984 | 5984 | return array(); |
@@ -6074,7 +6074,7 @@ discard block |
||
| 6074 | 6074 | $postapocalypticNightmare = true; |
| 6075 | 6075 | } |
| 6076 | 6076 | // If we aren't updating and the regex is valid, we're done |
| 6077 | - elseif (!empty($modSettings['tld_regex']) && @preg_match('~' . $modSettings['tld_regex'] . '~', null) !== false) |
|
| 6077 | + elseif (!empty($modSettings['tld_regex']) && @preg_match('~'.$modSettings['tld_regex'].'~', null) !== false) |
|
| 6078 | 6078 | { |
| 6079 | 6079 | $done = true; |
| 6080 | 6080 | return; |
@@ -6093,9 +6093,9 @@ discard block |
||
| 6093 | 6093 | }); |
| 6094 | 6094 | |
| 6095 | 6095 | // Convert Punycode to Unicode |
| 6096 | - require_once($sourcedir . '/Class-Punycode.php'); |
|
| 6096 | + require_once($sourcedir.'/Class-Punycode.php'); |
|
| 6097 | 6097 | $Punycode = new Punycode(); |
| 6098 | - $tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
| 6098 | + $tlds = array_map(function($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
| 6099 | 6099 | } |
| 6100 | 6100 | // Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update |
| 6101 | 6101 | else |
@@ -6189,7 +6189,7 @@ discard block |
||
| 6189 | 6189 | } |
| 6190 | 6190 | |
| 6191 | 6191 | // This recursive function creates the index array from the strings |
| 6192 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 6192 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 6193 | 6193 | { |
| 6194 | 6194 | static $depth = 0; |
| 6195 | 6195 | $depth++; |
@@ -6216,7 +6216,7 @@ discard block |
||
| 6216 | 6216 | }; |
| 6217 | 6217 | |
| 6218 | 6218 | // This recursive function turns the index array into a regular expression |
| 6219 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 6219 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 6220 | 6220 | { |
| 6221 | 6221 | static $depth = 0; |
| 6222 | 6222 | $depth++; |
@@ -6244,16 +6244,16 @@ discard block |
||
| 6244 | 6244 | $new_key .= $new_key_array[0]; |
| 6245 | 6245 | } |
| 6246 | 6246 | else |
| 6247 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 6247 | + $sub_regex = '(?'.'>'.$sub_regex.')'; |
|
| 6248 | 6248 | } |
| 6249 | 6249 | |
| 6250 | 6250 | if ($depth > 1) |
| 6251 | - $regex[$new_key] = $key_regex . $sub_regex; |
|
| 6251 | + $regex[$new_key] = $key_regex.$sub_regex; |
|
| 6252 | 6252 | else |
| 6253 | 6253 | { |
| 6254 | 6254 | if (($length += strlen($key_regex) + 1) < $max_length || empty($regex)) |
| 6255 | 6255 | { |
| 6256 | - $regex[$new_key] = $key_regex . $sub_regex; |
|
| 6256 | + $regex[$new_key] = $key_regex.$sub_regex; |
|
| 6257 | 6257 | unset($index[$key]); |
| 6258 | 6258 | } |
| 6259 | 6259 | else |
@@ -6287,10 +6287,10 @@ discard block |
||
| 6287 | 6287 | { |
| 6288 | 6288 | $regex = array(); |
| 6289 | 6289 | while (!empty($index)) |
| 6290 | - $regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6290 | + $regex[] = '(?'.'>'.$index_to_regex($index, $delim).')'; |
|
| 6291 | 6291 | } |
| 6292 | 6292 | else |
| 6293 | - $regex = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6293 | + $regex = '(?'.'>'.$index_to_regex($index, $delim).')'; |
|
| 6294 | 6294 | |
| 6295 | 6295 | // Restore PHP's internal character encoding to whatever it was originally |
| 6296 | 6296 | if (!empty($current_encoding)) |
@@ -6309,7 +6309,7 @@ discard block |
||
| 6309 | 6309 | { |
| 6310 | 6310 | // First, strip the subfolder from the passed url, if any |
| 6311 | 6311 | $parsedurl = parse_url($url); |
| 6312 | - $url = 'ssl://' . $parsedurl['host'] . ':443'; |
|
| 6312 | + $url = 'ssl://'.$parsedurl['host'].':443'; |
|
| 6313 | 6313 | |
| 6314 | 6314 | // Next, check the ssl stream context for certificate info |
| 6315 | 6315 | $result = false; |
@@ -6335,7 +6335,7 @@ discard block |
||
| 6335 | 6335 | { |
| 6336 | 6336 | // Ask for the headers for the passed url, but via http... |
| 6337 | 6337 | // Need to add the trailing slash, or it puts it there & thinks there's a redirect when there isn't... |
| 6338 | - $url = str_ireplace('https://', 'http://', $url) . '/'; |
|
| 6338 | + $url = str_ireplace('https://', 'http://', $url).'/'; |
|
| 6339 | 6339 | $headers = @get_headers($url); |
| 6340 | 6340 | if ($headers === false) |
| 6341 | 6341 | return false; |
@@ -6443,7 +6443,7 @@ discard block |
||
| 6443 | 6443 | // Just in case we've got duplicates here... |
| 6444 | 6444 | $boards_mod = array_unique($boards_mod); |
| 6445 | 6445 | |
| 6446 | - $mod_cache['mq'] = empty($boards_mod) ? '0=1' : 'b.id_board IN (' . implode(',', $boards_mod) . ')'; |
|
| 6446 | + $mod_cache['mq'] = empty($boards_mod) ? '0=1' : 'b.id_board IN ('.implode(',', $boards_mod).')'; |
|
| 6447 | 6447 | } |
| 6448 | 6448 | |
| 6449 | 6449 | // Just build this here, it makes it easier to change/use - administrators can see all boards. |
@@ -6451,8 +6451,8 @@ discard block |
||
| 6451 | 6451 | $query_part['query_see_board'] = '1=1'; |
| 6452 | 6452 | // Otherwise just the groups in $user_info['groups']. |
| 6453 | 6453 | else |
| 6454 | - $query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( '. implode(',', $groups) .') AND bpv.deny = 0) ' |
|
| 6455 | - . ( !empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( '. implode(',', $groups) .') and bpv.deny = 1)' : '') |
|
| 6454 | + $query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM '.$db_prefix.'board_permissions_view bpv WHERE (bpv.id_group IN ( '.implode(',', $groups).') AND bpv.deny = 0) ' |
|
| 6455 | + . (!empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( '.implode(',', $groups).') and bpv.deny = 1)' : '') |
|
| 6456 | 6456 | . ' AND bpv.id_board = b.id_board)'; |
| 6457 | 6457 | |
| 6458 | 6458 | // Build the list of boards they WANT to see. |
@@ -6463,7 +6463,7 @@ discard block |
||
| 6463 | 6463 | $query_part['query_wanna_see_board'] = $query_part['query_see_board']; |
| 6464 | 6464 | // Ok I guess they don't want to see all the boards |
| 6465 | 6465 | else |
| 6466 | - $query_part['query_wanna_see_board'] = '(' . $query_part['query_see_board'] . ' AND b.id_board NOT IN (' . implode(',', $ignoreboards) . '))'; |
|
| 6466 | + $query_part['query_wanna_see_board'] = '('.$query_part['query_see_board'].' AND b.id_board NOT IN ('.implode(',', $ignoreboards).'))'; |
|
| 6467 | 6467 | |
| 6468 | 6468 | return $query_part; |
| 6469 | 6469 | } |
@@ -6516,7 +6516,7 @@ discard block |
||
| 6516 | 6516 | function sanitize_iri($iri) |
| 6517 | 6517 | { |
| 6518 | 6518 | // Encode any non-ASCII characters (but not space or control characters of any sort) |
| 6519 | - $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) { |
|
| 6519 | + $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function($matches) { |
|
| 6520 | 6520 | return rawurlencode($matches[0]); |
| 6521 | 6521 | }, $iri); |
| 6522 | 6522 | |
@@ -6542,13 +6542,13 @@ discard block |
||
| 6542 | 6542 | { |
| 6543 | 6543 | global $sourcedir; |
| 6544 | 6544 | |
| 6545 | - $host = parse_url((strpos($iri, '://') === false ? 'http://' : '') . ltrim($iri, ':/'), PHP_URL_HOST); |
|
| 6545 | + $host = parse_url((strpos($iri, '://') === false ? 'http://' : '').ltrim($iri, ':/'), PHP_URL_HOST); |
|
| 6546 | 6546 | |
| 6547 | 6547 | if (empty($host)) |
| 6548 | 6548 | return $iri; |
| 6549 | 6549 | |
| 6550 | 6550 | // Convert the domain using the Punycode algorithm |
| 6551 | - require_once($sourcedir . '/Class-Punycode.php'); |
|
| 6551 | + require_once($sourcedir.'/Class-Punycode.php'); |
|
| 6552 | 6552 | $Punycode = new Punycode(); |
| 6553 | 6553 | $encoded_host = $Punycode->encode($host); |
| 6554 | 6554 | $pos = strpos($iri, $host); |
@@ -6558,7 +6558,7 @@ discard block |
||
| 6558 | 6558 | $unescaped = array( |
| 6559 | 6559 | '%21'=>'!', '%23'=>'#', '%24'=>'$', '%26'=>'&', |
| 6560 | 6560 | '%27'=>"'", '%28'=>'(', '%29'=>')', '%2A'=>'*', |
| 6561 | - '%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':', |
|
| 6561 | + '%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':', |
|
| 6562 | 6562 | '%3B'=>';', '%3D'=>'=', '%3F'=>'?', '%40'=>'@', |
| 6563 | 6563 | ); |
| 6564 | 6564 | $iri = strtr(rawurlencode($iri), $unescaped); |
@@ -6579,13 +6579,13 @@ discard block |
||
| 6579 | 6579 | { |
| 6580 | 6580 | global $sourcedir; |
| 6581 | 6581 | |
| 6582 | - $host = parse_url((strpos($url, '://') === false ? 'http://' : '') . ltrim($url, ':/'), PHP_URL_HOST); |
|
| 6582 | + $host = parse_url((strpos($url, '://') === false ? 'http://' : '').ltrim($url, ':/'), PHP_URL_HOST); |
|
| 6583 | 6583 | |
| 6584 | 6584 | if (empty($host)) |
| 6585 | 6585 | return $url; |
| 6586 | 6586 | |
| 6587 | 6587 | // Decode the domain from Punycode |
| 6588 | - require_once($sourcedir . '/Class-Punycode.php'); |
|
| 6588 | + require_once($sourcedir.'/Class-Punycode.php'); |
|
| 6589 | 6589 | $Punycode = new Punycode(); |
| 6590 | 6590 | $decoded_host = $Punycode->decode($host); |
| 6591 | 6591 | $pos = strpos($url, $host); |
@@ -6656,9 +6656,9 @@ discard block |
||
| 6656 | 6656 | $protocol = preg_match('~^\s*(HTTP/[12]\.\d)\s*$~i', $_SERVER['SERVER_PROTOCOL'], $matches) ? $matches[1] : 'HTTP/1.0'; |
| 6657 | 6657 | |
| 6658 | 6658 | if (!isset($statuses[$code]) && empty($status)) |
| 6659 | - header($protocol . ' 500 Internal Server Error'); |
|
| 6659 | + header($protocol.' 500 Internal Server Error'); |
|
| 6660 | 6660 | else |
| 6661 | - header($protocol . ' ' . $code . ' ' . (!empty($status) ? $status : $statuses[$code])); |
|
| 6661 | + header($protocol.' '.$code.' '.(!empty($status) ? $status : $statuses[$code])); |
|
| 6662 | 6662 | } |
| 6663 | 6663 | |
| 6664 | 6664 | ?> |
| 6665 | 6665 | \ No newline at end of file |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $utf8 = (empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']) === 'UTF-8'; |
| 77 | 77 | |
| 78 | 78 | // Set a list of common functions. |
| 79 | - $ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);'; |
|
| 79 | + $ent_list = '&(?:#'.(empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021').'|quot|amp|lt|gt|nbsp);'; |
|
| 80 | 80 | $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
| 81 | 81 | { |
| 82 | 82 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | elseif ($ord < 224) |
| 105 | 105 | { |
| 106 | - $new_string .= $string[$i] . $string[$i + 1]; |
|
| 106 | + $new_string .= $string[$i].$string[$i + 1]; |
|
| 107 | 107 | $i += 2; |
| 108 | 108 | } |
| 109 | 109 | elseif ($ord < 240) |
| 110 | 110 | { |
| 111 | - $new_string .= $string[$i] . $string[$i + 1] . $string[$i + 2]; |
|
| 111 | + $new_string .= $string[$i].$string[$i + 1].$string[$i + 2]; |
|
| 112 | 112 | $i += 3; |
| 113 | 113 | } |
| 114 | 114 | elseif ($ord < 248) |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $val += (ord($string[$i + 1]) & 0x3F) << 12; |
| 119 | 119 | $val += (ord($string[$i + 2]) & 0x3F) << 6; |
| 120 | 120 | $val += (ord($string[$i + 3]) & 0x3F); |
| 121 | - $new_string .= '&#' . $val . ';'; |
|
| 121 | + $new_string .= '&#'.$val.';'; |
|
| 122 | 122 | $i += 4; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | 'entity_fix' => function($string) |
| 131 | 131 | { |
| 132 | 132 | $num = $string[0] === 'x' ? hexdec(substr($string, 1)) : (int) $string; |
| 133 | - return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202E || $num === 0x202D ? '' : '&#' . $num . ';'; |
|
| 133 | + return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202E || $num === 0x202D ? '' : '&#'.$num.';'; |
|
| 134 | 134 | }, |
| 135 | 135 | 'htmlspecialchars' => function($string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1') use ($ent_check, $utf8, $fix_utf8mb4) |
| 136 | 136 | { |
@@ -141,15 +141,15 @@ discard block |
||
| 141 | 141 | // Preg_replace space characters depend on the character set in use |
| 142 | 142 | $space_chars = $utf8 ? '\p{Z}\p{C}' : '\x00-\x20\x80-\xA0'; |
| 143 | 143 | |
| 144 | - return preg_replace('~^(?:[' . $space_chars . ']| )+|(?:[' . $space_chars . ']| )+$~' . ($utf8 ? 'u' : ''), '', $ent_check($string)); |
|
| 144 | + return preg_replace('~^(?:['.$space_chars.']| )+|(?:['.$space_chars.']| )+$~'.($utf8 ? 'u' : ''), '', $ent_check($string)); |
|
| 145 | 145 | }, |
| 146 | 146 | 'strlen' => function($string) use ($ent_list, $utf8, $ent_check) |
| 147 | 147 | { |
| 148 | - return strlen(preg_replace('~' . $ent_list . ($utf8 ? '|.~u' : '~'), '_', $ent_check($string))); |
|
| 148 | + return strlen(preg_replace('~'.$ent_list.($utf8 ? '|.~u' : '~'), '_', $ent_check($string))); |
|
| 149 | 149 | }, |
| 150 | 150 | 'strpos' => function($haystack, $needle, $offset = 0) use ($utf8, $ent_check, $ent_list, $modSettings) |
| 151 | 151 | { |
| 152 | - $haystack_arr = preg_split('~(' . $ent_list . '|.)~' . ($utf8 ? 'u' : ''), $ent_check($haystack), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 152 | + $haystack_arr = preg_split('~('.$ent_list.'|.)~'.($utf8 ? 'u' : ''), $ent_check($haystack), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 153 | 153 | |
| 154 | 154 | if (strlen($needle) === 1) |
| 155 | 155 | { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | else |
| 160 | 160 | { |
| 161 | - $needle_arr = preg_split('~(' . $ent_list . '|.)~' . ($utf8 ? 'u' : '') . '', $ent_check($needle), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 161 | + $needle_arr = preg_split('~('.$ent_list.'|.)~'.($utf8 ? 'u' : '').'', $ent_check($needle), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 162 | 162 | $needle_size = count($needle_arr); |
| 163 | 163 | |
| 164 | 164 | $result = array_search($needle_arr[0], array_slice($haystack_arr, $offset)); |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | }, |
| 175 | 175 | 'substr' => function($string, $start, $length = null) use ($utf8, $ent_check, $ent_list, $modSettings) |
| 176 | 176 | { |
| 177 | - $ent_arr = preg_split('~(' . $ent_list . '|.)~' . ($utf8 ? 'u' : '') . '', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 177 | + $ent_arr = preg_split('~('.$ent_list.'|.)~'.($utf8 ? 'u' : '').'', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 178 | 178 | return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length)); |
| 179 | 179 | }, |
| 180 | 180 | 'strtolower' => $utf8 ? function($string) use ($sourcedir) |
| 181 | 181 | { |
| 182 | 182 | if (!function_exists('mb_strtolower')) |
| 183 | 183 | { |
| 184 | - require_once($sourcedir . '/Subs-Charset.php'); |
|
| 184 | + require_once($sourcedir.'/Subs-Charset.php'); |
|
| 185 | 185 | return utf8_strtolower($string); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | if (!function_exists('mb_strtolower')) |
| 195 | 195 | { |
| 196 | - require_once($sourcedir . '/Subs-Charset.php'); |
|
| 196 | + require_once($sourcedir.'/Subs-Charset.php'); |
|
| 197 | 197 | return utf8_strtoupper($string); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -202,15 +202,15 @@ discard block |
||
| 202 | 202 | 'truncate' => function($string, $length) use ($utf8, $ent_check, $ent_list, &$smcFunc) |
| 203 | 203 | { |
| 204 | 204 | $string = $ent_check($string); |
| 205 | - preg_match('~^(' . $ent_list . '|.){' . $smcFunc['strlen'](substr($string, 0, $length)) . '}~' . ($utf8 ? 'u' : ''), $string, $matches); |
|
| 205 | + preg_match('~^('.$ent_list.'|.){'.$smcFunc['strlen'](substr($string, 0, $length)).'}~'.($utf8 ? 'u' : ''), $string, $matches); |
|
| 206 | 206 | $string = $matches[0]; |
| 207 | 207 | while (strlen($string) > $length) |
| 208 | - $string = preg_replace('~(?:' . $ent_list . '|.)$~' . ($utf8 ? 'u' : ''), '', $string); |
|
| 208 | + $string = preg_replace('~(?:'.$ent_list.'|.)$~'.($utf8 ? 'u' : ''), '', $string); |
|
| 209 | 209 | return $string; |
| 210 | 210 | }, |
| 211 | 211 | 'ucfirst' => $utf8 ? function($string) use (&$smcFunc) |
| 212 | 212 | { |
| 213 | - return $smcFunc['strtoupper']($smcFunc['substr']($string, 0, 1)) . $smcFunc['substr']($string, 1); |
|
| 213 | + return $smcFunc['strtoupper']($smcFunc['substr']($string, 0, 1)).$smcFunc['substr']($string, 1); |
|
| 214 | 214 | } : 'ucfirst', |
| 215 | 215 | 'ucwords' => $utf8 ? function($string) use (&$smcFunc) |
| 216 | 216 | { |
@@ -428,17 +428,17 @@ discard block |
||
| 428 | 428 | $id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0; |
| 429 | 429 | |
| 430 | 430 | // Make sure the cookie is set to the correct domain and path |
| 431 | - require_once($sourcedir . '/Subs-Auth.php'); |
|
| 431 | + require_once($sourcedir.'/Subs-Auth.php'); |
|
| 432 | 432 | if (array($cookie_domain, $cookie_path) !== url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']))) |
| 433 | 433 | setLoginCookie((int) $login_span - time(), $id_member); |
| 434 | 434 | } |
| 435 | - elseif (empty($id_member) && isset($_SESSION['login_' . $cookiename]) && ($_SESSION['USER_AGENT'] == $_SERVER['HTTP_USER_AGENT'] || !empty($modSettings['disableCheckUA']))) |
|
| 435 | + elseif (empty($id_member) && isset($_SESSION['login_'.$cookiename]) && ($_SESSION['USER_AGENT'] == $_SERVER['HTTP_USER_AGENT'] || !empty($modSettings['disableCheckUA']))) |
|
| 436 | 436 | { |
| 437 | 437 | // @todo Perhaps we can do some more checking on this, such as on the first octet of the IP? |
| 438 | - $cookie_data = $smcFunc['json_decode']($_SESSION['login_' . $cookiename], true); |
|
| 438 | + $cookie_data = $smcFunc['json_decode']($_SESSION['login_'.$cookiename], true); |
|
| 439 | 439 | |
| 440 | 440 | if (empty($cookie_data)) |
| 441 | - $cookie_data = safe_unserialize($_SESSION['login_' . $cookiename]); |
|
| 441 | + $cookie_data = safe_unserialize($_SESSION['login_'.$cookiename]); |
|
| 442 | 442 | |
| 443 | 443 | list($id_member, $password, $login_span) = array_pad((array) $cookie_data, 3, ''); |
| 444 | 444 | $id_member = !empty($id_member) && strlen($password) == 128 && (int) $login_span > time() ? (int) $id_member : 0; |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | if ($id_member != 0) |
| 449 | 449 | { |
| 450 | 450 | // Is the member data cached? |
| 451 | - if (empty($modSettings['cache_enable']) || $modSettings['cache_enable'] < 2 || ($user_settings = cache_get_data('user_settings-' . $id_member, 60)) == null) |
|
| 451 | + if (empty($modSettings['cache_enable']) || $modSettings['cache_enable'] < 2 || ($user_settings = cache_get_data('user_settings-'.$id_member, 60)) == null) |
|
| 452 | 452 | { |
| 453 | 453 | $request = $smcFunc['db_query']('', ' |
| 454 | 454 | SELECT mem.*, COALESCE(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $user_settings['avatar'] = get_proxied_url($user_settings['avatar']); |
| 468 | 468 | |
| 469 | 469 | if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) |
| 470 | - cache_put_data('user_settings-' . $id_member, $user_settings, 60); |
|
| 470 | + cache_put_data('user_settings-'.$id_member, $user_settings, 60); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | // Did we find 'im? If not, junk it. |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | // If we no longer have the member maybe they're being all hackey, stop brute force! |
| 492 | 492 | if (!$id_member) |
| 493 | 493 | { |
| 494 | - require_once($sourcedir . '/LogInOut.php'); |
|
| 494 | + require_once($sourcedir.'/LogInOut.php'); |
|
| 495 | 495 | validatePasswordFlood( |
| 496 | 496 | !empty($user_settings['id_member']) ? $user_settings['id_member'] : $id_member, |
| 497 | 497 | !empty($user_settings['member_name']) ? $user_settings['member_name'] : '', |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | // Validate for Two Factor Authentication |
| 503 | 503 | elseif (!empty($modSettings['tfa_mode']) && $id_member && !empty($user_settings['tfa_secret']) && (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('login2', 'logintfa')))) |
| 504 | 504 | { |
| 505 | - $tfacookie = $cookiename . '_tfa'; |
|
| 505 | + $tfacookie = $cookiename.'_tfa'; |
|
| 506 | 506 | $tfasecret = null; |
| 507 | 507 | |
| 508 | 508 | $verified = call_integration_hook('integrate_verify_tfa', array($id_member, $user_settings)); |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | // 3. If it was set within this session, no need to set it again. |
| 583 | 583 | // 4. New session, yet updated < five hours ago? Maybe cache can help. |
| 584 | 584 | // 5. We're still logging in or authenticating |
| 585 | - if (SMF != 'SSI' && !isset($_REQUEST['xml']) && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('.xml', 'login2', 'logintfa'))) && empty($_SESSION['id_msg_last_visit']) && (empty($modSettings['cache_enable']) || ($_SESSION['id_msg_last_visit'] = cache_get_data('user_last_visit-' . $id_member, 5 * 3600)) === null)) |
|
| 585 | + if (SMF != 'SSI' && !isset($_REQUEST['xml']) && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('.xml', 'login2', 'logintfa'))) && empty($_SESSION['id_msg_last_visit']) && (empty($modSettings['cache_enable']) || ($_SESSION['id_msg_last_visit'] = cache_get_data('user_last_visit-'.$id_member, 5 * 3600)) === null)) |
|
| 586 | 586 | { |
| 587 | 587 | // @todo can this be cached? |
| 588 | 588 | // Do a quick query to make sure this isn't a mistake. |
@@ -607,10 +607,10 @@ discard block |
||
| 607 | 607 | $user_settings['last_login'] = time(); |
| 608 | 608 | |
| 609 | 609 | if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) |
| 610 | - cache_put_data('user_settings-' . $id_member, $user_settings, 60); |
|
| 610 | + cache_put_data('user_settings-'.$id_member, $user_settings, 60); |
|
| 611 | 611 | |
| 612 | 612 | if (!empty($modSettings['cache_enable'])) |
| 613 | - cache_put_data('user_last_visit-' . $id_member, $_SESSION['id_msg_last_visit'], 5 * 3600); |
|
| 613 | + cache_put_data('user_last_visit-'.$id_member, $_SESSION['id_msg_last_visit'], 5 * 3600); |
|
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | elseif (empty($_SESSION['id_msg_last_visit'])) |
@@ -664,15 +664,15 @@ discard block |
||
| 664 | 664 | $_COOKIE[$cookiename] = ''; |
| 665 | 665 | |
| 666 | 666 | // Expire the 2FA cookie |
| 667 | - if (isset($_COOKIE[$cookiename . '_tfa']) && empty($context['tfa_member'])) |
|
| 667 | + if (isset($_COOKIE[$cookiename.'_tfa']) && empty($context['tfa_member'])) |
|
| 668 | 668 | { |
| 669 | - $tfa_data = $smcFunc['json_decode']($_COOKIE[$cookiename . '_tfa'], true); |
|
| 669 | + $tfa_data = $smcFunc['json_decode']($_COOKIE[$cookiename.'_tfa'], true); |
|
| 670 | 670 | |
| 671 | 671 | list (,, $exp) = array_pad((array) $tfa_data, 3, 0); |
| 672 | 672 | |
| 673 | 673 | if (time() > $exp) |
| 674 | 674 | { |
| 675 | - $_COOKIE[$cookiename . '_tfa'] = ''; |
|
| 675 | + $_COOKIE[$cookiename.'_tfa'] = ''; |
|
| 676 | 676 | setTFACookie(-3600, 0, ''); |
| 677 | 677 | } |
| 678 | 678 | } |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | // Do we perhaps think this is a search robot? Check every five minutes just in case... |
| 687 | 687 | if ((!empty($modSettings['spider_mode']) || !empty($modSettings['spider_group'])) && (!isset($_SESSION['robot_check']) || $_SESSION['robot_check'] < time() - 300)) |
| 688 | 688 | { |
| 689 | - require_once($sourcedir . '/ManageSearchEngines.php'); |
|
| 689 | + require_once($sourcedir.'/ManageSearchEngines.php'); |
|
| 690 | 690 | $user_info['possibly_robot'] = SpiderCheck(); |
| 691 | 691 | } |
| 692 | 692 | elseif (!empty($modSettings['spider_mode'])) |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | $_REQUEST['msg'] = (int) $_REQUEST['msg']; |
| 808 | 808 | |
| 809 | 809 | // Looking through the message table can be slow, so try using the cache first. |
| 810 | - if (($topic = cache_get_data('msg_topic-' . $_REQUEST['msg'], 120)) === null) |
|
| 810 | + if (($topic = cache_get_data('msg_topic-'.$_REQUEST['msg'], 120)) === null) |
|
| 811 | 811 | { |
| 812 | 812 | $request = $smcFunc['db_query']('', ' |
| 813 | 813 | SELECT id_topic |
@@ -825,13 +825,13 @@ discard block |
||
| 825 | 825 | list ($topic) = $smcFunc['db_fetch_row']($request); |
| 826 | 826 | $smcFunc['db_free_result']($request); |
| 827 | 827 | // Save save save. |
| 828 | - cache_put_data('msg_topic-' . $_REQUEST['msg'], $topic, 120); |
|
| 828 | + cache_put_data('msg_topic-'.$_REQUEST['msg'], $topic, 120); |
|
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | // Remember redirection is the key to avoiding fallout from your bosses. |
| 833 | 833 | if (!empty($topic)) |
| 834 | - redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg']); |
|
| 834 | + redirectexit('topic='.$topic.'.msg'.$_REQUEST['msg'].'#msg'.$_REQUEST['msg']); |
|
| 835 | 835 | else |
| 836 | 836 | { |
| 837 | 837 | loadPermissions(); |
@@ -851,9 +851,9 @@ discard block |
||
| 851 | 851 | { |
| 852 | 852 | // @todo SLOW? |
| 853 | 853 | if (!empty($topic)) |
| 854 | - $temp = cache_get_data('topic_board-' . $topic, 120); |
|
| 854 | + $temp = cache_get_data('topic_board-'.$topic, 120); |
|
| 855 | 855 | else |
| 856 | - $temp = cache_get_data('board-' . $board, 120); |
|
| 856 | + $temp = cache_get_data('board-'.$board, 120); |
|
| 857 | 857 | |
| 858 | 858 | if (!empty($temp)) |
| 859 | 859 | { |
@@ -869,11 +869,11 @@ discard block |
||
| 869 | 869 | c.id_cat, b.name AS bname, b.description, b.num_topics, b.member_groups, b.deny_member_groups, |
| 870 | 870 | b.id_parent, c.name AS cname, COALESCE(mg.id_group, 0) AS id_moderator_group, mg.group_name, |
| 871 | 871 | COALESCE(mem.id_member, 0) AS id_moderator, |
| 872 | - mem.real_name' . (!empty($topic) ? ', b.id_board' : '') . ', b.child_level, |
|
| 872 | + mem.real_name' . (!empty($topic) ? ', b.id_board' : '').', b.child_level, |
|
| 873 | 873 | b.id_theme, b.override_theme, b.count_posts, b.id_profile, b.redirect, |
| 874 | - b.unapproved_topics, b.unapproved_posts' . (!empty($topic) ? ', t.approved, t.id_member_started' : '') . ' |
|
| 874 | + b.unapproved_topics, b.unapproved_posts' . (!empty($topic) ? ', t.approved, t.id_member_started' : '').' |
|
| 875 | 875 | FROM {db_prefix}boards AS b' . (!empty($topic) ? ' |
| 876 | - INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})' : '') . ' |
|
| 876 | + INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})' : '').' |
|
| 877 | 877 | LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat) |
| 878 | 878 | LEFT JOIN {db_prefix}moderator_groups AS modgs ON (modgs.id_board = {raw:board_link}) |
| 879 | 879 | LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = modgs.id_group) |
@@ -932,16 +932,16 @@ discard block |
||
| 932 | 932 | $board_info['moderators'][$row['id_moderator']] = array( |
| 933 | 933 | 'id' => $row['id_moderator'], |
| 934 | 934 | 'name' => $row['real_name'], |
| 935 | - 'href' => $scripturl . '?action=profile;u=' . $row['id_moderator'], |
|
| 936 | - 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_moderator'] . '">' . $row['real_name'] . '</a>' |
|
| 935 | + 'href' => $scripturl.'?action=profile;u='.$row['id_moderator'], |
|
| 936 | + 'link' => '<a href="'.$scripturl.'?action=profile;u='.$row['id_moderator'].'">'.$row['real_name'].'</a>' |
|
| 937 | 937 | ); |
| 938 | 938 | |
| 939 | 939 | if (!empty($row['id_moderator_group'])) |
| 940 | 940 | $board_info['moderator_groups'][$row['id_moderator_group']] = array( |
| 941 | 941 | 'id' => $row['id_moderator_group'], |
| 942 | 942 | 'name' => $row['group_name'], |
| 943 | - 'href' => $scripturl . '?action=groups;sa=members;group=' . $row['id_moderator_group'], |
|
| 944 | - 'link' => '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_moderator_group'] . '">' . $row['group_name'] . '</a>' |
|
| 943 | + 'href' => $scripturl.'?action=groups;sa=members;group='.$row['id_moderator_group'], |
|
| 944 | + 'link' => '<a href="'.$scripturl.'?action=groups;sa=members;group='.$row['id_moderator_group'].'">'.$row['group_name'].'</a>' |
|
| 945 | 945 | ); |
| 946 | 946 | } |
| 947 | 947 | while ($row = $smcFunc['db_fetch_assoc']($request)); |
@@ -975,8 +975,8 @@ discard block |
||
| 975 | 975 | { |
| 976 | 976 | // @todo SLOW? |
| 977 | 977 | if (!empty($topic)) |
| 978 | - cache_put_data('topic_board-' . $topic, $board_info, 120); |
|
| 979 | - cache_put_data('board-' . $board, $board_info, 120); |
|
| 978 | + cache_put_data('topic_board-'.$topic, $board_info, 120); |
|
| 979 | + cache_put_data('board-'.$board, $board_info, 120); |
|
| 980 | 980 | } |
| 981 | 981 | } |
| 982 | 982 | else |
@@ -1013,12 +1013,12 @@ discard block |
||
| 1013 | 1013 | $context['linktree'] = array_merge( |
| 1014 | 1014 | $context['linktree'], |
| 1015 | 1015 | array(array( |
| 1016 | - 'url' => $scripturl . '#c' . $board_info['cat']['id'], |
|
| 1016 | + 'url' => $scripturl.'#c'.$board_info['cat']['id'], |
|
| 1017 | 1017 | 'name' => $board_info['cat']['name'] |
| 1018 | 1018 | )), |
| 1019 | 1019 | array_reverse($board_info['parent_boards']), |
| 1020 | 1020 | array(array( |
| 1021 | - 'url' => $scripturl . '?board=' . $board . '.0', |
|
| 1021 | + 'url' => $scripturl.'?board='.$board.'.0', |
|
| 1022 | 1022 | 'name' => $board_info['name'] |
| 1023 | 1023 | )) |
| 1024 | 1024 | ); |
@@ -1098,14 +1098,14 @@ discard block |
||
| 1098 | 1098 | if ($user_info['possibly_robot']) |
| 1099 | 1099 | $cache_groups .= '-spider'; |
| 1100 | 1100 | |
| 1101 | - if ($modSettings['cache_enable'] >= 2 && !empty($board) && ($temp = cache_get_data('permissions:' . $cache_groups . ':' . $board, 240)) != null && time() - 240 > $modSettings['settings_updated']) |
|
| 1101 | + if ($modSettings['cache_enable'] >= 2 && !empty($board) && ($temp = cache_get_data('permissions:'.$cache_groups.':'.$board, 240)) != null && time() - 240 > $modSettings['settings_updated']) |
|
| 1102 | 1102 | { |
| 1103 | 1103 | list ($user_info['permissions']) = $temp; |
| 1104 | 1104 | banPermissions(); |
| 1105 | 1105 | |
| 1106 | 1106 | return; |
| 1107 | 1107 | } |
| 1108 | - elseif (($temp = cache_get_data('permissions:' . $cache_groups, 240)) != null && time() - 240 > $modSettings['settings_updated']) |
|
| 1108 | + elseif (($temp = cache_get_data('permissions:'.$cache_groups, 240)) != null && time() - 240 > $modSettings['settings_updated']) |
|
| 1109 | 1109 | list ($user_info['permissions'], $removals) = $temp; |
| 1110 | 1110 | } |
| 1111 | 1111 | |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | $smcFunc['db_free_result']($request); |
| 1137 | 1137 | |
| 1138 | 1138 | if (isset($cache_groups)) |
| 1139 | - cache_put_data('permissions:' . $cache_groups, array($user_info['permissions'], $removals), 240); |
|
| 1139 | + cache_put_data('permissions:'.$cache_groups, array($user_info['permissions'], $removals), 240); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | // Get the board permissions. |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | SELECT permission, add_deny |
| 1151 | 1151 | FROM {db_prefix}board_permissions |
| 1152 | 1152 | WHERE (id_group IN ({array_int:member_groups}) |
| 1153 | - ' . $spider_restrict . ') |
|
| 1153 | + ' . $spider_restrict.') |
|
| 1154 | 1154 | AND id_profile = {int:id_profile}', |
| 1155 | 1155 | array( |
| 1156 | 1156 | 'member_groups' => $user_info['groups'], |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | $user_info['permissions'] = array_diff($user_info['permissions'], $removals); |
| 1174 | 1174 | |
| 1175 | 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); |
|
| 1176 | + cache_put_data('permissions:'.$cache_groups.':'.$board, array($user_info['permissions'], null), 240); |
|
| 1177 | 1177 | |
| 1178 | 1178 | // Banned? Watch, don't touch.. |
| 1179 | 1179 | banPermissions(); |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | { |
| 1184 | 1184 | if (!isset($_SESSION['mc']) || $_SESSION['mc']['time'] <= $modSettings['settings_updated']) |
| 1185 | 1185 | { |
| 1186 | - require_once($sourcedir . '/Subs-Auth.php'); |
|
| 1186 | + require_once($sourcedir.'/Subs-Auth.php'); |
|
| 1187 | 1187 | rebuildModCache(); |
| 1188 | 1188 | } |
| 1189 | 1189 | else |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | $users = array_values($users); |
| 1229 | 1229 | for ($i = 0, $n = count($users); $i < $n; $i++) |
| 1230 | 1230 | { |
| 1231 | - $data = cache_get_data('member_data-' . $set . '-' . $users[$i], 240); |
|
| 1231 | + $data = cache_get_data('member_data-'.$set.'-'.$users[$i], 240); |
|
| 1232 | 1232 | if ($data == null) |
| 1233 | 1233 | continue; |
| 1234 | 1234 | |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | mem.birthdate, mem.member_ip, mem.member_ip2, mem.posts, mem.last_login, mem.id_post_group, mem.lngfile, mem.id_group, mem.time_offset, mem.show_online, |
| 1247 | 1247 | mg.online_color AS member_group_color, COALESCE(mg.group_name, {string:blank_string}) AS member_group, |
| 1248 | 1248 | pg.online_color AS post_group_color, COALESCE(pg.group_name, {string:blank_string}) AS post_group, |
| 1249 | - mem.is_activated, mem.warning, ' . (!empty($modSettings['titlesEnable']) ? 'mem.usertitle, ' : '') . ' |
|
| 1249 | + mem.is_activated, mem.warning, ' . (!empty($modSettings['titlesEnable']) ? 'mem.usertitle, ' : '').' |
|
| 1250 | 1250 | CASE WHEN mem.id_group = 0 OR mg.icons = {string:blank_string} THEN pg.icons ELSE mg.icons END AS icons'; |
| 1251 | 1251 | $select_tables = ' |
| 1252 | 1252 | LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member) |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | $select_tables = ''; |
| 1273 | 1273 | break; |
| 1274 | 1274 | default: |
| 1275 | - trigger_error('loadMemberData(): Invalid member data set \'' . $set . '\'', E_USER_WARNING); |
|
| 1275 | + trigger_error('loadMemberData(): Invalid member data set \''.$set.'\'', E_USER_WARNING); |
|
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | // Allow mods to easily add to the selected member data |
@@ -1282,9 +1282,9 @@ discard block |
||
| 1282 | 1282 | { |
| 1283 | 1283 | // Load the member's data. |
| 1284 | 1284 | $request = $smcFunc['db_query']('', ' |
| 1285 | - SELECT' . $select_columns . ' |
|
| 1286 | - FROM {db_prefix}members AS mem' . $select_tables . ' |
|
| 1287 | - WHERE mem.' . ($is_name ? 'member_name' : 'id_member') . ' IN ({' . ($is_name ? 'array_string' : 'array_int') . ':users})', |
|
| 1285 | + SELECT' . $select_columns.' |
|
| 1286 | + FROM {db_prefix}members AS mem' . $select_tables.' |
|
| 1287 | + WHERE mem.' . ($is_name ? 'member_name' : 'id_member').' IN ({'.($is_name ? 'array_string' : 'array_int').':users})', |
|
| 1288 | 1288 | array( |
| 1289 | 1289 | 'blank_string' => '', |
| 1290 | 1290 | 'users' => $users, |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | if (!empty($new_loaded_ids) && !empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 3) |
| 1356 | 1356 | { |
| 1357 | 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); |
|
| 1358 | + cache_put_data('member_data-'.$set.'-'.$new_loaded_ids[$i], $user_profile[$new_loaded_ids[$i]], 240); |
|
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | // Are we loading any moderators? If so, fix their group data... |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | return false; |
| 1419 | 1419 | if (!isset($user_profile[$user])) |
| 1420 | 1420 | { |
| 1421 | - trigger_error('loadMemberContext(): member id ' . $user . ' not previously loaded by loadMemberData()', E_USER_WARNING); |
|
| 1421 | + trigger_error('loadMemberContext(): member id '.$user.' not previously loaded by loadMemberData()', E_USER_WARNING); |
|
| 1422 | 1422 | return false; |
| 1423 | 1423 | } |
| 1424 | 1424 | |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | |
| 1433 | 1433 | // Set things up to be used before hand. |
| 1434 | 1434 | $profile['signature'] = str_replace(array("\n", "\r"), array('<br>', ''), $profile['signature']); |
| 1435 | - $profile['signature'] = parse_bbc($profile['signature'], true, 'sig' . $profile['id_member']); |
|
| 1435 | + $profile['signature'] = parse_bbc($profile['signature'], true, 'sig'.$profile['id_member']); |
|
| 1436 | 1436 | |
| 1437 | 1437 | $profile['is_online'] = (!empty($profile['show_online']) || allowedTo('moderate_forum')) && $profile['is_online'] > 0; |
| 1438 | 1438 | $profile['icons'] = empty($profile['icons']) ? array('', '') : explode('#', $profile['icons']); |
@@ -1441,10 +1441,10 @@ discard block |
||
| 1441 | 1441 | $buddy_list = !empty($profile['buddy_list']) ? explode(',', $profile['buddy_list']) : array(); |
| 1442 | 1442 | |
| 1443 | 1443 | //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 |
|
| 1445 | - $group_icon_url = $settings['images_url'] . '/membericons/' . $profile['icons'][1]; |
|
| 1444 | + if (isset($profile['icons'][1]) && file_exists($settings['actual_theme_dir'].'/images/membericons/'.$profile['icons'][1])) //icon is set and exists |
|
| 1445 | + $group_icon_url = $settings['images_url'].'/membericons/'.$profile['icons'][1]; |
|
| 1446 | 1446 | elseif (isset($profile['icons'][1])) //icon is set and doesn't exist, fallback to default |
| 1447 | - $group_icon_url = $settings['default_images_url'] . '/membericons/' . $profile['icons'][1]; |
|
| 1447 | + $group_icon_url = $settings['default_images_url'].'/membericons/'.$profile['icons'][1]; |
|
| 1448 | 1448 | else //not set, bye bye |
| 1449 | 1449 | $group_icon_url = ''; |
| 1450 | 1450 | |
@@ -1453,8 +1453,8 @@ discard block |
||
| 1453 | 1453 | 'username' => $profile['member_name'], |
| 1454 | 1454 | 'name' => $profile['real_name'], |
| 1455 | 1455 | 'id' => $profile['id_member'], |
| 1456 | - 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], |
|
| 1457 | - 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" ' . (!empty($modSettings['onlineEnable']) ? 'class="pm_icon"' : '') . '>' . $profile['real_name'] . '</a>', |
|
| 1456 | + 'href' => $scripturl.'?action=profile;u='.$profile['id_member'], |
|
| 1457 | + 'link' => '<a href="'.$scripturl.'?action=profile;u='.$profile['id_member'].'" title="'.$txt['profile_of'].' '.$profile['real_name'].'" '.(!empty($modSettings['onlineEnable']) ? 'class="pm_icon"' : '').'>'.$profile['real_name'].'</a>', |
|
| 1458 | 1458 | 'email' => $profile['email_address'], |
| 1459 | 1459 | 'show_email' => !$user_info['is_guest'] && ($user_info['id'] == $profile['id_member'] || allowedTo('moderate_forum')), |
| 1460 | 1460 | 'registered' => empty($profile['date_registered']) ? $txt['not_applicable'] : timeformat($profile['date_registered']), |
@@ -1469,9 +1469,9 @@ discard block |
||
| 1469 | 1469 | $loadedLanguages = getLanguages(); |
| 1470 | 1470 | |
| 1471 | 1471 | $memberContext[$user] += array( |
| 1472 | - 'username_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['member_name'] . '</span>', |
|
| 1473 | - 'name_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['real_name'] . '</span>', |
|
| 1474 | - 'link_color' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['real_name'] . '</a>', |
|
| 1472 | + 'username_color' => '<span '.(!empty($profile['member_group_color']) ? 'style="color:'.$profile['member_group_color'].';"' : '').'>'.$profile['member_name'].'</span>', |
|
| 1473 | + 'name_color' => '<span '.(!empty($profile['member_group_color']) ? 'style="color:'.$profile['member_group_color'].';"' : '').'>'.$profile['real_name'].'</span>', |
|
| 1474 | + 'link_color' => '<a href="'.$scripturl.'?action=profile;u='.$profile['id_member'].'" title="'.$txt['profile_of'].' '.$profile['real_name'].'" '.(!empty($profile['member_group_color']) ? 'style="color:'.$profile['member_group_color'].';"' : '').'>'.$profile['real_name'].'</a>', |
|
| 1475 | 1475 | 'is_buddy' => $profile['buddy'], |
| 1476 | 1476 | 'is_reverse_buddy' => in_array($user_info['id'], $buddy_list), |
| 1477 | 1477 | 'buddies' => $buddy_list, |
@@ -1481,7 +1481,7 @@ discard block |
||
| 1481 | 1481 | 'title' => $profile['website_title'], |
| 1482 | 1482 | 'url' => $profile['website_url'], |
| 1483 | 1483 | ), |
| 1484 | - 'birth_date' => empty($profile['birthdate']) ? '1004-01-01' : (substr($profile['birthdate'], 0, 4) === '0004' ? '1004' . substr($profile['birthdate'], 4) : $profile['birthdate']), |
|
| 1484 | + 'birth_date' => empty($profile['birthdate']) ? '1004-01-01' : (substr($profile['birthdate'], 0, 4) === '0004' ? '1004'.substr($profile['birthdate'], 4) : $profile['birthdate']), |
|
| 1485 | 1485 | 'signature' => $profile['signature'], |
| 1486 | 1486 | 'real_posts' => $profile['posts'], |
| 1487 | 1487 | 'posts' => $profile['posts'] > 500000 ? $txt['geek'] : comma_format($profile['posts']), |
@@ -1493,8 +1493,8 @@ discard block |
||
| 1493 | 1493 | 'is_online' => $profile['is_online'], |
| 1494 | 1494 | 'text' => $smcFunc['htmlspecialchars']($txt[$profile['is_online'] ? 'online' : 'offline']), |
| 1495 | 1495 | 'member_online_text' => sprintf($txt[$profile['is_online'] ? 'member_is_online' : 'member_is_offline'], $smcFunc['htmlspecialchars']($profile['real_name'])), |
| 1496 | - 'href' => $scripturl . '?action=pm;sa=send;u=' . $profile['id_member'], |
|
| 1497 | - 'link' => '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $profile['id_member'] . '">' . $txt[$profile['is_online'] ? 'online' : 'offline'] . '</a>', |
|
| 1496 | + 'href' => $scripturl.'?action=pm;sa=send;u='.$profile['id_member'], |
|
| 1497 | + 'link' => '<a href="'.$scripturl.'?action=pm;sa=send;u='.$profile['id_member'].'">'.$txt[$profile['is_online'] ? 'online' : 'offline'].'</a>', |
|
| 1498 | 1498 | 'label' => $txt[$profile['is_online'] ? 'online' : 'offline'] |
| 1499 | 1499 | ), |
| 1500 | 1500 | 'language' => !empty($loadedLanguages[$profile['lngfile']]) && !empty($loadedLanguages[$profile['lngfile']]['name']) ? $loadedLanguages[$profile['lngfile']]['name'] : $smcFunc['ucwords'](strtr($profile['lngfile'], array('_' => ' ', '-utf8' => ''))), |
@@ -1508,7 +1508,7 @@ discard block |
||
| 1508 | 1508 | 'group_id' => $profile['id_group'], |
| 1509 | 1509 | 'post_group' => $profile['post_group'], |
| 1510 | 1510 | 'post_group_color' => $profile['post_group_color'], |
| 1511 | - 'group_icons' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['icons'][1]) ? $group_icon_url : '') . '" alt="*">', empty($profile['icons'][0]) || empty($profile['icons'][1]) ? 0 : $profile['icons'][0]), |
|
| 1511 | + 'group_icons' => str_repeat('<img src="'.str_replace('$language', $context['user']['language'], isset($profile['icons'][1]) ? $group_icon_url : '').'" alt="*">', empty($profile['icons'][0]) || empty($profile['icons'][1]) ? 0 : $profile['icons'][0]), |
|
| 1512 | 1512 | 'warning' => $profile['warning'], |
| 1513 | 1513 | 'warning_status' => !empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $profile['warning'] ? 'mute' : (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $profile['warning'] ? 'moderate' : (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $profile['warning'] ? 'watch' : (''))), |
| 1514 | 1514 | 'local_time' => timeformat(time() + ($profile['time_offset'] - $user_info['time_offset']) * 3600, false), |
@@ -1531,18 +1531,18 @@ discard block |
||
| 1531 | 1531 | // So it's stored in the member table? |
| 1532 | 1532 | if (!empty($profile['avatar'])) |
| 1533 | 1533 | { |
| 1534 | - $image = (stristr($profile['avatar'], 'http://') || stristr($profile['avatar'], 'https://')) ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']; |
|
| 1534 | + $image = (stristr($profile['avatar'], 'http://') || stristr($profile['avatar'], 'https://')) ? $profile['avatar'] : $modSettings['avatar_url'].'/'.$profile['avatar']; |
|
| 1535 | 1535 | } |
| 1536 | 1536 | elseif (!empty($profile['filename'])) |
| 1537 | - $image = $modSettings['custom_avatar_url'] . '/' . $profile['filename']; |
|
| 1537 | + $image = $modSettings['custom_avatar_url'].'/'.$profile['filename']; |
|
| 1538 | 1538 | // Right... no avatar...use the default one |
| 1539 | 1539 | else |
| 1540 | - $image = $modSettings['avatar_url'] . '/default.png'; |
|
| 1540 | + $image = $modSettings['avatar_url'].'/default.png'; |
|
| 1541 | 1541 | } |
| 1542 | 1542 | if (!empty($image)) |
| 1543 | 1543 | $memberContext[$user]['avatar'] = array( |
| 1544 | 1544 | 'name' => $profile['avatar'], |
| 1545 | - 'image' => '<img class="avatar" src="' . $image . '" alt="avatar_' . $profile['member_name'] . '">', |
|
| 1545 | + 'image' => '<img class="avatar" src="'.$image.'" alt="avatar_'.$profile['member_name'].'">', |
|
| 1546 | 1546 | 'href' => $image, |
| 1547 | 1547 | 'url' => $image, |
| 1548 | 1548 | ); |
@@ -1717,7 +1717,7 @@ discard block |
||
| 1717 | 1717 | if (empty($context['browser'])) |
| 1718 | 1718 | detectBrowser(); |
| 1719 | 1719 | |
| 1720 | - return !empty($context['browser'][$browser]) || !empty($context['browser']['is_' . $browser]) ? true : false; |
|
| 1720 | + return !empty($context['browser'][$browser]) || !empty($context['browser']['is_'.$browser]) ? true : false; |
|
| 1721 | 1721 | } |
| 1722 | 1722 | |
| 1723 | 1723 | /** |
@@ -1774,7 +1774,7 @@ discard block |
||
| 1774 | 1774 | call_integration_hook('integrate_pre_load_theme', array(&$id_theme)); |
| 1775 | 1775 | |
| 1776 | 1776 | // We already load the basic stuff? |
| 1777 | - if (empty($settings['theme_id']) || $settings['theme_id'] != $id_theme ) |
|
| 1777 | + if (empty($settings['theme_id']) || $settings['theme_id'] != $id_theme) |
|
| 1778 | 1778 | { |
| 1779 | 1779 | $member = empty($user_info['id']) ? -1 : $user_info['id']; |
| 1780 | 1780 | |
@@ -1782,12 +1782,12 @@ discard block |
||
| 1782 | 1782 | if (empty($modSettings['force_ssl'])) |
| 1783 | 1783 | $image_proxy_enabled = false; |
| 1784 | 1784 | |
| 1785 | - 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']) |
|
| 1785 | + 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 | 1786 | { |
| 1787 | 1787 | $themeData = $temp; |
| 1788 | 1788 | $flag = true; |
| 1789 | 1789 | } |
| 1790 | - elseif (($temp = cache_get_data('theme_settings-' . $id_theme, 90)) != null && time() - 60 > $modSettings['settings_updated']) |
|
| 1790 | + elseif (($temp = cache_get_data('theme_settings-'.$id_theme, 90)) != null && time() - 60 > $modSettings['settings_updated']) |
|
| 1791 | 1791 | $themeData = $temp + array($member => array()); |
| 1792 | 1792 | else |
| 1793 | 1793 | $themeData = array(-1 => array(), 0 => array(), $member => array()); |
@@ -1798,8 +1798,8 @@ discard block |
||
| 1798 | 1798 | $result = $smcFunc['db_query']('', ' |
| 1799 | 1799 | SELECT variable, value, id_member, id_theme |
| 1800 | 1800 | FROM {db_prefix}themes |
| 1801 | - WHERE id_member' . (empty($themeData[0]) ? ' IN (-1, 0, {int:id_member})' : ' = {int:id_member}') . ' |
|
| 1802 | - AND id_theme' . ($id_theme == 1 ? ' = {int:id_theme}' : ' IN ({int:id_theme}, 1)') .' |
|
| 1801 | + WHERE id_member' . (empty($themeData[0]) ? ' IN (-1, 0, {int:id_member})' : ' = {int:id_member}').' |
|
| 1802 | + AND id_theme' . ($id_theme == 1 ? ' = {int:id_theme}' : ' IN ({int:id_theme}, 1)').' |
|
| 1803 | 1803 | ORDER BY id_theme asc', |
| 1804 | 1804 | array( |
| 1805 | 1805 | 'id_theme' => $id_theme, |
@@ -1815,7 +1815,7 @@ discard block |
||
| 1815 | 1815 | |
| 1816 | 1816 | // If this is the theme_dir of the default theme, store it. |
| 1817 | 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']; |
|
| 1818 | + $themeData[0]['default_'.$row['variable']] = $row['value']; |
|
| 1819 | 1819 | |
| 1820 | 1820 | // If this isn't set yet, is a theme option, or is not the default theme.. |
| 1821 | 1821 | if (!isset($themeData[$row['id_member']][$row['variable']]) || $row['id_theme'] != '1') |
@@ -1831,10 +1831,10 @@ discard block |
||
| 1831 | 1831 | } |
| 1832 | 1832 | |
| 1833 | 1833 | if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) |
| 1834 | - cache_put_data('theme_settings-' . $id_theme . ':' . $member, $themeData, 60); |
|
| 1834 | + cache_put_data('theme_settings-'.$id_theme.':'.$member, $themeData, 60); |
|
| 1835 | 1835 | // Only if we didn't already load that part of the cache... |
| 1836 | 1836 | elseif (!isset($temp)) |
| 1837 | - cache_put_data('theme_settings-' . $id_theme, array(-1 => $themeData[-1], 0 => $themeData[0]), 90); |
|
| 1837 | + cache_put_data('theme_settings-'.$id_theme, array(-1 => $themeData[-1], 0 => $themeData[0]), 90); |
|
| 1838 | 1838 | } |
| 1839 | 1839 | |
| 1840 | 1840 | $settings = $themeData[0]; |
@@ -1873,15 +1873,15 @@ discard block |
||
| 1873 | 1873 | fatal_lang_error($txt['login_ssl_required']); |
| 1874 | 1874 | } |
| 1875 | 1875 | |
| 1876 | - redirectexit(strtr($_SERVER['REQUEST_URL'], array('http://' => 'https://')) . (strpos($_SERVER['REQUEST_URL'], '?') > 0 ? ';' : '?') . 'sslRedirect'); |
|
| 1876 | + redirectexit(strtr($_SERVER['REQUEST_URL'], array('http://' => 'https://')).(strpos($_SERVER['REQUEST_URL'], '?') > 0 ? ';' : '?').'sslRedirect'); |
|
| 1877 | 1877 | } |
| 1878 | 1878 | |
| 1879 | 1879 | // Check to see if they're accessing it from the wrong place. |
| 1880 | 1880 | if (isset($_SERVER['HTTP_HOST']) || isset($_SERVER['SERVER_NAME'])) |
| 1881 | 1881 | { |
| 1882 | 1882 | $detected_url = httpsOn() ? 'https://' : 'http://'; |
| 1883 | - $detected_url .= empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] . (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']) : $_SERVER['HTTP_HOST']; |
|
| 1884 | - $temp = preg_replace('~/' . basename($scripturl) . '(/.+)?$~', '', strtr(dirname($_SERVER['PHP_SELF']), '\\', '/')); |
|
| 1883 | + $detected_url .= empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'].(empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':'.$_SERVER['SERVER_PORT']) : $_SERVER['HTTP_HOST']; |
|
| 1884 | + $temp = preg_replace('~/'.basename($scripturl).'(/.+)?$~', '', strtr(dirname($_SERVER['PHP_SELF']), '\\', '/')); |
|
| 1885 | 1885 | if ($temp != '/') |
| 1886 | 1886 | $detected_url .= $temp; |
| 1887 | 1887 | } |
@@ -1912,7 +1912,7 @@ discard block |
||
| 1912 | 1912 | $v = current($_GET); |
| 1913 | 1913 | |
| 1914 | 1914 | if ($k != 'wwwRedirect') |
| 1915 | - redirectexit('wwwRedirect;' . $k . '=' . $v); |
|
| 1915 | + redirectexit('wwwRedirect;'.$k.'='.$v); |
|
| 1916 | 1916 | } |
| 1917 | 1917 | } |
| 1918 | 1918 | |
@@ -1950,7 +1950,7 @@ discard block |
||
| 1950 | 1950 | foreach ($board_info['moderators'] as $k => $dummy) |
| 1951 | 1951 | { |
| 1952 | 1952 | $board_info['moderators'][$k]['href'] = strtr($dummy['href'], array($oldurl => $boardurl)); |
| 1953 | - $board_info['moderators'][$k]['link'] = strtr($dummy['link'], array('"' . $oldurl => '"' . $boardurl)); |
|
| 1953 | + $board_info['moderators'][$k]['link'] = strtr($dummy['link'], array('"'.$oldurl => '"'.$boardurl)); |
|
| 1954 | 1954 | } |
| 1955 | 1955 | } |
| 1956 | 1956 | foreach ($context['linktree'] as $k => $dummy) |
@@ -2038,7 +2038,7 @@ discard block |
||
| 2038 | 2038 | if (!isset($context['javascript_vars'])) |
| 2039 | 2039 | $context['javascript_vars'] = array(); |
| 2040 | 2040 | |
| 2041 | - $context['login_url'] = $scripturl . '?action=login2'; |
|
| 2041 | + $context['login_url'] = $scripturl.'?action=login2'; |
|
| 2042 | 2042 | $context['menu_separator'] = !empty($settings['use_image_buttons']) ? ' ' : ' | '; |
| 2043 | 2043 | $context['session_var'] = $_SESSION['session_var']; |
| 2044 | 2044 | $context['session_id'] = $_SESSION['session_value']; |
@@ -2176,7 +2176,7 @@ discard block |
||
| 2176 | 2176 | loadLanguage('ThemeStrings', '', false); |
| 2177 | 2177 | |
| 2178 | 2178 | // Make a special URL for the language. |
| 2179 | - $settings['lang_images_url'] = $settings['images_url'] . '/' . (!empty($txt['image_lang']) ? $txt['image_lang'] : $user_info['language']); |
|
| 2179 | + $settings['lang_images_url'] = $settings['images_url'].'/'.(!empty($txt['image_lang']) ? $txt['image_lang'] : $user_info['language']); |
|
| 2180 | 2180 | |
| 2181 | 2181 | // And of course, let's load the default CSS file. |
| 2182 | 2182 | loadCSSFile('index.css', array('minimize' => true, 'order_pos' => 1), 'smf_index'); |
@@ -2203,14 +2203,14 @@ discard block |
||
| 2203 | 2203 | $context['theme_variant'] = !empty($settings['default_variant']) && in_array($settings['default_variant'], $settings['theme_variants']) ? $settings['default_variant'] : $settings['theme_variants'][0]; |
| 2204 | 2204 | |
| 2205 | 2205 | // Do this to keep things easier in the templates. |
| 2206 | - $context['theme_variant'] = '_' . $context['theme_variant']; |
|
| 2207 | - $context['theme_variant_url'] = $context['theme_variant'] . '/'; |
|
| 2206 | + $context['theme_variant'] = '_'.$context['theme_variant']; |
|
| 2207 | + $context['theme_variant_url'] = $context['theme_variant'].'/'; |
|
| 2208 | 2208 | |
| 2209 | 2209 | if (!empty($context['theme_variant'])) |
| 2210 | 2210 | { |
| 2211 | - loadCSSFile('index' . $context['theme_variant'] . '.css', array('order_pos' => 300), 'smf_index' . $context['theme_variant']); |
|
| 2211 | + loadCSSFile('index'.$context['theme_variant'].'.css', array('order_pos' => 300), 'smf_index'.$context['theme_variant']); |
|
| 2212 | 2212 | if ($context['right_to_left']) |
| 2213 | - loadCSSFile('rtl' . $context['theme_variant'] . '.css', array('order_pos' => 400), 'smf_rtl' . $context['theme_variant']); |
|
| 2213 | + loadCSSFile('rtl'.$context['theme_variant'].'.css', array('order_pos' => 400), 'smf_rtl'.$context['theme_variant']); |
|
| 2214 | 2214 | } |
| 2215 | 2215 | } |
| 2216 | 2216 | |
@@ -2226,18 +2226,18 @@ discard block |
||
| 2226 | 2226 | |
| 2227 | 2227 | // Default JS variables for use in every theme |
| 2228 | 2228 | $context['javascript_vars'] = array( |
| 2229 | - 'smf_theme_url' => '"' . $settings['theme_url'] . '"', |
|
| 2230 | - 'smf_default_theme_url' => '"' . $settings['default_theme_url'] . '"', |
|
| 2231 | - 'smf_images_url' => '"' . $settings['images_url'] . '"', |
|
| 2232 | - 'smf_smileys_url' => '"' . $modSettings['smileys_url'] . '"', |
|
| 2233 | - 'smf_smiley_sets_default' => '"' . $modSettings['smiley_sets_default'] . '"', |
|
| 2234 | - 'smf_smiley_sets_exts' => '"' . $modSettings['smiley_sets_exts'] . '"', |
|
| 2235 | - 'smf_smiley_sets_default_ext' => '"' . $context['user']['smiley_set_default_ext'] . '"', |
|
| 2236 | - 'smf_scripturl' => '"' . $scripturl . '"', |
|
| 2229 | + 'smf_theme_url' => '"'.$settings['theme_url'].'"', |
|
| 2230 | + 'smf_default_theme_url' => '"'.$settings['default_theme_url'].'"', |
|
| 2231 | + 'smf_images_url' => '"'.$settings['images_url'].'"', |
|
| 2232 | + 'smf_smileys_url' => '"'.$modSettings['smileys_url'].'"', |
|
| 2233 | + 'smf_smiley_sets_default' => '"'.$modSettings['smiley_sets_default'].'"', |
|
| 2234 | + 'smf_smiley_sets_exts' => '"'.$modSettings['smiley_sets_exts'].'"', |
|
| 2235 | + 'smf_smiley_sets_default_ext' => '"'.$context['user']['smiley_set_default_ext'].'"', |
|
| 2236 | + 'smf_scripturl' => '"'.$scripturl.'"', |
|
| 2237 | 2237 | 'smf_iso_case_folding' => $context['server']['iso_case_folding'] ? 'true' : 'false', |
| 2238 | - 'smf_charset' => '"' . $context['character_set'] . '"', |
|
| 2239 | - 'smf_session_id' => '"' . $context['session_id'] . '"', |
|
| 2240 | - 'smf_session_var' => '"' . $context['session_var'] . '"', |
|
| 2238 | + 'smf_charset' => '"'.$context['character_set'].'"', |
|
| 2239 | + 'smf_session_id' => '"'.$context['session_id'].'"', |
|
| 2240 | + 'smf_session_var' => '"'.$context['session_var'].'"', |
|
| 2241 | 2241 | 'smf_member_id' => $context['user']['id'], |
| 2242 | 2242 | 'ajax_notification_text' => JavaScriptEscape($txt['ajax_in_progress']), |
| 2243 | 2243 | 'help_popup_heading_text' => JavaScriptEscape($txt['help_popup']), |
@@ -2276,7 +2276,7 @@ discard block |
||
| 2276 | 2276 | if (isBrowser('possibly_robot')) |
| 2277 | 2277 | { |
| 2278 | 2278 | // @todo Maybe move this somewhere better?! |
| 2279 | - require_once($sourcedir . '/ScheduledTasks.php'); |
|
| 2279 | + require_once($sourcedir.'/ScheduledTasks.php'); |
|
| 2280 | 2280 | |
| 2281 | 2281 | // What to do, what to do?! |
| 2282 | 2282 | if (empty($modSettings['next_task_time']) || $modSettings['next_task_time'] < time()) |
@@ -2292,7 +2292,7 @@ discard block |
||
| 2292 | 2292 | addInlineJavaScript(' |
| 2293 | 2293 | function smfAutoTask() |
| 2294 | 2294 | { |
| 2295 | - $.get(smf_scripturl + "?scheduled=' . $type . ';ts=' . $ts . '"); |
|
| 2295 | + $.get(smf_scripturl + "?scheduled=' . $type.';ts='.$ts.'"); |
|
| 2296 | 2296 | } |
| 2297 | 2297 | window.setTimeout("smfAutoTask();", 1);'); |
| 2298 | 2298 | } |
@@ -2306,7 +2306,7 @@ discard block |
||
| 2306 | 2306 | addInlineJavaScript(' |
| 2307 | 2307 | function triggerCron() |
| 2308 | 2308 | { |
| 2309 | - $.get(' . JavaScriptEscape($boardurl) . ' + "/cron.php?ts=' . $ts . '"); |
|
| 2309 | + $.get(' . JavaScriptEscape($boardurl).' + "/cron.php?ts='.$ts.'"); |
|
| 2310 | 2310 | } |
| 2311 | 2311 | window.setTimeout(triggerCron, 1);', true); |
| 2312 | 2312 | } |
@@ -2370,7 +2370,7 @@ discard block |
||
| 2370 | 2370 | $style_sheets = array($style_sheets); |
| 2371 | 2371 | |
| 2372 | 2372 | foreach ($style_sheets as $sheet) |
| 2373 | - loadCSSFile($sheet . '.css', array(), $sheet); |
|
| 2373 | + loadCSSFile($sheet.'.css', array(), $sheet); |
|
| 2374 | 2374 | } |
| 2375 | 2375 | |
| 2376 | 2376 | // No template to load? |
@@ -2380,10 +2380,10 @@ discard block |
||
| 2380 | 2380 | $loaded = false; |
| 2381 | 2381 | foreach ($settings['template_dirs'] as $template_dir) |
| 2382 | 2382 | { |
| 2383 | - if (file_exists($template_dir . '/' . $template_name . '.template.php')) |
|
| 2383 | + if (file_exists($template_dir.'/'.$template_name.'.template.php')) |
|
| 2384 | 2384 | { |
| 2385 | 2385 | $loaded = true; |
| 2386 | - template_include($template_dir . '/' . $template_name . '.template.php', true); |
|
| 2386 | + template_include($template_dir.'/'.$template_name.'.template.php', true); |
|
| 2387 | 2387 | break; |
| 2388 | 2388 | } |
| 2389 | 2389 | } |
@@ -2391,16 +2391,16 @@ discard block |
||
| 2391 | 2391 | if ($loaded) |
| 2392 | 2392 | { |
| 2393 | 2393 | if ($db_show_debug === true) |
| 2394 | - $context['debug']['templates'][] = $template_name . ' (' . basename($template_dir) . ')'; |
|
| 2394 | + $context['debug']['templates'][] = $template_name.' ('.basename($template_dir).')'; |
|
| 2395 | 2395 | |
| 2396 | 2396 | // 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'); |
|
| 2397 | + if (function_exists('template_'.$template_name.'_init')) |
|
| 2398 | + call_user_func('template_'.$template_name.'_init'); |
|
| 2399 | 2399 | } |
| 2400 | 2400 | // Hmmm... doesn't exist?! I don't suppose the directory is wrong, is it? |
| 2401 | - elseif (!file_exists($settings['default_theme_dir']) && file_exists($boarddir . '/Themes/default')) |
|
| 2401 | + elseif (!file_exists($settings['default_theme_dir']) && file_exists($boarddir.'/Themes/default')) |
|
| 2402 | 2402 | { |
| 2403 | - $settings['default_theme_dir'] = $boarddir . '/Themes/default'; |
|
| 2403 | + $settings['default_theme_dir'] = $boarddir.'/Themes/default'; |
|
| 2404 | 2404 | $settings['template_dirs'][] = $settings['default_theme_dir']; |
| 2405 | 2405 | |
| 2406 | 2406 | if (!empty($context['user']['is_admin']) && !isset($_GET['th'])) |
@@ -2408,7 +2408,7 @@ discard block |
||
| 2408 | 2408 | loadLanguage('Errors'); |
| 2409 | 2409 | echo ' |
| 2410 | 2410 | <div class="alert errorbox"> |
| 2411 | - <a href="', $scripturl . '?action=admin;area=theme;sa=list;' . $context['session_var'] . '=' . $context['session_id'], '" class="alert">', $txt['theme_dir_wrong'], '</a> |
|
| 2411 | + <a href="', $scripturl.'?action=admin;area=theme;sa=list;'.$context['session_var'].'='.$context['session_id'], '" class="alert">', $txt['theme_dir_wrong'], '</a> |
|
| 2412 | 2412 | </div>'; |
| 2413 | 2413 | } |
| 2414 | 2414 | |
@@ -2443,7 +2443,7 @@ discard block |
||
| 2443 | 2443 | $context['debug']['sub_templates'][] = $sub_template_name; |
| 2444 | 2444 | |
| 2445 | 2445 | // Figure out what the template function is named. |
| 2446 | - $theme_function = 'template_' . $sub_template_name; |
|
| 2446 | + $theme_function = 'template_'.$sub_template_name; |
|
| 2447 | 2447 | if (function_exists($theme_function)) |
| 2448 | 2448 | $theme_function(); |
| 2449 | 2449 | elseif ($fatal === false) |
@@ -2482,7 +2482,7 @@ discard block |
||
| 2482 | 2482 | if (empty($context['css_files_order'])) |
| 2483 | 2483 | $context['css_files_order'] = array(); |
| 2484 | 2484 | |
| 2485 | - $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']) : ''); |
|
| 2485 | + $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 | 2486 | $params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false; |
| 2487 | 2487 | $themeRef = !empty($params['default_theme']) ? 'default_theme' : 'theme'; |
| 2488 | 2488 | $params['minimize'] = isset($params['minimize']) ? $params['minimize'] : true; |
@@ -2502,13 +2502,13 @@ discard block |
||
| 2502 | 2502 | if (empty($params['external'])) |
| 2503 | 2503 | { |
| 2504 | 2504 | // Are we validating the the file exists? |
| 2505 | - if (!empty($params['validate']) && !file_exists($settings[$themeRef . '_dir'] . '/css/' . $fileName)) |
|
| 2505 | + if (!empty($params['validate']) && !file_exists($settings[$themeRef.'_dir'].'/css/'.$fileName)) |
|
| 2506 | 2506 | { |
| 2507 | 2507 | // Maybe the default theme has it? |
| 2508 | - if ($themeRef === 'theme' && !$params['force_current'] && file_exists($settings['default_theme_dir'] . '/css/' . $fileName)) |
|
| 2508 | + if ($themeRef === 'theme' && !$params['force_current'] && file_exists($settings['default_theme_dir'].'/css/'.$fileName)) |
|
| 2509 | 2509 | { |
| 2510 | - $fileUrl = $settings['default_theme_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
|
| 2511 | - $filePath = $settings['default_theme_dir'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
|
| 2510 | + $fileUrl = $settings['default_theme_url'].'/css/'.$fileName.($has_seed ? '' : $params['seed']); |
|
| 2511 | + $filePath = $settings['default_theme_dir'].'/css/'.$fileName.($has_seed ? '' : $params['seed']); |
|
| 2512 | 2512 | } |
| 2513 | 2513 | |
| 2514 | 2514 | else |
@@ -2520,8 +2520,8 @@ discard block |
||
| 2520 | 2520 | |
| 2521 | 2521 | else |
| 2522 | 2522 | { |
| 2523 | - $fileUrl = $settings[$themeRef . '_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
|
| 2524 | - $filePath = $settings[$themeRef . '_dir'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
|
| 2523 | + $fileUrl = $settings[$themeRef.'_url'].'/css/'.$fileName.($has_seed ? '' : $params['seed']); |
|
| 2524 | + $filePath = $settings[$themeRef.'_dir'].'/css/'.$fileName.($has_seed ? '' : $params['seed']); |
|
| 2525 | 2525 | } |
| 2526 | 2526 | } |
| 2527 | 2527 | |
@@ -2590,7 +2590,7 @@ discard block |
||
| 2590 | 2590 | { |
| 2591 | 2591 | global $settings, $context, $modSettings; |
| 2592 | 2592 | |
| 2593 | - $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']) : ''); |
|
| 2593 | + $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']) : ''); |
|
| 2594 | 2594 | $params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false; |
| 2595 | 2595 | $themeRef = !empty($params['default_theme']) ? 'default_theme' : 'theme'; |
| 2596 | 2596 | $params['async'] = isset($params['async']) ? $params['async'] : false; |
@@ -2610,13 +2610,13 @@ discard block |
||
| 2610 | 2610 | if (empty($params['external'])) |
| 2611 | 2611 | { |
| 2612 | 2612 | // Are we validating it exists on disk? |
| 2613 | - if (!empty($params['validate']) && !file_exists($settings[$themeRef . '_dir'] . '/scripts/' . $fileName)) |
|
| 2613 | + if (!empty($params['validate']) && !file_exists($settings[$themeRef.'_dir'].'/scripts/'.$fileName)) |
|
| 2614 | 2614 | { |
| 2615 | 2615 | // Can't find it in this theme, how about the default? |
| 2616 | - if ($themeRef === 'theme' && !$params['force_current'] && file_exists($settings['default_theme_dir'] . '/scripts/' . $fileName)) |
|
| 2616 | + if ($themeRef === 'theme' && !$params['force_current'] && file_exists($settings['default_theme_dir'].'/scripts/'.$fileName)) |
|
| 2617 | 2617 | { |
| 2618 | - $fileUrl = $settings['default_theme_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
|
| 2619 | - $filePath = $settings['default_theme_dir'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
|
| 2618 | + $fileUrl = $settings['default_theme_url'].'/scripts/'.$fileName.($has_seed ? '' : $params['seed']); |
|
| 2619 | + $filePath = $settings['default_theme_dir'].'/scripts/'.$fileName.($has_seed ? '' : $params['seed']); |
|
| 2620 | 2620 | } |
| 2621 | 2621 | |
| 2622 | 2622 | else |
@@ -2628,8 +2628,8 @@ discard block |
||
| 2628 | 2628 | |
| 2629 | 2629 | else |
| 2630 | 2630 | { |
| 2631 | - $fileUrl = $settings[$themeRef . '_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
|
| 2632 | - $filePath = $settings[$themeRef . '_dir'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
|
| 2631 | + $fileUrl = $settings[$themeRef.'_url'].'/scripts/'.$fileName.($has_seed ? '' : $params['seed']); |
|
| 2632 | + $filePath = $settings[$themeRef.'_dir'].'/scripts/'.$fileName.($has_seed ? '' : $params['seed']); |
|
| 2633 | 2633 | } |
| 2634 | 2634 | } |
| 2635 | 2635 | |
@@ -2711,7 +2711,7 @@ discard block |
||
| 2711 | 2711 | // Make sure we have $settings - if not we're in trouble and need to find it! |
| 2712 | 2712 | if (empty($settings['default_theme_dir'])) |
| 2713 | 2713 | { |
| 2714 | - require_once($sourcedir . '/ScheduledTasks.php'); |
|
| 2714 | + require_once($sourcedir.'/ScheduledTasks.php'); |
|
| 2715 | 2715 | loadEssentialThemeData(); |
| 2716 | 2716 | } |
| 2717 | 2717 | |
@@ -2751,17 +2751,17 @@ discard block |
||
| 2751 | 2751 | $found = false; |
| 2752 | 2752 | foreach ($attempts as $k => $file) |
| 2753 | 2753 | { |
| 2754 | - if (file_exists($file[0] . '/languages/' . $file[1] . '.' . $file[2] . '.php')) |
|
| 2754 | + if (file_exists($file[0].'/languages/'.$file[1].'.'.$file[2].'.php')) |
|
| 2755 | 2755 | { |
| 2756 | 2756 | // Include it! |
| 2757 | - template_include($file[0] . '/languages/' . $file[1] . '.' . $file[2] . '.php'); |
|
| 2757 | + template_include($file[0].'/languages/'.$file[1].'.'.$file[2].'.php'); |
|
| 2758 | 2758 | |
| 2759 | 2759 | // Note that we found it. |
| 2760 | 2760 | $found = true; |
| 2761 | 2761 | |
| 2762 | 2762 | // setlocale is required for basename() & pathinfo() to work properly on the selected language |
| 2763 | 2763 | if (!empty($txt['lang_locale']) && !empty($modSettings['global_character_set'])) |
| 2764 | - setlocale(LC_CTYPE, $txt['lang_locale'] . '.' . $modSettings['global_character_set']); |
|
| 2764 | + setlocale(LC_CTYPE, $txt['lang_locale'].'.'.$modSettings['global_character_set']); |
|
| 2765 | 2765 | |
| 2766 | 2766 | break; |
| 2767 | 2767 | } |
@@ -2770,7 +2770,7 @@ discard block |
||
| 2770 | 2770 | // That couldn't be found! Log the error, but *try* to continue normally. |
| 2771 | 2771 | if (!$found && $fatal) |
| 2772 | 2772 | { |
| 2773 | - log_error(sprintf($txt['theme_language_error'], $template_name . '.' . $lang, 'template')); |
|
| 2773 | + log_error(sprintf($txt['theme_language_error'], $template_name.'.'.$lang, 'template')); |
|
| 2774 | 2774 | break; |
| 2775 | 2775 | } |
| 2776 | 2776 | |
@@ -2779,8 +2779,8 @@ discard block |
||
| 2779 | 2779 | { |
| 2780 | 2780 | foreach ($txt['emails'] as $key => $value) |
| 2781 | 2781 | { |
| 2782 | - $txt[$key . '_subject'] = $value['subject']; |
|
| 2783 | - $txt[$key . '_body'] = $value['body']; |
|
| 2782 | + $txt[$key.'_subject'] = $value['subject']; |
|
| 2783 | + $txt[$key.'_body'] = $value['body']; |
|
| 2784 | 2784 | } |
| 2785 | 2785 | $txt['emails'] = array(); |
| 2786 | 2786 | } |
@@ -2792,9 +2792,9 @@ discard block |
||
| 2792 | 2792 | { |
| 2793 | 2793 | foreach ($birthdayEmails as $key => $value) |
| 2794 | 2794 | { |
| 2795 | - $txtBirthdayEmails[$key . '_subject'] = $value['subject']; |
|
| 2796 | - $txtBirthdayEmails[$key . '_body'] = $value['body']; |
|
| 2797 | - $txtBirthdayEmails[$key . '_author'] = $value['author']; |
|
| 2795 | + $txtBirthdayEmails[$key.'_subject'] = $value['subject']; |
|
| 2796 | + $txtBirthdayEmails[$key.'_body'] = $value['body']; |
|
| 2797 | + $txtBirthdayEmails[$key.'_author'] = $value['author']; |
|
| 2798 | 2798 | } |
| 2799 | 2799 | $birthdayEmails = array(); |
| 2800 | 2800 | } |
@@ -2802,7 +2802,7 @@ discard block |
||
| 2802 | 2802 | |
| 2803 | 2803 | // Keep track of what we're up to soldier. |
| 2804 | 2804 | if ($db_show_debug === true) |
| 2805 | - $context['debug']['language_files'][] = $template_name . '.' . $lang . ' (' . $theme_name . ')'; |
|
| 2805 | + $context['debug']['language_files'][] = $template_name.'.'.$lang.' ('.$theme_name.')'; |
|
| 2806 | 2806 | |
| 2807 | 2807 | // Remember what we have loaded, and in which language. |
| 2808 | 2808 | $already_loaded[$template_name] = $lang; |
@@ -2824,7 +2824,7 @@ discard block |
||
| 2824 | 2824 | global $scripturl, $smcFunc; |
| 2825 | 2825 | |
| 2826 | 2826 | // First check if we have this cached already. |
| 2827 | - if (($boards = cache_get_data('board_parents-' . $id_parent, 480)) === null) |
|
| 2827 | + if (($boards = cache_get_data('board_parents-'.$id_parent, 480)) === null) |
|
| 2828 | 2828 | { |
| 2829 | 2829 | $boards = array(); |
| 2830 | 2830 | $original_parent = $id_parent; |
@@ -2856,7 +2856,7 @@ discard block |
||
| 2856 | 2856 | { |
| 2857 | 2857 | $id_parent = $row['id_parent']; |
| 2858 | 2858 | $boards[$row['id_board']] = array( |
| 2859 | - 'url' => $scripturl . '?board=' . $row['id_board'] . '.0', |
|
| 2859 | + 'url' => $scripturl.'?board='.$row['id_board'].'.0', |
|
| 2860 | 2860 | 'name' => $row['name'], |
| 2861 | 2861 | 'level' => $row['child_level'], |
| 2862 | 2862 | 'groups' => explode(',', $row['member_groups']), |
@@ -2872,8 +2872,8 @@ discard block |
||
| 2872 | 2872 | $boards[$id]['moderators'][$row['id_moderator']] = array( |
| 2873 | 2873 | 'id' => $row['id_moderator'], |
| 2874 | 2874 | 'name' => $row['real_name'], |
| 2875 | - 'href' => $scripturl . '?action=profile;u=' . $row['id_moderator'], |
|
| 2876 | - 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_moderator'] . '">' . $row['real_name'] . '</a>' |
|
| 2875 | + 'href' => $scripturl.'?action=profile;u='.$row['id_moderator'], |
|
| 2876 | + 'link' => '<a href="'.$scripturl.'?action=profile;u='.$row['id_moderator'].'">'.$row['real_name'].'</a>' |
|
| 2877 | 2877 | ); |
| 2878 | 2878 | } |
| 2879 | 2879 | |
@@ -2884,15 +2884,15 @@ discard block |
||
| 2884 | 2884 | $boards[$id]['moderator_groups'][$row['id_moderator_group']] = array( |
| 2885 | 2885 | 'id' => $row['id_moderator_group'], |
| 2886 | 2886 | 'name' => $row['group_name'], |
| 2887 | - 'href' => $scripturl . '?action=groups;sa=members;group=' . $row['id_moderator_group'], |
|
| 2888 | - 'link' => '<a href="' . $scripturl . '?action=groups;sa=members;group=' . $row['id_moderator_group'] . '">' . $row['group_name'] . '</a>' |
|
| 2887 | + 'href' => $scripturl.'?action=groups;sa=members;group='.$row['id_moderator_group'], |
|
| 2888 | + 'link' => '<a href="'.$scripturl.'?action=groups;sa=members;group='.$row['id_moderator_group'].'">'.$row['group_name'].'</a>' |
|
| 2889 | 2889 | ); |
| 2890 | 2890 | } |
| 2891 | 2891 | } |
| 2892 | 2892 | $smcFunc['db_free_result']($result); |
| 2893 | 2893 | } |
| 2894 | 2894 | |
| 2895 | - cache_put_data('board_parents-' . $original_parent, $boards, 480); |
|
| 2895 | + cache_put_data('board_parents-'.$original_parent, $boards, 480); |
|
| 2896 | 2896 | } |
| 2897 | 2897 | |
| 2898 | 2898 | return $boards; |
@@ -2922,14 +2922,14 @@ discard block |
||
| 2922 | 2922 | |
| 2923 | 2923 | // Default language directories to try. |
| 2924 | 2924 | $language_directories = array( |
| 2925 | - $settings['default_theme_dir'] . '/languages', |
|
| 2925 | + $settings['default_theme_dir'].'/languages', |
|
| 2926 | 2926 | ); |
| 2927 | 2927 | if (!empty($settings['actual_theme_dir']) && $settings['actual_theme_dir'] != $settings['default_theme_dir']) |
| 2928 | - $language_directories[] = $settings['actual_theme_dir'] . '/languages'; |
|
| 2928 | + $language_directories[] = $settings['actual_theme_dir'].'/languages'; |
|
| 2929 | 2929 | |
| 2930 | 2930 | // We possibly have a base theme directory. |
| 2931 | 2931 | if (!empty($settings['base_theme_dir'])) |
| 2932 | - $language_directories[] = $settings['base_theme_dir'] . '/languages'; |
|
| 2932 | + $language_directories[] = $settings['base_theme_dir'].'/languages'; |
|
| 2933 | 2933 | |
| 2934 | 2934 | // Remove any duplicates. |
| 2935 | 2935 | $language_directories = array_unique($language_directories); |
@@ -2961,7 +2961,7 @@ discard block |
||
| 2961 | 2961 | $langName = $smcFunc['ucwords'](strtr($matches[1], array('_' => ' '))); |
| 2962 | 2962 | |
| 2963 | 2963 | // Get the line we need. |
| 2964 | - $fp = @fopen($language_dir . '/' . $entry); |
|
| 2964 | + $fp = @fopen($language_dir.'/'.$entry); |
|
| 2965 | 2965 | |
| 2966 | 2966 | // Yay! |
| 2967 | 2967 | if ($fp) |
@@ -2990,7 +2990,7 @@ discard block |
||
| 2990 | 2990 | 'name' => $langName, |
| 2991 | 2991 | 'selected' => false, |
| 2992 | 2992 | 'filename' => $matches[1], |
| 2993 | - 'location' => $language_dir . '/index.' . $matches[1] . '.php', |
|
| 2993 | + 'location' => $language_dir.'/index.'.$matches[1].'.php', |
|
| 2994 | 2994 | ); |
| 2995 | 2995 | } |
| 2996 | 2996 | $dir->close(); |
@@ -3047,7 +3047,7 @@ discard block |
||
| 3047 | 3047 | $boundary_before = preg_match('/^\w/', $censor_vulgar[$i]) ? '\b' : ($charset === 'UTF-8' ? '(?<![\p{L}\p{M}\p{N}_])' : '(?<!\w)'); |
| 3048 | 3048 | $boundary_after = preg_match('/\w$/', $censor_vulgar[$i]) ? '\b' : ($charset === 'UTF-8' ? '(?![\p{L}\p{M}\p{N}_])' : '(?!\w)'); |
| 3049 | 3049 | |
| 3050 | - $censor_vulgar[$i] = '/' . $boundary_before . $censor_vulgar[$i] . $boundary_after . '/' . (empty($modSettings['censorIgnoreCase']) ? '' : 'i') . ($charset === 'UTF-8' ? 'u' : ''); |
|
| 3050 | + $censor_vulgar[$i] = '/'.$boundary_before.$censor_vulgar[$i].$boundary_after.'/'.(empty($modSettings['censorIgnoreCase']) ? '' : 'i').($charset === 'UTF-8' ? 'u' : ''); |
|
| 3051 | 3051 | } |
| 3052 | 3052 | } |
| 3053 | 3053 | } |
@@ -3108,18 +3108,18 @@ discard block |
||
| 3108 | 3108 | ob_start(); |
| 3109 | 3109 | |
| 3110 | 3110 | if (isset($_GET['debug'])) |
| 3111 | - header('content-type: application/xhtml+xml; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set'])); |
|
| 3111 | + header('content-type: application/xhtml+xml; charset='.(empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set'])); |
|
| 3112 | 3112 | |
| 3113 | 3113 | // Don't cache error pages!! |
| 3114 | 3114 | header('expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 3115 | - header('last-modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 3115 | + header('last-modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 3116 | 3116 | header('cache-control: no-cache'); |
| 3117 | 3117 | |
| 3118 | 3118 | if (!isset($txt['template_parse_error'])) |
| 3119 | 3119 | { |
| 3120 | 3120 | $txt['template_parse_error'] = 'Template Parse Error!'; |
| 3121 | 3121 | $txt['template_parse_error_message'] = 'It seems something has gone sour on the forum with the template system. This problem should only be temporary, so please come back later and try again. If you continue to see this message, please contact the administrator.<br><br>You can also try <a href="javascript:location.reload();">refreshing this page</a>.'; |
| 3122 | - $txt['template_parse_error_details'] = 'There was a problem loading the <pre><strong>%1$s</strong></pre> template or language file. Please check the syntax and try again - remember, single quotes (<pre>\'</pre>) often have to be escaped with a slash (<pre>\\</pre>). To see more specific error information from PHP, try <a href="' . $boardurl . '%1$s" class="extern">accessing the file directly</a>.<br><br>You may want to try to <a href="javascript:location.reload();">refresh this page</a> or <a href="' . $scripturl . '?theme=1">use the default theme</a>.'; |
|
| 3122 | + $txt['template_parse_error_details'] = 'There was a problem loading the <pre><strong>%1$s</strong></pre> template or language file. Please check the syntax and try again - remember, single quotes (<pre>\'</pre>) often have to be escaped with a slash (<pre>\\</pre>). To see more specific error information from PHP, try <a href="'.$boardurl.'%1$s" class="extern">accessing the file directly</a>.<br><br>You may want to try to <a href="javascript:location.reload();">refresh this page</a> or <a href="'.$scripturl.'?theme=1">use the default theme</a>.'; |
|
| 3123 | 3123 | $txt['template_parse_errmsg'] = 'Unfortunately more information is not available at this time as to exactly what is wrong.'; |
| 3124 | 3124 | } |
| 3125 | 3125 | |
@@ -3151,7 +3151,7 @@ discard block |
||
| 3151 | 3151 | </html>'; |
| 3152 | 3152 | else |
| 3153 | 3153 | { |
| 3154 | - $error = fetch_web_data($boardurl . strtr($filename, array($boarddir => '', strtr($boarddir, '\\', '/') => ''))); |
|
| 3154 | + $error = fetch_web_data($boardurl.strtr($filename, array($boarddir => '', strtr($boarddir, '\\', '/') => ''))); |
|
| 3155 | 3155 | $error_array = error_get_last(); |
| 3156 | 3156 | if (empty($error) && ini_get('track_errors') && !empty($error_array)) |
| 3157 | 3157 | $error = $error_array['message']; |
@@ -3171,10 +3171,10 @@ discard block |
||
| 3171 | 3171 | echo ' |
| 3172 | 3172 | <hr> |
| 3173 | 3173 | |
| 3174 | - <div style="margin: 0 20px;"><pre>', strtr(strtr($error, array('<strong>' . $boarddir => '<strong>...', '<strong>' . strtr($boarddir, '\\', '/') => '<strong>...')), '\\', '/'), '</pre></div>'; |
|
| 3174 | + <div style="margin: 0 20px;"><pre>', strtr(strtr($error, array('<strong>'.$boarddir => '<strong>...', '<strong>'.strtr($boarddir, '\\', '/') => '<strong>...')), '\\', '/'), '</pre></div>'; |
|
| 3175 | 3175 | |
| 3176 | 3176 | // I know, I know... this is VERY COMPLICATED. Still, it's good. |
| 3177 | - if (preg_match('~ <strong>(\d+)</strong><br( /)?' . '>$~i', $error, $match) != 0) |
|
| 3177 | + if (preg_match('~ <strong>(\d+)</strong><br( /)?'.'>$~i', $error, $match) != 0) |
|
| 3178 | 3178 | { |
| 3179 | 3179 | $data = file($filename); |
| 3180 | 3180 | $data2 = highlight_php_code(implode('', $data)); |
@@ -3182,9 +3182,9 @@ discard block |
||
| 3182 | 3182 | |
| 3183 | 3183 | // Fix the PHP code stuff... |
| 3184 | 3184 | if (!isBrowser('gecko')) |
| 3185 | - $data2 = str_replace("\t", '<span style="white-space: pre;">' . "\t" . '</span>', $data2); |
|
| 3185 | + $data2 = str_replace("\t", '<span style="white-space: pre;">'."\t".'</span>', $data2); |
|
| 3186 | 3186 | else |
| 3187 | - $data2 = str_replace('<pre style="display: inline;">' . "\t" . '</pre>', "\t", $data2); |
|
| 3187 | + $data2 = str_replace('<pre style="display: inline;">'."\t".'</pre>', "\t", $data2); |
|
| 3188 | 3188 | |
| 3189 | 3189 | // Now we get to work around a bug in PHP where it doesn't escape <br>s! |
| 3190 | 3190 | $j = -1; |
@@ -3198,7 +3198,7 @@ discard block |
||
| 3198 | 3198 | $n = substr_count($line, '<br>'); |
| 3199 | 3199 | for ($i = 0; $i < $n; $i++) |
| 3200 | 3200 | { |
| 3201 | - $data2[$j] .= '<br />' . $data2[$j + $i + 1]; |
|
| 3201 | + $data2[$j] .= '<br />'.$data2[$j + $i + 1]; |
|
| 3202 | 3202 | unset($data2[$j + $i + 1]); |
| 3203 | 3203 | } |
| 3204 | 3204 | $j += $n; |
@@ -3226,9 +3226,9 @@ discard block |
||
| 3226 | 3226 | if ($line == $match[1]) |
| 3227 | 3227 | echo '</pre><div style="background-color: #ffb0b5;"><pre style="margin: 0;">'; |
| 3228 | 3228 | |
| 3229 | - echo '<span style="color: black;">', sprintf('%' . strlen($n) . 's', $line), ':</span> '; |
|
| 3229 | + echo '<span style="color: black;">', sprintf('%'.strlen($n).'s', $line), ':</span> '; |
|
| 3230 | 3230 | if (isset($data2[$line]) && $data2[$line] != '') |
| 3231 | - echo substr($data2[$line], 0, 2) == '</' ? preg_replace('~^</[^>]+>~', '', $data2[$line]) : $last_line . $data2[$line]; |
|
| 3231 | + echo substr($data2[$line], 0, 2) == '</' ? preg_replace('~^</[^>]+>~', '', $data2[$line]) : $last_line.$data2[$line]; |
|
| 3232 | 3232 | |
| 3233 | 3233 | if (isset($data2[$line]) && preg_match('~(<[^/>]+>)[^<]*$~', $data2[$line], $color_match) != 0) |
| 3234 | 3234 | { |
@@ -3267,11 +3267,11 @@ discard block |
||
| 3267 | 3267 | global $db_type, $db_name, $ssi_db_user, $ssi_db_passwd, $sourcedir, $db_prefix, $db_port, $db_mb4; |
| 3268 | 3268 | |
| 3269 | 3269 | // Figure out what type of database we are using. |
| 3270 | - if (empty($db_type) || !file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
|
| 3270 | + if (empty($db_type) || !file_exists($sourcedir.'/Subs-Db-'.$db_type.'.php')) |
|
| 3271 | 3271 | $db_type = 'mysql'; |
| 3272 | 3272 | |
| 3273 | 3273 | // Load the file for the database. |
| 3274 | - require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
|
| 3274 | + require_once($sourcedir.'/Subs-Db-'.$db_type.'.php'); |
|
| 3275 | 3275 | |
| 3276 | 3276 | $db_options = array(); |
| 3277 | 3277 | |
@@ -3329,18 +3329,18 @@ discard block |
||
| 3329 | 3329 | $cacheAPI = false; |
| 3330 | 3330 | |
| 3331 | 3331 | // Make sure our class is in session. |
| 3332 | - require_once($sourcedir . '/Class-CacheAPI.php'); |
|
| 3332 | + require_once($sourcedir.'/Class-CacheAPI.php'); |
|
| 3333 | 3333 | |
| 3334 | 3334 | // What accelerator we are going to try. |
| 3335 | 3335 | $tryAccelerator = !empty($overrideCache) ? $overrideCache : !empty($cache_accelerator) ? $cache_accelerator : 'smf'; |
| 3336 | 3336 | $tryAccelerator = strtolower($tryAccelerator); |
| 3337 | 3337 | |
| 3338 | 3338 | // Do some basic tests. |
| 3339 | - if (file_exists($sourcedir . '/CacheAPI-' . $tryAccelerator . '.php')) |
|
| 3339 | + if (file_exists($sourcedir.'/CacheAPI-'.$tryAccelerator.'.php')) |
|
| 3340 | 3340 | { |
| 3341 | - require_once($sourcedir . '/CacheAPI-' . $tryAccelerator . '.php'); |
|
| 3341 | + require_once($sourcedir.'/CacheAPI-'.$tryAccelerator.'.php'); |
|
| 3342 | 3342 | |
| 3343 | - $cache_class_name = $tryAccelerator . '_cache'; |
|
| 3343 | + $cache_class_name = $tryAccelerator.'_cache'; |
|
| 3344 | 3344 | $testAPI = new $cache_class_name(); |
| 3345 | 3345 | |
| 3346 | 3346 | // No Support? NEXT! |
@@ -3394,7 +3394,7 @@ discard block |
||
| 3394 | 3394 | */ |
| 3395 | 3395 | if (empty($modSettings['cache_enable']) || $modSettings['cache_enable'] < $level || !is_array($cache_block = cache_get_data($key, 3600)) || (!empty($cache_block['refresh_eval']) && eval($cache_block['refresh_eval'])) || (!empty($cache_block['expires']) && $cache_block['expires'] < time())) |
| 3396 | 3396 | { |
| 3397 | - require_once($sourcedir . '/' . $file); |
|
| 3397 | + require_once($sourcedir.'/'.$file); |
|
| 3398 | 3398 | $cache_block = call_user_func_array($function, $params); |
| 3399 | 3399 | |
| 3400 | 3400 | if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= $level) |
@@ -3587,17 +3587,17 @@ discard block |
||
| 3587 | 3587 | |
| 3588 | 3588 | // Just a plain external url. |
| 3589 | 3589 | else |
| 3590 | - $image = (stristr($data['avatar'], 'http://') || stristr($data['avatar'], 'https://')) ? $data['avatar'] : $modSettings['avatar_url'] . '/' . $data['avatar']; |
|
| 3590 | + $image = (stristr($data['avatar'], 'http://') || stristr($data['avatar'], 'https://')) ? $data['avatar'] : $modSettings['avatar_url'].'/'.$data['avatar']; |
|
| 3591 | 3591 | } |
| 3592 | 3592 | } |
| 3593 | 3593 | |
| 3594 | 3594 | // Perhaps this user has an attachment as avatar... |
| 3595 | 3595 | else if (!empty($data['filename'])) |
| 3596 | - $image = $modSettings['custom_avatar_url'] . '/' . $data['filename']; |
|
| 3596 | + $image = $modSettings['custom_avatar_url'].'/'.$data['filename']; |
|
| 3597 | 3597 | |
| 3598 | 3598 | // Right... no avatar... use our default image. |
| 3599 | 3599 | else |
| 3600 | - $image = $modSettings['avatar_url'] . '/default.png'; |
|
| 3600 | + $image = $modSettings['avatar_url'].'/default.png'; |
|
| 3601 | 3601 | } |
| 3602 | 3602 | |
| 3603 | 3603 | call_integration_hook('integrate_set_avatar_data', array(&$image, &$data)); |
@@ -3606,7 +3606,7 @@ discard block |
||
| 3606 | 3606 | if (!empty($image)) |
| 3607 | 3607 | return array( |
| 3608 | 3608 | 'name' => !empty($data['avatar']) ? $data['avatar'] : '', |
| 3609 | - 'image' => '<img class="avatar" src="' . $image . '" />', |
|
| 3609 | + 'image' => '<img class="avatar" src="'.$image.'" />', |
|
| 3610 | 3610 | 'href' => $image, |
| 3611 | 3611 | 'url' => $image, |
| 3612 | 3612 | ); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | // Set a list of common functions. |
| 79 | 79 | $ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);'; |
| 80 | 80 | $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
| 81 | - { |
|
| 81 | + { |
|
| 82 | 82 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
| 83 | 83 | return $string; |
| 84 | 84 | } : function($string) |
@@ -2131,7 +2131,6 @@ discard block |
||
| 2131 | 2131 | loadLanguage('index+Modifications'); |
| 2132 | 2132 | $context['template_layers'] = array(); |
| 2133 | 2133 | } |
| 2134 | - |
|
| 2135 | 2134 | else |
| 2136 | 2135 | { |
| 2137 | 2136 | // Custom templates to load, or just default? |
@@ -2510,14 +2509,12 @@ discard block |
||
| 2510 | 2509 | $fileUrl = $settings['default_theme_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2511 | 2510 | $filePath = $settings['default_theme_dir'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2512 | 2511 | } |
| 2513 | - |
|
| 2514 | 2512 | else |
| 2515 | 2513 | { |
| 2516 | 2514 | $fileUrl = false; |
| 2517 | 2515 | $filePath = false; |
| 2518 | 2516 | } |
| 2519 | 2517 | } |
| 2520 | - |
|
| 2521 | 2518 | else |
| 2522 | 2519 | { |
| 2523 | 2520 | $fileUrl = $settings[$themeRef . '_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
@@ -2618,14 +2615,12 @@ discard block |
||
| 2618 | 2615 | $fileUrl = $settings['default_theme_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2619 | 2616 | $filePath = $settings['default_theme_dir'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
| 2620 | 2617 | } |
| 2621 | - |
|
| 2622 | 2618 | else |
| 2623 | 2619 | { |
| 2624 | 2620 | $fileUrl = false; |
| 2625 | 2621 | $filePath = false; |
| 2626 | 2622 | } |
| 2627 | 2623 | } |
| 2628 | - |
|
| 2629 | 2624 | else |
| 2630 | 2625 | { |
| 2631 | 2626 | $fileUrl = $settings[$themeRef . '_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | $context['sub_action'] = $_REQUEST['sa']; |
| 109 | 109 | |
| 110 | 110 | // Warn the user if there's any relevant information regarding Settings.php. |
| 111 | - $settings_not_writable = !is_writable($boarddir . '/Settings.php'); |
|
| 112 | - $settings_backup_fail = !@is_writable($boarddir . '/Settings_bak.php') || !@copy($boarddir . '/Settings.php', $boarddir . '/Settings_bak.php'); |
|
| 111 | + $settings_not_writable = !is_writable($boarddir.'/Settings.php'); |
|
| 112 | + $settings_backup_fail = !@is_writable($boarddir.'/Settings_bak.php') || !@copy($boarddir.'/Settings.php', $boarddir.'/Settings_bak.php'); |
|
| 113 | 113 | |
| 114 | 114 | if ($settings_not_writable) |
| 115 | - $context['settings_message'] = '<div class="centertext"><strong>' . $txt['settings_not_writable'] . '</strong></div><br>'; |
|
| 115 | + $context['settings_message'] = '<div class="centertext"><strong>'.$txt['settings_not_writable'].'</strong></div><br>'; |
|
| 116 | 116 | elseif ($settings_backup_fail) |
| 117 | - $context['settings_message'] = '<div class="centertext"><strong>' . $txt['admin_backup_fail'] . '</strong></div><br>'; |
|
| 117 | + $context['settings_message'] = '<div class="centertext"><strong>'.$txt['admin_backup_fail'].'</strong></div><br>'; |
|
| 118 | 118 | |
| 119 | 119 | $context['settings_not_writable'] = $settings_not_writable; |
| 120 | 120 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | global $scripturl, $context, $txt, $modSettings, $boardurl, $sourcedir; |
| 142 | 142 | |
| 143 | 143 | // If no cert, force_ssl must remain 0 |
| 144 | - require_once($sourcedir . '/Subs.php'); |
|
| 144 | + require_once($sourcedir.'/Subs.php'); |
|
| 145 | 145 | if (!ssl_cert_found($boardurl) && empty($modSettings['force_ssl'])) |
| 146 | 146 | $disable_force_ssl = true; |
| 147 | 147 | else |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | return $config_vars; |
| 179 | 179 | |
| 180 | 180 | // Setup the template stuff. |
| 181 | - $context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=general;save'; |
|
| 181 | + $context['post_url'] = $scripturl.'?action=admin;area=serversettings;sa=general;save'; |
|
| 182 | 182 | $context['settings_title'] = $txt['general_settings']; |
| 183 | 183 | |
| 184 | 184 | // Saving settings? |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | saveSettings($config_vars); |
| 207 | 207 | $_SESSION['adm-save'] = true; |
| 208 | - redirectexit('action=admin;area=serversettings;sa=general;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 208 | + redirectexit('action=admin;area=serversettings;sa=general;'.$context['session_var'].'='.$context['session_id']); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | // Fill the config array. |
@@ -251,14 +251,14 @@ discard block |
||
| 251 | 251 | function AlignURLsWithSSLSetting($new_force_ssl = 0) |
| 252 | 252 | { |
| 253 | 253 | global $boardurl, $modSettings, $sourcedir, $smcFunc; |
| 254 | - require_once($sourcedir . '/Subs-Admin.php'); |
|
| 254 | + require_once($sourcedir.'/Subs-Admin.php'); |
|
| 255 | 255 | |
| 256 | 256 | // Check $boardurl |
| 257 | 257 | if (!empty($new_force_ssl)) |
| 258 | 258 | $newval = strtr($boardurl, array('http://' => 'https://')); |
| 259 | 259 | else |
| 260 | 260 | $newval = strtr($boardurl, array('https://' => 'http://')); |
| 261 | - updateSettingsFile(array('boardurl' => '\'' . addslashes($newval) . '\'')); |
|
| 261 | + updateSettingsFile(array('boardurl' => '\''.addslashes($newval).'\'')); |
|
| 262 | 262 | |
| 263 | 263 | $new_settings = array(); |
| 264 | 264 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 406 | 406 | $fts_language[$row['cfgname']] = $row['cfgname']; |
| 407 | 407 | |
| 408 | - $config_vars = array_merge ($config_vars, array( |
|
| 408 | + $config_vars = array_merge($config_vars, array( |
|
| 409 | 409 | '', |
| 410 | 410 | array('search_language', $txt['search_language'], 'db', 'select', $fts_language, 'pgFulltextSearch') |
| 411 | 411 | ) |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | return $config_vars; |
| 420 | 420 | |
| 421 | 421 | // Setup the template stuff. |
| 422 | - $context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=database;save'; |
|
| 422 | + $context['post_url'] = $scripturl.'?action=admin;area=serversettings;sa=database;save'; |
|
| 423 | 423 | $context['settings_title'] = $txt['database_settings']; |
| 424 | 424 | $context['save_disabled'] = $context['settings_not_writable']; |
| 425 | 425 | |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | saveSettings($config_vars); |
| 439 | 439 | $_SESSION['adm-save'] = true; |
| 440 | - redirectexit('action=admin;area=serversettings;sa=database;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 440 | + redirectexit('action=admin;area=serversettings;sa=database;'.$context['session_var'].'='.$context['session_id']); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | // Fill the config array. |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | 2 => $txt['tfa_mode_forced'], |
| 479 | 479 | )) + (empty($user_settings['tfa_secret']) ? array() : array( |
| 480 | 480 | 3 => $txt['tfa_mode_forcedall'], |
| 481 | - )), 'subtext' => $txt['tfa_mode_subtext'] . (empty($user_settings['tfa_secret']) ? '<br><strong>' . $txt['tfa_mode_forced_help'] . '</strong>' : ''), 'tfa_mode'), |
|
| 481 | + )), 'subtext' => $txt['tfa_mode_subtext'].(empty($user_settings['tfa_secret']) ? '<br><strong>'.$txt['tfa_mode_forced_help'].'</strong>' : ''), 'tfa_mode'), |
|
| 482 | 482 | ); |
| 483 | 483 | |
| 484 | 484 | addInlineJavaScript(' |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | if ($return_config) |
| 507 | 507 | return $config_vars; |
| 508 | 508 | |
| 509 | - $context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=cookie;save'; |
|
| 509 | + $context['post_url'] = $scripturl.'?action=admin;area=serversettings;sa=cookie;save'; |
|
| 510 | 510 | $context['settings_title'] = $txt['cookies_sessions_settings']; |
| 511 | 511 | |
| 512 | 512 | // Saving settings? |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | if ($cookiename != $_POST['cookiename'] || !empty($scope_changed)) |
| 531 | 531 | { |
| 532 | 532 | $original_session_id = $context['session_id']; |
| 533 | - include_once($sourcedir . '/Subs-Auth.php'); |
|
| 533 | + include_once($sourcedir.'/Subs-Auth.php'); |
|
| 534 | 534 | |
| 535 | 535 | // Remove the old cookie. |
| 536 | 536 | setLoginCookie(-3600, 0); |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | $cookiename = !empty($_POST['cookiename']) ? $_POST['cookiename'] : $cookiename; |
| 540 | 540 | setLoginCookie(60 * $modSettings['cookieTime'], $user_settings['id_member'], hash_salt($user_settings['passwd'], $user_settings['password_salt'])); |
| 541 | 541 | |
| 542 | - redirectexit('action=admin;area=serversettings;sa=cookie;' . $context['session_var'] . '=' . $original_session_id, $context['server']['needs_login_fix']); |
|
| 542 | + redirectexit('action=admin;area=serversettings;sa=cookie;'.$context['session_var'].'='.$original_session_id, $context['server']['needs_login_fix']); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | //If we disabled 2FA, reset all members and membergroups settings. |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | $_SESSION['adm-save'] = true; |
| 565 | - redirectexit('action=admin;area=serversettings;sa=cookie;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 565 | + redirectexit('action=admin;area=serversettings;sa=cookie;'.$context['session_var'].'='.$context['session_id']); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | // Fill the config array. |
@@ -617,10 +617,10 @@ discard block |
||
| 617 | 617 | call_integration_hook('integrate_save_general_security_settings'); |
| 618 | 618 | |
| 619 | 619 | writeLog(); |
| 620 | - redirectexit('action=admin;area=serversettings;sa=security;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 620 | + redirectexit('action=admin;area=serversettings;sa=security;'.$context['session_var'].'='.$context['session_id']); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - $context['post_url'] = $scripturl . '?action=admin;area=serversettings;save;sa=security'; |
|
| 623 | + $context['post_url'] = $scripturl.'?action=admin;area=serversettings;save;sa=security'; |
|
| 624 | 624 | $context['settings_title'] = $txt['security_settings']; |
| 625 | 625 | |
| 626 | 626 | prepareDBSettingContext($config_vars); |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | { |
| 674 | 674 | foreach ($detected as $tryCache => $dummy) |
| 675 | 675 | { |
| 676 | - $cache_class_name = $tryCache . '_cache'; |
|
| 676 | + $cache_class_name = $tryCache.'_cache'; |
|
| 677 | 677 | |
| 678 | 678 | // loadCacheAPIs has already included the file, just see if we can't add the settings in. |
| 679 | 679 | if (is_callable(array($cache_class_name, 'cacheSettings'))) |
@@ -698,14 +698,14 @@ discard block |
||
| 698 | 698 | updatesettings(array('cache_enable' => (int) $_POST['cache_enable'])); |
| 699 | 699 | |
| 700 | 700 | // exit so we reload our new settings on the page |
| 701 | - redirectexit('action=admin;area=serversettings;sa=cache;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 701 | + redirectexit('action=admin;area=serversettings;sa=cache;'.$context['session_var'].'='.$context['session_id']); |
|
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | loadLanguage('ManageMaintenance'); |
| 705 | 705 | createToken('admin-maint'); |
| 706 | 706 | $context['template_layers'][] = 'clean_cache_button'; |
| 707 | 707 | |
| 708 | - $context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=cache;save'; |
|
| 708 | + $context['post_url'] = $scripturl.'?action=admin;area=serversettings;sa=cache;save'; |
|
| 709 | 709 | $context['settings_title'] = $txt['caching_settings']; |
| 710 | 710 | |
| 711 | 711 | // Changing cache settings won't have any effect if Settings.php is not writeable. |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | if ($return_config) |
| 793 | 793 | return $config_vars; |
| 794 | 794 | |
| 795 | - $context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=loads;save'; |
|
| 795 | + $context['post_url'] = $scripturl.'?action=admin;area=serversettings;sa=loads;save'; |
|
| 796 | 796 | $context['settings_title'] = $txt['load_balancing_settings']; |
| 797 | 797 | |
| 798 | 798 | // Saving? |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | saveDBSettings($config_vars); |
| 820 | 820 | if (!isset($_SESSION['adm-save'])) |
| 821 | 821 | $_SESSION['adm-save'] = true; |
| 822 | - redirectexit('action=admin;area=serversettings;sa=loads;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 822 | + redirectexit('action=admin;area=serversettings;sa=loads;'.$context['session_var'].'='.$context['session_id']); |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | prepareDBSettingContext($config_vars); |
@@ -1081,16 +1081,16 @@ discard block |
||
| 1081 | 1081 | if (!is_numeric($k)) |
| 1082 | 1082 | { |
| 1083 | 1083 | if (substr($k, 0, 2) == 'on') |
| 1084 | - $context['config_vars'][$config_var[1]]['javascript'] .= ' ' . $k . '="' . $v . '"'; |
|
| 1084 | + $context['config_vars'][$config_var[1]]['javascript'] .= ' '.$k.'="'.$v.'"'; |
|
| 1085 | 1085 | else |
| 1086 | 1086 | $context['config_vars'][$config_var[1]][$k] = $v; |
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | // See if there are any other labels that might fit? |
| 1090 | - if (isset($txt['setting_' . $config_var[1]])) |
|
| 1091 | - $context['config_vars'][$config_var[1]]['label'] = $txt['setting_' . $config_var[1]]; |
|
| 1092 | - elseif (isset($txt['groups_' . $config_var[1]])) |
|
| 1093 | - $context['config_vars'][$config_var[1]]['label'] = $txt['groups_' . $config_var[1]]; |
|
| 1090 | + if (isset($txt['setting_'.$config_var[1]])) |
|
| 1091 | + $context['config_vars'][$config_var[1]]['label'] = $txt['setting_'.$config_var[1]]; |
|
| 1092 | + elseif (isset($txt['groups_'.$config_var[1]])) |
|
| 1093 | + $context['config_vars'][$config_var[1]]['label'] = $txt['groups_'.$config_var[1]]; |
|
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | 1096 | // Set the subtext in case it's part of the label. |
@@ -1107,13 +1107,13 @@ discard block |
||
| 1107 | 1107 | // If we have inline permissions we need to prep them. |
| 1108 | 1108 | if (!empty($inlinePermissions) && allowedTo('manage_permissions')) |
| 1109 | 1109 | { |
| 1110 | - require_once($sourcedir . '/ManagePermissions.php'); |
|
| 1110 | + require_once($sourcedir.'/ManagePermissions.php'); |
|
| 1111 | 1111 | init_inline_permissions($inlinePermissions, isset($context['permissions_excluded']) ? $context['permissions_excluded'] : array()); |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | if ($board_list) |
| 1115 | 1115 | { |
| 1116 | - require_once($sourcedir . '/Subs-MessageIndex.php'); |
|
| 1116 | + require_once($sourcedir.'/Subs-MessageIndex.php'); |
|
| 1117 | 1117 | $context['board_list'] = getBoardList(); |
| 1118 | 1118 | } |
| 1119 | 1119 | |
@@ -1156,9 +1156,9 @@ discard block |
||
| 1156 | 1156 | foreach ($bbcChoice as $bbc) |
| 1157 | 1157 | { |
| 1158 | 1158 | $context['bbc_sections'][$bbc] = array( |
| 1159 | - 'title' => isset($txt['bbc_title_' . $bbc]) ? $txt['bbc_title_' . $bbc] : $txt['bbcTagsToUse_select'], |
|
| 1160 | - 'disabled' => empty($modSettings['bbc_disabled_' . $bbc]) ? array() : $modSettings['bbc_disabled_' . $bbc], |
|
| 1161 | - 'all_selected' => empty($modSettings['bbc_disabled_' . $bbc]), |
|
| 1159 | + 'title' => isset($txt['bbc_title_'.$bbc]) ? $txt['bbc_title_'.$bbc] : $txt['bbcTagsToUse_select'], |
|
| 1160 | + 'disabled' => empty($modSettings['bbc_disabled_'.$bbc]) ? array() : $modSettings['bbc_disabled_'.$bbc], |
|
| 1161 | + 'all_selected' => empty($modSettings['bbc_disabled_'.$bbc]), |
|
| 1162 | 1162 | ); |
| 1163 | 1163 | } |
| 1164 | 1164 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | |
| 1185 | 1185 | // Fix the darn stupid cookiename! (more may not be allowed, but these for sure!) |
| 1186 | 1186 | if (isset($_POST['cookiename'])) |
| 1187 | - $_POST['cookiename'] = preg_replace('~[,;\s\.$]+~' . ($context['utf8'] ? 'u' : ''), '', $_POST['cookiename']); |
|
| 1187 | + $_POST['cookiename'] = preg_replace('~[,;\s\.$]+~'.($context['utf8'] ? 'u' : ''), '', $_POST['cookiename']); |
|
| 1188 | 1188 | |
| 1189 | 1189 | // Fix the forum's URL if necessary. |
| 1190 | 1190 | if (isset($_POST['boardurl'])) |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | elseif (substr($_POST['boardurl'], -1) == '/') |
| 1195 | 1195 | $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
| 1196 | 1196 | if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') |
| 1197 | - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1197 | + $_POST['boardurl'] = 'http://'.$_POST['boardurl']; |
|
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | 1200 | // Any passwords? |
@@ -1237,11 +1237,11 @@ discard block |
||
| 1237 | 1237 | if (in_array($config_var, $config_passwords)) |
| 1238 | 1238 | { |
| 1239 | 1239 | if (isset($_POST[$config_var][1]) && $_POST[$config_var][0] == $_POST[$config_var][1]) |
| 1240 | - $new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var][0], '\'\\') . '\''; |
|
| 1240 | + $new_settings[$config_var] = '\''.addcslashes($_POST[$config_var][0], '\'\\').'\''; |
|
| 1241 | 1241 | } |
| 1242 | 1242 | elseif (in_array($config_var, $config_strs)) |
| 1243 | 1243 | { |
| 1244 | - $new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var], '\'\\') . '\''; |
|
| 1244 | + $new_settings[$config_var] = '\''.addcslashes($_POST[$config_var], '\'\\').'\''; |
|
| 1245 | 1245 | } |
| 1246 | 1246 | elseif (in_array($config_var, $config_ints)) |
| 1247 | 1247 | { |
@@ -1265,12 +1265,12 @@ discard block |
||
| 1265 | 1265 | else |
| 1266 | 1266 | { |
| 1267 | 1267 | // This shouldn't happen, but it might... |
| 1268 | - fatal_error('Unknown config_var \'' . $config_var . '\''); |
|
| 1268 | + fatal_error('Unknown config_var \''.$config_var.'\''); |
|
| 1269 | 1269 | } |
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | 1272 | // Save the relevant settings in the Settings.php file. |
| 1273 | - require_once($sourcedir . '/Subs-Admin.php'); |
|
| 1273 | + require_once($sourcedir.'/Subs-Admin.php'); |
|
| 1274 | 1274 | updateSettingsFile($new_settings); |
| 1275 | 1275 | |
| 1276 | 1276 | // Now loop through the remaining (database-based) settings. |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | $inlinePermissions = array(); |
| 1320 | 1320 | foreach ($config_vars as $var) |
| 1321 | 1321 | { |
| 1322 | - if (!isset($var[1]) || (!isset($_POST[$var[1]]) && $var[0] != 'check' && $var[0] != 'permissions' && $var[0] != 'boards' && ($var[0] != 'bbc' || !isset($_POST[$var[1] . '_enabledTags'])))) |
|
| 1322 | + if (!isset($var[1]) || (!isset($_POST[$var[1]]) && $var[0] != 'check' && $var[0] != 'permissions' && $var[0] != 'boards' && ($var[0] != 'bbc' || !isset($_POST[$var[1].'_enabledTags'])))) |
|
| 1323 | 1323 | continue; |
| 1324 | 1324 | |
| 1325 | 1325 | // Checkboxes! |
@@ -1405,12 +1405,12 @@ discard block |
||
| 1405 | 1405 | foreach (parse_bbc(false) as $tag) |
| 1406 | 1406 | $bbcTags[] = $tag['tag']; |
| 1407 | 1407 | |
| 1408 | - if (!isset($_POST[$var[1] . '_enabledTags'])) |
|
| 1409 | - $_POST[$var[1] . '_enabledTags'] = array(); |
|
| 1410 | - elseif (!is_array($_POST[$var[1] . '_enabledTags'])) |
|
| 1411 | - $_POST[$var[1] . '_enabledTags'] = array($_POST[$var[1] . '_enabledTags']); |
|
| 1408 | + if (!isset($_POST[$var[1].'_enabledTags'])) |
|
| 1409 | + $_POST[$var[1].'_enabledTags'] = array(); |
|
| 1410 | + elseif (!is_array($_POST[$var[1].'_enabledTags'])) |
|
| 1411 | + $_POST[$var[1].'_enabledTags'] = array($_POST[$var[1].'_enabledTags']); |
|
| 1412 | 1412 | |
| 1413 | - $setArray[$var[1]] = implode(',', array_diff($bbcTags, $_POST[$var[1] . '_enabledTags'])); |
|
| 1413 | + $setArray[$var[1]] = implode(',', array_diff($bbcTags, $_POST[$var[1].'_enabledTags'])); |
|
| 1414 | 1414 | } |
| 1415 | 1415 | // Permissions? |
| 1416 | 1416 | elseif ($var[0] == 'permissions') |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | // If we have inline permissions we need to save them. |
| 1424 | 1424 | if (!empty($inlinePermissions) && allowedTo('manage_permissions')) |
| 1425 | 1425 | { |
| 1426 | - require_once($sourcedir . '/ManagePermissions.php'); |
|
| 1426 | + require_once($sourcedir.'/ManagePermissions.php'); |
|
| 1427 | 1427 | save_inline_permissions($inlinePermissions); |
| 1428 | 1428 | } |
| 1429 | 1429 | } |
@@ -1455,7 +1455,7 @@ discard block |
||
| 1455 | 1455 | // put all of it into an array |
| 1456 | 1456 | foreach ($info_lines as $line) |
| 1457 | 1457 | { |
| 1458 | - if (preg_match('~(' . $remove . ')~', $line)) |
|
| 1458 | + if (preg_match('~('.$remove.')~', $line)) |
|
| 1459 | 1459 | continue; |
| 1460 | 1460 | |
| 1461 | 1461 | // new category? |
@@ -1485,26 +1485,26 @@ discard block |
||
| 1485 | 1485 | global $sourcedir, $txt; |
| 1486 | 1486 | |
| 1487 | 1487 | // Make sure our class is in session. |
| 1488 | - require_once($sourcedir . '/Class-CacheAPI.php'); |
|
| 1488 | + require_once($sourcedir.'/Class-CacheAPI.php'); |
|
| 1489 | 1489 | |
| 1490 | 1490 | $apis = array(); |
| 1491 | 1491 | if ($dh = opendir($sourcedir)) |
| 1492 | 1492 | { |
| 1493 | 1493 | while (($file = readdir($dh)) !== false) |
| 1494 | 1494 | { |
| 1495 | - if (is_file($sourcedir . '/' . $file) && preg_match('~^CacheAPI-([A-Za-z\d_]+)\.php$~', $file, $matches)) |
|
| 1495 | + if (is_file($sourcedir.'/'.$file) && preg_match('~^CacheAPI-([A-Za-z\d_]+)\.php$~', $file, $matches)) |
|
| 1496 | 1496 | { |
| 1497 | 1497 | $tryCache = strtolower($matches[1]); |
| 1498 | 1498 | |
| 1499 | - require_once($sourcedir . '/' . $file); |
|
| 1500 | - $cache_class_name = $tryCache . '_cache'; |
|
| 1499 | + require_once($sourcedir.'/'.$file); |
|
| 1500 | + $cache_class_name = $tryCache.'_cache'; |
|
| 1501 | 1501 | $testAPI = new $cache_class_name(); |
| 1502 | 1502 | |
| 1503 | 1503 | // No Support? NEXT! |
| 1504 | 1504 | if (!$testAPI->isSupported(true)) |
| 1505 | 1505 | continue; |
| 1506 | 1506 | |
| 1507 | - $apis[$tryCache] = isset($txt[$tryCache . '_cache']) ? $txt[$tryCache . '_cache'] : $tryCache; |
|
| 1507 | + $apis[$tryCache] = isset($txt[$tryCache.'_cache']) ? $txt[$tryCache.'_cache'] : $tryCache; |
|
| 1508 | 1508 | } |
| 1509 | 1509 | } |
| 1510 | 1510 | } |
@@ -1533,9 +1533,9 @@ discard block |
||
| 1533 | 1533 | $fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr); |
| 1534 | 1534 | if ($fp) |
| 1535 | 1535 | { |
| 1536 | - $out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n"; |
|
| 1537 | - $out .= 'Host: www.simplemachines.org' . "\r\n"; |
|
| 1538 | - $out .= 'Connection: Close' . "\r\n\r\n"; |
|
| 1536 | + $out = 'GET /smf/stats/register_stats.php?site='.base64_encode($boardurl).' HTTP/1.1'."\r\n"; |
|
| 1537 | + $out .= 'Host: www.simplemachines.org'."\r\n"; |
|
| 1538 | + $out .= 'Connection: Close'."\r\n\r\n"; |
|
| 1539 | 1539 | fwrite($fp, $out); |
| 1540 | 1540 | |
| 1541 | 1541 | $return_data = ''; |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | $txt['member_id'] = 'ID'; |
| 123 | 123 | |
| 124 | 124 | $txt['unknown'] = 'unknown'; |
| 125 | -$txt['security_wrong'] = 'Administration login attempt!' . "\n" . 'Referrer: %1$s' . "\n" . 'User agent: %2$s' . "\n" . 'IP: %3$s'; |
|
| 125 | +$txt['security_wrong'] = 'Administration login attempt!'."\n".'Referrer: %1$s'."\n".'User agent: %2$s'."\n".'IP: %3$s'; |
|
| 126 | 126 | |
| 127 | 127 | $txt['email_as_html'] = 'Send in HTML format. (with this you can put normal HTML in the email.)'; |
| 128 | 128 | $txt['email_parsed_html'] = 'Add <br>s and &nbsp;s to this message.'; |
| 129 | -$txt['email_variables'] = 'In this message you can use a few "variables". Click <a href="' . $scripturl . '?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help">here</a> for more information.'; |
|
| 129 | +$txt['email_variables'] = 'In this message you can use a few "variables". Click <a href="'.$scripturl.'?action=helpadmin;help=email_members" onclick="return reqOverlayDiv(this.href);" class="help">here</a> for more information.'; |
|
| 130 | 130 | $txt['email_force'] = 'Send this to members even if they have chosen not to receive announcements.'; |
| 131 | 131 | $txt['email_as_pms'] = 'Send this to these groups using personal messages.'; |
| 132 | 132 | $txt['email_continue'] = 'Continue'; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | $txt['attach_dir_does_not_exist'] = 'Does not exist'; |
| 360 | 360 | $txt['attach_dir_not_writable'] = 'Not writable'; |
| 361 | -$txt['attach_dir_files_missing'] = 'Files Missing (<a href="' . $scripturl . '?action=admin;area=manageattachments;sa=repair;%2$s=%1$s">Repair</a>)'; |
|
| 361 | +$txt['attach_dir_files_missing'] = 'Files Missing (<a href="'.$scripturl.'?action=admin;area=manageattachments;sa=repair;%2$s=%1$s">Repair</a>)'; |
|
| 362 | 362 | $txt['attach_dir_unused'] = 'Unused'; |
| 363 | 363 | $txt['attach_dir_empty'] = 'Empty'; |
| 364 | 364 | $txt['attach_dir_ok'] = 'OK'; |
@@ -410,8 +410,8 @@ discard block |
||
| 410 | 410 | $txt['use_subdirectories_for_attachments_note'] = 'Otherwise any new directories will be created within the forum\'s main directory.'; |
| 411 | 411 | $txt['basedirectory_for_attachments'] = 'Set a base directory for attachments'; |
| 412 | 412 | $txt['basedirectory_for_attachments_current'] = 'Current base directory'; |
| 413 | -$txt['basedirectory_for_attachments_warning'] = '<div class="smalltext">Please note that the directory is wrong. <br>(<a href="' . $scripturl . '?action=admin;area=manageattachments;sa=attachpaths">Attempt to correct</a>)</div>'; |
|
| 414 | -$txt['attach_current_dir_warning'] = '<div class="smalltext">There seems to be a problem with this directory. <br>(<a href="' . $scripturl . '?action=admin;area=manageattachments;sa=attachpaths">Attempt to correct</a>)</div>'; |
|
| 413 | +$txt['basedirectory_for_attachments_warning'] = '<div class="smalltext">Please note that the directory is wrong. <br>(<a href="'.$scripturl.'?action=admin;area=manageattachments;sa=attachpaths">Attempt to correct</a>)</div>'; |
|
| 414 | +$txt['attach_current_dir_warning'] = '<div class="smalltext">There seems to be a problem with this directory. <br>(<a href="'.$scripturl.'?action=admin;area=manageattachments;sa=attachpaths">Attempt to correct</a>)</div>'; |
|
| 415 | 415 | |
| 416 | 416 | $txt['attachment_transfer'] = 'Transfer Attachments'; |
| 417 | 417 | $txt['attachment_transfer_desc'] = 'Transfer files between directories.'; |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | switch ($modSettings['automanage_attachments']) |
| 80 | 80 | { |
| 81 | 81 | case 1: |
| 82 | - $updir = $basedirectory . DIRECTORY_SEPARATOR . 'attachments_' . (isset($modSettings['last_attachments_directory'][$base_dir]) ? $modSettings['last_attachments_directory'][$base_dir] : 0); |
|
| 82 | + $updir = $basedirectory.DIRECTORY_SEPARATOR.'attachments_'.(isset($modSettings['last_attachments_directory'][$base_dir]) ? $modSettings['last_attachments_directory'][$base_dir] : 0); |
|
| 83 | 83 | break; |
| 84 | 84 | case 2: |
| 85 | - $updir = $basedirectory . DIRECTORY_SEPARATOR . $year; |
|
| 85 | + $updir = $basedirectory.DIRECTORY_SEPARATOR.$year; |
|
| 86 | 86 | break; |
| 87 | 87 | case 3: |
| 88 | - $updir = $basedirectory . DIRECTORY_SEPARATOR . $year . DIRECTORY_SEPARATOR . $month; |
|
| 88 | + $updir = $basedirectory.DIRECTORY_SEPARATOR.$year.DIRECTORY_SEPARATOR.$month; |
|
| 89 | 89 | break; |
| 90 | 90 | case 4: |
| 91 | - $updir = $basedirectory . DIRECTORY_SEPARATOR . (empty($modSettings['use_subdirectories_for_attachments']) ? 'attachments-' : 'random_') . $rand; |
|
| 91 | + $updir = $basedirectory.DIRECTORY_SEPARATOR.(empty($modSettings['use_subdirectories_for_attachments']) ? 'attachments-' : 'random_').$rand; |
|
| 92 | 92 | break; |
| 93 | 93 | case 5: |
| 94 | - $updir = $basedirectory . DIRECTORY_SEPARATOR . (empty($modSettings['use_subdirectories_for_attachments']) ? 'attachments-' : 'random_') . $rand . DIRECTORY_SEPARATOR . $rand1; |
|
| 94 | + $updir = $basedirectory.DIRECTORY_SEPARATOR.(empty($modSettings['use_subdirectories_for_attachments']) ? 'attachments-' : 'random_').$rand.DIRECTORY_SEPARATOR.$rand1; |
|
| 95 | 95 | break; |
| 96 | 96 | default : |
| 97 | 97 | $updir = ''; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | if ($directory === false) |
| 136 | 136 | { |
| 137 | 137 | // Maybe it's just the folder name |
| 138 | - $tree = get_directory_tree_elements($boarddir . DIRECTORY_SEPARATOR . $updir); |
|
| 138 | + $tree = get_directory_tree_elements($boarddir.DIRECTORY_SEPARATOR.$updir); |
|
| 139 | 139 | $count = count($tree); |
| 140 | 140 | |
| 141 | 141 | $directory = attachments_init_dir($tree, $count); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | return false; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $directory .= DIRECTORY_SEPARATOR . array_shift($tree); |
|
| 146 | + $directory .= DIRECTORY_SEPARATOR.array_shift($tree); |
|
| 147 | 147 | |
| 148 | 148 | while (!@is_dir($directory) || $count != -1) |
| 149 | 149 | { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - $directory .= DIRECTORY_SEPARATOR . array_shift($tree); |
|
| 159 | + $directory .= DIRECTORY_SEPARATOR.array_shift($tree); |
|
| 160 | 160 | $count--; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // Everything seems fine...let's create the .htaccess |
| 171 | - if (!file_exists($directory . DIRECTORY_SEPARATOR . '.htaccess')) |
|
| 171 | + if (!file_exists($directory.DIRECTORY_SEPARATOR.'.htaccess')) |
|
| 172 | 172 | secureDirectory($updir, true); |
| 173 | 173 | |
| 174 | 174 | $sep = (DIRECTORY_SEPARATOR === '\\') ? '\/' : DIRECTORY_SEPARATOR; |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | // And increment it. |
| 225 | 225 | $modSettings['last_attachments_directory'][$base_dir]++; |
| 226 | 226 | |
| 227 | - $updir = $basedirectory . DIRECTORY_SEPARATOR . 'attachments_' . $modSettings['last_attachments_directory'][$base_dir]; |
|
| 227 | + $updir = $basedirectory.DIRECTORY_SEPARATOR.'attachments_'.$modSettings['last_attachments_directory'][$base_dir]; |
|
| 228 | 228 | if (automanage_attachments_create_directory($updir)) |
| 229 | 229 | { |
| 230 | 230 | $modSettings['currentAttachmentUploadDir'] = array_search($updir, $modSettings['attachmentUploadDir']); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | if (!$ignore_temp) |
| 364 | 364 | { |
| 365 | 365 | foreach ($_SESSION['temp_attachments'] as $attachID => $attachment) |
| 366 | - if (strpos($attachID, 'post_tmp_' . $user_info['id']) !== false) |
|
| 366 | + if (strpos($attachID, 'post_tmp_'.$user_info['id']) !== false) |
|
| 367 | 367 | unlink($attachment['tmp_name']); |
| 368 | 368 | |
| 369 | 369 | $context['we_are_history'] = $txt['error_temp_attachments_flushed']; |
@@ -412,16 +412,16 @@ discard block |
||
| 412 | 412 | if ($_FILES['attachment']['error'][$n] == 2) |
| 413 | 413 | $errors[] = array('file_too_big', array($modSettings['attachmentSizeLimit'])); |
| 414 | 414 | elseif ($_FILES['attachment']['error'][$n] == 6) |
| 415 | - log_error($_FILES['attachment']['name'][$n] . ': ' . $txt['php_upload_error_6'], 'critical'); |
|
| 415 | + log_error($_FILES['attachment']['name'][$n].': '.$txt['php_upload_error_6'], 'critical'); |
|
| 416 | 416 | else |
| 417 | - log_error($_FILES['attachment']['name'][$n] . ': ' . $txt['php_upload_error_' . $_FILES['attachment']['error'][$n]]); |
|
| 417 | + log_error($_FILES['attachment']['name'][$n].': '.$txt['php_upload_error_'.$_FILES['attachment']['error'][$n]]); |
|
| 418 | 418 | if (empty($errors)) |
| 419 | 419 | $errors[] = 'attach_php_error'; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // Try to move and rename the file before doing any more checks on it. |
| 423 | - $attachID = 'post_tmp_' . $user_info['id'] . '_' . md5(mt_rand()); |
|
| 424 | - $destName = $context['attach_dir'] . '/' . $attachID; |
|
| 423 | + $attachID = 'post_tmp_'.$user_info['id'].'_'.md5(mt_rand()); |
|
| 424 | + $destName = $context['attach_dir'].'/'.$attachID; |
|
| 425 | 425 | if (empty($errors)) |
| 426 | 426 | { |
| 427 | 427 | // The reported MIME type of the attachment might not be reliable. |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | $size = @getimagesize($_SESSION['temp_attachments'][$attachID]['tmp_name']); |
| 516 | 516 | if (isset($context['valid_image_types'][$size[2]])) |
| 517 | 517 | { |
| 518 | - require_once($sourcedir . '/Subs-Graphics.php'); |
|
| 518 | + require_once($sourcedir.'/Subs-Graphics.php'); |
|
| 519 | 519 | if (!checkImageContents($_SESSION['temp_attachments'][$attachID]['tmp_name'], !empty($modSettings['attachment_image_paranoid']))) |
| 520 | 520 | { |
| 521 | 521 | // It's bad. Last chance, maybe we can re-encode it? |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | if (!(empty($size)) && ($size[2] != $old_format)) |
| 533 | 533 | { |
| 534 | 534 | if (isset($context['valid_image_types'][$size[2]])) |
| 535 | - $_SESSION['temp_attachments'][$attachID]['type'] = 'image/' . $context['valid_image_types'][$size[2]]; |
|
| 535 | + $_SESSION['temp_attachments'][$attachID]['type'] = 'image/'.$context['valid_image_types'][$size[2]]; |
|
| 536 | 536 | } |
| 537 | 537 | } |
| 538 | 538 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | if (empty($modSettings['attachment_full_notified']) && !empty($modSettings['attachmentDirSizeLimit']) && $modSettings['attachmentDirSizeLimit'] > 4000 && $context['dir_size'] > ($modSettings['attachmentDirSizeLimit'] - 2000) * 1024 |
| 564 | 564 | || (!empty($modSettings['attachmentDirFileLimit']) && $modSettings['attachmentDirFileLimit'] * .95 < $context['dir_files'] && $modSettings['attachmentDirFileLimit'] > 500)) |
| 565 | 565 | { |
| 566 | - require_once($sourcedir . '/Subs-Admin.php'); |
|
| 566 | + require_once($sourcedir.'/Subs-Admin.php'); |
|
| 567 | 567 | emailAdmins('admin_attachments_full'); |
| 568 | 568 | updateSettings(array('attachment_full_notified' => 1)); |
| 569 | 569 | } |
@@ -577,8 +577,8 @@ discard block |
||
| 577 | 577 | // Move it to the new folder if we can. |
| 578 | 578 | if (automanage_attachments_by_space()) |
| 579 | 579 | { |
| 580 | - rename($_SESSION['temp_attachments'][$attachID]['tmp_name'], $context['attach_dir'] . '/' . $attachID); |
|
| 581 | - $_SESSION['temp_attachments'][$attachID]['tmp_name'] = $context['attach_dir'] . '/' . $attachID; |
|
| 580 | + rename($_SESSION['temp_attachments'][$attachID]['tmp_name'], $context['attach_dir'].'/'.$attachID); |
|
| 581 | + $_SESSION['temp_attachments'][$attachID]['tmp_name'] = $context['attach_dir'].'/'.$attachID; |
|
| 582 | 582 | $_SESSION['temp_attachments'][$attachID]['id_folder'] = $modSettings['currentAttachmentUploadDir']; |
| 583 | 583 | $context['dir_size'] = 0; |
| 584 | 584 | $context['dir_files'] = 0; |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | { |
| 659 | 659 | global $modSettings, $sourcedir, $smcFunc, $context, $txt; |
| 660 | 660 | |
| 661 | - require_once($sourcedir . '/Subs-Graphics.php'); |
|
| 661 | + require_once($sourcedir.'/Subs-Graphics.php'); |
|
| 662 | 662 | |
| 663 | 663 | // If this is an image we need to set a few additional parameters. |
| 664 | 664 | $size = @getimagesize($attachmentOptions['tmp_name']); |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | // Otherwise a valid one? |
| 675 | 675 | elseif (isset($context['valid_image_types'][$size[2]])) |
| 676 | - $attachmentOptions['mime_type'] = 'image/' . $context['valid_image_types'][$size[2]]; |
|
| 676 | + $attachmentOptions['mime_type'] = 'image/'.$context['valid_image_types'][$size[2]]; |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | // It is possible we might have a MIME type that isn't actually an image but still have a size. |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | if (empty($attachmentOptions['fileext'])) |
| 693 | 693 | { |
| 694 | 694 | $attachmentOptions['fileext'] = strtolower(strrpos($attachmentOptions['name'], '.') !== false ? substr($attachmentOptions['name'], strrpos($attachmentOptions['name'], '.') + 1) : ''); |
| 695 | - if (strlen($attachmentOptions['fileext']) > 8 || '.' . $attachmentOptions['fileext'] == $attachmentOptions['name']) |
|
| 695 | + if (strlen($attachmentOptions['fileext']) > 8 || '.'.$attachmentOptions['fileext'] == $attachmentOptions['name']) |
|
| 696 | 696 | $attachmentOptions['fileext'] = ''; |
| 697 | 697 | } |
| 698 | 698 | |
@@ -755,21 +755,21 @@ discard block |
||
| 755 | 755 | if (createThumbnail($attachmentOptions['destination'], $modSettings['attachmentThumbWidth'], $modSettings['attachmentThumbHeight'])) |
| 756 | 756 | { |
| 757 | 757 | // Figure out how big we actually made it. |
| 758 | - $size = @getimagesize($attachmentOptions['destination'] . '_thumb'); |
|
| 758 | + $size = @getimagesize($attachmentOptions['destination'].'_thumb'); |
|
| 759 | 759 | list ($thumb_width, $thumb_height) = $size; |
| 760 | 760 | |
| 761 | 761 | if (!empty($size['mime'])) |
| 762 | 762 | $thumb_mime = $size['mime']; |
| 763 | 763 | elseif (isset($context['valid_image_types'][$size[2]])) |
| 764 | - $thumb_mime = 'image/' . $context['valid_image_types'][$size[2]]; |
|
| 764 | + $thumb_mime = 'image/'.$context['valid_image_types'][$size[2]]; |
|
| 765 | 765 | // Lord only knows how this happened... |
| 766 | 766 | else |
| 767 | 767 | $thumb_mime = ''; |
| 768 | 768 | |
| 769 | - $thumb_filename = $attachmentOptions['name'] . '_thumb'; |
|
| 770 | - $thumb_size = filesize($attachmentOptions['destination'] . '_thumb'); |
|
| 769 | + $thumb_filename = $attachmentOptions['name'].'_thumb'; |
|
| 770 | + $thumb_size = filesize($attachmentOptions['destination'].'_thumb'); |
|
| 771 | 771 | $thumb_file_hash = getAttachmentFilename($thumb_filename, false, null, true); |
| 772 | - $thumb_path = $attachmentOptions['destination'] . '_thumb'; |
|
| 772 | + $thumb_path = $attachmentOptions['destination'].'_thumb'; |
|
| 773 | 773 | |
| 774 | 774 | // We should check the file size and count here since thumbs are added to the existing totals. |
| 775 | 775 | if (!empty($modSettings['automanage_attachments']) && $modSettings['automanage_attachments'] == 1 && !empty($modSettings['attachmentDirSizeLimit']) || !empty($modSettings['attachmentDirFileLimit'])) |
@@ -782,8 +782,8 @@ discard block |
||
| 782 | 782 | { |
| 783 | 783 | if (automanage_attachments_by_space()) |
| 784 | 784 | { |
| 785 | - rename($thumb_path, $context['attach_dir'] . '/' . $thumb_filename); |
|
| 786 | - $thumb_path = $context['attach_dir'] . '/' . $thumb_filename; |
|
| 785 | + rename($thumb_path, $context['attach_dir'].'/'.$thumb_filename); |
|
| 786 | + $thumb_path = $context['attach_dir'].'/'.$thumb_filename; |
|
| 787 | 787 | $context['dir_size'] = 0; |
| 788 | 788 | $context['dir_files'] = 0; |
| 789 | 789 | } |
@@ -792,8 +792,8 @@ discard block |
||
| 792 | 792 | // If a new folder has been already created. Gotta move this thumb there then. |
| 793 | 793 | if ($modSettings['currentAttachmentUploadDir'] != $attachmentOptions['id_folder']) |
| 794 | 794 | { |
| 795 | - rename($thumb_path, $context['attach_dir'] . '/' . $thumb_filename); |
|
| 796 | - $thumb_path = $context['attach_dir'] . '/' . $thumb_filename; |
|
| 795 | + rename($thumb_path, $context['attach_dir'].'/'.$thumb_filename); |
|
| 796 | + $thumb_path = $context['attach_dir'].'/'.$thumb_filename; |
|
| 797 | 797 | } |
| 798 | 798 | |
| 799 | 799 | // To the database we go! |
@@ -910,13 +910,13 @@ discard block |
||
| 910 | 910 | $attachContext = $attachLoaded[$attachID]; |
| 911 | 911 | |
| 912 | 912 | // Fix the url to point out to showAvatar(). |
| 913 | - $attachContext['href'] = $scripturl . '?action=dlattach;attach=' . $attachID . ';type=preview'; |
|
| 913 | + $attachContext['href'] = $scripturl.'?action=dlattach;attach='.$attachID.';type=preview'; |
|
| 914 | 914 | |
| 915 | - $attachContext['link'] = '<a href="' . $scripturl . '?action=dlattach;attach=' . $attachID . ';type=preview' . (empty($attachContext['is_image']) ? ';file' : '') . '">' . $smcFunc['htmlspecialchars']($attachContext['name']) . '</a>'; |
|
| 915 | + $attachContext['link'] = '<a href="'.$scripturl.'?action=dlattach;attach='.$attachID.';type=preview'.(empty($attachContext['is_image']) ? ';file' : '').'">'.$smcFunc['htmlspecialchars']($attachContext['name']).'</a>'; |
|
| 916 | 916 | |
| 917 | 917 | // Fix the thumbnail too, if the image has one. |
| 918 | 918 | if (!empty($attachContext['thumbnail']) && !empty($attachContext['thumbnail']['has_thumb'])) |
| 919 | - $attachContext['thumbnail']['href'] = $scripturl . '?action=dlattach;attach=' . $attachContext['thumbnail']['id'] . ';image;type=preview'; |
|
| 919 | + $attachContext['thumbnail']['href'] = $scripturl.'?action=dlattach;attach='.$attachContext['thumbnail']['id'].';image;type=preview'; |
|
| 920 | 920 | |
| 921 | 921 | return $attachContext; |
| 922 | 922 | } |
@@ -992,9 +992,9 @@ discard block |
||
| 992 | 992 | |
| 993 | 993 | $request = $smcFunc['db_query']('', ' |
| 994 | 994 | SELECT a.id_attach, a.id_msg, a.id_member, a.size, a.mime_type, a.id_folder, a.filename' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ', |
| 995 | - COALESCE(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . ' |
|
| 995 | + COALESCE(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height').' |
|
| 996 | 996 | FROM {db_prefix}attachments AS a' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ' |
| 997 | - LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)') . ' |
|
| 997 | + LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)').' |
|
| 998 | 998 | WHERE a.id_attach IN ({array_int:attach_ids}) |
| 999 | 999 | LIMIT 1', |
| 1000 | 1000 | array( |
@@ -1072,12 +1072,12 @@ discard block |
||
| 1072 | 1072 | SELECT |
| 1073 | 1073 | a.id_attach, a.id_folder, a.id_msg, a.filename, a.file_hash, COALESCE(a.size, 0) AS filesize, a.downloads, a.approved, m.id_topic AS topic, m.id_board AS board, |
| 1074 | 1074 | a.width, a.height' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ', |
| 1075 | - COALESCE(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . ' |
|
| 1075 | + COALESCE(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height').' |
|
| 1076 | 1076 | FROM {db_prefix}attachments AS a' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ' |
| 1077 | - LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)') . ' |
|
| 1077 | + LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)').' |
|
| 1078 | 1078 | LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg) |
| 1079 | 1079 | WHERE a.attachment_type = {int:attachment_type} |
| 1080 | - '. (!empty($msgID) ? 'AND a.id_msg = {int:message_id}' : '') . '', |
|
| 1080 | + '. (!empty($msgID) ? 'AND a.id_msg = {int:message_id}' : '').'', |
|
| 1081 | 1081 | array( |
| 1082 | 1082 | 'message_id' => $msgID, |
| 1083 | 1083 | 'attachment_type' => 0, |
@@ -1131,10 +1131,10 @@ discard block |
||
| 1131 | 1131 | 'id' => $attachment['id_attach'], |
| 1132 | 1132 | 'name' => preg_replace('~&#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', $smcFunc['htmlspecialchars']($attachment['filename'])), |
| 1133 | 1133 | 'downloads' => $attachment['downloads'], |
| 1134 | - 'size' => ($attachment['filesize'] < 1024000) ? round($attachment['filesize'] / 1024, 2) . ' ' . $txt['kilobyte'] : round($attachment['filesize'] / 1024 / 1024, 2) . ' ' . $txt['megabyte'], |
|
| 1134 | + 'size' => ($attachment['filesize'] < 1024000) ? round($attachment['filesize'] / 1024, 2).' '.$txt['kilobyte'] : round($attachment['filesize'] / 1024 / 1024, 2).' '.$txt['megabyte'], |
|
| 1135 | 1135 | 'byte_size' => $attachment['filesize'], |
| 1136 | - 'href' => $scripturl . '?action=dlattach;topic=' . $attachment['topic'] . '.0;attach=' . $attachment['id_attach'], |
|
| 1137 | - 'link' => '<a href="' . $scripturl . '?action=dlattach;topic=' . $attachment['topic'] . '.0;attach=' . $attachment['id_attach'] . '">' . $smcFunc['htmlspecialchars']($attachment['filename']) . '</a>', |
|
| 1136 | + 'href' => $scripturl.'?action=dlattach;topic='.$attachment['topic'].'.0;attach='.$attachment['id_attach'], |
|
| 1137 | + 'link' => '<a href="'.$scripturl.'?action=dlattach;topic='.$attachment['topic'].'.0;attach='.$attachment['id_attach'].'">'.$smcFunc['htmlspecialchars']($attachment['filename']).'</a>', |
|
| 1138 | 1138 | 'is_image' => !empty($attachment['width']) && !empty($attachment['height']) && !empty($modSettings['attachmentShowImages']), |
| 1139 | 1139 | 'is_approved' => $attachment['approved'], |
| 1140 | 1140 | 'topic' => $attachment['topic'], |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | { |
| 1162 | 1162 | $filename = getAttachmentFilename($attachment['filename'], $attachment['id_attach'], $attachment['id_folder']); |
| 1163 | 1163 | |
| 1164 | - require_once($sourcedir . '/Subs-Graphics.php'); |
|
| 1164 | + require_once($sourcedir.'/Subs-Graphics.php'); |
|
| 1165 | 1165 | if (createThumbnail($filename, $modSettings['attachmentThumbWidth'], $modSettings['attachmentThumbHeight'])) |
| 1166 | 1166 | { |
| 1167 | 1167 | // So what folder are we putting this image in? |
@@ -1177,9 +1177,9 @@ discard block |
||
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | // Calculate the size of the created thumbnail. |
| 1180 | - $size = @getimagesize($filename . '_thumb'); |
|
| 1180 | + $size = @getimagesize($filename.'_thumb'); |
|
| 1181 | 1181 | list ($attachment['thumb_width'], $attachment['thumb_height']) = $size; |
| 1182 | - $thumb_size = filesize($filename . '_thumb'); |
|
| 1182 | + $thumb_size = filesize($filename.'_thumb'); |
|
| 1183 | 1183 | |
| 1184 | 1184 | // What about the extension? |
| 1185 | 1185 | $thumb_ext = isset($context['valid_image_types'][$size[2]]) ? $context['valid_image_types'][$size[2]] : ''; |
@@ -1188,9 +1188,9 @@ discard block |
||
| 1188 | 1188 | if (!empty($size['mime'])) |
| 1189 | 1189 | $thumb_mime = $size['mime']; |
| 1190 | 1190 | else |
| 1191 | - $thumb_mime = 'image/' . $thumb_ext; |
|
| 1191 | + $thumb_mime = 'image/'.$thumb_ext; |
|
| 1192 | 1192 | |
| 1193 | - $thumb_filename = $attachment['filename'] . '_thumb'; |
|
| 1193 | + $thumb_filename = $attachment['filename'].'_thumb'; |
|
| 1194 | 1194 | $thumb_hash = getAttachmentFilename($thumb_filename, false, null, true); |
| 1195 | 1195 | $old_id_thumb = $attachment['id_thumb']; |
| 1196 | 1196 | |
@@ -1216,12 +1216,12 @@ discard block |
||
| 1216 | 1216 | ); |
| 1217 | 1217 | |
| 1218 | 1218 | $thumb_realname = getAttachmentFilename($thumb_filename, $attachment['id_thumb'], $id_folder_thumb, false, $thumb_hash); |
| 1219 | - rename($filename . '_thumb', $thumb_realname); |
|
| 1219 | + rename($filename.'_thumb', $thumb_realname); |
|
| 1220 | 1220 | |
| 1221 | 1221 | // Do we need to remove an old thumbnail? |
| 1222 | 1222 | if (!empty($old_id_thumb)) |
| 1223 | 1223 | { |
| 1224 | - require_once($sourcedir . '/ManageAttachments.php'); |
|
| 1224 | + require_once($sourcedir.'/ManageAttachments.php'); |
|
| 1225 | 1225 | removeAttachments(array('id_attach' => $old_id_thumb), '', false, false); |
| 1226 | 1226 | } |
| 1227 | 1227 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | if (!empty($attachment['id_thumb'])) |
| 1240 | 1240 | $attachmentData[$i]['thumbnail'] = array( |
| 1241 | 1241 | 'id' => $attachment['id_thumb'], |
| 1242 | - 'href' => $scripturl . '?action=dlattach;topic=' . $attachment['topic'] . '.0;attach=' . $attachment['id_thumb'] . ';image', |
|
| 1242 | + 'href' => $scripturl.'?action=dlattach;topic='.$attachment['topic'].'.0;attach='.$attachment['id_thumb'].';image', |
|
| 1243 | 1243 | ); |
| 1244 | 1244 | $attachmentData[$i]['thumbnail']['has_thumb'] = !empty($attachment['id_thumb']); |
| 1245 | 1245 | |
@@ -1261,9 +1261,9 @@ discard block |
||
| 1261 | 1261 | { |
| 1262 | 1262 | // If the image is too large to show inline, make it a popup. |
| 1263 | 1263 | if (((!empty($modSettings['max_image_width']) && $attachmentData[$i]['real_width'] > $modSettings['max_image_width']) || (!empty($modSettings['max_image_height']) && $attachmentData[$i]['real_height'] > $modSettings['max_image_height']))) |
| 1264 | - $attachmentData[$i]['thumbnail']['javascript'] = 'return reqWin(\'' . $attachmentData[$i]['href'] . ';image\', ' . ($attachment['width'] + 20) . ', ' . ($attachment['height'] + 20) . ', true);'; |
|
| 1264 | + $attachmentData[$i]['thumbnail']['javascript'] = 'return reqWin(\''.$attachmentData[$i]['href'].';image\', '.($attachment['width'] + 20).', '.($attachment['height'] + 20).', true);'; |
|
| 1265 | 1265 | else |
| 1266 | - $attachmentData[$i]['thumbnail']['javascript'] = 'return expandThumb(' . $attachment['id_attach'] . ');'; |
|
| 1266 | + $attachmentData[$i]['thumbnail']['javascript'] = 'return expandThumb('.$attachment['id_attach'].');'; |
|
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | if (!$attachmentData[$i]['thumbnail']['has_thumb']) |