@@ -1996,7 +1996,9 @@ |
||
| 1996 | 1996 | // Remove anything that isn't actually new from our list of files |
| 1997 | 1997 | foreach ($to_unset as $key => $ids) |
| 1998 | 1998 | { |
| 1999 | - if (array_reduce($ids, function($carry, $item) { return $carry * $item; }, true) == true) |
|
| 1999 | + if (array_reduce($ids, function($carry, $item) |
|
| 2000 | + { |
|
| 2001 | +return $carry * $item; }, true) == true) |
|
| 2000 | 2002 | unset($smiley_files[$key]); |
| 2001 | 2003 | } |
| 2002 | 2004 | |
@@ -3244,7 +3244,9 @@ |
||
| 3244 | 3244 | return $string; |
| 3245 | 3245 | |
| 3246 | 3246 | // This bit fixes incorrect string lengths, which can happen if the character encoding was changed (e.g. conversion to UTF-8) |
| 3247 | - $new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function($matches) {return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";'; }, $string); |
|
| 3247 | + $new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function($matches) |
|
| 3248 | + { |
|
| 3249 | +return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";'; }, $string); |
|
| 3248 | 3250 | |
| 3249 | 3251 | // @todo Add more possible fixes here. For example, fix incorrect array lengths, try to handle truncated strings gracefully, etc. |
| 3250 | 3252 | |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | 'tag' => 'cowsay', |
| 2160 | 2160 | 'parameters' => array( |
| 2161 | 2161 | 'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc) |
| 2162 | - { |
|
| 2162 | + { |
|
| 2163 | 2163 | static $css_added; |
| 2164 | 2164 | |
| 2165 | 2165 | if (empty($css_added)) |
@@ -2176,7 +2176,7 @@ discard block |
||
| 2176 | 2176 | }, |
| 2177 | 2177 | ), |
| 2178 | 2178 | 't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => ' ', 'validate' => function ($tongue) use ($smcFunc) |
| 2179 | - { |
|
| 2179 | + { |
|
| 2180 | 2180 | return $smcFunc['substr']($tongue . ' ', 0, 2); |
| 2181 | 2181 | }, |
| 2182 | 2182 | ), |
@@ -3274,7 +3274,7 @@ discard block |
||
| 3274 | 3274 | |
| 3275 | 3275 | // Replace away! |
| 3276 | 3276 | $message = preg_replace_callback($smileyPregSearch, function($matches) use ($smileyPregReplacements) |
| 3277 | - { |
|
| 3277 | + { |
|
| 3278 | 3278 | return $smileyPregReplacements[$matches[1]]; |
| 3279 | 3279 | }, $message); |
| 3280 | 3280 | } |
@@ -941,8 +941,9 @@ discard block |
||
| 941 | 941 | { |
| 942 | 942 | // Wait for a response that isn't continued with -, but don't wait too long. |
| 943 | 943 | $time = time(); |
| 944 | - do |
|
| 945 | - $this->last_message = fgets($this->connection, 1024); |
|
| 944 | + do { |
|
| 945 | + $this->last_message = fgets($this->connection, 1024); |
|
| 946 | + } |
|
| 946 | 947 | while ((strlen($this->last_message) < 4 || strpos($this->last_message, ' ') === 0 || strpos($this->last_message, ' ', 3) !== 3) && time() - $time < 5); |
| 947 | 948 | |
| 948 | 949 | // Was the desired response returned? |
@@ -963,8 +964,9 @@ discard block |
||
| 963 | 964 | // Request a passive connection - this means, we'll talk to you, you don't talk to us. |
| 964 | 965 | @fwrite($this->connection, 'PASV' . "\r\n"); |
| 965 | 966 | $time = time(); |
| 966 | - do |
|
| 967 | - $response = fgets($this->connection, 1024); |
|
| 967 | + do { |
|
| 968 | + $response = fgets($this->connection, 1024); |
|
| 969 | + } |
|
| 968 | 970 | while (strpos($response, ' ', 3) !== 3 && time() - $time < 5); |
| 969 | 971 | |
| 970 | 972 | // If it's not 227, we weren't given an IP and port, which means it failed. |
@@ -1086,8 +1088,9 @@ discard block |
||
| 1086 | 1088 | |
| 1087 | 1089 | @fwrite($this->connection, 'PWD' . "\r\n"); |
| 1088 | 1090 | $time = time(); |
| 1089 | - do |
|
| 1090 | - $response = fgets($this->connection, 1024); |
|
| 1091 | + do { |
|
| 1092 | + $response = fgets($this->connection, 1024); |
|
| 1093 | + } |
|
| 1091 | 1094 | while ($response[3] != ' ' && time() - $time < 5); |
| 1092 | 1095 | |
| 1093 | 1096 | // Check for 257! |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | // Set a list of common functions. |
| 105 | 105 | $ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);'; |
| 106 | 106 | $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
| 107 | - { |
|
| 107 | + { |
|
| 108 | 108 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
| 109 | 109 | return $string; |
| 110 | 110 | } : function($string) |