@@ -172,6 +172,9 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | +/** |
|
176 | + * @param string $ext |
|
177 | + */ |
|
175 | 178 | function get_target_files($ext, $dir, $files_to_skip) { |
176 | 179 | $files = glob("{$dir}*.{$ext}"); |
177 | 180 | $skips = glob("{$dir}*.min.{$ext}"); |
@@ -181,6 +184,9 @@ discard block |
||
181 | 184 | return $files; |
182 | 185 | } |
183 | 186 | |
187 | +/** |
|
188 | + * @param string $content |
|
189 | + */ |
|
184 | 190 | function closure_compile($content) { |
185 | 191 | require_once dirname(__FILE__).'/../../classes/httprequest/XEHttpRequest.class.php'; |
186 | 192 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author NAVER([email protected]) |
12 | 12 | */ |
13 | 13 | |
14 | -if(version_compare(PHP_VERSION, '5.3.0', '<')) { |
|
14 | +if (version_compare(PHP_VERSION, '5.3.0', '<')) { |
|
15 | 15 | echo "PHP 5.3.0 or above version is required."; |
16 | 16 | exit(1); |
17 | 17 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | $argc = $_SERVER['argc']; |
22 | 22 | |
23 | 23 | // get target directories |
24 | - if($argc < 1) exit; |
|
25 | - elseif($argc < 2) $dirs = array($_SERVER['PWD']); |
|
24 | + if ($argc < 1) exit; |
|
25 | + elseif ($argc < 2) $dirs = array($_SERVER['PWD']); |
|
26 | 26 | else $dirs = array_slice($argv, 1); |
27 | 27 | |
28 | 28 | $dirs = array_map('realpath', $dirs); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // add directory separator |
35 | 35 | function add_dirsep($path) { |
36 | - if(substr($path,-1) != DIRECTORY_SEPARATOR) $path .= DIRECTORY_SEPARATOR; |
|
36 | + if (substr($path, -1) != DIRECTORY_SEPARATOR) $path .= DIRECTORY_SEPARATOR; |
|
37 | 37 | return $path; |
38 | 38 | } |
39 | 39 | |
@@ -46,38 +46,38 @@ discard block |
||
46 | 46 | echo " Done\n"; |
47 | 47 | |
48 | 48 | // merge |
49 | - foreach($config['merge'] as $target=>$files) { |
|
49 | + foreach ($config['merge'] as $target=>$files) { |
|
50 | 50 | merge($files, $target, $dir); |
51 | 51 | } |
52 | 52 | |
53 | 53 | // files to skip |
54 | 54 | $files_to_skip = $config['skip']; |
55 | - foreach($files_to_skip as $idx=>$file) { |
|
56 | - if($file) $files_to_skip[$idx] = realpath($dir.trim($file)); |
|
55 | + foreach ($files_to_skip as $idx=>$file) { |
|
56 | + if ($file) $files_to_skip[$idx] = realpath($dir . trim($file)); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | echo " Minifying JavaScript files..."; |
60 | 60 | $js_files = get_target_files('js', $dir, $files_to_skip); |
61 | 61 | |
62 | - if(count($js_files) && !class_exists('JSMinPlus')) { |
|
63 | - require dirname(__FILE__).'/jsminplus/jsminplus.php'; |
|
62 | + if (count($js_files) && !class_exists('JSMinPlus')) { |
|
63 | + require dirname(__FILE__) . '/jsminplus/jsminplus.php'; |
|
64 | 64 | } |
65 | - foreach($js_files as $file) { |
|
66 | - if(!is_readable($file)) continue; |
|
65 | + foreach ($js_files as $file) { |
|
66 | + if (!is_readable($file)) continue; |
|
67 | 67 | |
68 | 68 | $target = preg_replace('@\.js$@', '.min.js', $file); |
69 | 69 | $content = file_get_contents($file); |
70 | 70 | |
71 | 71 | // save copyright to preserve it |
72 | - if(preg_match('@^[ \t]*(/\*\*.+?\*/)@s', $content, $matches)) { |
|
73 | - $copyright = $matches[1]."\n"; |
|
72 | + if (preg_match('@^[ \t]*(/\*\*.+?\*/)@s', $content, $matches)) { |
|
73 | + $copyright = $matches[1] . "\n"; |
|
74 | 74 | } else { |
75 | 75 | $copyright = ''; |
76 | 76 | } |
77 | 77 | |
78 | - if($config['use_closure_compiler']) { |
|
78 | + if ($config['use_closure_compiler']) { |
|
79 | 79 | $content = closure_compile($content); |
80 | - if(!$content) { |
|
80 | + if (!$content) { |
|
81 | 81 | echo " CANNOT compile the js file with closure compiler.\n"; |
82 | 82 | echo " Trying again with JSMinPlus.\n"; |
83 | 83 | $content = JSMinPlus::minify($content); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $content = JSMinPlus::minify($content); |
87 | 87 | } |
88 | 88 | |
89 | - file_put_contents($target, $copyright.$content, LOCK_EX); |
|
89 | + file_put_contents($target, $copyright . $content, LOCK_EX); |
|
90 | 90 | |
91 | 91 | echo '.'; |
92 | 92 | } |
@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | echo " Minifying CSS files..."; |
96 | 96 | $css_files = get_target_files('css', $dir, $files_to_skip); |
97 | 97 | |
98 | - if(count($css_files) && !class_exists('CSSmin')) { |
|
99 | - require dirname(__FILE__).'/cssmin/CSSmin.php'; |
|
98 | + if (count($css_files) && !class_exists('CSSmin')) { |
|
99 | + require dirname(__FILE__) . '/cssmin/CSSmin.php'; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $oCSSmin = new CSSmin(); |
103 | 103 | |
104 | - foreach($css_files as $file) { |
|
105 | - if(!is_readable($file)) continue; |
|
104 | + foreach ($css_files as $file) { |
|
105 | + if (!is_readable($file)) continue; |
|
106 | 106 | |
107 | 107 | $target = preg_replace('@\.css$@', '.min.css', $file); |
108 | 108 | $content = file_get_contents($file); |
109 | 109 | |
110 | - file_put_contents($target, $copyright.$oCSSmin->run($content), LOCK_EX); |
|
110 | + file_put_contents($target, $copyright . $oCSSmin->run($content), LOCK_EX); |
|
111 | 111 | echo '.'; |
112 | 112 | } |
113 | 113 | echo " Done\n"; |
@@ -115,59 +115,59 @@ discard block |
||
115 | 115 | |
116 | 116 | function read_config($dir) { |
117 | 117 | $default = array('option'=>array(), 'skip'=>array(), 'merge'=>array()); |
118 | - $file = $dir.'minify.ini'; |
|
118 | + $file = $dir . 'minify.ini'; |
|
119 | 119 | |
120 | - if(!is_readable($file)) return $default; |
|
120 | + if (!is_readable($file)) return $default; |
|
121 | 121 | |
122 | 122 | $config_str = file_get_contents($file); |
123 | 123 | $config_str = preg_replace_callback('/(\[(?:skip|merge *>> *.+?)\])([\s\S]+?)(?=\[|$)/', 'transform_config_str', $config_str); |
124 | 124 | |
125 | 125 | $config = parse_ini_string($config_str, 1); |
126 | - if($config === false) return $default; |
|
126 | + if ($config === false) return $default; |
|
127 | 127 | |
128 | - if(is_array($config['skip'])) $config['skip'] = array_keys($config['skip']); |
|
128 | + if (is_array($config['skip'])) $config['skip'] = array_keys($config['skip']); |
|
129 | 129 | |
130 | - foreach($config as $section=>$value) { |
|
131 | - if(preg_match('/merge *>> *(.+)/', $section, $match)) { |
|
132 | - if(!is_array($config['merge'])) $config['merge'] = array(); |
|
130 | + foreach ($config as $section=>$value) { |
|
131 | + if (preg_match('/merge *>> *(.+)/', $section, $match)) { |
|
132 | + if (!is_array($config['merge'])) $config['merge'] = array(); |
|
133 | 133 | $config['merge'][trim($match[1])] = array_keys($value); |
134 | 134 | |
135 | 135 | unset($config[$section]); |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - if(is_array($config['option'])) $config = array_merge($config['option'], $config); |
|
139 | + if (is_array($config['option'])) $config = array_merge($config['option'], $config); |
|
140 | 140 | $config = array_merge($default, $config); |
141 | 141 | |
142 | 142 | return $config; |
143 | 143 | } |
144 | 144 | |
145 | 145 | function transform_config_str($matches) { |
146 | - if(!$matches[2]) return $matches[0]; |
|
146 | + if (!$matches[2]) return $matches[0]; |
|
147 | 147 | $values = preg_replace('/$/m', '=', trim($matches[2])); |
148 | 148 | |
149 | 149 | return "{$matches[1]}\n{$values}\n\n"; |
150 | 150 | } |
151 | 151 | |
152 | 152 | function merge($files, $target, $base_dir) { |
153 | - if(!is_array($files)) return false; |
|
153 | + if (!is_array($files)) return false; |
|
154 | 154 | |
155 | 155 | $body = ''; |
156 | 156 | $is_css = !!preg_match('/\.css$/', $target); |
157 | 157 | |
158 | - foreach($files as $file) { |
|
159 | - $file = $base_dir.trim($file); |
|
160 | - if(!is_readable($file)) continue; |
|
158 | + foreach ($files as $file) { |
|
159 | + $file = $base_dir . trim($file); |
|
160 | + if (!is_readable($file)) continue; |
|
161 | 161 | |
162 | 162 | $content = trim(file_get_contents($file)); |
163 | - if($is_css && $body) $content = preg_replace('/^@.+?;/m', '', $content); |
|
164 | - if($content) $body .= $content."\n"; |
|
163 | + if ($is_css && $body) $content = preg_replace('/^@.+?;/m', '', $content); |
|
164 | + if ($content) $body .= $content . "\n"; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | if ($body) { |
168 | 168 | $file_count = count($files); |
169 | 169 | echo " Merging {$file_count} files to create {$target} file..."; |
170 | - file_put_contents($base_dir.$target, $body, LOCK_EX); |
|
170 | + file_put_contents($base_dir . $target, $body, LOCK_EX); |
|
171 | 171 | echo " Done\n"; |
172 | 172 | } |
173 | 173 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | function closure_compile($content) { |
185 | - require_once dirname(__FILE__).'/../../classes/httprequest/XEHttpRequest.class.php'; |
|
185 | + require_once dirname(__FILE__) . '/../../classes/httprequest/XEHttpRequest.class.php'; |
|
186 | 186 | |
187 | 187 | $req = new XEHttpRequest('closure-compiler.appspot.com', 80); |
188 | 188 | $ret = $req->send('/compile', 'POST', 5, array( |
@@ -21,9 +21,13 @@ discard block |
||
21 | 21 | $argc = $_SERVER['argc']; |
22 | 22 | |
23 | 23 | // get target directories |
24 | - if($argc < 1) exit; |
|
25 | - elseif($argc < 2) $dirs = array($_SERVER['PWD']); |
|
26 | - else $dirs = array_slice($argv, 1); |
|
24 | + if($argc < 1) { |
|
25 | + exit; |
|
26 | + } elseif($argc < 2) { |
|
27 | + $dirs = array($_SERVER['PWD']); |
|
28 | + } else { |
|
29 | + $dirs = array_slice($argv, 1); |
|
30 | + } |
|
27 | 31 | |
28 | 32 | $dirs = array_map('realpath', $dirs); |
29 | 33 | $dirs = array_map('add_dirsep', $dirs); |
@@ -33,7 +37,9 @@ discard block |
||
33 | 37 | |
34 | 38 | // add directory separator |
35 | 39 | function add_dirsep($path) { |
36 | - if(substr($path,-1) != DIRECTORY_SEPARATOR) $path .= DIRECTORY_SEPARATOR; |
|
40 | + if(substr($path,-1) != DIRECTORY_SEPARATOR) { |
|
41 | + $path .= DIRECTORY_SEPARATOR; |
|
42 | + } |
|
37 | 43 | return $path; |
38 | 44 | } |
39 | 45 | |
@@ -53,7 +59,9 @@ discard block |
||
53 | 59 | // files to skip |
54 | 60 | $files_to_skip = $config['skip']; |
55 | 61 | foreach($files_to_skip as $idx=>$file) { |
56 | - if($file) $files_to_skip[$idx] = realpath($dir.trim($file)); |
|
62 | + if($file) { |
|
63 | + $files_to_skip[$idx] = realpath($dir.trim($file)); |
|
64 | + } |
|
57 | 65 | } |
58 | 66 | |
59 | 67 | echo " Minifying JavaScript files..."; |
@@ -63,7 +71,9 @@ discard block |
||
63 | 71 | require dirname(__FILE__).'/jsminplus/jsminplus.php'; |
64 | 72 | } |
65 | 73 | foreach($js_files as $file) { |
66 | - if(!is_readable($file)) continue; |
|
74 | + if(!is_readable($file)) { |
|
75 | + continue; |
|
76 | + } |
|
67 | 77 | |
68 | 78 | $target = preg_replace('@\.js$@', '.min.js', $file); |
69 | 79 | $content = file_get_contents($file); |
@@ -102,7 +112,9 @@ discard block |
||
102 | 112 | $oCSSmin = new CSSmin(); |
103 | 113 | |
104 | 114 | foreach($css_files as $file) { |
105 | - if(!is_readable($file)) continue; |
|
115 | + if(!is_readable($file)) { |
|
116 | + continue; |
|
117 | + } |
|
106 | 118 | |
107 | 119 | $target = preg_replace('@\.css$@', '.min.css', $file); |
108 | 120 | $content = file_get_contents($file); |
@@ -117,51 +129,71 @@ discard block |
||
117 | 129 | $default = array('option'=>array(), 'skip'=>array(), 'merge'=>array()); |
118 | 130 | $file = $dir.'minify.ini'; |
119 | 131 | |
120 | - if(!is_readable($file)) return $default; |
|
132 | + if(!is_readable($file)) { |
|
133 | + return $default; |
|
134 | + } |
|
121 | 135 | |
122 | 136 | $config_str = file_get_contents($file); |
123 | 137 | $config_str = preg_replace_callback('/(\[(?:skip|merge *>> *.+?)\])([\s\S]+?)(?=\[|$)/', 'transform_config_str', $config_str); |
124 | 138 | |
125 | 139 | $config = parse_ini_string($config_str, 1); |
126 | - if($config === false) return $default; |
|
140 | + if($config === false) { |
|
141 | + return $default; |
|
142 | + } |
|
127 | 143 | |
128 | - if(is_array($config['skip'])) $config['skip'] = array_keys($config['skip']); |
|
144 | + if(is_array($config['skip'])) { |
|
145 | + $config['skip'] = array_keys($config['skip']); |
|
146 | + } |
|
129 | 147 | |
130 | 148 | foreach($config as $section=>$value) { |
131 | 149 | if(preg_match('/merge *>> *(.+)/', $section, $match)) { |
132 | - if(!is_array($config['merge'])) $config['merge'] = array(); |
|
150 | + if(!is_array($config['merge'])) { |
|
151 | + $config['merge'] = array(); |
|
152 | + } |
|
133 | 153 | $config['merge'][trim($match[1])] = array_keys($value); |
134 | 154 | |
135 | 155 | unset($config[$section]); |
136 | 156 | } |
137 | 157 | } |
138 | 158 | |
139 | - if(is_array($config['option'])) $config = array_merge($config['option'], $config); |
|
159 | + if(is_array($config['option'])) { |
|
160 | + $config = array_merge($config['option'], $config); |
|
161 | + } |
|
140 | 162 | $config = array_merge($default, $config); |
141 | 163 | |
142 | 164 | return $config; |
143 | 165 | } |
144 | 166 | |
145 | 167 | function transform_config_str($matches) { |
146 | - if(!$matches[2]) return $matches[0]; |
|
168 | + if(!$matches[2]) { |
|
169 | + return $matches[0]; |
|
170 | + } |
|
147 | 171 | $values = preg_replace('/$/m', '=', trim($matches[2])); |
148 | 172 | |
149 | 173 | return "{$matches[1]}\n{$values}\n\n"; |
150 | 174 | } |
151 | 175 | |
152 | 176 | function merge($files, $target, $base_dir) { |
153 | - if(!is_array($files)) return false; |
|
177 | + if(!is_array($files)) { |
|
178 | + return false; |
|
179 | + } |
|
154 | 180 | |
155 | 181 | $body = ''; |
156 | 182 | $is_css = !!preg_match('/\.css$/', $target); |
157 | 183 | |
158 | 184 | foreach($files as $file) { |
159 | 185 | $file = $base_dir.trim($file); |
160 | - if(!is_readable($file)) continue; |
|
186 | + if(!is_readable($file)) { |
|
187 | + continue; |
|
188 | + } |
|
161 | 189 | |
162 | 190 | $content = trim(file_get_contents($file)); |
163 | - if($is_css && $body) $content = preg_replace('/^@.+?;/m', '', $content); |
|
164 | - if($content) $body .= $content."\n"; |
|
191 | + if($is_css && $body) { |
|
192 | + $content = preg_replace('/^@.+?;/m', '', $content); |
|
193 | + } |
|
194 | + if($content) { |
|
195 | + $body .= $content."\n"; |
|
196 | + } |
|
165 | 197 | } |
166 | 198 | |
167 | 199 | if ($body) { |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * Minify |
|
5 | - * This script comnbines multiple JavaScript or CSS files with minifying. |
|
6 | - * PHP 5.3.0 or above version is required. |
|
7 | - * |
|
8 | - * Usage : php minify.php [TARGET_DIR ...] |
|
9 | - * TARGET_DIR use the current working directory as a default path. |
|
10 | - * |
|
11 | - * @author NAVER([email protected]) |
|
12 | - */ |
|
4 | + * Minify |
|
5 | + * This script comnbines multiple JavaScript or CSS files with minifying. |
|
6 | + * PHP 5.3.0 or above version is required. |
|
7 | + * |
|
8 | + * Usage : php minify.php [TARGET_DIR ...] |
|
9 | + * TARGET_DIR use the current working directory as a default path. |
|
10 | + * |
|
11 | + * @author NAVER([email protected]) |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | if(version_compare(PHP_VERSION, '5.3.0', '<')) { |
15 | 15 | echo "PHP 5.3.0 or above version is required."; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @brief admin log |
11 | 11 | */ |
12 | 12 | $logged_info = Context::get('logged_info'); |
13 | -if($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') |
|
13 | +if ($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') |
|
14 | 14 | { |
15 | 15 | $oAdminloggingController = getController('adminlogging'); |
16 | 16 | $oAdminloggingController->insertLog($this->module, $this->act); |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file point.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * @author NAVER ([email protected]) |
10 | 10 | * @brief Automatic link add-on |
11 | 11 | */ |
12 | -if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML") |
|
12 | +if ($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML") |
|
13 | 13 | { |
14 | - if(Mobile::isFromMobilePhone()) |
|
14 | + if (Mobile::isFromMobilePhone()) |
|
15 | 15 | { |
16 | 16 | Context::addJsFile('./common/js/jquery.min.js', false, '', -1000000); |
17 | 17 | Context::addJsFile('./common/js/xe.min.js', false, '', -1000000); |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file point.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * It should be called before executing the module(before_module_proc). If not, it is forced to shut down. |
14 | 14 | * */ |
15 | 15 | // Insert a rsd tag when called_position is after_module_proc |
16 | -if($called_position == 'after_module_proc') |
|
16 | +if ($called_position == 'after_module_proc') |
|
17 | 17 | { |
18 | 18 | // Create rsd address of the current module |
19 | 19 | $site_module_info = Context::get('site_module_info'); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | Context::addHtmlHeader(" " . '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . $rsd_url . '" />'); |
23 | 23 | } |
24 | 24 | // If act isnot api, just return |
25 | -if($_REQUEST['act'] != 'api') |
|
25 | +if ($_REQUEST['act'] != 'api') |
|
26 | 26 | { |
27 | 27 | return; |
28 | 28 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
34 | 34 | |
35 | 35 | // If HTTP_RAW_POST_DATA is NULL, Print error message |
36 | -if(!$xml) |
|
36 | +if (!$xml) |
|
37 | 37 | { |
38 | 38 | $content = getXmlRpcFailure(1, 'Invalid Method Call'); |
39 | 39 | printContent($content); |
@@ -41,38 +41,38 @@ discard block |
||
41 | 41 | |
42 | 42 | // xmlprc parsing |
43 | 43 | // Parse the requested xmlrpc |
44 | -if(Security::detectingXEE($xml)) |
|
44 | +if (Security::detectingXEE($xml)) |
|
45 | 45 | { |
46 | 46 | header("HTTP/1.0 400 Bad Request"); |
47 | 47 | exit; |
48 | 48 | } |
49 | 49 | |
50 | -if(version_compare(PHP_VERSION, '5.2.11', '<=')) libxml_disable_entity_loader(true); |
|
50 | +if (version_compare(PHP_VERSION, '5.2.11', '<=')) libxml_disable_entity_loader(true); |
|
51 | 51 | $xml = new SimpleXMLElement($xml, LIBXML_NONET | LIBXML_NOENT); |
52 | 52 | |
53 | -$method_name = (string)$xml->methodName; |
|
53 | +$method_name = (string) $xml->methodName; |
|
54 | 54 | $params = $xml->params->param; |
55 | 55 | |
56 | 56 | // Compatible with some of methodname |
57 | -if(in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo'))) |
|
57 | +if (in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo'))) |
|
58 | 58 | { |
59 | 59 | $method_name = str_replace('metaWeblog.', 'blogger.', $method_name); |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Get user_id, password and attempt log-in |
63 | -$user_id = trim((string)$params[1]->value->string); |
|
64 | -$password = trim((string)$params[2]->value->string); |
|
63 | +$user_id = trim((string) $params[1]->value->string); |
|
64 | +$password = trim((string) $params[2]->value->string); |
|
65 | 65 | |
66 | 66 | // Before executing the module, authentication is processed. |
67 | -if($called_position == 'before_module_init') |
|
67 | +if ($called_position == 'before_module_init') |
|
68 | 68 | { |
69 | 69 | // Attempt log-in by using member controller |
70 | - if($user_id && $password) |
|
70 | + if ($user_id && $password) |
|
71 | 71 | { |
72 | 72 | $oMemberController = getController('member'); |
73 | 73 | $output = $oMemberController->doLogin($user_id, $password); |
74 | 74 | // If login fails, an error message appears |
75 | - if(!$output->toBool()) |
|
75 | + if (!$output->toBool()) |
|
76 | 76 | { |
77 | 77 | $content = getXmlRpcFailure(1, $output->getMessage()); |
78 | 78 | printContent($content); |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | // Before module processing, handle requests from blogapi tool and then terminate. |
89 | -if($called_position == 'before_module_proc') |
|
89 | +if ($called_position == 'before_module_proc') |
|
90 | 90 | { |
91 | 91 | // Check writing permission |
92 | - if(!$this->grant->write_document) |
|
92 | + if (!$this->grant->write_document) |
|
93 | 93 | { |
94 | 94 | printContent(getXmlRpcFailure(1, 'no permission')); |
95 | 95 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $tmp_uploaded_path = sprintf(_XE_PATH_ . 'files/cache/blogapi/%s/%s/', $this->mid, $user_id); |
103 | 103 | $uploaded_target_path = sprintf(_XE_PATH_ . 'files/cache/blogapi/%s/%s/', $this->mid, $user_id); |
104 | 104 | |
105 | - switch($method_name) |
|
105 | + switch ($method_name) |
|
106 | 106 | { |
107 | 107 | // Blog information |
108 | 108 | case 'blogger.getUsersBlogs' : |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | // Return a list of categories |
120 | 120 | case 'metaWeblog.getCategories' : |
121 | 121 | $category_obj_list = array(); |
122 | - if($category_list) |
|
122 | + if ($category_list) |
|
123 | 123 | { |
124 | - foreach($category_list as $category_srl => $category_info) |
|
124 | + foreach ($category_list as $category_srl => $category_info) |
|
125 | 125 | { |
126 | 126 | $obj = new stdClass(); |
127 | 127 | $obj->description = $category_info->title; |
@@ -142,35 +142,35 @@ discard block |
||
142 | 142 | // Check a file upload permission |
143 | 143 | $oFileModel = getModel('file'); |
144 | 144 | $file_module_config = $oFileModel->getFileModuleConfig($this->module_srl); |
145 | - if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant) > 0) |
|
145 | + if (is_array($file_module_config->download_grant) && count($file_module_config->download_grant) > 0) |
|
146 | 146 | { |
147 | 147 | $logged_info = Context::get('logged_info'); |
148 | - if($logged_info->is_admin != 'Y') |
|
148 | + if ($logged_info->is_admin != 'Y') |
|
149 | 149 | { |
150 | 150 | $is_permitted = false; |
151 | - for($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
151 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
152 | 152 | { |
153 | 153 | $group_srl = $file_module_config->download_grant[$i]; |
154 | - if($logged_info->group_list[$group_srl]) |
|
154 | + if ($logged_info->group_list[$group_srl]) |
|
155 | 155 | { |
156 | 156 | $is_permitted = true; |
157 | 157 | break; |
158 | 158 | } |
159 | 159 | } |
160 | - if(!$is_permitted){ |
|
160 | + if (!$is_permitted) { |
|
161 | 161 | printContent(getXmlRpcFailure(1, 'no permission')); |
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | 166 | $fileinfo = $params[3]->value->struct->member; |
167 | - foreach($fileinfo as $key => $val) |
|
167 | + foreach ($fileinfo as $key => $val) |
|
168 | 168 | { |
169 | - $nodename = (string)$val->name; |
|
170 | - if($nodename == 'bits') |
|
171 | - $filedata = base64_decode((string)$val->value->base64); |
|
172 | - elseif($nodename == 'name') |
|
173 | - $filename = (string)$val->value->string; |
|
169 | + $nodename = (string) $val->name; |
|
170 | + if ($nodename == 'bits') |
|
171 | + $filedata = base64_decode((string) $val->value->base64); |
|
172 | + elseif ($nodename == 'name') |
|
173 | + $filename = (string) $val->value->string; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $tmp_arr = explode('/', $filename); |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | break; |
189 | 189 | // Get posts |
190 | 190 | case 'metaWeblog.getPost' : |
191 | - $document_srl = (string)$params[0]->value->string; |
|
192 | - if(!$document_srl) |
|
191 | + $document_srl = (string) $params[0]->value->string; |
|
192 | + if (!$document_srl) |
|
193 | 193 | { |
194 | 194 | printContent(getXmlRpcFailure(1, 'no permission')); |
195 | 195 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $oDocumentModel = getModel('document'); |
199 | 199 | $oDocument = $oDocumentModel->getDocument($document_srl); |
200 | - if(!$oDocument->isExists() || !$oDocument->isGranted()) |
|
200 | + if (!$oDocument->isExists() || !$oDocument->isGranted()) |
|
201 | 201 | { |
202 | 202 | printContent(getXmlRpcFailure(1, 'no permission')); |
203 | 203 | } |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | { |
206 | 206 | // Get a list of categories and set Context |
207 | 207 | $category = ""; |
208 | - if($oDocument->get('category_srl')) |
|
208 | + if ($oDocument->get('category_srl')) |
|
209 | 209 | { |
210 | 210 | $oDocumentModel = getModel('document'); |
211 | 211 | $category_list = $oDocumentModel->getCategoryList($oDocument->get('module_srl')); |
212 | - if($category_list[$oDocument->get('category_srl')]) |
|
212 | + if ($category_list[$oDocument->get('category_srl')]) |
|
213 | 213 | { |
214 | 214 | $category = $category_list[$oDocument->get('category_srl')]->title; |
215 | 215 | } |
@@ -251,35 +251,35 @@ discard block |
||
251 | 251 | $obj = new stdClass(); |
252 | 252 | $info = $params[3]; |
253 | 253 | // Get information of post, title, and category |
254 | - foreach($info->value->struct->member as $val) |
|
254 | + foreach ($info->value->struct->member as $val) |
|
255 | 255 | { |
256 | - switch((string)$val->name) |
|
256 | + switch ((string) $val->name) |
|
257 | 257 | { |
258 | 258 | case 'title' : |
259 | - $obj->title = (string)$val->value->string; |
|
259 | + $obj->title = (string) $val->value->string; |
|
260 | 260 | break; |
261 | 261 | case 'description' : |
262 | - $obj->content = (string)$val->value->string; |
|
262 | + $obj->content = (string) $val->value->string; |
|
263 | 263 | break; |
264 | 264 | case 'categories' : |
265 | 265 | $categories = $val->value->array->data->value; |
266 | - $category = (string)$categories[0]->string; |
|
267 | - if($category && $category_list) |
|
266 | + $category = (string) $categories[0]->string; |
|
267 | + if ($category && $category_list) |
|
268 | 268 | { |
269 | - foreach($category_list as $category_srl => $category_info) |
|
269 | + foreach ($category_list as $category_srl => $category_info) |
|
270 | 270 | { |
271 | - if($category_info->title == $category) |
|
271 | + if ($category_info->title == $category) |
|
272 | 272 | $obj->category_srl = $category_srl; |
273 | 273 | } |
274 | 274 | } |
275 | 275 | break; |
276 | 276 | case 'tagwords' : |
277 | 277 | $tags = $val->value->array->data->value; |
278 | - foreach($tags as $tag) |
|
278 | + foreach ($tags as $tag) |
|
279 | 279 | { |
280 | - $tag_list[] = (string)$tag->string; |
|
280 | + $tag_list[] = (string) $tag->string; |
|
281 | 281 | } |
282 | - if(count($tag_list)) |
|
282 | + if (count($tag_list)) |
|
283 | 283 | $obj->tags = implode(',', $tag_list); |
284 | 284 | break; |
285 | 285 | } |
@@ -291,14 +291,14 @@ discard block |
||
291 | 291 | $obj->module_srl = $this->module_srl; |
292 | 292 | |
293 | 293 | // Attachment |
294 | - if(is_dir($tmp_uploaded_path)) |
|
294 | + if (is_dir($tmp_uploaded_path)) |
|
295 | 295 | { |
296 | 296 | $file_list = FileHandler::readDir($tmp_uploaded_path); |
297 | 297 | $file_count = count($file_list); |
298 | - if($file_count) |
|
298 | + if ($file_count) |
|
299 | 299 | { |
300 | 300 | $oFileController = getController('file'); |
301 | - for($i = 0; $i < $file_count; $i++) |
|
301 | + for ($i = 0; $i < $file_count; $i++) |
|
302 | 302 | { |
303 | 303 | $file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]); |
304 | 304 | $file_info['name'] = $file_list[$i]; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $obj->homepage = $logged_info->homepage; |
325 | 325 | $output = $oDocumentController->insertDocument($obj, TRUE); |
326 | 326 | |
327 | - if(!$output->toBool()) |
|
327 | + if (!$output->toBool()) |
|
328 | 328 | { |
329 | 329 | $content = getXmlRpcFailure(1, $output->getMessage()); |
330 | 330 | } |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | |
340 | 340 | // Edit post |
341 | 341 | case 'metaWeblog.editPost' : |
342 | - $tmp_val = (string)$params[0]->value->string; |
|
343 | - if(!$tmp_val) |
|
344 | - $tmp_val = (string)$params[0]->value->i4; |
|
345 | - if(!$tmp_val) |
|
342 | + $tmp_val = (string) $params[0]->value->string; |
|
343 | + if (!$tmp_val) |
|
344 | + $tmp_val = (string) $params[0]->value->i4; |
|
345 | + if (!$tmp_val) |
|
346 | 346 | { |
347 | 347 | $content = getXmlRpcFailure(1, 'no permission'); |
348 | 348 | break; |
349 | 349 | } |
350 | 350 | $tmp_arr = explode('/', $tmp_val); |
351 | 351 | $document_srl = array_pop($tmp_arr); |
352 | - if(!$document_srl) |
|
352 | + if (!$document_srl) |
|
353 | 353 | { |
354 | 354 | $content = getXmlRpcFailure(1, 'no permission'); |
355 | 355 | break; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $oDocumentModel = getModel('document'); |
359 | 359 | $oDocument = $oDocumentModel->getDocument($document_srl); |
360 | 360 | // Check if a permission to modify a document is granted |
361 | - if(!$oDocument->isGranted()) |
|
361 | + if (!$oDocument->isGranted()) |
|
362 | 362 | { |
363 | 363 | $content = getXmlRpcFailure(1, 'no permission'); |
364 | 364 | break; |
@@ -368,35 +368,35 @@ discard block |
||
368 | 368 | |
369 | 369 | $info = $params[3]; |
370 | 370 | // Get information of post, title, and category |
371 | - foreach($info->value->struct->member as $val) |
|
371 | + foreach ($info->value->struct->member as $val) |
|
372 | 372 | { |
373 | - switch((string)$val->name) |
|
373 | + switch ((string) $val->name) |
|
374 | 374 | { |
375 | 375 | case 'title' : |
376 | - $obj->title = (string)$val->value->string; |
|
376 | + $obj->title = (string) $val->value->string; |
|
377 | 377 | break; |
378 | 378 | case 'description' : |
379 | - $obj->content = (string)$val->value->string; |
|
379 | + $obj->content = (string) $val->value->string; |
|
380 | 380 | break; |
381 | 381 | case 'categories' : |
382 | 382 | $categories = $val->value->array->data->value; |
383 | - $category = (string)$categories[0]->string; |
|
384 | - if($category && $category_list) |
|
383 | + $category = (string) $categories[0]->string; |
|
384 | + if ($category && $category_list) |
|
385 | 385 | { |
386 | - foreach($category_list as $category_srl => $category_info) |
|
386 | + foreach ($category_list as $category_srl => $category_info) |
|
387 | 387 | { |
388 | - if($category_info->title == $category) |
|
388 | + if ($category_info->title == $category) |
|
389 | 389 | $obj->category_srl = $category_srl; |
390 | 390 | } |
391 | 391 | } |
392 | 392 | break; |
393 | 393 | case 'tagwords' : |
394 | 394 | $tags = $val->value->array->data->value; |
395 | - foreach($tags as $tag) |
|
395 | + foreach ($tags as $tag) |
|
396 | 396 | { |
397 | - $tag_list[] = (string)$tag->string; |
|
397 | + $tag_list[] = (string) $tag->string; |
|
398 | 398 | } |
399 | - if(count($tag_list)) |
|
399 | + if (count($tag_list)) |
|
400 | 400 | $obj->tags = implode(',', $tag_list); |
401 | 401 | break; |
402 | 402 | } |
@@ -405,20 +405,20 @@ discard block |
||
405 | 405 | $obj->document_srl = $document_srl; |
406 | 406 | $obj->module_srl = $this->module_srl; |
407 | 407 | // Attachment |
408 | - if(is_dir($tmp_uploaded_path)) |
|
408 | + if (is_dir($tmp_uploaded_path)) |
|
409 | 409 | { |
410 | 410 | $file_list = FileHandler::readDir($tmp_uploaded_path); |
411 | 411 | $file_count = count($file_list); |
412 | - if($file_count) |
|
412 | + if ($file_count) |
|
413 | 413 | { |
414 | 414 | $oFileController = getController('file'); |
415 | - for($i = 0; $i < $file_count; $i++) |
|
415 | + for ($i = 0; $i < $file_count; $i++) |
|
416 | 416 | { |
417 | 417 | $file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]); |
418 | 418 | $file_info['name'] = $file_list[$i]; |
419 | 419 | |
420 | 420 | $moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']); |
421 | - if(file_exists($moved_filename)) |
|
421 | + if (file_exists($moved_filename)) |
|
422 | 422 | continue; |
423 | 423 | |
424 | 424 | $fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $oDocumentController = getController('document'); |
434 | 434 | $output = $oDocumentController->updateDocument($oDocument, $obj, TRUE); |
435 | 435 | |
436 | - if(!$output->toBool()) |
|
436 | + if (!$output->toBool()) |
|
437 | 437 | { |
438 | 438 | $content = getXmlRpcFailure(1, $output->getMessage()); |
439 | 439 | } |
@@ -447,19 +447,19 @@ discard block |
||
447 | 447 | break; |
448 | 448 | // Delete the post |
449 | 449 | case 'blogger.deletePost' : |
450 | - $tmp_val = (string)$params[1]->value->string; |
|
450 | + $tmp_val = (string) $params[1]->value->string; |
|
451 | 451 | $tmp_arr = explode('/', $tmp_val); |
452 | 452 | $document_srl = array_pop($tmp_arr); |
453 | 453 | // Get a document |
454 | 454 | $oDocumentModel = getModel('document'); |
455 | 455 | $oDocument = $oDocumentModel->getDocument($document_srl); |
456 | 456 | // If the document exists |
457 | - if(!$oDocument->isExists()) |
|
457 | + if (!$oDocument->isExists()) |
|
458 | 458 | { |
459 | 459 | $content = getXmlRpcFailure(1, 'not exists'); |
460 | 460 | // Check if a permission to delete a document is granted |
461 | 461 | } |
462 | - elseif(!$oDocument->isGranted()) |
|
462 | + elseif (!$oDocument->isGranted()) |
|
463 | 463 | { |
464 | 464 | $content = getXmlRpcFailure(1, 'no permission'); |
465 | 465 | break; |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | { |
470 | 470 | $oDocumentController = getController('document'); |
471 | 471 | $output = $oDocumentController->deleteDocument($document_srl); |
472 | - if(!$output->toBool()) |
|
472 | + if (!$output->toBool()) |
|
473 | 473 | $content = getXmlRpcFailure(1, $output->getMessage()); |
474 | 474 | else |
475 | 475 | $content = getXmlRpcResponse(true); |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $args->search_target = 'member_srl'; |
490 | 490 | $args->search_keyword = $logged_info->member_srl; |
491 | 491 | $output = $oDocumentModel->getDocumentList($args); |
492 | - if(!$output->toBool() || !$output->data) |
|
492 | + if (!$output->toBool() || !$output->data) |
|
493 | 493 | { |
494 | 494 | $content = getXmlRpcFailure(1, 'post not founded'); |
495 | 495 | } |
@@ -498,12 +498,12 @@ discard block |
||
498 | 498 | $oEditorController = getController('editor'); |
499 | 499 | |
500 | 500 | $posts = array(); |
501 | - foreach($output->data as $key => $oDocument) |
|
501 | + foreach ($output->data as $key => $oDocument) |
|
502 | 502 | { |
503 | 503 | $post = new stdClass(); |
504 | 504 | $post->categories = array(); |
505 | 505 | $post->dateCreated = date("Ymd", $oDocument->getRegdateTime()) . 'T' . date("H:i:s", $oDocument->getRegdateTime()); |
506 | - $post->description = sprintf('<![CDATA[%s]]>',$oEditorController->transComponent($oDocument->getContent(false, false, true, false))); |
|
506 | + $post->description = sprintf('<![CDATA[%s]]>', $oEditorController->transComponent($oDocument->getContent(false, false, true, false))); |
|
507 | 507 | $post->link = $post->permaLink = getFullUrl('', 'document_srl', $oDocument->document_srl); |
508 | 508 | $post->postid = $oDocument->document_srl; |
509 | 509 | $post->title = htmlspecialchars($oDocument->get('title'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
@@ -1,8 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file blogapicounter.addon.php |
@@ -47,7 +48,9 @@ discard block |
||
47 | 48 | exit; |
48 | 49 | } |
49 | 50 | |
50 | -if(version_compare(PHP_VERSION, '5.2.11', '<=')) libxml_disable_entity_loader(true); |
|
51 | +if(version_compare(PHP_VERSION, '5.2.11', '<=')) { |
|
52 | + libxml_disable_entity_loader(true); |
|
53 | +} |
|
51 | 54 | $xml = new SimpleXMLElement($xml, LIBXML_NONET | LIBXML_NOENT); |
52 | 55 | |
53 | 56 | $method_name = (string)$xml->methodName; |
@@ -77,8 +80,7 @@ discard block |
||
77 | 80 | $content = getXmlRpcFailure(1, $output->getMessage()); |
78 | 81 | printContent($content); |
79 | 82 | } |
80 | - } |
|
81 | - else |
|
83 | + } else |
|
82 | 84 | { |
83 | 85 | $content = getXmlRpcFailure(1, 'not logged'); |
84 | 86 | printContent($content); |
@@ -167,10 +169,11 @@ discard block |
||
167 | 169 | foreach($fileinfo as $key => $val) |
168 | 170 | { |
169 | 171 | $nodename = (string)$val->name; |
170 | - if($nodename == 'bits') |
|
171 | - $filedata = base64_decode((string)$val->value->base64); |
|
172 | - elseif($nodename == 'name') |
|
173 | - $filename = (string)$val->value->string; |
|
172 | + if($nodename == 'bits') { |
|
173 | + $filedata = base64_decode((string)$val->value->base64); |
|
174 | + } elseif($nodename == 'name') { |
|
175 | + $filename = (string)$val->value->string; |
|
176 | + } |
|
174 | 177 | } |
175 | 178 | |
176 | 179 | $tmp_arr = explode('/', $filename); |
@@ -192,16 +195,14 @@ discard block |
||
192 | 195 | if(!$document_srl) |
193 | 196 | { |
194 | 197 | printContent(getXmlRpcFailure(1, 'no permission')); |
195 | - } |
|
196 | - else |
|
198 | + } else |
|
197 | 199 | { |
198 | 200 | $oDocumentModel = getModel('document'); |
199 | 201 | $oDocument = $oDocumentModel->getDocument($document_srl); |
200 | 202 | if(!$oDocument->isExists() || !$oDocument->isGranted()) |
201 | 203 | { |
202 | 204 | printContent(getXmlRpcFailure(1, 'no permission')); |
203 | - } |
|
204 | - else |
|
205 | + } else |
|
205 | 206 | { |
206 | 207 | // Get a list of categories and set Context |
207 | 208 | $category = ""; |
@@ -268,8 +269,9 @@ discard block |
||
268 | 269 | { |
269 | 270 | foreach($category_list as $category_srl => $category_info) |
270 | 271 | { |
271 | - if($category_info->title == $category) |
|
272 | - $obj->category_srl = $category_srl; |
|
272 | + if($category_info->title == $category) { |
|
273 | + $obj->category_srl = $category_srl; |
|
274 | + } |
|
273 | 275 | } |
274 | 276 | } |
275 | 277 | break; |
@@ -279,8 +281,9 @@ discard block |
||
279 | 281 | { |
280 | 282 | $tag_list[] = (string)$tag->string; |
281 | 283 | } |
282 | - if(count($tag_list)) |
|
283 | - $obj->tags = implode(',', $tag_list); |
|
284 | + if(count($tag_list)) { |
|
285 | + $obj->tags = implode(',', $tag_list); |
|
286 | + } |
|
284 | 287 | break; |
285 | 288 | } |
286 | 289 | } |
@@ -327,8 +330,7 @@ discard block |
||
327 | 330 | if(!$output->toBool()) |
328 | 331 | { |
329 | 332 | $content = getXmlRpcFailure(1, $output->getMessage()); |
330 | - } |
|
331 | - else |
|
333 | + } else |
|
332 | 334 | { |
333 | 335 | $content = getXmlRpcResponse(strval($document_srl)); |
334 | 336 | } |
@@ -340,8 +342,9 @@ discard block |
||
340 | 342 | // Edit post |
341 | 343 | case 'metaWeblog.editPost' : |
342 | 344 | $tmp_val = (string)$params[0]->value->string; |
343 | - if(!$tmp_val) |
|
344 | - $tmp_val = (string)$params[0]->value->i4; |
|
345 | + if(!$tmp_val) { |
|
346 | + $tmp_val = (string)$params[0]->value->i4; |
|
347 | + } |
|
345 | 348 | if(!$tmp_val) |
346 | 349 | { |
347 | 350 | $content = getXmlRpcFailure(1, 'no permission'); |
@@ -385,8 +388,9 @@ discard block |
||
385 | 388 | { |
386 | 389 | foreach($category_list as $category_srl => $category_info) |
387 | 390 | { |
388 | - if($category_info->title == $category) |
|
389 | - $obj->category_srl = $category_srl; |
|
391 | + if($category_info->title == $category) { |
|
392 | + $obj->category_srl = $category_srl; |
|
393 | + } |
|
390 | 394 | } |
391 | 395 | } |
392 | 396 | break; |
@@ -396,8 +400,9 @@ discard block |
||
396 | 400 | { |
397 | 401 | $tag_list[] = (string)$tag->string; |
398 | 402 | } |
399 | - if(count($tag_list)) |
|
400 | - $obj->tags = implode(',', $tag_list); |
|
403 | + if(count($tag_list)) { |
|
404 | + $obj->tags = implode(',', $tag_list); |
|
405 | + } |
|
401 | 406 | break; |
402 | 407 | } |
403 | 408 | } |
@@ -418,8 +423,9 @@ discard block |
||
418 | 423 | $file_info['name'] = $file_list[$i]; |
419 | 424 | |
420 | 425 | $moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']); |
421 | - if(file_exists($moved_filename)) |
|
422 | - continue; |
|
426 | + if(file_exists($moved_filename)) { |
|
427 | + continue; |
|
428 | + } |
|
423 | 429 | |
424 | 430 | $fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true); |
425 | 431 | $uploaded_filename = $fileOutput->get('uploaded_filename'); |
@@ -436,8 +442,7 @@ discard block |
||
436 | 442 | if(!$output->toBool()) |
437 | 443 | { |
438 | 444 | $content = getXmlRpcFailure(1, $output->getMessage()); |
439 | - } |
|
440 | - else |
|
445 | + } else |
|
441 | 446 | { |
442 | 447 | $content = getXmlRpcResponse(true); |
443 | 448 | FileHandler::removeDir($tmp_uploaded_path); |
@@ -458,21 +463,20 @@ discard block |
||
458 | 463 | { |
459 | 464 | $content = getXmlRpcFailure(1, 'not exists'); |
460 | 465 | // Check if a permission to delete a document is granted |
461 | - } |
|
462 | - elseif(!$oDocument->isGranted()) |
|
466 | + } elseif(!$oDocument->isGranted()) |
|
463 | 467 | { |
464 | 468 | $content = getXmlRpcFailure(1, 'no permission'); |
465 | 469 | break; |
466 | 470 | // Delete |
467 | - } |
|
468 | - else |
|
471 | + } else |
|
469 | 472 | { |
470 | 473 | $oDocumentController = getController('document'); |
471 | 474 | $output = $oDocumentController->deleteDocument($document_srl); |
472 | - if(!$output->toBool()) |
|
473 | - $content = getXmlRpcFailure(1, $output->getMessage()); |
|
474 | - else |
|
475 | - $content = getXmlRpcResponse(true); |
|
475 | + if(!$output->toBool()) { |
|
476 | + $content = getXmlRpcFailure(1, $output->getMessage()); |
|
477 | + } else { |
|
478 | + $content = getXmlRpcResponse(true); |
|
479 | + } |
|
476 | 480 | } |
477 | 481 | |
478 | 482 | printContent($content); |
@@ -492,8 +496,7 @@ discard block |
||
492 | 496 | if(!$output->toBool() || !$output->data) |
493 | 497 | { |
494 | 498 | $content = getXmlRpcFailure(1, 'post not founded'); |
495 | - } |
|
496 | - else |
|
499 | + } else |
|
497 | 500 | { |
498 | 501 | $oEditorController = getController('editor'); |
499 | 502 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -31,42 +31,42 @@ discard block |
||
31 | 31 | // Encoding |
32 | 32 | function _getEncodedVal($val, $is_sub_set = false) |
33 | 33 | { |
34 | - if(preg_match('/^\<\!\[CDATA\[/',$val)) |
|
34 | + if (preg_match('/^\<\!\[CDATA\[/', $val)) |
|
35 | 35 | { |
36 | 36 | $buff = sprintf("<value>%s</value>", $val); |
37 | 37 | } |
38 | - elseif(is_int($val)) |
|
38 | + elseif (is_int($val)) |
|
39 | 39 | { |
40 | 40 | $buff = sprintf("<value><i4>%d</i4></value>", $val); |
41 | 41 | } |
42 | - elseif(is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val)) |
|
42 | + elseif (is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val)) |
|
43 | 43 | { |
44 | 44 | $buff = sprintf("<value><dateTime.iso8601>%s</dateTime.iso8601></value>\n", $val); |
45 | 45 | } |
46 | - elseif(is_double($val)) |
|
46 | + elseif (is_double($val)) |
|
47 | 47 | { |
48 | 48 | $buff = sprintf("<value><double>%f</double></value>", $val); |
49 | 49 | } |
50 | - elseif(is_bool($val)) |
|
50 | + elseif (is_bool($val)) |
|
51 | 51 | { |
52 | 52 | $buff = sprintf("<value><boolean>%d</boolean></value>", $val ? 1 : 0); |
53 | 53 | } |
54 | - elseif(is_object($val)) |
|
54 | + elseif (is_object($val)) |
|
55 | 55 | { |
56 | 56 | $values = get_object_vars($val); |
57 | 57 | $val_count = count($values); |
58 | 58 | $buff = "<value><struct>"; |
59 | - foreach($values as $k => $v) |
|
59 | + foreach ($values as $k => $v) |
|
60 | 60 | { |
61 | 61 | $buff .= sprintf("<member>\n<name>%s</name>\n%s</member>\n", htmlspecialchars($k, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), _getEncodedVal($v, true)); |
62 | 62 | } |
63 | 63 | $buff .= "</struct></value>\n"; |
64 | 64 | } |
65 | - elseif(is_array($val)) |
|
65 | + elseif (is_array($val)) |
|
66 | 66 | { |
67 | 67 | $val_count = count($val); |
68 | 68 | $buff = "<value><array>\n<data>"; |
69 | - for($i = 0; $i < $val_count; $i++) |
|
69 | + for ($i = 0; $i < $val_count; $i++) |
|
70 | 70 | { |
71 | 71 | $buff .= _getEncodedVal($val[$i], true); |
72 | 72 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $buff = sprintf("<value><string>%s</string></value>\n", $val); |
78 | 78 | } |
79 | - if(!$is_sub_set) |
|
79 | + if (!$is_sub_set) |
|
80 | 80 | { |
81 | 81 | return sprintf("<param>\n%s</param>", $buff); |
82 | 82 | } |
@@ -1,8 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file ./addons/blogapi/blogapi.func.php |
@@ -34,24 +35,19 @@ discard block |
||
34 | 35 | if(preg_match('/^\<\!\[CDATA\[/',$val)) |
35 | 36 | { |
36 | 37 | $buff = sprintf("<value>%s</value>", $val); |
37 | - } |
|
38 | - elseif(is_int($val)) |
|
38 | + } elseif(is_int($val)) |
|
39 | 39 | { |
40 | 40 | $buff = sprintf("<value><i4>%d</i4></value>", $val); |
41 | - } |
|
42 | - elseif(is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val)) |
|
41 | + } elseif(is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val)) |
|
43 | 42 | { |
44 | 43 | $buff = sprintf("<value><dateTime.iso8601>%s</dateTime.iso8601></value>\n", $val); |
45 | - } |
|
46 | - elseif(is_double($val)) |
|
44 | + } elseif(is_double($val)) |
|
47 | 45 | { |
48 | 46 | $buff = sprintf("<value><double>%f</double></value>", $val); |
49 | - } |
|
50 | - elseif(is_bool($val)) |
|
47 | + } elseif(is_bool($val)) |
|
51 | 48 | { |
52 | 49 | $buff = sprintf("<value><boolean>%d</boolean></value>", $val ? 1 : 0); |
53 | - } |
|
54 | - elseif(is_object($val)) |
|
50 | + } elseif(is_object($val)) |
|
55 | 51 | { |
56 | 52 | $values = get_object_vars($val); |
57 | 53 | $val_count = count($values); |
@@ -61,8 +57,7 @@ discard block |
||
61 | 57 | $buff .= sprintf("<member>\n<name>%s</name>\n%s</member>\n", htmlspecialchars($k, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), _getEncodedVal($v, true)); |
62 | 58 | } |
63 | 59 | $buff .= "</struct></value>\n"; |
64 | - } |
|
65 | - elseif(is_array($val)) |
|
60 | + } elseif(is_array($val)) |
|
66 | 61 | { |
67 | 62 | $val_count = count($val); |
68 | 63 | $buff = "<value><array>\n<data>"; |
@@ -71,8 +66,7 @@ discard block |
||
71 | 66 | $buff .= _getEncodedVal($val[$i], true); |
72 | 67 | } |
73 | 68 | $buff .= "</data>\n</array></value>"; |
74 | - } |
|
75 | - else |
|
69 | + } else |
|
76 | 70 | { |
77 | 71 | $buff = sprintf("<value><string>%s</string></value>\n", $val); |
78 | 72 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if (!defined("__XE__")) exit(); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @file captcha.addon.php |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | * @brief Captcha for a particular action |
10 | 10 | * English alphabets and voice verification added |
11 | 11 | * */ |
12 | -if(!class_exists('AddonCaptcha', false)) |
|
12 | +if (!class_exists('AddonCaptcha', false)) |
|
13 | 13 | { |
14 | 14 | // On the mobile mode, XE Core does not load jquery and xe.js as normal. |
15 | - if(Mobile::isFromMobilePhone()) |
|
15 | + if (Mobile::isFromMobilePhone()) |
|
16 | 16 | { |
17 | 17 | Context::loadFile(array('./common/js/jquery.min.js', 'head', NULL, -100000), true); |
18 | 18 | Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | function before_module_proc() |
33 | 33 | { |
34 | - if($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) |
|
34 | + if ($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) |
|
35 | 35 | { |
36 | 36 | unset($_SESSION['captcha_authed']); |
37 | 37 | } |
@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | function before_module_init(&$ModuleHandler) |
41 | 41 | { |
42 | 42 | $logged_info = Context::get('logged_info'); |
43 | - if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
43 | + if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
44 | 44 | { |
45 | 45 | return false; |
46 | 46 | } |
47 | - if($this->addon_info->target != 'all' && Context::get('is_logged')) |
|
47 | + if ($this->addon_info->target != 'all' && Context::get('is_logged')) |
|
48 | 48 | { |
49 | 49 | return false; |
50 | 50 | } |
51 | - if($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
51 | + if ($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
52 | 52 | { |
53 | 53 | $_SESSION['captcha_authed'] = false; |
54 | 54 | } |
55 | - if($_SESSION['captcha_authed']) |
|
55 | + if ($_SESSION['captcha_authed']) |
|
56 | 56 | { |
57 | 57 | return false; |
58 | 58 | } |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | |
62 | 62 | $this->target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment'); |
63 | 63 | |
64 | - if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
64 | + if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
65 | 65 | { |
66 | - if($type == 'inline') |
|
66 | + if ($type == 'inline') |
|
67 | 67 | { |
68 | - if(!$this->compareCaptcha()) |
|
68 | + if (!$this->compareCaptcha()) |
|
69 | 69 | { |
70 | 70 | Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
71 | 71 | $_SESSION['XE_VALIDATOR_ERROR'] = -1; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | // compare session when calling actions such as writing a post or a comment on the board/issue tracker module |
89 | - if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
89 | + if (!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
90 | 90 | { |
91 | 91 | Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
92 | 92 | $ModuleHandler->error = "captcha_denied"; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | function createKeyword() |
99 | 99 | { |
100 | 100 | $type = Context::get('captchaType'); |
101 | - if($type == 'inline' && $_SESSION['captcha_keyword']) |
|
101 | + if ($type == 'inline' && $_SESSION['captcha_keyword']) |
|
102 | 102 | { |
103 | 103 | return; |
104 | 104 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | function before_module_init_setCaptchaSession() |
113 | 113 | { |
114 | - if($_SESSION['captcha_authed']) |
|
114 | + if ($_SESSION['captcha_authed']) |
|
115 | 115 | { |
116 | 116 | return false; |
117 | 117 | } |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | |
141 | 141 | function before_module_init_captchaImage() |
142 | 142 | { |
143 | - if($_SESSION['captcha_authed']) |
|
143 | + if ($_SESSION['captcha_authed']) |
|
144 | 144 | { |
145 | 145 | return false; |
146 | 146 | } |
147 | - if(Context::get('renew')) |
|
147 | + if (Context::get('renew')) |
|
148 | 148 | { |
149 | 149 | $this->createKeyword(); |
150 | 150 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | function createCaptchaImage($string) |
167 | 167 | { |
168 | 168 | $arr = array(); |
169 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
169 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
170 | 170 | { |
171 | 171 | $arr[] = $string{$i}; |
172 | 172 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | shuffle($deg); |
189 | 189 | |
190 | 190 | // Create an image for each letter |
191 | - foreach($arr as $i => $str) |
|
191 | + foreach ($arr as $i => $str) |
|
192 | 192 | { |
193 | 193 | $im[$i + 1] = @imagecreate($w, $h); |
194 | 194 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $ran = range(1, 20); |
199 | 199 | shuffle($ran); |
200 | 200 | |
201 | - if(function_exists('imagerotate')) |
|
201 | + if (function_exists('imagerotate')) |
|
202 | 202 | { |
203 | 203 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color); |
204 | 204 | $im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | // Combine images of each character |
216 | - for($i = 1, $c = count($im); $i<$c; $i++) |
|
216 | + for ($i = 1, $c = count($im); $i < $c; $i++) |
|
217 | 217 | { |
218 | 218 | imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); |
219 | 219 | imagedestroy($im[$i]); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h); |
226 | 226 | imagedestroy($im[0]); |
227 | 227 | |
228 | - if(function_exists('imageantialias')) |
|
228 | + if (function_exists('imageantialias')) |
|
229 | 229 | { |
230 | 230 | imageantialias($big, true); |
231 | 231 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $h = $h * $big_count; |
238 | 238 | $d = array_pop($deg); |
239 | 239 | |
240 | - for($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
240 | + for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
241 | 241 | { |
242 | 242 | imageline($big, 0, $i + $d, $w, $i, $line_color); |
243 | 243 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $x = range(0, ($w - 10)); |
246 | 246 | shuffle($x); |
247 | 247 | |
248 | - for($i = 0; $i < 200; $i++) |
|
248 | + for ($i = 0; $i < 200; $i++) |
|
249 | 249 | { |
250 | 250 | imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color); |
251 | 251 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | function before_module_init_captchaAudio() |
257 | 257 | { |
258 | - if($_SESSION['captcha_authed']) |
|
258 | + if ($_SESSION['captcha_authed']) |
|
259 | 259 | { |
260 | 260 | return false; |
261 | 261 | } |
@@ -279,17 +279,17 @@ discard block |
||
279 | 279 | { |
280 | 280 | $data = ''; |
281 | 281 | $_audio = './addons/captcha/audio/F_%s.mp3'; |
282 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
282 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
283 | 283 | { |
284 | 284 | $_data = FileHandler::readFile(sprintf($_audio, $string{$i})); |
285 | 285 | |
286 | 286 | $start = rand(5, 68); // Random start in 4-byte header and 64 byte data |
287 | 287 | $datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes |
288 | 288 | |
289 | - for($j = $start; $j < $datalen; $j+=64) |
|
289 | + for ($j = $start; $j < $datalen; $j += 64) |
|
290 | 290 | { |
291 | 291 | $ch = ord($_data{$j}); |
292 | - if($ch < 9 || $ch > 119) |
|
292 | + if ($ch < 9 || $ch > 119) |
|
293 | 293 | { |
294 | 294 | continue; |
295 | 295 | } |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | |
305 | 305 | function compareCaptcha() |
306 | 306 | { |
307 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
307 | + if (!in_array(Context::get('act'), $this->target_acts)) return true; |
|
308 | 308 | |
309 | - if($_SESSION['captcha_authed']) |
|
309 | + if ($_SESSION['captcha_authed']) |
|
310 | 310 | { |
311 | 311 | return true; |
312 | 312 | } |
313 | 313 | |
314 | - if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
314 | + if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
315 | 315 | { |
316 | 316 | $_SESSION['captcha_authed'] = true; |
317 | 317 | return true; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | function before_module_init_captchaCompare() |
326 | 326 | { |
327 | - if(!$this->compareCaptcha()) |
|
327 | + if (!$this->compareCaptcha()) |
|
328 | 328 | { |
329 | 329 | return false; |
330 | 330 | } |
@@ -384,18 +384,18 @@ discard block |
||
384 | 384 | |
385 | 385 | $oAddonCaptcha = &$GLOBALS['__AddonCaptcha__']; |
386 | 386 | |
387 | -if(method_exists($oAddonCaptcha, $called_position)) |
|
387 | +if (method_exists($oAddonCaptcha, $called_position)) |
|
388 | 388 | { |
389 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) |
|
389 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) |
|
390 | 390 | { |
391 | 391 | return false; |
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | 395 | $addon_act = Context::get('captcha_action'); |
396 | -if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act)) |
|
396 | +if ($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act)) |
|
397 | 397 | { |
398 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this))) |
|
398 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this))) |
|
399 | 399 | { |
400 | 400 | return false; |
401 | 401 | } |
@@ -286,6 +286,9 @@ |
||
286 | 286 | exit(); |
287 | 287 | } |
288 | 288 | |
289 | + /** |
|
290 | + * @param string $string |
|
291 | + */ |
|
289 | 292 | function createCaptchaAudio($string) |
290 | 293 | { |
291 | 294 | $data = ''; |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if(!defined("__XE__")) { |
|
5 | + exit(); |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * @file captcha.addon.php |
@@ -85,8 +87,7 @@ discard block |
||
85 | 87 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); |
86 | 88 | $ModuleHandler->_setInputValueToSession(); |
87 | 89 | } |
88 | - } |
|
89 | - else |
|
90 | + } else |
|
90 | 91 | { |
91 | 92 | Context::addHtmlHeader('<script> |
92 | 93 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
@@ -216,8 +217,7 @@ discard block |
||
216 | 217 | |
217 | 218 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
218 | 219 | imagecolortransparent($im[$i + 1], $background_color); |
219 | - } |
|
220 | - else |
|
220 | + } else |
|
221 | 221 | { |
222 | 222 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color); |
223 | 223 | } |
@@ -315,7 +315,9 @@ discard block |
||
315 | 315 | |
316 | 316 | function compareCaptcha() |
317 | 317 | { |
318 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
318 | + if(!in_array(Context::get('act'), $this->target_acts)) { |
|
319 | + return true; |
|
320 | + } |
|
319 | 321 | |
320 | 322 | if($_SESSION['member_captcha_authed']) |
321 | 323 | { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @brief Counter add-on |
11 | 11 | */ |
12 | 12 | // Execute if called_position is before_display_content |
13 | -if($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler()) |
|
13 | +if ($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler()) |
|
14 | 14 | { |
15 | 15 | $oCounterController = getController('counter'); |
16 | 16 | $oCounterController->counterExecute(); |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file point.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | // Stop if non-logged-in user is |
17 | 17 | $logged_info = Context::get('logged_info'); |
18 | -if(!$logged_info|| isCrawler()) |
|
18 | +if (!$logged_info || isCrawler()) |
|
19 | 19 | { |
20 | 20 | return; |
21 | 21 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received |
25 | 25 | * */ |
26 | -if($this->module != 'member' && $called_position == 'before_module_init') |
|
26 | +if ($this->module != 'member' && $called_position == 'before_module_init') |
|
27 | 27 | { |
28 | 28 | // Load a language file from the communication module |
29 | 29 | Context::loadLang(_XE_PATH_ . 'modules/communication/lang'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); |
34 | 34 | |
35 | 35 | $flag_file = _XE_PATH_ . 'files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl; |
36 | - if($addon_info->use_alarm != 'N' && file_exists($flag_file)) |
|
36 | + if ($addon_info->use_alarm != 'N' && file_exists($flag_file)) |
|
37 | 37 | { |
38 | 38 | // Pop-up to display messages if a flag on new message is set |
39 | 39 | $new_message_count = (int) trim(FileHandler::readFile($flag_file)); |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"); |
46 | 46 | } |
47 | 47 | } |
48 | -elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
48 | +elseif ($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
49 | 49 | { |
50 | 50 | $member_srl = Context::get('target_srl'); |
51 | 51 | $oCommunicationModel = getModel('communication'); |
52 | 52 | |
53 | 53 | // Add a feature to display own message box. |
54 | - if($logged_info->member_srl == $member_srl) |
|
54 | + if ($logged_info->member_srl == $member_srl) |
|
55 | 55 | { |
56 | 56 | $mid = Context::get('cur_mid'); |
57 | 57 | $oMemberController = getController('member'); |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | // Get member information |
67 | 67 | $oMemberModel = getModel('member'); |
68 | 68 | $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
69 | - if(!$target_member_info->member_srl) |
|
69 | + if (!$target_member_info->member_srl) |
|
70 | 70 | { |
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | 74 | $oMemberController = getController('member'); |
75 | 75 | // Add a menu for sending message |
76 | - if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
76 | + if ($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
77 | 77 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
78 | 78 | // Add a menu for listing friends (if a friend is new) |
79 | - if(!$oCommunicationModel->isAddedFriend($member_srl)) |
|
79 | + if (!$oCommunicationModel->isAddedFriend($member_srl)) |
|
80 | 80 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
81 | 81 | } |
82 | 82 | } |
@@ -1,8 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file member_communication.addon.php |
@@ -44,8 +45,7 @@ discard block |
||
44 | 45 | $text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); |
45 | 46 | Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"); |
46 | 47 | } |
47 | -} |
|
48 | -elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
48 | +} elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
49 | 49 | { |
50 | 50 | $member_srl = Context::get('target_srl'); |
51 | 51 | $oCommunicationModel = getModel('communication'); |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | // Display a list of friends |
61 | 61 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); |
62 | 62 | // If not, Add menus to send message and to add friends |
63 | - } |
|
64 | - else |
|
63 | + } else |
|
65 | 64 | { |
66 | 65 | // Get member information |
67 | 66 | $oMemberModel = getModel('member'); |
@@ -73,11 +72,13 @@ discard block |
||
73 | 72 | |
74 | 73 | $oMemberController = getController('member'); |
75 | 74 | // Add a menu for sending message |
76 | - if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
77 | - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
|
75 | + if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) { |
|
76 | + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
|
77 | + } |
|
78 | 78 | // Add a menu for listing friends (if a friend is new) |
79 | - if(!$oCommunicationModel->isAddedFriend($member_srl)) |
|
80 | - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
|
79 | + if(!$oCommunicationModel->isAddedFriend($member_srl)) { |
|
80 | + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
|
81 | + } |
|
81 | 82 | } |
82 | 83 | } |
83 | 84 | /* End of file member_communication.addon.php */ |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | { |
9 | 9 | // If member_srl < 0, then return text only in the body |
10 | 10 | $member_srl = $matches[3]; |
11 | - if($member_srl < 0) |
|
11 | + if ($member_srl < 0) |
|
12 | 12 | { |
13 | 13 | return $matches[5]; |
14 | 14 | } |
15 | 15 | // If member_srl=o(not a member), return the entire body |
16 | - if(!$member_srl) |
|
16 | + if (!$member_srl) |
|
17 | 17 | { |
18 | 18 | return $matches[0]; |
19 | 19 | } |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | |
24 | 24 | $_tmp = &$GLOBALS['_transImageNameList'][$member_srl]; |
25 | 25 | // If pre-defined data in the global variablesm return it |
26 | - if(!$_tmp->cached) |
|
26 | + if (!$_tmp->cached) |
|
27 | 27 | { |
28 | 28 | $_tmp->cached = true; |
29 | 29 | $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
30 | 30 | $image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
31 | 31 | |
32 | - if(file_exists(_XE_PATH_ . $image_name_file)) |
|
32 | + if (file_exists(_XE_PATH_ . $image_name_file)) |
|
33 | 33 | { |
34 | 34 | $_tmp->image_name_file = $image_name_file; |
35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $image_name_file = ''; |
39 | 39 | } |
40 | 40 | |
41 | - if(file_exists(_XE_PATH_ . $image_mark_file)) |
|
41 | + if (file_exists(_XE_PATH_ . $image_mark_file)) |
|
42 | 42 | { |
43 | 43 | $_tmp->image_mark_file = $image_mark_file; |
44 | 44 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | // If image name and mark doesn't exist, set the original information |
62 | - if(!$image_name_file && !$image_mark_file && !$group_image) |
|
62 | + if (!$image_name_file && !$image_mark_file && !$group_image) |
|
63 | 63 | { |
64 | 64 | return $matches[0]; |
65 | 65 | } |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | |
69 | 69 | $config = $oMemberModel->getMemberConfig(); |
70 | 70 | |
71 | - if($config->image_name == 'Y' && $image_name_file) |
|
71 | + if ($config->image_name == 'Y' && $image_name_file) |
|
72 | 72 | { |
73 | 73 | $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id: %s" style="border:0;vertical-align:middle;margin-right:3px" />', Context::getRequestUri(), $image_name_file, strip_tags($nick_name), strip_tags($nick_name)); |
74 | 74 | } |
75 | - if($config->image_mark == 'Y' && $image_mark_file) |
|
75 | + if ($config->image_mark == 'Y' && $image_mark_file) |
|
76 | 76 | { |
77 | 77 | $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id : %s" style="border:0;vertical-align:middle;margin-right:3px"/>%s', Context::getRequestUri(), $image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name); |
78 | 78 | } |
79 | 79 | |
80 | - if($group_image) |
|
80 | + if ($group_image) |
|
81 | 81 | { |
82 | 82 | $nick_name = sprintf('<img src="%s" style="border:0;max-height:16px;vertical-align:middle;margin-right:3px" alt="%s" title="%s" />%s', $group_image->src, $group_image->title, $group_image->description, $nick_name); |
83 | 83 | } |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | if(file_exists(_XE_PATH_ . $image_name_file)) |
33 | 33 | { |
34 | 34 | $_tmp->image_name_file = $image_name_file; |
35 | - } |
|
36 | - else |
|
35 | + } else |
|
37 | 36 | { |
38 | 37 | $image_name_file = ''; |
39 | 38 | } |
@@ -41,8 +40,7 @@ discard block |
||
41 | 40 | if(file_exists(_XE_PATH_ . $image_mark_file)) |
42 | 41 | { |
43 | 42 | $_tmp->image_mark_file = $image_mark_file; |
44 | - } |
|
45 | - else |
|
43 | + } else |
|
46 | 44 | { |
47 | 45 | $image_mark_file = ''; |
48 | 46 | } |
@@ -50,8 +48,7 @@ discard block |
||
50 | 48 | $site_module_info = Context::get('site_module_info'); |
51 | 49 | $group_image = $oMemberModel->getGroupImageMark($member_srl, $site_module_info->site_srl); |
52 | 50 | $_tmp->group_image = $group_image; |
53 | - } |
|
54 | - else |
|
51 | + } else |
|
55 | 52 | { |
56 | 53 | $group_image = $_tmp->group_image; |
57 | 54 | $image_name_file = $_tmp->image_name_file; |