@@ -3388,7 +3388,7 @@ discard block |
||
3388 | 3388 | |
3389 | 3389 | $regex = <<<'EOT' |
3390 | 3390 | (\s*#\s*Make\s+sure\s+the\s+paths\s+are\s+correct\.\.\.\s+at\s+least\s+try\s+to\s+fix\s+them\.\s+)?if\s*\(\!file_exists\(\$boarddir\)\s+&&\s+file_exists\(dirname\(__FILE__\)\s+\.\s+'/agreement\.txt'\)\)\s+\$boarddir\s*\=\s*dirname\(__FILE__\);\s+if\s*\(\!file_exists\(\$sourcedir\)\s+&&\s+file_exists\(\$boarddir\s*\.\s*'/Sources'\)\)\s+\$sourcedir\s*\=\s*\$boarddir\s*\.\s*'/Sources';\s+if\s*\(\!file_exists\(\$cachedir\)\s+&&\s+file_exists\(\$boarddir\s*\.\s*'/cache'\)\)\s+\$cachedir\s*\=\s*\$boarddir\s*\.\s*'/cache'; |
3391 | -EOT; |
|
3391 | +eot; |
|
3392 | 3392 | |
3393 | 3393 | $replacement = <<<'EOT' |
3394 | 3394 | # Make sure the paths are correct... at least try to fix them. |
@@ -3400,7 +3400,7 @@ discard block |
||
3400 | 3400 | $cachedir = $boarddir . '/cache'; |
3401 | 3401 | |
3402 | 3402 | |
3403 | -EOT; |
|
3403 | +eot; |
|
3404 | 3404 | |
3405 | 3405 | if (preg_match('~' . $regex . '~', $settings) && preg_match('~(#+\s*Error-Catching\s*#+)~', $settings)) |
3406 | 3406 | { |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $to = explode('/', $lang_dir); |
502 | 502 | $relPath = $to; |
503 | 503 | |
504 | - foreach($from as $depth => $dir) |
|
504 | + foreach ($from as $depth => $dir) |
|
505 | 505 | { |
506 | 506 | if ($dir === $to[$depth]) |
507 | 507 | array_shift($relPath); |
@@ -2881,94 +2881,94 @@ discard block |
||
2881 | 2881 | // Translation table for the character sets not native for MySQL. |
2882 | 2882 | $translation_tables = array( |
2883 | 2883 | 'windows-1255' => array( |
2884 | - '0x81' => '\'\'', '0x8A' => '\'\'', '0x8C' => '\'\'', |
|
2885 | - '0x8D' => '\'\'', '0x8E' => '\'\'', '0x8F' => '\'\'', |
|
2886 | - '0x90' => '\'\'', '0x9A' => '\'\'', '0x9C' => '\'\'', |
|
2887 | - '0x9D' => '\'\'', '0x9E' => '\'\'', '0x9F' => '\'\'', |
|
2888 | - '0xCA' => '\'\'', '0xD9' => '\'\'', '0xDA' => '\'\'', |
|
2889 | - '0xDB' => '\'\'', '0xDC' => '\'\'', '0xDD' => '\'\'', |
|
2890 | - '0xDE' => '\'\'', '0xDF' => '\'\'', '0xFB' => '0xD792', |
|
2891 | - '0xFC' => '0xE282AC', '0xFF' => '0xD6B2', '0xC2' => '0xFF', |
|
2892 | - '0x80' => '0xFC', '0xE2' => '0xFB', '0xA0' => '0xC2A0', |
|
2893 | - '0xA1' => '0xC2A1', '0xA2' => '0xC2A2', '0xA3' => '0xC2A3', |
|
2894 | - '0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7', |
|
2895 | - '0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB', |
|
2896 | - '0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE', |
|
2897 | - '0xAF' => '0xC2AF', '0xB0' => '0xC2B0', '0xB1' => '0xC2B1', |
|
2898 | - '0xB2' => '0xC2B2', '0xB3' => '0xC2B3', '0xB4' => '0xC2B4', |
|
2899 | - '0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7', |
|
2900 | - '0xB8' => '0xC2B8', '0xB9' => '0xC2B9', '0xBB' => '0xC2BB', |
|
2901 | - '0xBC' => '0xC2BC', '0xBD' => '0xC2BD', '0xBE' => '0xC2BE', |
|
2902 | - '0xBF' => '0xC2BF', '0xD7' => '0xD7B3', '0xD1' => '0xD781', |
|
2903 | - '0xD4' => '0xD7B0', '0xD5' => '0xD7B1', '0xD6' => '0xD7B2', |
|
2904 | - '0xE0' => '0xD790', '0xEA' => '0xD79A', '0xEC' => '0xD79C', |
|
2905 | - '0xED' => '0xD79D', '0xEE' => '0xD79E', '0xEF' => '0xD79F', |
|
2906 | - '0xF0' => '0xD7A0', '0xF1' => '0xD7A1', '0xF2' => '0xD7A2', |
|
2907 | - '0xF3' => '0xD7A3', '0xF5' => '0xD7A5', '0xF6' => '0xD7A6', |
|
2908 | - '0xF7' => '0xD7A7', '0xF8' => '0xD7A8', '0xF9' => '0xD7A9', |
|
2909 | - '0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6', |
|
2910 | - '0x86' => '0xE280A0', '0x87' => '0xE280A1', '0x89' => '0xE280B0', |
|
2911 | - '0x8B' => '0xE280B9', '0x93' => '0xE2809C', '0x94' => '0xE2809D', |
|
2912 | - '0x95' => '0xE280A2', '0x97' => '0xE28094', '0x99' => '0xE284A2', |
|
2913 | - '0xC0' => '0xD6B0', '0xC1' => '0xD6B1', '0xC3' => '0xD6B3', |
|
2914 | - '0xC4' => '0xD6B4', '0xC5' => '0xD6B5', '0xC6' => '0xD6B6', |
|
2915 | - '0xC7' => '0xD6B7', '0xC8' => '0xD6B8', '0xC9' => '0xD6B9', |
|
2916 | - '0xCB' => '0xD6BB', '0xCC' => '0xD6BC', '0xCD' => '0xD6BD', |
|
2917 | - '0xCE' => '0xD6BE', '0xCF' => '0xD6BF', '0xD0' => '0xD780', |
|
2918 | - '0xD2' => '0xD782', '0xE3' => '0xD793', '0xE4' => '0xD794', |
|
2919 | - '0xE5' => '0xD795', '0xE7' => '0xD797', '0xE9' => '0xD799', |
|
2920 | - '0xFD' => '0xE2808E', '0xFE' => '0xE2808F', '0x92' => '0xE28099', |
|
2921 | - '0x83' => '0xC692', '0xD3' => '0xD783', '0x88' => '0xCB86', |
|
2922 | - '0x98' => '0xCB9C', '0x91' => '0xE28098', '0x96' => '0xE28093', |
|
2923 | - '0xBA' => '0xC3B7', '0x9B' => '0xE280BA', '0xAA' => '0xC397', |
|
2924 | - '0xA4' => '0xE282AA', '0xE1' => '0xD791', '0xE6' => '0xD796', |
|
2925 | - '0xE8' => '0xD798', '0xEB' => '0xD79B', '0xF4' => '0xD7A4', |
|
2884 | + '0x81' => '\'\'', '0x8A' => '\'\'', '0x8C' => '\'\'', |
|
2885 | + '0x8D' => '\'\'', '0x8E' => '\'\'', '0x8F' => '\'\'', |
|
2886 | + '0x90' => '\'\'', '0x9A' => '\'\'', '0x9C' => '\'\'', |
|
2887 | + '0x9D' => '\'\'', '0x9E' => '\'\'', '0x9F' => '\'\'', |
|
2888 | + '0xCA' => '\'\'', '0xD9' => '\'\'', '0xDA' => '\'\'', |
|
2889 | + '0xDB' => '\'\'', '0xDC' => '\'\'', '0xDD' => '\'\'', |
|
2890 | + '0xDE' => '\'\'', '0xDF' => '\'\'', '0xFB' => '0xD792', |
|
2891 | + '0xFC' => '0xE282AC', '0xFF' => '0xD6B2', '0xC2' => '0xFF', |
|
2892 | + '0x80' => '0xFC', '0xE2' => '0xFB', '0xA0' => '0xC2A0', |
|
2893 | + '0xA1' => '0xC2A1', '0xA2' => '0xC2A2', '0xA3' => '0xC2A3', |
|
2894 | + '0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7', |
|
2895 | + '0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB', |
|
2896 | + '0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE', |
|
2897 | + '0xAF' => '0xC2AF', '0xB0' => '0xC2B0', '0xB1' => '0xC2B1', |
|
2898 | + '0xB2' => '0xC2B2', '0xB3' => '0xC2B3', '0xB4' => '0xC2B4', |
|
2899 | + '0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7', |
|
2900 | + '0xB8' => '0xC2B8', '0xB9' => '0xC2B9', '0xBB' => '0xC2BB', |
|
2901 | + '0xBC' => '0xC2BC', '0xBD' => '0xC2BD', '0xBE' => '0xC2BE', |
|
2902 | + '0xBF' => '0xC2BF', '0xD7' => '0xD7B3', '0xD1' => '0xD781', |
|
2903 | + '0xD4' => '0xD7B0', '0xD5' => '0xD7B1', '0xD6' => '0xD7B2', |
|
2904 | + '0xE0' => '0xD790', '0xEA' => '0xD79A', '0xEC' => '0xD79C', |
|
2905 | + '0xED' => '0xD79D', '0xEE' => '0xD79E', '0xEF' => '0xD79F', |
|
2906 | + '0xF0' => '0xD7A0', '0xF1' => '0xD7A1', '0xF2' => '0xD7A2', |
|
2907 | + '0xF3' => '0xD7A3', '0xF5' => '0xD7A5', '0xF6' => '0xD7A6', |
|
2908 | + '0xF7' => '0xD7A7', '0xF8' => '0xD7A8', '0xF9' => '0xD7A9', |
|
2909 | + '0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6', |
|
2910 | + '0x86' => '0xE280A0', '0x87' => '0xE280A1', '0x89' => '0xE280B0', |
|
2911 | + '0x8B' => '0xE280B9', '0x93' => '0xE2809C', '0x94' => '0xE2809D', |
|
2912 | + '0x95' => '0xE280A2', '0x97' => '0xE28094', '0x99' => '0xE284A2', |
|
2913 | + '0xC0' => '0xD6B0', '0xC1' => '0xD6B1', '0xC3' => '0xD6B3', |
|
2914 | + '0xC4' => '0xD6B4', '0xC5' => '0xD6B5', '0xC6' => '0xD6B6', |
|
2915 | + '0xC7' => '0xD6B7', '0xC8' => '0xD6B8', '0xC9' => '0xD6B9', |
|
2916 | + '0xCB' => '0xD6BB', '0xCC' => '0xD6BC', '0xCD' => '0xD6BD', |
|
2917 | + '0xCE' => '0xD6BE', '0xCF' => '0xD6BF', '0xD0' => '0xD780', |
|
2918 | + '0xD2' => '0xD782', '0xE3' => '0xD793', '0xE4' => '0xD794', |
|
2919 | + '0xE5' => '0xD795', '0xE7' => '0xD797', '0xE9' => '0xD799', |
|
2920 | + '0xFD' => '0xE2808E', '0xFE' => '0xE2808F', '0x92' => '0xE28099', |
|
2921 | + '0x83' => '0xC692', '0xD3' => '0xD783', '0x88' => '0xCB86', |
|
2922 | + '0x98' => '0xCB9C', '0x91' => '0xE28098', '0x96' => '0xE28093', |
|
2923 | + '0xBA' => '0xC3B7', '0x9B' => '0xE280BA', '0xAA' => '0xC397', |
|
2924 | + '0xA4' => '0xE282AA', '0xE1' => '0xD791', '0xE6' => '0xD796', |
|
2925 | + '0xE8' => '0xD798', '0xEB' => '0xD79B', '0xF4' => '0xD7A4', |
|
2926 | 2926 | '0xFA' => '0xD7AA', |
2927 | 2927 | ), |
2928 | 2928 | 'windows-1253' => array( |
2929 | - '0x81' => '\'\'', '0x88' => '\'\'', '0x8A' => '\'\'', |
|
2930 | - '0x8C' => '\'\'', '0x8D' => '\'\'', '0x8E' => '\'\'', |
|
2931 | - '0x8F' => '\'\'', '0x90' => '\'\'', '0x98' => '\'\'', |
|
2932 | - '0x9A' => '\'\'', '0x9C' => '\'\'', '0x9D' => '\'\'', |
|
2933 | - '0x9E' => '\'\'', '0x9F' => '\'\'', '0xAA' => '\'\'', |
|
2934 | - '0xD2' => '0xE282AC', '0xFF' => '0xCE92', '0xCE' => '0xCE9E', |
|
2935 | - '0xB8' => '0xCE88', '0xBA' => '0xCE8A', '0xBC' => '0xCE8C', |
|
2936 | - '0xBE' => '0xCE8E', '0xBF' => '0xCE8F', '0xC0' => '0xCE90', |
|
2937 | - '0xC8' => '0xCE98', '0xCA' => '0xCE9A', '0xCC' => '0xCE9C', |
|
2938 | - '0xCD' => '0xCE9D', '0xCF' => '0xCE9F', '0xDA' => '0xCEAA', |
|
2939 | - '0xE8' => '0xCEB8', '0xEA' => '0xCEBA', '0xEC' => '0xCEBC', |
|
2940 | - '0xEE' => '0xCEBE', '0xEF' => '0xCEBF', '0xC2' => '0xFF', |
|
2941 | - '0xBD' => '0xC2BD', '0xED' => '0xCEBD', '0xB2' => '0xC2B2', |
|
2942 | - '0xA0' => '0xC2A0', '0xA3' => '0xC2A3', '0xA4' => '0xC2A4', |
|
2943 | - '0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7', |
|
2944 | - '0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB', |
|
2945 | - '0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE', |
|
2946 | - '0xB0' => '0xC2B0', '0xB1' => '0xC2B1', '0xB3' => '0xC2B3', |
|
2947 | - '0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7', |
|
2948 | - '0xBB' => '0xC2BB', '0xE2' => '0xCEB2', '0x80' => '0xD2', |
|
2949 | - '0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6', |
|
2950 | - '0x86' => '0xE280A0', '0xA1' => '0xCE85', '0xA2' => '0xCE86', |
|
2951 | - '0x87' => '0xE280A1', '0x89' => '0xE280B0', '0xB9' => '0xCE89', |
|
2952 | - '0x8B' => '0xE280B9', '0x91' => '0xE28098', '0x99' => '0xE284A2', |
|
2953 | - '0x92' => '0xE28099', '0x93' => '0xE2809C', '0x94' => '0xE2809D', |
|
2954 | - '0x95' => '0xE280A2', '0x96' => '0xE28093', '0x97' => '0xE28094', |
|
2955 | - '0x9B' => '0xE280BA', '0xAF' => '0xE28095', '0xB4' => '0xCE84', |
|
2956 | - '0xC1' => '0xCE91', '0xC3' => '0xCE93', '0xC4' => '0xCE94', |
|
2957 | - '0xC5' => '0xCE95', '0xC6' => '0xCE96', '0x83' => '0xC692', |
|
2958 | - '0xC7' => '0xCE97', '0xC9' => '0xCE99', '0xCB' => '0xCE9B', |
|
2959 | - '0xD0' => '0xCEA0', '0xD1' => '0xCEA1', '0xD3' => '0xCEA3', |
|
2960 | - '0xD4' => '0xCEA4', '0xD5' => '0xCEA5', '0xD6' => '0xCEA6', |
|
2961 | - '0xD7' => '0xCEA7', '0xD8' => '0xCEA8', '0xD9' => '0xCEA9', |
|
2962 | - '0xDB' => '0xCEAB', '0xDC' => '0xCEAC', '0xDD' => '0xCEAD', |
|
2963 | - '0xDE' => '0xCEAE', '0xDF' => '0xCEAF', '0xE0' => '0xCEB0', |
|
2964 | - '0xE1' => '0xCEB1', '0xE3' => '0xCEB3', '0xE4' => '0xCEB4', |
|
2965 | - '0xE5' => '0xCEB5', '0xE6' => '0xCEB6', '0xE7' => '0xCEB7', |
|
2966 | - '0xE9' => '0xCEB9', '0xEB' => '0xCEBB', '0xF0' => '0xCF80', |
|
2967 | - '0xF1' => '0xCF81', '0xF2' => '0xCF82', '0xF3' => '0xCF83', |
|
2968 | - '0xF4' => '0xCF84', '0xF5' => '0xCF85', '0xF6' => '0xCF86', |
|
2969 | - '0xF7' => '0xCF87', '0xF8' => '0xCF88', '0xF9' => '0xCF89', |
|
2970 | - '0xFA' => '0xCF8A', '0xFB' => '0xCF8B', '0xFC' => '0xCF8C', |
|
2971 | - '0xFD' => '0xCF8D', '0xFE' => '0xCF8E', |
|
2929 | + '0x81' => '\'\'', '0x88' => '\'\'', '0x8A' => '\'\'', |
|
2930 | + '0x8C' => '\'\'', '0x8D' => '\'\'', '0x8E' => '\'\'', |
|
2931 | + '0x8F' => '\'\'', '0x90' => '\'\'', '0x98' => '\'\'', |
|
2932 | + '0x9A' => '\'\'', '0x9C' => '\'\'', '0x9D' => '\'\'', |
|
2933 | + '0x9E' => '\'\'', '0x9F' => '\'\'', '0xAA' => '\'\'', |
|
2934 | + '0xD2' => '0xE282AC', '0xFF' => '0xCE92', '0xCE' => '0xCE9E', |
|
2935 | + '0xB8' => '0xCE88', '0xBA' => '0xCE8A', '0xBC' => '0xCE8C', |
|
2936 | + '0xBE' => '0xCE8E', '0xBF' => '0xCE8F', '0xC0' => '0xCE90', |
|
2937 | + '0xC8' => '0xCE98', '0xCA' => '0xCE9A', '0xCC' => '0xCE9C', |
|
2938 | + '0xCD' => '0xCE9D', '0xCF' => '0xCE9F', '0xDA' => '0xCEAA', |
|
2939 | + '0xE8' => '0xCEB8', '0xEA' => '0xCEBA', '0xEC' => '0xCEBC', |
|
2940 | + '0xEE' => '0xCEBE', '0xEF' => '0xCEBF', '0xC2' => '0xFF', |
|
2941 | + '0xBD' => '0xC2BD', '0xED' => '0xCEBD', '0xB2' => '0xC2B2', |
|
2942 | + '0xA0' => '0xC2A0', '0xA3' => '0xC2A3', '0xA4' => '0xC2A4', |
|
2943 | + '0xA5' => '0xC2A5', '0xA6' => '0xC2A6', '0xA7' => '0xC2A7', |
|
2944 | + '0xA8' => '0xC2A8', '0xA9' => '0xC2A9', '0xAB' => '0xC2AB', |
|
2945 | + '0xAC' => '0xC2AC', '0xAD' => '0xC2AD', '0xAE' => '0xC2AE', |
|
2946 | + '0xB0' => '0xC2B0', '0xB1' => '0xC2B1', '0xB3' => '0xC2B3', |
|
2947 | + '0xB5' => '0xC2B5', '0xB6' => '0xC2B6', '0xB7' => '0xC2B7', |
|
2948 | + '0xBB' => '0xC2BB', '0xE2' => '0xCEB2', '0x80' => '0xD2', |
|
2949 | + '0x82' => '0xE2809A', '0x84' => '0xE2809E', '0x85' => '0xE280A6', |
|
2950 | + '0x86' => '0xE280A0', '0xA1' => '0xCE85', '0xA2' => '0xCE86', |
|
2951 | + '0x87' => '0xE280A1', '0x89' => '0xE280B0', '0xB9' => '0xCE89', |
|
2952 | + '0x8B' => '0xE280B9', '0x91' => '0xE28098', '0x99' => '0xE284A2', |
|
2953 | + '0x92' => '0xE28099', '0x93' => '0xE2809C', '0x94' => '0xE2809D', |
|
2954 | + '0x95' => '0xE280A2', '0x96' => '0xE28093', '0x97' => '0xE28094', |
|
2955 | + '0x9B' => '0xE280BA', '0xAF' => '0xE28095', '0xB4' => '0xCE84', |
|
2956 | + '0xC1' => '0xCE91', '0xC3' => '0xCE93', '0xC4' => '0xCE94', |
|
2957 | + '0xC5' => '0xCE95', '0xC6' => '0xCE96', '0x83' => '0xC692', |
|
2958 | + '0xC7' => '0xCE97', '0xC9' => '0xCE99', '0xCB' => '0xCE9B', |
|
2959 | + '0xD0' => '0xCEA0', '0xD1' => '0xCEA1', '0xD3' => '0xCEA3', |
|
2960 | + '0xD4' => '0xCEA4', '0xD5' => '0xCEA5', '0xD6' => '0xCEA6', |
|
2961 | + '0xD7' => '0xCEA7', '0xD8' => '0xCEA8', '0xD9' => '0xCEA9', |
|
2962 | + '0xDB' => '0xCEAB', '0xDC' => '0xCEAC', '0xDD' => '0xCEAD', |
|
2963 | + '0xDE' => '0xCEAE', '0xDF' => '0xCEAF', '0xE0' => '0xCEB0', |
|
2964 | + '0xE1' => '0xCEB1', '0xE3' => '0xCEB3', '0xE4' => '0xCEB4', |
|
2965 | + '0xE5' => '0xCEB5', '0xE6' => '0xCEB6', '0xE7' => '0xCEB7', |
|
2966 | + '0xE9' => '0xCEB9', '0xEB' => '0xCEBB', '0xF0' => '0xCF80', |
|
2967 | + '0xF1' => '0xCF81', '0xF2' => '0xCF82', '0xF3' => '0xCF83', |
|
2968 | + '0xF4' => '0xCF84', '0xF5' => '0xCF85', '0xF6' => '0xCF86', |
|
2969 | + '0xF7' => '0xCF87', '0xF8' => '0xCF88', '0xF9' => '0xCF89', |
|
2970 | + '0xFA' => '0xCF8A', '0xFB' => '0xCF8B', '0xFC' => '0xCF8C', |
|
2971 | + '0xFD' => '0xCF8D', '0xFE' => '0xCF8E', |
|
2972 | 2972 | ), |
2973 | 2973 | ); |
2974 | 2974 | |
@@ -3205,7 +3205,7 @@ discard block |
||
3205 | 3205 | return $string; |
3206 | 3206 | |
3207 | 3207 | // This bit fixes incorrect string lengths, which can happen if the character encoding was changed (e.g. conversion to UTF-8) |
3208 | - $new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function ($matches) {return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";';}, $string); |
|
3208 | + $new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function($matches) {return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";'; }, $string); |
|
3209 | 3209 | |
3210 | 3210 | // @todo Add more possible fixes here. For example, fix incorrect array lengths, try to handle truncated strings gracefully, etc. |
3211 | 3211 |
@@ -3205,7 +3205,9 @@ |
||
3205 | 3205 | return $string; |
3206 | 3206 | |
3207 | 3207 | // This bit fixes incorrect string lengths, which can happen if the character encoding was changed (e.g. conversion to UTF-8) |
3208 | - $new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function ($matches) {return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";';}, $string); |
|
3208 | + $new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function ($matches) |
|
3209 | + { |
|
3210 | +return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";';}, $string); |
|
3209 | 3211 | |
3210 | 3212 | // @todo Add more possible fixes here. For example, fix incorrect array lengths, try to handle truncated strings gracefully, etc. |
3211 | 3213 |
@@ -1,204 +1,204 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (!is_callable('random_int')) { |
4 | - /** |
|
5 | - * Random_* Compatibility Library |
|
6 | - * for using the new PHP 7 random_* API in PHP 5 projects |
|
7 | - * |
|
8 | - * The MIT License (MIT) |
|
9 | - * |
|
10 | - * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises |
|
11 | - * |
|
12 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
13 | - * of this software and associated documentation files (the "Software"), to deal |
|
14 | - * in the Software without restriction, including without limitation the rights |
|
15 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
16 | - * copies of the Software, and to permit persons to whom the Software is |
|
17 | - * furnished to do so, subject to the following conditions: |
|
18 | - * |
|
19 | - * The above copyright notice and this permission notice shall be included in |
|
20 | - * all copies or substantial portions of the Software. |
|
21 | - * |
|
22 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
23 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
24 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
25 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
26 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
27 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
28 | - * SOFTWARE. |
|
29 | - */ |
|
30 | - |
|
31 | - /** |
|
32 | - * Fetch a random integer between $min and $max inclusive |
|
33 | - * |
|
34 | - * @param int $min |
|
35 | - * @param int $max |
|
36 | - * |
|
37 | - * @throws Exception |
|
38 | - * |
|
39 | - * @return int |
|
40 | - */ |
|
41 | - function random_int($min, $max) |
|
42 | - { |
|
43 | - /** |
|
44 | - * Type and input logic checks |
|
45 | - * |
|
46 | - * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) |
|
47 | - * (non-inclusive), it will sanely cast it to an int. If you it's equal to |
|
48 | - * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats |
|
49 | - * lose precision, so the <= and => operators might accidentally let a float |
|
50 | - * through. |
|
51 | - */ |
|
52 | - |
|
53 | - try { |
|
54 | - /** @var int $min */ |
|
55 | - $min = RandomCompat_intval($min); |
|
56 | - } catch (TypeError $ex) { |
|
57 | - throw new TypeError( |
|
58 | - 'random_int(): $min must be an integer' |
|
59 | - ); |
|
60 | - } |
|
61 | - |
|
62 | - try { |
|
63 | - /** @var int $max */ |
|
64 | - $max = RandomCompat_intval($max); |
|
65 | - } catch (TypeError $ex) { |
|
66 | - throw new TypeError( |
|
67 | - 'random_int(): $max must be an integer' |
|
68 | - ); |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Now that we've verified our weak typing system has given us an integer, |
|
73 | - * let's validate the logic then we can move forward with generating random |
|
74 | - * integers along a given range. |
|
75 | - */ |
|
76 | - if ($min > $max) { |
|
77 | - throw new Error( |
|
78 | - 'Minimum value must be less than or equal to the maximum value' |
|
79 | - ); |
|
80 | - } |
|
81 | - |
|
82 | - if ($max === $min) { |
|
83 | - return (int) $min; |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * Initialize variables to 0 |
|
88 | - * |
|
89 | - * We want to store: |
|
90 | - * $bytes => the number of random bytes we need |
|
91 | - * $mask => an integer bitmask (for use with the &) operator |
|
92 | - * so we can minimize the number of discards |
|
93 | - */ |
|
94 | - $attempts = $bits = $bytes = $mask = $valueShift = 0; |
|
95 | - /** @var int $attempts */ |
|
96 | - /** @var int $bits */ |
|
97 | - /** @var int $bytes */ |
|
98 | - /** @var int $mask */ |
|
99 | - /** @var int $valueShift */ |
|
100 | - |
|
101 | - /** |
|
102 | - * At this point, $range is a positive number greater than 0. It might |
|
103 | - * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to |
|
104 | - * a float and we will lose some precision. |
|
105 | - * |
|
106 | - * @var int|float $range |
|
107 | - */ |
|
108 | - $range = $max - $min; |
|
109 | - |
|
110 | - /** |
|
111 | - * Test for integer overflow: |
|
112 | - */ |
|
113 | - if (!is_int($range)) { |
|
114 | - |
|
115 | - /** |
|
116 | - * Still safely calculate wider ranges. |
|
117 | - * Provided by @CodesInChaos, @oittaa |
|
118 | - * |
|
119 | - * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435 |
|
120 | - * |
|
121 | - * We use ~0 as a mask in this case because it generates all 1s |
|
122 | - * |
|
123 | - * @ref https://eval.in/400356 (32-bit) |
|
124 | - * @ref http://3v4l.org/XX9r5 (64-bit) |
|
125 | - */ |
|
126 | - $bytes = PHP_INT_SIZE; |
|
127 | - /** @var int $mask */ |
|
128 | - $mask = ~0; |
|
129 | - |
|
130 | - } else { |
|
131 | - |
|
132 | - /** |
|
133 | - * $bits is effectively ceil(log($range, 2)) without dealing with |
|
134 | - * type juggling |
|
135 | - */ |
|
136 | - while ($range > 0) { |
|
137 | - if ($bits % 8 === 0) { |
|
138 | - ++$bytes; |
|
139 | - } |
|
140 | - ++$bits; |
|
141 | - $range >>= 1; |
|
142 | - /** @var int $mask */ |
|
143 | - $mask = $mask << 1 | 1; |
|
144 | - } |
|
145 | - $valueShift = $min; |
|
146 | - } |
|
147 | - |
|
148 | - /** @var int $val */ |
|
149 | - $val = 0; |
|
150 | - /** |
|
151 | - * Now that we have our parameters set up, let's begin generating |
|
152 | - * random integers until one falls between $min and $max |
|
153 | - */ |
|
154 | - /** @psalm-suppress RedundantCondition */ |
|
155 | - do { |
|
156 | - /** |
|
157 | - * The rejection probability is at most 0.5, so this corresponds |
|
158 | - * to a failure probability of 2^-128 for a working RNG |
|
159 | - */ |
|
160 | - if ($attempts > 128) { |
|
161 | - throw new Exception( |
|
162 | - 'random_int: RNG is broken - too many rejections' |
|
163 | - ); |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * Let's grab the necessary number of random bytes |
|
168 | - */ |
|
169 | - $randomByteString = random_bytes($bytes); |
|
170 | - |
|
171 | - /** |
|
172 | - * Let's turn $randomByteString into an integer |
|
173 | - * |
|
174 | - * This uses bitwise operators (<< and |) to build an integer |
|
175 | - * out of the values extracted from ord() |
|
176 | - * |
|
177 | - * Example: [9F] | [6D] | [32] | [0C] => |
|
178 | - * 159 + 27904 + 3276800 + 201326592 => |
|
179 | - * 204631455 |
|
180 | - */ |
|
181 | - $val &= 0; |
|
182 | - for ($i = 0; $i < $bytes; ++$i) { |
|
183 | - $val |= ord($randomByteString[$i]) << ($i * 8); |
|
184 | - } |
|
185 | - /** @var int $val */ |
|
186 | - |
|
187 | - /** |
|
188 | - * Apply mask |
|
189 | - */ |
|
190 | - $val &= $mask; |
|
191 | - $val += $valueShift; |
|
192 | - |
|
193 | - ++$attempts; |
|
194 | - /** |
|
195 | - * If $val overflows to a floating point number, |
|
196 | - * ... or is larger than $max, |
|
197 | - * ... or smaller than $min, |
|
198 | - * then try again. |
|
199 | - */ |
|
200 | - } while (!is_int($val) || $val > $max || $val < $min); |
|
201 | - |
|
202 | - return (int) $val; |
|
203 | - } |
|
4 | + /** |
|
5 | + * Random_* Compatibility Library |
|
6 | + * for using the new PHP 7 random_* API in PHP 5 projects |
|
7 | + * |
|
8 | + * The MIT License (MIT) |
|
9 | + * |
|
10 | + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises |
|
11 | + * |
|
12 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
13 | + * of this software and associated documentation files (the "Software"), to deal |
|
14 | + * in the Software without restriction, including without limitation the rights |
|
15 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
16 | + * copies of the Software, and to permit persons to whom the Software is |
|
17 | + * furnished to do so, subject to the following conditions: |
|
18 | + * |
|
19 | + * The above copyright notice and this permission notice shall be included in |
|
20 | + * all copies or substantial portions of the Software. |
|
21 | + * |
|
22 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
23 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
24 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
25 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
26 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
27 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
28 | + * SOFTWARE. |
|
29 | + */ |
|
30 | + |
|
31 | + /** |
|
32 | + * Fetch a random integer between $min and $max inclusive |
|
33 | + * |
|
34 | + * @param int $min |
|
35 | + * @param int $max |
|
36 | + * |
|
37 | + * @throws Exception |
|
38 | + * |
|
39 | + * @return int |
|
40 | + */ |
|
41 | + function random_int($min, $max) |
|
42 | + { |
|
43 | + /** |
|
44 | + * Type and input logic checks |
|
45 | + * |
|
46 | + * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) |
|
47 | + * (non-inclusive), it will sanely cast it to an int. If you it's equal to |
|
48 | + * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats |
|
49 | + * lose precision, so the <= and => operators might accidentally let a float |
|
50 | + * through. |
|
51 | + */ |
|
52 | + |
|
53 | + try { |
|
54 | + /** @var int $min */ |
|
55 | + $min = RandomCompat_intval($min); |
|
56 | + } catch (TypeError $ex) { |
|
57 | + throw new TypeError( |
|
58 | + 'random_int(): $min must be an integer' |
|
59 | + ); |
|
60 | + } |
|
61 | + |
|
62 | + try { |
|
63 | + /** @var int $max */ |
|
64 | + $max = RandomCompat_intval($max); |
|
65 | + } catch (TypeError $ex) { |
|
66 | + throw new TypeError( |
|
67 | + 'random_int(): $max must be an integer' |
|
68 | + ); |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Now that we've verified our weak typing system has given us an integer, |
|
73 | + * let's validate the logic then we can move forward with generating random |
|
74 | + * integers along a given range. |
|
75 | + */ |
|
76 | + if ($min > $max) { |
|
77 | + throw new Error( |
|
78 | + 'Minimum value must be less than or equal to the maximum value' |
|
79 | + ); |
|
80 | + } |
|
81 | + |
|
82 | + if ($max === $min) { |
|
83 | + return (int) $min; |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * Initialize variables to 0 |
|
88 | + * |
|
89 | + * We want to store: |
|
90 | + * $bytes => the number of random bytes we need |
|
91 | + * $mask => an integer bitmask (for use with the &) operator |
|
92 | + * so we can minimize the number of discards |
|
93 | + */ |
|
94 | + $attempts = $bits = $bytes = $mask = $valueShift = 0; |
|
95 | + /** @var int $attempts */ |
|
96 | + /** @var int $bits */ |
|
97 | + /** @var int $bytes */ |
|
98 | + /** @var int $mask */ |
|
99 | + /** @var int $valueShift */ |
|
100 | + |
|
101 | + /** |
|
102 | + * At this point, $range is a positive number greater than 0. It might |
|
103 | + * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to |
|
104 | + * a float and we will lose some precision. |
|
105 | + * |
|
106 | + * @var int|float $range |
|
107 | + */ |
|
108 | + $range = $max - $min; |
|
109 | + |
|
110 | + /** |
|
111 | + * Test for integer overflow: |
|
112 | + */ |
|
113 | + if (!is_int($range)) { |
|
114 | + |
|
115 | + /** |
|
116 | + * Still safely calculate wider ranges. |
|
117 | + * Provided by @CodesInChaos, @oittaa |
|
118 | + * |
|
119 | + * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435 |
|
120 | + * |
|
121 | + * We use ~0 as a mask in this case because it generates all 1s |
|
122 | + * |
|
123 | + * @ref https://eval.in/400356 (32-bit) |
|
124 | + * @ref http://3v4l.org/XX9r5 (64-bit) |
|
125 | + */ |
|
126 | + $bytes = PHP_INT_SIZE; |
|
127 | + /** @var int $mask */ |
|
128 | + $mask = ~0; |
|
129 | + |
|
130 | + } else { |
|
131 | + |
|
132 | + /** |
|
133 | + * $bits is effectively ceil(log($range, 2)) without dealing with |
|
134 | + * type juggling |
|
135 | + */ |
|
136 | + while ($range > 0) { |
|
137 | + if ($bits % 8 === 0) { |
|
138 | + ++$bytes; |
|
139 | + } |
|
140 | + ++$bits; |
|
141 | + $range >>= 1; |
|
142 | + /** @var int $mask */ |
|
143 | + $mask = $mask << 1 | 1; |
|
144 | + } |
|
145 | + $valueShift = $min; |
|
146 | + } |
|
147 | + |
|
148 | + /** @var int $val */ |
|
149 | + $val = 0; |
|
150 | + /** |
|
151 | + * Now that we have our parameters set up, let's begin generating |
|
152 | + * random integers until one falls between $min and $max |
|
153 | + */ |
|
154 | + /** @psalm-suppress RedundantCondition */ |
|
155 | + do { |
|
156 | + /** |
|
157 | + * The rejection probability is at most 0.5, so this corresponds |
|
158 | + * to a failure probability of 2^-128 for a working RNG |
|
159 | + */ |
|
160 | + if ($attempts > 128) { |
|
161 | + throw new Exception( |
|
162 | + 'random_int: RNG is broken - too many rejections' |
|
163 | + ); |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Let's grab the necessary number of random bytes |
|
168 | + */ |
|
169 | + $randomByteString = random_bytes($bytes); |
|
170 | + |
|
171 | + /** |
|
172 | + * Let's turn $randomByteString into an integer |
|
173 | + * |
|
174 | + * This uses bitwise operators (<< and |) to build an integer |
|
175 | + * out of the values extracted from ord() |
|
176 | + * |
|
177 | + * Example: [9F] | [6D] | [32] | [0C] => |
|
178 | + * 159 + 27904 + 3276800 + 201326592 => |
|
179 | + * 204631455 |
|
180 | + */ |
|
181 | + $val &= 0; |
|
182 | + for ($i = 0; $i < $bytes; ++$i) { |
|
183 | + $val |= ord($randomByteString[$i]) << ($i * 8); |
|
184 | + } |
|
185 | + /** @var int $val */ |
|
186 | + |
|
187 | + /** |
|
188 | + * Apply mask |
|
189 | + */ |
|
190 | + $val &= $mask; |
|
191 | + $val += $valueShift; |
|
192 | + |
|
193 | + ++$attempts; |
|
194 | + /** |
|
195 | + * If $val overflows to a floating point number, |
|
196 | + * ... or is larger than $max, |
|
197 | + * ... or smaller than $min, |
|
198 | + * then try again. |
|
199 | + */ |
|
200 | + } while (!is_int($val) || $val > $max || $val < $min); |
|
201 | + |
|
202 | + return (int) $val; |
|
203 | + } |
|
204 | 204 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!is_callable('random_int')) { |
|
3 | +if (!is_callable('random_int')) |
|
4 | +{ |
|
4 | 5 | /** |
5 | 6 | * Random_* Compatibility Library |
6 | 7 | * for using the new PHP 7 random_* API in PHP 5 projects |
@@ -50,19 +51,25 @@ discard block |
||
50 | 51 | * through. |
51 | 52 | */ |
52 | 53 | |
53 | - try { |
|
54 | + try |
|
55 | + { |
|
54 | 56 | /** @var int $min */ |
55 | 57 | $min = RandomCompat_intval($min); |
56 | - } catch (TypeError $ex) { |
|
58 | + } |
|
59 | + catch (TypeError $ex) |
|
60 | + { |
|
57 | 61 | throw new TypeError( |
58 | 62 | 'random_int(): $min must be an integer' |
59 | 63 | ); |
60 | 64 | } |
61 | 65 | |
62 | - try { |
|
66 | + try |
|
67 | + { |
|
63 | 68 | /** @var int $max */ |
64 | 69 | $max = RandomCompat_intval($max); |
65 | - } catch (TypeError $ex) { |
|
70 | + } |
|
71 | + catch (TypeError $ex) |
|
72 | + { |
|
66 | 73 | throw new TypeError( |
67 | 74 | 'random_int(): $max must be an integer' |
68 | 75 | ); |
@@ -73,13 +80,15 @@ discard block |
||
73 | 80 | * let's validate the logic then we can move forward with generating random |
74 | 81 | * integers along a given range. |
75 | 82 | */ |
76 | - if ($min > $max) { |
|
83 | + if ($min > $max) |
|
84 | + { |
|
77 | 85 | throw new Error( |
78 | 86 | 'Minimum value must be less than or equal to the maximum value' |
79 | 87 | ); |
80 | 88 | } |
81 | 89 | |
82 | - if ($max === $min) { |
|
90 | + if ($max === $min) |
|
91 | + { |
|
83 | 92 | return (int) $min; |
84 | 93 | } |
85 | 94 | |
@@ -110,7 +119,8 @@ discard block |
||
110 | 119 | /** |
111 | 120 | * Test for integer overflow: |
112 | 121 | */ |
113 | - if (!is_int($range)) { |
|
122 | + if (!is_int($range)) |
|
123 | + { |
|
114 | 124 | |
115 | 125 | /** |
116 | 126 | * Still safely calculate wider ranges. |
@@ -127,14 +137,18 @@ discard block |
||
127 | 137 | /** @var int $mask */ |
128 | 138 | $mask = ~0; |
129 | 139 | |
130 | - } else { |
|
140 | + } |
|
141 | + else |
|
142 | + { |
|
131 | 143 | |
132 | 144 | /** |
133 | 145 | * $bits is effectively ceil(log($range, 2)) without dealing with |
134 | 146 | * type juggling |
135 | 147 | */ |
136 | - while ($range > 0) { |
|
137 | - if ($bits % 8 === 0) { |
|
148 | + while ($range > 0) |
|
149 | + { |
|
150 | + if ($bits % 8 === 0) |
|
151 | + { |
|
138 | 152 | ++$bytes; |
139 | 153 | } |
140 | 154 | ++$bits; |
@@ -157,7 +171,8 @@ discard block |
||
157 | 171 | * The rejection probability is at most 0.5, so this corresponds |
158 | 172 | * to a failure probability of 2^-128 for a working RNG |
159 | 173 | */ |
160 | - if ($attempts > 128) { |
|
174 | + if ($attempts > 128) |
|
175 | + { |
|
161 | 176 | throw new Exception( |
162 | 177 | 'random_int: RNG is broken - too many rejections' |
163 | 178 | ); |
@@ -179,7 +194,8 @@ discard block |
||
179 | 194 | * 204631455 |
180 | 195 | */ |
181 | 196 | $val &= 0; |
182 | - for ($i = 0; $i < $bytes; ++$i) { |
|
197 | + for ($i = 0; $i < $bytes; ++$i) |
|
198 | + { |
|
183 | 199 | $val |= ord($randomByteString[$i]) << ($i * 8); |
184 | 200 | } |
185 | 201 | /** @var int $val */ |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | /** |
21 | 21 | * Constants for reply types. |
22 | - */ |
|
22 | + */ |
|
23 | 23 | const NOTIFY_TYPE_REPLY_AND_MODIFY = 1; |
24 | 24 | const NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING = 2; |
25 | 25 | const NOTIFY_TYPE_ONLY_REPLIES = 3; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Constants for frequencies. |
30 | - */ |
|
30 | + */ |
|
31 | 31 | const FREQUENCY_NOTHING = 0; |
32 | 32 | const FREQUENCY_EVERYTHING = 1; |
33 | 33 | const FREQUENCY_FIRST_UNREAD_MSG = 2; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | const FREQUENCY_WEEKLY_DIGEST = 4; |
36 | 36 | |
37 | 37 | /** |
38 | - * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
38 | + * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
39 | 39 | * @return bool Always returns true |
40 | 40 | */ |
41 | 41 | public function execute() |
@@ -103,7 +103,7 @@ |
||
103 | 103 | if ($type == 'edit') |
104 | 104 | { |
105 | 105 | // Filter out members who have already been notified about this post's topic |
106 | - $unnotified = array_filter($watched, function ($member) |
|
106 | + $unnotified = array_filter($watched, function($member) |
|
107 | 107 | { |
108 | 108 | return empty($member['sent']); |
109 | 109 | }); |
@@ -281,7 +281,7 @@ |
||
281 | 281 | { |
282 | 282 | /** |
283 | 283 | * Constants for notfication types. |
284 | - */ |
|
284 | + */ |
|
285 | 285 | const RECEIVE_NOTIFY_EMAIL = 0x02; |
286 | 286 | const RECEIVE_NOTIFY_ALERT = 0x01; |
287 | 287 |
@@ -419,7 +419,7 @@ |
||
419 | 419 | $board['last_post']['last_post_message'] = sprintf($txt['last_post_message'], $board['last_post']['member']['link'], $board['last_post']['link'], $board['last_post']['time'] > 0 ? timeformat($board['last_post']['time']) : $txt['not_applicable']); |
420 | 420 | } |
421 | 421 | } |
422 | - else |
|
422 | + else |
|
423 | 423 | foreach ($this_category as &$board) |
424 | 424 | { |
425 | 425 | if (!empty($moderators[$board['id']])) |
@@ -332,7 +332,6 @@ discard block |
||
332 | 332 | $replacement .= $precedingStyle . $extra_attr . $afterStyle; |
333 | 333 | } |
334 | 334 | } |
335 | - |
|
336 | 335 | elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1) |
337 | 336 | { |
338 | 337 | // Is this the element that we've been waiting for to be closed? |
@@ -592,7 +591,6 @@ discard block |
||
592 | 591 | $parts[$i + 2] = str_repeat("\t", $listDepth) . '[/list]'; |
593 | 592 | $parts[$i + 3] = ''; |
594 | 593 | } |
595 | - |
|
596 | 594 | else |
597 | 595 | { |
598 | 596 | // We're in a list item. |
@@ -631,7 +629,6 @@ discard block |
||
631 | 629 | $parts[$i + 2] = ''; |
632 | 630 | $parts[$i + 3] = ''; |
633 | 631 | } |
634 | - |
|
635 | 632 | else |
636 | 633 | { |
637 | 634 | // Remove the trailing breaks from the list item. |
@@ -280,7 +280,7 @@ |
||
280 | 280 | $ret .= |
281 | 281 | chr(($this->m_arColors[$i] & 0x000000FF)) . // R |
282 | 282 | chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G |
283 | - chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B |
|
283 | + chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | return $ret; |
@@ -67,8 +67,7 @@ |
||
67 | 67 | $sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8); |
68 | 68 | switch ($word{$i} === 's' ? 0 : mt_rand(0, 2)) |
69 | 69 | { |
70 | - case 0 : |
|
71 | - for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
70 | + case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
72 | 71 | for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++) |
73 | 72 | $sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(mt_rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF))); |
74 | 73 | break; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | if ($c === $n) { |
147 | 147 | $q = $delta; |
148 | - for ($k = static::BASE;; $k += static::BASE) { |
|
148 | + for ($k = static::BASE; ; $k += static::BASE) { |
|
149 | 149 | $t = $this->calculateThreshold($k, $bias); |
150 | 150 | if ($q < $t) { |
151 | 151 | break; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $oldi = $i; |
228 | 228 | $w = 1; |
229 | 229 | |
230 | - for ($k = static::BASE;; $k += static::BASE) |
|
230 | + for ($k = static::BASE; ; $k += static::BASE) |
|
231 | 231 | { |
232 | 232 | $digit = static::$decodeTable[$input[$pos++]]; |
233 | 233 | $i = $i + ($digit * $w); |
@@ -94,7 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | $input = mb_strtolower($input, $this->encoding); |
96 | 96 | $parts = explode('.', $input); |
97 | - foreach ($parts as &$part) { |
|
97 | + foreach ($parts as &$part) |
|
98 | + { |
|
98 | 99 | $part = $this->encodePart($part); |
99 | 100 | } |
100 | 101 | $output = implode('.', $parts); |
@@ -119,13 +120,16 @@ discard block |
||
119 | 120 | $h = $b = count($codePoints['basic']); |
120 | 121 | |
121 | 122 | $output = ''; |
122 | - foreach ($codePoints['basic'] as $code) { |
|
123 | + foreach ($codePoints['basic'] as $code) |
|
124 | + { |
|
123 | 125 | $output .= $this->codePointToChar($code); |
124 | 126 | } |
125 | - if ($input === $output) { |
|
127 | + if ($input === $output) |
|
128 | + { |
|
126 | 129 | return $output; |
127 | 130 | } |
128 | - if ($b > 0) { |
|
131 | + if ($b > 0) |
|
132 | + { |
|
129 | 133 | $output .= static::DELIMITER; |
130 | 134 | } |
131 | 135 | |
@@ -134,20 +138,26 @@ discard block |
||
134 | 138 | |
135 | 139 | $i = 0; |
136 | 140 | $length = mb_strlen($input, $this->encoding); |
137 | - while ($h < $length) { |
|
141 | + while ($h < $length) |
|
142 | + { |
|
138 | 143 | $m = $codePoints['nonBasic'][$i++]; |
139 | 144 | $delta = $delta + ($m - $n) * ($h + 1); |
140 | 145 | $n = $m; |
141 | 146 | |
142 | - foreach ($codePoints['all'] as $c) { |
|
143 | - if ($c < $n || $c < static::INITIAL_N) { |
|
147 | + foreach ($codePoints['all'] as $c) |
|
148 | + { |
|
149 | + if ($c < $n || $c < static::INITIAL_N) |
|
150 | + { |
|
144 | 151 | $delta++; |
145 | 152 | } |
146 | - if ($c === $n) { |
|
153 | + if ($c === $n) |
|
154 | + { |
|
147 | 155 | $q = $delta; |
148 | - for ($k = static::BASE;; $k += static::BASE) { |
|
156 | + for ($k = static::BASE;; $k += static::BASE) |
|
157 | + { |
|
149 | 158 | $t = $this->calculateThreshold($k, $bias); |
150 | - if ($q < $t) { |
|
159 | + if ($q < $t) |
|
160 | + { |
|
151 | 161 | break; |
152 | 162 | } |
153 | 163 |