@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | 'if (!is_dir(realpath($cachedir)) && is_dir($boarddir . \'/cache\'))', |
847 | 847 | ' $cachedir = $boarddir . \'/cache\';', |
848 | 848 | )), |
849 | - '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', |
|
849 | + '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', |
|
850 | 850 | ), |
851 | 851 | 'db_character_set' => array( |
852 | 852 | 'text' => implode("\n", array( |
@@ -945,8 +945,8 @@ discard block |
||
945 | 945 | 'boolean' => '(?i:TRUE|FALSE|(["\']?)[01]\b\\1)', |
946 | 946 | 'NULL' => '(?i:NULL)', |
947 | 947 | // These use a PCRE subroutine to match nested arrays. |
948 | - 'array' => 'array\s*(\((?'.'>[^()]|(?1))*\))', |
|
949 | - 'object' => '\w+::__set_state\(array\s*(\((?'.'>[^()]|(?1))*\))\)', |
|
948 | + 'array' => 'array\s*(\((?' . '>[^()]|(?1))*\))', |
|
949 | + 'object' => '\w+::__set_state\(array\s*(\((?' . '>[^()]|(?1))*\))\)', |
|
950 | 950 | ); |
951 | 951 | |
952 | 952 | /* |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | ), |
980 | 980 | // Remove the code that redirects to the installer. |
981 | 981 | $neg_index-- => array( |
982 | - 'search_pattern' => '~^if\s*\(file_exists\(dirname\(__FILE__\)\s*\.\s*\'/install\.php\'\)\)\s*(?:({(?'.'>[^{}]|(?1))*})\h*|header(\((?' . '>[^()]|(?2))*\));\n)~m', |
|
982 | + 'search_pattern' => '~^if\s*\(file_exists\(dirname\(__FILE__\)\s*\.\s*\'/install\.php\'\)\)\s*(?:({(?' . '>[^{}]|(?1))*})\h*|header(\((?' . '>[^()]|(?2))*\));\n)~m', |
|
983 | 983 | 'placeholder' => '', |
984 | 984 | ), |
985 | 985 | ); |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | // Prevents warnings about constants that are already defined. |
1743 | 1743 | $settingsText = preg_replace_callback( |
1744 | 1744 | '~\bdefine\s*\(\s*(["\'])(\w+)\1~', |
1745 | - function ($matches) |
|
1745 | + function($matches) |
|
1746 | 1746 | { |
1747 | 1747 | return 'define(\'' . md5(mt_rand()) . '\''; |
1748 | 1748 | }, |
@@ -1752,7 +1752,7 @@ discard block |
||
1752 | 1752 | // Handle eval errors gracefully in both PHP 5 and PHP 7 |
1753 | 1753 | try |
1754 | 1754 | { |
1755 | - if($settingsText !== '' && @eval($settingsText) === false) |
|
1755 | + if ($settingsText !== '' && @eval($settingsText) === false) |
|
1756 | 1756 | throw new ErrorException('eval error'); |
1757 | 1757 | |
1758 | 1758 | unset($mtime, $settingsFile, $settingsText); |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | } |
1956 | 1956 | |
1957 | 1957 | // Everything is simpler if we convert heredocs to normal strings first. |
1958 | - if (preg_match_all('/<<<(\'?)(\w+)\'?'. $line_ending . '(.*?)'. $line_ending . '\2;$/m', $code_str, $matches)) |
|
1958 | + if (preg_match_all('/<<<(\'?)(\w+)\'?' . $line_ending . '(.*?)' . $line_ending . '\2;$/m', $code_str, $matches)) |
|
1959 | 1959 | { |
1960 | 1960 | foreach ($matches[0] as $mkey => $heredoc) |
1961 | 1961 | { |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | } |
1970 | 1970 | |
1971 | 1971 | // Split before everything that could possibly delimit a comment or a string. |
1972 | - $parts = preg_split('~(?=#+|/(?=/|\*)|\*/|'. $line_ending . '|(?<!\\\)[\'"])~m', $code_str); |
|
1972 | + $parts = preg_split('~(?=#+|/(?=/|\*)|\*/|' . $line_ending . '|(?<!\\\)[\'"])~m', $code_str); |
|
1973 | 1973 | |
1974 | 1974 | $in_string = 0; |
1975 | 1975 | $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'); |