@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | 'if (!is_dir(realpath($cachedir)) && is_dir($boarddir . \'/cache\'))', |
857 | 857 | ' $cachedir = $boarddir . \'/cache\';', |
858 | 858 | )), |
859 | - 'search_pattern' => '~\n?(#[^\n]+)?(?:\n\h*if\s*\((?:\!file_exists\(\$(?'.'>boarddir|sourcedir|tasksdir|packagesdir|cachedir)\)|\!is_dir\(realpath\(\$(?'.'>boarddir|sourcedir|tasksdir|packagesdir|cachedir)\)\))[^;]+\n\h*\$(?'.'>boarddir|sourcedir|tasksdir|packagesdir|cachedir)[^\n]+;)+~sm', |
|
859 | + 'search_pattern' => '~\n?(#[^\n]+)?(?:\n\h*if\s*\((?:\!file_exists\(\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)\)|\!is_dir\(realpath\(\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)\)\))[^;]+\n\h*\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)[^\n]+;)+~sm', |
|
860 | 860 | ), |
861 | 861 | 'db_character_set' => array( |
862 | 862 | 'text' => implode("\n", array( |
@@ -955,8 +955,8 @@ discard block |
||
955 | 955 | 'boolean' => '(?i:TRUE|FALSE|(["\']?)[01]\b\\1)', |
956 | 956 | 'NULL' => '(?i:NULL)', |
957 | 957 | // These use a PCRE subroutine to match nested arrays. |
958 | - 'array' => 'array\s*(\((?'.'>[^()]|(?1))*\))', |
|
959 | - 'object' => '\w+::__set_state\(array\s*(\((?'.'>[^()]|(?1))*\))\)', |
|
958 | + 'array' => 'array\s*(\((?' . '>[^()]|(?1))*\))', |
|
959 | + 'object' => '\w+::__set_state\(array\s*(\((?' . '>[^()]|(?1))*\))\)', |
|
960 | 960 | ); |
961 | 961 | |
962 | 962 | /* |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | ), |
990 | 990 | // Remove the code that redirects to the installer. |
991 | 991 | $neg_index-- => array( |
992 | - 'search_pattern' => '~^if\s*\(file_exists\(dirname\(__FILE__\)\s*\.\s*\'/install\.php\'\)\)\s*(?:({(?'.'>[^{}]|(?1))*})\h*|header(\((?' . '>[^()]|(?2))*\));\n)~m', |
|
992 | + 'search_pattern' => '~^if\s*\(file_exists\(dirname\(__FILE__\)\s*\.\s*\'/install\.php\'\)\)\s*(?:({(?' . '>[^{}]|(?1))*})\h*|header(\((?' . '>[^()]|(?2))*\));\n)~m', |
|
993 | 993 | 'placeholder' => '', |
994 | 994 | ), |
995 | 995 | ); |
@@ -1752,7 +1752,7 @@ discard block |
||
1752 | 1752 | // Prevents warnings about constants that are already defined. |
1753 | 1753 | $settingsText = preg_replace_callback( |
1754 | 1754 | '~\bdefine\s*\(\s*(["\'])(\w+)\1~', |
1755 | - function ($matches) |
|
1755 | + function($matches) |
|
1756 | 1756 | { |
1757 | 1757 | return 'define(\'' . md5(mt_rand()) . '\''; |
1758 | 1758 | }, |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | // Handle eval errors gracefully in both PHP 5 and PHP 7 |
1763 | 1763 | try |
1764 | 1764 | { |
1765 | - if($settingsText !== '' && @eval($settingsText) === false) |
|
1765 | + if ($settingsText !== '' && @eval($settingsText) === false) |
|
1766 | 1766 | throw new ErrorException('eval error'); |
1767 | 1767 | |
1768 | 1768 | unset($mtime, $settingsFile, $settingsText); |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | } |
1966 | 1966 | |
1967 | 1967 | // Everything is simpler if we convert heredocs to normal strings first. |
1968 | - if (preg_match_all('/<<<(\'?)(\w+)\'?'. $line_ending . '(.*?)'. $line_ending . '\2;$/m', $code_str, $matches)) |
|
1968 | + if (preg_match_all('/<<<(\'?)(\w+)\'?' . $line_ending . '(.*?)' . $line_ending . '\2;$/m', $code_str, $matches)) |
|
1969 | 1969 | { |
1970 | 1970 | foreach ($matches[0] as $mkey => $heredoc) |
1971 | 1971 | { |
@@ -1979,7 +1979,7 @@ discard block |
||
1979 | 1979 | } |
1980 | 1980 | |
1981 | 1981 | // Split before everything that could possibly delimit a comment or a string. |
1982 | - $parts = preg_split('~(?=#+|/(?=/|\*)|\*/|'. $line_ending . '|(?<!\\\)[\'"])~m', $code_str); |
|
1982 | + $parts = preg_split('~(?=#+|/(?=/|\*)|\*/|' . $line_ending . '|(?<!\\\)[\'"])~m', $code_str); |
|
1983 | 1983 | |
1984 | 1984 | $in_string = 0; |
1985 | 1985 | $in_comment = 0; |
@@ -2718,8 +2718,7 @@ discard block |
||
2718 | 2718 | $context['css_files_order'] = array(); |
2719 | 2719 | |
2720 | 2720 | $params['seed'] = (!array_key_exists('seed', $params) || (array_key_exists('seed', $params) && $params['seed'] === true)) ? |
2721 | - (array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') : |
|
2722 | - (is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : ''); |
|
2721 | + (array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') : (is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : ''); |
|
2723 | 2722 | $params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false; |
2724 | 2723 | $themeRef = !empty($params['default_theme']) ? 'default_theme' : 'theme'; |
2725 | 2724 | $params['minimize'] = isset($params['minimize']) ? $params['minimize'] : true; |
@@ -2833,8 +2832,7 @@ discard block |
||
2833 | 2832 | global $settings, $context, $modSettings; |
2834 | 2833 | |
2835 | 2834 | $params['seed'] = (!array_key_exists('seed', $params) || (array_key_exists('seed', $params) && $params['seed'] === true)) ? |
2836 | - (array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') : |
|
2837 | - (is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : ''); |
|
2835 | + (array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') : (is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : ''); |
|
2838 | 2836 | $params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false; |
2839 | 2837 | $themeRef = !empty($params['default_theme']) ? 'default_theme' : 'theme'; |
2840 | 2838 | $params['async'] = isset($params['async']) ? $params['async'] : false; |
@@ -3577,8 +3575,7 @@ discard block |
||
3577 | 3575 | |
3578 | 3576 | // What accelerator we are going to try. |
3579 | 3577 | $cache_class_name = !empty($cache_accelerator) ? $cache_accelerator : CacheApi::APIS_DEFAULT; |
3580 | - $fully_qualified_class_name = !empty($overrideCache) ? $overrideCache : |
|
3581 | - CacheApi::APIS_NAMESPACE . $cache_class_name; |
|
3578 | + $fully_qualified_class_name = !empty($overrideCache) ? $overrideCache : CacheApi::APIS_NAMESPACE . $cache_class_name; |
|
3582 | 3579 | |
3583 | 3580 | // Do some basic tests. |
3584 | 3581 | if (class_exists($fully_qualified_class_name)) |
@@ -3882,7 +3879,7 @@ discard block |
||
3882 | 3879 | $auth_secret = hash_file('sha256', $boarddir . '/Settings.php'); |
3883 | 3880 | |
3884 | 3881 | // Set the last error to now, but only every 15 minutes. Don't need to flood the logs. |
3885 | - if (empty($db_last_error) || ($db_last_error + 60*15) <= time()) |
|
3882 | + if (empty($db_last_error) || ($db_last_error + 60 * 15) <= time()) |
|
3886 | 3883 | { |
3887 | 3884 | updateDbLastError(time()); |
3888 | 3885 | loadLanguage('Errors'); |
@@ -1704,7 +1704,7 @@ |
||
1704 | 1704 | // Missing, but we have a fallback. |
1705 | 1705 | else |
1706 | 1706 | { |
1707 | - usort($fallbacks[$tzid], function ($a, $b) { |
|
1707 | + usort($fallbacks[$tzid], function($a, $b) { |
|
1708 | 1708 | return $a['ts'] > $b['ts']; |
1709 | 1709 | }); |
1710 | 1710 |
@@ -1704,7 +1704,8 @@ |
||
1704 | 1704 | // Missing, but we have a fallback. |
1705 | 1705 | else |
1706 | 1706 | { |
1707 | - usort($fallbacks[$tzid], function ($a, $b) { |
|
1707 | + usort($fallbacks[$tzid], function ($a, $b) |
|
1708 | + { |
|
1708 | 1709 | return $a['ts'] > $b['ts']; |
1709 | 1710 | }); |
1710 | 1711 |