@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | $version = $smcFunc['db_get_version'](); |
39 | 39 | // if we got a Beta Version |
40 | 40 | if (stripos($version, 'beta') !== false) |
41 | - $version = substr($version, 0, stripos($version, 'beta')).'.0'; |
|
41 | + $version = substr($version, 0, stripos($version, 'beta')) . '.0'; |
|
42 | 42 | // or RC |
43 | 43 | if (stripos($version, 'rc') !== false) |
44 | - $version = substr($version, 0, stripos($version, 'rc')).'.0'; |
|
44 | + $version = substr($version, 0, stripos($version, 'rc')) . '.0'; |
|
45 | 45 | |
46 | - if (version_compare($version,'9.5.0','>=')) |
|
46 | + if (version_compare($version, '9.5.0', '>=')) |
|
47 | 47 | $smcFunc['db_support_ignore'] = true; |
48 | 48 | } |
49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | function smf_db_search_support($search_type) |
57 | 57 | { |
58 | - $supported_types = array('custom','fulltext'); |
|
58 | + $supported_types = array('custom', 'fulltext'); |
|
59 | 59 | |
60 | 60 | return in_array($search_type, $supported_types); |
61 | 61 | } |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | if (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0) |
110 | 110 | { |
111 | 111 | $db_string = preg_replace('~^\s*INSERT\sIGNORE~i', 'INSERT', $db_string); |
112 | - if ($smcFunc['db_support_ignore']){ |
|
112 | + if ($smcFunc['db_support_ignore']) { |
|
113 | 113 | //pg style "INSERT INTO.... ON CONFLICT DO NOTHING" |
114 | - $db_string = $db_string.' ON CONFLICT DO NOTHING'; |
|
114 | + $db_string = $db_string . ' ON CONFLICT DO NOTHING'; |
|
115 | 115 | } |
116 | 116 | else |
117 | 117 | { |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $language_ftx = $modSettings['search_language']; |
169 | 169 | else |
170 | 170 | { |
171 | - $request = $smcFunc['db_query']('',' |
|
171 | + $request = $smcFunc['db_query']('', ' |
|
172 | 172 | SELECT cfgname FROM pg_ts_config WHERE oid = current_setting({string:default_language})::regconfig', |
173 | 173 | array( |
174 | 174 | 'default_language' => 'default_text_search_config' |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | |
258 | 258 | case 'datetime': |
259 | 259 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
260 | - return 'str_to_date('. |
|
261 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
260 | + return 'str_to_date(' . |
|
261 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
262 | 262 | ',\'%Y-%m-%d %h:%i:%s\')'; |
263 | 263 | else |
264 | 264 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $connection |
826 | 826 | ); |
827 | 827 | |
828 | - if(!empty($keys) && (count($keys) > 0) && ($method === '' || $method === 'insert') && $returnmode > 0) |
|
828 | + if (!empty($keys) && (count($keys) > 0) && ($method === '' || $method === 'insert') && $returnmode > 0) |
|
829 | 829 | { |
830 | 830 | if ($returnmode == 1) |
831 | 831 | $return_var = smf_db_insert_id($table, $keys[0]) + count($insertRows) - 1; |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | $return_var = array(); |
835 | 835 | $count = count($insertRows); |
836 | 836 | $start = smf_db_insert_id($table, $keys[0]); |
837 | - for ($i = 0; $i < $count; $i++ ) |
|
837 | + for ($i = 0; $i < $count; $i++) |
|
838 | 838 | $return_var[] = $start + $i; |
839 | 839 | } |
840 | 840 | return $return_var; |
@@ -199,22 +199,22 @@ discard block |
||
199 | 199 | |
200 | 200 | case 'date': |
201 | 201 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
202 | - return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date'; |
|
202 | + return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date'; |
|
203 | 203 | else |
204 | 204 | smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
205 | 205 | break; |
206 | 206 | |
207 | 207 | case 'time': |
208 | 208 | if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) |
209 | - return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time'; |
|
209 | + return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time'; |
|
210 | 210 | else |
211 | 211 | smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
212 | 212 | break; |
213 | 213 | |
214 | 214 | case 'datetime': |
215 | 215 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
216 | - return 'to_timestamp('. |
|
217 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
216 | + return 'to_timestamp(' . |
|
217 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
218 | 218 | ',\'YYYY-MM-DD HH24:MI:SS\')'; |
219 | 219 | else |
220 | 220 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -763,10 +763,10 @@ discard block |
||
763 | 763 | $returning = ''; |
764 | 764 | $with_returning = false; |
765 | 765 | // lets build the returning string, mysql allow only in normal mode |
766 | - if(!empty($keys) && (count($keys) > 0) && ($method === '' || $method === 'insert') && $returnmode > 0) |
|
766 | + if (!empty($keys) && (count($keys) > 0) && ($method === '' || $method === 'insert') && $returnmode > 0) |
|
767 | 767 | { |
768 | 768 | // we only take the first key |
769 | - $returning = ' RETURNING '.$keys[0]; |
|
769 | + $returning = ' RETURNING ' . $keys[0]; |
|
770 | 770 | $with_returning = true; |
771 | 771 | } |
772 | 772 | |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '") |
798 | 798 | VALUES |
799 | 799 | ' . implode(', |
800 | - ', $insertRows).$replace.$returning, |
|
800 | + ', $insertRows) . $replace . $returning, |
|
801 | 801 | array( |
802 | 802 | 'security_override' => true, |
803 | 803 | 'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors', |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | if ($returnmode === 2) |
811 | 811 | $return_var = array(); |
812 | 812 | |
813 | - while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
813 | + while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
814 | 814 | { |
815 | 815 | if (is_numeric($row[0])) // try to emulate mysql limitation |
816 | 816 | { |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | |
1611 | 1611 | // Our custom error handler - does nothing but does stop public errors from XML! |
1612 | 1612 | set_error_handler( |
1613 | - function ($errno, $errstr, $errfile, $errline) use ($support_js) |
|
1613 | + function($errno, $errstr, $errfile, $errline) use ($support_js) |
|
1614 | 1614 | { |
1615 | 1615 | if ($support_js) |
1616 | 1616 | return true; |
@@ -2595,94 +2595,94 @@ discard block |
||
2595 | 2595 | // Translation table for the character sets not native for MySQL. |
2596 | 2596 | $translation_tables = array( |
2597 | 2597 | 'windows-1255' => array( |
2598 | - '0x81' => '\'\'', '0x8A' => '\'\'', '0x8C' => '\'\'', |
|
2599 | - '0x8D' => '\'\'', '0x8E' => '\'\'', '0x8F' => '\'\'', |
|
2600 | - '0x90' => '\'\'', '0x9A' => '\'\'', '0x9C' => '\'\'', |
|
2601 | - '0x9D' => '\'\'', '0x9E' => '\'\'', '0x9F' => '\'\'', |
|
2602 | - '0xCA' => '\'\'', '0xD9' => '\'\'', '0xDA' => '\'\'', |
|
2603 | - '0xDB' => '\'\'', '0xDC' => '\'\'', '0xDD' => '\'\'', |
|
2604 | - '0xDE' => '\'\'', '0xDF' => '\'\'', '0xFB' => '0xD792', |
|
2605 | - '0xFC' => '0xE282AC', '0xFF' => '0xD6B2', '0xC2' => '0xFF', |
|
2606 | - '0x80' => '0xFC', '0xE2' => '0xFB', '0xA0' => '0xC2A0', |
|
2607 | - '0xA1' => '0xC2A1', '0xA2' => '0xC2A2', '0xA3' => '0xC2A3', |
|
2608 | - '0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7', |
|
2609 | - '0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB', |
|
2610 | - '0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE', |
|
2611 | - '0xAF' => '0xC2AF', '0xB0' => '0xC2B0', '0xB1' => '0xC2B1', |
|
2612 | - '0xB2' => '0xC2B2', '0xB3' => '0xC2B3', '0xB4' => '0xC2B4', |
|
2613 | - '0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7', |
|
2614 | - '0xB8' => '0xC2B8', '0xB9' => '0xC2B9', '0xBB' => '0xC2BB', |
|
2615 | - '0xBC' => '0xC2BC', '0xBD' => '0xC2BD', '0xBE' => '0xC2BE', |
|
2616 | - '0xBF' => '0xC2BF', '0xD7' => '0xD7B3', '0xD1' => '0xD781', |
|
2617 | - '0xD4' => '0xD7B0', '0xD5' => '0xD7B1', '0xD6' => '0xD7B2', |
|
2618 | - '0xE0' => '0xD790', '0xEA' => '0xD79A', '0xEC' => '0xD79C', |
|
2619 | - '0xED' => '0xD79D', '0xEE' => '0xD79E', '0xEF' => '0xD79F', |
|
2620 | - '0xF0' => '0xD7A0', '0xF1' => '0xD7A1', '0xF2' => '0xD7A2', |
|
2621 | - '0xF3' => '0xD7A3', '0xF5' => '0xD7A5', '0xF6' => '0xD7A6', |
|
2622 | - '0xF7' => '0xD7A7', '0xF8' => '0xD7A8', '0xF9' => '0xD7A9', |
|
2623 | - '0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6', |
|
2624 | - '0x86' => '0xE280A0', '0x87' => '0xE280A1', '0x89' => '0xE280B0', |
|
2625 | - '0x8B' => '0xE280B9', '0x93' => '0xE2809C', '0x94' => '0xE2809D', |
|
2626 | - '0x95' => '0xE280A2', '0x97' => '0xE28094', '0x99' => '0xE284A2', |
|
2627 | - '0xC0' => '0xD6B0', '0xC1' => '0xD6B1', '0xC3' => '0xD6B3', |
|
2628 | - '0xC4' => '0xD6B4', '0xC5' => '0xD6B5', '0xC6' => '0xD6B6', |
|
2629 | - '0xC7' => '0xD6B7', '0xC8' => '0xD6B8', '0xC9' => '0xD6B9', |
|
2630 | - '0xCB' => '0xD6BB', '0xCC' => '0xD6BC', '0xCD' => '0xD6BD', |
|
2631 | - '0xCE' => '0xD6BE', '0xCF' => '0xD6BF', '0xD0' => '0xD780', |
|
2632 | - '0xD2' => '0xD782', '0xE3' => '0xD793', '0xE4' => '0xD794', |
|
2633 | - '0xE5' => '0xD795', '0xE7' => '0xD797', '0xE9' => '0xD799', |
|
2634 | - '0xFD' => '0xE2808E', '0xFE' => '0xE2808F', '0x92' => '0xE28099', |
|
2635 | - '0x83' => '0xC692', '0xD3' => '0xD783', '0x88' => '0xCB86', |
|
2636 | - '0x98' => '0xCB9C', '0x91' => '0xE28098', '0x96' => '0xE28093', |
|
2637 | - '0xBA' => '0xC3B7', '0x9B' => '0xE280BA', '0xAA' => '0xC397', |
|
2638 | - '0xA4' => '0xE282AA', '0xE1' => '0xD791', '0xE6' => '0xD796', |
|
2639 | - '0xE8' => '0xD798', '0xEB' => '0xD79B', '0xF4' => '0xD7A4', |
|
2598 | + '0x81' => '\'\'', '0x8A' => '\'\'', '0x8C' => '\'\'', |
|
2599 | + '0x8D' => '\'\'', '0x8E' => '\'\'', '0x8F' => '\'\'', |
|
2600 | + '0x90' => '\'\'', '0x9A' => '\'\'', '0x9C' => '\'\'', |
|
2601 | + '0x9D' => '\'\'', '0x9E' => '\'\'', '0x9F' => '\'\'', |
|
2602 | + '0xCA' => '\'\'', '0xD9' => '\'\'', '0xDA' => '\'\'', |
|
2603 | + '0xDB' => '\'\'', '0xDC' => '\'\'', '0xDD' => '\'\'', |
|
2604 | + '0xDE' => '\'\'', '0xDF' => '\'\'', '0xFB' => '0xD792', |
|
2605 | + '0xFC' => '0xE282AC', '0xFF' => '0xD6B2', '0xC2' => '0xFF', |
|
2606 | + '0x80' => '0xFC', '0xE2' => '0xFB', '0xA0' => '0xC2A0', |
|
2607 | + '0xA1' => '0xC2A1', '0xA2' => '0xC2A2', '0xA3' => '0xC2A3', |
|
2608 | + '0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7', |
|
2609 | + '0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB', |
|
2610 | + '0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE', |
|
2611 | + '0xAF' => '0xC2AF', '0xB0' => '0xC2B0', '0xB1' => '0xC2B1', |
|
2612 | + '0xB2' => '0xC2B2', '0xB3' => '0xC2B3', '0xB4' => '0xC2B4', |
|
2613 | + '0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7', |
|
2614 | + '0xB8' => '0xC2B8', '0xB9' => '0xC2B9', '0xBB' => '0xC2BB', |
|
2615 | + '0xBC' => '0xC2BC', '0xBD' => '0xC2BD', '0xBE' => '0xC2BE', |
|
2616 | + '0xBF' => '0xC2BF', '0xD7' => '0xD7B3', '0xD1' => '0xD781', |
|
2617 | + '0xD4' => '0xD7B0', '0xD5' => '0xD7B1', '0xD6' => '0xD7B2', |
|
2618 | + '0xE0' => '0xD790', '0xEA' => '0xD79A', '0xEC' => '0xD79C', |
|
2619 | + '0xED' => '0xD79D', '0xEE' => '0xD79E', '0xEF' => '0xD79F', |
|
2620 | + '0xF0' => '0xD7A0', '0xF1' => '0xD7A1', '0xF2' => '0xD7A2', |
|
2621 | + '0xF3' => '0xD7A3', '0xF5' => '0xD7A5', '0xF6' => '0xD7A6', |
|
2622 | + '0xF7' => '0xD7A7', '0xF8' => '0xD7A8', '0xF9' => '0xD7A9', |
|
2623 | + '0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6', |
|
2624 | + '0x86' => '0xE280A0', '0x87' => '0xE280A1', '0x89' => '0xE280B0', |
|
2625 | + '0x8B' => '0xE280B9', '0x93' => '0xE2809C', '0x94' => '0xE2809D', |
|
2626 | + '0x95' => '0xE280A2', '0x97' => '0xE28094', '0x99' => '0xE284A2', |
|
2627 | + '0xC0' => '0xD6B0', '0xC1' => '0xD6B1', '0xC3' => '0xD6B3', |
|
2628 | + '0xC4' => '0xD6B4', '0xC5' => '0xD6B5', '0xC6' => '0xD6B6', |
|
2629 | + '0xC7' => '0xD6B7', '0xC8' => '0xD6B8', '0xC9' => '0xD6B9', |
|
2630 | + '0xCB' => '0xD6BB', '0xCC' => '0xD6BC', '0xCD' => '0xD6BD', |
|
2631 | + '0xCE' => '0xD6BE', '0xCF' => '0xD6BF', '0xD0' => '0xD780', |
|
2632 | + '0xD2' => '0xD782', '0xE3' => '0xD793', '0xE4' => '0xD794', |
|
2633 | + '0xE5' => '0xD795', '0xE7' => '0xD797', '0xE9' => '0xD799', |
|
2634 | + '0xFD' => '0xE2808E', '0xFE' => '0xE2808F', '0x92' => '0xE28099', |
|
2635 | + '0x83' => '0xC692', '0xD3' => '0xD783', '0x88' => '0xCB86', |
|
2636 | + '0x98' => '0xCB9C', '0x91' => '0xE28098', '0x96' => '0xE28093', |
|
2637 | + '0xBA' => '0xC3B7', '0x9B' => '0xE280BA', '0xAA' => '0xC397', |
|
2638 | + '0xA4' => '0xE282AA', '0xE1' => '0xD791', '0xE6' => '0xD796', |
|
2639 | + '0xE8' => '0xD798', '0xEB' => '0xD79B', '0xF4' => '0xD7A4', |
|
2640 | 2640 | '0xFA' => '0xD7AA', |
2641 | 2641 | ), |
2642 | 2642 | 'windows-1253' => array( |
2643 | - '0x81' => '\'\'', '0x88' => '\'\'', '0x8A' => '\'\'', |
|
2644 | - '0x8C' => '\'\'', '0x8D' => '\'\'', '0x8E' => '\'\'', |
|
2645 | - '0x8F' => '\'\'', '0x90' => '\'\'', '0x98' => '\'\'', |
|
2646 | - '0x9A' => '\'\'', '0x9C' => '\'\'', '0x9D' => '\'\'', |
|
2647 | - '0x9E' => '\'\'', '0x9F' => '\'\'', '0xAA' => '\'\'', |
|
2648 | - '0xD2' => '0xE282AC', '0xFF' => '0xCE92', '0xCE' => '0xCE9E', |
|
2649 | - '0xB8' => '0xCE88', '0xBA' => '0xCE8A', '0xBC' => '0xCE8C', |
|
2650 | - '0xBE' => '0xCE8E', '0xBF' => '0xCE8F', '0xC0' => '0xCE90', |
|
2651 | - '0xC8' => '0xCE98', '0xCA' => '0xCE9A', '0xCC' => '0xCE9C', |
|
2652 | - '0xCD' => '0xCE9D', '0xCF' => '0xCE9F', '0xDA' => '0xCEAA', |
|
2653 | - '0xE8' => '0xCEB8', '0xEA' => '0xCEBA', '0xEC' => '0xCEBC', |
|
2654 | - '0xEE' => '0xCEBE', '0xEF' => '0xCEBF', '0xC2' => '0xFF', |
|
2655 | - '0xBD' => '0xC2BD', '0xED' => '0xCEBD', '0xB2' => '0xC2B2', |
|
2656 | - '0xA0' => '0xC2A0', '0xA3' => '0xC2A3', '0xA4' => '0xC2A4', |
|
2657 | - '0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7', |
|
2658 | - '0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB', |
|
2659 | - '0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE', |
|
2660 | - '0xB0' => '0xC2B0', '0xB1' => '0xC2B1', '0xB3' => '0xC2B3', |
|
2661 | - '0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7', |
|
2662 | - '0xBB' => '0xC2BB', '0xE2' => '0xCEB2', '0x80' => '0xD2', |
|
2663 | - '0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6', |
|
2664 | - '0x86' => '0xE280A0', '0xA1' => '0xCE85', '0xA2' => '0xCE86', |
|
2665 | - '0x87' => '0xE280A1', '0x89' => '0xE280B0', '0xB9' => '0xCE89', |
|
2666 | - '0x8B' => '0xE280B9', '0x91' => '0xE28098', '0x99' => '0xE284A2', |
|
2667 | - '0x92' => '0xE28099', '0x93' => '0xE2809C', '0x94' => '0xE2809D', |
|
2668 | - '0x95' => '0xE280A2', '0x96' => '0xE28093', '0x97' => '0xE28094', |
|
2669 | - '0x9B' => '0xE280BA', '0xAF' => '0xE28095', '0xB4' => '0xCE84', |
|
2670 | - '0xC1' => '0xCE91', '0xC3' => '0xCE93', '0xC4' => '0xCE94', |
|
2671 | - '0xC5' => '0xCE95', '0xC6' => '0xCE96', '0x83' => '0xC692', |
|
2672 | - '0xC7' => '0xCE97', '0xC9' => '0xCE99', '0xCB' => '0xCE9B', |
|
2673 | - '0xD0' => '0xCEA0', '0xD1' => '0xCEA1', '0xD3' => '0xCEA3', |
|
2674 | - '0xD4' => '0xCEA4', '0xD5' => '0xCEA5', '0xD6' => '0xCEA6', |
|
2675 | - '0xD7' => '0xCEA7', '0xD8' => '0xCEA8', '0xD9' => '0xCEA9', |
|
2676 | - '0xDB' => '0xCEAB', '0xDC' => '0xCEAC', '0xDD' => '0xCEAD', |
|
2677 | - '0xDE' => '0xCEAE', '0xDF' => '0xCEAF', '0xE0' => '0xCEB0', |
|
2678 | - '0xE1' => '0xCEB1', '0xE3' => '0xCEB3', '0xE4' => '0xCEB4', |
|
2679 | - '0xE5' => '0xCEB5', '0xE6' => '0xCEB6', '0xE7' => '0xCEB7', |
|
2680 | - '0xE9' => '0xCEB9', '0xEB' => '0xCEBB', '0xF0' => '0xCF80', |
|
2681 | - '0xF1' => '0xCF81', '0xF2' => '0xCF82', '0xF3' => '0xCF83', |
|
2682 | - '0xF4' => '0xCF84', '0xF5' => '0xCF85', '0xF6' => '0xCF86', |
|
2683 | - '0xF7' => '0xCF87', '0xF8' => '0xCF88', '0xF9' => '0xCF89', |
|
2684 | - '0xFA' => '0xCF8A', '0xFB' => '0xCF8B', '0xFC' => '0xCF8C', |
|
2685 | - '0xFD' => '0xCF8D', '0xFE' => '0xCF8E', |
|
2643 | + '0x81' => '\'\'', '0x88' => '\'\'', '0x8A' => '\'\'', |
|
2644 | + '0x8C' => '\'\'', '0x8D' => '\'\'', '0x8E' => '\'\'', |
|
2645 | + '0x8F' => '\'\'', '0x90' => '\'\'', '0x98' => '\'\'', |
|
2646 | + '0x9A' => '\'\'', '0x9C' => '\'\'', '0x9D' => '\'\'', |
|
2647 | + '0x9E' => '\'\'', '0x9F' => '\'\'', '0xAA' => '\'\'', |
|
2648 | + '0xD2' => '0xE282AC', '0xFF' => '0xCE92', '0xCE' => '0xCE9E', |
|
2649 | + '0xB8' => '0xCE88', '0xBA' => '0xCE8A', '0xBC' => '0xCE8C', |
|
2650 | + '0xBE' => '0xCE8E', '0xBF' => '0xCE8F', '0xC0' => '0xCE90', |
|
2651 | + '0xC8' => '0xCE98', '0xCA' => '0xCE9A', '0xCC' => '0xCE9C', |
|
2652 | + '0xCD' => '0xCE9D', '0xCF' => '0xCE9F', '0xDA' => '0xCEAA', |
|
2653 | + '0xE8' => '0xCEB8', '0xEA' => '0xCEBA', '0xEC' => '0xCEBC', |
|
2654 | + '0xEE' => '0xCEBE', '0xEF' => '0xCEBF', '0xC2' => '0xFF', |
|
2655 | + '0xBD' => '0xC2BD', '0xED' => '0xCEBD', '0xB2' => '0xC2B2', |
|
2656 | + '0xA0' => '0xC2A0', '0xA3' => '0xC2A3', '0xA4' => '0xC2A4', |
|
2657 | + '0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7', |
|
2658 | + '0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB', |
|
2659 | + '0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE', |
|
2660 | + '0xB0' => '0xC2B0', '0xB1' => '0xC2B1', '0xB3' => '0xC2B3', |
|
2661 | + '0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7', |
|
2662 | + '0xBB' => '0xC2BB', '0xE2' => '0xCEB2', '0x80' => '0xD2', |
|
2663 | + '0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6', |
|
2664 | + '0x86' => '0xE280A0', '0xA1' => '0xCE85', '0xA2' => '0xCE86', |
|
2665 | + '0x87' => '0xE280A1', '0x89' => '0xE280B0', '0xB9' => '0xCE89', |
|
2666 | + '0x8B' => '0xE280B9', '0x91' => '0xE28098', '0x99' => '0xE284A2', |
|
2667 | + '0x92' => '0xE28099', '0x93' => '0xE2809C', '0x94' => '0xE2809D', |
|
2668 | + '0x95' => '0xE280A2', '0x96' => '0xE28093', '0x97' => '0xE28094', |
|
2669 | + '0x9B' => '0xE280BA', '0xAF' => '0xE28095', '0xB4' => '0xCE84', |
|
2670 | + '0xC1' => '0xCE91', '0xC3' => '0xCE93', '0xC4' => '0xCE94', |
|
2671 | + '0xC5' => '0xCE95', '0xC6' => '0xCE96', '0x83' => '0xC692', |
|
2672 | + '0xC7' => '0xCE97', '0xC9' => '0xCE99', '0xCB' => '0xCE9B', |
|
2673 | + '0xD0' => '0xCEA0', '0xD1' => '0xCEA1', '0xD3' => '0xCEA3', |
|
2674 | + '0xD4' => '0xCEA4', '0xD5' => '0xCEA5', '0xD6' => '0xCEA6', |
|
2675 | + '0xD7' => '0xCEA7', '0xD8' => '0xCEA8', '0xD9' => '0xCEA9', |
|
2676 | + '0xDB' => '0xCEAB', '0xDC' => '0xCEAC', '0xDD' => '0xCEAD', |
|
2677 | + '0xDE' => '0xCEAE', '0xDF' => '0xCEAF', '0xE0' => '0xCEB0', |
|
2678 | + '0xE1' => '0xCEB1', '0xE3' => '0xCEB3', '0xE4' => '0xCEB4', |
|
2679 | + '0xE5' => '0xCEB5', '0xE6' => '0xCEB6', '0xE7' => '0xCEB7', |
|
2680 | + '0xE9' => '0xCEB9', '0xEB' => '0xCEBB', '0xF0' => '0xCF80', |
|
2681 | + '0xF1' => '0xCF81', '0xF2' => '0xCF82', '0xF3' => '0xCF83', |
|
2682 | + '0xF4' => '0xCF84', '0xF5' => '0xCF85', '0xF6' => '0xCF86', |
|
2683 | + '0xF7' => '0xCF87', '0xF8' => '0xCF88', '0xF9' => '0xCF89', |
|
2684 | + '0xFA' => '0xCF8A', '0xFB' => '0xCF8B', '0xFC' => '0xCF8C', |
|
2685 | + '0xFD' => '0xCF8D', '0xFE' => '0xCF8E', |
|
2686 | 2686 | ), |
2687 | 2687 | ); |
2688 | 2688 | |
@@ -3781,7 +3781,7 @@ discard block |
||
3781 | 3781 | <form action="', $upcontext['form_url'], '" name="upform" id="upform" method="post"> |
3782 | 3782 | <input type="hidden" name="backup_done" id="backup_done" value="0"> |
3783 | 3783 | <strong>Completed <span id="tab_done">', $upcontext['cur_table_num'], '</span> out of ', $upcontext['table_count'], ' tables.</strong> |
3784 | - <div id="debug_section" style="height: ', ($is_debug ? '115' : '12') , 'px; overflow: auto;"> |
|
3784 | + <div id="debug_section" style="height: ', ($is_debug ? '115' : '12'), 'px; overflow: auto;"> |
|
3785 | 3785 | <span id="debuginfo"></span> |
3786 | 3786 | </div>'; |
3787 | 3787 | |
@@ -4282,7 +4282,7 @@ discard block |
||
4282 | 4282 | <form action="', $upcontext['form_url'], '" name="upform" id="upform" method="post"> |
4283 | 4283 | <input type="hidden" name="utf8_done" id="utf8_done" value="0"> |
4284 | 4284 | <strong>Completed <span id="tab_done">', $upcontext['cur_table_num'], '</span> out of ', $upcontext['table_count'], ' tables.</strong> |
4285 | - <div id="debug_section" style="height: ', ($is_debug ? '97' : '12') , 'px; overflow: auto;"> |
|
4285 | + <div id="debug_section" style="height: ', ($is_debug ? '97' : '12'), 'px; overflow: auto;"> |
|
4286 | 4286 | <span id="debuginfo"></span> |
4287 | 4287 | </div>'; |
4288 | 4288 | |
@@ -4383,7 +4383,7 @@ discard block |
||
4383 | 4383 | <form action="', $upcontext['form_url'], '" name="upform" id="upform" method="post"> |
4384 | 4384 | <input type="hidden" name="json_done" id="json_done" value="0"> |
4385 | 4385 | <strong>Completed <span id="tab_done">', $upcontext['cur_table_num'], '</span> out of ', $upcontext['table_count'], ' tables.</strong> |
4386 | - <div id="debug_section" style="height: ', ($is_debug ? '115' : '12') , 'px; overflow: auto;"> |
|
4386 | + <div id="debug_section" style="height: ', ($is_debug ? '115' : '12'), 'px; overflow: auto;"> |
|
4387 | 4387 | <span id="debuginfo"></span> |
4388 | 4388 | </div>'; |
4389 | 4389 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The truncated array |
25 | 25 | */ |
26 | -function truncateArray($arr, $max_length=1900) |
|
26 | +function truncateArray($arr, $max_length = 1900) |
|
27 | 27 | { |
28 | 28 | $curr_length = array_sum(array_map("strlen", $arr)); |
29 | 29 | if ($curr_length <= $max_length) |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | else |
32 | 32 | { |
33 | 33 | // Truncate each element's value to a reasonable length |
34 | - $param_max = floor($max_length/count($arr)); |
|
34 | + $param_max = floor($max_length / count($arr)); |
|
35 | 35 | foreach ($arr as $key => &$value) |
36 | 36 | $value = substr($value, 0, $param_max - strlen($key) - 5); |
37 | 37 | return $arr; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | if (filemtime($boarddir . '/db_last_error.php') === $last_db_error_change) |
198 | 198 | { |
199 | 199 | // Write the change |
200 | - $write_db_change = '<' . '?' . "php\n" . '$db_last_error = ' . time() . ';' . "\n" . '?' . '>'; |
|
200 | + $write_db_change = '<' . '?' . "php\n" . '$db_last_error = ' . time() . ';' . "\n" . '?' . '>'; |
|
201 | 201 | $written_bytes = file_put_contents($boarddir . '/db_last_error.php', $write_db_change, LOCK_EX); |
202 | 202 | |
203 | 203 | // survey says ... |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | ', $txt['debug_language_files'], count($context['debug']['language_files']), ': <em>', implode('</em>, <em>', $context['debug']['language_files']), '</em>.<br> |
271 | 271 | ', $txt['debug_stylesheets'], count($context['debug']['sheets']), ': <em>', implode('</em>, <em>', $context['debug']['sheets']), '</em>.<br> |
272 | 272 | ', $txt['debug_hooks'], empty($context['debug']['hooks']) ? 0 : count($context['debug']['hooks']) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_hooks\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_hooks" style="display: none;"><em>' . implode('</em>, <em>', $context['debug']['hooks']), '</em></span>)', '<br> |
273 | - ',(isset($context['debug']['instances']) ? ($txt['debug_instances'] . (empty($context['debug']['instances']) ? 0 : count($context['debug']['instances'])) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_instances\').style.display = \'inline\'; this.style.display = \'none\'; return false;">'. $txt['debug_show'] .'</a><span id="debug_instances" style="display: none;"><em>'. implode('</em>, <em>', array_keys($context['debug']['instances'])) .'</em></span>)'. '<br>') : ''),' |
|
273 | + ',(isset($context['debug']['instances']) ? ($txt['debug_instances'] . (empty($context['debug']['instances']) ? 0 : count($context['debug']['instances'])) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_instances\').style.display = \'inline\'; this.style.display = \'none\'; return false;">' . $txt['debug_show'] . '</a><span id="debug_instances" style="display: none;"><em>' . implode('</em>, <em>', array_keys($context['debug']['instances'])) . '</em></span>)' . '<br>') : ''), ' |
|
274 | 274 | ', $txt['debug_files_included'], count($files), ' - ', round($total_size / 1024), $txt['debug_kb'], ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_include_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_include_info" style="display: none;"><em>', implode('</em>, <em>', $files), '</em></span>)<br>'; |
275 | 275 | |
276 | 276 | if (function_exists('memory_get_peak_usage')) |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | call_integration_hook('integrate_poll_buttons'); |
825 | 825 | } |
826 | 826 | |
827 | - if(!empty($_REQUEST['page_id'])) |
|
827 | + if (!empty($_REQUEST['page_id'])) |
|
828 | 828 | $start_char = substr($_REQUEST['page_id'], 0, 1); |
829 | 829 | else |
830 | 830 | $start_char = null; |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | SELECT id_msg, id_member, approved |
887 | 887 | FROM {db_prefix}messages |
888 | 888 | WHERE id_topic = {int:current_topic} |
889 | - AND id_msg '. $page_operator . ' {int:page_id}'. (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
889 | + AND id_msg '. $page_operator . ' {int:page_id}' . (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
890 | 890 | AND (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . ' |
891 | 891 | ORDER BY id_msg ' . ($ascending ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : ' |
892 | 892 | LIMIT {int:limit}'), |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | if (empty($low_id)) |
600 | 600 | $pageindex .= $start == 0 ? ' ' : sprintf($base_link, $start - $num_per_page, $settings['page_index']['previous_page']); |
601 | 601 | else |
602 | - $pageindex .= $start == 0 ? ' ' : sprintf($base_link_page, ($start - $num_per_page), $settings['page_index']['previous_page'], 'L'.$low_id); |
|
602 | + $pageindex .= $start == 0 ? ' ' : sprintf($base_link_page, ($start - $num_per_page), $settings['page_index']['previous_page'], 'L' . $low_id); |
|
603 | 603 | |
604 | 604 | // Show all the pages. |
605 | 605 | $display_page = 1; |
@@ -608,11 +608,11 @@ discard block |
||
608 | 608 | |
609 | 609 | // Show the right arrow. |
610 | 610 | $display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page); |
611 | - if ($start != $counter - $max_value && !$start_invalid){ |
|
611 | + if ($start != $counter - $max_value && !$start_invalid) { |
|
612 | 612 | if (empty($max_id)) |
613 | 613 | $pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link, $display_page, $settings['page_index']['next_page']); |
614 | 614 | else |
615 | - $pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link_page, $display_page , $settings['page_index']['next_page'], 'M'.$max_id); |
|
615 | + $pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link_page, $display_page, $settings['page_index']['next_page'], 'M' . $max_id); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | if (empty($low_id)) |
627 | 627 | $pageindex .= sprintf($base_link, $start - $num_per_page, $settings['page_index']['previous_page']); |
628 | 628 | else |
629 | - $pageindex .= sprintf($base_link_page, $start - $num_per_page, $settings['page_index']['previous_page'], 'L'.$low_id); |
|
629 | + $pageindex .= sprintf($base_link_page, $start - $num_per_page, $settings['page_index']['previous_page'], 'L' . $low_id); |
|
630 | 630 | else |
631 | 631 | $pageindex .= ''; |
632 | 632 | |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | if ($start >= $num_per_page * $nCont) |
649 | 649 | { |
650 | 650 | $tmpStart = $start - $num_per_page * $nCont; |
651 | - if($nCont != 1 || empty($low_id)) |
|
651 | + if ($nCont != 1 || empty($low_id)) |
|
652 | 652 | $pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1); |
653 | 653 | else |
654 | - $pageindex .= sprintf($base_link_page, $tmpStart, $tmpStart / $num_per_page + 1, 'L'.$low_id); |
|
654 | + $pageindex .= sprintf($base_link_page, $tmpStart, $tmpStart / $num_per_page + 1, 'L' . $low_id); |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | // Show the current page. (prev page 1 ... 6 7 >[8]< 9 10 ... 15 next page) |
@@ -666,10 +666,10 @@ discard block |
||
666 | 666 | if ($start + $num_per_page * $nCont <= $tmpMaxPages) |
667 | 667 | { |
668 | 668 | $tmpStart = $start + $num_per_page * $nCont; |
669 | - if($nCont != 1 || empty($max_id)) |
|
669 | + if ($nCont != 1 || empty($max_id)) |
|
670 | 670 | $pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1); |
671 | 671 | else |
672 | - $pageindex .= sprintf($base_link_page, $tmpStart, $tmpStart / $num_per_page + 1, 'M'.$max_id); |
|
672 | + $pageindex .= sprintf($base_link_page, $tmpStart, $tmpStart / $num_per_page + 1, 'M' . $max_id); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | // Show the '...' part near the end. (prev page 1 ... 6 7 [8] 9 10 >...< 15 next page) |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | if (empty($max_id)) |
691 | 691 | $pageindex .= sprintf($base_link, $start + $num_per_page, $settings['page_index']['next_page']); |
692 | 692 | else |
693 | - $pageindex .= sprintf($base_link_page, $start + $num_per_page, $settings['page_index']['next_page'], 'M'.$max_id); |
|
693 | + $pageindex .= sprintf($base_link_page, $start + $num_per_page, $settings['page_index']['next_page'], 'M' . $max_id); |
|
694 | 694 | } |
695 | 695 | $pageindex .= $settings['page_index']['extra_after']; |
696 | 696 | |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
1126 | 1126 | ), |
1127 | 1127 | 'content' => '$1', |
1128 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
1128 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
1129 | 1129 | { |
1130 | 1130 | $returnContext = ''; |
1131 | 1131 | |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
1163 | - $returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>'; |
|
1163 | + $returnContext .= '<a href="' . $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '"' . $alt . $title . ' id="thumb_' . $currentAttachment['id'] . '" class="atc_img"></a>'; |
|
1164 | 1164 | else |
1165 | 1165 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>'; |
1166 | 1166 | } |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | 'type' => 'unparsed_content', |
1190 | 1190 | 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
1191 | 1191 | // @todo Maybe this can be simplified? |
1192 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
1192 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
1193 | 1193 | { |
1194 | 1194 | if (!isset($disabled['code'])) |
1195 | 1195 | { |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | 'type' => 'unparsed_equals_content', |
1227 | 1227 | 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
1228 | 1228 | // @todo Maybe this can be simplified? |
1229 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
1229 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
1230 | 1230 | { |
1231 | 1231 | if (!isset($disabled['code'])) |
1232 | 1232 | { |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | 'type' => 'unparsed_content', |
1271 | 1271 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
1272 | 1272 | // @todo Should this respect guest_hideContacts? |
1273 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1273 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1274 | 1274 | { |
1275 | 1275 | $data = strtr($data, array('<br>' => '')); |
1276 | 1276 | }, |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | 'type' => 'unparsed_commas_content', |
1290 | 1290 | 'test' => '\d+,\d+\]', |
1291 | 1291 | 'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">', |
1292 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1292 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1293 | 1293 | { |
1294 | 1294 | if (isset($disabled['url'])) |
1295 | 1295 | $tag['content'] = '$1'; |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | 'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]', |
1306 | 1306 | 'before' => '<div $1>', |
1307 | 1307 | 'after' => '</div>', |
1308 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1308 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1309 | 1309 | { |
1310 | 1310 | $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; |
1311 | 1311 | |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
1355 | 1355 | ), |
1356 | 1356 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
1357 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1357 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1358 | 1358 | { |
1359 | 1359 | global $image_proxy_enabled, $image_proxy_secret, $boardurl; |
1360 | 1360 | |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | 'tag' => 'img', |
1378 | 1378 | 'type' => 'unparsed_content', |
1379 | 1379 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
1380 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1380 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1381 | 1381 | { |
1382 | 1382 | global $image_proxy_enabled, $image_proxy_secret, $boardurl; |
1383 | 1383 | |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | 'tag' => 'iurl', |
1401 | 1401 | 'type' => 'unparsed_content', |
1402 | 1402 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
1403 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1403 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1404 | 1404 | { |
1405 | 1405 | $data = strtr($data, array('<br>' => '')); |
1406 | 1406 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | 'quoted' => 'optional', |
1415 | 1415 | 'before' => '<a href="$1" class="bbc_link">', |
1416 | 1416 | 'after' => '</a>', |
1417 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1417 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1418 | 1418 | { |
1419 | 1419 | if (substr($data, 0, 1) == '#') |
1420 | 1420 | $data = '#post_' . substr($data, 1); |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | 'tag' => 'php', |
1495 | 1495 | 'type' => 'unparsed_content', |
1496 | 1496 | 'content' => '<span class="phpcode">$1</span>', |
1497 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
1497 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
1498 | 1498 | { |
1499 | 1499 | if (!isset($disabled['php'])) |
1500 | 1500 | { |
@@ -1592,7 +1592,7 @@ discard block |
||
1592 | 1592 | 'test' => '[1-7]\]', |
1593 | 1593 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
1594 | 1594 | 'after' => '</span>', |
1595 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1595 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1596 | 1596 | { |
1597 | 1597 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
1598 | 1598 | $data = $sizes[$data] . 'em'; |
@@ -1630,7 +1630,7 @@ discard block |
||
1630 | 1630 | 'tag' => 'time', |
1631 | 1631 | 'type' => 'unparsed_content', |
1632 | 1632 | 'content' => '$1', |
1633 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1633 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1634 | 1634 | { |
1635 | 1635 | if (is_numeric($data)) |
1636 | 1636 | $data = timeformat($data); |
@@ -1658,7 +1658,7 @@ discard block |
||
1658 | 1658 | 'tag' => 'url', |
1659 | 1659 | 'type' => 'unparsed_content', |
1660 | 1660 | 'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>', |
1661 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1661 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1662 | 1662 | { |
1663 | 1663 | $data = strtr($data, array('<br>' => '')); |
1664 | 1664 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | 'quoted' => 'optional', |
1673 | 1673 | 'before' => '<a href="$1" class="bbc_link" target="_blank">', |
1674 | 1674 | 'after' => '</a>', |
1675 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1675 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1676 | 1676 | { |
1677 | 1677 | $scheme = parse_url($data, PHP_URL_SCHEME); |
1678 | 1678 | if (empty($scheme)) |
@@ -1698,7 +1698,7 @@ discard block |
||
1698 | 1698 | { |
1699 | 1699 | if (isset($temp_bbc)) |
1700 | 1700 | $bbc_codes = $temp_bbc; |
1701 | - usort($codes, function ($a, $b) { |
|
1701 | + usort($codes, function($a, $b) { |
|
1702 | 1702 | return strcmp($a['tag'], $b['tag']); |
1703 | 1703 | }); |
1704 | 1704 | return $codes; |
@@ -1936,7 +1936,7 @@ discard block |
||
1936 | 1936 | # a run of Unicode domain name characters and a dot |
1937 | 1937 | [\p{L}\p{M}\p{N}\-.:@]+\. |
1938 | 1938 | # and then a TLD valid in the DNS or the reserved "local" TLD |
1939 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
1939 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
1940 | 1940 | ) |
1941 | 1941 | # followed by a non-domain character or end of line |
1942 | 1942 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -2004,7 +2004,7 @@ discard block |
||
2004 | 2004 | )? |
2005 | 2005 | '; |
2006 | 2006 | |
2007 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
2007 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
2008 | 2008 | $url = array_shift($matches); |
2009 | 2009 | |
2010 | 2010 | $scheme = parse_url($url, PHP_URL_SCHEME); |
@@ -2741,7 +2741,7 @@ discard block |
||
2741 | 2741 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
2742 | 2742 | { |
2743 | 2743 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
2744 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
2744 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
2745 | 2745 | |
2746 | 2746 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
2747 | 2747 | |
@@ -2758,7 +2758,7 @@ discard block |
||
2758 | 2758 | |
2759 | 2759 | // Replace away! |
2760 | 2760 | $message = preg_replace_callback($smileyPregSearch, |
2761 | - function ($matches) use ($smileyPregReplacements) |
|
2761 | + function($matches) use ($smileyPregReplacements) |
|
2762 | 2762 | { |
2763 | 2763 | return $smileyPregReplacements[$matches[1]]; |
2764 | 2764 | }, $message); |
@@ -2824,13 +2824,13 @@ discard block |
||
2824 | 2824 | { |
2825 | 2825 | if (defined('SID') && SID != '') |
2826 | 2826 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
2827 | - function ($m) use ($scripturl) |
|
2827 | + function($m) use ($scripturl) |
|
2828 | 2828 | { |
2829 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
2829 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
2830 | 2830 | }, $setLocation); |
2831 | 2831 | else |
2832 | 2832 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
2833 | - function ($m) use ($scripturl) |
|
2833 | + function($m) use ($scripturl) |
|
2834 | 2834 | { |
2835 | 2835 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
2836 | 2836 | }, $setLocation); |
@@ -3153,7 +3153,7 @@ discard block |
||
3153 | 3153 | |
3154 | 3154 | // Add a generic "Are you sure?" confirmation message. |
3155 | 3155 | addInlineJavaScript(' |
3156 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
3156 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
3157 | 3157 | |
3158 | 3158 | // Now add the capping code for avatars. |
3159 | 3159 | if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize') |
@@ -3514,7 +3514,7 @@ discard block |
||
3514 | 3514 | |
3515 | 3515 | else |
3516 | 3516 | echo ' |
3517 | - <script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>'; |
|
3517 | + <script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>'; |
|
3518 | 3518 | } |
3519 | 3519 | |
3520 | 3520 | // Inline JavaScript - Actually useful some times! |
@@ -3592,14 +3592,14 @@ discard block |
||
3592 | 3592 | |
3593 | 3593 | else |
3594 | 3594 | echo ' |
3595 | - <link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">'; |
|
3595 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">'; |
|
3596 | 3596 | } |
3597 | 3597 | |
3598 | 3598 | // Print the rest after the minified files. |
3599 | 3599 | if (!empty($normal)) |
3600 | 3600 | foreach ($normal as $nf) |
3601 | 3601 | echo ' |
3602 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
3602 | + <link rel="stylesheet" href="', $nf, '">'; |
|
3603 | 3603 | |
3604 | 3604 | if ($db_show_debug === true) |
3605 | 3605 | { |
@@ -3615,7 +3615,7 @@ discard block |
||
3615 | 3615 | <style>'; |
3616 | 3616 | |
3617 | 3617 | foreach ($context['css_header'] as $css) |
3618 | - echo $css .' |
|
3618 | + echo $css . ' |
|
3619 | 3619 | '; |
3620 | 3620 | |
3621 | 3621 | echo' |
@@ -3644,27 +3644,27 @@ discard block |
||
3644 | 3644 | return false; |
3645 | 3645 | |
3646 | 3646 | // Did we already did this? |
3647 | - $toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400); |
|
3647 | + $toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400); |
|
3648 | 3648 | |
3649 | 3649 | // Already done? |
3650 | 3650 | if (!empty($toCache)) |
3651 | 3651 | return true; |
3652 | 3652 | |
3653 | 3653 | // No namespaces, sorry! |
3654 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
3654 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
3655 | 3655 | |
3656 | 3656 | // Temp path. |
3657 | - $cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/'; |
|
3657 | + $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
|
3658 | 3658 | |
3659 | 3659 | // What kind of file are we going to create? |
3660 | - $toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type; |
|
3660 | + $toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type; |
|
3661 | 3661 | |
3662 | 3662 | // File has to exists, if it isn't try to create it. |
3663 | 3663 | if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate)) |
3664 | 3664 | { |
3665 | 3665 | loadLanguage('Errors'); |
3666 | 3666 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
3667 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
3667 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
3668 | 3668 | |
3669 | 3669 | // The process failed so roll back to print each individual file. |
3670 | 3670 | return $data; |
@@ -3699,14 +3699,14 @@ discard block |
||
3699 | 3699 | { |
3700 | 3700 | loadLanguage('Errors'); |
3701 | 3701 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
3702 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
3702 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
3703 | 3703 | |
3704 | 3704 | // The process failed so roll back to print each individual file. |
3705 | 3705 | return $data; |
3706 | 3706 | } |
3707 | 3707 | |
3708 | 3708 | // And create a long lived cache entry. |
3709 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400); |
|
3709 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400); |
|
3710 | 3710 | |
3711 | 3711 | return true; |
3712 | 3712 | } |
@@ -3766,7 +3766,7 @@ discard block |
||
3766 | 3766 | else |
3767 | 3767 | $path = $modSettings['attachmentUploadDir']; |
3768 | 3768 | |
3769 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
3769 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
3770 | 3770 | } |
3771 | 3771 | |
3772 | 3772 | /** |
@@ -3810,10 +3810,10 @@ discard block |
||
3810 | 3810 | $valid_low = isValidIP($ip_parts[0]); |
3811 | 3811 | $valid_high = isValidIP($ip_parts[1]); |
3812 | 3812 | $count = 0; |
3813 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
3813 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
3814 | 3814 | $max = ($mode == ':' ? 'ffff' : '255'); |
3815 | 3815 | $min = 0; |
3816 | - if(!$valid_low) |
|
3816 | + if (!$valid_low) |
|
3817 | 3817 | { |
3818 | 3818 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
3819 | 3819 | $valid_low = isValidIP($ip_parts[0]); |
@@ -3827,7 +3827,7 @@ discard block |
||
3827 | 3827 | } |
3828 | 3828 | |
3829 | 3829 | $count = 0; |
3830 | - if(!$valid_high) |
|
3830 | + if (!$valid_high) |
|
3831 | 3831 | { |
3832 | 3832 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
3833 | 3833 | $valid_high = isValidIP($ip_parts[1]); |
@@ -3840,7 +3840,7 @@ discard block |
||
3840 | 3840 | } |
3841 | 3841 | } |
3842 | 3842 | |
3843 | - if($valid_high && $valid_low) |
|
3843 | + if ($valid_high && $valid_low) |
|
3844 | 3844 | { |
3845 | 3845 | $ip_array['low'] = $ip_parts[0]; |
3846 | 3846 | $ip_array['high'] = $ip_parts[1]; |
@@ -4022,7 +4022,7 @@ discard block |
||
4022 | 4022 | addInlineJavaScript(' |
4023 | 4023 | var user_menus = new smc_PopupMenu(); |
4024 | 4024 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
4025 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
4025 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
4026 | 4026 | if ($context['allow_pm']) |
4027 | 4027 | addInlineJavaScript(' |
4028 | 4028 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4644,7 +4644,7 @@ discard block |
||
4644 | 4644 | // No? try a fallback to $sourcedir |
4645 | 4645 | else |
4646 | 4646 | { |
4647 | - $absPath = $sourcedir .'/'. $file; |
|
4647 | + $absPath = $sourcedir . '/' . $file; |
|
4648 | 4648 | |
4649 | 4649 | if (file_exists($absPath)) |
4650 | 4650 | require_once($absPath); |
@@ -4725,15 +4725,15 @@ discard block |
||
4725 | 4725 | |
4726 | 4726 | // UTF-8 occurences of MS special characters |
4727 | 4727 | $findchars_utf8 = array( |
4728 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
4729 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
4730 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
4731 | - "\xe2\x80\x98", // left single curly quote |
|
4732 | - "\xe2\x80\x99", // right single curly quote |
|
4733 | - "\xe2\x80\x9c", // left double curly quote |
|
4734 | - "\xe2\x80\x9d", // right double curly quote |
|
4735 | - "\xe2\x80\x93", // en dash |
|
4736 | - "\xe2\x80\x94", // em dash |
|
4728 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
4729 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
4730 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
4731 | + "\xe2\x80\x98", // left single curly quote |
|
4732 | + "\xe2\x80\x99", // right single curly quote |
|
4733 | + "\xe2\x80\x9c", // left double curly quote |
|
4734 | + "\xe2\x80\x9d", // right double curly quote |
|
4735 | + "\xe2\x80\x93", // en dash |
|
4736 | + "\xe2\x80\x94", // em dash |
|
4737 | 4737 | ); |
4738 | 4738 | |
4739 | 4739 | // windows 1252 / iso equivalents |
@@ -4751,15 +4751,15 @@ discard block |
||
4751 | 4751 | |
4752 | 4752 | // safe replacements |
4753 | 4753 | $replacechars = array( |
4754 | - ',', // ‚ |
|
4755 | - ',,', // „ |
|
4756 | - '...', // … |
|
4757 | - "'", // ‘ |
|
4758 | - "'", // ’ |
|
4759 | - '"', // “ |
|
4760 | - '"', // ” |
|
4761 | - '-', // – |
|
4762 | - '--', // — |
|
4754 | + ',', // ‚ |
|
4755 | + ',,', // „ |
|
4756 | + '...', // … |
|
4757 | + "'", // ‘ |
|
4758 | + "'", // ’ |
|
4759 | + '"', // “ |
|
4760 | + '"', // ” |
|
4761 | + '-', // – |
|
4762 | + '--', // — |
|
4763 | 4763 | ); |
4764 | 4764 | |
4765 | 4765 | if ($context['utf8']) |
@@ -5177,7 +5177,7 @@ discard block |
||
5177 | 5177 | */ |
5178 | 5178 | function inet_dtop($bin) |
5179 | 5179 | { |
5180 | - if(empty($bin)) |
|
5180 | + if (empty($bin)) |
|
5181 | 5181 | return ''; |
5182 | 5182 | |
5183 | 5183 | global $db_type; |
@@ -5208,28 +5208,28 @@ discard block |
||
5208 | 5208 | */ |
5209 | 5209 | function _safe_serialize($value) |
5210 | 5210 | { |
5211 | - if(is_null($value)) |
|
5211 | + if (is_null($value)) |
|
5212 | 5212 | return 'N;'; |
5213 | 5213 | |
5214 | - if(is_bool($value)) |
|
5215 | - return 'b:'. (int) $value .';'; |
|
5214 | + if (is_bool($value)) |
|
5215 | + return 'b:' . (int) $value . ';'; |
|
5216 | 5216 | |
5217 | - if(is_int($value)) |
|
5218 | - return 'i:'. $value .';'; |
|
5217 | + if (is_int($value)) |
|
5218 | + return 'i:' . $value . ';'; |
|
5219 | 5219 | |
5220 | - if(is_float($value)) |
|
5221 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
5220 | + if (is_float($value)) |
|
5221 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
5222 | 5222 | |
5223 | - if(is_string($value)) |
|
5224 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
5223 | + if (is_string($value)) |
|
5224 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
5225 | 5225 | |
5226 | - if(is_array($value)) |
|
5226 | + if (is_array($value)) |
|
5227 | 5227 | { |
5228 | 5228 | $out = ''; |
5229 | - foreach($value as $k => $v) |
|
5229 | + foreach ($value as $k => $v) |
|
5230 | 5230 | $out .= _safe_serialize($k) . _safe_serialize($v); |
5231 | 5231 | |
5232 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
5232 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
5233 | 5233 | } |
5234 | 5234 | |
5235 | 5235 | // safe_serialize cannot serialize resources or objects. |
@@ -5271,7 +5271,7 @@ discard block |
||
5271 | 5271 | function _safe_unserialize($str) |
5272 | 5272 | { |
5273 | 5273 | // Input is not a string. |
5274 | - if(empty($str) || !is_string($str)) |
|
5274 | + if (empty($str) || !is_string($str)) |
|
5275 | 5275 | return false; |
5276 | 5276 | |
5277 | 5277 | $stack = array(); |
@@ -5285,40 +5285,40 @@ discard block |
||
5285 | 5285 | * 3 - in array, expecting value or another array |
5286 | 5286 | */ |
5287 | 5287 | $state = 0; |
5288 | - while($state != 1) |
|
5288 | + while ($state != 1) |
|
5289 | 5289 | { |
5290 | 5290 | $type = isset($str[0]) ? $str[0] : ''; |
5291 | - if($type == '}') |
|
5291 | + if ($type == '}') |
|
5292 | 5292 | $str = substr($str, 1); |
5293 | 5293 | |
5294 | - else if($type == 'N' && $str[1] == ';') |
|
5294 | + else if ($type == 'N' && $str[1] == ';') |
|
5295 | 5295 | { |
5296 | 5296 | $value = null; |
5297 | 5297 | $str = substr($str, 2); |
5298 | 5298 | } |
5299 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
5299 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
5300 | 5300 | { |
5301 | 5301 | $value = $matches[1] == '1' ? true : false; |
5302 | 5302 | $str = substr($str, 4); |
5303 | 5303 | } |
5304 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
5304 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
5305 | 5305 | { |
5306 | - $value = (int)$matches[1]; |
|
5306 | + $value = (int) $matches[1]; |
|
5307 | 5307 | $str = $matches[2]; |
5308 | 5308 | } |
5309 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
5309 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
5310 | 5310 | { |
5311 | - $value = (float)$matches[1]; |
|
5311 | + $value = (float) $matches[1]; |
|
5312 | 5312 | $str = $matches[3]; |
5313 | 5313 | } |
5314 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
5314 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
5315 | 5315 | { |
5316 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
5317 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
5316 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
5317 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
5318 | 5318 | } |
5319 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
5319 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
5320 | 5320 | { |
5321 | - $expectedLength = (int)$matches[1]; |
|
5321 | + $expectedLength = (int) $matches[1]; |
|
5322 | 5322 | $str = $matches[2]; |
5323 | 5323 | } |
5324 | 5324 | |
@@ -5326,10 +5326,10 @@ discard block |
||
5326 | 5326 | else |
5327 | 5327 | return false; |
5328 | 5328 | |
5329 | - switch($state) |
|
5329 | + switch ($state) |
|
5330 | 5330 | { |
5331 | 5331 | case 3: // In array, expecting value or another array. |
5332 | - if($type == 'a') |
|
5332 | + if ($type == 'a') |
|
5333 | 5333 | { |
5334 | 5334 | $stack[] = &$list; |
5335 | 5335 | $list[$key] = array(); |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | $state = 2; |
5339 | 5339 | break; |
5340 | 5340 | } |
5341 | - if($type != '}') |
|
5341 | + if ($type != '}') |
|
5342 | 5342 | { |
5343 | 5343 | $list[$key] = $value; |
5344 | 5344 | $state = 2; |
@@ -5349,29 +5349,29 @@ discard block |
||
5349 | 5349 | return false; |
5350 | 5350 | |
5351 | 5351 | case 2: // in array, expecting end of array or a key |
5352 | - if($type == '}') |
|
5352 | + if ($type == '}') |
|
5353 | 5353 | { |
5354 | 5354 | // Array size is less than expected. |
5355 | - if(count($list) < end($expected)) |
|
5355 | + if (count($list) < end($expected)) |
|
5356 | 5356 | return false; |
5357 | 5357 | |
5358 | 5358 | unset($list); |
5359 | - $list = &$stack[count($stack)-1]; |
|
5359 | + $list = &$stack[count($stack) - 1]; |
|
5360 | 5360 | array_pop($stack); |
5361 | 5361 | |
5362 | 5362 | // Go to terminal state if we're at the end of the root array. |
5363 | 5363 | array_pop($expected); |
5364 | 5364 | |
5365 | - if(count($expected) == 0) |
|
5365 | + if (count($expected) == 0) |
|
5366 | 5366 | $state = 1; |
5367 | 5367 | |
5368 | 5368 | break; |
5369 | 5369 | } |
5370 | 5370 | |
5371 | - if($type == 'i' || $type == 's') |
|
5371 | + if ($type == 'i' || $type == 's') |
|
5372 | 5372 | { |
5373 | 5373 | // Array size exceeds expected length. |
5374 | - if(count($list) >= end($expected)) |
|
5374 | + if (count($list) >= end($expected)) |
|
5375 | 5375 | return false; |
5376 | 5376 | |
5377 | 5377 | $key = $value; |
@@ -5384,7 +5384,7 @@ discard block |
||
5384 | 5384 | |
5385 | 5385 | // Expecting array or value. |
5386 | 5386 | case 0: |
5387 | - if($type == 'a') |
|
5387 | + if ($type == 'a') |
|
5388 | 5388 | { |
5389 | 5389 | $data = array(); |
5390 | 5390 | $list = &$data; |
@@ -5393,7 +5393,7 @@ discard block |
||
5393 | 5393 | break; |
5394 | 5394 | } |
5395 | 5395 | |
5396 | - if($type != '}') |
|
5396 | + if ($type != '}') |
|
5397 | 5397 | { |
5398 | 5398 | $data = $value; |
5399 | 5399 | $state = 1; |
@@ -5406,7 +5406,7 @@ discard block |
||
5406 | 5406 | } |
5407 | 5407 | |
5408 | 5408 | // Trailing data in input. |
5409 | - if(!empty($str)) |
|
5409 | + if (!empty($str)) |
|
5410 | 5410 | return false; |
5411 | 5411 | |
5412 | 5412 | return $data; |
@@ -5460,7 +5460,7 @@ discard block |
||
5460 | 5460 | // Set different modes. |
5461 | 5461 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
5462 | 5462 | |
5463 | - foreach($chmodValues as $val) |
|
5463 | + foreach ($chmodValues as $val) |
|
5464 | 5464 | { |
5465 | 5465 | // If it's writable, break out of the loop. |
5466 | 5466 | if (is_writable($file)) |
@@ -5495,13 +5495,13 @@ discard block |
||
5495 | 5495 | $returnArray = @json_decode($json, $returnAsArray); |
5496 | 5496 | |
5497 | 5497 | // PHP 5.3 so no json_last_error_msg() |
5498 | - switch(json_last_error()) |
|
5498 | + switch (json_last_error()) |
|
5499 | 5499 | { |
5500 | 5500 | case JSON_ERROR_NONE: |
5501 | 5501 | $jsonError = false; |
5502 | 5502 | break; |
5503 | 5503 | case JSON_ERROR_DEPTH: |
5504 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
5504 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
5505 | 5505 | break; |
5506 | 5506 | case JSON_ERROR_STATE_MISMATCH: |
5507 | 5507 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5529,10 +5529,10 @@ discard block |
||
5529 | 5529 | loadLanguage('Errors'); |
5530 | 5530 | |
5531 | 5531 | if (!empty($jsonDebug)) |
5532 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
5532 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
5533 | 5533 | |
5534 | 5534 | else |
5535 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
5535 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
5536 | 5536 | |
5537 | 5537 | // Everyone expects an array. |
5538 | 5538 | return array(); |
@@ -5636,7 +5636,7 @@ discard block |
||
5636 | 5636 | }); |
5637 | 5637 | |
5638 | 5638 | // Convert Punycode to Unicode |
5639 | - $tlds = array_map(function ($input) { |
|
5639 | + $tlds = array_map(function($input) { |
|
5640 | 5640 | $prefix = 'xn--'; |
5641 | 5641 | $safe_char = 0xFFFC; |
5642 | 5642 | $base = 36; |
@@ -5652,7 +5652,7 @@ discard block |
||
5652 | 5652 | |
5653 | 5653 | foreach ($enco_parts as $encoded) |
5654 | 5654 | { |
5655 | - if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0) |
|
5655 | + if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) |
|
5656 | 5656 | { |
5657 | 5657 | $output_parts[] = $encoded; |
5658 | 5658 | continue; |
@@ -5663,7 +5663,7 @@ discard block |
||
5663 | 5663 | $idx = 0; |
5664 | 5664 | $char = 0x80; |
5665 | 5665 | $decoded = array(); |
5666 | - $output=''; |
|
5666 | + $output = ''; |
|
5667 | 5667 | $delim_pos = strrpos($encoded, '-'); |
5668 | 5668 | |
5669 | 5669 | if ($delim_pos > strlen($prefix)) |
@@ -5679,7 +5679,7 @@ discard block |
||
5679 | 5679 | |
5680 | 5680 | for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) |
5681 | 5681 | { |
5682 | - for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base) |
|
5682 | + for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) |
|
5683 | 5683 | { |
5684 | 5684 | $cp = ord($encoded{$enco_idx++}); |
5685 | 5685 | $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base)); |
@@ -5720,15 +5720,15 @@ discard block |
||
5720 | 5720 | |
5721 | 5721 | // 2 bytes |
5722 | 5722 | elseif ($v < (1 << 11)) |
5723 | - $output .= chr(192+($v >> 6)) . chr(128+($v & 63)); |
|
5723 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
5724 | 5724 | |
5725 | 5725 | // 3 bytes |
5726 | 5726 | elseif ($v < (1 << 16)) |
5727 | - $output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
5727 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
5728 | 5728 | |
5729 | 5729 | // 4 bytes |
5730 | 5730 | elseif ($v < (1 << 21)) |
5731 | - $output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
5731 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
5732 | 5732 | |
5733 | 5733 | // 'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k |
5734 | 5734 | else |
@@ -5835,7 +5835,7 @@ discard block |
||
5835 | 5835 | } |
5836 | 5836 | |
5837 | 5837 | // This recursive function creates the index array from the strings |
5838 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
5838 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
5839 | 5839 | { |
5840 | 5840 | static $depth = 0; |
5841 | 5841 | $depth++; |
@@ -5862,7 +5862,7 @@ discard block |
||
5862 | 5862 | }; |
5863 | 5863 | |
5864 | 5864 | // This recursive function turns the index array into a regular expression |
5865 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
5865 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
5866 | 5866 | { |
5867 | 5867 | static $depth = 0; |
5868 | 5868 | $depth++; |
@@ -5886,11 +5886,11 @@ discard block |
||
5886 | 5886 | |
5887 | 5887 | if (count(array_keys($value)) == 1) |
5888 | 5888 | { |
5889 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
5889 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
5890 | 5890 | $new_key .= $new_key_array[0]; |
5891 | 5891 | } |
5892 | 5892 | else |
5893 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
5893 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
5894 | 5894 | } |
5895 | 5895 | |
5896 | 5896 | if ($depth > 1) |
@@ -5930,7 +5930,7 @@ discard block |
||
5930 | 5930 | $index = $add_string_to_index($string, $index); |
5931 | 5931 | |
5932 | 5932 | while (!empty($index)) |
5933 | - $regexes[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
5933 | + $regexes[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
5934 | 5934 | |
5935 | 5935 | // Restore PHP's internal character encoding to whatever it was originally |
5936 | 5936 | if (!empty($current_encoding)) |