@@ -8,24 +8,24 @@ |
||
8 | 8 | |
9 | 9 | $version_select = '<select size="1" name="idn_version"><option value="2003">IDNA 2003</option><option value="2008"'; |
10 | 10 | if ($idn_version == 2008) { |
11 | - $version_select .= ' selected="selected"'; |
|
11 | + $version_select .= ' selected="selected"'; |
|
12 | 12 | } |
13 | 13 | $version_select .= '>IDNA 2008</option></select>'; |
14 | 14 | |
15 | 15 | if (isset($_REQUEST['encode'])) { |
16 | - $decoded = isset($_REQUEST['decoded']) ? stripslashes($_REQUEST['decoded']) : ''; |
|
17 | - $encoded = $IDN->encode($decoded); |
|
16 | + $decoded = isset($_REQUEST['decoded']) ? stripslashes($_REQUEST['decoded']) : ''; |
|
17 | + $encoded = $IDN->encode($decoded); |
|
18 | 18 | } |
19 | 19 | if (isset($_REQUEST['decode'])) { |
20 | - $encoded = isset($_REQUEST['encoded']) ? stripslashes($_REQUEST['encoded']) : ''; |
|
21 | - $decoded = $IDN->decode($encoded); |
|
20 | + $encoded = isset($_REQUEST['encoded']) ? stripslashes($_REQUEST['encoded']) : ''; |
|
21 | + $decoded = $IDN->decode($encoded); |
|
22 | 22 | } |
23 | 23 | $lang = 'en'; |
24 | 24 | if (isset($_REQUEST['lang'])) { |
25 | - if ('de' == $_REQUEST['lang'] || 'en' == $_REQUEST['lang']) { |
|
26 | - $lang = $_REQUEST['lang']; |
|
27 | - $add .= '<input type="hidden" name="lang" value="'.$lang.'" />'."\n"; |
|
28 | - } |
|
25 | + if ('de' == $_REQUEST['lang'] || 'en' == $_REQUEST['lang']) { |
|
26 | + $lang = $_REQUEST['lang']; |
|
27 | + $add .= '<input type="hidden" name="lang" value="'.$lang.'" />'."\n"; |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | ?> |
31 | 31 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
@@ -24,7 +24,7 @@ |
||
24 | 24 | if (isset($_REQUEST['lang'])) { |
25 | 25 | if ('de' == $_REQUEST['lang'] || 'en' == $_REQUEST['lang']) { |
26 | 26 | $lang = $_REQUEST['lang']; |
27 | - $add .= '<input type="hidden" name="lang" value="'.$lang.'" />'."\n"; |
|
27 | + $add .= '<input type="hidden" name="lang" value="' . $lang . '" />' . "\n"; |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | ?> |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * transcode wrapper functions |
|
4 | - * @package IDNA Convert |
|
5 | - * @subpackage charset transcoding |
|
6 | - * @author Matthias Sommerfeld, <[email protected]> |
|
7 | - * @version 0.1.0 |
|
8 | - */ |
|
3 | + * transcode wrapper functions |
|
4 | + * @package IDNA Convert |
|
5 | + * @subpackage charset transcoding |
|
6 | + * @author Matthias Sommerfeld, <[email protected]> |
|
7 | + * @version 0.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Convert a string from any of various encodings to UTF-8 |
@@ -18,29 +18,29 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function encode_utf8($string = '', $encoding = 'iso-8859-1', $safe_mode = false) |
20 | 20 | { |
21 | - $safe = ($safe_mode) ? $string : false; |
|
22 | - if (strtoupper($encoding) == 'UTF-8' || strtoupper($encoding) == 'UTF8') { |
|
23 | - return $string; |
|
24 | - } elseif (strtoupper($encoding) == 'ISO-8859-1') { |
|
25 | - return utf8_encode($string); |
|
26 | - } elseif (strtoupper($encoding) == 'WINDOWS-1252') { |
|
27 | - return utf8_encode(map_w1252_iso8859_1($string)); |
|
28 | - } elseif (strtoupper($encoding) == 'UNICODE-1-1-UTF-7') { |
|
29 | - $encoding = 'utf-7'; |
|
30 | - } |
|
31 | - if (function_exists('mb_convert_encoding')) { |
|
32 | - $conv = @mb_convert_encoding($string, 'UTF-8', strtoupper($encoding)); |
|
33 | - if ($conv) return $conv; |
|
34 | - } |
|
35 | - if (function_exists('iconv')) { |
|
36 | - $conv = @iconv(strtoupper($encoding), 'UTF-8', $string); |
|
37 | - if ($conv) return $conv; |
|
38 | - } |
|
39 | - if (function_exists('libiconv')) { |
|
40 | - $conv = @libiconv(strtoupper($encoding), 'UTF-8', $string); |
|
41 | - if ($conv) return $conv; |
|
42 | - } |
|
43 | - return $safe; |
|
21 | + $safe = ($safe_mode) ? $string : false; |
|
22 | + if (strtoupper($encoding) == 'UTF-8' || strtoupper($encoding) == 'UTF8') { |
|
23 | + return $string; |
|
24 | + } elseif (strtoupper($encoding) == 'ISO-8859-1') { |
|
25 | + return utf8_encode($string); |
|
26 | + } elseif (strtoupper($encoding) == 'WINDOWS-1252') { |
|
27 | + return utf8_encode(map_w1252_iso8859_1($string)); |
|
28 | + } elseif (strtoupper($encoding) == 'UNICODE-1-1-UTF-7') { |
|
29 | + $encoding = 'utf-7'; |
|
30 | + } |
|
31 | + if (function_exists('mb_convert_encoding')) { |
|
32 | + $conv = @mb_convert_encoding($string, 'UTF-8', strtoupper($encoding)); |
|
33 | + if ($conv) return $conv; |
|
34 | + } |
|
35 | + if (function_exists('iconv')) { |
|
36 | + $conv = @iconv(strtoupper($encoding), 'UTF-8', $string); |
|
37 | + if ($conv) return $conv; |
|
38 | + } |
|
39 | + if (function_exists('libiconv')) { |
|
40 | + $conv = @libiconv(strtoupper($encoding), 'UTF-8', $string); |
|
41 | + if ($conv) return $conv; |
|
42 | + } |
|
43 | + return $safe; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -54,30 +54,30 @@ discard block |
||
54 | 54 | */ |
55 | 55 | function decode_utf8($string = '', $encoding = 'iso-8859-1', $safe_mode = false) |
56 | 56 | { |
57 | - $safe = ($safe_mode) ? $string : false; |
|
58 | - if (!$encoding) $encoding = 'ISO-8859-1'; |
|
59 | - if (strtoupper($encoding) == 'UTF-8' || strtoupper($encoding) == 'UTF8') { |
|
60 | - return $string; |
|
61 | - } elseif (strtoupper($encoding) == 'ISO-8859-1') { |
|
62 | - return utf8_decode($string); |
|
63 | - } elseif (strtoupper($encoding) == 'WINDOWS-1252') { |
|
64 | - return map_iso8859_1_w1252(utf8_decode($string)); |
|
65 | - } elseif (strtoupper($encoding) == 'UNICODE-1-1-UTF-7') { |
|
66 | - $encoding = 'utf-7'; |
|
67 | - } |
|
68 | - if (function_exists('mb_convert_encoding')) { |
|
69 | - $conv = @mb_convert_encoding($string, strtoupper($encoding), 'UTF-8'); |
|
70 | - if ($conv) return $conv; |
|
71 | - } |
|
72 | - if (function_exists('iconv')) { |
|
73 | - $conv = @iconv('UTF-8', strtoupper($encoding), $string); |
|
74 | - if ($conv) return $conv; |
|
75 | - } |
|
76 | - if (function_exists('libiconv')) { |
|
77 | - $conv = @libiconv('UTF-8', strtoupper($encoding), $string); |
|
78 | - if ($conv) return $conv; |
|
79 | - } |
|
80 | - return $safe; |
|
57 | + $safe = ($safe_mode) ? $string : false; |
|
58 | + if (!$encoding) $encoding = 'ISO-8859-1'; |
|
59 | + if (strtoupper($encoding) == 'UTF-8' || strtoupper($encoding) == 'UTF8') { |
|
60 | + return $string; |
|
61 | + } elseif (strtoupper($encoding) == 'ISO-8859-1') { |
|
62 | + return utf8_decode($string); |
|
63 | + } elseif (strtoupper($encoding) == 'WINDOWS-1252') { |
|
64 | + return map_iso8859_1_w1252(utf8_decode($string)); |
|
65 | + } elseif (strtoupper($encoding) == 'UNICODE-1-1-UTF-7') { |
|
66 | + $encoding = 'utf-7'; |
|
67 | + } |
|
68 | + if (function_exists('mb_convert_encoding')) { |
|
69 | + $conv = @mb_convert_encoding($string, strtoupper($encoding), 'UTF-8'); |
|
70 | + if ($conv) return $conv; |
|
71 | + } |
|
72 | + if (function_exists('iconv')) { |
|
73 | + $conv = @iconv('UTF-8', strtoupper($encoding), $string); |
|
74 | + if ($conv) return $conv; |
|
75 | + } |
|
76 | + if (function_exists('libiconv')) { |
|
77 | + $conv = @libiconv('UTF-8', strtoupper($encoding), $string); |
|
78 | + if ($conv) return $conv; |
|
79 | + } |
|
80 | + return $safe; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -89,22 +89,22 @@ discard block |
||
89 | 89 | */ |
90 | 90 | function map_w1252_iso8859_1($string = '') |
91 | 91 | { |
92 | - if ($string == '') return ''; |
|
93 | - $return = ''; |
|
94 | - for ($i = 0; $i < strlen($string); ++$i) { |
|
95 | - $c = ord($string{$i}); |
|
96 | - switch ($c) { |
|
97 | - case 129: $return .= chr(252); break; |
|
98 | - case 132: $return .= chr(228); break; |
|
99 | - case 142: $return .= chr(196); break; |
|
100 | - case 148: $return .= chr(246); break; |
|
101 | - case 153: $return .= chr(214); break; |
|
102 | - case 154: $return .= chr(220); break; |
|
103 | - case 225: $return .= chr(223); break; |
|
104 | - default: $return .= chr($c); break; |
|
105 | - } |
|
106 | - } |
|
107 | - return $return; |
|
92 | + if ($string == '') return ''; |
|
93 | + $return = ''; |
|
94 | + for ($i = 0; $i < strlen($string); ++$i) { |
|
95 | + $c = ord($string{$i}); |
|
96 | + switch ($c) { |
|
97 | + case 129: $return .= chr(252); break; |
|
98 | + case 132: $return .= chr(228); break; |
|
99 | + case 142: $return .= chr(196); break; |
|
100 | + case 148: $return .= chr(246); break; |
|
101 | + case 153: $return .= chr(214); break; |
|
102 | + case 154: $return .= chr(220); break; |
|
103 | + case 225: $return .= chr(223); break; |
|
104 | + default: $return .= chr($c); break; |
|
105 | + } |
|
106 | + } |
|
107 | + return $return; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -116,22 +116,22 @@ discard block |
||
116 | 116 | */ |
117 | 117 | function map_iso8859_1_w1252($string = '') |
118 | 118 | { |
119 | - if ($string == '') return ''; |
|
120 | - $return = ''; |
|
121 | - for ($i = 0; $i < strlen($string); ++$i) { |
|
122 | - $c = ord($string{$i}); |
|
123 | - switch ($c) { |
|
124 | - case 196: $return .= chr(142); break; |
|
125 | - case 214: $return .= chr(153); break; |
|
126 | - case 220: $return .= chr(154); break; |
|
127 | - case 223: $return .= chr(225); break; |
|
128 | - case 228: $return .= chr(132); break; |
|
129 | - case 246: $return .= chr(148); break; |
|
130 | - case 252: $return .= chr(129); break; |
|
131 | - default: $return .= chr($c); break; |
|
132 | - } |
|
133 | - } |
|
134 | - return $return; |
|
119 | + if ($string == '') return ''; |
|
120 | + $return = ''; |
|
121 | + for ($i = 0; $i < strlen($string); ++$i) { |
|
122 | + $c = ord($string{$i}); |
|
123 | + switch ($c) { |
|
124 | + case 196: $return .= chr(142); break; |
|
125 | + case 214: $return .= chr(153); break; |
|
126 | + case 220: $return .= chr(154); break; |
|
127 | + case 223: $return .= chr(225); break; |
|
128 | + case 228: $return .= chr(132); break; |
|
129 | + case 246: $return .= chr(148); break; |
|
130 | + case 252: $return .= chr(129); break; |
|
131 | + default: $return .= chr($c); break; |
|
132 | + } |
|
133 | + } |
|
134 | + return $return; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | ?> |
138 | 138 | \ No newline at end of file |
@@ -30,15 +30,21 @@ discard block |
||
30 | 30 | } |
31 | 31 | if (function_exists('mb_convert_encoding')) { |
32 | 32 | $conv = @mb_convert_encoding($string, 'UTF-8', strtoupper($encoding)); |
33 | - if ($conv) return $conv; |
|
33 | + if ($conv) { |
|
34 | + return $conv; |
|
35 | + } |
|
34 | 36 | } |
35 | 37 | if (function_exists('iconv')) { |
36 | 38 | $conv = @iconv(strtoupper($encoding), 'UTF-8', $string); |
37 | - if ($conv) return $conv; |
|
39 | + if ($conv) { |
|
40 | + return $conv; |
|
41 | + } |
|
38 | 42 | } |
39 | 43 | if (function_exists('libiconv')) { |
40 | 44 | $conv = @libiconv(strtoupper($encoding), 'UTF-8', $string); |
41 | - if ($conv) return $conv; |
|
45 | + if ($conv) { |
|
46 | + return $conv; |
|
47 | + } |
|
42 | 48 | } |
43 | 49 | return $safe; |
44 | 50 | } |
@@ -55,7 +61,9 @@ discard block |
||
55 | 61 | function decode_utf8($string = '', $encoding = 'iso-8859-1', $safe_mode = false) |
56 | 62 | { |
57 | 63 | $safe = ($safe_mode) ? $string : false; |
58 | - if (!$encoding) $encoding = 'ISO-8859-1'; |
|
64 | + if (!$encoding) { |
|
65 | + $encoding = 'ISO-8859-1'; |
|
66 | + } |
|
59 | 67 | if (strtoupper($encoding) == 'UTF-8' || strtoupper($encoding) == 'UTF8') { |
60 | 68 | return $string; |
61 | 69 | } elseif (strtoupper($encoding) == 'ISO-8859-1') { |
@@ -67,15 +75,21 @@ discard block |
||
67 | 75 | } |
68 | 76 | if (function_exists('mb_convert_encoding')) { |
69 | 77 | $conv = @mb_convert_encoding($string, strtoupper($encoding), 'UTF-8'); |
70 | - if ($conv) return $conv; |
|
78 | + if ($conv) { |
|
79 | + return $conv; |
|
80 | + } |
|
71 | 81 | } |
72 | 82 | if (function_exists('iconv')) { |
73 | 83 | $conv = @iconv('UTF-8', strtoupper($encoding), $string); |
74 | - if ($conv) return $conv; |
|
84 | + if ($conv) { |
|
85 | + return $conv; |
|
86 | + } |
|
75 | 87 | } |
76 | 88 | if (function_exists('libiconv')) { |
77 | 89 | $conv = @libiconv('UTF-8', strtoupper($encoding), $string); |
78 | - if ($conv) return $conv; |
|
90 | + if ($conv) { |
|
91 | + return $conv; |
|
92 | + } |
|
79 | 93 | } |
80 | 94 | return $safe; |
81 | 95 | } |
@@ -89,7 +103,9 @@ discard block |
||
89 | 103 | */ |
90 | 104 | function map_w1252_iso8859_1($string = '') |
91 | 105 | { |
92 | - if ($string == '') return ''; |
|
106 | + if ($string == '') { |
|
107 | + return ''; |
|
108 | + } |
|
93 | 109 | $return = ''; |
94 | 110 | for ($i = 0; $i < strlen($string); ++$i) { |
95 | 111 | $c = ord($string{$i}); |
@@ -116,7 +132,9 @@ discard block |
||
116 | 132 | */ |
117 | 133 | function map_iso8859_1_w1252($string = '') |
118 | 134 | { |
119 | - if ($string == '') return ''; |
|
135 | + if ($string == '') { |
|
136 | + return ''; |
|
137 | + } |
|
120 | 138 | $return = ''; |
121 | 139 | for ($i = 0; $i < strlen($string); ++$i) { |
122 | 140 | $c = ord($string{$i}); |
@@ -16,285 +16,285 @@ |
||
16 | 16 | * @version 0.0.6 2009-05-10 |
17 | 17 | */ |
18 | 18 | class uctc { |
19 | - private static $mechs = array('ucs4', /*'ucs4le', 'ucs4be', */'ucs4array', /*'utf16', 'utf16le', 'utf16be', */'utf8', 'utf7', 'utf7imap'); |
|
20 | - private static $allow_overlong = false; |
|
21 | - private static $safe_mode; |
|
22 | - private static $safe_char; |
|
19 | + private static $mechs = array('ucs4', /*'ucs4le', 'ucs4be', */'ucs4array', /*'utf16', 'utf16le', 'utf16be', */'utf8', 'utf7', 'utf7imap'); |
|
20 | + private static $allow_overlong = false; |
|
21 | + private static $safe_mode; |
|
22 | + private static $safe_char; |
|
23 | 23 | |
24 | - /** |
|
25 | - * The actual conversion routine |
|
26 | - * |
|
27 | - * @param mixed $data The data to convert, usually a string, array when converting from UCS-4 array |
|
28 | - * @param string $from Original encoding of the data |
|
29 | - * @param string $to Target encoding of the data |
|
30 | - * @param bool $safe_mode SafeMode tries to correct invalid codepoints |
|
31 | - * @return mixed False on failure, String or array on success, depending on target encoding |
|
32 | - * @access public |
|
33 | - * @since 0.0.1 |
|
34 | - */ |
|
35 | - public static function convert($data, $from, $to, $safe_mode = false, $safe_char = 0xFFFC) |
|
36 | - { |
|
37 | - self::$safe_mode = ($safe_mode) ? true : false; |
|
38 | - self::$safe_char = ($safe_char) ? $safe_char : 0xFFFC; |
|
39 | - if (self::$safe_mode) self::$allow_overlong = true; |
|
40 | - if (!in_array($from, self::$mechs)) throw new Exception('Invalid input format specified'); |
|
41 | - if (!in_array($to, self::$mechs)) throw new Exception('Invalid output format specified'); |
|
42 | - if ($from != 'ucs4array') eval('$data = self::'.$from.'_ucs4array($data);'); |
|
43 | - if ($to != 'ucs4array') eval('$data = self::ucs4array_'.$to.'($data);'); |
|
44 | - return $data; |
|
45 | - } |
|
24 | + /** |
|
25 | + * The actual conversion routine |
|
26 | + * |
|
27 | + * @param mixed $data The data to convert, usually a string, array when converting from UCS-4 array |
|
28 | + * @param string $from Original encoding of the data |
|
29 | + * @param string $to Target encoding of the data |
|
30 | + * @param bool $safe_mode SafeMode tries to correct invalid codepoints |
|
31 | + * @return mixed False on failure, String or array on success, depending on target encoding |
|
32 | + * @access public |
|
33 | + * @since 0.0.1 |
|
34 | + */ |
|
35 | + public static function convert($data, $from, $to, $safe_mode = false, $safe_char = 0xFFFC) |
|
36 | + { |
|
37 | + self::$safe_mode = ($safe_mode) ? true : false; |
|
38 | + self::$safe_char = ($safe_char) ? $safe_char : 0xFFFC; |
|
39 | + if (self::$safe_mode) self::$allow_overlong = true; |
|
40 | + if (!in_array($from, self::$mechs)) throw new Exception('Invalid input format specified'); |
|
41 | + if (!in_array($to, self::$mechs)) throw new Exception('Invalid output format specified'); |
|
42 | + if ($from != 'ucs4array') eval('$data = self::'.$from.'_ucs4array($data);'); |
|
43 | + if ($to != 'ucs4array') eval('$data = self::ucs4array_'.$to.'($data);'); |
|
44 | + return $data; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * This converts an UTF-8 encoded string to its UCS-4 representation |
|
49 | - * |
|
50 | - * @param string $input The UTF-8 string to convert |
|
51 | - * @return array Array of 32bit values representing each codepoint |
|
52 | - * @access private |
|
53 | - */ |
|
54 | - private static function utf8_ucs4array($input) |
|
55 | - { |
|
56 | - $output = array(); |
|
57 | - $out_len = 0; |
|
58 | - $inp_len = strlen($input); |
|
59 | - $mode = 'next'; |
|
60 | - $test = 'none'; |
|
61 | - for ($k = 0; $k < $inp_len; ++$k) { |
|
62 | - $v = ord($input{$k}); // Extract byte from input string |
|
47 | + /** |
|
48 | + * This converts an UTF-8 encoded string to its UCS-4 representation |
|
49 | + * |
|
50 | + * @param string $input The UTF-8 string to convert |
|
51 | + * @return array Array of 32bit values representing each codepoint |
|
52 | + * @access private |
|
53 | + */ |
|
54 | + private static function utf8_ucs4array($input) |
|
55 | + { |
|
56 | + $output = array(); |
|
57 | + $out_len = 0; |
|
58 | + $inp_len = strlen($input); |
|
59 | + $mode = 'next'; |
|
60 | + $test = 'none'; |
|
61 | + for ($k = 0; $k < $inp_len; ++$k) { |
|
62 | + $v = ord($input{$k}); // Extract byte from input string |
|
63 | 63 | |
64 | - if ($v < 128) { // We found an ASCII char - put into stirng as is |
|
65 | - $output[$out_len] = $v; |
|
66 | - ++$out_len; |
|
67 | - if ('add' == $mode) { |
|
68 | - if (self::$safe_mode) { |
|
69 | - $output[$out_len-2] = self::$safe_char; |
|
70 | - $mode = 'next'; |
|
71 | - } else { |
|
72 | - throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
73 | - } |
|
74 | - } |
|
75 | - continue; |
|
76 | - } |
|
77 | - if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char |
|
78 | - $start_byte = $v; |
|
79 | - $mode = 'add'; |
|
80 | - $test = 'range'; |
|
81 | - if ($v >> 5 == 6) { // &110xxxxx 10xxxxx |
|
82 | - $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left |
|
83 | - $v = ($v - 192) << 6; |
|
84 | - } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx |
|
85 | - $next_byte = 1; |
|
86 | - $v = ($v - 224) << 12; |
|
87 | - } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
88 | - $next_byte = 2; |
|
89 | - $v = ($v - 240) << 18; |
|
90 | - } elseif (self::$safe_mode) { |
|
91 | - $mode = 'next'; |
|
92 | - $output[$out_len] = self::$safe_char; |
|
93 | - ++$out_len; |
|
94 | - continue; |
|
95 | - } else { |
|
96 | - throw new Exception('This might be UTF-8, but I don\'t understand it at byte '.$k); |
|
97 | - } |
|
98 | - if ($inp_len-$k-$next_byte < 2) { |
|
99 | - $output[$out_len] = self::$safe_char; |
|
100 | - $mode = 'no'; |
|
101 | - continue; |
|
102 | - } |
|
64 | + if ($v < 128) { // We found an ASCII char - put into stirng as is |
|
65 | + $output[$out_len] = $v; |
|
66 | + ++$out_len; |
|
67 | + if ('add' == $mode) { |
|
68 | + if (self::$safe_mode) { |
|
69 | + $output[$out_len-2] = self::$safe_char; |
|
70 | + $mode = 'next'; |
|
71 | + } else { |
|
72 | + throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
73 | + } |
|
74 | + } |
|
75 | + continue; |
|
76 | + } |
|
77 | + if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char |
|
78 | + $start_byte = $v; |
|
79 | + $mode = 'add'; |
|
80 | + $test = 'range'; |
|
81 | + if ($v >> 5 == 6) { // &110xxxxx 10xxxxx |
|
82 | + $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left |
|
83 | + $v = ($v - 192) << 6; |
|
84 | + } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx |
|
85 | + $next_byte = 1; |
|
86 | + $v = ($v - 224) << 12; |
|
87 | + } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
88 | + $next_byte = 2; |
|
89 | + $v = ($v - 240) << 18; |
|
90 | + } elseif (self::$safe_mode) { |
|
91 | + $mode = 'next'; |
|
92 | + $output[$out_len] = self::$safe_char; |
|
93 | + ++$out_len; |
|
94 | + continue; |
|
95 | + } else { |
|
96 | + throw new Exception('This might be UTF-8, but I don\'t understand it at byte '.$k); |
|
97 | + } |
|
98 | + if ($inp_len-$k-$next_byte < 2) { |
|
99 | + $output[$out_len] = self::$safe_char; |
|
100 | + $mode = 'no'; |
|
101 | + continue; |
|
102 | + } |
|
103 | 103 | |
104 | - if ('add' == $mode) { |
|
105 | - $output[$out_len] = (int) $v; |
|
106 | - ++$out_len; |
|
107 | - continue; |
|
108 | - } |
|
109 | - } |
|
110 | - if ('add' == $mode) { |
|
111 | - if (!self::$allow_overlong && $test == 'range') { |
|
112 | - $test = 'none'; |
|
113 | - if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { |
|
114 | - throw new Exception('Bogus UTF-8 character detected (out of legal range) at byte '.$k); |
|
115 | - } |
|
116 | - } |
|
117 | - if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx |
|
118 | - $v = ($v-128) << ($next_byte*6); |
|
119 | - $output[($out_len-1)] += $v; |
|
120 | - --$next_byte; |
|
121 | - } else { |
|
122 | - if (self::$safe_mode) { |
|
123 | - $output[$out_len-1] = ord(self::$safe_char); |
|
124 | - $k--; |
|
125 | - $mode = 'next'; |
|
126 | - continue; |
|
127 | - } else { |
|
128 | - throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
129 | - } |
|
130 | - } |
|
131 | - if ($next_byte < 0) { |
|
132 | - $mode = 'next'; |
|
133 | - } |
|
134 | - } |
|
135 | - } // for |
|
136 | - return $output; |
|
137 | - } |
|
104 | + if ('add' == $mode) { |
|
105 | + $output[$out_len] = (int) $v; |
|
106 | + ++$out_len; |
|
107 | + continue; |
|
108 | + } |
|
109 | + } |
|
110 | + if ('add' == $mode) { |
|
111 | + if (!self::$allow_overlong && $test == 'range') { |
|
112 | + $test = 'none'; |
|
113 | + if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { |
|
114 | + throw new Exception('Bogus UTF-8 character detected (out of legal range) at byte '.$k); |
|
115 | + } |
|
116 | + } |
|
117 | + if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx |
|
118 | + $v = ($v-128) << ($next_byte*6); |
|
119 | + $output[($out_len-1)] += $v; |
|
120 | + --$next_byte; |
|
121 | + } else { |
|
122 | + if (self::$safe_mode) { |
|
123 | + $output[$out_len-1] = ord(self::$safe_char); |
|
124 | + $k--; |
|
125 | + $mode = 'next'; |
|
126 | + continue; |
|
127 | + } else { |
|
128 | + throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
129 | + } |
|
130 | + } |
|
131 | + if ($next_byte < 0) { |
|
132 | + $mode = 'next'; |
|
133 | + } |
|
134 | + } |
|
135 | + } // for |
|
136 | + return $output; |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Convert UCS-4 string into UTF-8 string |
|
141 | - * See utf8_ucs4array() for details |
|
142 | - * @access private |
|
143 | - */ |
|
144 | - private static function ucs4array_utf8($input) |
|
145 | - { |
|
146 | - $output = ''; |
|
147 | - foreach ($input as $v) { |
|
148 | - if ($v < 128) { // 7bit are transferred literally |
|
149 | - $output .= chr($v); |
|
150 | - } elseif ($v < (1 << 11)) { // 2 bytes |
|
151 | - $output .= chr(192+($v >> 6)).chr(128+($v & 63)); |
|
152 | - } elseif ($v < (1 << 16)) { // 3 bytes |
|
153 | - $output .= chr(224+($v >> 12)).chr(128+(($v >> 6) & 63)).chr(128+($v & 63)); |
|
154 | - } elseif ($v < (1 << 21)) { // 4 bytes |
|
155 | - $output .= chr(240+($v >> 18)).chr(128+(($v >> 12) & 63)).chr(128+(($v >> 6) & 63)).chr(128+($v & 63)); |
|
156 | - } elseif (self::$safe_mode) { |
|
157 | - $output .= self::$safe_char; |
|
158 | - } else { |
|
159 | - throw new Exception('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); |
|
160 | - } |
|
161 | - } |
|
162 | - return $output; |
|
163 | - } |
|
139 | + /** |
|
140 | + * Convert UCS-4 string into UTF-8 string |
|
141 | + * See utf8_ucs4array() for details |
|
142 | + * @access private |
|
143 | + */ |
|
144 | + private static function ucs4array_utf8($input) |
|
145 | + { |
|
146 | + $output = ''; |
|
147 | + foreach ($input as $v) { |
|
148 | + if ($v < 128) { // 7bit are transferred literally |
|
149 | + $output .= chr($v); |
|
150 | + } elseif ($v < (1 << 11)) { // 2 bytes |
|
151 | + $output .= chr(192+($v >> 6)).chr(128+($v & 63)); |
|
152 | + } elseif ($v < (1 << 16)) { // 3 bytes |
|
153 | + $output .= chr(224+($v >> 12)).chr(128+(($v >> 6) & 63)).chr(128+($v & 63)); |
|
154 | + } elseif ($v < (1 << 21)) { // 4 bytes |
|
155 | + $output .= chr(240+($v >> 18)).chr(128+(($v >> 12) & 63)).chr(128+(($v >> 6) & 63)).chr(128+($v & 63)); |
|
156 | + } elseif (self::$safe_mode) { |
|
157 | + $output .= self::$safe_char; |
|
158 | + } else { |
|
159 | + throw new Exception('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); |
|
160 | + } |
|
161 | + } |
|
162 | + return $output; |
|
163 | + } |
|
164 | 164 | |
165 | - private static function utf7imap_ucs4array($input) |
|
166 | - { |
|
167 | - return self::utf7_ucs4array(str_replace(',', '/', $input), '&'); |
|
168 | - } |
|
165 | + private static function utf7imap_ucs4array($input) |
|
166 | + { |
|
167 | + return self::utf7_ucs4array(str_replace(',', '/', $input), '&'); |
|
168 | + } |
|
169 | 169 | |
170 | - private static function utf7_ucs4array($input, $sc = '+') |
|
171 | - { |
|
172 | - $output = array(); |
|
173 | - $out_len = 0; |
|
174 | - $inp_len = strlen($input); |
|
175 | - $mode = 'd'; |
|
176 | - $b64 = ''; |
|
170 | + private static function utf7_ucs4array($input, $sc = '+') |
|
171 | + { |
|
172 | + $output = array(); |
|
173 | + $out_len = 0; |
|
174 | + $inp_len = strlen($input); |
|
175 | + $mode = 'd'; |
|
176 | + $b64 = ''; |
|
177 | 177 | |
178 | - for ($k = 0; $k < $inp_len; ++$k) { |
|
179 | - $c = $input{$k}; |
|
180 | - if (0 == ord($c)) continue; // Ignore zero bytes |
|
181 | - if ('b' == $mode) { |
|
182 | - // Sequence got terminated |
|
183 | - if (!preg_match('![A-Za-z0-9/'.preg_quote($sc, '!').']!', $c)) { |
|
184 | - if ('-' == $c) { |
|
185 | - if ($b64 == '') { |
|
186 | - $output[$out_len] = ord($sc); |
|
187 | - $out_len++; |
|
188 | - $mode = 'd'; |
|
189 | - continue; |
|
190 | - } |
|
191 | - } |
|
192 | - $tmp = base64_decode($b64); |
|
193 | - $tmp = substr($tmp, -1 * (strlen($tmp) % 2)); |
|
194 | - for ($i = 0; $i < strlen($tmp); $i++) { |
|
195 | - if ($i % 2) { |
|
196 | - $output[$out_len] += ord($tmp{$i}); |
|
197 | - $out_len++; |
|
198 | - } else { |
|
199 | - $output[$out_len] = ord($tmp{$i}) << 8; |
|
200 | - } |
|
201 | - } |
|
202 | - $mode = 'd'; |
|
203 | - $b64 = ''; |
|
204 | - continue; |
|
205 | - } else { |
|
206 | - $b64 .= $c; |
|
207 | - } |
|
208 | - } |
|
209 | - if ('d' == $mode) { |
|
210 | - if ($sc == $c) { |
|
211 | - $mode = 'b'; |
|
212 | - continue; |
|
213 | - } |
|
214 | - $output[$out_len] = ord($c); |
|
215 | - $out_len++; |
|
216 | - } |
|
217 | - } |
|
218 | - return $output; |
|
219 | - } |
|
178 | + for ($k = 0; $k < $inp_len; ++$k) { |
|
179 | + $c = $input{$k}; |
|
180 | + if (0 == ord($c)) continue; // Ignore zero bytes |
|
181 | + if ('b' == $mode) { |
|
182 | + // Sequence got terminated |
|
183 | + if (!preg_match('![A-Za-z0-9/'.preg_quote($sc, '!').']!', $c)) { |
|
184 | + if ('-' == $c) { |
|
185 | + if ($b64 == '') { |
|
186 | + $output[$out_len] = ord($sc); |
|
187 | + $out_len++; |
|
188 | + $mode = 'd'; |
|
189 | + continue; |
|
190 | + } |
|
191 | + } |
|
192 | + $tmp = base64_decode($b64); |
|
193 | + $tmp = substr($tmp, -1 * (strlen($tmp) % 2)); |
|
194 | + for ($i = 0; $i < strlen($tmp); $i++) { |
|
195 | + if ($i % 2) { |
|
196 | + $output[$out_len] += ord($tmp{$i}); |
|
197 | + $out_len++; |
|
198 | + } else { |
|
199 | + $output[$out_len] = ord($tmp{$i}) << 8; |
|
200 | + } |
|
201 | + } |
|
202 | + $mode = 'd'; |
|
203 | + $b64 = ''; |
|
204 | + continue; |
|
205 | + } else { |
|
206 | + $b64 .= $c; |
|
207 | + } |
|
208 | + } |
|
209 | + if ('d' == $mode) { |
|
210 | + if ($sc == $c) { |
|
211 | + $mode = 'b'; |
|
212 | + continue; |
|
213 | + } |
|
214 | + $output[$out_len] = ord($c); |
|
215 | + $out_len++; |
|
216 | + } |
|
217 | + } |
|
218 | + return $output; |
|
219 | + } |
|
220 | 220 | |
221 | - private static function ucs4array_utf7imap($input) |
|
222 | - { |
|
223 | - return str_replace('/', ',', self::ucs4array_utf7($input, '&')); |
|
224 | - } |
|
221 | + private static function ucs4array_utf7imap($input) |
|
222 | + { |
|
223 | + return str_replace('/', ',', self::ucs4array_utf7($input, '&')); |
|
224 | + } |
|
225 | 225 | |
226 | - private static function ucs4array_utf7($input, $sc = '+') |
|
227 | - { |
|
228 | - $output = ''; |
|
229 | - $mode = 'd'; |
|
230 | - $b64 = ''; |
|
231 | - while (true) { |
|
232 | - $v = (!empty($input)) ? array_shift($input) : false; |
|
233 | - $is_direct = (false !== $v) ? (0x20 <= $v && $v <= 0x7e && $v != ord($sc)) : true; |
|
234 | - if ($mode == 'b') { |
|
235 | - if ($is_direct) { |
|
236 | - if ($b64 == chr(0).$sc) { |
|
237 | - $output .= $sc.'-'; |
|
238 | - $b64 = ''; |
|
239 | - } elseif ($b64) { |
|
240 | - $output .= $sc.str_replace('=', '', base64_encode($b64)).'-'; |
|
241 | - $b64 = ''; |
|
242 | - } |
|
243 | - $mode = 'd'; |
|
244 | - } elseif (false !== $v) { |
|
245 | - $b64 .= chr(($v >> 8) & 255). chr($v & 255); |
|
246 | - } |
|
247 | - } |
|
248 | - if ($mode == 'd' && false !== $v) { |
|
249 | - if ($is_direct) { |
|
250 | - $output .= chr($v); |
|
251 | - } else { |
|
252 | - $b64 = chr(($v >> 8) & 255). chr($v & 255); |
|
253 | - $mode = 'b'; |
|
254 | - } |
|
255 | - } |
|
256 | - if (false === $v && $b64 == '') break; |
|
257 | - } |
|
258 | - return $output; |
|
259 | - } |
|
226 | + private static function ucs4array_utf7($input, $sc = '+') |
|
227 | + { |
|
228 | + $output = ''; |
|
229 | + $mode = 'd'; |
|
230 | + $b64 = ''; |
|
231 | + while (true) { |
|
232 | + $v = (!empty($input)) ? array_shift($input) : false; |
|
233 | + $is_direct = (false !== $v) ? (0x20 <= $v && $v <= 0x7e && $v != ord($sc)) : true; |
|
234 | + if ($mode == 'b') { |
|
235 | + if ($is_direct) { |
|
236 | + if ($b64 == chr(0).$sc) { |
|
237 | + $output .= $sc.'-'; |
|
238 | + $b64 = ''; |
|
239 | + } elseif ($b64) { |
|
240 | + $output .= $sc.str_replace('=', '', base64_encode($b64)).'-'; |
|
241 | + $b64 = ''; |
|
242 | + } |
|
243 | + $mode = 'd'; |
|
244 | + } elseif (false !== $v) { |
|
245 | + $b64 .= chr(($v >> 8) & 255). chr($v & 255); |
|
246 | + } |
|
247 | + } |
|
248 | + if ($mode == 'd' && false !== $v) { |
|
249 | + if ($is_direct) { |
|
250 | + $output .= chr($v); |
|
251 | + } else { |
|
252 | + $b64 = chr(($v >> 8) & 255). chr($v & 255); |
|
253 | + $mode = 'b'; |
|
254 | + } |
|
255 | + } |
|
256 | + if (false === $v && $b64 == '') break; |
|
257 | + } |
|
258 | + return $output; |
|
259 | + } |
|
260 | 260 | |
261 | - /** |
|
262 | - * Convert UCS-4 array into UCS-4 string (Little Endian at the moment) |
|
263 | - * @access private |
|
264 | - */ |
|
265 | - private static function ucs4array_ucs4($input) |
|
266 | - { |
|
267 | - $output = ''; |
|
268 | - foreach ($input as $v) { |
|
269 | - $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); |
|
270 | - } |
|
271 | - return $output; |
|
272 | - } |
|
261 | + /** |
|
262 | + * Convert UCS-4 array into UCS-4 string (Little Endian at the moment) |
|
263 | + * @access private |
|
264 | + */ |
|
265 | + private static function ucs4array_ucs4($input) |
|
266 | + { |
|
267 | + $output = ''; |
|
268 | + foreach ($input as $v) { |
|
269 | + $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); |
|
270 | + } |
|
271 | + return $output; |
|
272 | + } |
|
273 | 273 | |
274 | - /** |
|
275 | - * Convert UCS-4 string (LE in the moment) into UCS-4 garray |
|
276 | - * @access private |
|
277 | - */ |
|
278 | - private static function ucs4_ucs4array($input) |
|
279 | - { |
|
280 | - $output = array(); |
|
274 | + /** |
|
275 | + * Convert UCS-4 string (LE in the moment) into UCS-4 garray |
|
276 | + * @access private |
|
277 | + */ |
|
278 | + private static function ucs4_ucs4array($input) |
|
279 | + { |
|
280 | + $output = array(); |
|
281 | 281 | |
282 | - $inp_len = strlen($input); |
|
283 | - // Input length must be dividable by 4 |
|
284 | - if ($inp_len % 4) { |
|
285 | - throw new Exception('Input UCS4 string is broken'); |
|
286 | - } |
|
287 | - // Empty input - return empty output |
|
288 | - if (!$inp_len) return $output; |
|
282 | + $inp_len = strlen($input); |
|
283 | + // Input length must be dividable by 4 |
|
284 | + if ($inp_len % 4) { |
|
285 | + throw new Exception('Input UCS4 string is broken'); |
|
286 | + } |
|
287 | + // Empty input - return empty output |
|
288 | + if (!$inp_len) return $output; |
|
289 | 289 | |
290 | - for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) { |
|
291 | - if (!($i % 4)) { // Increment output position every 4 input bytes |
|
292 | - $out_len++; |
|
293 | - $output[$out_len] = 0; |
|
294 | - } |
|
295 | - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); |
|
296 | - } |
|
297 | - return $output; |
|
298 | - } |
|
290 | + for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) { |
|
291 | + if (!($i % 4)) { // Increment output position every 4 input bytes |
|
292 | + $out_len++; |
|
293 | + $output[$out_len] = 0; |
|
294 | + } |
|
295 | + $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); |
|
296 | + } |
|
297 | + return $output; |
|
298 | + } |
|
299 | 299 | } |
300 | 300 | ?> |
301 | 301 | \ No newline at end of file |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | if (self::$safe_mode) self::$allow_overlong = true; |
40 | 40 | if (!in_array($from, self::$mechs)) throw new Exception('Invalid input format specified'); |
41 | 41 | if (!in_array($to, self::$mechs)) throw new Exception('Invalid output format specified'); |
42 | - if ($from != 'ucs4array') eval('$data = self::'.$from.'_ucs4array($data);'); |
|
43 | - if ($to != 'ucs4array') eval('$data = self::ucs4array_'.$to.'($data);'); |
|
42 | + if ($from != 'ucs4array') eval('$data = self::' . $from . '_ucs4array($data);'); |
|
43 | + if ($to != 'ucs4array') eval('$data = self::ucs4array_' . $to . '($data);'); |
|
44 | 44 | return $data; |
45 | 45 | } |
46 | 46 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | ++$out_len; |
67 | 67 | if ('add' == $mode) { |
68 | 68 | if (self::$safe_mode) { |
69 | - $output[$out_len-2] = self::$safe_char; |
|
69 | + $output[$out_len - 2] = self::$safe_char; |
|
70 | 70 | $mode = 'next'; |
71 | 71 | } else { |
72 | - throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
72 | + throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | continue; |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | ++$out_len; |
94 | 94 | continue; |
95 | 95 | } else { |
96 | - throw new Exception('This might be UTF-8, but I don\'t understand it at byte '.$k); |
|
96 | + throw new Exception('This might be UTF-8, but I don\'t understand it at byte ' . $k); |
|
97 | 97 | } |
98 | - if ($inp_len-$k-$next_byte < 2) { |
|
98 | + if ($inp_len - $k - $next_byte < 2) { |
|
99 | 99 | $output[$out_len] = self::$safe_char; |
100 | 100 | $mode = 'no'; |
101 | 101 | continue; |
@@ -111,21 +111,21 @@ discard block |
||
111 | 111 | if (!self::$allow_overlong && $test == 'range') { |
112 | 112 | $test = 'none'; |
113 | 113 | if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { |
114 | - throw new Exception('Bogus UTF-8 character detected (out of legal range) at byte '.$k); |
|
114 | + throw new Exception('Bogus UTF-8 character detected (out of legal range) at byte ' . $k); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx |
118 | - $v = ($v-128) << ($next_byte*6); |
|
119 | - $output[($out_len-1)] += $v; |
|
118 | + $v = ($v - 128) << ($next_byte * 6); |
|
119 | + $output[($out_len - 1)] += $v; |
|
120 | 120 | --$next_byte; |
121 | 121 | } else { |
122 | 122 | if (self::$safe_mode) { |
123 | - $output[$out_len-1] = ord(self::$safe_char); |
|
123 | + $output[$out_len - 1] = ord(self::$safe_char); |
|
124 | 124 | $k--; |
125 | 125 | $mode = 'next'; |
126 | 126 | continue; |
127 | 127 | } else { |
128 | - throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
128 | + throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | if ($next_byte < 0) { |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | if ($v < 128) { // 7bit are transferred literally |
149 | 149 | $output .= chr($v); |
150 | 150 | } elseif ($v < (1 << 11)) { // 2 bytes |
151 | - $output .= chr(192+($v >> 6)).chr(128+($v & 63)); |
|
151 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
152 | 152 | } elseif ($v < (1 << 16)) { // 3 bytes |
153 | - $output .= chr(224+($v >> 12)).chr(128+(($v >> 6) & 63)).chr(128+($v & 63)); |
|
153 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
154 | 154 | } elseif ($v < (1 << 21)) { // 4 bytes |
155 | - $output .= chr(240+($v >> 18)).chr(128+(($v >> 12) & 63)).chr(128+(($v >> 6) & 63)).chr(128+($v & 63)); |
|
155 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
156 | 156 | } elseif (self::$safe_mode) { |
157 | 157 | $output .= self::$safe_char; |
158 | 158 | } else { |
159 | - throw new Exception('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); |
|
159 | + throw new Exception('Conversion from UCS-4 to UTF-8 failed: malformed input at byte ' . $k); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | return $output; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if (0 == ord($c)) continue; // Ignore zero bytes |
181 | 181 | if ('b' == $mode) { |
182 | 182 | // Sequence got terminated |
183 | - if (!preg_match('![A-Za-z0-9/'.preg_quote($sc, '!').']!', $c)) { |
|
183 | + if (!preg_match('![A-Za-z0-9/' . preg_quote($sc, '!') . ']!', $c)) { |
|
184 | 184 | if ('-' == $c) { |
185 | 185 | if ($b64 == '') { |
186 | 186 | $output[$out_len] = ord($sc); |
@@ -233,23 +233,23 @@ discard block |
||
233 | 233 | $is_direct = (false !== $v) ? (0x20 <= $v && $v <= 0x7e && $v != ord($sc)) : true; |
234 | 234 | if ($mode == 'b') { |
235 | 235 | if ($is_direct) { |
236 | - if ($b64 == chr(0).$sc) { |
|
237 | - $output .= $sc.'-'; |
|
236 | + if ($b64 == chr(0) . $sc) { |
|
237 | + $output .= $sc . '-'; |
|
238 | 238 | $b64 = ''; |
239 | 239 | } elseif ($b64) { |
240 | - $output .= $sc.str_replace('=', '', base64_encode($b64)).'-'; |
|
240 | + $output .= $sc . str_replace('=', '', base64_encode($b64)) . '-'; |
|
241 | 241 | $b64 = ''; |
242 | 242 | } |
243 | 243 | $mode = 'd'; |
244 | 244 | } elseif (false !== $v) { |
245 | - $b64 .= chr(($v >> 8) & 255). chr($v & 255); |
|
245 | + $b64 .= chr(($v >> 8) & 255) . chr($v & 255); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | if ($mode == 'd' && false !== $v) { |
249 | 249 | if ($is_direct) { |
250 | 250 | $output .= chr($v); |
251 | 251 | } else { |
252 | - $b64 = chr(($v >> 8) & 255). chr($v & 255); |
|
252 | + $b64 = chr(($v >> 8) & 255) . chr($v & 255); |
|
253 | 253 | $mode = 'b'; |
254 | 254 | } |
255 | 255 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | { |
267 | 267 | $output = ''; |
268 | 268 | foreach ($input as $v) { |
269 | - $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); |
|
269 | + $output .= chr(($v >> 24) & 255) . chr(($v >> 16) & 255) . chr(($v >> 8) & 255) . chr($v & 255); |
|
270 | 270 | } |
271 | 271 | return $output; |
272 | 272 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $out_len++; |
293 | 293 | $output[$out_len] = 0; |
294 | 294 | } |
295 | - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); |
|
295 | + $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4))); |
|
296 | 296 | } |
297 | 297 | return $output; |
298 | 298 | } |
@@ -36,11 +36,21 @@ discard block |
||
36 | 36 | { |
37 | 37 | self::$safe_mode = ($safe_mode) ? true : false; |
38 | 38 | self::$safe_char = ($safe_char) ? $safe_char : 0xFFFC; |
39 | - if (self::$safe_mode) self::$allow_overlong = true; |
|
40 | - if (!in_array($from, self::$mechs)) throw new Exception('Invalid input format specified'); |
|
41 | - if (!in_array($to, self::$mechs)) throw new Exception('Invalid output format specified'); |
|
42 | - if ($from != 'ucs4array') eval('$data = self::'.$from.'_ucs4array($data);'); |
|
43 | - if ($to != 'ucs4array') eval('$data = self::ucs4array_'.$to.'($data);'); |
|
39 | + if (self::$safe_mode) { |
|
40 | + self::$allow_overlong = true; |
|
41 | + } |
|
42 | + if (!in_array($from, self::$mechs)) { |
|
43 | + throw new Exception('Invalid input format specified'); |
|
44 | + } |
|
45 | + if (!in_array($to, self::$mechs)) { |
|
46 | + throw new Exception('Invalid output format specified'); |
|
47 | + } |
|
48 | + if ($from != 'ucs4array') { |
|
49 | + eval('$data = self::'.$from.'_ucs4array($data);'); |
|
50 | + } |
|
51 | + if ($to != 'ucs4array') { |
|
52 | + eval('$data = self::ucs4array_'.$to.'($data);'); |
|
53 | + } |
|
44 | 54 | return $data; |
45 | 55 | } |
46 | 56 | |
@@ -177,7 +187,10 @@ discard block |
||
177 | 187 | |
178 | 188 | for ($k = 0; $k < $inp_len; ++$k) { |
179 | 189 | $c = $input{$k}; |
180 | - if (0 == ord($c)) continue; // Ignore zero bytes |
|
190 | + if (0 == ord($c)) { |
|
191 | + continue; |
|
192 | + } |
|
193 | + // Ignore zero bytes |
|
181 | 194 | if ('b' == $mode) { |
182 | 195 | // Sequence got terminated |
183 | 196 | if (!preg_match('![A-Za-z0-9/'.preg_quote($sc, '!').']!', $c)) { |
@@ -253,7 +266,9 @@ discard block |
||
253 | 266 | $mode = 'b'; |
254 | 267 | } |
255 | 268 | } |
256 | - if (false === $v && $b64 == '') break; |
|
269 | + if (false === $v && $b64 == '') { |
|
270 | + break; |
|
271 | + } |
|
257 | 272 | } |
258 | 273 | return $output; |
259 | 274 | } |
@@ -285,7 +300,9 @@ discard block |
||
285 | 300 | throw new Exception('Input UCS4 string is broken'); |
286 | 301 | } |
287 | 302 | // Empty input - return empty output |
288 | - if (!$inp_len) return $output; |
|
303 | + if (!$inp_len) { |
|
304 | + return $output; |
|
305 | + } |
|
289 | 306 | |
290 | 307 | for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) { |
291 | 308 | if (!($i % 4)) { // Increment output position every 4 input bytes |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * PHPMailer language file. |
|
4 | - * English Version |
|
5 | - */ |
|
3 | + * PHPMailer language file. |
|
4 | + * English Version |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | $PHPMAILER_LANG = array(); |
8 | 8 | |
9 | 9 | $PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' . |
10 | - 'recipient email address.'; |
|
10 | + 'recipient email address.'; |
|
11 | 11 | $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.'; |
12 | 12 | $PHPMAILER_LANG["execute"] = 'Could not execute: '; |
13 | 13 | $PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.'; |
14 | 14 | $PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.'; |
15 | 15 | $PHPMAILER_LANG["from_failed"] = 'The following From address failed: '; |
16 | 16 | $PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' . |
17 | - 'recipients failed: '; |
|
17 | + 'recipients failed: '; |
|
18 | 18 | $PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.'; |
19 | 19 | $PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.'; |
20 | 20 | $PHPMAILER_LANG["file_access"] = 'Could not access file: '; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $site_module_info = Context::get('site_module_info'); |
35 | 35 | |
36 | - if($site_module_info->site_srl) |
|
36 | + if ($site_module_info->site_srl) |
|
37 | 37 | { |
38 | 38 | $site_srl = $site_module_info->site_srl; |
39 | 39 | } |
@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | $site_srl = 0; |
43 | 43 | } |
44 | 44 | |
45 | - if(!$pcOnList) |
|
45 | + if (!$pcOnList) |
|
46 | 46 | { |
47 | 47 | $pcOnList = array(); |
48 | 48 | } |
49 | - if(!$mobileOnList) |
|
49 | + if (!$mobileOnList) |
|
50 | 50 | { |
51 | 51 | $mobileOnList = array(); |
52 | 52 | } |
53 | - if(!$fixed) |
|
53 | + if (!$fixed) |
|
54 | 54 | { |
55 | 55 | $fixed = array(); |
56 | 56 | } |
57 | 57 | |
58 | - if(!is_array($pcOnList)) |
|
58 | + if (!is_array($pcOnList)) |
|
59 | 59 | { |
60 | 60 | $pcOnList = array($pcOnList); |
61 | 61 | } |
62 | - if(!is_array($mobileOnList)) |
|
62 | + if (!is_array($mobileOnList)) |
|
63 | 63 | { |
64 | 64 | $pcOnList = array($mobileOnList); |
65 | 65 | } |
66 | - if(!is_array($fixed)) |
|
66 | + if (!is_array($fixed)) |
|
67 | 67 | { |
68 | 68 | $pcOnList = array($fixed); |
69 | 69 | } |
@@ -74,21 +74,21 @@ discard block |
||
74 | 74 | |
75 | 75 | // get need update addon list |
76 | 76 | $updateList = array(); |
77 | - foreach($currentAddonList as $addon) |
|
77 | + foreach ($currentAddonList as $addon) |
|
78 | 78 | { |
79 | - if($addon->activated !== in_array($addon->addon_name, $pcOnList)) |
|
79 | + if ($addon->activated !== in_array($addon->addon_name, $pcOnList)) |
|
80 | 80 | { |
81 | 81 | $updateList[] = $addon->addon_name; |
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | |
85 | - if($addon->mactivated !== in_array($addon->addon_name, $mobileOnList)) |
|
85 | + if ($addon->mactivated !== in_array($addon->addon_name, $mobileOnList)) |
|
86 | 86 | { |
87 | 87 | $updateList[] = $addon->addon_name; |
88 | 88 | continue; |
89 | 89 | } |
90 | 90 | |
91 | - if($addon->fixed !== in_array($addon->addon_name, $fixed)) |
|
91 | + if ($addon->fixed !== in_array($addon->addon_name, $fixed)) |
|
92 | 92 | { |
93 | 93 | $updateList[] = $addon->addon_name; |
94 | 94 | continue; |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | // update |
99 | - foreach($updateList as $targetAddon) |
|
99 | + foreach ($updateList as $targetAddon) |
|
100 | 100 | { |
101 | 101 | $args = new stdClass(); |
102 | 102 | |
103 | - if(in_array($targetAddon, $pcOnList)) |
|
103 | + if (in_array($targetAddon, $pcOnList)) |
|
104 | 104 | { |
105 | 105 | $args->is_used = 'Y'; |
106 | 106 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $args->is_used = 'N'; |
110 | 110 | } |
111 | 111 | |
112 | - if(in_array($targetAddon, $mobileOnList)) |
|
112 | + if (in_array($targetAddon, $mobileOnList)) |
|
113 | 113 | { |
114 | 114 | $args->is_used_m = 'Y'; |
115 | 115 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $args->is_used_m = 'N'; |
119 | 119 | } |
120 | 120 | |
121 | - if(in_array($targetAddon, $fixed)) |
|
121 | + if (in_array($targetAddon, $fixed)) |
|
122 | 122 | { |
123 | 123 | $args->fixed = 'Y'; |
124 | 124 | } |
@@ -131,20 +131,20 @@ discard block |
||
131 | 131 | $args->site_srl = $site_srl; |
132 | 132 | |
133 | 133 | $output = executeQuery('addon.updateSiteAddon', $args); |
134 | - if(!$output->toBool()) |
|
134 | + if (!$output->toBool()) |
|
135 | 135 | { |
136 | 136 | return $output; |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if(count($updateList)) |
|
140 | + if (count($updateList)) |
|
141 | 141 | { |
142 | 142 | $this->makeCacheFile($site_srl, 'pc', 'site'); |
143 | 143 | $this->makeCacheFile($site_srl, 'mobile', 'site'); |
144 | 144 | } |
145 | 145 | |
146 | 146 | $this->setMessage('success_updated', 'info'); |
147 | - if(Context::get('success_return_url')) |
|
147 | + if (Context::get('success_return_url')) |
|
148 | 148 | { |
149 | 149 | $this->setRedirectUrl(Context::get('success_return_url')); |
150 | 150 | } |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | // batahom addon values |
168 | 168 | $addon = Context::get('addon'); |
169 | 169 | $type = Context::get('type'); |
170 | - if(!$type) |
|
170 | + if (!$type) |
|
171 | 171 | { |
172 | 172 | $type = "pc"; |
173 | 173 | } |
174 | - if($addon) |
|
174 | + if ($addon) |
|
175 | 175 | { |
176 | 176 | // If enabled Disables |
177 | - if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type)) |
|
177 | + if ($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type)) |
|
178 | 178 | { |
179 | 179 | $this->doDeactivate($addon, $site_module_info->site_srl, $type); |
180 | 180 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $site_module_info = Context::get('site_module_info'); |
208 | 208 | |
209 | 209 | $output = $this->doSetup($addon_name, $args, $site_module_info->site_srl, 'site'); |
210 | - if(!$output->toBool()) |
|
210 | + if (!$output->toBool()) |
|
211 | 211 | { |
212 | 212 | return $output; |
213 | 213 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $args = new stdClass; |
233 | 233 | $args->addon = $addon; |
234 | 234 | $args->is_used = $isUsed; |
235 | - if($gtype == 'global') |
|
235 | + if ($gtype == 'global') |
|
236 | 236 | { |
237 | 237 | return executeQuery('addon.insertAddon', $args); |
238 | 238 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | { |
254 | 254 | $args = new stdClass(); |
255 | 255 | $args->addon = $addon; |
256 | - if($type == "pc") |
|
256 | + if ($type == "pc") |
|
257 | 257 | { |
258 | 258 | $args->is_used = 'Y'; |
259 | 259 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | { |
262 | 262 | $args->is_used_m = "Y"; |
263 | 263 | } |
264 | - if($gtype == 'global') |
|
264 | + if ($gtype == 'global') |
|
265 | 265 | { |
266 | 266 | return executeQuery('addon.updateAddon', $args); |
267 | 267 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | { |
282 | 282 | $args = new stdClass(); |
283 | 283 | $args->addon = $addon; |
284 | - if($type == "pc") |
|
284 | + if ($type == "pc") |
|
285 | 285 | { |
286 | 286 | $args->is_used = 'N'; |
287 | 287 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | { |
290 | 290 | $args->is_used_m = 'N'; |
291 | 291 | } |
292 | - if($gtype == 'global') |
|
292 | + if ($gtype == 'global') |
|
293 | 293 | { |
294 | 294 | return executeQuery('addon.updateAddon', $args); |
295 | 295 | } |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | if($site_module_info->site_srl) |
37 | 37 | { |
38 | 38 | $site_srl = $site_module_info->site_srl; |
39 | - } |
|
40 | - else |
|
39 | + } else |
|
41 | 40 | { |
42 | 41 | $site_srl = 0; |
43 | 42 | } |
@@ -103,8 +102,7 @@ discard block |
||
103 | 102 | if(in_array($targetAddon, $pcOnList)) |
104 | 103 | { |
105 | 104 | $args->is_used = 'Y'; |
106 | - } |
|
107 | - else |
|
105 | + } else |
|
108 | 106 | { |
109 | 107 | $args->is_used = 'N'; |
110 | 108 | } |
@@ -112,8 +110,7 @@ discard block |
||
112 | 110 | if(in_array($targetAddon, $mobileOnList)) |
113 | 111 | { |
114 | 112 | $args->is_used_m = 'Y'; |
115 | - } |
|
116 | - else |
|
113 | + } else |
|
117 | 114 | { |
118 | 115 | $args->is_used_m = 'N'; |
119 | 116 | } |
@@ -121,8 +118,7 @@ discard block |
||
121 | 118 | if(in_array($targetAddon, $fixed)) |
122 | 119 | { |
123 | 120 | $args->fixed = 'Y'; |
124 | - } |
|
125 | - else |
|
121 | + } else |
|
126 | 122 | { |
127 | 123 | $args->fixed = 'N'; |
128 | 124 | } |
@@ -147,8 +143,7 @@ discard block |
||
147 | 143 | if(Context::get('success_return_url')) |
148 | 144 | { |
149 | 145 | $this->setRedirectUrl(Context::get('success_return_url')); |
150 | - } |
|
151 | - else |
|
146 | + } else |
|
152 | 147 | { |
153 | 148 | $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAddonAdminIndex')); |
154 | 149 | } |
@@ -256,8 +251,7 @@ discard block |
||
256 | 251 | if($type == "pc") |
257 | 252 | { |
258 | 253 | $args->is_used = 'Y'; |
259 | - } |
|
260 | - else |
|
254 | + } else |
|
261 | 255 | { |
262 | 256 | $args->is_used_m = "Y"; |
263 | 257 | } |
@@ -284,8 +278,7 @@ discard block |
||
284 | 278 | if($type == "pc") |
285 | 279 | { |
286 | 280 | $args->is_used = 'N'; |
287 | - } |
|
288 | - else |
|
281 | + } else |
|
289 | 282 | { |
290 | 283 | $args->is_used_m = 'N'; |
291 | 284 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $security = new Security($addon_list); |
35 | 35 | $addon_list = $security->encodeHTML('..', '..author..'); |
36 | 36 | |
37 | - foreach($addon_list as $no => $addon_info) |
|
37 | + foreach ($addon_list as $no => $addon_info) |
|
38 | 38 | { |
39 | 39 | $addon_list[$no]->description = nl2br(trim($addon_info->description)); |
40 | 40 | } |
@@ -64,21 +64,21 @@ discard block |
||
64 | 64 | $oModuleAdminModel = getAdminModel('module'); |
65 | 65 | |
66 | 66 | $args = new stdClass(); |
67 | - if($site_module_info->site_srl) |
|
67 | + if ($site_module_info->site_srl) |
|
68 | 68 | { |
69 | 69 | $args->site_srl = $site_module_info->site_srl; |
70 | 70 | } |
71 | 71 | $columnList = array('module_srl', 'module_category_srl', 'mid', 'browser_title'); |
72 | 72 | $mid_list = $oModuleModel->getMidList($args, $columnList); |
73 | 73 | // module_category and module combination |
74 | - if(!$site_module_info->site_srl) |
|
74 | + if (!$site_module_info->site_srl) |
|
75 | 75 | { |
76 | 76 | // Get a list of module categories |
77 | 77 | $module_categories = $oModuleModel->getModuleCategories(); |
78 | 78 | |
79 | - if(is_array($mid_list)) |
|
79 | + if (is_array($mid_list)) |
|
80 | 80 | { |
81 | - foreach($mid_list as $module_srl => $module) |
|
81 | + foreach ($mid_list as $module_srl => $module) |
|
82 | 82 | { |
83 | 83 | $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
84 | 84 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // Template specifies the path and file |
97 | 97 | $this->setTemplateFile('setup_addon'); |
98 | 98 | |
99 | - if(Context::get('module') != 'admin') |
|
99 | + if (Context::get('module') != 'admin') |
|
100 | 100 | { |
101 | 101 | $this->setLayoutPath('./common/tpl'); |
102 | 102 | $this->setLayoutFile('popup_layout'); |
@@ -21,8 +21,7 @@ |
||
21 | 21 | if($absolute_url) |
22 | 22 | { |
23 | 23 | return getFullUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
24 | - } |
|
25 | - else |
|
24 | + } else |
|
26 | 25 | { |
27 | 26 | return getUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
28 | 27 | } |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | function checkUpdate() |
39 | 39 | { |
40 | 40 | $oDB = DB::getInstance(); |
41 | - if(!$oDB->isColumnExists("addons", "is_used_m")) |
|
41 | + if (!$oDB->isColumnExists("addons", "is_used_m")) |
|
42 | 42 | { |
43 | 43 | return TRUE; |
44 | 44 | } |
45 | - if(!$oDB->isColumnExists("addons_site", "is_used_m")) |
|
45 | + if (!$oDB->isColumnExists("addons_site", "is_used_m")) |
|
46 | 46 | { |
47 | 47 | return TRUE; |
48 | 48 | } |
49 | 49 | |
50 | 50 | // 2011. 7. 29. add is_fixed column |
51 | - if(!$oDB->isColumnExists('addons', 'is_fixed')) |
|
51 | + if (!$oDB->isColumnExists('addons', 'is_fixed')) |
|
52 | 52 | { |
53 | 53 | return TRUE; |
54 | 54 | } |
@@ -64,25 +64,25 @@ discard block |
||
64 | 64 | function moduleUpdate() |
65 | 65 | { |
66 | 66 | $oDB = DB::getInstance(); |
67 | - if(!$oDB->isColumnExists("addons", "is_used_m")) |
|
67 | + if (!$oDB->isColumnExists("addons", "is_used_m")) |
|
68 | 68 | { |
69 | 69 | $oDB->addColumn("addons", "is_used_m", "char", 1, "N", TRUE); |
70 | 70 | } |
71 | - if(!$oDB->isColumnExists("addons_site", "is_used_m")) |
|
71 | + if (!$oDB->isColumnExists("addons_site", "is_used_m")) |
|
72 | 72 | { |
73 | 73 | $oDB->addColumn("addons_site", "is_used_m", "char", 1, "N", TRUE); |
74 | 74 | } |
75 | 75 | |
76 | 76 | // 2011. 7. 29. add is_fixed column |
77 | - if(!$oDB->isColumnExists('addons', 'is_fixed')) |
|
77 | + if (!$oDB->isColumnExists('addons', 'is_fixed')) |
|
78 | 78 | { |
79 | 79 | $oDB->addColumn('addons', 'is_fixed', 'char', 1, 'N', TRUE); |
80 | 80 | |
81 | 81 | // move addon info to addon_site table |
82 | 82 | $output = executeQueryArray('addon.getAddons'); |
83 | - if($output->data) |
|
83 | + if ($output->data) |
|
84 | 84 | { |
85 | - foreach($output->data as $row) |
|
85 | + foreach ($output->data as $row) |
|
86 | 86 | { |
87 | 87 | $args = new stdClass(); |
88 | 88 | $args->site_srl = 0; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | function getCacheFilePath($type = "pc") |
27 | 27 | { |
28 | 28 | static $addon_file; |
29 | - if(isset($addon_file)) |
|
29 | + if (isset($addon_file)) |
|
30 | 30 | { |
31 | 31 | return $addon_file; |
32 | 32 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $addon_path = _XE_PATH_ . 'files/cache/addons/'; |
38 | 38 | $addon_file = $addon_path . $site_srl . $type . '.acivated_addons.cache.php'; |
39 | 39 | |
40 | - if($this->addon_file_called) |
|
40 | + if ($this->addon_file_called) |
|
41 | 41 | { |
42 | 42 | return $addon_file; |
43 | 43 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | FileHandler::makeDir($addon_path); |
48 | 48 | |
49 | - if(!file_exists($addon_file)) |
|
49 | + if (!file_exists($addon_file)) |
|
50 | 50 | { |
51 | 51 | $this->makeCacheFile($site_srl, $type); |
52 | 52 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | $buff = array('<?php if(!defined("__XE__")) exit();', '$_m = Context::get(\'mid\');'); |
83 | 83 | $oAddonModel = getAdminModel('addon'); |
84 | 84 | $addon_list = $oAddonModel->getInsertedAddons($site_srl, $gtype); |
85 | - foreach($addon_list as $addon => $val) |
|
85 | + foreach ($addon_list as $addon => $val) |
|
86 | 86 | { |
87 | - if($val->addon == "smartphone" |
|
87 | + if ($val->addon == "smartphone" |
|
88 | 88 | || ($type == "pc" && $val->is_used != 'Y') |
89 | 89 | || ($type == "mobile" && $val->is_used_m != 'Y') |
90 | 90 | || ($gtype == 'global' && $val->is_fixed != 'Y') |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $extra_vars = unserialize($val->extra_vars); |
97 | 97 | $mid_list = $extra_vars->mid_list; |
98 | - if(!is_array($mid_list) || count($mid_list) < 1) |
|
98 | + if (!is_array($mid_list) || count($mid_list) < 1) |
|
99 | 99 | { |
100 | 100 | $mid_list = NULL; |
101 | 101 | } |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | $buff[] = '$before_time = microtime(true);'; |
104 | 104 | $buff[] = '$rm = \'' . $extra_vars->xe_run_method . "';"; |
105 | 105 | $buff[] = '$ml = array('; |
106 | - if($mid_list) |
|
106 | + if ($mid_list) |
|
107 | 107 | { |
108 | - foreach($mid_list as $mid) |
|
108 | + foreach ($mid_list as $mid) |
|
109 | 109 | { |
110 | 110 | $buff[] = "'$mid' => 1,"; |
111 | 111 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $buff[] = ');'; |
114 | 114 | $buff[] = sprintf('$addon_file = \'./addons/%s/%s.addon.php\';', $addon, $addon); |
115 | 115 | |
116 | - if($val->extra_vars) |
|
116 | + if ($val->extra_vars) |
|
117 | 117 | { |
118 | 118 | unset($extra_vars); |
119 | 119 | $extra_vars = base64_encode($val->extra_vars); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | function doSetup($addon, $extra_vars, $site_srl = 0, $gtype = 'site') |
154 | 154 | { |
155 | - if(!is_array($extra_vars->mid_list)) |
|
155 | + if (!is_array($extra_vars->mid_list)) |
|
156 | 156 | { |
157 | 157 | unset($extra_vars->mid_list); |
158 | 158 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $args = new stdClass(); |
161 | 161 | $args->addon = $addon; |
162 | 162 | $args->extra_vars = serialize($extra_vars); |
163 | - if($gtype == 'global') |
|
163 | + if ($gtype == 'global') |
|
164 | 164 | { |
165 | 165 | return executeQuery('addon.updateAddon', $args); |
166 | 166 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | $addon_path = _XE_PATH_ . 'files/cache/addons/'; |
180 | 180 | $addon_file = $addon_path . $site_srl . '.acivated_addons.cache.php'; |
181 | - if(file_exists($addon_file)) |
|
181 | + if (file_exists($addon_file)) |
|
182 | 182 | { |
183 | 183 | FileHandler::removeFile($addon_file); |
184 | 184 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $db_info = Context::getDBInfo(); |
30 | 30 | |
31 | - if(strpos($db_info->default_url, 'xn--') !== FALSE) |
|
31 | + if (strpos($db_info->default_url, 'xn--') !== FALSE) |
|
32 | 32 | { |
33 | 33 | $xe_default_url = Context::decodeIdna($db_info->default_url); |
34 | 34 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | // forbit access if the user is not an administrator |
49 | 49 | $oMemberModel = getModel('member'); |
50 | 50 | $logged_info = $oMemberModel->getLoggedInfo(); |
51 | - if($logged_info->is_admin != 'Y') |
|
51 | + if ($logged_info->is_admin != 'Y') |
|
52 | 52 | { |
53 | 53 | return $this->stop("msg_is_not_administrator"); |
54 | 54 | } |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | Context::set('use_db_session', $db_info->use_db_session == 'N' ? 'N' : 'Y'); |
75 | 75 | Context::set('use_mobile_view', $db_info->use_mobile_view == 'Y' ? 'Y' : 'N'); |
76 | 76 | Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none"); |
77 | - if($db_info->http_port) |
|
77 | + if ($db_info->http_port) |
|
78 | 78 | { |
79 | 79 | Context::set('http_port', $db_info->http_port); |
80 | 80 | } |
81 | - if($db_info->https_port) |
|
81 | + if ($db_info->https_port) |
|
82 | 82 | { |
83 | 83 | Context::set('https_port', $db_info->https_port); |
84 | 84 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | function checkEasyinstall() |
95 | 95 | { |
96 | 96 | $lastTime = (int) FileHandler::readFile($this->easyinstallCheckFile); |
97 | - if($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
|
97 | + if ($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
|
98 | 98 | { |
99 | 99 | return; |
100 | 100 | } |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | $lUpdateDoc = $xml_lUpdate->parse($buff); |
109 | 109 | $updateDate = $lUpdateDoc->response->updatedate->body; |
110 | 110 | |
111 | - if(!$updateDate) |
|
111 | + if (!$updateDate) |
|
112 | 112 | { |
113 | 113 | $this->_markingCheckEasyinstall(); |
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | $item = $oAutoinstallModel->getLatestPackage(); |
118 | - if(!$item || $item->updatedate < $updateDate) |
|
118 | + if (!$item || $item->updatedate < $updateDate) |
|
119 | 119 | { |
120 | 120 | $oController = getAdminController('autoinstall'); |
121 | 121 | $oController->_updateinfo(); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | // Check is_shortcut column |
146 | 146 | $oDB = DB::getInstance(); |
147 | - if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
147 | + if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
148 | 148 | { |
149 | 149 | return; |
150 | 150 | } |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | $currentAct = Context::get('act'); |
163 | 163 | $subMenuTitle = ''; |
164 | 164 | |
165 | - foreach((array) $moduleActionInfo->menu as $key => $value) |
|
165 | + foreach ((array) $moduleActionInfo->menu as $key => $value) |
|
166 | 166 | { |
167 | - if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
|
167 | + if (isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
|
168 | 168 | { |
169 | 169 | $subMenuTitle = $value->title; |
170 | 170 | break; |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | // get current menu's srl(=parentSrl) |
174 | 174 | $parentSrl = 0; |
175 | 175 | $oMenuAdminConroller = getAdminController('menu'); |
176 | - foreach((array) $menu->list as $parentKey => $parentMenu) |
|
176 | + foreach ((array) $menu->list as $parentKey => $parentMenu) |
|
177 | 177 | { |
178 | - if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
|
178 | + if (!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
|
179 | 179 | { |
180 | 180 | continue; |
181 | 181 | } |
182 | - if($parentMenu['href'] == '#' && count($parentMenu['list'])) |
|
182 | + if ($parentMenu['href'] == '#' && count($parentMenu['list'])) |
|
183 | 183 | { |
184 | 184 | $firstChild = current($parentMenu['list']); |
185 | 185 | $menu->list[$parentKey]['href'] = $firstChild['href']; |
186 | 186 | } |
187 | 187 | |
188 | - foreach($parentMenu['list'] as $childKey => $childMenu) |
|
188 | + foreach ($parentMenu['list'] as $childKey => $childMenu) |
|
189 | 189 | { |
190 | - if($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
|
190 | + if ($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
|
191 | 191 | { |
192 | 192 | $parentSrl = $childMenu['parent_srl']; |
193 | 193 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | // move from index method, because use in admin footer |
212 | 212 | $newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __XE_VERSION__, _XE_PACKAGE_); |
213 | 213 | $cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); |
214 | - if(!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
|
214 | + if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
|
215 | 215 | { |
216 | 216 | // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page |
217 | 217 | // Ensure to access the administration page even though news cannot be displayed |
@@ -219,20 +219,20 @@ discard block |
||
219 | 219 | FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); |
220 | 220 | } |
221 | 221 | |
222 | - if(file_exists($cache_file)) |
|
222 | + if (file_exists($cache_file)) |
|
223 | 223 | { |
224 | 224 | $oXml = new XmlParser(); |
225 | 225 | $buff = $oXml->parse(FileHandler::readFile($cache_file)); |
226 | 226 | |
227 | 227 | $item = $buff->zbxe_news->item; |
228 | - if($item) |
|
228 | + if ($item) |
|
229 | 229 | { |
230 | - if(!is_array($item)) |
|
230 | + if (!is_array($item)) |
|
231 | 231 | { |
232 | 232 | $item = array($item); |
233 | 233 | } |
234 | 234 | |
235 | - foreach($item as $key => $val) |
|
235 | + foreach ($item as $key => $val) |
|
236 | 236 | { |
237 | 237 | $obj = new stdClass(); |
238 | 238 | $obj->title = $val->body; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $news[] = $obj; |
242 | 242 | } |
243 | 243 | Context::set('news', $news); |
244 | - if(isset($news) && is_array($news)) |
|
244 | + if (isset($news) && is_array($news)) |
|
245 | 245 | { |
246 | 246 | Context::set('latestVersion', array_shift($news)); |
247 | 247 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | function dispAdminIndex() |
265 | 265 | { |
266 | 266 | $db_info = Context::getDBInfo(); |
267 | - Context::set('db_info',$db_info); |
|
267 | + Context::set('db_info', $db_info); |
|
268 | 268 | |
269 | 269 | // Get statistics |
270 | 270 | $args = new stdClass(); |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | $args = new stdClass(); |
302 | 302 | $args->list_count = 5; |
303 | 303 | $output = $oCommentModel->getNewestCommentList($args, $columnList); |
304 | - if(is_array($output)) |
|
304 | + if (is_array($output)) |
|
305 | 305 | { |
306 | - foreach($output AS $key => $value) |
|
306 | + foreach ($output AS $key => $value) |
|
307 | 307 | { |
308 | 308 | $value->content = strip_tags($value->content); |
309 | 309 | } |
@@ -314,17 +314,17 @@ discard block |
||
314 | 314 | // Get list of modules |
315 | 315 | $oModuleModel = getModel('module'); |
316 | 316 | $module_list = $oModuleModel->getModuleList(); |
317 | - if(is_array($module_list)) |
|
317 | + if (is_array($module_list)) |
|
318 | 318 | { |
319 | 319 | $needUpdate = FALSE; |
320 | 320 | $addTables = FALSE; |
321 | - foreach($module_list AS $key => $value) |
|
321 | + foreach ($module_list AS $key => $value) |
|
322 | 322 | { |
323 | - if($value->need_install) |
|
323 | + if ($value->need_install) |
|
324 | 324 | { |
325 | 325 | $addTables = TRUE; |
326 | 326 | } |
327 | - if($value->need_update) |
|
327 | + if ($value->need_update) |
|
328 | 328 | { |
329 | 329 | $needUpdate = TRUE; |
330 | 330 | } |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | $oAutoinstallAdminModel = getAdminModel('autoinstall'); |
336 | 336 | $needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList(); |
337 | 337 | |
338 | - if(is_array($needUpdateList)) |
|
338 | + if (is_array($needUpdateList)) |
|
339 | 339 | { |
340 | - foreach($needUpdateList AS $key => $value) |
|
340 | + foreach ($needUpdateList AS $key => $value) |
|
341 | 341 | { |
342 | 342 | $helpUrl = './admin/help/index.html#'; |
343 | - switch($value->type) |
|
343 | + switch ($value->type) |
|
344 | 344 | { |
345 | 345 | case 'addon': |
346 | 346 | $helpUrl .= 'UMAN_terminology_addon'; |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | |
368 | 368 | $site_module_info = Context::get('site_module_info'); |
369 | 369 | $oAddonAdminModel = getAdminModel('addon'); |
370 | - $counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl ); |
|
371 | - if(!$counterAddonActivated) |
|
370 | + $counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl); |
|
371 | + if (!$counterAddonActivated) |
|
372 | 372 | { |
373 | 373 | $columnList = array('member_srl', 'nick_name', 'user_name', 'user_id', 'email_address'); |
374 | 374 | $args = new stdClass; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
394 | 394 | $path = FileHandler::getRealPath('./files/env/' . $mainVersion); |
395 | 395 | $isEnviromentGatheringAgreement = FALSE; |
396 | - if(file_exists($path)) |
|
396 | + if (file_exists($path)) |
|
397 | 397 | { |
398 | 398 | $isEnviromentGatheringAgreement = TRUE; |
399 | 399 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $isLicenseAgreement = FALSE; |
404 | 404 | $path = FileHandler::getRealPath('./files/env/license_agreement'); |
405 | 405 | $isLicenseAgreement = FALSE; |
406 | - if(file_exists($path)) |
|
406 | + if (file_exists($path)) |
|
407 | 407 | { |
408 | 408 | $isLicenseAgreement = TRUE; |
409 | 409 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | |
426 | 426 | Context::set('selected_lang', $db_info->lang_type); |
427 | 427 | |
428 | - if(strpos($db_info->default_url, 'xn--') !== FALSE) |
|
428 | + if (strpos($db_info->default_url, 'xn--') !== FALSE) |
|
429 | 429 | { |
430 | 430 | $db_info->default_url = Context::decodeIdna($db_info->default_url); |
431 | 431 | } |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | |
435 | 435 | // site lock |
436 | 436 | Context::set('IP', $_SERVER['REMOTE_ADDR']); |
437 | - if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
438 | - if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
439 | - if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
437 | + if (!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
438 | + if (!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
439 | + if (!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
440 | 440 | $db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist); |
441 | 441 | Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); |
442 | 442 | Context::set('use_sitelock', $db_info->use_sitelock); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | Context::set('sitelock_whitelist', $whitelist); |
448 | 448 | |
449 | 449 | |
450 | - if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
450 | + if ($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
451 | 451 | else $admin_ip_list = ''; |
452 | 452 | Context::set('admin_ip_list', $admin_ip_list); |
453 | 453 | |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | $oAdminModel = getAdminModel('admin'); |
457 | 457 | $favicon_url = $oAdminModel->getFaviconUrl(); |
458 | 458 | $mobicon_url = $oAdminModel->getMobileIconUrl(); |
459 | - Context::set('favicon_url', $favicon_url.'?'.$_SERVER['REQUEST_TIME']); |
|
460 | - Context::set('mobicon_url', $mobicon_url.'?'.$_SERVER['REQUEST_TIME']); |
|
459 | + Context::set('favicon_url', $favicon_url . '?' . $_SERVER['REQUEST_TIME']); |
|
460 | + Context::set('mobicon_url', $mobicon_url . '?' . $_SERVER['REQUEST_TIME']); |
|
461 | 461 | |
462 | 462 | $oDocumentModel = getModel('document'); |
463 | 463 | $config = $oDocumentModel->getDocumentConfig(); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | */ |
530 | 530 | function showSendEnv() |
531 | 531 | { |
532 | - if(Context::getResponseMethod() != 'HTML') |
|
532 | + if (Context::getResponseMethod() != 'HTML') |
|
533 | 533 | { |
534 | 534 | return; |
535 | 535 | } |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | $install_env = $path . 'install'; |
540 | 540 | $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
541 | 541 | |
542 | - if(file_exists(FileHandler::getRealPath($install_env))) |
|
542 | + if (file_exists(FileHandler::getRealPath($install_env))) |
|
543 | 543 | { |
544 | 544 | $oAdminAdminModel = getAdminModel('admin'); |
545 | 545 | $params = $oAdminAdminModel->getEnv('INSTALL'); |
@@ -548,9 +548,9 @@ discard block |
||
548 | 548 | |
549 | 549 | FileHandler::writeFile($path . $mainVersion, '1'); |
550 | 550 | } |
551 | - else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
551 | + else if (isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
552 | 552 | { |
553 | - if($_SESSION['enviroment_gather'] == 'Y') |
|
553 | + if ($_SESSION['enviroment_gather'] == 'Y') |
|
554 | 554 | { |
555 | 555 | $oAdminAdminModel = getAdminModel('admin'); |
556 | 556 | $params = $oAdminAdminModel->getEnv(); |
@@ -576,64 +576,64 @@ discard block |
||
576 | 576 | $tmp = explode("&", $envInfo); |
577 | 577 | $arrInfo = array(); |
578 | 578 | $xe_check_env = array(); |
579 | - foreach($tmp as $value) { |
|
579 | + foreach ($tmp as $value) { |
|
580 | 580 | $arr = explode("=", $value); |
581 | - if($arr[0]=="type") { |
|
581 | + if ($arr[0] == "type") { |
|
582 | 582 | continue; |
583 | - }elseif($arr[0]=="phpext" ) { |
|
583 | + }elseif ($arr[0] == "phpext") { |
|
584 | 584 | $str = urldecode($arr[1]); |
585 | - $xe_check_env[$arr[0]]= str_replace("|", ", ", $str); |
|
586 | - } elseif($arr[0]=="module" ) { |
|
585 | + $xe_check_env[$arr[0]] = str_replace("|", ", ", $str); |
|
586 | + } elseif ($arr[0] == "module") { |
|
587 | 587 | $str = urldecode($arr[1]); |
588 | 588 | $arrModuleName = explode("|", $str); |
589 | 589 | $oModuleModel = getModel("module"); |
590 | 590 | $mInfo = array(); |
591 | - foreach($arrModuleName as $moduleName) { |
|
591 | + foreach ($arrModuleName as $moduleName) { |
|
592 | 592 | $moduleInfo = $oModuleModel->getModuleInfoXml($moduleName); |
593 | 593 | $mInfo[] = "{$moduleName}({$moduleInfo->version})"; |
594 | 594 | } |
595 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
596 | - } elseif($arr[0]=="addon") { |
|
595 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
596 | + } elseif ($arr[0] == "addon") { |
|
597 | 597 | $str = urldecode($arr[1]); |
598 | 598 | $arrAddonName = explode("|", $str); |
599 | 599 | $oAddonModel = getAdminModel("addon"); |
600 | 600 | $mInfo = array(); |
601 | - foreach($arrAddonName as $addonName) { |
|
601 | + foreach ($arrAddonName as $addonName) { |
|
602 | 602 | $addonInfo = $oAddonModel->getAddonInfoXml($addonName); |
603 | 603 | $mInfo[] = "{$addonName}({$addonInfo->version})"; |
604 | 604 | } |
605 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
606 | - } elseif($arr[0]=="widget") { |
|
605 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
606 | + } elseif ($arr[0] == "widget") { |
|
607 | 607 | $str = urldecode($arr[1]); |
608 | 608 | $arrWidgetName = explode("|", $str); |
609 | 609 | $oWidgetModel = getModel("widget"); |
610 | 610 | $mInfo = array(); |
611 | - foreach($arrWidgetName as $widgetName) { |
|
611 | + foreach ($arrWidgetName as $widgetName) { |
|
612 | 612 | $widgetInfo = $oWidgetModel->getWidgetInfo($widgetName); |
613 | 613 | $mInfo[] = "{$widgetName}({$widgetInfo->version})"; |
614 | 614 | } |
615 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
616 | - } elseif($arr[0]=="widgetstyle") { |
|
615 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
616 | + } elseif ($arr[0] == "widgetstyle") { |
|
617 | 617 | $str = urldecode($arr[1]); |
618 | 618 | $arrWidgetstyleName = explode("|", $str); |
619 | 619 | $oWidgetModel = getModel("widget"); |
620 | 620 | $mInfo = array(); |
621 | - foreach($arrWidgetstyleName as $widgetstyleName) { |
|
621 | + foreach ($arrWidgetstyleName as $widgetstyleName) { |
|
622 | 622 | $widgetstyleInfo = $oWidgetModel->getWidgetStyleInfo($widgetstyleName); |
623 | 623 | $mInfo[] = "{$widgetstyleName}({$widgetstyleInfo->version})"; |
624 | 624 | } |
625 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
625 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
626 | 626 | |
627 | - } elseif($arr[0]=="layout") { |
|
627 | + } elseif ($arr[0] == "layout") { |
|
628 | 628 | $str = urldecode($arr[1]); |
629 | 629 | $arrLayoutName = explode("|", $str); |
630 | 630 | $oLayoutModel = getModel("layout"); |
631 | 631 | $mInfo = array(); |
632 | - foreach($arrLayoutName as $layoutName) { |
|
632 | + foreach ($arrLayoutName as $layoutName) { |
|
633 | 633 | $layoutInfo = $oLayoutModel->getLayoutInfo($layoutName); |
634 | 634 | $mInfo[] = "{$layoutName}({$layoutInfo->version})"; |
635 | 635 | } |
636 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
636 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
637 | 637 | } else { |
638 | 638 | $xe_check_env[$arr[0]] = urldecode($arr[1]); |
639 | 639 | } |
@@ -648,14 +648,14 @@ discard block |
||
648 | 648 | $info['PHP_Core'] = $php_core; |
649 | 649 | |
650 | 650 | $str_info = "[XE Server Environment " . date("Y-m-d") . "]\n\n"; |
651 | - $str_info .= "realpath : ".realpath('./')."\n"; |
|
652 | - foreach( $info as $key=>$value ) |
|
651 | + $str_info .= "realpath : " . realpath('./') . "\n"; |
|
652 | + foreach ($info as $key=>$value) |
|
653 | 653 | { |
654 | - if( is_array( $value ) == false ) { |
|
654 | + if (is_array($value) == false) { |
|
655 | 655 | $str_info .= "{$key} : {$value}\n"; |
656 | 656 | } else { |
657 | 657 | //$str_info .= "\n{$key} \n"; |
658 | - foreach( $value as $key2=>$value2 ) |
|
658 | + foreach ($value as $key2=>$value2) |
|
659 | 659 | $str_info .= "{$key2} : {$value2}\n"; |
660 | 660 | } |
661 | 661 | } |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | if(strpos($db_info->default_url, 'xn--') !== FALSE) |
32 | 32 | { |
33 | 33 | $xe_default_url = Context::decodeIdna($db_info->default_url); |
34 | - } |
|
35 | - else |
|
34 | + } else |
|
36 | 35 | { |
37 | 36 | $xe_default_url = $db_info->default_url; |
38 | 37 | } |
@@ -434,9 +433,15 @@ discard block |
||
434 | 433 | |
435 | 434 | // site lock |
436 | 435 | Context::set('IP', $_SERVER['REMOTE_ADDR']); |
437 | - if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
438 | - if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
439 | - if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
436 | + if(!$db_info->sitelock_title) { |
|
437 | + $db_info->sitelock_title = 'Maintenance in progress...'; |
|
438 | + } |
|
439 | + if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) { |
|
440 | + $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
441 | + } |
|
442 | + if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) { |
|
443 | + $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
444 | + } |
|
440 | 445 | $db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist); |
441 | 446 | Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); |
442 | 447 | Context::set('use_sitelock', $db_info->use_sitelock); |
@@ -447,8 +452,11 @@ discard block |
||
447 | 452 | Context::set('sitelock_whitelist', $whitelist); |
448 | 453 | |
449 | 454 | |
450 | - if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
451 | - else $admin_ip_list = ''; |
|
455 | + if($db_info->admin_ip_list) { |
|
456 | + $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
457 | + } else { |
|
458 | + $admin_ip_list = ''; |
|
459 | + } |
|
452 | 460 | Context::set('admin_ip_list', $admin_ip_list); |
453 | 461 | |
454 | 462 | Context::set('lang_selected', Context::loadLangSelected()); |
@@ -547,8 +555,7 @@ discard block |
||
547 | 555 | Context::addHtmlFooter($img); |
548 | 556 | |
549 | 557 | FileHandler::writeFile($path . $mainVersion, '1'); |
550 | - } |
|
551 | - else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
558 | + } else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
552 | 559 | { |
553 | 560 | if($_SESSION['enviroment_gather'] == 'Y') |
554 | 561 | { |
@@ -580,7 +587,7 @@ discard block |
||
580 | 587 | $arr = explode("=", $value); |
581 | 588 | if($arr[0]=="type") { |
582 | 589 | continue; |
583 | - }elseif($arr[0]=="phpext" ) { |
|
590 | + } elseif($arr[0]=="phpext" ) { |
|
584 | 591 | $str = urldecode($arr[1]); |
585 | 592 | $xe_check_env[$arr[0]]= str_replace("|", ", ", $str); |
586 | 593 | } elseif($arr[0]=="module" ) { |
@@ -655,8 +662,9 @@ discard block |
||
655 | 662 | $str_info .= "{$key} : {$value}\n"; |
656 | 663 | } else { |
657 | 664 | //$str_info .= "\n{$key} \n"; |
658 | - foreach( $value as $key2=>$value2 ) |
|
659 | - $str_info .= "{$key2} : {$value2}\n"; |
|
665 | + foreach( $value as $key2=>$value2 ) { |
|
666 | + $str_info .= "{$key2} : {$value2}\n"; |
|
667 | + } |
|
660 | 668 | } |
661 | 669 | } |
662 | 670 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Initialization |
17 | - * @return void |
|
17 | + * @return ModuleObject|null |
|
18 | 18 | */ |
19 | 19 | function init() |
20 | 20 | { |
@@ -1284,7 +1284,7 @@ |
||
1284 | 1284 | /** |
1285 | 1285 | * Delete cached group data |
1286 | 1286 | * @return void |
1287 | - */ |
|
1287 | + */ |
|
1288 | 1288 | function _deleteMemberGroupCache($site_srl = 0) |
1289 | 1289 | { |
1290 | 1290 | //remove from cache |