@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * constructor |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function XEHttpRequest($host, $port, $scheme='') |
|
44 | + function XEHttpRequest($host, $port, $scheme = '') |
|
45 | 45 | { |
46 | 46 | $this->m_host = $host; |
47 | 47 | $this->m_port = $port; |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $this->addToHeader('Connection', 'close'); |
77 | 77 | |
78 | 78 | $method = strtoupper($method); |
79 | - if(!$allow_methods) |
|
79 | + if (!$allow_methods) |
|
80 | 80 | { |
81 | 81 | $allow_methods = explode(' ', 'GET POST PUT'); |
82 | 82 | } |
83 | - if(!in_array($method, $allow_methods)) |
|
83 | + if (!in_array($method, $allow_methods)) |
|
84 | 84 | { |
85 | 85 | $method = $allow_methods[0]; |
86 | 86 | } |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | $timout = max((int) $timeout, 0); |
90 | 90 | |
91 | 91 | // list of post variables |
92 | - if(!is_array($post_vars)) |
|
92 | + if (!is_array($post_vars)) |
|
93 | 93 | { |
94 | 94 | $post_vars = array(); |
95 | 95 | } |
96 | 96 | |
97 | - if(FALSE && is_callable('curl_init')) |
|
97 | + if (FALSE && is_callable('curl_init')) |
|
98 | 98 | { |
99 | 99 | return $this->sendWithCurl($target, $method, $timeout, $post_vars); |
100 | 100 | } |
@@ -117,30 +117,30 @@ discard block |
||
117 | 117 | static $crlf = "\r\n"; |
118 | 118 | |
119 | 119 | $scheme = ''; |
120 | - if($this->m_scheme=='https') |
|
120 | + if ($this->m_scheme == 'https') |
|
121 | 121 | { |
122 | 122 | $scheme = 'ssl://'; |
123 | 123 | } |
124 | 124 | |
125 | - $sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout); |
|
126 | - if(!$sock) |
|
125 | + $sock = @fsockopen($scheme.$this->m_host, $this->m_port, $errno, $errstr, $timeout); |
|
126 | + if (!$sock) |
|
127 | 127 | { |
128 | 128 | return new BaseObject(-1, 'socket_connect_failed'); |
129 | 129 | } |
130 | 130 | |
131 | 131 | $headers = $this->m_headers + array(); |
132 | - if(!isset($headers['Accept-Encoding'])) |
|
132 | + if (!isset($headers['Accept-Encoding'])) |
|
133 | 133 | { |
134 | 134 | $headers['Accept-Encoding'] = 'identity'; |
135 | 135 | } |
136 | 136 | |
137 | 137 | // post body |
138 | 138 | $post_body = ''; |
139 | - if($method == 'POST' && count($post_vars)) |
|
139 | + if ($method == 'POST' && count($post_vars)) |
|
140 | 140 | { |
141 | - foreach($post_vars as $key => $value) |
|
141 | + foreach ($post_vars as $key => $value) |
|
142 | 142 | { |
143 | - $post_body .= urlencode($key) . '=' . urlencode($value) . '&'; |
|
143 | + $post_body .= urlencode($key).'='.urlencode($value).'&'; |
|
144 | 144 | } |
145 | 145 | $post_body = substr($post_body, 0, -1); |
146 | 146 | |
@@ -149,35 +149,35 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | $request = "$method $target HTTP/1.1$crlf"; |
152 | - foreach($headers as $equiv => $content) |
|
152 | + foreach ($headers as $equiv => $content) |
|
153 | 153 | { |
154 | 154 | $request .= "$equiv: $content$crlf"; |
155 | 155 | } |
156 | - $request .= $crlf . $post_body; |
|
156 | + $request .= $crlf.$post_body; |
|
157 | 157 | fwrite($sock, $request); |
158 | 158 | |
159 | 159 | list($httpver, $code, $status) = preg_split('/ +/', rtrim(fgets($sock)), 3); |
160 | 160 | |
161 | 161 | // read response headers |
162 | 162 | $is_chunked = FALSE; |
163 | - while(strlen(trim($line = fgets($sock)))) |
|
163 | + while (strlen(trim($line = fgets($sock)))) |
|
164 | 164 | { |
165 | 165 | list($equiv, $content) = preg_split('/ *: */', rtrim($line), 2); |
166 | - if(!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
166 | + if (!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
167 | 167 | { |
168 | 168 | $is_chunked = TRUE; |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | 172 | $body = ''; |
173 | - while(!feof($sock)) |
|
173 | + while (!feof($sock)) |
|
174 | 174 | { |
175 | - if($is_chunked) |
|
175 | + if ($is_chunked) |
|
176 | 176 | { |
177 | 177 | $chunk_size = hexdec(fgets($sock)); |
178 | - if($chunk_size) |
|
178 | + if ($chunk_size) |
|
179 | 179 | { |
180 | - $body .= fgets($sock, $chunk_size+1); |
|
180 | + $body .= fgets($sock, $chunk_size + 1); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | else |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
220 | 220 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
221 | 221 | |
222 | - switch($method) |
|
222 | + switch ($method) |
|
223 | 223 | { |
224 | 224 | case 'GET': curl_setopt($ch, CURLOPT_HTTPGET, true); |
225 | 225 | break; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | $arr_headers = array(); |
235 | - foreach($headers as $key => $value) |
|
235 | + foreach ($headers as $key => $value) |
|
236 | 236 | { |
237 | 237 | $arr_headers[] = "$key: $value"; |
238 | 238 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | curl_setopt($ch, CURLOPT_HTTPHEADER, $arr_headers); |
241 | 241 | |
242 | 242 | $body = curl_exec($ch); |
243 | - if(curl_errno($ch)) |
|
243 | + if (curl_errno($ch)) |
|
244 | 244 | { |
245 | 245 | return new BaseObject(-1, 'socket_connect_failed'); |
246 | 246 | } |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | |
74 | 74 | function getType() |
75 | 75 | { |
76 | - if(isset($this->type)) |
|
76 | + if (isset($this->type)) |
|
77 | 77 | { |
78 | 78 | return $this->type; |
79 | 79 | } |
80 | - if(is_string($this->value)) |
|
80 | + if (is_string($this->value)) |
|
81 | 81 | { |
82 | 82 | return 'column_name'; |
83 | 83 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | function getValue() |
104 | 104 | { |
105 | - if(!isset($this->_value)) |
|
105 | + if (!isset($this->_value)) |
|
106 | 106 | { |
107 | 107 | $value = $this->getEscapedValue(); |
108 | 108 | $this->_value = $this->toString($value); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | function getUnescapedValue() |
129 | 129 | { |
130 | - if($this->value === 'null') |
|
130 | + if ($this->value === 'null') |
|
131 | 131 | { |
132 | 132 | return null; |
133 | 133 | } |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | */ |
142 | 142 | function toString($value) |
143 | 143 | { |
144 | - if(is_array($value)) |
|
144 | + if (is_array($value)) |
|
145 | 145 | { |
146 | - if(count($value) === 0) |
|
146 | + if (count($value) === 0) |
|
147 | 147 | { |
148 | 148 | return ''; |
149 | 149 | } |
150 | - if(count($value) === 1 && $value[0] === '') |
|
150 | + if (count($value) === 1 && $value[0] === '') |
|
151 | 151 | { |
152 | 152 | return ''; |
153 | 153 | } |
154 | - return '(' . implode(',', $value) . ')'; |
|
154 | + return '('.implode(',', $value).')'; |
|
155 | 155 | } |
156 | 156 | return $value; |
157 | 157 | } |
@@ -164,42 +164,42 @@ discard block |
||
164 | 164 | function escapeValue($value) |
165 | 165 | { |
166 | 166 | $column_type = $this->getType(); |
167 | - if($column_type == 'column_name') |
|
167 | + if ($column_type == 'column_name') |
|
168 | 168 | { |
169 | 169 | $dbParser = DB::getParser(); |
170 | 170 | return $dbParser->parseExpression($value); |
171 | 171 | } |
172 | - if(!isset($value)) |
|
172 | + if (!isset($value)) |
|
173 | 173 | { |
174 | 174 | return null; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $columnTypeList = array('date' => 1, 'varchar' => 1, 'char' => 1, 'text' => 1, 'bigtext' => 1); |
178 | - if(isset($columnTypeList[$column_type])) |
|
178 | + if (isset($columnTypeList[$column_type])) |
|
179 | 179 | { |
180 | - if(!is_array($value)) |
|
180 | + if (!is_array($value)) |
|
181 | 181 | { |
182 | 182 | $value = $this->_escapeStringValue($value); |
183 | 183 | } |
184 | 184 | else |
185 | 185 | { |
186 | - foreach($value as $key=>$val) |
|
186 | + foreach ($value as $key=>$val) |
|
187 | 187 | { |
188 | 188 | $value[$key] = $this->_escapeStringValue($val); |
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
192 | - if($this->uses_default_value) |
|
192 | + if ($this->uses_default_value) |
|
193 | 193 | { |
194 | 194 | return $value; |
195 | 195 | } |
196 | - if($column_type == 'number') |
|
196 | + if ($column_type == 'number') |
|
197 | 197 | { |
198 | - if(is_array($value)) |
|
198 | + if (is_array($value)) |
|
199 | 199 | { |
200 | - foreach($value AS $key => $val) |
|
200 | + foreach ($value AS $key => $val) |
|
201 | 201 | { |
202 | - if(isset($val) && $val !== '') |
|
202 | + if (isset($val) && $val !== '') |
|
203 | 203 | { |
204 | 204 | $value[$key] = (int) $val; |
205 | 205 | } |
@@ -227,20 +227,20 @@ discard block |
||
227 | 227 | $value = preg_replace_callback($regex, array($this, 'utf8Replacer'), $value); |
228 | 228 | $db = DB::getInstance(); |
229 | 229 | $value = $db->addQuotes($value); |
230 | - return '\'' . $value . '\''; |
|
230 | + return '\''.$value.'\''; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | function utf8Replacer($captures) |
234 | 234 | { |
235 | - if(strlen($captures[1])) |
|
235 | + if (strlen($captures[1])) |
|
236 | 236 | { |
237 | 237 | // Valid byte sequence. Return unmodified. |
238 | 238 | return $captures[1]; |
239 | 239 | } |
240 | - else if(strlen($captures[2])) |
|
240 | + else if (strlen($captures[2])) |
|
241 | 241 | { |
242 | 242 | // Remove user defined area |
243 | - if("\xF3\xB0\x80\x80" <= $captures[2]) |
|
243 | + if ("\xF3\xB0\x80\x80" <= $captures[2]) |
|
244 | 244 | { |
245 | 245 | return; |
246 | 246 | } |
@@ -262,15 +262,15 @@ discard block |
||
262 | 262 | { |
263 | 263 | $type = $this->getType(); |
264 | 264 | $value = $this->getUnescapedValue(); |
265 | - if($type == 'column_name') |
|
265 | + if ($type == 'column_name') |
|
266 | 266 | { |
267 | 267 | return TRUE; |
268 | 268 | } |
269 | - if($type == 'number' && is_null($value)) |
|
269 | + if ($type == 'number' && is_null($value)) |
|
270 | 270 | { |
271 | 271 | return FALSE; |
272 | 272 | } |
273 | - if($type == 'number' && !is_numeric($value) && $this->uses_default_value) |
|
273 | + if ($type == 'number' && !is_numeric($value) && $this->uses_default_value) |
|
274 | 274 | { |
275 | 275 | return TRUE; |
276 | 276 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | function ensureDefaultValue($default_value) |
286 | 286 | { |
287 | - if($this->value === NULL || $this->value === '') |
|
287 | + if ($this->value === NULL || $this->value === '') |
|
288 | 288 | { |
289 | 289 | $this->value = $default_value; |
290 | 290 | $this->uses_default_value = TRUE; |
@@ -298,23 +298,23 @@ discard block |
||
298 | 298 | */ |
299 | 299 | function checkFilter($filter_type) |
300 | 300 | { |
301 | - if(isset($this->value) && $this->value != '') |
|
301 | + if (isset($this->value) && $this->value != '') |
|
302 | 302 | { |
303 | 303 | global $lang; |
304 | 304 | $val = $this->value; |
305 | 305 | $key = $this->name; |
306 | - switch($filter_type) |
|
306 | + switch ($filter_type) |
|
307 | 307 | { |
308 | 308 | case 'email' : |
309 | 309 | case 'email_address' : |
310 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/is', $val)) |
|
310 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/is', $val)) |
|
311 | 311 | { |
312 | 312 | $this->isValid = FALSE; |
313 | 313 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_email, $lang->{$key} ? $lang->{$key} : $key)); |
314 | 314 | } |
315 | 315 | break; |
316 | 316 | case 'homepage' : |
317 | - if(!preg_match('/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val)) |
|
317 | + if (!preg_match('/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val)) |
|
318 | 318 | { |
319 | 319 | $this->isValid = FALSE; |
320 | 320 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_homepage, $lang->{$key} ? $lang->{$key} : $key)); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | break; |
323 | 323 | case 'userid' : |
324 | 324 | case 'user_id' : |
325 | - if(!preg_match('/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val)) |
|
325 | + if (!preg_match('/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val)) |
|
326 | 326 | { |
327 | 327 | $this->isValid = FALSE; |
328 | 328 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_userid, $lang->{$key} ? $lang->{$key} : $key)); |
@@ -330,25 +330,25 @@ discard block |
||
330 | 330 | break; |
331 | 331 | case 'number' : |
332 | 332 | case 'numbers' : |
333 | - if(is_array($val)) |
|
333 | + if (is_array($val)) |
|
334 | 334 | { |
335 | 335 | $val = join(',', $val); |
336 | 336 | } |
337 | - if(!preg_match('/^(-?)[0-9]+(,\-?[0-9]+)*$/is', $val)) |
|
337 | + if (!preg_match('/^(-?)[0-9]+(,\-?[0-9]+)*$/is', $val)) |
|
338 | 338 | { |
339 | 339 | $this->isValid = FALSE; |
340 | 340 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_number, $lang->{$key} ? $lang->{$key} : $key)); |
341 | 341 | } |
342 | 342 | break; |
343 | 343 | case 'alpha' : |
344 | - if(!preg_match('/^[a-z]+$/is', $val)) |
|
344 | + if (!preg_match('/^[a-z]+$/is', $val)) |
|
345 | 345 | { |
346 | 346 | $this->isValid = FALSE; |
347 | 347 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_alpha, $lang->{$key} ? $lang->{$key} : $key)); |
348 | 348 | } |
349 | 349 | break; |
350 | 350 | case 'alpha_number' : |
351 | - if(!preg_match('/^[0-9a-z]+$/is', $val)) |
|
351 | + if (!preg_match('/^[0-9a-z]+$/is', $val)) |
|
352 | 352 | { |
353 | 353 | $this->isValid = FALSE; |
354 | 354 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_alpha_number, $lang->{$key} ? $lang->{$key} : $key)); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | function checkMaxLength($length) |
362 | 362 | { |
363 | - if($this->value && (strlen($this->value) > $length)) |
|
363 | + if ($this->value && (strlen($this->value) > $length)) |
|
364 | 364 | { |
365 | 365 | global $lang; |
366 | 366 | $this->isValid = FALSE; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | function checkMinLength($length) |
373 | 373 | { |
374 | - if($this->value && (strlen($this->value) < $length)) |
|
374 | + if ($this->value && (strlen($this->value) < $length)) |
|
375 | 375 | { |
376 | 376 | global $lang; |
377 | 377 | $this->isValid = FALSE; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | function checkNotNull() |
384 | 384 | { |
385 | - if(!isset($this->value)) |
|
385 | + if (!isset($this->value)) |
|
386 | 386 | { |
387 | 387 | global $lang; |
388 | 388 | $this->isValid = FALSE; |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $logged_info = Context::get('logged_info'); |
40 | 40 | |
41 | 41 | // Check permissions |
42 | - if(!$this->grant->access) return new BaseObject(-1,'msg_not_permitted'); |
|
42 | + if (!$this->grant->access) return new BaseObject(-1, 'msg_not_permitted'); |
|
43 | 43 | |
44 | 44 | $config = $oModuleModel->getModuleConfig('integration_search'); |
45 | - if(!$config) $config = new stdClass; |
|
46 | - if(!$config->skin) |
|
45 | + if (!$config) $config = new stdClass; |
|
46 | + if (!$config->skin) |
|
47 | 47 | { |
48 | 48 | $config->skin = 'default'; |
49 | 49 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | Context::set('module_info', $skin_vars); |
68 | 68 | |
69 | 69 | $target = $config->target; |
70 | - if(!$target) $target = 'include'; |
|
70 | + if (!$target) $target = 'include'; |
|
71 | 71 | |
72 | - if(empty($config->target_module_srl)) |
|
72 | + if (empty($config->target_module_srl)) |
|
73 | 73 | $module_srl_list = array(); |
74 | 74 | else |
75 | - $module_srl_list = explode(',',$config->target_module_srl); |
|
75 | + $module_srl_list = explode(',', $config->target_module_srl); |
|
76 | 76 | |
77 | 77 | // https://github.com/xpressengine/xe-core/issues/1522 |
78 | 78 | // 검색 대상을 지정하지 않았을 때 검색 제한 |
79 | - if($target === 'include' && !count($module_srl_list)) |
|
79 | + if ($target === 'include' && !count($module_srl_list)) |
|
80 | 80 | { |
81 | 81 | $oMessageObject = ModuleHandler::getModuleInstance('message'); |
82 | 82 | $oMessageObject->setError(-1); |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | // Set a variable for search keyword |
91 | 91 | $is_keyword = Context::get('is_keyword'); |
92 | 92 | // Set page variables |
93 | - $page = (int)Context::get('page'); |
|
94 | - if(!$page) $page = 1; |
|
93 | + $page = (int) Context::get('page'); |
|
94 | + if (!$page) $page = 1; |
|
95 | 95 | // Search by search tab |
96 | 96 | $where = Context::get('where'); |
97 | 97 | // Create integration search model object |
98 | - if($is_keyword) |
|
98 | + if ($is_keyword) |
|
99 | 99 | { |
100 | 100 | $oIS = getModel('integration_search'); |
101 | - switch($where) |
|
101 | + switch ($where) |
|
102 | 102 | { |
103 | 103 | case 'document' : |
104 | 104 | $search_target = Context::get('search_target'); |
105 | - if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title'; |
|
105 | + if (!in_array($search_target, array('title', 'content', 'title_content', 'tag'))) $search_target = 'title'; |
|
106 | 106 | Context::set('search_target', $search_target); |
107 | 107 | |
108 | 108 | $output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | break; |
117 | 117 | case 'trackback' : |
118 | 118 | $search_target = Context::get('search_target'); |
119 | - if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title'; |
|
119 | + if (!in_array($search_target, array('title', 'url', 'blog_name', 'excerpt'))) $search_target = 'title'; |
|
120 | 120 | Context::set('search_target', $search_target); |
121 | 121 | |
122 | 122 | $output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->setTemplateFile("trackback", $page); |
125 | 125 | break; |
126 | 126 | case 'multimedia' : |
127 | - $output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page,20); |
|
127 | + $output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 20); |
|
128 | 128 | Context::set('output', $output); |
129 | 129 | $this->setTemplateFile("multimedia", $page); |
130 | 130 | break; |
@@ -39,24 +39,26 @@ discard block |
||
39 | 39 | $logged_info = Context::get('logged_info'); |
40 | 40 | |
41 | 41 | // Check permissions |
42 | - if(!$this->grant->access) return new BaseObject(-1,'msg_not_permitted'); |
|
42 | + if(!$this->grant->access) { |
|
43 | + return new BaseObject(-1,'msg_not_permitted'); |
|
44 | + } |
|
43 | 45 | |
44 | 46 | $config = $oModuleModel->getModuleConfig('integration_search'); |
45 | - if(!$config) $config = new stdClass; |
|
47 | + if(!$config) { |
|
48 | + $config = new stdClass; |
|
49 | + } |
|
46 | 50 | if(!$config->skin) |
47 | 51 | { |
48 | 52 | $config->skin = 'default'; |
49 | 53 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
50 | - } |
|
51 | - else |
|
54 | + } else |
|
52 | 55 | { |
53 | 56 | //check theme |
54 | 57 | $config_parse = explode('|@|', $config->skin); |
55 | 58 | if (count($config_parse) > 1) |
56 | 59 | { |
57 | 60 | $template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]); |
58 | - } |
|
59 | - else |
|
61 | + } else |
|
60 | 62 | { |
61 | 63 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
62 | 64 | } |
@@ -67,12 +69,15 @@ discard block |
||
67 | 69 | Context::set('module_info', $skin_vars); |
68 | 70 | |
69 | 71 | $target = $config->target; |
70 | - if(!$target) $target = 'include'; |
|
72 | + if(!$target) { |
|
73 | + $target = 'include'; |
|
74 | + } |
|
71 | 75 | |
72 | - if(empty($config->target_module_srl)) |
|
73 | - $module_srl_list = array(); |
|
74 | - else |
|
75 | - $module_srl_list = explode(',',$config->target_module_srl); |
|
76 | + if(empty($config->target_module_srl)) { |
|
77 | + $module_srl_list = array(); |
|
78 | + } else { |
|
79 | + $module_srl_list = explode(',',$config->target_module_srl); |
|
80 | + } |
|
76 | 81 | |
77 | 82 | // https://github.com/xpressengine/xe-core/issues/1522 |
78 | 83 | // 검색 대상을 지정하지 않았을 때 검색 제한 |
@@ -91,7 +96,9 @@ discard block |
||
91 | 96 | $is_keyword = Context::get('is_keyword'); |
92 | 97 | // Set page variables |
93 | 98 | $page = (int)Context::get('page'); |
94 | - if(!$page) $page = 1; |
|
99 | + if(!$page) { |
|
100 | + $page = 1; |
|
101 | + } |
|
95 | 102 | // Search by search tab |
96 | 103 | $where = Context::get('where'); |
97 | 104 | // Create integration search model object |
@@ -102,7 +109,9 @@ discard block |
||
102 | 109 | { |
103 | 110 | case 'document' : |
104 | 111 | $search_target = Context::get('search_target'); |
105 | - if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title'; |
|
112 | + if(!in_array($search_target, array('title','content','title_content','tag'))) { |
|
113 | + $search_target = 'title'; |
|
114 | + } |
|
106 | 115 | Context::set('search_target', $search_target); |
107 | 116 | |
108 | 117 | $output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10); |
@@ -116,7 +125,9 @@ discard block |
||
116 | 125 | break; |
117 | 126 | case 'trackback' : |
118 | 127 | $search_target = Context::get('search_target'); |
119 | - if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title'; |
|
128 | + if(!in_array($search_target, array('title','url','blog_name','excerpt'))) { |
|
129 | + $search_target = 'title'; |
|
130 | + } |
|
120 | 131 | Context::set('search_target', $search_target); |
121 | 132 | |
122 | 133 | $output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10); |
@@ -144,8 +155,7 @@ discard block |
||
144 | 155 | $this->setTemplateFile("index", $page); |
145 | 156 | break; |
146 | 157 | } |
147 | - } |
|
148 | - else |
|
158 | + } else |
|
149 | 159 | { |
150 | 160 | $this->setTemplateFile("no_keywords"); |
151 | 161 | } |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return BaseObject output document list |
30 | 30 | */ |
31 | - function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20) |
|
31 | + function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page = 1, $list_count = 20) |
|
32 | 32 | { |
33 | - if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list); |
|
33 | + if (is_array($module_srls_list)) $module_srls_list = implode(',', $module_srls_list); |
|
34 | 34 | |
35 | 35 | $args = new stdClass(); |
36 | - if($target == 'exclude') |
|
36 | + if ($target == 'exclude') |
|
37 | 37 | { |
38 | 38 | $module_srls_list .= ',0'; // exclude 'trash' |
39 | 39 | if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $args->sort_index = 'list_order'; |
54 | 54 | $args->order_type = 'asc'; |
55 | 55 | $args->statusList = array('PUBLIC'); |
56 | - if(!$args->module_srl) unset($args->module_srl); |
|
56 | + if (!$args->module_srl) unset($args->module_srl); |
|
57 | 57 | // Get a list of documents |
58 | 58 | $oDocumentModel = getModel('document'); |
59 | 59 | |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return BaseObject output comment list |
73 | 73 | */ |
74 | - function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) |
|
74 | + function getComments($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20) |
|
75 | 75 | { |
76 | 76 | $args = new stdClass(); |
77 | 77 | |
78 | - if(is_array($module_srls_list)) |
|
78 | + if (is_array($module_srls_list)) |
|
79 | 79 | { |
80 | - if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list); |
|
80 | + if (count($module_srls_list) > 0) $module_srls = implode(',', $module_srls_list); |
|
81 | 81 | } |
82 | 82 | else |
83 | 83 | { |
84 | - if($module_srls_list) |
|
84 | + if ($module_srls_list) |
|
85 | 85 | { |
86 | 86 | $module_srls = $module_srls_list; |
87 | 87 | } |
88 | 88 | } |
89 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
89 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
90 | 90 | else $args->module_srl = $module_srls; |
91 | 91 | |
92 | 92 | $args->page = $page; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // Get a list of documents |
100 | 100 | $oCommentModel = getModel('comment'); |
101 | 101 | $output = $oCommentModel->getTotalCommentList($args); |
102 | - if(!$output->toBool()|| !$output->data) return $output; |
|
102 | + if (!$output->toBool() || !$output->data) return $output; |
|
103 | 103 | return $output; |
104 | 104 | } |
105 | 105 | |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return BaseObject output trackback list |
117 | 117 | */ |
118 | - function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20) |
|
118 | + function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page = 1, $list_count = 20) |
|
119 | 119 | { |
120 | 120 | $oTrackbackModel = getAdminModel('trackback'); |
121 | - if(!$oTrackbackModel) return new BaseObject(); |
|
121 | + if (!$oTrackbackModel) return new BaseObject(); |
|
122 | 122 | $args = new stdClass(); |
123 | 123 | |
124 | - if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); |
|
124 | + if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list); |
|
125 | 125 | else $module_srls = $module_srls_list; |
126 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
126 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
127 | 127 | else $args->module_srl = $module_srls; |
128 | 128 | $args->page = $page; |
129 | 129 | $args->list_count = $list_count; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $args->order_type = 'asc'; |
135 | 135 | // Get a list of documents |
136 | 136 | $output = $oTrackbackModel->getTotalTrackbackList($args); |
137 | - if(!$output->toBool()|| !$output->data) return $output; |
|
137 | + if (!$output->toBool() || !$output->data) return $output; |
|
138 | 138 | return $output; |
139 | 139 | } |
140 | 140 | |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | { |
155 | 155 | $args = new stdClass(); |
156 | 156 | |
157 | - if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); |
|
157 | + if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list); |
|
158 | 158 | else $module_srls = $module_srls_list; |
159 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
159 | + if ($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
160 | 160 | else $args->module_srl = $module_srls; |
161 | 161 | $args->page = $page; |
162 | 162 | $args->list_count = $list_count; |
@@ -166,32 +166,32 @@ discard block |
||
166 | 166 | $args->sort_index = 'files.file_srl'; |
167 | 167 | $args->order_type = 'desc'; |
168 | 168 | $args->isvalid = 'Y'; |
169 | - $args->direct_download = $direct_download=='Y'?'Y':'N'; |
|
169 | + $args->direct_download = $direct_download == 'Y' ? 'Y' : 'N'; |
|
170 | 170 | // Get a list of documents |
171 | 171 | $oFileAdminModel = getAdminModel('file'); |
172 | 172 | $output = $oFileAdminModel->getFileList($args); |
173 | - if(!$output->toBool() || !$output->data) return $output; |
|
173 | + if (!$output->toBool() || !$output->data) return $output; |
|
174 | 174 | |
175 | 175 | $list = array(); |
176 | - foreach($output->data as $key => $val) |
|
176 | + foreach ($output->data as $key => $val) |
|
177 | 177 | { |
178 | 178 | $obj = new stdClass; |
179 | 179 | $obj->filename = $val->source_filename; |
180 | 180 | $obj->download_count = $val->download_count; |
181 | - if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2); |
|
181 | + if (substr($val->download_url, 0, 2) == './') $val->download_url = substr($val->download_url, 2); |
|
182 | 182 | $obj->download_url = Context::getRequestUri().$val->download_url; |
183 | 183 | $obj->target_srl = $val->upload_target_srl; |
184 | 184 | $obj->file_size = $val->file_size; |
185 | 185 | // Images |
186 | - if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) |
|
186 | + if (preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) |
|
187 | 187 | { |
188 | 188 | $obj->type = 'image'; |
189 | 189 | |
190 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3)); |
|
191 | - if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path); |
|
190 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($val->file_srl, 3)); |
|
191 | + if (!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path); |
|
192 | 192 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop'); |
193 | 193 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
194 | - if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); |
|
194 | + if (!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); |
|
195 | 195 | $obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120); |
196 | 196 | } |
197 | 197 | else |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | |
208 | 208 | $oDocumentModel = getModel('document'); |
209 | 209 | $document_list = $oDocumentModel->getDocuments($target_list); |
210 | - if($document_list) foreach($document_list as $key => $val) |
|
210 | + if ($document_list) foreach ($document_list as $key => $val) |
|
211 | 211 | { |
212 | - foreach($output->data as $k => $v) |
|
212 | + foreach ($output->data as $k => $v) |
|
213 | 213 | { |
214 | - if($v->target_srl== $val->document_srl) |
|
214 | + if ($v->target_srl == $val->document_srl) |
|
215 | 215 | { |
216 | 216 | $output->data[$k]->url = $val->getPermanentUrl(); |
217 | 217 | $output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | |
223 | 223 | $oCommentModel = getModel('comment'); |
224 | 224 | $comment_list = $oCommentModel->getComments($target_list); |
225 | - if($comment_list) foreach($comment_list as $key => $val) |
|
225 | + if ($comment_list) foreach ($comment_list as $key => $val) |
|
226 | 226 | { |
227 | - foreach($output->data as $k => $v) |
|
227 | + foreach ($output->data as $k => $v) |
|
228 | 228 | { |
229 | - if($v->target_srl== $val->comment_srl) |
|
229 | + if ($v->target_srl == $val->comment_srl) |
|
230 | 230 | { |
231 | 231 | $output->data[$k]->url = $val->getPermanentUrl(); |
232 | 232 | $output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return BaseObject |
251 | 251 | */ |
252 | - function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) |
|
252 | + function getImages($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20) |
|
253 | 253 | { |
254 | 254 | return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count); |
255 | 255 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return BaseObject |
267 | 267 | */ |
268 | - function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) |
|
268 | + function getFiles($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20) |
|
269 | 269 | { |
270 | 270 | return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N'); |
271 | 271 | } |
@@ -30,16 +30,19 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20) |
32 | 32 | { |
33 | - if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list); |
|
33 | + if(is_array($module_srls_list)) { |
|
34 | + $module_srls_list = implode(',',$module_srls_list); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | $args = new stdClass(); |
36 | 38 | if($target == 'exclude') |
37 | 39 | { |
38 | 40 | $module_srls_list .= ',0'; // exclude 'trash' |
39 | - if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1); |
|
41 | + if ($module_srls_list{0} == ',') { |
|
42 | + $module_srls_list = substr($module_srls_list, 1); |
|
43 | + } |
|
40 | 44 | $args->exclude_module_srl = $module_srls_list; |
41 | - } |
|
42 | - else |
|
45 | + } else |
|
43 | 46 | { |
44 | 47 | $args->module_srl = $module_srls_list; |
45 | 48 | $args->exclude_module_srl = '0'; // exclude 'trash' |
@@ -53,7 +56,9 @@ discard block |
||
53 | 56 | $args->sort_index = 'list_order'; |
54 | 57 | $args->order_type = 'asc'; |
55 | 58 | $args->statusList = array('PUBLIC'); |
56 | - if(!$args->module_srl) unset($args->module_srl); |
|
59 | + if(!$args->module_srl) { |
|
60 | + unset($args->module_srl); |
|
61 | + } |
|
57 | 62 | // Get a list of documents |
58 | 63 | $oDocumentModel = getModel('document'); |
59 | 64 | |
@@ -77,17 +82,21 @@ discard block |
||
77 | 82 | |
78 | 83 | if(is_array($module_srls_list)) |
79 | 84 | { |
80 | - if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list); |
|
81 | - } |
|
82 | - else |
|
85 | + if (count($module_srls_list) > 0) { |
|
86 | + $module_srls = implode(',',$module_srls_list); |
|
87 | + } |
|
88 | + } else |
|
83 | 89 | { |
84 | 90 | if($module_srls_list) |
85 | 91 | { |
86 | 92 | $module_srls = $module_srls_list; |
87 | 93 | } |
88 | 94 | } |
89 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
90 | - else $args->module_srl = $module_srls; |
|
95 | + if($target == 'exclude') { |
|
96 | + $args->exclude_module_srl = $module_srls; |
|
97 | + } else { |
|
98 | + $args->module_srl = $module_srls; |
|
99 | + } |
|
91 | 100 | |
92 | 101 | $args->page = $page; |
93 | 102 | $args->list_count = $list_count; |
@@ -99,7 +108,9 @@ discard block |
||
99 | 108 | // Get a list of documents |
100 | 109 | $oCommentModel = getModel('comment'); |
101 | 110 | $output = $oCommentModel->getTotalCommentList($args); |
102 | - if(!$output->toBool()|| !$output->data) return $output; |
|
111 | + if(!$output->toBool()|| !$output->data) { |
|
112 | + return $output; |
|
113 | + } |
|
103 | 114 | return $output; |
104 | 115 | } |
105 | 116 | |
@@ -118,13 +129,21 @@ discard block |
||
118 | 129 | function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20) |
119 | 130 | { |
120 | 131 | $oTrackbackModel = getAdminModel('trackback'); |
121 | - if(!$oTrackbackModel) return new BaseObject(); |
|
132 | + if(!$oTrackbackModel) { |
|
133 | + return new BaseObject(); |
|
134 | + } |
|
122 | 135 | $args = new stdClass(); |
123 | 136 | |
124 | - if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); |
|
125 | - else $module_srls = $module_srls_list; |
|
126 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
127 | - else $args->module_srl = $module_srls; |
|
137 | + if(is_array($module_srls_list)) { |
|
138 | + $module_srls = implode(',',$module_srls_list); |
|
139 | + } else { |
|
140 | + $module_srls = $module_srls_list; |
|
141 | + } |
|
142 | + if($target == 'exclude') { |
|
143 | + $args->exclude_module_srl = $module_srls; |
|
144 | + } else { |
|
145 | + $args->module_srl = $module_srls; |
|
146 | + } |
|
128 | 147 | $args->page = $page; |
129 | 148 | $args->list_count = $list_count; |
130 | 149 | $args->page_count = 10; |
@@ -134,7 +153,9 @@ discard block |
||
134 | 153 | $args->order_type = 'asc'; |
135 | 154 | // Get a list of documents |
136 | 155 | $output = $oTrackbackModel->getTotalTrackbackList($args); |
137 | - if(!$output->toBool()|| !$output->data) return $output; |
|
156 | + if(!$output->toBool()|| !$output->data) { |
|
157 | + return $output; |
|
158 | + } |
|
138 | 159 | return $output; |
139 | 160 | } |
140 | 161 | |
@@ -154,10 +175,16 @@ discard block |
||
154 | 175 | { |
155 | 176 | $args = new stdClass(); |
156 | 177 | |
157 | - if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); |
|
158 | - else $module_srls = $module_srls_list; |
|
159 | - if($target == 'exclude') $args->exclude_module_srl = $module_srls; |
|
160 | - else $args->module_srl = $module_srls; |
|
178 | + if(is_array($module_srls_list)) { |
|
179 | + $module_srls = implode(',',$module_srls_list); |
|
180 | + } else { |
|
181 | + $module_srls = $module_srls_list; |
|
182 | + } |
|
183 | + if($target == 'exclude') { |
|
184 | + $args->exclude_module_srl = $module_srls; |
|
185 | + } else { |
|
186 | + $args->module_srl = $module_srls; |
|
187 | + } |
|
161 | 188 | $args->page = $page; |
162 | 189 | $args->list_count = $list_count; |
163 | 190 | $args->page_count = 10; |
@@ -170,7 +197,9 @@ discard block |
||
170 | 197 | // Get a list of documents |
171 | 198 | $oFileAdminModel = getAdminModel('file'); |
172 | 199 | $output = $oFileAdminModel->getFileList($args); |
173 | - if(!$output->toBool() || !$output->data) return $output; |
|
200 | + if(!$output->toBool() || !$output->data) { |
|
201 | + return $output; |
|
202 | + } |
|
174 | 203 | |
175 | 204 | $list = array(); |
176 | 205 | foreach($output->data as $key => $val) |
@@ -178,7 +207,9 @@ discard block |
||
178 | 207 | $obj = new stdClass; |
179 | 208 | $obj->filename = $val->source_filename; |
180 | 209 | $obj->download_count = $val->download_count; |
181 | - if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2); |
|
210 | + if(substr($val->download_url,0,2)=='./') { |
|
211 | + $val->download_url = substr($val->download_url,2); |
|
212 | + } |
|
182 | 213 | $obj->download_url = Context::getRequestUri().$val->download_url; |
183 | 214 | $obj->target_srl = $val->upload_target_srl; |
184 | 215 | $obj->file_size = $val->file_size; |
@@ -188,13 +219,16 @@ discard block |
||
188 | 219 | $obj->type = 'image'; |
189 | 220 | |
190 | 221 | $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3)); |
191 | - if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path); |
|
222 | + if(!is_dir($thumbnail_path)) { |
|
223 | + FileHandler::makeDir($thumbnail_path); |
|
224 | + } |
|
192 | 225 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop'); |
193 | 226 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
194 | - if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); |
|
227 | + if(!file_exists($thumbnail_file)) { |
|
228 | + FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); |
|
229 | + } |
|
195 | 230 | $obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120); |
196 | - } |
|
197 | - else |
|
231 | + } else |
|
198 | 232 | { |
199 | 233 | $obj->type = 'binary'; |
200 | 234 | $obj->src = ''; |
@@ -207,13 +241,15 @@ discard block |
||
207 | 241 | |
208 | 242 | $oDocumentModel = getModel('document'); |
209 | 243 | $document_list = $oDocumentModel->getDocuments($target_list); |
210 | - if($document_list) foreach($document_list as $key => $val) |
|
244 | + if($document_list) { |
|
245 | + foreach($document_list as $key => $val) |
|
211 | 246 | { |
212 | 247 | foreach($output->data as $k => $v) |
213 | 248 | { |
214 | 249 | if($v->target_srl== $val->document_srl) |
215 | 250 | { |
216 | 251 | $output->data[$k]->url = $val->getPermanentUrl(); |
252 | + } |
|
217 | 253 | $output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); |
218 | 254 | $output->data[$k]->nick_name = $val->getNickName(); |
219 | 255 | } |
@@ -222,13 +258,15 @@ discard block |
||
222 | 258 | |
223 | 259 | $oCommentModel = getModel('comment'); |
224 | 260 | $comment_list = $oCommentModel->getComments($target_list); |
225 | - if($comment_list) foreach($comment_list as $key => $val) |
|
261 | + if($comment_list) { |
|
262 | + foreach($comment_list as $key => $val) |
|
226 | 263 | { |
227 | 264 | foreach($output->data as $k => $v) |
228 | 265 | { |
229 | 266 | if($v->target_srl== $val->comment_srl) |
230 | 267 | { |
231 | 268 | $output->data[$k]->url = $val->getPermanentUrl(); |
269 | + } |
|
232 | 270 | $output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i"); |
233 | 271 | $output->data[$k]->nick_name = $val->getNickName(); |
234 | 272 | } |
@@ -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_ . 'libs/ftp.class.php'); |
|
4 | +require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Module installer |
@@ -78,17 +78,17 @@ discard block |
||
78 | 78 | { |
79 | 79 | $oModel = getModel('autoinstall'); |
80 | 80 | $type = $oModel->getTypeFromPath($this->package->path); |
81 | - if($type == "module") |
|
81 | + if ($type == "module") |
|
82 | 82 | { |
83 | 83 | $output = $this->uninstallModule(); |
84 | - if(!$output->toBool()) |
|
84 | + if (!$output->toBool()) |
|
85 | 85 | { |
86 | 86 | return $output; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | 90 | $output = $this->_connect(); |
91 | - if(!$output->toBool()) |
|
91 | + if (!$output->toBool()) |
|
92 | 92 | { |
93 | 93 | return $output; |
94 | 94 | } |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | */ |
117 | 117 | function _download() |
118 | 118 | { |
119 | - if($this->package->path == ".") |
|
119 | + if ($this->package->path == ".") |
|
120 | 120 | { |
121 | - $this->download_file = $this->temp_dir . "xe.tar"; |
|
121 | + $this->download_file = $this->temp_dir."xe.tar"; |
|
122 | 122 | $this->target_path = ""; |
123 | 123 | $this->download_path = $this->temp_dir; |
124 | 124 | } |
125 | 125 | else |
126 | 126 | { |
127 | 127 | $subpath = trim(substr($this->package->path, 2), '/'); |
128 | - $this->download_file = $this->temp_dir . $subpath . ".tar"; |
|
128 | + $this->download_file = $this->temp_dir.$subpath.".tar"; |
|
129 | 129 | $subpatharr = explode("/", $subpath); |
130 | 130 | array_pop($subpatharr); |
131 | - $this->download_path = $this->temp_dir . implode("/", $subpatharr); |
|
131 | + $this->download_path = $this->temp_dir.implode("/", $subpatharr); |
|
132 | 132 | $this->target_path = implode("/", $subpatharr); |
133 | 133 | } |
134 | 134 | |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | $path_array = explode("/", $this->package->path); |
153 | 153 | $target_name = array_pop($path_array); |
154 | 154 | $oModule = getModule($target_name, "class"); |
155 | - if(!$oModule) |
|
155 | + if (!$oModule) |
|
156 | 156 | { |
157 | 157 | return new BaseObject(-1, 'msg_invalid_request'); |
158 | 158 | } |
159 | - if(!method_exists($oModule, "moduleUninstall")) |
|
159 | + if (!method_exists($oModule, "moduleUninstall")) |
|
160 | 160 | { |
161 | 161 | return new BaseObject(-1, 'msg_invalid_request'); |
162 | 162 | } |
163 | 163 | |
164 | 164 | $output = $oModule->moduleUninstall(); |
165 | - if(is_subclass_of($output, 'BaseObject') && !$output->toBool()) |
|
165 | + if (is_subclass_of($output, 'BaseObject') && !$output->toBool()) |
|
166 | 166 | { |
167 | 167 | return $output; |
168 | 168 | } |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | $schema_dir = sprintf('%s/schemas/', $this->package->path); |
171 | 171 | $schema_files = FileHandler::readDir($schema_dir); |
172 | 172 | $oDB = DB::getInstance(); |
173 | - if(is_array($schema_files)) |
|
173 | + if (is_array($schema_files)) |
|
174 | 174 | { |
175 | - foreach($schema_files as $file) |
|
175 | + foreach ($schema_files as $file) |
|
176 | 176 | { |
177 | 177 | $filename_arr = explode(".", $file); |
178 | 178 | $filename = array_shift($filename_arr); |
@@ -192,26 +192,26 @@ discard block |
||
192 | 192 | function installModule() |
193 | 193 | { |
194 | 194 | $path = $this->package->path; |
195 | - if($path != ".") |
|
195 | + if ($path != ".") |
|
196 | 196 | { |
197 | 197 | $path_array = explode("/", $path); |
198 | 198 | $target_name = array_pop($path_array); |
199 | 199 | $type = substr(array_pop($path_array), 0, -1); |
200 | 200 | } |
201 | 201 | |
202 | - if($type == "module") |
|
202 | + if ($type == "module") |
|
203 | 203 | { |
204 | 204 | $oModuleModel = getModel('module'); |
205 | 205 | $oInstallController = getController('install'); |
206 | 206 | $module_path = ModuleHandler::getModulePath($target_name); |
207 | - if($oModuleModel->checkNeedInstall($target_name)) |
|
207 | + if ($oModuleModel->checkNeedInstall($target_name)) |
|
208 | 208 | { |
209 | 209 | $oInstallController->installModule($target_name, $module_path); |
210 | 210 | } |
211 | - if($oModuleModel->checkNeedUpdate($target_name)) |
|
211 | + if ($oModuleModel->checkNeedUpdate($target_name)) |
|
212 | 212 | { |
213 | 213 | $oModule = getModule($target_name, 'class'); |
214 | - if(method_exists($oModule, 'moduleUpdate')) |
|
214 | + if (method_exists($oModule, 'moduleUpdate')) |
|
215 | 215 | { |
216 | 216 | $oModule->moduleUpdate(); |
217 | 217 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $this->_download(); |
232 | 232 | $file_list = $this->_unPack(); |
233 | 233 | $output = $this->_copyDir($file_list); |
234 | - if(!$output->toBool()) |
|
234 | + if (!$output->toBool()) |
|
235 | 235 | { |
236 | 236 | FileHandler::removeDir($this->temp_dir); |
237 | 237 | return $output; |
@@ -249,18 +249,18 @@ discard block |
||
249 | 249 | */ |
250 | 250 | function _unPack() |
251 | 251 | { |
252 | - require_once(_XE_PATH_ . 'libs/tar.class.php'); |
|
252 | + require_once(_XE_PATH_.'libs/tar.class.php'); |
|
253 | 253 | |
254 | 254 | $oTar = new tar(); |
255 | 255 | $oTar->openTAR($this->download_file); |
256 | 256 | |
257 | 257 | $_files = $oTar->files; |
258 | 258 | $file_list = array(); |
259 | - if(is_array($_files)) |
|
259 | + if (is_array($_files)) |
|
260 | 260 | { |
261 | - foreach($_files as $key => $info) |
|
261 | + foreach ($_files as $key => $info) |
|
262 | 262 | { |
263 | - FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']); |
|
263 | + FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']); |
|
264 | 264 | $file_list[] = $info['name']; |
265 | 265 | } |
266 | 266 | } |
@@ -278,22 +278,22 @@ discard block |
||
278 | 278 | $real_path = FileHandler::getRealPath($path); |
279 | 279 | $oDir = dir($path); |
280 | 280 | $files = array(); |
281 | - while($file = $oDir->read()) |
|
281 | + while ($file = $oDir->read()) |
|
282 | 282 | { |
283 | - if($file == "." || $file == "..") |
|
283 | + if ($file == "." || $file == "..") |
|
284 | 284 | { |
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | $files[] = $file; |
288 | 288 | } |
289 | 289 | |
290 | - foreach($files as $file) |
|
290 | + foreach ($files as $file) |
|
291 | 291 | { |
292 | - $file_path = $path . "/" . $file; |
|
293 | - if(is_dir(FileHandler::getRealPath($file_path))) |
|
292 | + $file_path = $path."/".$file; |
|
293 | + if (is_dir(FileHandler::getRealPath($file_path))) |
|
294 | 294 | { |
295 | 295 | $output = $this->_removeDir($file_path); |
296 | - if(!$output->toBool()) |
|
296 | + if (!$output->toBool()) |
|
297 | 297 | { |
298 | 298 | return $output; |
299 | 299 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | else |
302 | 302 | { |
303 | 303 | $output = $this->_removeFile($file_path); |
304 | - if(!$output->toBool()) |
|
304 | + if (!$output->toBool()) |
|
305 | 305 | { |
306 | 306 | return $output; |
307 | 307 | } |
@@ -357,17 +357,17 @@ discard block |
||
357 | 357 | */ |
358 | 358 | function _connect() |
359 | 359 | { |
360 | - if(!function_exists('ssh2_connect')) |
|
360 | + if (!function_exists('ssh2_connect')) |
|
361 | 361 | { |
362 | 362 | return new BaseObject(-1, 'msg_sftp_not_supported'); |
363 | 363 | } |
364 | 364 | |
365 | - if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y') |
|
365 | + if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y') |
|
366 | 366 | { |
367 | 367 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
368 | 368 | } |
369 | 369 | |
370 | - if($this->ftp_info->ftp_host) |
|
370 | + if ($this->ftp_info->ftp_host) |
|
371 | 371 | { |
372 | 372 | $ftp_host = $this->ftp_info->ftp_host; |
373 | 373 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $ftp_host = "127.0.0.1"; |
377 | 377 | } |
378 | 378 | $this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port); |
379 | - if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password)) |
|
379 | + if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password)) |
|
380 | 380 | { |
381 | 381 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
382 | 382 | } |
@@ -403,13 +403,13 @@ discard block |
||
403 | 403 | */ |
404 | 404 | function _removeFile($path) |
405 | 405 | { |
406 | - if(substr($path, 0, 2) == "./") |
|
406 | + if (substr($path, 0, 2) == "./") |
|
407 | 407 | { |
408 | 408 | $path = substr($path, 2); |
409 | 409 | } |
410 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
410 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
411 | 411 | |
412 | - if(!@ssh2_sftp_unlink($this->sftp, $target_path)) |
|
412 | + if (!@ssh2_sftp_unlink($this->sftp, $target_path)) |
|
413 | 413 | { |
414 | 414 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
415 | 415 | } |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | */ |
425 | 425 | function _removeDir_real($path) |
426 | 426 | { |
427 | - if(substr($path, 0, 2) == "./") |
|
427 | + if (substr($path, 0, 2) == "./") |
|
428 | 428 | { |
429 | 429 | $path = substr($path, 2); |
430 | 430 | } |
431 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
431 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
432 | 432 | |
433 | - if(!@ssh2_sftp_rmdir($this->sftp, $target_path)) |
|
433 | + if (!@ssh2_sftp_rmdir($this->sftp, $target_path)) |
|
434 | 434 | { |
435 | 435 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path)); |
436 | 436 | } |
@@ -445,36 +445,36 @@ discard block |
||
445 | 445 | */ |
446 | 446 | function _copyDir(&$file_list) |
447 | 447 | { |
448 | - if(!$this->ftp_password) |
|
448 | + if (!$this->ftp_password) |
|
449 | 449 | { |
450 | 450 | return new BaseObject(-1, 'msg_ftp_password_input'); |
451 | 451 | } |
452 | 452 | |
453 | 453 | $output = $this->_connect(); |
454 | - if(!$output->toBool()) |
|
454 | + if (!$output->toBool()) |
|
455 | 455 | { |
456 | 456 | return $output; |
457 | 457 | } |
458 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
458 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
459 | 459 | |
460 | - if(is_array($file_list)) |
|
460 | + if (is_array($file_list)) |
|
461 | 461 | { |
462 | - foreach($file_list as $k => $file) |
|
462 | + foreach ($file_list as $k => $file) |
|
463 | 463 | { |
464 | 464 | $org_file = $file; |
465 | - if($this->package->path == ".") |
|
465 | + if ($this->package->path == ".") |
|
466 | 466 | { |
467 | 467 | $file = substr($file, 3); |
468 | 468 | } |
469 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
470 | - $pathname = dirname($target_dir . "/" . $file); |
|
469 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
470 | + $pathname = dirname($target_dir."/".$file); |
|
471 | 471 | |
472 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
472 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
473 | 473 | { |
474 | 474 | ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE); |
475 | 475 | } |
476 | 476 | |
477 | - ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file); |
|
477 | + ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | return new BaseObject(); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | function _connect() |
522 | 522 | { |
523 | - if($this->ftp_info->ftp_host) |
|
523 | + if ($this->ftp_info->ftp_host) |
|
524 | 524 | { |
525 | 525 | $ftp_host = $this->ftp_info->ftp_host; |
526 | 526 | } |
@@ -530,20 +530,20 @@ discard block |
||
530 | 530 | } |
531 | 531 | |
532 | 532 | $this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port); |
533 | - if(!$this->connection) |
|
533 | + if (!$this->connection) |
|
534 | 534 | { |
535 | 535 | return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
536 | 536 | } |
537 | 537 | |
538 | 538 | $login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password); |
539 | - if(!$login_result) |
|
539 | + if (!$login_result) |
|
540 | 540 | { |
541 | 541 | $this->_close(); |
542 | 542 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
543 | 543 | } |
544 | 544 | |
545 | 545 | $_SESSION['ftp_password'] = $this->ftp_password; |
546 | - if($this->ftp_info->ftp_pasv != "N") |
|
546 | + if ($this->ftp_info->ftp_pasv != "N") |
|
547 | 547 | { |
548 | 548 | ftp_pasv($this->connection, TRUE); |
549 | 549 | } |
@@ -558,15 +558,15 @@ discard block |
||
558 | 558 | */ |
559 | 559 | function _removeFile($path) |
560 | 560 | { |
561 | - if(substr($path, 0, 2) == "./") |
|
561 | + if (substr($path, 0, 2) == "./") |
|
562 | 562 | { |
563 | 563 | $path = substr($path, 2); |
564 | 564 | } |
565 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
565 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
566 | 566 | |
567 | - if(!@ftp_delete($this->connection, $target_path)) |
|
567 | + if (!@ftp_delete($this->connection, $target_path)) |
|
568 | 568 | { |
569 | - return new BaseObject(-1, "failed to delete file " . $path); |
|
569 | + return new BaseObject(-1, "failed to delete file ".$path); |
|
570 | 570 | } |
571 | 571 | return new BaseObject(); |
572 | 572 | } |
@@ -579,15 +579,15 @@ discard block |
||
579 | 579 | */ |
580 | 580 | function _removeDir_real($path) |
581 | 581 | { |
582 | - if(substr($path, 0, 2) == "./") |
|
582 | + if (substr($path, 0, 2) == "./") |
|
583 | 583 | { |
584 | 584 | $path = substr($path, 2); |
585 | 585 | } |
586 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
586 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
587 | 587 | |
588 | - if(!@ftp_rmdir($this->connection, $target_path)) |
|
588 | + if (!@ftp_rmdir($this->connection, $target_path)) |
|
589 | 589 | { |
590 | - return new BaseObject(-1, "failed to delete directory " . $path); |
|
590 | + return new BaseObject(-1, "failed to delete directory ".$path); |
|
591 | 591 | } |
592 | 592 | return new BaseObject(); |
593 | 593 | } |
@@ -610,73 +610,73 @@ discard block |
||
610 | 610 | */ |
611 | 611 | function _copyDir(&$file_list) |
612 | 612 | { |
613 | - if(!$this->ftp_password) |
|
613 | + if (!$this->ftp_password) |
|
614 | 614 | { |
615 | 615 | return new BaseObject(-1, 'msg_ftp_password_input'); |
616 | 616 | } |
617 | 617 | |
618 | 618 | $output = $this->_connect(); |
619 | - if(!$output->toBool()) |
|
619 | + if (!$output->toBool()) |
|
620 | 620 | { |
621 | 621 | return $output; |
622 | 622 | } |
623 | 623 | |
624 | - if(!$this->target_path) |
|
624 | + if (!$this->target_path) |
|
625 | 625 | { |
626 | 626 | $this->target_path = '.'; |
627 | 627 | } |
628 | - if(substr($this->download_path, -1) == '/') |
|
628 | + if (substr($this->download_path, -1) == '/') |
|
629 | 629 | { |
630 | 630 | $this->download_path = substr($this->download_path, 0, -1); |
631 | 631 | } |
632 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
632 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
633 | 633 | |
634 | - if(is_array($file_list)) |
|
634 | + if (is_array($file_list)) |
|
635 | 635 | { |
636 | - foreach($file_list as $k => $file) |
|
636 | + foreach ($file_list as $k => $file) |
|
637 | 637 | { |
638 | - if(!$file) |
|
638 | + if (!$file) |
|
639 | 639 | { |
640 | 640 | continue; |
641 | 641 | } |
642 | 642 | $org_file = $file; |
643 | - if($this->package->path == ".") |
|
643 | + if ($this->package->path == ".") |
|
644 | 644 | { |
645 | 645 | $file = substr($file, 3); |
646 | 646 | } |
647 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
648 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
647 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
648 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
649 | 649 | |
650 | 650 | $real_path = "./"; |
651 | 651 | $ftp_path = $this->ftp_info->ftp_root_path; |
652 | 652 | |
653 | - for($i = 0; $i < count($path_list); $i++) |
|
653 | + for ($i = 0; $i < count($path_list); $i++) |
|
654 | 654 | { |
655 | - if($path_list == "") |
|
655 | + if ($path_list == "") |
|
656 | 656 | { |
657 | 657 | continue; |
658 | 658 | } |
659 | - $real_path .= $path_list[$i] . "/"; |
|
660 | - $ftp_path .= $path_list[$i] . "/"; |
|
661 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
659 | + $real_path .= $path_list[$i]."/"; |
|
660 | + $ftp_path .= $path_list[$i]."/"; |
|
661 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
662 | 662 | { |
663 | - if(!@ftp_mkdir($this->connection, $ftp_path)) |
|
663 | + if (!@ftp_mkdir($this->connection, $ftp_path)) |
|
664 | 664 | { |
665 | 665 | return new BaseObject(-1, "msg_make_directory_failed"); |
666 | 666 | } |
667 | 667 | |
668 | - if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') |
|
668 | + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') |
|
669 | 669 | { |
670 | - if(function_exists('ftp_chmod')) |
|
670 | + if (function_exists('ftp_chmod')) |
|
671 | 671 | { |
672 | - if(!ftp_chmod($this->connection, 0755, $ftp_path)) |
|
672 | + if (!ftp_chmod($this->connection, 0755, $ftp_path)) |
|
673 | 673 | { |
674 | 674 | return new BaseObject(-1, "msg_permission_adjust_failed"); |
675 | 675 | } |
676 | 676 | } |
677 | 677 | else |
678 | 678 | { |
679 | - if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path)) |
|
679 | + if (!ftp_site($this->connection, "CHMOD 755 ".$ftp_path)) |
|
680 | 680 | { |
681 | 681 | return new BaseObject(-1, "msg_permission_adjust_failed"); |
682 | 682 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | } |
685 | 685 | } |
686 | 686 | } |
687 | - if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY)) |
|
687 | + if (!ftp_put($this->connection, $target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY)) |
|
688 | 688 | { |
689 | 689 | return new BaseObject(-1, "msg_ftp_upload_failed"); |
690 | 690 | } |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | */ |
734 | 734 | function _connect() |
735 | 735 | { |
736 | - if($this->ftp_info->ftp_host) |
|
736 | + if ($this->ftp_info->ftp_host) |
|
737 | 737 | { |
738 | 738 | $ftp_host = $this->ftp_info->ftp_host; |
739 | 739 | } |
@@ -743,11 +743,11 @@ discard block |
||
743 | 743 | } |
744 | 744 | |
745 | 745 | $this->oFtp = new ftp(); |
746 | - if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port)) |
|
746 | + if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port)) |
|
747 | 747 | { |
748 | 748 | return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
749 | 749 | } |
750 | - if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) |
|
750 | + if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) |
|
751 | 751 | { |
752 | 752 | $this->_close(); |
753 | 753 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
@@ -764,13 +764,13 @@ discard block |
||
764 | 764 | */ |
765 | 765 | function _removeFile($path) |
766 | 766 | { |
767 | - if(substr($path, 0, 2) == "./") |
|
767 | + if (substr($path, 0, 2) == "./") |
|
768 | 768 | { |
769 | 769 | $path = substr($path, 2); |
770 | 770 | } |
771 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
771 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
772 | 772 | |
773 | - if(!$this->oFtp->ftp_delete($target_path)) |
|
773 | + if (!$this->oFtp->ftp_delete($target_path)) |
|
774 | 774 | { |
775 | 775 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
776 | 776 | } |
@@ -784,13 +784,13 @@ discard block |
||
784 | 784 | */ |
785 | 785 | function _removeDir_real($path) |
786 | 786 | { |
787 | - if(substr($path, 0, 2) == "./") |
|
787 | + if (substr($path, 0, 2) == "./") |
|
788 | 788 | { |
789 | 789 | $path = substr($path, 2); |
790 | 790 | } |
791 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
791 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
792 | 792 | |
793 | - if(!$this->oFtp->ftp_rmdir($target_path)) |
|
793 | + if (!$this->oFtp->ftp_rmdir($target_path)) |
|
794 | 794 | { |
795 | 795 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path)); |
796 | 796 | } |
@@ -815,50 +815,50 @@ discard block |
||
815 | 815 | */ |
816 | 816 | function _copyDir(&$file_list) |
817 | 817 | { |
818 | - if(!$this->ftp_password) |
|
818 | + if (!$this->ftp_password) |
|
819 | 819 | { |
820 | 820 | return new BaseObject(-1, 'msg_ftp_password_input'); |
821 | 821 | } |
822 | 822 | |
823 | 823 | $output = $this->_connect(); |
824 | - if(!$output->toBool()) |
|
824 | + if (!$output->toBool()) |
|
825 | 825 | { |
826 | 826 | return $output; |
827 | 827 | } |
828 | 828 | |
829 | 829 | $oFtp = &$this->oFtp; |
830 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
830 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
831 | 831 | |
832 | - if(is_array($file_list)) |
|
832 | + if (is_array($file_list)) |
|
833 | 833 | { |
834 | - foreach($file_list as $k => $file) |
|
834 | + foreach ($file_list as $k => $file) |
|
835 | 835 | { |
836 | 836 | $org_file = $file; |
837 | - if($this->package->path == ".") |
|
837 | + if ($this->package->path == ".") |
|
838 | 838 | { |
839 | 839 | $file = substr($file, 3); |
840 | 840 | } |
841 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
842 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
841 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
842 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
843 | 843 | |
844 | 844 | $real_path = "./"; |
845 | 845 | $ftp_path = $this->ftp_info->ftp_root_path; |
846 | 846 | |
847 | - for($i = 0; $i < count($path_list); $i++) |
|
847 | + for ($i = 0; $i < count($path_list); $i++) |
|
848 | 848 | { |
849 | - if($path_list == "") |
|
849 | + if ($path_list == "") |
|
850 | 850 | { |
851 | 851 | continue; |
852 | 852 | } |
853 | - $real_path .= $path_list[$i] . "/"; |
|
854 | - $ftp_path .= $path_list[$i] . "/"; |
|
855 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
853 | + $real_path .= $path_list[$i]."/"; |
|
854 | + $ftp_path .= $path_list[$i]."/"; |
|
855 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
856 | 856 | { |
857 | 857 | $oFtp->ftp_mkdir($ftp_path); |
858 | - $oFtp->ftp_site("CHMOD 755 " . $ftp_path); |
|
858 | + $oFtp->ftp_site("CHMOD 755 ".$ftp_path); |
|
859 | 859 | } |
860 | 860 | } |
861 | - $oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file)); |
|
861 | + $oFtp->ftp_put($target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file)); |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | |
@@ -903,13 +903,13 @@ discard block |
||
903 | 903 | */ |
904 | 904 | function _removeFile($path) |
905 | 905 | { |
906 | - if(substr($path, 0, 2) == "./") |
|
906 | + if (substr($path, 0, 2) == "./") |
|
907 | 907 | { |
908 | 908 | $path = substr($path, 2); |
909 | 909 | } |
910 | 910 | $target_path = FileHandler::getRealPath($path); |
911 | 911 | |
912 | - if(!FileHandler::removeFile($target_path)) |
|
912 | + if (!FileHandler::removeFile($target_path)) |
|
913 | 913 | { |
914 | 914 | return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
915 | 915 | } |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | */ |
924 | 924 | function _removeDir_real($path) |
925 | 925 | { |
926 | - if(substr($path, 0, 2) == "./") |
|
926 | + if (substr($path, 0, 2) == "./") |
|
927 | 927 | { |
928 | 928 | $path = substr($path, 2); |
929 | 929 | } |
@@ -952,38 +952,38 @@ discard block |
||
952 | 952 | function _copyDir(&$file_list) |
953 | 953 | { |
954 | 954 | $output = $this->_connect(); |
955 | - if(!$output->toBool()) |
|
955 | + if (!$output->toBool()) |
|
956 | 956 | { |
957 | 957 | return $output; |
958 | 958 | } |
959 | 959 | $target_dir = $this->target_path; |
960 | 960 | |
961 | - if(is_array($file_list)) |
|
961 | + if (is_array($file_list)) |
|
962 | 962 | { |
963 | - foreach($file_list as $k => $file) |
|
963 | + foreach ($file_list as $k => $file) |
|
964 | 964 | { |
965 | 965 | $org_file = $file; |
966 | - if($this->package->path == ".") |
|
966 | + if ($this->package->path == ".") |
|
967 | 967 | { |
968 | 968 | $file = substr($file, 3); |
969 | 969 | } |
970 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
971 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
970 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
971 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
972 | 972 | $real_path = "./"; |
973 | 973 | |
974 | - for($i = 0; $i < count($path_list); $i++) |
|
974 | + for ($i = 0; $i < count($path_list); $i++) |
|
975 | 975 | { |
976 | - if($path_list == "") |
|
976 | + if ($path_list == "") |
|
977 | 977 | { |
978 | 978 | continue; |
979 | 979 | } |
980 | - $real_path .= $path_list[$i] . "/"; |
|
981 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
980 | + $real_path .= $path_list[$i]."/"; |
|
981 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
982 | 982 | { |
983 | 983 | FileHandler::makeDir($real_path); |
984 | 984 | } |
985 | 985 | } |
986 | - FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file)); |
|
986 | + FileHandler::copyFile(FileHandler::getRealPath($this->download_path."/".$org_file), FileHandler::getRealPath("./".$target_dir.'/'.$file)); |
|
987 | 987 | } |
988 | 988 | } |
989 | 989 |
@@ -121,8 +121,7 @@ discard block |
||
121 | 121 | $this->download_file = $this->temp_dir . "xe.tar"; |
122 | 122 | $this->target_path = ""; |
123 | 123 | $this->download_path = $this->temp_dir; |
124 | - } |
|
125 | - else |
|
124 | + } else |
|
126 | 125 | { |
127 | 126 | $subpath = trim(substr($this->package->path, 2), '/'); |
128 | 127 | $this->download_file = $this->temp_dir . $subpath . ".tar"; |
@@ -297,8 +296,7 @@ discard block |
||
297 | 296 | { |
298 | 297 | return $output; |
299 | 298 | } |
300 | - } |
|
301 | - else |
|
299 | + } else |
|
302 | 300 | { |
303 | 301 | $output = $this->_removeFile($file_path); |
304 | 302 | if(!$output->toBool()) |
@@ -370,8 +368,7 @@ discard block |
||
370 | 368 | if($this->ftp_info->ftp_host) |
371 | 369 | { |
372 | 370 | $ftp_host = $this->ftp_info->ftp_host; |
373 | - } |
|
374 | - else |
|
371 | + } else |
|
375 | 372 | { |
376 | 373 | $ftp_host = "127.0.0.1"; |
377 | 374 | } |
@@ -523,8 +520,7 @@ discard block |
||
523 | 520 | if($this->ftp_info->ftp_host) |
524 | 521 | { |
525 | 522 | $ftp_host = $this->ftp_info->ftp_host; |
526 | - } |
|
527 | - else |
|
523 | + } else |
|
528 | 524 | { |
529 | 525 | $ftp_host = "127.0.0.1"; |
530 | 526 | } |
@@ -673,8 +669,7 @@ discard block |
||
673 | 669 | { |
674 | 670 | return new BaseObject(-1, "msg_permission_adjust_failed"); |
675 | 671 | } |
676 | - } |
|
677 | - else |
|
672 | + } else |
|
678 | 673 | { |
679 | 674 | if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path)) |
680 | 675 | { |
@@ -736,8 +731,7 @@ discard block |
||
736 | 731 | if($this->ftp_info->ftp_host) |
737 | 732 | { |
738 | 733 | $ftp_host = $this->ftp_info->ftp_host; |
739 | - } |
|
740 | - else |
|
734 | + } else |
|
741 | 735 | { |
742 | 736 | $ftp_host = "127.0.0.1"; |
743 | 737 | } |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | function preProcParam(&$order_target, &$order_type, &$page) |
20 | 20 | { |
21 | 21 | $order_target_array = array('newest' => 1, 'download' => 1, 'popular' => 1); |
22 | - if(!isset($order_target_array[$order_target])) |
|
22 | + if (!isset($order_target_array[$order_target])) |
|
23 | 23 | { |
24 | 24 | $order_target = 'newest'; |
25 | 25 | } |
26 | 26 | |
27 | 27 | $order_type_array = array('asc' => 1, 'desc' => 1); |
28 | - if(!isset($order_type_array[$order_type])) |
|
28 | + if (!isset($order_type_array[$order_type])) |
|
29 | 29 | { |
30 | 30 | $order_type = 'desc'; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $page = (int) $page; |
34 | - if($page < 1) |
|
34 | + if ($page < 1) |
|
35 | 35 | { |
36 | 36 | $page = 1; |
37 | 37 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | |
64 | 64 | $type_array = array('M' => 1, 'P' => 1); |
65 | 65 | $type = Context::get('type'); |
66 | - if(!isset($type_array[$type])) |
|
66 | + if (!isset($type_array[$type])) |
|
67 | 67 | { |
68 | 68 | $type = 'P'; |
69 | 69 | } |
70 | 70 | |
71 | - if($type == 'P') |
|
71 | + if ($type == 'P') |
|
72 | 72 | { |
73 | 73 | $category_srl = $this->layout_category_srl; |
74 | 74 | } |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | |
96 | 96 | $type_array = array('M' => 1, 'P' => 1); |
97 | 97 | $type = Context::get('type'); |
98 | - if(!isset($type_array[$type])) |
|
98 | + if (!isset($type_array[$type])) |
|
99 | 99 | { |
100 | 100 | $type = 'P'; |
101 | 101 | } |
102 | 102 | |
103 | - if($type == 'P') |
|
103 | + if ($type == 'P') |
|
104 | 104 | { |
105 | 105 | $category_srl = $this->module_skin_category_srl; |
106 | 106 | } |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL) |
120 | 120 | { |
121 | - if($type == 'menu') |
|
121 | + if ($type == 'menu') |
|
122 | 122 | { |
123 | 123 | $params["act"] = "getResourceapiMenuPackageList"; |
124 | 124 | } |
125 | - elseif($type == 'skin') |
|
125 | + elseif ($type == 'skin') |
|
126 | 126 | { |
127 | 127 | $params["act"] = "getResourceapiSkinPackageList"; |
128 | 128 | $params['parent_program'] = $parent_program; |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | $params["order_type"] = $order_type; |
138 | 138 | $params["page"] = $page; |
139 | 139 | |
140 | - if($category_srl) |
|
140 | + if ($category_srl) |
|
141 | 141 | { |
142 | 142 | $params["category_srl"] = $category_srl; |
143 | 143 | } |
144 | 144 | |
145 | - if($search_keyword) |
|
145 | + if ($search_keyword) |
|
146 | 146 | { |
147 | 147 | $params["search_keyword"] = $search_keyword; |
148 | 148 | } |
149 | 149 | |
150 | 150 | $xmlDoc = XmlGenerater::getXmlDoc($params); |
151 | - if($xmlDoc && $xmlDoc->response->packagelist->item) |
|
151 | + if ($xmlDoc && $xmlDoc->response->packagelist->item) |
|
152 | 152 | { |
153 | 153 | $item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item); |
154 | 154 | $this->add('item_list', $item_list); |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | |
170 | 170 | $is_authed = 0; |
171 | 171 | $output = $oAdminModel->checkUseDirectModuleInstall($package); |
172 | - if($output->toBool()==TRUE) |
|
172 | + if ($output->toBool() == TRUE) |
|
173 | 173 | { |
174 | 174 | $is_authed = 1; |
175 | 175 | } |
176 | 176 | else |
177 | 177 | { |
178 | 178 | $ftp_info = Context::getFTPInfo(); |
179 | - if(!$ftp_info->ftp_root_path) |
|
179 | + if (!$ftp_info->ftp_root_path) |
|
180 | 180 | { |
181 | 181 | $is_authed = -1; |
182 | 182 | } |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | { |
197 | 197 | $oModel = getModel('autoinstall'); |
198 | 198 | $output = executeQueryArray('autoinstall.getNeedUpdate'); |
199 | - if(!is_array($output->data)) |
|
199 | + if (!is_array($output->data)) |
|
200 | 200 | { |
201 | 201 | return NULL; |
202 | 202 | } |
203 | 203 | |
204 | 204 | $result = array(); |
205 | 205 | $xml = new XmlParser(); |
206 | - foreach($output->data as $package) |
|
206 | + foreach ($output->data as $package) |
|
207 | 207 | { |
208 | 208 | $packageSrl = $package->package_srl; |
209 | 209 | |
@@ -213,27 +213,27 @@ discard block |
||
213 | 213 | $packageInfo->type = $oModel->getTypeFromPath($package->path); |
214 | 214 | $packageInfo->url = $oModel->getUpdateUrlByPackageSrl($package->package_srl); |
215 | 215 | |
216 | - if($packageInfo->type == 'core') |
|
216 | + if ($packageInfo->type == 'core') |
|
217 | 217 | { |
218 | 218 | $title = 'XpressEngine'; |
219 | 219 | } |
220 | 220 | else |
221 | 221 | { |
222 | 222 | $configFile = $oModel->getConfigFilePath($packageInfo->type); |
223 | - $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile); |
|
223 | + $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path).$configFile); |
|
224 | 224 | |
225 | - if($xmlDoc) |
|
225 | + if ($xmlDoc) |
|
226 | 226 | { |
227 | 227 | $type = $packageInfo->type; |
228 | - if($type == "drcomponent") |
|
228 | + if ($type == "drcomponent") |
|
229 | 229 | { |
230 | 230 | $type = "component"; |
231 | 231 | } |
232 | - if($type == "style" || $type == "m.skin") |
|
232 | + if ($type == "style" || $type == "m.skin") |
|
233 | 233 | { |
234 | 234 | $type = "skin"; |
235 | 235 | } |
236 | - if($type == "m.layout") |
|
236 | + if ($type == "m.layout") |
|
237 | 237 | { |
238 | 238 | $type = "layout"; |
239 | 239 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $oModel = getModel('autoinstall'); |
268 | 268 | |
269 | 269 | $targetpackages = array(); |
270 | - if($xmlDoc) |
|
270 | + if ($xmlDoc) |
|
271 | 271 | { |
272 | 272 | $xmlPackage = $xmlDoc->response->package; |
273 | 273 | $package = new stdClass(); |
@@ -276,15 +276,15 @@ discard block |
||
276 | 276 | $package->package_description = $xmlPackage->package_description->body; |
277 | 277 | $package->version = $xmlPackage->version->body; |
278 | 278 | $package->path = $xmlPackage->path->body; |
279 | - if($xmlPackage->depends) |
|
279 | + if ($xmlPackage->depends) |
|
280 | 280 | { |
281 | - if(!is_array($xmlPackage->depends->item)) |
|
281 | + if (!is_array($xmlPackage->depends->item)) |
|
282 | 282 | { |
283 | 283 | $xmlPackage->depends->item = array($xmlPackage->depends->item); |
284 | 284 | } |
285 | 285 | |
286 | 286 | $package->depends = array(); |
287 | - foreach($xmlPackage->depends->item as $item) |
|
287 | + foreach ($xmlPackage->depends->item as $item) |
|
288 | 288 | { |
289 | 289 | $dep_item = new stdClass(); |
290 | 290 | $dep_item->package_srl = $item->package_srl->body; |
@@ -297,23 +297,23 @@ discard block |
||
297 | 297 | |
298 | 298 | $packages = $oModel->getInstalledPackages(array_keys($targetpackages)); |
299 | 299 | $package->deplist = ""; |
300 | - foreach($package->depends as $key => $dep) |
|
300 | + foreach ($package->depends as $key => $dep) |
|
301 | 301 | { |
302 | - if(!$packages[$dep->package_srl]) |
|
302 | + if (!$packages[$dep->package_srl]) |
|
303 | 303 | { |
304 | 304 | $package->depends[$key]->installed = FALSE; |
305 | - $package->package_srl .= "," . $dep->package_srl; |
|
305 | + $package->package_srl .= ",".$dep->package_srl; |
|
306 | 306 | } |
307 | 307 | else |
308 | 308 | { |
309 | 309 | $package->depends[$key]->installed = TRUE; |
310 | 310 | $package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version; |
311 | - if(version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
311 | + if (version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
312 | 312 | { |
313 | 313 | $package->depends[$key]->need_update = TRUE; |
314 | - $package->package_srl .= "," . $dep->package_srl; |
|
314 | + $package->package_srl .= ",".$dep->package_srl; |
|
315 | 315 | |
316 | - if($dep->path === '.') |
|
316 | + if ($dep->path === '.') |
|
317 | 317 | { |
318 | 318 | $package->contain_core = TRUE; |
319 | 319 | $package->contain_core_version = $dep->version; |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | $installedPackage = $oModel->getInstalledPackage($packageSrl); |
331 | - if($installedPackage) |
|
331 | + if ($installedPackage) |
|
332 | 332 | { |
333 | 333 | $package->installed = TRUE; |
334 | 334 | $package->cur_version = $installedPackage->current_version; |
335 | 335 | $package->need_update = version_compare($package->version, $installedPackage->current_version, ">"); |
336 | 336 | } |
337 | 337 | |
338 | - if($package->path === '.') |
|
338 | + if ($package->path === '.') |
|
339 | 339 | { |
340 | 340 | $package->contain_core = TRUE; |
341 | 341 | $package->contain_core_version = $package->version; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | public function getAutoInstallAdminInstallInfo() |
352 | 352 | { |
353 | 353 | $packageSrl = Context::get('package_srl'); |
354 | - if(!$packageSrl) |
|
354 | + if (!$packageSrl) |
|
355 | 355 | { |
356 | 356 | return new BaseObject(-1, 'msg_invalid_request'); |
357 | 357 | } |
@@ -365,23 +365,23 @@ discard block |
||
365 | 365 | $directModuleInstall = TRUE; |
366 | 366 | $arrUnwritableDir = array(); |
367 | 367 | $output = $this->isWritableDir($package->path); |
368 | - if($output->toBool()==FALSE) |
|
368 | + if ($output->toBool() == FALSE) |
|
369 | 369 | { |
370 | 370 | $directModuleInstall = FALSE; |
371 | 371 | $arrUnwritableDir[] = $output->get('path'); |
372 | 372 | } |
373 | 373 | |
374 | - foreach($package->depends as $dep) |
|
374 | + foreach ($package->depends as $dep) |
|
375 | 375 | { |
376 | 376 | $output = $this->isWritableDir($dep->path); |
377 | - if($output->toBool()==FALSE) |
|
377 | + if ($output->toBool() == FALSE) |
|
378 | 378 | { |
379 | 379 | $directModuleInstall = FALSE; |
380 | 380 | $arrUnwritableDir[] = $output->get('path'); |
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | - if($directModuleInstall==FALSE) |
|
384 | + if ($directModuleInstall == FALSE) |
|
385 | 385 | { |
386 | 386 | $output = new BaseObject(-1, 'msg_direct_inall_invalid'); |
387 | 387 | $output->add('path', $arrUnwritableDir); |
@@ -396,17 +396,17 @@ discard block |
||
396 | 396 | $path_list = explode('/', dirname($path)); |
397 | 397 | $real_path = './'; |
398 | 398 | |
399 | - while($path_list) |
|
399 | + while ($path_list) |
|
400 | 400 | { |
401 | - $check_path = realpath($real_path . implode('/', $path_list)); |
|
402 | - if(FileHandler::isDir($check_path)) |
|
401 | + $check_path = realpath($real_path.implode('/', $path_list)); |
|
402 | + if (FileHandler::isDir($check_path)) |
|
403 | 403 | { |
404 | 404 | break; |
405 | 405 | } |
406 | 406 | array_pop($path_list); |
407 | 407 | } |
408 | 408 | |
409 | - if(FileHandler::isWritableDir($check_path)==FALSE) |
|
409 | + if (FileHandler::isWritableDir($check_path) == FALSE) |
|
410 | 410 | { |
411 | 411 | $output = new BaseObject(-1, 'msg_unwritable_directory'); |
412 | 412 | $output->add('path', FileHandler::getRealPath($check_path)); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | function session() |
17 | 17 | { |
18 | - if(Context::isInstalled()) $this->session_started= true; |
|
18 | + if (Context::isInstalled()) $this->session_started = true; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | function moduleInstall() |
25 | 25 | { |
26 | 26 | $oDB = &DB::getInstance(); |
27 | - $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid")); |
|
27 | + $oDB->addIndex("session", "idx_session_update_mid", array("member_srl", "last_update", "cur_mid")); |
|
28 | 28 | |
29 | 29 | return new BaseObject(); |
30 | 30 | } |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | $oModuleModel = getModel('module'); |
39 | 39 | $oModuleController = getController('module'); |
40 | 40 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
41 | - if($oModuleModel->needUpdate($version_update_id)) |
|
41 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
42 | 42 | { |
43 | - if(!$oDB->isTableExists('session')) return true; |
|
44 | - if(!$oDB->isColumnExists("session","cur_mid")) return true; |
|
45 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true; |
|
43 | + if (!$oDB->isTableExists('session')) return true; |
|
44 | + if (!$oDB->isColumnExists("session", "cur_mid")) return true; |
|
45 | + if (!$oDB->isIndexExists("session", "idx_session_update_mid")) return true; |
|
46 | 46 | |
47 | 47 | $oModuleController->insertUpdatedLog($version_update_id); |
48 | 48 | } |
@@ -59,19 +59,19 @@ discard block |
||
59 | 59 | $oModuleModel = getModel('module'); |
60 | 60 | $oModuleController = getController('module'); |
61 | 61 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
62 | - if($oModuleModel->needUpdate($version_update_id)) |
|
62 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
63 | 63 | { |
64 | - if(!$oDB->isTableExists('session')) |
|
64 | + if (!$oDB->isTableExists('session')) |
|
65 | 65 | { |
66 | 66 | $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml'); |
67 | 67 | } |
68 | - if(!$oDB->isColumnExists("session","cur_mid")) |
|
68 | + if (!$oDB->isColumnExists("session", "cur_mid")) |
|
69 | 69 | { |
70 | - $oDB->addColumn('session',"cur_mid","varchar",128); |
|
70 | + $oDB->addColumn('session', "cur_mid", "varchar", 128); |
|
71 | 71 | } |
72 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) |
|
72 | + if (!$oDB->isIndexExists("session", "idx_session_update_mid")) |
|
73 | 73 | { |
74 | - $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid")); |
|
74 | + $oDB->addIndex("session", "idx_session_update_mid", array("member_srl", "last_update", "cur_mid")); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $oModuleController->insertUpdatedLog($version_update_id); |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function unSerializeSession($val) |
87 | 87 | { |
88 | - $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
|
89 | - for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
88 | + $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
|
89 | + for ($i = 0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
90 | 90 | return $result; |
91 | 91 | } |
92 | 92 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | */ |
96 | 96 | function serializeSession($data) |
97 | 97 | { |
98 | - if(!count($data)) return; |
|
98 | + if (!count($data)) return; |
|
99 | 99 | |
100 | 100 | $str = ''; |
101 | - foreach($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
102 | - return substr($str, 0, strlen($str)-1).'}'; |
|
101 | + foreach ($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
102 | + return substr($str, 0, strlen($str) - 1).'}'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $this->filename = $filename; |
100 | 100 | |
101 | 101 | $this->startTag = $startTag; |
102 | - if($endTag) $this->endTag = $endTag; |
|
102 | + if ($endTag) $this->endTag = $endTag; |
|
103 | 103 | $this->itemStartTag = $itemTag; |
104 | 104 | $this->itemEndTag = $itemEndTag; |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->cache_path = './files/cache/importer/'.$this->key; |
109 | 109 | $this->cache_index_file = $this->cache_path.'/index'; |
110 | 110 | |
111 | - if(!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
111 | + if (!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
112 | 112 | |
113 | 113 | return $this->openFile(); |
114 | 114 | } |
@@ -120,55 +120,55 @@ discard block |
||
120 | 120 | function openFile() |
121 | 121 | { |
122 | 122 | FileHandler::removeFile($this->cache_index_file); |
123 | - $this->index_fd = fopen($this->cache_index_file,"a"); |
|
123 | + $this->index_fd = fopen($this->cache_index_file, "a"); |
|
124 | 124 | // If local file |
125 | - if(strncasecmp('http://', $this->filename, 7) !== 0) |
|
125 | + if (strncasecmp('http://', $this->filename, 7) !== 0) |
|
126 | 126 | { |
127 | - if(!file_exists($this->filename)) return new BaseObject(-1,'msg_no_xml_file'); |
|
128 | - $this->fd = fopen($this->filename,"r"); |
|
127 | + if (!file_exists($this->filename)) return new BaseObject(-1, 'msg_no_xml_file'); |
|
128 | + $this->fd = fopen($this->filename, "r"); |
|
129 | 129 | // If remote file |
130 | 130 | } |
131 | 131 | else |
132 | 132 | { |
133 | 133 | $url_info = parse_url($this->filename); |
134 | - if(!$url_info['port']) $url_info['port'] = 80; |
|
135 | - if(!$url_info['path']) $url_info['path'] = '/'; |
|
134 | + if (!$url_info['port']) $url_info['port'] = 80; |
|
135 | + if (!$url_info['path']) $url_info['path'] = '/'; |
|
136 | 136 | |
137 | 137 | $this->fd = @fsockopen($url_info['host'], $url_info['port']); |
138 | - if(!$this->fd) return new BaseObject(-1,'msg_no_xml_file'); |
|
138 | + if (!$this->fd) return new BaseObject(-1, 'msg_no_xml_file'); |
|
139 | 139 | // If the file name contains Korean, do urlencode(iconv required) |
140 | 140 | $path = $url_info['path']; |
141 | - if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) |
|
141 | + if (preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path) && function_exists('iconv')) |
|
142 | 142 | { |
143 | - $path_list = explode('/',$path); |
|
143 | + $path_list = explode('/', $path); |
|
144 | 144 | $cnt = count($path_list); |
145 | - $filename = $path_list[$cnt-1]; |
|
146 | - $filename = urlencode(iconv("UTF-8","EUC-KR",$filename)); |
|
147 | - $path_list[$cnt-1] = $filename; |
|
148 | - $path = implode('/',$path_list); |
|
145 | + $filename = $path_list[$cnt - 1]; |
|
146 | + $filename = urlencode(iconv("UTF-8", "EUC-KR", $filename)); |
|
147 | + $path_list[$cnt - 1] = $filename; |
|
148 | + $path = implode('/', $path_list); |
|
149 | 149 | $url_info['path'] = $path; |
150 | 150 | } |
151 | 151 | |
152 | 152 | $header = sprintf("GET %s?%s HTTP/1.0\r\nHost: %s\r\nReferer: %s://%s\r\nConnection: Close\r\n\r\n", $url_info['path'], $url_info['query'], $url_info['host'], $url_info['scheme'], $url_info['host']); |
153 | 153 | @fwrite($this->fd, $header); |
154 | 154 | $buff = ''; |
155 | - while(!feof($this->fd)) |
|
155 | + while (!feof($this->fd)) |
|
156 | 156 | { |
157 | 157 | $buff .= $str = fgets($this->fd, 1024); |
158 | - if(!trim($str)) break; |
|
158 | + if (!trim($str)) break; |
|
159 | 159 | } |
160 | - if(preg_match('/404 Not Found/i',$buff)) return new BaseObject(-1,'msg_no_xml_file'); |
|
160 | + if (preg_match('/404 Not Found/i', $buff)) return new BaseObject(-1, 'msg_no_xml_file'); |
|
161 | 161 | } |
162 | 162 | |
163 | - if($this->startTag) |
|
163 | + if ($this->startTag) |
|
164 | 164 | { |
165 | - while(!feof($this->fd)) |
|
165 | + while (!feof($this->fd)) |
|
166 | 166 | { |
167 | 167 | $str = fgets($this->fd, 1024); |
168 | 168 | $pos = strpos($str, $this->startTag); |
169 | - if($pos !== false) |
|
169 | + if ($pos !== false) |
|
170 | 170 | { |
171 | - $this->buff = substr($this->buff, $pos+strlen($this->startTag)); |
|
171 | + $this->buff = substr($this->buff, $pos + strlen($this->startTag)); |
|
172 | 172 | $this->isStarted = true; |
173 | 173 | $this->isFinished = false; |
174 | 174 | break; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | FileHandler::removeDir($this->cache_path.$this->key); |
210 | 210 | $this->index = 0; |
211 | - while(!$this->isFinished()) |
|
211 | + while (!$this->isFinished()) |
|
212 | 212 | { |
213 | 213 | $this->getItem(); |
214 | 214 | } |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | |
225 | 225 | $filename = sprintf('%s/%s', $this->cache_path, $filename); |
226 | 226 | |
227 | - $index_fd = fopen($this->cache_index_file,"r"); |
|
228 | - $fd = fopen($filename,'w'); |
|
227 | + $index_fd = fopen($this->cache_index_file, "r"); |
|
228 | + $fd = fopen($filename, 'w'); |
|
229 | 229 | |
230 | 230 | fwrite($fd, '<items>'); |
231 | - while(!feof($index_fd)) |
|
231 | + while (!feof($index_fd)) |
|
232 | 232 | { |
233 | - $target_file = trim(fgets($index_fd,1024)); |
|
234 | - if(!file_exists($target_file)) continue; |
|
233 | + $target_file = trim(fgets($index_fd, 1024)); |
|
234 | + if (!file_exists($target_file)) continue; |
|
235 | 235 | $buff = FileHandler::readFile($target_file); |
236 | 236 | fwrite($fd, FileHandler::readFile($target_file)); |
237 | 237 | |
@@ -247,21 +247,21 @@ discard block |
||
247 | 247 | */ |
248 | 248 | function getItem() |
249 | 249 | { |
250 | - if($this->isFinished()) return; |
|
250 | + if ($this->isFinished()) return; |
|
251 | 251 | |
252 | - while(!feof($this->fd)) |
|
252 | + while (!feof($this->fd)) |
|
253 | 253 | { |
254 | 254 | $startPos = strpos($this->buff, $this->itemStartTag); |
255 | - if($startPos !== false) |
|
255 | + if ($startPos !== false) |
|
256 | 256 | { |
257 | 257 | $this->buff = substr($this->buff, $startPos); |
258 | - $this->buff = preg_replace("/\>/",">\r\n",$this->buff,1); |
|
258 | + $this->buff = preg_replace("/\>/", ">\r\n", $this->buff, 1); |
|
259 | 259 | break; |
260 | 260 | } |
261 | - elseif($this->endTag) |
|
261 | + elseif ($this->endTag) |
|
262 | 262 | { |
263 | 263 | $endPos = strpos($this->buff, $this->endTag); |
264 | - if($endPos !== false) |
|
264 | + if ($endPos !== false) |
|
265 | 265 | { |
266 | 266 | $this->closeFile(); |
267 | 267 | return; |
@@ -271,21 +271,21 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | $startPos = strpos($this->buff, $this->itemStartTag); |
274 | - if($startPos === false) |
|
274 | + if ($startPos === false) |
|
275 | 275 | { |
276 | 276 | $this->closeFile(); |
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | - $filename = sprintf('%s/%s.xml',$this->cache_path, $this->index++); |
|
280 | + $filename = sprintf('%s/%s.xml', $this->cache_path, $this->index++); |
|
281 | 281 | fwrite($this->index_fd, $filename."\r\n"); |
282 | 282 | |
283 | - $fd = fopen($filename,'w'); |
|
283 | + $fd = fopen($filename, 'w'); |
|
284 | 284 | |
285 | - while(!feof($this->fd)) |
|
285 | + while (!feof($this->fd)) |
|
286 | 286 | { |
287 | 287 | $endPos = strpos($this->buff, $this->itemEndTag); |
288 | - if($endPos !== false) |
|
288 | + if ($endPos !== false) |
|
289 | 289 | { |
290 | 290 | $endPos += strlen($this->itemEndTag); |
291 | 291 | $buff = substr($this->buff, 0, $endPos); |
@@ -99,7 +99,9 @@ discard block |
||
99 | 99 | $this->filename = $filename; |
100 | 100 | |
101 | 101 | $this->startTag = $startTag; |
102 | - if($endTag) $this->endTag = $endTag; |
|
102 | + if($endTag) { |
|
103 | + $this->endTag = $endTag; |
|
104 | + } |
|
103 | 105 | $this->itemStartTag = $itemTag; |
104 | 106 | $this->itemEndTag = $itemEndTag; |
105 | 107 | |
@@ -108,7 +110,9 @@ discard block |
||
108 | 110 | $this->cache_path = './files/cache/importer/'.$this->key; |
109 | 111 | $this->cache_index_file = $this->cache_path.'/index'; |
110 | 112 | |
111 | - if(!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
113 | + if(!is_dir($this->cache_path)) { |
|
114 | + FileHandler::makeDir($this->cache_path); |
|
115 | + } |
|
112 | 116 | |
113 | 117 | return $this->openFile(); |
114 | 118 | } |
@@ -124,18 +128,25 @@ discard block |
||
124 | 128 | // If local file |
125 | 129 | if(strncasecmp('http://', $this->filename, 7) !== 0) |
126 | 130 | { |
127 | - if(!file_exists($this->filename)) return new BaseObject(-1,'msg_no_xml_file'); |
|
131 | + if(!file_exists($this->filename)) { |
|
132 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
133 | + } |
|
128 | 134 | $this->fd = fopen($this->filename,"r"); |
129 | 135 | // If remote file |
130 | - } |
|
131 | - else |
|
136 | + } else |
|
132 | 137 | { |
133 | 138 | $url_info = parse_url($this->filename); |
134 | - if(!$url_info['port']) $url_info['port'] = 80; |
|
135 | - if(!$url_info['path']) $url_info['path'] = '/'; |
|
139 | + if(!$url_info['port']) { |
|
140 | + $url_info['port'] = 80; |
|
141 | + } |
|
142 | + if(!$url_info['path']) { |
|
143 | + $url_info['path'] = '/'; |
|
144 | + } |
|
136 | 145 | |
137 | 146 | $this->fd = @fsockopen($url_info['host'], $url_info['port']); |
138 | - if(!$this->fd) return new BaseObject(-1,'msg_no_xml_file'); |
|
147 | + if(!$this->fd) { |
|
148 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
149 | + } |
|
139 | 150 | // If the file name contains Korean, do urlencode(iconv required) |
140 | 151 | $path = $url_info['path']; |
141 | 152 | if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) |
@@ -155,9 +166,13 @@ discard block |
||
155 | 166 | while(!feof($this->fd)) |
156 | 167 | { |
157 | 168 | $buff .= $str = fgets($this->fd, 1024); |
158 | - if(!trim($str)) break; |
|
169 | + if(!trim($str)) { |
|
170 | + break; |
|
171 | + } |
|
172 | + } |
|
173 | + if(preg_match('/404 Not Found/i',$buff)) { |
|
174 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
159 | 175 | } |
160 | - if(preg_match('/404 Not Found/i',$buff)) return new BaseObject(-1,'msg_no_xml_file'); |
|
161 | 176 | } |
162 | 177 | |
163 | 178 | if($this->startTag) |
@@ -174,8 +189,7 @@ discard block |
||
174 | 189 | break; |
175 | 190 | } |
176 | 191 | } |
177 | - } |
|
178 | - else |
|
192 | + } else |
|
179 | 193 | { |
180 | 194 | $this->isStarted = true; |
181 | 195 | $this->isFinished = false; |
@@ -231,7 +245,9 @@ discard block |
||
231 | 245 | while(!feof($index_fd)) |
232 | 246 | { |
233 | 247 | $target_file = trim(fgets($index_fd,1024)); |
234 | - if(!file_exists($target_file)) continue; |
|
248 | + if(!file_exists($target_file)) { |
|
249 | + continue; |
|
250 | + } |
|
235 | 251 | $buff = FileHandler::readFile($target_file); |
236 | 252 | fwrite($fd, FileHandler::readFile($target_file)); |
237 | 253 | |
@@ -247,7 +263,9 @@ discard block |
||
247 | 263 | */ |
248 | 264 | function getItem() |
249 | 265 | { |
250 | - if($this->isFinished()) return; |
|
266 | + if($this->isFinished()) { |
|
267 | + return; |
|
268 | + } |
|
251 | 269 | |
252 | 270 | while(!feof($this->fd)) |
253 | 271 | { |
@@ -257,8 +275,7 @@ discard block |
||
257 | 275 | $this->buff = substr($this->buff, $startPos); |
258 | 276 | $this->buff = preg_replace("/\>/",">\r\n",$this->buff,1); |
259 | 277 | break; |
260 | - } |
|
261 | - elseif($this->endTag) |
|
278 | + } elseif($this->endTag) |
|
262 | 279 | { |
263 | 280 | $endPos = strpos($this->buff, $this->endTag); |
264 | 281 | if($endPos !== false) |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | Context::set('module_srl',''); |
30 | 30 | $this->act = 'list'; |
31 | - } |
|
32 | - else |
|
31 | + } else |
|
33 | 32 | { |
34 | 33 | ModuleModel::syncModuleToSite($module_info); |
35 | 34 | $this->module_info = $module_info; |
@@ -62,7 +61,9 @@ discard block |
||
62 | 61 | $search_target_list = array('s_mid','s_browser_title'); |
63 | 62 | $search_target = Context::get('search_target'); |
64 | 63 | $search_keyword = Context::get('search_keyword'); |
65 | - if(in_array($search_target,$search_target_list) && $search_keyword) $args->{$search_target} = $search_keyword; |
|
64 | + if(in_array($search_target,$search_target_list) && $search_keyword) { |
|
65 | + $args->{$search_target} = $search_keyword; |
|
66 | + } |
|
66 | 67 | |
67 | 68 | $output = executeQuery('page.getPageList', $args); |
68 | 69 | $oModuleModel = getModel('module'); |
@@ -101,7 +102,9 @@ discard block |
||
101 | 102 | $module_srl = Context::get('module_srl'); |
102 | 103 | $module_info = Context::get('module_info'); |
103 | 104 | // If you do not value module_srl just showing the index page |
104 | - if(!$module_srl) return $this->dispPageAdminContent(); |
|
105 | + if(!$module_srl) { |
|
106 | + return $this->dispPageAdminContent(); |
|
107 | + } |
|
105 | 108 | // If the layout is destined to add layout information haejum (layout_title, layout) |
106 | 109 | if($module_info->layout_srl) |
107 | 110 | { |
@@ -183,8 +186,7 @@ discard block |
||
183 | 186 | $oPageMobile->module_info->mskin = $oModuleModel->getModuleDefaultSkin('page', 'M'); |
184 | 187 | } |
185 | 188 | $page_content = $oPageMobile->{$method}(); |
186 | - } |
|
187 | - else |
|
189 | + } else |
|
188 | 190 | { |
189 | 191 | return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
190 | 192 | } |
@@ -202,8 +204,7 @@ discard block |
||
202 | 204 | if ($this->module_info->page_type == 'WIDGET') |
203 | 205 | { |
204 | 206 | $this->_setWidgetTypeContentModify(true); |
205 | - } |
|
206 | - else if ($this->module_info->page_type == 'ARTICLE') |
|
207 | + } else if ($this->module_info->page_type == 'ARTICLE') |
|
207 | 208 | { |
208 | 209 | $this->_setArticleTypeContentModify(true); |
209 | 210 | } |
@@ -220,8 +221,7 @@ discard block |
||
220 | 221 | if ($this->module_info->page_type == 'WIDGET') |
221 | 222 | { |
222 | 223 | $this->_setWidgetTypeContentModify(); |
223 | - } |
|
224 | - else if ($this->module_info->page_type == 'ARTICLE') |
|
224 | + } else if ($this->module_info->page_type == 'ARTICLE') |
|
225 | 225 | { |
226 | 226 | $this->_setArticleTypeContentModify(); |
227 | 227 | } |
@@ -233,13 +233,16 @@ discard block |
||
233 | 233 | if($isMobile) |
234 | 234 | { |
235 | 235 | $content = Context::get('mcontent'); |
236 | - if(!$content) $content = $this->module_info->mcontent; |
|
236 | + if(!$content) { |
|
237 | + $content = $this->module_info->mcontent; |
|
238 | + } |
|
237 | 239 | $templateFile = 'page_mobile_content_modify'; |
238 | - } |
|
239 | - else |
|
240 | + } else |
|
240 | 241 | { |
241 | 242 | $content = Context::get('content'); |
242 | - if(!$content) $content = $this->module_info->content; |
|
243 | + if(!$content) { |
|
244 | + $content = $this->module_info->content; |
|
245 | + } |
|
243 | 246 | $templateFile = 'page_content_modify'; |
244 | 247 | } |
245 | 248 | |
@@ -271,8 +274,7 @@ discard block |
||
271 | 274 | { |
272 | 275 | Context::set('isMobile', 'Y'); |
273 | 276 | $target = 'mdocument_srl'; |
274 | - } |
|
275 | - else |
|
277 | + } else |
|
276 | 278 | { |
277 | 279 | Context::set('isMobile', 'N'); |
278 | 280 | $target = 'document_srl'; |
@@ -283,14 +285,12 @@ discard block |
||
283 | 285 | $document_srl = $this->module_info->{$target}; |
284 | 286 | $oDocument->setDocument($document_srl); |
285 | 287 | Context::set('document_srl', $document_srl); |
286 | - } |
|
287 | - else if(Context::get('document_srl')) |
|
288 | + } else if(Context::get('document_srl')) |
|
288 | 289 | { |
289 | 290 | $document_srl = Context::get('document_srl'); |
290 | 291 | $oDocument->setDocument($document_srl); |
291 | 292 | Context::set('document_srl', $document_srl); |
292 | - } |
|
293 | - else |
|
293 | + } else |
|
294 | 294 | { |
295 | 295 | $oDocument->add('module_srl', $this->module_info->module_srl); |
296 | 296 | } |
@@ -307,7 +307,9 @@ discard block |
||
307 | 307 | function dispPageAdminDelete() |
308 | 308 | { |
309 | 309 | $module_srl = Context::get('module_srl'); |
310 | - if(!$module_srl) return $this->dispContent(); |
|
310 | + if(!$module_srl) { |
|
311 | + return $this->dispContent(); |
|
312 | + } |
|
311 | 313 | |
312 | 314 | $oModuleModel = getModel('module'); |
313 | 315 | $columnList = array('module_srl', 'module', 'mid'); |