| @@ -89,7 +89,9 @@ | ||
| 89 | 89 |  						<li><a href="#" onclick="showSSIBlock('ssi_quickSearch'); return false;">Quick Search Box</a></li> | 
| 90 | 90 |  						<li><a href="#" onclick="showSSIBlock('ssi_recentAttachments'); return false;">Recent Attachments</a></li> | 
| 91 | 91 | </ul> | 
| 92 | -					<?php if ($user_info['is_admin']) { ?> | |
| 92 | + <?php if ($user_info['is_admin']) | |
| 93 | +{ | |
| 94 | +?> | |
| 93 | 95 | <h3>Advanced Functions <img class="help" title="Functions that require additional tweaking, not just copy and paste." src="<?php echo $settings['images_url']; ?>/helptopics.png" alt=""></h3> | 
| 94 | 96 | <ul> | 
| 95 | 97 |  						<li><a href="#" onclick="showSSIBlock('ssi_showPoll'); return false;">Show Single Poll</a></li> | 
| @@ -419,7 +419,7 @@ | ||
| 419 | 419 | |
| 420 | 420 | if (checkImagick()) | 
| 421 | 421 |  		{ | 
| 422 | - $imagick = New Imagick($destName); | |
| 422 | + $imagick = new Imagick($destName); | |
| 423 | 423 | $src_width = empty($src_width) ? $imagick->getImageWidth() : $src_width; | 
| 424 | 424 | $src_height = empty($src_height) ? $imagick->getImageHeight() : $src_height; | 
| 425 | 425 | $dest_width = empty($max_width) ? $src_width : $max_width; | 
| @@ -41,7 +41,7 @@ | ||
| 41 | 41 |  	{ | 
| 42 | 42 |  		if (class_exists('Imagick')) | 
| 43 | 43 |  		{ | 
| 44 | - $temp = New Imagick; | |
| 44 | + $temp = new Imagick; | |
| 45 | 45 | $temp2 = $temp->getVersion(); | 
| 46 | 46 | $im_version = $temp2['versionString']; | 
| 47 | 47 |  			$extension_version = 'Imagick ' . phpversion('Imagick'); | 
| @@ -859,7 +859,7 @@ discard block | ||
| 859 | 859 | 'if (!is_dir(realpath($cachedir)) && is_dir($boarddir . \'/cache\'))', | 
| 860 | 860 | ' $cachedir = $boarddir . \'/cache\';', | 
| 861 | 861 | )), | 
| 862 | - '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', | |
| 862 | + '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', | |
| 863 | 863 | ), | 
| 864 | 864 | 'db_character_set' => array( | 
| 865 | 865 |  			'text' => implode("\n", array( | 
| @@ -958,8 +958,8 @@ discard block | ||
| 958 | 958 | 'boolean' => '(?i:TRUE|FALSE|(["\']?)[01]\b\\1)', | 
| 959 | 959 | 'NULL' => '(?i:NULL)', | 
| 960 | 960 | // These use a PCRE subroutine to match nested arrays. | 
| 961 | - 'array' => 'array\s*(\((?'.'>[^()]|(?1))*\))', | |
| 962 | - 'object' => '\w+::__set_state\(array\s*(\((?'.'>[^()]|(?1))*\))\)', | |
| 961 | + 'array' => 'array\s*(\((?' . '>[^()]|(?1))*\))', | |
| 962 | + 'object' => '\w+::__set_state\(array\s*(\((?' . '>[^()]|(?1))*\))\)', | |
| 963 | 963 | ); | 
| 964 | 964 | |
| 965 | 965 | /* | 
| @@ -992,7 +992,7 @@ discard block | ||
| 992 | 992 | ), | 
| 993 | 993 | // Remove the code that redirects to the installer. | 
| 994 | 994 | $neg_index-- => array( | 
| 995 | -			'search_pattern' => '~^if\s*\(file_exists\(dirname\(__FILE__\)\s*\.\s*\'/install\.php\'\)\)\s*(?:({(?'.'>[^{}]|(?1))*})\h*|header(\((?' . '>[^()]|(?2))*\));\n)~m', | |
| 995 | +			'search_pattern' => '~^if\s*\(file_exists\(dirname\(__FILE__\)\s*\.\s*\'/install\.php\'\)\)\s*(?:({(?' . '>[^{}]|(?1))*})\h*|header(\((?' . '>[^()]|(?2))*\));\n)~m', | |
| 996 | 996 | 'placeholder' => '', | 
| 997 | 997 | ), | 
| 998 | 998 | ); | 
| @@ -1755,7 +1755,7 @@ discard block | ||
| 1755 | 1755 | // Prevents warnings about constants that are already defined. | 
| 1756 | 1756 | $settingsText = preg_replace_callback( | 
| 1757 | 1757 | '~\bdefine\s*\(\s*(["\'])(\w+)\1~', | 
| 1758 | - function ($matches) | |
| 1758 | + function($matches) | |
| 1759 | 1759 |  		{ | 
| 1760 | 1760 | return 'define(\'' . md5(mt_rand()) . '\''; | 
| 1761 | 1761 | }, | 
| @@ -1765,7 +1765,7 @@ discard block | ||
| 1765 | 1765 | // Handle eval errors gracefully in both PHP 5 and PHP 7 | 
| 1766 | 1766 | try | 
| 1767 | 1767 |  	{ | 
| 1768 | - if($settingsText !== '' && @eval($settingsText) === false) | |
| 1768 | + if ($settingsText !== '' && @eval($settingsText) === false) | |
| 1769 | 1769 |  			throw new ErrorException('eval error'); | 
| 1770 | 1770 | |
| 1771 | 1771 | unset($mtime, $settingsFile, $settingsText); | 
| @@ -1234,7 +1234,8 @@ discard block | ||
| 1234 | 1234 | // It's important to do the numbered ones before the named ones, or messes happen. | 
| 1235 | 1235 | uksort( | 
| 1236 | 1236 | $substitutions, | 
| 1237 | -		function($a, $b) { | |
| 1237 | + function($a, $b) | |
| 1238 | +		{ | |
| 1238 | 1239 | if (is_int($a) && is_int($b)) | 
| 1239 | 1240 | return $a > $b ? 1 : ($a < $b ? -1 : 0); | 
| 1240 | 1241 | elseif (is_int($a)) | 
| @@ -1774,8 +1775,12 @@ discard block | ||
| 1774 | 1775 | unset($mtime, $settingsFile, $settingsText); | 
| 1775 | 1776 | $defined_vars = get_defined_vars(); | 
| 1776 | 1777 | } | 
| 1777 | -	catch (Throwable $e) {} | |
| 1778 | -	catch (ErrorException $e) {} | |
| 1778 | + catch (Throwable $e) | |
| 1779 | +	{ | |
| 1780 | +} | |
| 1781 | + catch (ErrorException $e) | |
| 1782 | +	{ | |
| 1783 | +} | |
| 1779 | 1784 | if (isset($e)) | 
| 1780 | 1785 | return false; | 
| 1781 | 1786 | |
| @@ -1973,7 +1978,8 @@ discard block | ||
| 1973 | 1978 |  			{ | 
| 1974 | 1979 | list($id, $text) = $token; | 
| 1975 | 1980 | |
| 1976 | -				switch ($id) { | |
| 1981 | + switch ($id) | |
| 1982 | +				{ | |
| 1977 | 1983 | case T_COMMENT: | 
| 1978 | 1984 | case T_DOC_COMMENT: | 
| 1979 | 1985 | end($parts); | 
| @@ -2310,7 +2316,8 @@ discard block | ||
| 2310 | 2316 | // Search for a working temp directory. | 
| 2311 | 2317 | foreach ($temp_dir_options as $id_temp => $temp_option) | 
| 2312 | 2318 |  	{ | 
| 2313 | -		switch ($temp_option) { | |
| 2319 | + switch ($temp_option) | |
| 2320 | +		{ | |
| 2314 | 2321 | case 'cachedir': | 
| 2315 | 2322 | $possible_temp = rtrim($cachedir, '/'); | 
| 2316 | 2323 | break; | 
| @@ -1364,7 +1364,6 @@ | ||
| 1364 | 1364 | // return all the info. | 
| 1365 | 1365 | return $context['to_install']; | 
| 1366 | 1366 | } | 
| 1367 | - | |
| 1368 | 1367 | else | 
| 1369 | 1368 |  		fatal_lang_error('theme_install_error_title', false); | 
| 1370 | 1369 | } | 
| @@ -222,7 +222,6 @@ | ||
| 222 | 222 | |
| 223 | 223 |  			$this->_validLikes['can_like'] = ($this->_user['id'] == $topicOwner ? 'cannot_like_content' : (allowedTo('likes_like') ? true : 'cannot_like_content')); | 
| 224 | 224 | } | 
| 225 | - | |
| 226 | 225 | else | 
| 227 | 226 |  		{ | 
| 228 | 227 | // Modders: This will give you whatever the user offers up in terms of liking, e.g. $this->_type=msg, $this->_content=1 | 
| @@ -199,7 +199,6 @@ | ||
| 199 | 199 | list ($context['attachments']['quantity'], $context['attachments']['total_size']) = $smcFunc['db_fetch_row']($request); | 
| 200 | 200 | $smcFunc['db_free_result']($request); | 
| 201 | 201 | } | 
| 202 | - | |
| 203 | 202 | else | 
| 204 | 203 | $context['attachments'] = array( | 
| 205 | 204 | 'quantity' => 0, | 
| @@ -93,7 +93,6 @@ | ||
| 93 | 93 | |
| 94 | 94 | continue; | 
| 95 | 95 | } | 
| 96 | - | |
| 97 | 96 | elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) | 
| 98 | 97 |  		{ | 
| 99 | 98 | // Just increase the stats and don't add this hidden user to any list. | 
| @@ -881,7 +881,6 @@ discard block | ||
| 881 | 881 | $is_writable = true; | 
| 882 | 882 | break; | 
| 883 | 883 | } | 
| 884 | - | |
| 885 | 884 | else | 
| 886 | 885 |  			{ | 
| 887 | 886 |  				// Convert the chmod value from octal (0777) to text ("777"). | 
| @@ -935,8 +934,9 @@ discard block | ||
| 935 | 934 |  	{ | 
| 936 | 935 | // Wait for a response that isn't continued with -, but don't wait too long. | 
| 937 | 936 | $time = time(); | 
| 938 | - do | |
| 939 | - $this->last_message = fgets($this->connection, 1024); | |
| 937 | +		do { | |
| 938 | + $this->last_message = fgets($this->connection, 1024); | |
| 939 | + } | |
| 940 | 940 | while ((strlen($this->last_message) < 4 || strpos($this->last_message, ' ') === 0 || strpos($this->last_message, ' ', 3) !== 3) && time() - $time < 5); | 
| 941 | 941 | |
| 942 | 942 | // Was the desired response returned? | 
| @@ -957,8 +957,9 @@ discard block | ||
| 957 | 957 | // Request a passive connection - this means, we'll talk to you, you don't talk to us. | 
| 958 | 958 | @fwrite($this->connection, 'PASV' . "\r\n"); | 
| 959 | 959 | $time = time(); | 
| 960 | - do | |
| 961 | - $response = fgets($this->connection, 1024); | |
| 960 | +		do { | |
| 961 | + $response = fgets($this->connection, 1024); | |
| 962 | + } | |
| 962 | 963 | while (strpos($response, ' ', 3) !== 3 && time() - $time < 5); | 
| 963 | 964 | |
| 964 | 965 | // If it's not 227, we weren't given an IP and port, which means it failed. | 
| @@ -1080,8 +1081,9 @@ discard block | ||
| 1080 | 1081 | |
| 1081 | 1082 | @fwrite($this->connection, 'PWD' . "\r\n"); | 
| 1082 | 1083 | $time = time(); | 
| 1083 | - do | |
| 1084 | - $response = fgets($this->connection, 1024); | |
| 1084 | +		do { | |
| 1085 | + $response = fgets($this->connection, 1024); | |
| 1086 | + } | |
| 1085 | 1087 | while ($response[3] != ' ' && time() - $time < 5); | 
| 1086 | 1088 | |
| 1087 | 1089 | // Check for 257! | 
| @@ -3219,7 +3219,7 @@ discard block | ||
| 3219 | 3219 | // Deleting an existing label? | 
| 3220 | 3220 | elseif (isset($_POST['delete'], $_POST['delete_label'])) | 
| 3221 | 3221 |  		{ | 
| 3222 | - foreach ($_POST['delete_label'] AS $label => $dummy) | |
| 3222 | + foreach ($_POST['delete_label'] as $label => $dummy) | |
| 3223 | 3223 |  			{ | 
| 3224 | 3224 | unset($the_labels[$label]); | 
| 3225 | 3225 | $labels_to_remove[] = $label; | 
| @@ -3260,7 +3260,7 @@ discard block | ||
| 3260 | 3260 | if (!empty($labels_to_add)) | 
| 3261 | 3261 |  		{ | 
| 3262 | 3262 | $inserts = array(); | 
| 3263 | - foreach ($labels_to_add AS $label) | |
| 3263 | + foreach ($labels_to_add as $label) | |
| 3264 | 3264 | $inserts[] = array($user_info['id'], $label); | 
| 3265 | 3265 | |
| 3266 | 3266 |  			$smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'string-30'), $inserts, array()); | 
| @@ -3269,7 +3269,7 @@ discard block | ||
| 3269 | 3269 | // Update existing labels as needed | 
| 3270 | 3270 | if (!empty($label_upates)) | 
| 3271 | 3271 |  		{ | 
| 3272 | - foreach ($label_updates AS $id => $name) | |
| 3272 | + foreach ($label_updates as $id => $name) | |
| 3273 | 3273 |  			{ | 
| 3274 | 3274 |  				$smcFunc['db_query']('', ' | 
| 3275 | 3275 |  					UPDATE {db_prefix}labels |