@@ -61,7 +61,7 @@ |
||
| 61 | 61 | $server = trim($servers[array_rand($servers)]); |
| 62 | 62 | |
| 63 | 63 | // Normal host names do not contain slashes, while e.g. unix sockets do. Assume alternative transport pipe with port 0. |
| 64 | - if (strpos($server,'/') !== false) |
|
| 64 | + if (strpos($server, '/') !== false) |
|
| 65 | 65 | $host = $server; |
| 66 | 66 | else |
| 67 | 67 | { |
@@ -76,15 +76,15 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // Set a list of common functions. |
| 78 | 78 | $ent_list = empty($modSettings['disableEntityCheck']) ? '&(#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(#021|quot|amp|lt|gt|nbsp);'; |
| 79 | - $ent_check = empty($modSettings['disableEntityCheck']) ? function ($string) |
|
| 79 | + $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
|
| 80 | 80 | { |
| 81 | 81 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
| 82 | 82 | return $string; |
| 83 | - } : function ($string) |
|
| 83 | + } : function($string) |
|
| 84 | 84 | { |
| 85 | 85 | return $string; |
| 86 | 86 | }; |
| 87 | - $fix_utf8mb4 = function ($string) use ($utf8) |
|
| 87 | + $fix_utf8mb4 = function($string) use ($utf8) |
|
| 88 | 88 | { |
| 89 | 89 | if (!$utf8) |
| 90 | 90 | return $string; |
@@ -102,21 +102,21 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | elseif ($ord < 224) |
| 104 | 104 | { |
| 105 | - $new_string .= $string[$i] . $string[$i+1]; |
|
| 105 | + $new_string .= $string[$i] . $string[$i + 1]; |
|
| 106 | 106 | $i += 2; |
| 107 | 107 | } |
| 108 | 108 | elseif ($ord < 240) |
| 109 | 109 | { |
| 110 | - $new_string .= $string[$i] . $string[$i+1] . $string[$i+2]; |
|
| 110 | + $new_string .= $string[$i] . $string[$i + 1] . $string[$i + 2]; |
|
| 111 | 111 | $i += 3; |
| 112 | 112 | } |
| 113 | 113 | elseif ($ord < 248) |
| 114 | 114 | { |
| 115 | 115 | // Magic happens. |
| 116 | 116 | $val = (ord($string[$i]) & 0x07) << 18; |
| 117 | - $val += (ord($string[$i+1]) & 0x3F) << 12; |
|
| 118 | - $val += (ord($string[$i+2]) & 0x3F) << 6; |
|
| 119 | - $val += (ord($string[$i+3]) & 0x3F); |
|
| 117 | + $val += (ord($string[$i + 1]) & 0x3F) << 12; |
|
| 118 | + $val += (ord($string[$i + 2]) & 0x3F) << 6; |
|
| 119 | + $val += (ord($string[$i + 3]) & 0x3F); |
|
| 120 | 120 | $new_string .= '&#' . $val . ';'; |
| 121 | 121 | $i += 4; |
| 122 | 122 | } |
@@ -129,24 +129,24 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | // global array of anonymous helper functions, used mostly to properly handle multi byte strings |
| 131 | 131 | $smcFunc += array( |
| 132 | - 'entity_fix' => function ($string) |
|
| 132 | + 'entity_fix' => function($string) |
|
| 133 | 133 | { |
| 134 | 134 | $num = $string[0] === 'x' ? hexdec(substr($string, 1)) : (int) $string; |
| 135 | 135 | return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202E || $num === 0x202D ? '' : '&#' . $num . ';'; |
| 136 | 136 | }, |
| 137 | - 'htmlspecialchars' => function ($string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1') use ($ent_check, $utf8, $fix_utf8mb4) |
|
| 137 | + 'htmlspecialchars' => function($string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1') use ($ent_check, $utf8, $fix_utf8mb4) |
|
| 138 | 138 | { |
| 139 | 139 | return $fix_utf8mb4($ent_check(htmlspecialchars($string, $quote_style, $utf8 ? 'UTF-8' : $charset))); |
| 140 | 140 | }, |
| 141 | - 'htmltrim' => function ($string) use ($utf8, $space_chars, $ent_check) |
|
| 141 | + 'htmltrim' => function($string) use ($utf8, $space_chars, $ent_check) |
|
| 142 | 142 | { |
| 143 | 143 | return preg_replace('~^(?:[ \t\n\r\x0B\x00' . $space_chars . ']| )+|(?:[ \t\n\r\x0B\x00' . $space_chars . ']| )+$~' . ($utf8 ? 'u' : ''), '', $ent_check($string)); |
| 144 | 144 | }, |
| 145 | - 'strlen' => function ($string) use ($ent_list, $utf8, $ent_check) |
|
| 145 | + 'strlen' => function($string) use ($ent_list, $utf8, $ent_check) |
|
| 146 | 146 | { |
| 147 | 147 | return strlen(preg_replace('~' . $ent_list . ($utf8 ? '|.~u' : '~'), '_', $ent_check($string))); |
| 148 | 148 | }, |
| 149 | - 'strpos' => function ($haystack, $needle, $offset = 0) use ($utf8, $ent_check, $modSettings) |
|
| 149 | + 'strpos' => function($haystack, $needle, $offset = 0) use ($utf8, $ent_check, $modSettings) |
|
| 150 | 150 | { |
| 151 | 151 | $haystack_arr = preg_split('~(&#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . ';|"|&|<|>| |.)~' . ($utf8 ? 'u' : ''), $ent_check($haystack), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 152 | 152 | |
@@ -171,12 +171,12 @@ discard block |
||
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | }, |
| 174 | - 'substr' => function ($string, $start, $length = null) use ($utf8, $ent_check, $modSettings) |
|
| 174 | + 'substr' => function($string, $start, $length = null) use ($utf8, $ent_check, $modSettings) |
|
| 175 | 175 | { |
| 176 | 176 | $ent_arr = preg_split('~(&#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . ';|"|&|<|>| |.)~' . ($utf8 ? 'u' : '') . '', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 177 | 177 | return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length)); |
| 178 | 178 | }, |
| 179 | - 'strtolower' => $utf8 ? function ($string) use ($sourcedir) |
|
| 179 | + 'strtolower' => $utf8 ? function($string) use ($sourcedir) |
|
| 180 | 180 | { |
| 181 | 181 | if (!function_exists('mb_strtolower')) |
| 182 | 182 | { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | return mb_strtolower($string, 'UTF-8'); |
| 188 | 188 | } : 'strtolower', |
| 189 | - 'strtoupper' => $utf8 ? function ($string) |
|
| 189 | + 'strtoupper' => $utf8 ? function($string) |
|
| 190 | 190 | { |
| 191 | 191 | global $sourcedir; |
| 192 | 192 | |
@@ -201,17 +201,17 @@ discard block |
||
| 201 | 201 | 'truncate' => function($string, $length) use ($utf8, $ent_check, $ent_list, &$smcFunc) |
| 202 | 202 | { |
| 203 | 203 | $string = $ent_check($string); |
| 204 | - preg_match('~^(' . $ent_list . '|.){' . $smcFunc['strlen'](substr($string, 0, $length)) . '}~'. ($utf8 ? 'u' : ''), $string, $matches); |
|
| 204 | + preg_match('~^(' . $ent_list . '|.){' . $smcFunc['strlen'](substr($string, 0, $length)) . '}~' . ($utf8 ? 'u' : ''), $string, $matches); |
|
| 205 | 205 | $string = $matches[0]; |
| 206 | 206 | while (strlen($string) > $length) |
| 207 | - $string = preg_replace('~(?:' . $ent_list . '|.)$~'. ($utf8 ? 'u' : ''), '', $string); |
|
| 207 | + $string = preg_replace('~(?:' . $ent_list . '|.)$~' . ($utf8 ? 'u' : ''), '', $string); |
|
| 208 | 208 | return $string; |
| 209 | 209 | }, |
| 210 | - 'ucfirst' => $utf8 ? function ($string) use (&$smcFunc) |
|
| 210 | + 'ucfirst' => $utf8 ? function($string) use (&$smcFunc) |
|
| 211 | 211 | { |
| 212 | 212 | return $smcFunc['strtoupper']($smcFunc['substr']($string, 0, 1)) . $smcFunc['substr']($string, 1); |
| 213 | 213 | } : 'ucfirst', |
| 214 | - 'ucwords' => $utf8 ? function ($string) use (&$smcFunc) |
|
| 214 | + 'ucwords' => $utf8 ? function($string) use (&$smcFunc) |
|
| 215 | 215 | { |
| 216 | 216 | $words = preg_split('~([\s\r\n\t]+)~', $string, -1, PREG_SPLIT_DELIM_CAPTURE); |
| 217 | 217 | for ($i = 0, $n = count($words); $i < $n; $i += 2) |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | else |
| 611 | 611 | { |
| 612 | 612 | // !!! Compatibility. |
| 613 | - $user_info['time_offset'] = empty($user_settings['time_offset']) ? 0 :$user_settings['time_offset']; |
|
| 613 | + $user_info['time_offset'] = empty($user_settings['time_offset']) ? 0 : $user_settings['time_offset']; |
|
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | // If the user is a guest, initialize all the critical user settings. |
@@ -1265,9 +1265,9 @@ discard block |
||
| 1265 | 1265 | if ($image_proxy_enabled && !empty($row['avatar']) && stripos($row['avatar'], 'http://') !== false) |
| 1266 | 1266 | $row['avatar'] = $boardurl . '/proxy.php?request=' . urlencode($row['avatar']) . '&hash=' . md5($row['avatar'] . $image_proxy_secret); |
| 1267 | 1267 | |
| 1268 | - if ( isset($row['member_ip']) ) |
|
| 1268 | + if (isset($row['member_ip'])) |
|
| 1269 | 1269 | $row['member_ip'] = inet_dtop($row['member_ip']); |
| 1270 | - if ( isset($row['member_ip2']) ) |
|
| 1270 | + if (isset($row['member_ip2'])) |
|
| 1271 | 1271 | $row['member_ip2'] = inet_dtop($row['member_ip2']); |
| 1272 | 1272 | $new_loaded_ids[] = $row['id_member']; |
| 1273 | 1273 | $loaded_ids[] = $row['id_member']; |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | 'name' => $profile['real_name'], |
| 1416 | 1416 | 'id' => $profile['id_member'], |
| 1417 | 1417 | 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], |
| 1418 | - '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>', |
|
| 1418 | + '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>', |
|
| 1419 | 1419 | 'email' => $profile['email_address'], |
| 1420 | 1420 | 'show_email' => !$user_info['is_guest'] && ($user_info['id'] == $profile['id_member'] || allowedTo('moderate_forum')), |
| 1421 | 1421 | 'registered' => empty($profile['date_registered']) ? $txt['not_applicable'] : timeformat($profile['date_registered']), |
@@ -1430,9 +1430,9 @@ discard block |
||
| 1430 | 1430 | $loadedLanguages = getLanguages(); |
| 1431 | 1431 | |
| 1432 | 1432 | $memberContext[$user] += array( |
| 1433 | - 'username_color' => '<span '. (!empty($profile['member_group_color']) ? 'style="color:'. $profile['member_group_color'] .';"' : '') .'>'. $profile['member_name'] .'</span>', |
|
| 1434 | - 'name_color' => '<span '. (!empty($profile['member_group_color']) ? 'style="color:'. $profile['member_group_color'] .';"' : '') .'>'. $profile['real_name'] .'</span>', |
|
| 1435 | - '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>', |
|
| 1433 | + 'username_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['member_name'] . '</span>', |
|
| 1434 | + 'name_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['real_name'] . '</span>', |
|
| 1435 | + '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>', |
|
| 1436 | 1436 | 'is_buddy' => $profile['buddy'], |
| 1437 | 1437 | 'is_reverse_buddy' => in_array($user_info['id'], $buddy_list), |
| 1438 | 1438 | 'buddies' => $buddy_list, |
@@ -1502,7 +1502,7 @@ discard block |
||
| 1502 | 1502 | if (!empty($image)) |
| 1503 | 1503 | $memberContext[$user]['avatar'] = array( |
| 1504 | 1504 | 'name' => $profile['avatar'], |
| 1505 | - 'image' => '<img class="avatar" src="' . $image . '" alt="avatar_'. $profile['member_name'].'">', |
|
| 1505 | + 'image' => '<img class="avatar" src="' . $image . '" alt="avatar_' . $profile['member_name'] . '">', |
|
| 1506 | 1506 | 'href' => $image, |
| 1507 | 1507 | 'url' => $image, |
| 1508 | 1508 | ); |
@@ -2828,7 +2828,7 @@ discard block |
||
| 2828 | 2828 | $langName = $smcFunc['ucwords'](strtr($matches[1], array('_' => ' '))); |
| 2829 | 2829 | |
| 2830 | 2830 | // Get the line we need. |
| 2831 | - $fp = @fopen($language_dir .'/'. $entry); |
|
| 2831 | + $fp = @fopen($language_dir . '/' . $entry); |
|
| 2832 | 2832 | |
| 2833 | 2833 | // Yay! |
| 2834 | 2834 | if ($fp) |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | collapsedDiv.show(\'slow\'); |
| 183 | 183 | icon.removeClass(\'toggle_down\').addClass(\'toggle_up\'); |
| 184 | - icon.prop(\'title\', '. JavaScriptEscape($txt['hide']) .'); |
|
| 184 | + icon.prop(\'title\', '. JavaScriptEscape($txt['hide']) . '); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | else |
| 188 | 188 | { |
| 189 | 189 | collapsedDiv.hide(\'slow\'); |
| 190 | 190 | icon.removeClass(\'toggle_up\').addClass(\'toggle_down\'); |
| 191 | - icon.prop(\'title\', '. JavaScriptEscape($txt['show']) .'); |
|
| 191 | + icon.prop(\'title\', '. JavaScriptEscape($txt['show']) . '); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | });', true); |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | // Setup the correct template, even though I'll admit we ain't downloading ;) |
| 643 | 643 | $context['sub_template'] = 'downloaded'; |
| 644 | - $allowext = array('.zip','.tgz','.gz'); |
|
| 644 | + $allowext = array('.zip', '.tgz', '.gz'); |
|
| 645 | 645 | // @todo Use FTP if the Packages directory is not writable. |
| 646 | 646 | |
| 647 | 647 | // Check the file was even sent! |
@@ -653,13 +653,13 @@ discard block |
||
| 653 | 653 | // Make sure it has a sane filename. |
| 654 | 654 | $_FILES['package']['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['package']['name']); |
| 655 | 655 | $extension = substr(strrchr(strtolower($_FILES['package']['name']), '.'), 0); |
| 656 | - if(!in_array($extension, $allowext)) |
|
| 656 | + if (!in_array($extension, $allowext)) |
|
| 657 | 657 | { |
| 658 | 658 | fatal_lang_error('package_upload_error_supports', false, array('zip, tgz, tar.gz')); |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | // We only need the filename... |
| 662 | - $extension = ($extension == '.gz') ? '.tar.gz' : $extension ; |
|
| 662 | + $extension = ($extension == '.gz') ? '.tar.gz' : $extension; |
|
| 663 | 663 | $packageName = time() . $extension; |
| 664 | 664 | |
| 665 | 665 | // Setup the destination and throw an error if the file is already there! |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | $currentServers = $this->memcached->getServerList(); |
| 55 | 55 | foreach ($servers as $server) |
| 56 | 56 | { |
| 57 | - if (strpos($server,'/') !== false) |
|
| 57 | + if (strpos($server, '/') !== false) |
|
| 58 | 58 | $tempServer = array($server, 0); |
| 59 | 59 | else |
| 60 | 60 | { |