@@ -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"> |
@@ -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}); |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -66,7 +66,7 @@ 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 | 72 | throw new Exception('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } else { |
96 | 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; |
@@ -115,12 +115,12 @@ discard block |
||
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; |
@@ -148,11 +148,11 @@ 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 { |
@@ -242,14 +242,14 @@ discard block |
||
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 | } |
@@ -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,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 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -require_once(_XE_PATH_ . 'modules/addon/addon.controller.php'); |
|
4 | +require_once(_XE_PATH_.'modules/addon/addon.controller.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Admin controller class of addon modules |
@@ -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 | } |
@@ -83,8 +83,7 @@ |
||
83 | 83 | $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
84 | 84 | } |
85 | 85 | } |
86 | - } |
|
87 | - else |
|
86 | + } else |
|
88 | 87 | { |
89 | 88 | $module_categories = array(); |
90 | 89 | $module_categories[0] = new stdClass(); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function init() |
17 | 17 | { |
18 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
18 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -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'); |
@@ -92,8 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $this->createXeAdminMenu(); |
94 | 94 | $output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName); |
95 | - } |
|
96 | - else |
|
95 | + } else |
|
97 | 96 | { |
98 | 97 | if(!is_readable(FileHandler::getRealPath($output->php_file))) |
99 | 98 | { |
@@ -140,8 +139,7 @@ discard block |
||
140 | 139 | if($value == 'dashboard') |
141 | 140 | { |
142 | 141 | $args->url = 'index.php?module=admin'; |
143 | - } |
|
144 | - else |
|
142 | + } else |
|
145 | 143 | { |
146 | 144 | $args->url = '#'; |
147 | 145 | } |
@@ -449,8 +447,7 @@ discard block |
||
449 | 447 | if($parentMenu[$menuItem->parent_srl] == 'extensions') |
450 | 448 | { |
451 | 449 | $newParentItem = $newAdminParentMenuList['advanced']; |
452 | - } |
|
453 | - else |
|
450 | + } else |
|
454 | 451 | { |
455 | 452 | $newParentItem = $newAdminParentMenuList[$parentMenu[$menuItem->parent_srl]]; |
456 | 453 | } |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | $oModuleModel = getModel('module'); |
38 | 38 | $oModuleController = getController('module'); |
39 | 39 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
40 | - if($oModuleModel->needUpdate($version_update_id)) |
|
40 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
41 | 41 | { |
42 | - if(!$oDB->isColumnExists("admin_favorite", "type")) |
|
42 | + if (!$oDB->isColumnExists("admin_favorite", "type")) |
|
43 | 43 | { |
44 | 44 | return TRUE; |
45 | 45 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | $oModuleModel = getModel('module'); |
61 | 61 | $oModuleController = getController('module'); |
62 | 62 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
63 | - if($oModuleModel->needUpdate($version_update_id)) |
|
63 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
64 | 64 | { |
65 | - if(!$oDB->isColumnExists("admin_favorite", "type")) |
|
65 | + if (!$oDB->isColumnExists("admin_favorite", "type")) |
|
66 | 66 | { |
67 | 67 | $oAdminAdminModel = getAdminModel('admin'); |
68 | 68 | $output = $oAdminAdminModel->getFavoriteList(); |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | $oDB->dropColumn('admin_favorite', 'admin_favorite_srl'); |
72 | 72 | $oDB->addColumn('admin_favorite', "admin_favorite_srl", "number", 11, 0); |
73 | 73 | $oDB->addColumn('admin_favorite', "type", "varchar", 30, 'module'); |
74 | - if(is_array($favoriteList)) |
|
74 | + if (is_array($favoriteList)) |
|
75 | 75 | { |
76 | 76 | $oAdminAdminController = getAdminController('admin'); |
77 | 77 | $oAdminAdminController->_deleteAllFavorite(); |
78 | - foreach($favoriteList AS $key => $value) |
|
78 | + foreach ($favoriteList AS $key => $value) |
|
79 | 79 | { |
80 | 80 | $oAdminAdminController->_insertFavorite($value->site_srl, $value->module); |
81 | 81 | } |
@@ -99,19 +99,19 @@ discard block |
||
99 | 99 | public function checkAdminMenu() |
100 | 100 | { |
101 | 101 | // for admin menu |
102 | - if(Context::isInstalled()) |
|
102 | + if (Context::isInstalled()) |
|
103 | 103 | { |
104 | 104 | $oMenuAdminModel = getAdminModel('menu'); |
105 | 105 | $output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName); |
106 | 106 | |
107 | - if(!$output->menu_srl) |
|
107 | + if (!$output->menu_srl) |
|
108 | 108 | { |
109 | 109 | $this->createXeAdminMenu(); |
110 | 110 | $output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName); |
111 | 111 | } |
112 | 112 | else |
113 | 113 | { |
114 | - if(!is_readable(FileHandler::getRealPath($output->php_file))) |
|
114 | + if (!is_readable(FileHandler::getRealPath($output->php_file))) |
|
115 | 115 | { |
116 | 116 | $oMenuAdminController = getAdminController('menu'); |
117 | 117 | $oMenuAdminController->makeXmlFile($output->menu_srl); |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | |
147 | 147 | // gnb item create |
148 | 148 | $gnbList = array('dashboard', 'menu', 'user', 'content', 'configuration', 'advanced'); |
149 | - foreach($gnbList AS $key => $value) |
|
149 | + foreach ($gnbList AS $key => $value) |
|
150 | 150 | { |
151 | 151 | //insert menu item |
152 | 152 | $args = new stdClass(); |
153 | 153 | $args->menu_srl = $menuSrl; |
154 | 154 | $args->menu_item_srl = getNextSequence(); |
155 | - $args->name = '{$lang->menu_gnb[\'' . $value . '\']}'; |
|
156 | - if($value == 'dashboard') |
|
155 | + $args->name = '{$lang->menu_gnb[\''.$value.'\']}'; |
|
156 | + if ($value == 'dashboard') |
|
157 | 157 | { |
158 | 158 | $args->url = 'index.php?module=admin'; |
159 | 159 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | $oMenuAdminModel = getAdminModel('menu'); |
169 | 169 | $columnList = array('menu_item_srl', 'name'); |
170 | 170 | $output = $oMenuAdminModel->getMenuItems($menuSrl, 0, $columnList); |
171 | - if(is_array($output->data)) |
|
171 | + if (is_array($output->data)) |
|
172 | 172 | { |
173 | - foreach($output->data AS $key => $value) |
|
173 | + foreach ($output->data AS $key => $value) |
|
174 | 174 | { |
175 | 175 | preg_match('/\{\$lang->menu_gnb\[(.*?)\]\}/i', $value->name, $m); |
176 | 176 | $gnbDBList[$m[1]] = $value->menu_item_srl; |
@@ -281,20 +281,20 @@ discard block |
||
281 | 281 | $args->group_srls = $adminGroupSrl; |
282 | 282 | $oModuleModel = getModel('module'); |
283 | 283 | |
284 | - foreach($gnbModuleList AS $key => $value) |
|
284 | + foreach ($gnbModuleList AS $key => $value) |
|
285 | 285 | { |
286 | - if(is_array($value['subMenu'])) |
|
286 | + if (is_array($value['subMenu'])) |
|
287 | 287 | { |
288 | 288 | $moduleActionInfo = $oModuleModel->getModuleActionXml($value['module']); |
289 | - foreach($value['subMenu'] AS $key2 => $value2) |
|
289 | + foreach ($value['subMenu'] AS $key2 => $value2) |
|
290 | 290 | { |
291 | - $gnbKey = "'" . $this->_getGnbKey($value2) . "'"; |
|
291 | + $gnbKey = "'".$this->_getGnbKey($value2)."'"; |
|
292 | 292 | |
293 | 293 | //insert menu item |
294 | 294 | $args->menu_item_srl = getNextSequence(); |
295 | 295 | $args->parent_srl = $gnbDBList[$gnbKey]; |
296 | - $args->name = '{$lang->menu_gnb_sub[\'' . $value2 . '\']}'; |
|
297 | - $args->url = 'index.php?module=admin&act=' . $moduleActionInfo->menu->{$value2}->index; |
|
296 | + $args->name = '{$lang->menu_gnb_sub[\''.$value2.'\']}'; |
|
297 | + $args->url = 'index.php?module=admin&act='.$moduleActionInfo->menu->{$value2}->index; |
|
298 | 298 | $args->listorder = -1 * $args->menu_item_srl; |
299 | 299 | $output = executeQuery('menu.insertMenuItem', $args); |
300 | 300 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | function _getGnbKey($menuName) |
317 | 317 | { |
318 | - switch($menuName) |
|
318 | + switch ($menuName) |
|
319 | 319 | { |
320 | 320 | case 'siteMap': |
321 | 321 | case 'siteDesign': |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function _getOldGnbKey($menuName) |
366 | 366 | { |
367 | - switch($menuName) |
|
367 | + switch ($menuName) |
|
368 | 368 | { |
369 | 369 | case 'siteMap': |
370 | 370 | return 'menu'; |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | $newAdminmenuSrl = $output->menu_srl; |
415 | 415 | $output = $oMenuAdminModel->getMenuItems($newAdminmenuSrl, 0); |
416 | 416 | $newAdminParentMenuList = array(); |
417 | - if(is_array($output->data)) |
|
417 | + if (is_array($output->data)) |
|
418 | 418 | { |
419 | - foreach($output->data AS $key => $value) |
|
419 | + foreach ($output->data AS $key => $value) |
|
420 | 420 | { |
421 | 421 | $tmp = explode('\'', $value->name); |
422 | 422 | $newAdminParentMenuList[$tmp[1]] = $value; |
@@ -429,15 +429,15 @@ discard block |
||
429 | 429 | $menuSrl = $output->menu_srl; |
430 | 430 | |
431 | 431 | $oMenuAdminController = getAdminController('menu'); |
432 | - if($menuSrl) |
|
432 | + if ($menuSrl) |
|
433 | 433 | { |
434 | 434 | $output = $oMenuAdminModel->getMenuItems($menuSrl); |
435 | - if(is_array($output->data)) |
|
435 | + if (is_array($output->data)) |
|
436 | 436 | { |
437 | 437 | $parentMenu = array(); |
438 | - foreach($output->data AS $key => $menuItem) |
|
438 | + foreach ($output->data AS $key => $menuItem) |
|
439 | 439 | { |
440 | - if($menuItem->parent_srl == 0) |
|
440 | + if ($menuItem->parent_srl == 0) |
|
441 | 441 | { |
442 | 442 | $tmp = explode('\'', $menuItem->name); |
443 | 443 | $parentMenuKey = $tmp[1]; |
@@ -446,15 +446,15 @@ discard block |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | $isUserAddedMenuMoved = FALSE; |
449 | - foreach($output->data AS $key => $menuItem) |
|
449 | + foreach ($output->data AS $key => $menuItem) |
|
450 | 450 | { |
451 | - if($menuItem->parent_srl != 0) |
|
451 | + if ($menuItem->parent_srl != 0) |
|
452 | 452 | { |
453 | 453 | $tmp = explode('\'', $menuItem->name); |
454 | 454 | $menuKey = $tmp[1]; |
455 | 455 | |
456 | 456 | $result = $this->_getOldGnbKey($menuKey); |
457 | - if($result == 'user_added_menu') |
|
457 | + if ($result == 'user_added_menu') |
|
458 | 458 | { |
459 | 459 | // theme menu use not anymore |
460 | 460 | /* if($parentMenu[$menuItem->parent_srl] == 'theme') |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $newParentItem = $newAdminParentMenuList['menu']; |
463 | 463 | } |
464 | 464 | else */ |
465 | - if($parentMenu[$menuItem->parent_srl] == 'extensions') |
|
465 | + if ($parentMenu[$menuItem->parent_srl] == 'extensions') |
|
466 | 466 | { |
467 | 467 | $newParentItem = $newAdminParentMenuList['advanced']; |
468 | 468 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
482 | - if($isUserAddedMenuMoved) |
|
482 | + if ($isUserAddedMenuMoved) |
|
483 | 483 | { |
484 | 484 | $oMenuAdminController->makeXmlFile($newAdminmenuSrl); |
485 | 485 | } |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | |
489 | 489 | // all old admin menu delete |
490 | 490 | $output = $oMenuAdminModel->getMenuListByTitle('__XE_ADMIN__'); |
491 | - if(is_array($output)) |
|
491 | + if (is_array($output)) |
|
492 | 492 | { |
493 | - foreach($output AS $key=>$value) |
|
493 | + foreach ($output AS $key=>$value) |
|
494 | 494 | { |
495 | 495 | $oMenuAdminController->deleteMenu($value->menu_srl); |
496 | 496 | } |
@@ -104,8 +104,7 @@ discard block |
||
104 | 104 | if($type == "core") |
105 | 105 | { |
106 | 106 | $version = __XE_VERSION__; |
107 | - } |
|
108 | - else |
|
107 | + } else |
|
109 | 108 | { |
110 | 109 | $config_file = NULL; |
111 | 110 | switch($type) |
@@ -161,8 +160,7 @@ discard block |
||
161 | 160 | if(version_compare($args->version, $args->current_version, ">")) |
162 | 161 | { |
163 | 162 | $args->need_update = "Y"; |
164 | - } |
|
165 | - else |
|
163 | + } else |
|
166 | 164 | { |
167 | 165 | $args->need_update = "N"; |
168 | 166 | } |
@@ -187,8 +185,7 @@ discard block |
||
187 | 185 | if(!$_SESSION['ftp_password']) |
188 | 186 | { |
189 | 187 | $ftp_password = Context::get('ftp_password'); |
190 | - } |
|
191 | - else |
|
188 | + } else |
|
192 | 189 | { |
193 | 190 | $ftp_password = $_SESSION['ftp_password']; |
194 | 191 | } |
@@ -200,16 +197,13 @@ discard block |
||
200 | 197 | if($oAdminModel->checkUseDirectModuleInstall($package)->toBool()) |
201 | 198 | { |
202 | 199 | $oModuleInstaller = new DirectModuleInstaller($package); |
203 | - } |
|
204 | - else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported) |
|
200 | + } else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported) |
|
205 | 201 | { |
206 | 202 | $oModuleInstaller = new SFTPModuleInstaller($package); |
207 | - } |
|
208 | - else if(function_exists(ftp_connect)) |
|
203 | + } else if(function_exists(ftp_connect)) |
|
209 | 204 | { |
210 | 205 | $oModuleInstaller = new PHPFTPModuleInstaller($package); |
211 | - } |
|
212 | - else |
|
206 | + } else |
|
213 | 207 | { |
214 | 208 | $oModuleInstaller = new FTPModuleInstaller($package); |
215 | 209 | } |
@@ -230,8 +224,7 @@ discard block |
||
230 | 224 | if(Context::get('return_url')) |
231 | 225 | { |
232 | 226 | $this->setRedirectUrl(Context::get('return_url')); |
233 | - } |
|
234 | - else |
|
227 | + } else |
|
235 | 228 | { |
236 | 229 | $this->setRedirectUrl(preg_replace('/act=[^&]*/', 'act=dispAutoinstallAdminIndex', Context::get('error_return_url'))); |
237 | 230 | } |
@@ -265,8 +258,7 @@ discard block |
||
265 | 258 | if($oModel->getPackage($args->package_srl)) |
266 | 259 | { |
267 | 260 | $output = executeQuery("autoinstall.updatePackage", $args); |
268 | - } |
|
269 | - else |
|
261 | + } else |
|
270 | 262 | { |
271 | 263 | $output = executeQuery("autoinstall.insertPackage", $args); |
272 | 264 | if(!$output->toBool()) |
@@ -322,8 +314,7 @@ discard block |
||
322 | 314 | if(Context::get('return_url')) |
323 | 315 | { |
324 | 316 | $this->setRedirectUrl(Context::get('return_url')); |
325 | - } |
|
326 | - else |
|
317 | + } else |
|
327 | 318 | { |
328 | 319 | $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstalledPackages')); |
329 | 320 | } |
@@ -362,8 +353,7 @@ discard block |
||
362 | 353 | if(!$_SESSION['ftp_password']) |
363 | 354 | { |
364 | 355 | $ftp_password = Context::get('ftp_password'); |
365 | - } |
|
366 | - else |
|
356 | + } else |
|
367 | 357 | { |
368 | 358 | $ftp_password = $_SESSION['ftp_password']; |
369 | 359 | } |
@@ -373,16 +363,13 @@ discard block |
||
373 | 363 | if($oAdminModel->checkUseDirectModuleInstall($package)->toBool()) |
374 | 364 | { |
375 | 365 | $oModuleInstaller = new DirectModuleInstaller($package); |
376 | - } |
|
377 | - else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported) |
|
366 | + } else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported) |
|
378 | 367 | { |
379 | 368 | $oModuleInstaller = new SFTPModuleInstaller($package); |
380 | - } |
|
381 | - else if(function_exists('ftp_connect')) |
|
369 | + } else if(function_exists('ftp_connect')) |
|
382 | 370 | { |
383 | 371 | $oModuleInstaller = new PHPFTPModuleInstaller($package); |
384 | - } |
|
385 | - else |
|
372 | + } else |
|
386 | 373 | { |
387 | 374 | $oModuleInstaller = new FTPModuleInstaller($package); |
388 | 375 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -require_once(_XE_PATH_ . 'modules/autoinstall/autoinstall.lib.php'); |
|
4 | +require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * autoinstall module admin controller class |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $oModel = getModel('autoinstall'); |
66 | 66 | $item = $oModel->getLatestPackage(); |
67 | - if($item) |
|
67 | + if ($item) |
|
68 | 68 | { |
69 | 69 | $params["updatedate"] = $item->updatedate; |
70 | 70 | } |
@@ -92,23 +92,23 @@ discard block |
||
92 | 92 | executeQuery("autoinstall.deleteInstalledPackage"); |
93 | 93 | $oModel = getModel('autoinstall'); |
94 | 94 | $packages = $oModel->getPackages(); |
95 | - foreach($packages as $package) |
|
95 | + foreach ($packages as $package) |
|
96 | 96 | { |
97 | 97 | $real_path = FileHandler::getRealPath($package->path); |
98 | - if(!file_exists($real_path)) |
|
98 | + if (!file_exists($real_path)) |
|
99 | 99 | { |
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | |
103 | 103 | $type = $oModel->getTypeFromPath($package->path); |
104 | - if($type == "core") |
|
104 | + if ($type == "core") |
|
105 | 105 | { |
106 | 106 | $version = __XE_VERSION__; |
107 | 107 | } |
108 | 108 | else |
109 | 109 | { |
110 | 110 | $config_file = NULL; |
111 | - switch($type) |
|
111 | + switch ($type) |
|
112 | 112 | { |
113 | 113 | case "m.layout": |
114 | 114 | $type = "layout"; |
@@ -138,15 +138,15 @@ discard block |
||
138 | 138 | break; |
139 | 139 | } |
140 | 140 | |
141 | - if(!$config_file) |
|
141 | + if (!$config_file) |
|
142 | 142 | { |
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $xml = new XmlParser(); |
147 | - $xmlDoc = $xml->loadXmlFile($real_path . $config_file); |
|
147 | + $xmlDoc = $xml->loadXmlFile($real_path.$config_file); |
|
148 | 148 | |
149 | - if(!$xmlDoc) |
|
149 | + if (!$xmlDoc) |
|
150 | 150 | { |
151 | 151 | continue; |
152 | 152 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $args->package_srl = $package->package_srl; |
159 | 159 | $args->version = $package->version; |
160 | 160 | $args->current_version = $version; |
161 | - if(version_compare($args->version, $args->current_version, ">")) |
|
161 | + if (version_compare($args->version, $args->current_version, ">")) |
|
162 | 162 | { |
163 | 163 | $args->need_update = "Y"; |
164 | 164 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $oAdminModel = getAdminModel('autoinstall'); |
185 | 185 | $packages = explode(',', $package_srls); |
186 | 186 | $ftp_info = Context::getFTPInfo(); |
187 | - if(!$_SESSION['ftp_password']) |
|
187 | + if (!$_SESSION['ftp_password']) |
|
188 | 188 | { |
189 | 189 | $ftp_password = Context::get('ftp_password'); |
190 | 190 | } |
@@ -194,18 +194,18 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | $isSftpSupported = function_exists(ssh2_sftp); |
197 | - foreach($packages as $package_srl) |
|
197 | + foreach ($packages as $package_srl) |
|
198 | 198 | { |
199 | 199 | $package = $oModel->getPackage($package_srl); |
200 | - if($oAdminModel->checkUseDirectModuleInstall($package)->toBool()) |
|
200 | + if ($oAdminModel->checkUseDirectModuleInstall($package)->toBool()) |
|
201 | 201 | { |
202 | 202 | $oModuleInstaller = new DirectModuleInstaller($package); |
203 | 203 | } |
204 | - else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported) |
|
204 | + else if ($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported) |
|
205 | 205 | { |
206 | 206 | $oModuleInstaller = new SFTPModuleInstaller($package); |
207 | 207 | } |
208 | - else if(function_exists(ftp_connect)) |
|
208 | + else if (function_exists(ftp_connect)) |
|
209 | 209 | { |
210 | 210 | $oModuleInstaller = new PHPFTPModuleInstaller($package); |
211 | 211 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_); |
218 | 218 | $oModuleInstaller->setPassword($ftp_password); |
219 | 219 | $output = $oModuleInstaller->install(); |
220 | - if(!$output->toBool()) |
|
220 | + if (!$output->toBool()) |
|
221 | 221 | { |
222 | 222 | return $output; |
223 | 223 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | $this->setMessage('success_installed', 'update'); |
229 | 229 | |
230 | - if(Context::get('return_url')) |
|
230 | + if (Context::get('return_url')) |
|
231 | 231 | { |
232 | 232 | $this->setRedirectUrl(Context::get('return_url')); |
233 | 233 | } |
@@ -246,30 +246,30 @@ discard block |
||
246 | 246 | function updatePackages(&$xmlDoc) |
247 | 247 | { |
248 | 248 | $oModel = getModel('autoinstall'); |
249 | - if(!$xmlDoc->response->packages->item) |
|
249 | + if (!$xmlDoc->response->packages->item) |
|
250 | 250 | { |
251 | 251 | return; |
252 | 252 | } |
253 | - if(!is_array($xmlDoc->response->packages->item)) |
|
253 | + if (!is_array($xmlDoc->response->packages->item)) |
|
254 | 254 | { |
255 | 255 | $xmlDoc->response->packages->item = array($xmlDoc->response->packages->item); |
256 | 256 | } |
257 | 257 | $targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl', 'have_instance'); |
258 | - foreach($xmlDoc->response->packages->item as $item) |
|
258 | + foreach ($xmlDoc->response->packages->item as $item) |
|
259 | 259 | { |
260 | 260 | $args = new stdClass(); |
261 | - foreach($targets as $target) |
|
261 | + foreach ($targets as $target) |
|
262 | 262 | { |
263 | 263 | $args->{$target} = $item->{$target}->body; |
264 | 264 | } |
265 | - if($oModel->getPackage($args->package_srl)) |
|
265 | + if ($oModel->getPackage($args->package_srl)) |
|
266 | 266 | { |
267 | 267 | $output = executeQuery("autoinstall.updatePackage", $args); |
268 | 268 | } |
269 | 269 | else |
270 | 270 | { |
271 | 271 | $output = executeQuery("autoinstall.insertPackage", $args); |
272 | - if(!$output->toBool()) |
|
272 | + if (!$output->toBool()) |
|
273 | 273 | { |
274 | 274 | $output = executeQuery("autoinstall.deletePackage", $args); |
275 | 275 | $output = executeQuery("autoinstall.insertPackage", $args); |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | { |
289 | 289 | executeQuery("autoinstall.deleteCategory"); |
290 | 290 | $oModel = getModel('autoinstall'); |
291 | - if(!is_array($xmlDoc->response->categorylist->item)) |
|
291 | + if (!is_array($xmlDoc->response->categorylist->item)) |
|
292 | 292 | { |
293 | 293 | $xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item); |
294 | 294 | } |
295 | 295 | $list_order = 0; |
296 | - foreach($xmlDoc->response->categorylist->item as $item) |
|
296 | + foreach ($xmlDoc->response->categorylist->item as $item) |
|
297 | 297 | { |
298 | 298 | $args = new stdClass(); |
299 | 299 | $args->category_srl = $item->category_srl->body; |
@@ -314,12 +314,12 @@ discard block |
||
314 | 314 | $package_srl = Context::get('package_srl'); |
315 | 315 | |
316 | 316 | $output = $this->uninstallPackageByPackageSrl($package_srl); |
317 | - if($output->toBool()==FALSE) |
|
317 | + if ($output->toBool() == FALSE) |
|
318 | 318 | { |
319 | 319 | return $output; |
320 | 320 | } |
321 | 321 | |
322 | - if(Context::get('return_url')) |
|
322 | + if (Context::get('return_url')) |
|
323 | 323 | { |
324 | 324 | $this->setRedirectUrl(Context::get('return_url')); |
325 | 325 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | $oAdminModel = getAdminModel('autoinstall'); |
361 | 361 | |
362 | - if(!$_SESSION['ftp_password']) |
|
362 | + if (!$_SESSION['ftp_password']) |
|
363 | 363 | { |
364 | 364 | $ftp_password = Context::get('ftp_password'); |
365 | 365 | } |
@@ -370,15 +370,15 @@ discard block |
||
370 | 370 | $ftp_info = Context::getFTPInfo(); |
371 | 371 | |
372 | 372 | $isSftpSupported = function_exists(ssh2_sftp); |
373 | - if($oAdminModel->checkUseDirectModuleInstall($package)->toBool()) |
|
373 | + if ($oAdminModel->checkUseDirectModuleInstall($package)->toBool()) |
|
374 | 374 | { |
375 | 375 | $oModuleInstaller = new DirectModuleInstaller($package); |
376 | 376 | } |
377 | - else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported) |
|
377 | + else if ($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported) |
|
378 | 378 | { |
379 | 379 | $oModuleInstaller = new SFTPModuleInstaller($package); |
380 | 380 | } |
381 | - else if(function_exists('ftp_connect')) |
|
381 | + else if (function_exists('ftp_connect')) |
|
382 | 382 | { |
383 | 383 | $oModuleInstaller = new PHPFTPModuleInstaller($package); |
384 | 384 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | $oModuleInstaller->setPassword($ftp_password); |
393 | 393 | $output = $oModuleInstaller->uninstall(); |
394 | - if(!$output->toBool()) |
|
394 | + if (!$output->toBool()) |
|
395 | 395 | { |
396 | 396 | return $output; |
397 | 397 | } |
@@ -332,6 +332,7 @@ |
||
332 | 332 | /** |
333 | 333 | * Uninstall package by package serial number |
334 | 334 | * |
335 | + * @param string $package_srl |
|
335 | 336 | * @return BaseObject |
336 | 337 | */ |
337 | 338 | function uninstallPackageByPackageSrl($package_srl) |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | if(!$ftp_info->ftp_root_path) |
37 | 37 | { |
38 | 38 | Context::set('show_ftp_note', TRUE); |
39 | - } |
|
40 | - else |
|
39 | + } else |
|
41 | 40 | { |
42 | 41 | $this->ftp_set = TRUE; |
43 | 42 | } |
@@ -217,12 +216,10 @@ discard block |
||
217 | 216 | if($v->type == "core") |
218 | 217 | { |
219 | 218 | $v->avail_remove = FALSE; |
220 | - } |
|
221 | - else if($v->type == "module") |
|
219 | + } else if($v->type == "module") |
|
222 | 220 | { |
223 | 221 | $v->avail_remove = $oModel->checkRemovable($packages[$v->package_srl]->path); |
224 | - } |
|
225 | - else |
|
222 | + } else |
|
226 | 223 | { |
227 | 224 | $v->avail_remove = TRUE; |
228 | 225 | } |
@@ -455,8 +452,7 @@ discard block |
||
455 | 452 | if($childrenList) |
456 | 453 | { |
457 | 454 | $params["category_srl"] = $childrenList; |
458 | - } |
|
459 | - else if($category_srl) |
|
455 | + } else if($category_srl) |
|
460 | 456 | { |
461 | 457 | $params["category_srl"] = $category_srl; |
462 | 458 | } |
@@ -565,8 +561,7 @@ discard block |
||
565 | 561 | $security->encodeHTML('package.'); |
566 | 562 | |
567 | 563 | $this->setTemplateFile('uninstall'); |
568 | - } |
|
569 | - else |
|
564 | + } else |
|
570 | 565 | { |
571 | 566 | return $this->stop('msg_connection_fail'); |
572 | 567 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->setTemplatePath($template_path); |
34 | 34 | |
35 | 35 | $ftp_info = Context::getFTPInfo(); |
36 | - if(!$ftp_info->ftp_root_path) |
|
36 | + if (!$ftp_info->ftp_root_path) |
|
37 | 37 | { |
38 | 38 | Context::set('show_ftp_note', TRUE); |
39 | 39 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | function rearrange(&$item, &$targets) |
91 | 91 | { |
92 | 92 | $ret = new stdClass(); |
93 | - foreach($targets as $target) |
|
93 | + foreach ($targets as $target) |
|
94 | 94 | { |
95 | 95 | $ret->{$target} = $item->{$target}->body; |
96 | 96 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | function rearranges($items, $packages = null) |
171 | 171 | { |
172 | - if(!is_array($items)) |
|
172 | + if (!is_array($items)) |
|
173 | 173 | { |
174 | 174 | $items = array($items); |
175 | 175 | } |
@@ -178,47 +178,47 @@ discard block |
||
178 | 178 | $targets = array('category_srl', 'package_srl', 'item_screenshot_url', 'package_voted', 'package_voter', 'package_description', 'package_downloaded', 'item_regdate', 'title', 'item_version', 'package_star', 'depfrom'); |
179 | 179 | $targetpackages = array(); |
180 | 180 | |
181 | - foreach($items as $item) |
|
181 | + foreach ($items as $item) |
|
182 | 182 | { |
183 | 183 | $targetpackages[$item->package_srl->body] = 0; |
184 | 184 | } |
185 | 185 | |
186 | 186 | $oModel = getModel('autoinstall'); |
187 | 187 | |
188 | - if($package == null) |
|
188 | + if ($package == null) |
|
189 | 189 | { |
190 | 190 | $packages = $oModel->getInstalledPackages(array_keys($targetpackages)); |
191 | 191 | } |
192 | 192 | |
193 | 193 | $depto = array(); |
194 | 194 | |
195 | - foreach($items as $item) |
|
195 | + foreach ($items as $item) |
|
196 | 196 | { |
197 | 197 | $v = $this->rearrange($item, $targets); |
198 | 198 | $v->item_screenshot_url = str_replace('./', _XE_DOWNLOAD_SERVER_, $v->item_screenshot_url); |
199 | 199 | $v->category = $this->categories[$v->category_srl]->title; |
200 | - $v->url = _XE_LOCATION_SITE_ . '?mid=download&package_srl=' . $v->package_srl; |
|
200 | + $v->url = _XE_LOCATION_SITE_.'?mid=download&package_srl='.$v->package_srl; |
|
201 | 201 | |
202 | - if($packages[$v->package_srl]) |
|
202 | + if ($packages[$v->package_srl]) |
|
203 | 203 | { |
204 | 204 | $v->current_version = $packages[$v->package_srl]->current_version; |
205 | 205 | $v->need_update = $packages[$v->package_srl]->need_update; |
206 | 206 | $v->type = $oModel->getTypeFromPath($packages[$v->package_srl]->path); |
207 | 207 | |
208 | - if($this->ftp_set && $v->depfrom) |
|
208 | + if ($this->ftp_set && $v->depfrom) |
|
209 | 209 | { |
210 | 210 | $depfrom = explode(",", $v->depfrom); |
211 | - foreach($depfrom as $package_srl) |
|
211 | + foreach ($depfrom as $package_srl) |
|
212 | 212 | { |
213 | 213 | $depto[$package_srl][] = $v->package_srl; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - if($v->type == "core") |
|
217 | + if ($v->type == "core") |
|
218 | 218 | { |
219 | 219 | $v->avail_remove = FALSE; |
220 | 220 | } |
221 | - else if($v->type == "module") |
|
221 | + else if ($v->type == "module") |
|
222 | 222 | { |
223 | 223 | $v->avail_remove = $oModel->checkRemovable($packages[$v->package_srl]->path); |
224 | 224 | } |
@@ -230,41 +230,41 @@ discard block |
||
230 | 230 | $item_list[$v->package_srl] = $v; |
231 | 231 | } |
232 | 232 | |
233 | - if(count($depto) > 0) |
|
233 | + if (count($depto) > 0) |
|
234 | 234 | { |
235 | 235 | $installed = $oModel->getInstalledPackages(implode(",", array_keys($depto))); |
236 | - foreach($installed as $key => $val) |
|
236 | + foreach ($installed as $key => $val) |
|
237 | 237 | { |
238 | 238 | $path = $val->path; |
239 | 239 | $type = $oModel->getTypeFromPath($path); |
240 | 240 | |
241 | - if(!$type || $type == "core") |
|
241 | + if (!$type || $type == "core") |
|
242 | 242 | { |
243 | 243 | continue; |
244 | 244 | } |
245 | 245 | |
246 | 246 | $config_file = $oModel->getConfigFilePath($type); |
247 | - if(!$config_file) |
|
247 | + if (!$config_file) |
|
248 | 248 | { |
249 | 249 | continue; |
250 | 250 | } |
251 | 251 | |
252 | 252 | $xml = new XmlParser(); |
253 | - $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path) . $config_file); |
|
254 | - if(!$xmlDoc) |
|
253 | + $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path).$config_file); |
|
254 | + if (!$xmlDoc) |
|
255 | 255 | { |
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | |
259 | - if($type == "drcomponent") |
|
259 | + if ($type == "drcomponent") |
|
260 | 260 | { |
261 | 261 | $type = "component"; |
262 | 262 | } |
263 | - if($type == "style" || $type == "m.skin") |
|
263 | + if ($type == "style" || $type == "m.skin") |
|
264 | 264 | { |
265 | 265 | $type = "skin"; |
266 | 266 | } |
267 | - if($type == "m.layout") |
|
267 | + if ($type == "m.layout") |
|
268 | 268 | { |
269 | 269 | $type = "layout"; |
270 | 270 | } |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | $oSecurity = new Security(); |
277 | 277 | $oSecurity->encodeHTML('installed..'); |
278 | 278 | |
279 | - foreach($installed as $key => $val) |
|
279 | + foreach ($installed as $key => $val) |
|
280 | 280 | { |
281 | - foreach($depto[$key] as $package_srl) |
|
281 | + foreach ($depto[$key] as $package_srl) |
|
282 | 282 | { |
283 | 283 | $item_list[$package_srl]->avail_remove = false; |
284 | 284 | $item_list[$package_srl]->deps[] = $key; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | function dispAutoinstallAdminInstalledPackages() |
298 | 298 | { |
299 | 299 | $page = Context::get('page'); |
300 | - if(!$page) |
|
300 | + if (!$page) |
|
301 | 301 | { |
302 | 302 | $page = 1; |
303 | 303 | } |
@@ -313,13 +313,13 @@ discard block |
||
313 | 313 | $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml"); |
314 | 314 | $xml_lUpdate = new XmlParser(); |
315 | 315 | $xmlDoc = $xml_lUpdate->parse($buff); |
316 | - if($xmlDoc && $xmlDoc->response->packagelist->item) |
|
316 | + if ($xmlDoc && $xmlDoc->response->packagelist->item) |
|
317 | 317 | { |
318 | 318 | $item_list = $this->rearranges($xmlDoc->response->packagelist->item, $package_list); |
319 | 319 | $res = array(); |
320 | - foreach($package_list as $package_srl => $package) |
|
320 | + foreach ($package_list as $package_srl => $package) |
|
321 | 321 | { |
322 | - if($item_list[$package_srl]) |
|
322 | + if ($item_list[$package_srl]) |
|
323 | 323 | { |
324 | 324 | $res[] = $item_list[$package_srl]; |
325 | 325 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | Context::set('item_list', $res); |
328 | 328 | } |
329 | 329 | |
330 | - if(count($package_list) != count($res)) |
|
330 | + if (count($package_list) != count($res)) |
|
331 | 331 | { |
332 | 332 | $localPackageSrls = array_keys($package_list); |
333 | 333 | $remotePackageSrls = array_keys($item_list); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | function dispAutoinstallAdminInstall() |
353 | 353 | { |
354 | 354 | $package_srl = Context::get('package_srl'); |
355 | - if(!$package_srl) |
|
355 | + if (!$package_srl) |
|
356 | 356 | { |
357 | 357 | return $this->dispAutoinstallAdminIndex(); |
358 | 358 | } |
@@ -363,13 +363,13 @@ discard block |
||
363 | 363 | Context::set("package", $package); |
364 | 364 | Context::set('contain_core', $package->contain_core); |
365 | 365 | |
366 | - if(!$_SESSION['ftp_password']) |
|
366 | + if (!$_SESSION['ftp_password']) |
|
367 | 367 | { |
368 | 368 | Context::set('need_password', TRUE); |
369 | 369 | } |
370 | 370 | |
371 | 371 | $output = $oAdminModel->checkUseDirectModuleInstall($package); |
372 | - if($output->toBool()==TRUE) |
|
372 | + if ($output->toBool() == TRUE) |
|
373 | 373 | { |
374 | 374 | Context::set('show_ftp_note', FALSE); |
375 | 375 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $oModuleModel = getModel('module'); |
392 | 392 | $config = $oModuleModel->getModuleConfig('autoinstall'); |
393 | 393 | $ftp_info = Context::getFTPInfo(); |
394 | - if(!$ftp_info->ftp_root_path) |
|
394 | + if (!$ftp_info->ftp_root_path) |
|
395 | 395 | { |
396 | 396 | Context::set('show_ftp_note', TRUE); |
397 | 397 | } |
@@ -406,21 +406,21 @@ discard block |
||
406 | 406 | $lUpdateDoc = $xml_lUpdate->parse($buff); |
407 | 407 | $updateDate = $lUpdateDoc->response->updatedate->body; |
408 | 408 | |
409 | - if(!$updateDate) |
|
409 | + if (!$updateDate) |
|
410 | 410 | { |
411 | 411 | return $this->stop('msg_connection_fail'); |
412 | 412 | } |
413 | 413 | |
414 | 414 | $oModel = getModel('autoinstall'); |
415 | 415 | $item = $oModel->getLatestPackage(); |
416 | - if(!$item || $item->updatedate < $updateDate || count($this->categories) < 1) |
|
416 | + if (!$item || $item->updatedate < $updateDate || count($this->categories) < 1) |
|
417 | 417 | { |
418 | 418 | $oController = getAdminController('autoinstall'); |
419 | 419 | $oController->_updateinfo(); |
420 | 420 | |
421 | - if(!$_SESSION['__XE_EASYINSTALL_REDIRECT__']) |
|
421 | + if (!$_SESSION['__XE_EASYINSTALL_REDIRECT__']) |
|
422 | 422 | { |
423 | - header('location: ' . getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminIndex')); |
|
423 | + header('location: '.getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminIndex')); |
|
424 | 424 | $_SESSION['__XE_EASYINSTALL_REDIRECT__'] = TRUE; |
425 | 425 | return; |
426 | 426 | } |
@@ -428,21 +428,21 @@ discard block |
||
428 | 428 | unset($_SESSION['__XE_EASYINSTALL_REDIRECT__']); |
429 | 429 | |
430 | 430 | $page = Context::get('page'); |
431 | - if(!$page) |
|
431 | + if (!$page) |
|
432 | 432 | { |
433 | 433 | $page = 1; |
434 | 434 | } |
435 | 435 | Context::set('page', $page); |
436 | 436 | |
437 | 437 | $order_type = Context::get('order_type'); |
438 | - if(!in_array($order_type, array('asc', 'desc'))) |
|
438 | + if (!in_array($order_type, array('asc', 'desc'))) |
|
439 | 439 | { |
440 | 440 | $order_type = 'desc'; |
441 | 441 | } |
442 | 442 | Context::set('order_type', $order_type); |
443 | 443 | |
444 | 444 | $order_target = Context::get('order_target'); |
445 | - if(!in_array($order_target, array('newest', 'download', 'popular'))) |
|
445 | + if (!in_array($order_target, array('newest', 'download', 'popular'))) |
|
446 | 446 | { |
447 | 447 | $order_target = 'newest'; |
448 | 448 | } |
@@ -452,11 +452,11 @@ discard block |
||
452 | 452 | |
453 | 453 | $childrenList = Context::get('childrenList'); |
454 | 454 | $category_srl = Context::get('category_srl'); |
455 | - if($childrenList) |
|
455 | + if ($childrenList) |
|
456 | 456 | { |
457 | 457 | $params["category_srl"] = $childrenList; |
458 | 458 | } |
459 | - else if($category_srl) |
|
459 | + else if ($category_srl) |
|
460 | 460 | { |
461 | 461 | $params["category_srl"] = $category_srl; |
462 | 462 | } |
@@ -465,12 +465,12 @@ discard block |
||
465 | 465 | $params["order_target"] = $order_target; |
466 | 466 | $params["order_type"] = $order_type; |
467 | 467 | $params["page"] = $page; |
468 | - if($search_keyword) |
|
468 | + if ($search_keyword) |
|
469 | 469 | { |
470 | 470 | $params["search_keyword"] = $search_keyword; |
471 | 471 | } |
472 | 472 | $xmlDoc = XmlGenerater::getXmlDoc($params); |
473 | - if($xmlDoc && $xmlDoc->response->packagelist->item) |
|
473 | + if ($xmlDoc && $xmlDoc->response->packagelist->item) |
|
474 | 474 | { |
475 | 475 | $item_list = $this->rearranges($xmlDoc->response->packagelist->item); |
476 | 476 | Context::set('item_list', $item_list); |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | function dispAutoinstallAdminUninstall() |
505 | 505 | { |
506 | 506 | $package_srl = Context::get('package_srl'); |
507 | - if(!$package_srl) |
|
507 | + if (!$package_srl) |
|
508 | 508 | { |
509 | 509 | return $this->dispAutoinstallAdminIndex(); |
510 | 510 | } |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | $oModel = getModel('autoinstall'); |
513 | 513 | $oAdminModel = getAdminModel('autoinstall'); |
514 | 514 | $installedPackage = $oModel->getInstalledPackage($package_srl); |
515 | - if(!$installedPackage) |
|
515 | + if (!$installedPackage) |
|
516 | 516 | { |
517 | 517 | return $this->dispAutoinstallAdminInstalledPackages(); |
518 | 518 | } |
519 | 519 | |
520 | - if(!$_SESSION['ftp_password']) |
|
520 | + if (!$_SESSION['ftp_password']) |
|
521 | 521 | { |
522 | 522 | Context::set('need_password', TRUE); |
523 | 523 | } |
@@ -526,19 +526,19 @@ discard block |
||
526 | 526 | $path = $installedPackage->path; |
527 | 527 | $type = $oModel->getTypeFromPath($path); |
528 | 528 | |
529 | - if(!$type || $type == "core") |
|
529 | + if (!$type || $type == "core") |
|
530 | 530 | { |
531 | 531 | return $this->stop("msg_invalid_request"); |
532 | 532 | } |
533 | 533 | |
534 | 534 | $config_file = $oModel->getConfigFilePath($type); |
535 | - if(!$config_file) |
|
535 | + if (!$config_file) |
|
536 | 536 | { |
537 | 537 | return $this->stop("msg_invalid_request"); |
538 | 538 | } |
539 | 539 | |
540 | 540 | $output = $oAdminModel->checkUseDirectModuleInstall($installedPackage); |
541 | - if($output->toBool()==TRUE) |
|
541 | + if ($output->toBool() == TRUE) |
|
542 | 542 | { |
543 | 543 | Context::set('show_ftp_note', FALSE); |
544 | 544 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml"); |
551 | 551 | $xml_lUpdate = new XmlParser(); |
552 | 552 | $xmlDoc = $xml_lUpdate->parse($buff); |
553 | - if($xmlDoc && $xmlDoc->response->packagelist->item) |
|
553 | + if ($xmlDoc && $xmlDoc->response->packagelist->item) |
|
554 | 554 | { |
555 | 555 | $item_list = $this->rearranges($xmlDoc->response->packagelist->item); |
556 | 556 | $installedPackage->title = $item_list[$package_srl]->title; |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | $installedPackage->deps = $item_list[$package_srl]->deps; |
560 | 560 | Context::set('package', $installedPackage); |
561 | 561 | $this->setTemplateFile('uninstall'); |
562 | - Context::addJsFilter($this->module_path . 'tpl/filter', 'uninstall_package.xml'); |
|
562 | + Context::addJsFilter($this->module_path.'tpl/filter', 'uninstall_package.xml'); |
|
563 | 563 | |
564 | 564 | $security = new Security(); |
565 | 565 | $security->encodeHTML('package.'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param object $item |
87 | 87 | * @param object $targets |
88 | - * @return object |
|
88 | + * @return stdClass |
|
89 | 89 | */ |
90 | 90 | function rearrange(&$item, &$targets) |
91 | 91 | { |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | /** |
348 | 348 | * Display install package |
349 | 349 | * |
350 | - * @return BaseObject |
|
350 | + * @return ModuleObject|null |
|
351 | 351 | */ |
352 | 352 | function dispAutoinstallAdminInstall() |
353 | 353 | { |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | /** |
385 | 385 | * Display package list |
386 | 386 | * |
387 | - * @return BaseObject |
|
387 | + * @return ModuleObject|null |
|
388 | 388 | */ |
389 | 389 | function dispAutoinstallAdminIndex() |
390 | 390 | { |
@@ -103,8 +103,7 @@ discard block |
||
103 | 103 | if($category->parent_srl) |
104 | 104 | { |
105 | 105 | $categoryList[$category->parent_srl]->children[] = & $categoryList[$key]; |
106 | - } |
|
107 | - else |
|
106 | + } else |
|
108 | 107 | { |
109 | 108 | $depth0[] = $key; |
110 | 109 | } |
@@ -324,8 +323,7 @@ discard block |
||
324 | 323 | if(method_exists($oModule, "moduleUninstall")) |
325 | 324 | { |
326 | 325 | return TRUE; |
327 | - } |
|
328 | - else |
|
326 | + } else |
|
329 | 327 | { |
330 | 328 | return FALSE; |
331 | 329 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $args = new stdClass(); |
20 | 20 | $args->category_srl = $category_srl; |
21 | 21 | $output = executeQueryArray("autoinstall.getCategory", $args); |
22 | - if(!$output->data) |
|
22 | + if (!$output->data) |
|
23 | 23 | { |
24 | 24 | return null; |
25 | 25 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | function getPackages() |
35 | 35 | { |
36 | 36 | $output = executeQueryArray("autoinstall.getPackages"); |
37 | - if(!$output->data) |
|
37 | + if (!$output->data) |
|
38 | 38 | { |
39 | 39 | return array(); |
40 | 40 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $args = new stdClass(); |
53 | 53 | $args->package_srl = $package_srl; |
54 | 54 | $output = executeQueryArray("autoinstall.getInstalledPackage", $args); |
55 | - if(!$output->data) |
|
55 | + if (!$output->data) |
|
56 | 56 | { |
57 | 57 | return null; |
58 | 58 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $args = new stdClass(); |
71 | 71 | $args->package_srl = $package_srl; |
72 | 72 | $output = executeQueryArray("autoinstall.getPackage", $args); |
73 | - if(!$output->data) |
|
73 | + if (!$output->data) |
|
74 | 74 | { |
75 | 75 | return null; |
76 | 76 | } |
@@ -85,22 +85,22 @@ discard block |
||
85 | 85 | function getCategoryList() |
86 | 86 | { |
87 | 87 | $output = executeQueryArray("autoinstall.getCategories"); |
88 | - if(!$output->toBool() || !$output->data) |
|
88 | + if (!$output->toBool() || !$output->data) |
|
89 | 89 | { |
90 | 90 | return array(); |
91 | 91 | } |
92 | 92 | |
93 | 93 | $categoryList = array(); |
94 | - foreach($output->data as $category) |
|
94 | + foreach ($output->data as $category) |
|
95 | 95 | { |
96 | 96 | $category->children = array(); |
97 | 97 | $categoryList[$category->category_srl] = $category; |
98 | 98 | } |
99 | 99 | |
100 | 100 | $depth0 = array(); |
101 | - foreach($categoryList as $key => $category) |
|
101 | + foreach ($categoryList as $key => $category) |
|
102 | 102 | { |
103 | - if($category->parent_srl) |
|
103 | + if ($category->parent_srl) |
|
104 | 104 | { |
105 | 105 | $categoryList[$category->parent_srl]->children[] = & $categoryList[$key]; |
106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | } |
112 | 112 | $resultList = array(); |
113 | - foreach($depth0 as $category_srl) |
|
113 | + foreach ($depth0 as $category_srl) |
|
114 | 114 | { |
115 | 115 | $this->setDepth($categoryList[$category_srl], 0, $categoryList, $resultList); |
116 | 116 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $args = new stdClass(); |
129 | 129 | $args->category_srl = $category_srl; |
130 | 130 | $output = executeQuery("autoinstall.getPackageCount", $args); |
131 | - if(!$output->data) |
|
131 | + if (!$output->data) |
|
132 | 132 | { |
133 | 133 | return 0; |
134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | function getInstalledPackageCount() |
144 | 144 | { |
145 | 145 | $output = executeQuery("autoinstall.getInstalledPackageCount"); |
146 | - if(!$output->data) |
|
146 | + if (!$output->data) |
|
147 | 147 | { |
148 | 148 | return 0; |
149 | 149 | } |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | $resultList[$item->category_srl] = &$item; |
165 | 165 | $item->depth = $depth; |
166 | 166 | $siblingList = $item->category_srl; |
167 | - foreach($item->children as $child) |
|
167 | + foreach ($item->children as $child) |
|
168 | 168 | { |
169 | - $siblingList .= "," . $this->setDepth($list[$child->category_srl], $depth + 1, $list, $resultList); |
|
169 | + $siblingList .= ",".$this->setDepth($list[$child->category_srl], $depth + 1, $list, $resultList); |
|
170 | 170 | } |
171 | - if(count($item->children) < 1) |
|
171 | + if (count($item->children) < 1) |
|
172 | 172 | { |
173 | 173 | $item->nPackages = $this->getPackageCount($item->category_srl); |
174 | 174 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | function getLatestPackage() |
185 | 185 | { |
186 | 186 | $output = executeQueryArray("autoinstall.getLatestPackage"); |
187 | - if(!$output->data) |
|
187 | + if (!$output->data) |
|
188 | 188 | { |
189 | 189 | return null; |
190 | 190 | } |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | $args->package_list = $package_list; |
204 | 204 | $output = executeQueryArray("autoinstall.getInstalledPackages", $args); |
205 | 205 | $result = array(); |
206 | - if(!$output->data) |
|
206 | + if (!$output->data) |
|
207 | 207 | { |
208 | 208 | return $result; |
209 | 209 | } |
210 | - foreach($output->data as $value) |
|
210 | + foreach ($output->data as $value) |
|
211 | 211 | { |
212 | 212 | $result[$value->package_srl] = $value; |
213 | 213 | } |
@@ -226,15 +226,15 @@ discard block |
||
226 | 226 | $args->page = $page; |
227 | 227 | $args->list_count = 10; |
228 | 228 | $args->page_count = 5; |
229 | - if(Context::getDBType() == 'mssql') |
|
229 | + if (Context::getDBType() == 'mssql') |
|
230 | 230 | { |
231 | 231 | $args->sort_index = 'package_srl'; |
232 | 232 | } |
233 | 233 | $output = executeQueryArray("autoinstall.getInstalledPackageList", $args); |
234 | 234 | $res = array(); |
235 | - if($output->data) |
|
235 | + if ($output->data) |
|
236 | 236 | { |
237 | - foreach($output->data as $val) |
|
237 | + foreach ($output->data as $val) |
|
238 | 238 | { |
239 | 239 | $res[$val->package_srl] = $val; |
240 | 240 | } |
@@ -251,19 +251,19 @@ discard block |
||
251 | 251 | */ |
252 | 252 | function getTypeFromPath($path) |
253 | 253 | { |
254 | - if(!$path) |
|
254 | + if (!$path) |
|
255 | 255 | { |
256 | 256 | return NULL; |
257 | 257 | } |
258 | 258 | |
259 | - if($path == ".") |
|
259 | + if ($path == ".") |
|
260 | 260 | { |
261 | 261 | return "core"; |
262 | 262 | } |
263 | 263 | |
264 | 264 | $path_array = explode("/", $path); |
265 | 265 | $target_name = array_pop($path_array); |
266 | - if(!$target_name) |
|
266 | + if (!$target_name) |
|
267 | 267 | { |
268 | 268 | $target_name = array_pop($path_array); |
269 | 269 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | function getConfigFilePath($type) |
281 | 281 | { |
282 | 282 | $config_file = NULL; |
283 | - switch($type) |
|
283 | + switch ($type) |
|
284 | 284 | { |
285 | 285 | case "m.layout": |
286 | 286 | case "module": |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | $path_array = explode("/", $path); |
318 | 318 | $target_name = array_pop($path_array); |
319 | 319 | $oModule = getModule($target_name, "class"); |
320 | - if(!$oModule) |
|
320 | + if (!$oModule) |
|
321 | 321 | { |
322 | 322 | return FALSE; |
323 | 323 | } |
324 | - if(method_exists($oModule, "moduleUninstall")) |
|
324 | + if (method_exists($oModule, "moduleUninstall")) |
|
325 | 325 | { |
326 | 326 | return TRUE; |
327 | 327 | } |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | */ |
340 | 340 | function getPackageSrlByPath($path) |
341 | 341 | { |
342 | - if(!$path) |
|
342 | + if (!$path) |
|
343 | 343 | { |
344 | 344 | return; |
345 | 345 | } |
346 | 346 | |
347 | - if(substr($path, -1) == '/') |
|
347 | + if (substr($path, -1) == '/') |
|
348 | 348 | { |
349 | 349 | $path = substr($path, 0, strlen($path) - 1); |
350 | 350 | } |
351 | 351 | |
352 | - if(!$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path]) |
|
352 | + if (!$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path]) |
|
353 | 353 | { |
354 | 354 | $args = new stdClass(); |
355 | 355 | $args->path = $path; |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | function getRemoveUrlByPackageSrl($packageSrl) |
371 | 371 | { |
372 | 372 | $ftp_info = Context::getFTPInfo(); |
373 | - if(!$ftp_info->ftp_root_path) |
|
373 | + if (!$ftp_info->ftp_root_path) |
|
374 | 374 | { |
375 | 375 | return; |
376 | 376 | } |
377 | 377 | |
378 | - if(!$packageSrl) |
|
378 | + if (!$packageSrl) |
|
379 | 379 | { |
380 | 380 | return; |
381 | 381 | } |
@@ -391,19 +391,19 @@ discard block |
||
391 | 391 | */ |
392 | 392 | function getRemoveUrlByPath($path) |
393 | 393 | { |
394 | - if(!$path) |
|
394 | + if (!$path) |
|
395 | 395 | { |
396 | 396 | return; |
397 | 397 | } |
398 | 398 | |
399 | 399 | $ftp_info = Context::getFTPInfo(); |
400 | - if(!$ftp_info->ftp_root_path) |
|
400 | + if (!$ftp_info->ftp_root_path) |
|
401 | 401 | { |
402 | 402 | return; |
403 | 403 | } |
404 | 404 | |
405 | 405 | $packageSrl = $this->getPackageSrlByPath($path); |
406 | - if(!$packageSrl) |
|
406 | + if (!$packageSrl) |
|
407 | 407 | { |
408 | 408 | return; |
409 | 409 | } |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | function getUpdateUrlByPackageSrl($packageSrl) |
421 | 421 | { |
422 | - if(!$packageSrl) |
|
422 | + if (!$packageSrl) |
|
423 | 423 | { |
424 | 424 | return; |
425 | 425 | } |
@@ -435,13 +435,13 @@ discard block |
||
435 | 435 | */ |
436 | 436 | function getUpdateUrlByPath($path) |
437 | 437 | { |
438 | - if(!$path) |
|
438 | + if (!$path) |
|
439 | 439 | { |
440 | 440 | return; |
441 | 441 | } |
442 | 442 | |
443 | 443 | $packageSrl = $this->getPackageSrlByPath($path); |
444 | - if(!$packageSrl) |
|
444 | + if (!$packageSrl) |
|
445 | 445 | { |
446 | 446 | return; |
447 | 447 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | function getHaveInstance($columnList = array()) |
453 | 453 | { |
454 | 454 | $output = executeQueryArray('autoinstall.getHaveInstance', NULL, $columnList); |
455 | - if(!$output->data) |
|
455 | + if (!$output->data) |
|
456 | 456 | { |
457 | 457 | return array(); |
458 | 458 | } |