@@ -131,7 +131,7 @@ |
||
131 | 131 | * opt : notnull, default, size\n |
132 | 132 | * index : primary key, index, unique\n |
133 | 133 | * @param string $xml_doc xml schema contents |
134 | - * @return void|object |
|
134 | + * @return null|false |
|
135 | 135 | */ |
136 | 136 | function _createTable($xml_doc) |
137 | 137 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | function __construct($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if ($auto_connect) $this->_connect(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | function __connect($connection) |
45 | 45 | { |
46 | 46 | // Attempt to connect |
47 | - if($connection["db_port"]) |
|
47 | + if ($connection["db_port"]) |
|
48 | 48 | { |
49 | 49 | $result = @mysqli_connect($connection["db_hostname"] |
50 | 50 | , $connection["db_userid"] |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | , $connection["db_database"]); |
61 | 61 | } |
62 | 62 | $error = mysqli_connect_errno(); |
63 | - if($error) |
|
63 | + if ($error) |
|
64 | 64 | { |
65 | 65 | $this->setError($error, mysqli_connect_error()); |
66 | 66 | return; |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | { |
90 | 90 | $connection = $this->_getConnection('master'); |
91 | 91 | |
92 | - if(!$transactionLevel) |
|
92 | + if (!$transactionLevel) |
|
93 | 93 | { |
94 | 94 | $this->_query("begin"); |
95 | 95 | } |
96 | 96 | else |
97 | 97 | { |
98 | - $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
|
98 | + $this->_query("SAVEPOINT SP".$transactionLevel, $connection); |
|
99 | 99 | } |
100 | 100 | return true; |
101 | 101 | } |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | |
112 | 112 | $point = $transactionLevel - 1; |
113 | 113 | |
114 | - if($point) |
|
114 | + if ($point) |
|
115 | 115 | { |
116 | - $this->_query("ROLLBACK TO SP" . $point, $connection); |
|
116 | + $this->_query("ROLLBACK TO SP".$point, $connection); |
|
117 | 117 | } |
118 | 118 | else |
119 | 119 | { |
120 | 120 | mysqli_rollback($connection); |
121 | - $this->setQueryLog( array("query"=>"rollback") ); |
|
121 | + $this->setQueryLog(array("query"=>"rollback")); |
|
122 | 122 | } |
123 | 123 | return true; |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | $connection = $this->_getConnection('master'); |
134 | 134 | mysqli_commit($connection); |
135 | - $this->setQueryLog( array("query"=>"commit") ); |
|
135 | + $this->setQueryLog(array("query"=>"commit")); |
|
136 | 136 | return true; |
137 | 137 | } |
138 | 138 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function addQuotes($string) |
147 | 147 | { |
148 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
148 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
149 | 149 | { |
150 | 150 | $string = stripslashes(str_replace("\\", "\\\\", $string)); |
151 | 151 | } |
152 | - if(!is_numeric($string)) |
|
152 | + if (!is_numeric($string)) |
|
153 | 153 | { |
154 | 154 | $connection = $this->_getConnection('master'); |
155 | 155 | $string = mysqli_escape_string($connection, $string); |
@@ -166,23 +166,23 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function __query($query, $connection) |
168 | 168 | { |
169 | - if($this->use_prepared_statements == 'Y') |
|
169 | + if ($this->use_prepared_statements == 'Y') |
|
170 | 170 | { |
171 | 171 | // 1. Prepare query |
172 | 172 | $stmt = mysqli_prepare($connection, $query); |
173 | - if($stmt) |
|
173 | + if ($stmt) |
|
174 | 174 | { |
175 | 175 | $types = ''; |
176 | 176 | $params = array(); |
177 | 177 | $this->_prepareQueryParameters($types, $params); |
178 | 178 | |
179 | - if(!empty($params)) |
|
179 | + if (!empty($params)) |
|
180 | 180 | { |
181 | 181 | $args[0] = $stmt; |
182 | 182 | $args[1] = $types; |
183 | 183 | |
184 | 184 | $i = 2; |
185 | - foreach($params as $key => $param) |
|
185 | + foreach ($params as $key => $param) |
|
186 | 186 | { |
187 | 187 | $copy[$key] = $param; |
188 | 188 | $args[$i++] = &$copy[$key]; |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | |
191 | 191 | // 2. Bind parameters |
192 | 192 | $status = call_user_func_array('mysqli_stmt_bind_param', $args); |
193 | - if(!$status) |
|
193 | + if (!$status) |
|
194 | 194 | { |
195 | - $this->setError(-1, "Invalid arguments: $query" . mysqli_error($connection)); |
|
195 | + $this->setError(-1, "Invalid arguments: $query".mysqli_error($connection)); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | 199 | // 3. Execute query |
200 | 200 | $status = mysqli_stmt_execute($stmt); |
201 | 201 | |
202 | - if(!$status) |
|
202 | + if (!$status) |
|
203 | 203 | { |
204 | - $this->setError(-1, "Prepared statement failed: $query" . mysqli_error($connection)); |
|
204 | + $this->setError(-1, "Prepared statement failed: $query".mysqli_error($connection)); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | // Return stmt for other processing - like retrieving resultset (_fetch) |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $result = mysqli_query($connection, $query); |
214 | 214 | // Error Check |
215 | 215 | $error = mysqli_error($connection); |
216 | - if($error) |
|
216 | + if ($error) |
|
217 | 217 | { |
218 | 218 | $this->setError(mysqli_errno($connection), $error); |
219 | 219 | } |
@@ -232,23 +232,23 @@ discard block |
||
232 | 232 | { |
233 | 233 | $types = ''; |
234 | 234 | $params = array(); |
235 | - if(!$this->param) |
|
235 | + if (!$this->param) |
|
236 | 236 | { |
237 | 237 | return; |
238 | 238 | } |
239 | 239 | |
240 | - foreach($this->param as $k => $o) |
|
240 | + foreach ($this->param as $k => $o) |
|
241 | 241 | { |
242 | 242 | $value = $o->getUnescapedValue(); |
243 | 243 | $type = $o->getType(); |
244 | 244 | |
245 | 245 | // Skip column names -> this should be concatenated to query string |
246 | - if($o->isColumnName()) |
|
246 | + if ($o->isColumnName()) |
|
247 | 247 | { |
248 | 248 | continue; |
249 | 249 | } |
250 | 250 | |
251 | - switch($type) |
|
251 | + switch ($type) |
|
252 | 252 | { |
253 | 253 | case 'number' : |
254 | 254 | $type = 'i'; |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | $type = 's'; |
261 | 261 | } |
262 | 262 | |
263 | - if(is_array($value)) |
|
263 | + if (is_array($value)) |
|
264 | 264 | { |
265 | - foreach($value as $v) |
|
265 | + foreach ($value as $v) |
|
266 | 266 | { |
267 | 267 | $params[] = $v; |
268 | 268 | $types .= $type; |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function _fetch($result, $arrayIndexEndValue = NULL) |
286 | 286 | { |
287 | - if($this->use_prepared_statements != 'Y') |
|
287 | + if ($this->use_prepared_statements != 'Y') |
|
288 | 288 | { |
289 | 289 | return parent::_fetch($result, $arrayIndexEndValue); |
290 | 290 | } |
291 | 291 | $output = array(); |
292 | - if(!$this->isConnected() || $this->isError() || !$result) |
|
292 | + if (!$this->isConnected() || $this->isError() || !$result) |
|
293 | 293 | { |
294 | 294 | return $output; |
295 | 295 | } |
@@ -305,25 +305,25 @@ discard block |
||
305 | 305 | * MYSQLI_TYPE for longtext is 252 |
306 | 306 | */ |
307 | 307 | $longtext_exists = false; |
308 | - foreach($fields as $field) |
|
308 | + foreach ($fields as $field) |
|
309 | 309 | { |
310 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
310 | + if (isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
311 | 311 | { |
312 | - $field->name = 'repeat_' . $field->name; |
|
312 | + $field->name = 'repeat_'.$field->name; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | // Array passed needs to contain references, not values |
316 | 316 | $row[$field->name] = ""; |
317 | 317 | $resultArray[$field->name] = &$row[$field->name]; |
318 | 318 | |
319 | - if($field->type == 252) |
|
319 | + if ($field->type == 252) |
|
320 | 320 | { |
321 | 321 | $longtext_exists = true; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | $resultArray = array_merge(array($stmt), $resultArray); |
325 | 325 | |
326 | - if($longtext_exists) |
|
326 | + if ($longtext_exists) |
|
327 | 327 | { |
328 | 328 | mysqli_stmt_store_result($stmt); |
329 | 329 | } |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | call_user_func_array('mysqli_stmt_bind_result', $resultArray); |
332 | 332 | |
333 | 333 | $rows = array(); |
334 | - while(mysqli_stmt_fetch($stmt)) |
|
334 | + while (mysqli_stmt_fetch($stmt)) |
|
335 | 335 | { |
336 | 336 | $resultObject = new stdClass(); |
337 | 337 | |
338 | - foreach($resultArray as $key => $value) |
|
338 | + foreach ($resultArray as $key => $value) |
|
339 | 339 | { |
340 | - if($key === 0) |
|
340 | + if ($key === 0) |
|
341 | 341 | { |
342 | 342 | continue; // Skip stmt object |
343 | 343 | } |
344 | - if(strpos($key, 'repeat_')) |
|
344 | + if (strpos($key, 'repeat_')) |
|
345 | 345 | { |
346 | 346 | $key = substr($key, 6); |
347 | 347 | } |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | |
354 | 354 | mysqli_stmt_close($stmt); |
355 | 355 | |
356 | - if($arrayIndexEndValue) |
|
356 | + if ($arrayIndexEndValue) |
|
357 | 357 | { |
358 | - foreach($rows as $row) |
|
358 | + foreach ($rows as $row) |
|
359 | 359 | { |
360 | 360 | $output[$arrayIndexEndValue--] = $row; |
361 | 361 | } |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | $output = $rows; |
366 | 366 | } |
367 | 367 | |
368 | - if(count($output) == 1) |
|
368 | + if (count($output) == 1) |
|
369 | 369 | { |
370 | - if(isset($arrayIndexEndValue)) |
|
370 | + if (isset($arrayIndexEndValue)) |
|
371 | 371 | { |
372 | 372 | return $output; |
373 | 373 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | function _executeInsertAct($queryObject, $with_values = false) |
390 | 390 | { |
391 | - if($this->use_prepared_statements != 'Y') |
|
391 | + if ($this->use_prepared_statements != 'Y') |
|
392 | 392 | { |
393 | 393 | return parent::_executeInsertAct($queryObject); |
394 | 394 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function _executeUpdateAct($queryObject, $with_values = false) |
408 | 408 | { |
409 | - if($this->use_prepared_statements != 'Y') |
|
409 | + if ($this->use_prepared_statements != 'Y') |
|
410 | 410 | { |
411 | 411 | return parent::_executeUpdateAct($queryObject); |
412 | 412 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | */ |
425 | 425 | function _executeDeleteAct($queryObject, $with_values = false) |
426 | 426 | { |
427 | - if($this->use_prepared_statements != 'Y') |
|
427 | + if ($this->use_prepared_statements != 'Y') |
|
428 | 428 | { |
429 | 429 | return parent::_executeDeleteAct($queryObject); |
430 | 430 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | function _executeSelectAct($queryObject, $connection = null, $with_values = false) |
447 | 447 | { |
448 | - if($this->use_prepared_statements != 'Y') |
|
448 | + if ($this->use_prepared_statements != 'Y') |
|
449 | 449 | { |
450 | 450 | return parent::_executeSelectAct($queryObject, $connection); |
451 | 451 | } |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | $xml_obj = $oXml->parse($xml_doc); |
504 | 504 | // Create a table schema |
505 | 505 | $table_name = $xml_obj->table->attrs->name; |
506 | - if($this->isTableExists($table_name)) |
|
506 | + if ($this->isTableExists($table_name)) |
|
507 | 507 | { |
508 | 508 | return; |
509 | 509 | } |
510 | - $table_name = $this->prefix . $table_name; |
|
510 | + $table_name = $this->prefix.$table_name; |
|
511 | 511 | |
512 | - if(!is_array($xml_obj->table->column)) |
|
512 | + if (!is_array($xml_obj->table->column)) |
|
513 | 513 | { |
514 | 514 | $columns[] = $xml_obj->table->column; |
515 | 515 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $columns = $xml_obj->table->column; |
519 | 519 | } |
520 | 520 | |
521 | - foreach($columns as $column) |
|
521 | + foreach ($columns as $column) |
|
522 | 522 | { |
523 | 523 | $name = $column->attrs->name; |
524 | 524 | $type = $column->attrs->type; |
@@ -530,47 +530,47 @@ discard block |
||
530 | 530 | $default = $column->attrs->default; |
531 | 531 | $auto_increment = $column->attrs->auto_increment; |
532 | 532 | |
533 | - $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
533 | + $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
534 | 534 | |
535 | - if($primary_key) |
|
535 | + if ($primary_key) |
|
536 | 536 | { |
537 | 537 | $primary_list[] = $name; |
538 | 538 | } |
539 | - else if($unique) |
|
539 | + else if ($unique) |
|
540 | 540 | { |
541 | 541 | $unique_list[$unique][] = $name; |
542 | 542 | } |
543 | - else if($index) |
|
543 | + else if ($index) |
|
544 | 544 | { |
545 | 545 | $index_list[$index][] = $name; |
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
549 | - if(count($primary_list)) |
|
549 | + if (count($primary_list)) |
|
550 | 550 | { |
551 | - $column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`'); |
|
551 | + $column_schema[] = sprintf("primary key (%s)", '`'.implode($primary_list, '`,`').'`'); |
|
552 | 552 | } |
553 | 553 | |
554 | - if(count($unique_list)) |
|
554 | + if (count($unique_list)) |
|
555 | 555 | { |
556 | - foreach($unique_list as $key => $val) |
|
556 | + foreach ($unique_list as $key => $val) |
|
557 | 557 | { |
558 | - $column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
558 | + $column_schema[] = sprintf("unique %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | - if(count($index_list)) |
|
562 | + if (count($index_list)) |
|
563 | 563 | { |
564 | - foreach($index_list as $key => $val) |
|
564 | + foreach ($index_list as $key => $val) |
|
565 | 565 | { |
566 | - $column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
566 | + $column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | 570 | $schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci"); |
571 | 571 | |
572 | 572 | $output = $this->_query($schema); |
573 | - if(!$output) |
|
573 | + if (!$output) |
|
574 | 574 | { |
575 | 575 | return false; |
576 | 576 | } |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | function __construct($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if($auto_connect) { |
|
27 | + $this->_connect(); |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | |
29 | 31 | /** |
@@ -51,8 +53,7 @@ discard block |
||
51 | 53 | , $connection["db_password"] |
52 | 54 | , $connection["db_database"] |
53 | 55 | , $connection["db_port"]); |
54 | - } |
|
55 | - else |
|
56 | + } else |
|
56 | 57 | { |
57 | 58 | $result = @mysqli_connect($connection["db_hostname"] |
58 | 59 | , $connection["db_userid"] |
@@ -92,8 +93,7 @@ discard block |
||
92 | 93 | if(!$transactionLevel) |
93 | 94 | { |
94 | 95 | $this->_query("begin"); |
95 | - } |
|
96 | - else |
|
96 | + } else |
|
97 | 97 | { |
98 | 98 | $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
99 | 99 | } |
@@ -114,8 +114,7 @@ discard block |
||
114 | 114 | if($point) |
115 | 115 | { |
116 | 116 | $this->_query("ROLLBACK TO SP" . $point, $connection); |
117 | - } |
|
118 | - else |
|
117 | + } else |
|
119 | 118 | { |
120 | 119 | mysqli_rollback($connection); |
121 | 120 | $this->setQueryLog( array("query"=>"rollback") ); |
@@ -267,8 +266,7 @@ discard block |
||
267 | 266 | $params[] = $v; |
268 | 267 | $types .= $type; |
269 | 268 | } |
270 | - } |
|
271 | - else |
|
269 | + } else |
|
272 | 270 | { |
273 | 271 | $params[] = $value; |
274 | 272 | $types .= $type; |
@@ -307,10 +305,12 @@ discard block |
||
307 | 305 | $longtext_exists = false; |
308 | 306 | foreach($fields as $field) |
309 | 307 | { |
310 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
308 | + if(isset($resultArray[$field->name])) { |
|
309 | + // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
311 | 310 | { |
312 | 311 | $field->name = 'repeat_' . $field->name; |
313 | 312 | } |
313 | + } |
|
314 | 314 | |
315 | 315 | // Array passed needs to contain references, not values |
316 | 316 | $row[$field->name] = ""; |
@@ -359,8 +359,7 @@ discard block |
||
359 | 359 | { |
360 | 360 | $output[$arrayIndexEndValue--] = $row; |
361 | 361 | } |
362 | - } |
|
363 | - else |
|
362 | + } else |
|
364 | 363 | { |
365 | 364 | $output = $rows; |
366 | 365 | } |
@@ -370,8 +369,7 @@ discard block |
||
370 | 369 | if(isset($arrayIndexEndValue)) |
371 | 370 | { |
372 | 371 | return $output; |
373 | - } |
|
374 | - else |
|
372 | + } else |
|
375 | 373 | { |
376 | 374 | return $output[0]; |
377 | 375 | } |
@@ -512,8 +510,7 @@ discard block |
||
512 | 510 | if(!is_array($xml_obj->table->column)) |
513 | 511 | { |
514 | 512 | $columns[] = $xml_obj->table->column; |
515 | - } |
|
516 | - else |
|
513 | + } else |
|
517 | 514 | { |
518 | 515 | $columns = $xml_obj->table->column; |
519 | 516 | } |
@@ -535,12 +532,10 @@ discard block |
||
535 | 532 | if($primary_key) |
536 | 533 | { |
537 | 534 | $primary_list[] = $name; |
538 | - } |
|
539 | - else if($unique) |
|
535 | + } else if($unique) |
|
540 | 536 | { |
541 | 537 | $unique_list[$unique][] = $name; |
542 | - } |
|
543 | - else if($index) |
|
538 | + } else if($index) |
|
544 | 539 | { |
545 | 540 | $index_list[$index][] = $name; |
546 | 541 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | /** |
167 | 167 | * Method to retrieve an object containing a key/value pairs |
168 | 168 | * |
169 | - * @return BaseObject Returns an object containing key/value pairs |
|
169 | + * @return stdClass Returns an object containing key/value pairs |
|
170 | 170 | */ |
171 | 171 | function gets() |
172 | 172 | { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | /** |
193 | 193 | * Method to retrieve an object of key/value pairs |
194 | 194 | * |
195 | - * @return BaseObject |
|
195 | + * @return stdClass |
|
196 | 196 | */ |
197 | 197 | function getObjectVars() |
198 | 198 | { |
@@ -99,8 +99,7 @@ |
||
99 | 99 | if($str = Context::getLang($message)) |
100 | 100 | { |
101 | 101 | $this->message = $str; |
102 | - } |
|
103 | - else |
|
102 | + } else |
|
104 | 103 | { |
105 | 104 | $this->message = $message; |
106 | 105 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | function setMessage($message = 'success', $type = NULL) |
97 | 97 | { |
98 | - if($str = Context::getLang($message)) |
|
98 | + if ($str = Context::getLang($message)) |
|
99 | 99 | { |
100 | 100 | $this->message = $str; |
101 | 101 | } |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | */ |
139 | 139 | function adds($object) |
140 | 140 | { |
141 | - if(is_object($object)) |
|
141 | + if (is_object($object)) |
|
142 | 142 | { |
143 | 143 | $object = get_object_vars($object); |
144 | 144 | } |
145 | 145 | |
146 | - if(is_array($object)) |
|
146 | + if (is_array($object)) |
|
147 | 147 | { |
148 | - foreach($object as $key => $val) |
|
148 | + foreach ($object as $key => $val) |
|
149 | 149 | { |
150 | 150 | $this->variables[$key] = $val; |
151 | 151 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | { |
173 | 173 | $args = func_get_args(); |
174 | 174 | $output = new stdClass(); |
175 | - foreach($args as $arg) |
|
175 | + foreach ($args as $arg) |
|
176 | 176 | { |
177 | 177 | $output->{$arg} = $this->get($arg); |
178 | 178 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | function getObjectVars() |
198 | 198 | { |
199 | 199 | $output = new stdClass(); |
200 | - foreach($this->variables as $key => $val) |
|
200 | + foreach ($this->variables as $key => $val) |
|
201 | 201 | { |
202 | 202 | $output->{$key} = $val; |
203 | 203 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | -if(version_compare(PHP_VERSION, '7.2', '<') && !class_exists('Object', false)) |
|
229 | +if (version_compare(PHP_VERSION, '7.2', '<') && !class_exists('Object', false)) |
|
230 | 230 | { |
231 | 231 | class_alias('BaseObject', 'Object'); |
232 | 232 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | /** |
15 | 15 | * initialization |
16 | - * @return void |
|
16 | + * @return ModuleObject|null |
|
17 | 17 | */ |
18 | 18 | function init() |
19 | 19 | { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Regenerate all cache files |
55 | - * @return void |
|
55 | + * @return BaseObject|null |
|
56 | 56 | */ |
57 | 57 | function procAdminRecompileCacheFile() |
58 | 58 | { |
@@ -156,6 +156,9 @@ discard block |
||
156 | 156 | return $this->setRedirectUrl(Context::get('error_return_url'), $output); |
157 | 157 | } |
158 | 158 | |
159 | + /** |
|
160 | + * @param BaseObject $vars |
|
161 | + */ |
|
159 | 162 | public function updateDefaultDesignInfo($vars) |
160 | 163 | { |
161 | 164 | $siteDesignPath = _XE_PATH_ . 'files/site_design/'; |
@@ -207,6 +210,9 @@ discard block |
||
207 | 210 | return new BaseObject(); |
208 | 211 | } |
209 | 212 | |
213 | + /** |
|
214 | + * @param stdClass $designInfo |
|
215 | + */ |
|
210 | 216 | function makeDefaultDesignFile($designInfo, $site_srl = 0) |
211 | 217 | { |
212 | 218 | $buff = array(); |
@@ -433,6 +439,8 @@ discard block |
||
433 | 439 | |
434 | 440 | /** |
435 | 441 | * Insert favorite |
442 | + * @param string $siteSrl |
|
443 | + * @param string $module |
|
436 | 444 | * @return object query result |
437 | 445 | */ |
438 | 446 | function _insertFavorite($siteSrl, $module, $type = 'module') |
@@ -471,7 +479,7 @@ discard block |
||
471 | 479 | |
472 | 480 | /** |
473 | 481 | * Remove admin icon |
474 | - * @return object|void |
|
482 | + * @return BaseObject|null |
|
475 | 483 | */ |
476 | 484 | function procAdminRemoveIcons() |
477 | 485 | { |
@@ -181,8 +181,7 @@ discard block |
||
181 | 181 | if(is_readable($siteDesignFile)) |
182 | 182 | { |
183 | 183 | include($siteDesignFile); |
184 | - } |
|
185 | - else |
|
184 | + } else |
|
186 | 185 | { |
187 | 186 | $designInfo = new stdClass(); |
188 | 187 | } |
@@ -198,7 +197,9 @@ discard block |
||
198 | 197 | $moduleName = 'page'; |
199 | 198 | } |
200 | 199 | |
201 | - if(!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass(); |
|
200 | + if(!isset($designInfo->module->{$moduleName})) { |
|
201 | + $designInfo->module->{$moduleName} = new stdClass(); |
|
202 | + } |
|
202 | 203 | $designInfo->module->{$moduleName}->{$skinTarget} = $skinName; |
203 | 204 | } |
204 | 205 | |
@@ -337,8 +338,7 @@ discard block |
||
337 | 338 | if($isAgree == 'true') |
338 | 339 | { |
339 | 340 | $_SESSION['enviroment_gather'] = 'Y'; |
340 | - } |
|
341 | - else |
|
341 | + } else |
|
342 | 342 | { |
343 | 343 | $_SESSION['enviroment_gather'] = 'N'; |
344 | 344 | } |
@@ -374,12 +374,10 @@ discard block |
||
374 | 374 | if($type == 3) |
375 | 375 | { |
376 | 376 | $ext = 'png'; |
377 | - } |
|
378 | - elseif($type == 2) |
|
377 | + } elseif($type == 2) |
|
379 | 378 | { |
380 | 379 | $ext = 'jpg'; |
381 | - } |
|
382 | - else |
|
380 | + } else |
|
383 | 381 | { |
384 | 382 | $ext = 'gif'; |
385 | 383 | } |
@@ -392,8 +390,7 @@ discard block |
||
392 | 390 | if($adminTitle) |
393 | 391 | { |
394 | 392 | $oAdminConfig->adminTitle = strip_tags($adminTitle); |
395 | - } |
|
396 | - else |
|
393 | + } else |
|
397 | 394 | { |
398 | 395 | unset($oAdminConfig->adminTitle); |
399 | 396 | } |
@@ -488,8 +485,7 @@ discard block |
||
488 | 485 | if($file_exist) |
489 | 486 | { |
490 | 487 | @FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
491 | - } |
|
492 | - else |
|
488 | + } else |
|
493 | 489 | { |
494 | 490 | return new BaseObject(-1, 'fail_to_delete'); |
495 | 491 | } |
@@ -533,7 +529,9 @@ discard block |
||
533 | 529 | if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON'))) |
534 | 530 | { |
535 | 531 | $returnUrl = Context::get('success_return_url'); |
536 | - if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
532 | + if(!$returnUrl) { |
|
533 | + $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
534 | + } |
|
537 | 535 | header('location:' . $returnUrl); |
538 | 536 | return; |
539 | 537 | } |
@@ -577,7 +575,9 @@ discard block |
||
577 | 575 | if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON'))) |
578 | 576 | { |
579 | 577 | $returnUrl = Context::get('success_return_url'); |
580 | - if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
578 | + if(!$returnUrl) { |
|
579 | + $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
580 | + } |
|
581 | 581 | header('location:' . $returnUrl); |
582 | 582 | return; |
583 | 583 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | // forbit access if the user is not an administrator |
21 | 21 | $oMemberModel = getModel('member'); |
22 | 22 | $logged_info = $oMemberModel->getLoggedInfo(); |
23 | - if($logged_info->is_admin != 'Y') |
|
23 | + if ($logged_info->is_admin != 'Y') |
|
24 | 24 | { |
25 | 25 | return $this->stop("msg_is_not_administrator"); |
26 | 26 | } |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | function procAdminMenuReset() |
34 | 34 | { |
35 | 35 | $menuSrl = Context::get('menu_srl'); |
36 | - if(!$menuSrl) |
|
36 | + if (!$menuSrl) |
|
37 | 37 | { |
38 | 38 | return $this->stop('msg_invalid_request'); |
39 | 39 | } |
40 | 40 | |
41 | 41 | $oMenuAdminController = getAdminController('menu'); |
42 | 42 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
43 | - if($oCacheHandler->isSupport()) |
|
43 | + if ($oCacheHandler->isSupport()) |
|
44 | 44 | { |
45 | - $cache_key = 'admin_menu_langs:' . Context::getLangType(); |
|
45 | + $cache_key = 'admin_menu_langs:'.Context::getLangType(); |
|
46 | 46 | $oCacheHandler->delete($cache_key); |
47 | 47 | } |
48 | 48 | $output = $oMenuAdminController->deleteMenu($menuSrl); |
49 | - if(!$output->toBool()) |
|
49 | + if (!$output->toBool()) |
|
50 | 50 | { |
51 | 51 | return $output; |
52 | 52 | } |
@@ -63,30 +63,30 @@ discard block |
||
63 | 63 | function procAdminRecompileCacheFile() |
64 | 64 | { |
65 | 65 | // rename cache dir |
66 | - $temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME']; |
|
66 | + $temp_cache_dir = './files/cache_'.$_SERVER['REQUEST_TIME']; |
|
67 | 67 | FileHandler::rename('./files/cache', $temp_cache_dir); |
68 | 68 | FileHandler::makeDir('./files/cache'); |
69 | 69 | |
70 | 70 | // remove module extend cache |
71 | - FileHandler::removeFile(_XE_PATH_ . 'files/config/module_extend.php'); |
|
71 | + FileHandler::removeFile(_XE_PATH_.'files/config/module_extend.php'); |
|
72 | 72 | |
73 | 73 | // remove debug files |
74 | - FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php'); |
|
75 | - FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php'); |
|
76 | - FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_query.php'); |
|
77 | - FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_trigger.php'); |
|
78 | - FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_addon.php'); |
|
79 | - FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_widget.php'); |
|
74 | + FileHandler::removeFile(_XE_PATH_.'files/_debug_message.php'); |
|
75 | + FileHandler::removeFile(_XE_PATH_.'files/_debug_db_query.php'); |
|
76 | + FileHandler::removeFile(_XE_PATH_.'files/_slowlog_query.php'); |
|
77 | + FileHandler::removeFile(_XE_PATH_.'files/_slowlog_trigger.php'); |
|
78 | + FileHandler::removeFile(_XE_PATH_.'files/_slowlog_addon.php'); |
|
79 | + FileHandler::removeFile(_XE_PATH_.'files/_slowlog_widget.php'); |
|
80 | 80 | |
81 | 81 | $oModuleModel = getModel('module'); |
82 | 82 | $module_list = $oModuleModel->getModuleList(); |
83 | 83 | |
84 | 84 | // call recompileCache for each module |
85 | - foreach($module_list as $module) |
|
85 | + foreach ($module_list as $module) |
|
86 | 86 | { |
87 | 87 | $oModule = NULL; |
88 | 88 | $oModule = getClass($module->module); |
89 | - if(method_exists($oModule, 'recompileCache')) |
|
89 | + if (method_exists($oModule, 'recompileCache')) |
|
90 | 90 | { |
91 | 91 | $oModule->recompileCache(); |
92 | 92 | } |
@@ -97,37 +97,37 @@ discard block |
||
97 | 97 | $oObjectCacheHandler = CacheHandler::getInstance('object'); |
98 | 98 | $oTemplateCacheHandler = CacheHandler::getInstance('template'); |
99 | 99 | |
100 | - if($oObjectCacheHandler->isSupport()) |
|
100 | + if ($oObjectCacheHandler->isSupport()) |
|
101 | 101 | { |
102 | 102 | $truncated[] = $oObjectCacheHandler->truncate(); |
103 | 103 | } |
104 | 104 | |
105 | - if($oTemplateCacheHandler->isSupport()) |
|
105 | + if ($oTemplateCacheHandler->isSupport()) |
|
106 | 106 | { |
107 | 107 | $truncated[] = $oTemplateCacheHandler->truncate(); |
108 | 108 | } |
109 | 109 | |
110 | - if(count($truncated) && in_array(FALSE, $truncated)) |
|
110 | + if (count($truncated) && in_array(FALSE, $truncated)) |
|
111 | 111 | { |
112 | 112 | return new BaseObject(-1, 'msg_self_restart_cache_engine'); |
113 | 113 | } |
114 | 114 | |
115 | 115 | // remove cache dir |
116 | 116 | $tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/'); |
117 | - if($tmp_cache_list) |
|
117 | + if ($tmp_cache_list) |
|
118 | 118 | { |
119 | - foreach($tmp_cache_list as $tmp_dir) |
|
119 | + foreach ($tmp_cache_list as $tmp_dir) |
|
120 | 120 | { |
121 | - if($tmp_dir) |
|
121 | + if ($tmp_dir) |
|
122 | 122 | { |
123 | - FileHandler::removeDir('./files/' . $tmp_dir); |
|
123 | + FileHandler::removeDir('./files/'.$tmp_dir); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | 128 | // remove duplicate indexes (only for CUBRID) |
129 | 129 | $db_type = Context::getDBType(); |
130 | - if($db_type == 'cubrid') |
|
130 | + if ($db_type == 'cubrid') |
|
131 | 131 | { |
132 | 132 | $db = DB::getInstance(); |
133 | 133 | $db->deleteDuplicateIndexes(); |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | $oMemberController = getController('member'); |
150 | 150 | $oMemberController->procMemberLogout(); |
151 | 151 | |
152 | - header('Location: ' . getNotEncodedUrl('', 'module', 'admin')); |
|
152 | + header('Location: '.getNotEncodedUrl('', 'module', 'admin')); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | public function procAdminInsertDefaultDesignInfo() |
156 | 156 | { |
157 | 157 | $vars = Context::getRequestVars(); |
158 | - if(!$vars->site_srl) |
|
158 | + if (!$vars->site_srl) |
|
159 | 159 | { |
160 | 160 | $vars->site_srl = 0; |
161 | 161 | } |
@@ -167,27 +167,27 @@ discard block |
||
167 | 167 | |
168 | 168 | public function updateDefaultDesignInfo($vars) |
169 | 169 | { |
170 | - $siteDesignPath = _XE_PATH_ . 'files/site_design/'; |
|
170 | + $siteDesignPath = _XE_PATH_.'files/site_design/'; |
|
171 | 171 | |
172 | 172 | $vars->module_skin = json_decode($vars->module_skin); |
173 | 173 | |
174 | - if(!is_dir($siteDesignPath)) |
|
174 | + if (!is_dir($siteDesignPath)) |
|
175 | 175 | { |
176 | 176 | FileHandler::makeDir($siteDesignPath); |
177 | 177 | } |
178 | 178 | |
179 | - $siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $vars->site_srl . '.php'; |
|
179 | + $siteDesignFile = _XE_PATH_.'files/site_design/design_'.$vars->site_srl.'.php'; |
|
180 | 180 | |
181 | 181 | $layoutTarget = 'layout_srl'; |
182 | 182 | $skinTarget = 'skin'; |
183 | 183 | |
184 | - if($vars->target_type == 'M') |
|
184 | + if ($vars->target_type == 'M') |
|
185 | 185 | { |
186 | 186 | $layoutTarget = 'mlayout_srl'; |
187 | 187 | $skinTarget = 'mskin'; |
188 | 188 | } |
189 | 189 | |
190 | - if(is_readable($siteDesignFile)) |
|
190 | + if (is_readable($siteDesignFile)) |
|
191 | 191 | { |
192 | 192 | include($siteDesignFile); |
193 | 193 | } |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | |
201 | 201 | $designInfo->{$layoutTarget} = $layoutSrl; |
202 | 202 | |
203 | - foreach($vars->module_skin as $moduleName => $skinName) |
|
203 | + foreach ($vars->module_skin as $moduleName => $skinName) |
|
204 | 204 | { |
205 | - if($moduleName == 'ARTICLE') |
|
205 | + if ($moduleName == 'ARTICLE') |
|
206 | 206 | { |
207 | 207 | $moduleName = 'page'; |
208 | 208 | } |
209 | 209 | |
210 | - if(!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass(); |
|
210 | + if (!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass(); |
|
211 | 211 | $designInfo->module->{$moduleName}->{$skinTarget} = $skinName; |
212 | 212 | } |
213 | 213 | |
@@ -222,28 +222,28 @@ discard block |
||
222 | 222 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
223 | 223 | $buff[] = '$designInfo = new stdClass;'; |
224 | 224 | |
225 | - if($designInfo->layout_srl) |
|
225 | + if ($designInfo->layout_srl) |
|
226 | 226 | { |
227 | 227 | $buff[] = sprintf('$designInfo->layout_srl = %s; ', $designInfo->layout_srl); |
228 | 228 | } |
229 | 229 | |
230 | - if($designInfo->mlayout_srl) |
|
230 | + if ($designInfo->mlayout_srl) |
|
231 | 231 | { |
232 | 232 | $buff[] = sprintf('$designInfo->mlayout_srl = %s;', $designInfo->mlayout_srl); |
233 | 233 | } |
234 | 234 | |
235 | 235 | $buff[] = '$designInfo->module = new stdClass;'; |
236 | 236 | |
237 | - foreach($designInfo->module as $moduleName => $skinInfo) |
|
237 | + foreach ($designInfo->module as $moduleName => $skinInfo) |
|
238 | 238 | { |
239 | 239 | $buff[] = sprintf('$designInfo->module->%s = new stdClass;', $moduleName); |
240 | - foreach($skinInfo as $target => $skinName) |
|
240 | + foreach ($skinInfo as $target => $skinName) |
|
241 | 241 | { |
242 | 242 | $buff[] = sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName); |
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | - $siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $site_srl . '.php'; |
|
246 | + $siteDesignFile = _XE_PATH_.'files/site_design/design_'.$site_srl.'.php'; |
|
247 | 247 | FileHandler::writeFile($siteDesignFile, implode(PHP_EOL, $buff)); |
248 | 248 | } |
249 | 249 | |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | // check favorite exists |
260 | 260 | $oModel = getAdminModel('admin'); |
261 | 261 | $output = $oModel->isExistsFavorite($siteSrl, $moduleName); |
262 | - if(!$output->toBool()) |
|
262 | + if (!$output->toBool()) |
|
263 | 263 | { |
264 | 264 | return $output; |
265 | 265 | } |
266 | 266 | |
267 | 267 | // if exists, delete favorite |
268 | - if($output->get('result')) |
|
268 | + if ($output->get('result')) |
|
269 | 269 | { |
270 | 270 | $favoriteSrl = $output->get('favoriteSrl'); |
271 | 271 | $output = $this->_deleteFavorite($favoriteSrl); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $result = 'on'; |
279 | 279 | } |
280 | 280 | |
281 | - if(!$output->toBool()) |
|
281 | + if (!$output->toBool()) |
|
282 | 282 | { |
283 | 283 | return $output; |
284 | 284 | } |
@@ -296,31 +296,31 @@ discard block |
||
296 | 296 | { |
297 | 297 | $oModel = getAdminModel('admin'); |
298 | 298 | $output = $oModel->getFavoriteList(); |
299 | - if(!$output->toBool()) |
|
299 | + if (!$output->toBool()) |
|
300 | 300 | { |
301 | 301 | return $output; |
302 | 302 | } |
303 | 303 | |
304 | 304 | $favoriteList = $output->get('favoriteList'); |
305 | - if(!$favoriteList) |
|
305 | + if (!$favoriteList) |
|
306 | 306 | { |
307 | 307 | return new BaseObject(); |
308 | 308 | } |
309 | 309 | |
310 | 310 | $deleteTargets = array(); |
311 | - foreach($favoriteList as $favorite) |
|
311 | + foreach ($favoriteList as $favorite) |
|
312 | 312 | { |
313 | - if($favorite->type == 'module') |
|
313 | + if ($favorite->type == 'module') |
|
314 | 314 | { |
315 | - $modulePath = _XE_PATH_ . 'modules/' . $favorite->module; |
|
316 | - if(!is_dir($modulePath)) |
|
315 | + $modulePath = _XE_PATH_.'modules/'.$favorite->module; |
|
316 | + if (!is_dir($modulePath)) |
|
317 | 317 | { |
318 | 318 | $deleteTargets[] = $favorite->admin_favorite_srl; |
319 | 319 | } |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - if(!count($deleteTargets)) |
|
323 | + if (!count($deleteTargets)) |
|
324 | 324 | { |
325 | 325 | return new BaseObject(); |
326 | 326 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $args = new stdClass(); |
329 | 329 | $args->admin_favorite_srls = $deleteTargets; |
330 | 330 | $output = executeQuery('admin.deleteFavorites', $args); |
331 | - if(!$output->toBool()) |
|
331 | + if (!$output->toBool()) |
|
332 | 332 | { |
333 | 333 | return $output; |
334 | 334 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | function procAdminEnviromentGatheringAgreement() |
344 | 344 | { |
345 | 345 | $isAgree = Context::get('is_agree'); |
346 | - if($isAgree == 'true') |
|
346 | + if ($isAgree == 'true') |
|
347 | 347 | { |
348 | 348 | $_SESSION['enviroment_gather'] = 'Y'; |
349 | 349 | } |
@@ -368,23 +368,23 @@ discard block |
||
368 | 368 | $oModuleModel = getModel('module'); |
369 | 369 | $oAdminConfig = $oModuleModel->getModuleConfig('admin'); |
370 | 370 | |
371 | - if(!is_object($oAdminConfig)) |
|
371 | + if (!is_object($oAdminConfig)) |
|
372 | 372 | { |
373 | 373 | $oAdminConfig = new stdClass(); |
374 | 374 | } |
375 | 375 | |
376 | - if($file['tmp_name']) |
|
376 | + if ($file['tmp_name']) |
|
377 | 377 | { |
378 | 378 | $target_path = 'files/attach/images/admin/'; |
379 | 379 | FileHandler::makeDir($target_path); |
380 | 380 | |
381 | 381 | // Get file information |
382 | 382 | list($width, $height, $type, $attrs) = @getimagesize($file['tmp_name']); |
383 | - if($type == 3) |
|
383 | + if ($type == 3) |
|
384 | 384 | { |
385 | 385 | $ext = 'png'; |
386 | 386 | } |
387 | - elseif($type == 2) |
|
387 | + elseif ($type == 2) |
|
388 | 388 | { |
389 | 389 | $ext = 'jpg'; |
390 | 390 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | |
399 | 399 | $oAdminConfig->adminLogo = $target_filename; |
400 | 400 | } |
401 | - if($adminTitle) |
|
401 | + if ($adminTitle) |
|
402 | 402 | { |
403 | 403 | $oAdminConfig->adminTitle = strip_tags($adminTitle); |
404 | 404 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | unset($oAdminConfig->adminTitle); |
408 | 408 | } |
409 | 409 | |
410 | - if($oAdminConfig) |
|
410 | + if ($oAdminConfig) |
|
411 | 411 | { |
412 | 412 | $oModuleController = getController('module'); |
413 | 413 | $oModuleController->insertModuleConfig('admin', $oAdminConfig); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $oModuleModel = getModel('module'); |
429 | 429 | $oAdminConfig = $oModuleModel->getModuleConfig('admin'); |
430 | 430 | |
431 | - FileHandler::removeFile(_XE_PATH_ . $oAdminConfig->adminLogo); |
|
431 | + FileHandler::removeFile(_XE_PATH_.$oAdminConfig->adminLogo); |
|
432 | 432 | unset($oAdminConfig->adminLogo); |
433 | 433 | |
434 | 434 | $oModuleController = getController('module'); |
@@ -487,16 +487,16 @@ discard block |
||
487 | 487 | |
488 | 488 | $site_info = Context::get('site_module_info'); |
489 | 489 | $virtual_site = ''; |
490 | - if($site_info->site_srl) |
|
490 | + if ($site_info->site_srl) |
|
491 | 491 | { |
492 | - $virtual_site = $site_info->site_srl . '/'; |
|
492 | + $virtual_site = $site_info->site_srl.'/'; |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | $iconname = Context::get('iconname'); |
496 | - $file_exist = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
|
497 | - if($file_exist) |
|
496 | + $file_exist = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname); |
|
497 | + if ($file_exist) |
|
498 | 498 | { |
499 | - @FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
|
499 | + @FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname); |
|
500 | 500 | } |
501 | 501 | else |
502 | 502 | { |
@@ -517,33 +517,33 @@ discard block |
||
517 | 517 | $db_info->sitelock_message = $vars->sitelock_message; |
518 | 518 | |
519 | 519 | $whitelist = $vars->sitelock_whitelist; |
520 | - $whitelist = preg_replace("/[\r|\n|\r\n]+/",",",$whitelist); |
|
521 | - $whitelist = preg_replace("/\s+/","",$whitelist); |
|
522 | - if(preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist)) |
|
520 | + $whitelist = preg_replace("/[\r|\n|\r\n]+/", ",", $whitelist); |
|
521 | + $whitelist = preg_replace("/\s+/", "", $whitelist); |
|
522 | + if (preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist)) |
|
523 | 523 | { |
524 | 524 | $whitelist = ''; |
525 | 525 | } |
526 | - $whitelist .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR']; |
|
527 | - $whitelist = explode(',',trim($whitelist, ',')); |
|
526 | + $whitelist .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR']; |
|
527 | + $whitelist = explode(',', trim($whitelist, ',')); |
|
528 | 528 | $whitelist = array_unique($whitelist); |
529 | 529 | |
530 | - if(!IpFilter::validate($whitelist)) { |
|
530 | + if (!IpFilter::validate($whitelist)) { |
|
531 | 531 | return new BaseObject(-1, 'msg_invalid_ip'); |
532 | 532 | } |
533 | 533 | |
534 | 534 | $db_info->sitelock_whitelist = $whitelist; |
535 | 535 | |
536 | 536 | $oInstallController = getController('install'); |
537 | - if(!$oInstallController->makeConfigFile()) |
|
537 | + if (!$oInstallController->makeConfigFile()) |
|
538 | 538 | { |
539 | 539 | return new BaseObject(-1, 'msg_invalid_request'); |
540 | 540 | } |
541 | 541 | |
542 | - if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON'))) |
|
542 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
543 | 543 | { |
544 | 544 | $returnUrl = Context::get('success_return_url'); |
545 | - if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
546 | - header('location:' . $returnUrl); |
|
545 | + if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
546 | + header('location:'.$returnUrl); |
|
547 | 547 | return; |
548 | 548 | } |
549 | 549 | } |
@@ -574,20 +574,20 @@ discard block |
||
574 | 574 | $db_info->embed_white_iframe = $white_iframe; |
575 | 575 | |
576 | 576 | $oInstallController = getController('install'); |
577 | - if(!$oInstallController->makeConfigFile()) |
|
577 | + if (!$oInstallController->makeConfigFile()) |
|
578 | 578 | { |
579 | 579 | return new BaseObject(-1, 'msg_invalid_request'); |
580 | 580 | } |
581 | 581 | |
582 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
582 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
583 | 583 | $oEmbedFilter = EmbedFilter::getInstance(); |
584 | 584 | $oEmbedFilter->_makeWhiteDomainList($whitelist); |
585 | 585 | |
586 | - if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON'))) |
|
586 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
587 | 587 | { |
588 | 588 | $returnUrl = Context::get('success_return_url'); |
589 | - if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
590 | - header('location:' . $returnUrl); |
|
589 | + if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
590 | + header('location:'.$returnUrl); |
|
591 | 591 | return; |
592 | 592 | } |
593 | 593 | } |
@@ -867,6 +867,7 @@ discard block |
||
867 | 867 | * Returns a list of all sites that contain modules |
868 | 868 | * For each site domain and site_srl are retrieved |
869 | 869 | * |
870 | + * @param string $domain |
|
870 | 871 | * @return array |
871 | 872 | */ |
872 | 873 | function getAllSitesThatHaveModules($domain = NULL) |
@@ -945,6 +946,11 @@ discard block |
||
945 | 946 | return $this->iconUrlCheck('mobicon.png', 'mobiconSample.png', $default); |
946 | 947 | } |
947 | 948 | |
949 | + /** |
|
950 | + * @param string $iconname |
|
951 | + * @param string $default_icon_name |
|
952 | + * @param boolean $default |
|
953 | + */ |
|
948 | 954 | function iconUrlCheck($iconname, $default_icon_name, $default) |
949 | 955 | { |
950 | 956 | $site_info = Context::get('site_module_info'); |
@@ -955,10 +955,10 @@ |
||
955 | 955 | |
956 | 956 | $file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
957 | 957 | if(!$file_exsit && $default === true) |
958 | - { |
|
959 | - $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
|
960 | - } |
|
961 | - elseif($file_exsit) |
|
958 | + { |
|
959 | + $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
|
960 | + } |
|
961 | + elseif($file_exsit) |
|
962 | 962 | { |
963 | 963 | $default_url = Context::GetUrl(); |
964 | 964 | if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | { |
31 | 31 | $ftp_info = Context::getRequestVars(); |
32 | 32 | |
33 | - if(!$ftp_info->ftp_host) |
|
33 | + if (!$ftp_info->ftp_host) |
|
34 | 34 | { |
35 | 35 | $ftp_info->ftp_host = "127.0.0.1"; |
36 | 36 | } |
37 | 37 | |
38 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
38 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
39 | 39 | { |
40 | 40 | $ftp_info->ftp_port = '22'; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
44 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
44 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
45 | 45 | { |
46 | 46 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
47 | 47 | } |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | $path_candidate = array(); |
59 | 59 | |
60 | 60 | $temp = ''; |
61 | - foreach($path_info as $path) |
|
61 | + foreach ($path_info as $path) |
|
62 | 62 | { |
63 | - $temp = '/' . $path . $temp; |
|
63 | + $temp = '/'.$path.$temp; |
|
64 | 64 | $path_candidate[] = $temp; |
65 | 65 | } |
66 | 66 | |
67 | 67 | // try |
68 | - foreach($path_candidate as $path) |
|
68 | + foreach ($path_candidate as $path) |
|
69 | 69 | { |
70 | 70 | // upload check file |
71 | - if(!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path . 'ftp_check.html')) |
|
71 | + if (!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path.'ftp_check.html')) |
|
72 | 72 | { |
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // get check file |
77 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
77 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
78 | 78 | |
79 | 79 | // delete temp check file |
80 | - @ssh2_sftp_unlink($sftp, $path . 'ftp_check.html'); |
|
80 | + @ssh2_sftp_unlink($sftp, $path.'ftp_check.html'); |
|
81 | 81 | |
82 | 82 | // found |
83 | - if($result == $pin) |
|
83 | + if ($result == $pin) |
|
84 | 84 | { |
85 | 85 | $found_path = $path; |
86 | 86 | break; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
91 | 91 | |
92 | - if($found_path) |
|
92 | + if ($found_path) |
|
93 | 93 | { |
94 | 94 | $this->add('found_path', $found_path); |
95 | 95 | } |
@@ -99,24 +99,24 @@ discard block |
||
99 | 99 | { |
100 | 100 | $ftp_info = Context::getRequestVars(); |
101 | 101 | |
102 | - if(!$ftp_info->ftp_host) |
|
102 | + if (!$ftp_info->ftp_host) |
|
103 | 103 | { |
104 | 104 | $ftp_info->ftp_host = "127.0.0.1"; |
105 | 105 | } |
106 | 106 | |
107 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
107 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
108 | 108 | { |
109 | 109 | $ftp_info->ftp_port = '22'; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
113 | - if(!$connection) |
|
113 | + if (!$connection) |
|
114 | 114 | { |
115 | 115 | return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
116 | 116 | } |
117 | 117 | |
118 | 118 | $login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password); |
119 | - if(!$login_result) |
|
119 | + if (!$login_result) |
|
120 | 120 | { |
121 | 121 | ftp_close($connection); |
122 | 122 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
@@ -133,29 +133,29 @@ discard block |
||
133 | 133 | $path_candidate = array(); |
134 | 134 | |
135 | 135 | $temp = ''; |
136 | - foreach($path_info as $path) |
|
136 | + foreach ($path_info as $path) |
|
137 | 137 | { |
138 | - $temp = '/' . $path . $temp; |
|
138 | + $temp = '/'.$path.$temp; |
|
139 | 139 | $path_candidate[] = $temp; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // try |
143 | - foreach($path_candidate as $path) |
|
143 | + foreach ($path_candidate as $path) |
|
144 | 144 | { |
145 | 145 | // upload check file |
146 | - if(!ftp_put($connection, $path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY)) |
|
146 | + if (!ftp_put($connection, $path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY)) |
|
147 | 147 | { |
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // get check file |
152 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
152 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
153 | 153 | |
154 | 154 | // delete temp check file |
155 | - ftp_delete($connection, $path . 'ftp_check.html'); |
|
155 | + ftp_delete($connection, $path.'ftp_check.html'); |
|
156 | 156 | |
157 | 157 | // found |
158 | - if($result == $pin) |
|
158 | + if ($result == $pin) |
|
159 | 159 | { |
160 | 160 | $found_path = $path; |
161 | 161 | break; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
166 | 166 | |
167 | - if($found_path) |
|
167 | + if ($found_path) |
|
168 | 168 | { |
169 | 169 | $this->add('found_path', $found_path); |
170 | 170 | } |
@@ -175,39 +175,39 @@ discard block |
||
175 | 175 | */ |
176 | 176 | function getAdminFTPPath() |
177 | 177 | { |
178 | - Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang'); |
|
178 | + Context::loadLang(_XE_PATH_.'modules/autoinstall/lang'); |
|
179 | 179 | @set_time_limit(5); |
180 | - require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
180 | + require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
181 | 181 | |
182 | 182 | $ftp_info = Context::getRequestVars(); |
183 | 183 | |
184 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
184 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
185 | 185 | { |
186 | 186 | return new BaseObject(1, 'msg_ftp_invalid_auth_info'); |
187 | 187 | } |
188 | 188 | |
189 | - if(!$ftp_info->ftp_host) |
|
189 | + if (!$ftp_info->ftp_host) |
|
190 | 190 | { |
191 | 191 | $ftp_info->ftp_host = '127.0.0.1'; |
192 | 192 | } |
193 | 193 | |
194 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
194 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
195 | 195 | { |
196 | 196 | $ftp_info->ftp_port = '21'; |
197 | 197 | } |
198 | 198 | |
199 | - if($ftp_info->sftp == 'Y') |
|
199 | + if ($ftp_info->sftp == 'Y') |
|
200 | 200 | { |
201 | - if(!function_exists('ssh2_sftp')) |
|
201 | + if (!function_exists('ssh2_sftp')) |
|
202 | 202 | { |
203 | 203 | return new BaseObject(-1, 'disable_sftp_support'); |
204 | 204 | } |
205 | 205 | return $this->getSFTPPath(); |
206 | 206 | } |
207 | 207 | |
208 | - if($ftp_info->ftp_pasv == 'N') |
|
208 | + if ($ftp_info->ftp_pasv == 'N') |
|
209 | 209 | { |
210 | - if(function_exists('ftp_connect')) |
|
210 | + if (function_exists('ftp_connect')) |
|
211 | 211 | { |
212 | 212 | return $this->getFTPPath(); |
213 | 213 | } |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | $oFTP = new ftp(); |
218 | - if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
218 | + if (!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
219 | 219 | { |
220 | 220 | return new BaseObject(1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
221 | 221 | } |
222 | 222 | |
223 | - if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
223 | + if (!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
224 | 224 | { |
225 | 225 | return new BaseObject(1, 'msg_ftp_invalid_auth_info'); |
226 | 226 | } |
@@ -236,29 +236,29 @@ discard block |
||
236 | 236 | $path_candidate = array(); |
237 | 237 | |
238 | 238 | $temp = ''; |
239 | - foreach($path_info as $path) |
|
239 | + foreach ($path_info as $path) |
|
240 | 240 | { |
241 | - $temp = '/' . $path . $temp; |
|
241 | + $temp = '/'.$path.$temp; |
|
242 | 242 | $path_candidate[] = $temp; |
243 | 243 | } |
244 | 244 | |
245 | 245 | // try |
246 | - foreach($path_candidate as $path) |
|
246 | + foreach ($path_candidate as $path) |
|
247 | 247 | { |
248 | 248 | // upload check file |
249 | - if(!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) |
|
249 | + if (!$oFTP->ftp_put($path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) |
|
250 | 250 | { |
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // get check file |
255 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
255 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
256 | 256 | |
257 | 257 | // delete temp check file |
258 | - $oFTP->ftp_delete($path . 'ftp_check.html'); |
|
258 | + $oFTP->ftp_delete($path.'ftp_check.html'); |
|
259 | 259 | |
260 | 260 | // found |
261 | - if($result == $pin) |
|
261 | + if ($result == $pin) |
|
262 | 262 | { |
263 | 263 | $found_path = $path; |
264 | 264 | break; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
269 | 269 | |
270 | - if($found_path) |
|
270 | + if ($found_path) |
|
271 | 271 | { |
272 | 272 | $this->add('found_path', $found_path); |
273 | 273 | } |
@@ -280,27 +280,27 @@ discard block |
||
280 | 280 | function getSFTPList() |
281 | 281 | { |
282 | 282 | $ftp_info = Context::getRequestVars(); |
283 | - if(!$ftp_info->ftp_host) |
|
283 | + if (!$ftp_info->ftp_host) |
|
284 | 284 | { |
285 | 285 | $ftp_info->ftp_host = "127.0.0.1"; |
286 | 286 | } |
287 | 287 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
288 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
288 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
289 | 289 | { |
290 | 290 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
291 | 291 | } |
292 | 292 | |
293 | 293 | $sftp = ssh2_sftp($connection); |
294 | - $curpwd = "ssh2.sftp://$sftp" . $this->pwd; |
|
294 | + $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
|
295 | 295 | $dh = @opendir($curpwd); |
296 | - if(!$dh) |
|
296 | + if (!$dh) |
|
297 | 297 | { |
298 | 298 | return new BaseObject(-1, 'msg_ftp_invalid_path'); |
299 | 299 | } |
300 | 300 | $list = array(); |
301 | - while(($file = readdir($dh)) !== FALSE) |
|
301 | + while (($file = readdir($dh)) !== FALSE) |
|
302 | 302 | { |
303 | - if(is_dir($curpwd . $file)) |
|
303 | + if (is_dir($curpwd.$file)) |
|
304 | 304 | { |
305 | 305 | $file .= "/"; |
306 | 306 | } |
@@ -320,32 +320,32 @@ discard block |
||
320 | 320 | */ |
321 | 321 | function getAdminFTPList() |
322 | 322 | { |
323 | - Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang'); |
|
323 | + Context::loadLang(_XE_PATH_.'modules/autoinstall/lang'); |
|
324 | 324 | @set_time_limit(5); |
325 | 325 | |
326 | - require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
326 | + require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
327 | 327 | |
328 | 328 | $ftp_info = Context::getRequestVars(); |
329 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
329 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
330 | 330 | { |
331 | 331 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
332 | 332 | } |
333 | 333 | |
334 | 334 | $this->pwd = $ftp_info->ftp_root_path; |
335 | 335 | |
336 | - if(!$ftp_info->ftp_host) |
|
336 | + if (!$ftp_info->ftp_host) |
|
337 | 337 | { |
338 | 338 | $ftp_info->ftp_host = "127.0.0.1"; |
339 | 339 | } |
340 | 340 | |
341 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
341 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
342 | 342 | { |
343 | 343 | $ftp_info->ftp_port = "21"; |
344 | 344 | } |
345 | 345 | |
346 | - if($ftp_info->sftp == 'Y') |
|
346 | + if ($ftp_info->sftp == 'Y') |
|
347 | 347 | { |
348 | - if(!function_exists('ssh2_sftp')) |
|
348 | + if (!function_exists('ssh2_sftp')) |
|
349 | 349 | { |
350 | 350 | return new BaseObject(-1, 'disable_sftp_support'); |
351 | 351 | } |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | $oFtp = new ftp(); |
356 | - if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
356 | + if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
357 | 357 | { |
358 | - if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
358 | + if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
359 | 359 | { |
360 | 360 | $_list = $oFtp->ftp_rawlist($this->pwd); |
361 | 361 | $oFtp->ftp_quit(); |
@@ -367,17 +367,17 @@ discard block |
||
367 | 367 | } |
368 | 368 | $list = array(); |
369 | 369 | |
370 | - if($_list) |
|
370 | + if ($_list) |
|
371 | 371 | { |
372 | - foreach($_list as $k => $v) |
|
372 | + foreach ($_list as $k => $v) |
|
373 | 373 | { |
374 | 374 | $src = new stdClass(); |
375 | 375 | $src->data = $v; |
376 | 376 | $res = Context::convertEncoding($src); |
377 | 377 | $v = $res->data; |
378 | - if(strpos($v, 'd') === 0 || strpos($v, '<DIR>')) |
|
378 | + if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) |
|
379 | 379 | { |
380 | - $list[] = substr(strrchr($v, ' '), 1) . '/'; |
|
380 | + $list[] = substr(strrchr($v, ' '), 1).'/'; |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | , 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget') |
401 | 401 | , 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image') |
402 | 402 | , 'layout' => array('default') |
403 | - , 'widget' => array('content', 'language_select', 'login_info','mcontent') |
|
403 | + , 'widget' => array('content', 'language_select', 'login_info', 'mcontent') |
|
404 | 404 | , 'widgetstyle' => array(), |
405 | 405 | ); |
406 | 406 | $info = array(); |
@@ -420,86 +420,86 @@ discard block |
||
420 | 420 | $info['use_ssl'] = $db_info->use_ssl; |
421 | 421 | |
422 | 422 | $info['phpext'] = ''; |
423 | - foreach(get_loaded_extensions() as $ext) |
|
423 | + foreach (get_loaded_extensions() as $ext) |
|
424 | 424 | { |
425 | 425 | $ext = strtolower($ext); |
426 | - if(in_array($ext, $skip['ext'])) |
|
426 | + if (in_array($ext, $skip['ext'])) |
|
427 | 427 | { |
428 | 428 | continue; |
429 | 429 | } |
430 | - $info['phpext'] .= '|' . $ext; |
|
430 | + $info['phpext'] .= '|'.$ext; |
|
431 | 431 | } |
432 | 432 | $info['phpext'] = substr($info['phpext'], 1); |
433 | 433 | |
434 | 434 | $info['module'] = ''; |
435 | 435 | $oModuleModel = getModel('module'); |
436 | 436 | $module_list = $oModuleModel->getModuleList(); |
437 | - if($module_list) foreach($module_list as $module) |
|
437 | + if ($module_list) foreach ($module_list as $module) |
|
438 | 438 | { |
439 | - if(in_array($module->module, $skip['module'])) |
|
439 | + if (in_array($module->module, $skip['module'])) |
|
440 | 440 | { |
441 | 441 | continue; |
442 | 442 | } |
443 | - $info['module'] .= '|' . $module->module; |
|
443 | + $info['module'] .= '|'.$module->module; |
|
444 | 444 | } |
445 | 445 | $info['module'] = substr($info['module'], 1); |
446 | 446 | |
447 | 447 | $info['addon'] = ''; |
448 | 448 | $oAddonAdminModel = getAdminModel('addon'); |
449 | 449 | $addon_list = $oAddonAdminModel->getAddonList(); |
450 | - if($addon_list) foreach($addon_list as $addon) |
|
450 | + if ($addon_list) foreach ($addon_list as $addon) |
|
451 | 451 | { |
452 | - if(in_array($addon->addon, $skip['addon'])) |
|
452 | + if (in_array($addon->addon, $skip['addon'])) |
|
453 | 453 | { |
454 | 454 | continue; |
455 | 455 | } |
456 | - $info['addon'] .= '|' . $addon->addon; |
|
456 | + $info['addon'] .= '|'.$addon->addon; |
|
457 | 457 | } |
458 | 458 | $info['addon'] = substr($info['addon'], 1); |
459 | 459 | |
460 | 460 | $info['layout'] = ""; |
461 | 461 | $oLayoutModel = getModel('layout'); |
462 | 462 | $layout_list = $oLayoutModel->getDownloadedLayoutList(); |
463 | - if($layout_list) foreach($layout_list as $layout) |
|
463 | + if ($layout_list) foreach ($layout_list as $layout) |
|
464 | 464 | { |
465 | - if(in_array($layout->layout, $skip['layout'])) |
|
465 | + if (in_array($layout->layout, $skip['layout'])) |
|
466 | 466 | { |
467 | 467 | continue; |
468 | 468 | } |
469 | - $info['layout'] .= '|' . $layout->layout; |
|
469 | + $info['layout'] .= '|'.$layout->layout; |
|
470 | 470 | } |
471 | 471 | $info['layout'] = substr($info['layout'], 1); |
472 | 472 | |
473 | 473 | $info['widget'] = ""; |
474 | 474 | $oWidgetModel = getModel('widget'); |
475 | 475 | $widget_list = $oWidgetModel->getDownloadedWidgetList(); |
476 | - if($widget_list) foreach($widget_list as $widget) |
|
476 | + if ($widget_list) foreach ($widget_list as $widget) |
|
477 | 477 | { |
478 | - if(in_array($widget->widget, $skip['widget'])) |
|
478 | + if (in_array($widget->widget, $skip['widget'])) |
|
479 | 479 | { |
480 | 480 | continue; |
481 | 481 | } |
482 | - $info['widget'] .= '|' . $widget->widget; |
|
482 | + $info['widget'] .= '|'.$widget->widget; |
|
483 | 483 | } |
484 | 484 | $info['widget'] = substr($info['widget'], 1); |
485 | 485 | |
486 | 486 | $info['widgetstyle'] = ""; |
487 | 487 | $oWidgetModel = getModel('widget'); |
488 | 488 | $widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList(); |
489 | - if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle) |
|
489 | + if ($widgetstyle_list) foreach ($widgetstyle_list as $widgetstyle) |
|
490 | 490 | { |
491 | - if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
|
491 | + if (in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
|
492 | 492 | { |
493 | 493 | continue; |
494 | 494 | } |
495 | - $info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle; |
|
495 | + $info['widgetstyle'] .= '|'.$widgetstyle->widgetStyle; |
|
496 | 496 | } |
497 | 497 | $info['widgetstyle'] = substr($info['widgetstyle'], 1); |
498 | 498 | |
499 | 499 | $param = ''; |
500 | - foreach($info as $k => $v) |
|
500 | + foreach ($info as $k => $v) |
|
501 | 501 | { |
502 | - if($v) |
|
502 | + if ($v) |
|
503 | 503 | { |
504 | 504 | $param .= sprintf('&%s=%s', $k, urlencode($v)); |
505 | 505 | } |
@@ -515,13 +515,13 @@ discard block |
||
515 | 515 | */ |
516 | 516 | function getThemeList() |
517 | 517 | { |
518 | - $path = _XE_PATH_ . 'themes'; |
|
518 | + $path = _XE_PATH_.'themes'; |
|
519 | 519 | $list = FileHandler::readDir($path); |
520 | 520 | |
521 | 521 | $theme_info = array(); |
522 | - if(count($list) > 0) |
|
522 | + if (count($list) > 0) |
|
523 | 523 | { |
524 | - foreach($list as $val) |
|
524 | + foreach ($list as $val) |
|
525 | 525 | { |
526 | 526 | $theme_info[$val] = $this->getThemeInfo($val); |
527 | 527 | } |
@@ -538,20 +538,20 @@ discard block |
||
538 | 538 | */ |
539 | 539 | function getThemeInfo($theme_name, $layout_list = NULL) |
540 | 540 | { |
541 | - if($GLOBALS['__ThemeInfo__'][$theme_name]) |
|
541 | + if ($GLOBALS['__ThemeInfo__'][$theme_name]) |
|
542 | 542 | { |
543 | 543 | return $GLOBALS['__ThemeInfo__'][$theme_name]; |
544 | 544 | } |
545 | 545 | |
546 | - $info_file = _XE_PATH_ . 'themes/' . $theme_name . '/conf/info.xml'; |
|
547 | - if(!file_exists($info_file)) |
|
546 | + $info_file = _XE_PATH_.'themes/'.$theme_name.'/conf/info.xml'; |
|
547 | + if (!file_exists($info_file)) |
|
548 | 548 | { |
549 | 549 | return; |
550 | 550 | } |
551 | 551 | |
552 | 552 | $oXmlParser = new XmlParser(); |
553 | 553 | $_xml_obj = $oXmlParser->loadXmlFile($info_file); |
554 | - if(!$_xml_obj->theme) |
|
554 | + if (!$_xml_obj->theme) |
|
555 | 555 | { |
556 | 556 | return; |
557 | 557 | } |
@@ -562,16 +562,16 @@ discard block |
||
562 | 562 | $theme_info = new stdClass(); |
563 | 563 | $theme_info->name = $theme_name; |
564 | 564 | $theme_info->title = $xml_obj->title->body; |
565 | - $thumbnail = './themes/' . $theme_name . '/thumbnail.png'; |
|
565 | + $thumbnail = './themes/'.$theme_name.'/thumbnail.png'; |
|
566 | 566 | $theme_info->thumbnail = (FileHandler::exists($thumbnail)) ? $thumbnail : NULL; |
567 | 567 | $theme_info->version = $xml_obj->version->body; |
568 | 568 | $date_obj = new stdClass(); |
569 | 569 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
570 | 570 | $theme_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
571 | 571 | $theme_info->description = $xml_obj->description->body; |
572 | - $theme_info->path = './themes/' . $theme_name . '/'; |
|
572 | + $theme_info->path = './themes/'.$theme_name.'/'; |
|
573 | 573 | |
574 | - if(!is_array($xml_obj->publisher)) |
|
574 | + if (!is_array($xml_obj->publisher)) |
|
575 | 575 | { |
576 | 576 | $publisher_list = array(); |
577 | 577 | $publisher_list[] = $xml_obj->publisher; |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | } |
583 | 583 | |
584 | 584 | $theme_info->publisher = array(); |
585 | - foreach($publisher_list as $publisher) |
|
585 | + foreach ($publisher_list as $publisher) |
|
586 | 586 | { |
587 | 587 | $publisher_obj = new stdClass(); |
588 | 588 | $publisher_obj->name = $publisher->name->body; |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | $layout_path = $layout->directory->attrs->path; |
596 | 596 | $layout_parse = explode('/', $layout_path); |
597 | 597 | $layout_info = new stdClass(); |
598 | - switch($layout_parse[1]) |
|
598 | + switch ($layout_parse[1]) |
|
599 | 599 | { |
600 | 600 | case 'themes' : |
601 | - $layout_info->name = $theme_name . '|@|' . $layout_parse[count($layout_parse) - 1]; |
|
601 | + $layout_info->name = $theme_name.'|@|'.$layout_parse[count($layout_parse) - 1]; |
|
602 | 602 | break; |
603 | 603 | |
604 | 604 | case 'layouts' : |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | $oLayoutModel = getModel('layout'); |
616 | 616 | $layout_info_list = array(); |
617 | 617 | $layout_list = $oLayoutModel->getLayoutList($site_info->site_srl); |
618 | - if($layout_list) |
|
618 | + if ($layout_list) |
|
619 | 619 | { |
620 | - foreach($layout_list as $val) |
|
620 | + foreach ($layout_list as $val) |
|
621 | 621 | { |
622 | - if($val->layout == $layout_info->name) |
|
622 | + if ($val->layout == $layout_info->name) |
|
623 | 623 | { |
624 | 624 | $is_new_layout = FALSE; |
625 | 625 | $layout_info->layout_srl = $val->layout_srl; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | } |
630 | 630 | |
631 | - if($is_new_layout) |
|
631 | + if ($is_new_layout) |
|
632 | 632 | { |
633 | 633 | $site_module_info = Context::get('site_module_info'); |
634 | 634 | $args = new stdClass(); |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $theme_info->layout_info = $layout_info; |
647 | 647 | |
648 | 648 | $skin_infos = $xml_obj->skininfos; |
649 | - if(is_array($skin_infos->skininfo)) |
|
649 | + if (is_array($skin_infos->skininfo)) |
|
650 | 650 | { |
651 | 651 | $skin_list = $skin_infos->skininfo; |
652 | 652 | } |
@@ -657,17 +657,17 @@ discard block |
||
657 | 657 | |
658 | 658 | $oModuleModel = getModel('module'); |
659 | 659 | $skins = array(); |
660 | - foreach($skin_list as $val) |
|
660 | + foreach ($skin_list as $val) |
|
661 | 661 | { |
662 | 662 | $skin_info = new stdClass(); |
663 | 663 | unset($skin_parse); |
664 | 664 | $skin_parse = explode('/', $val->directory->attrs->path); |
665 | - switch($skin_parse[1]) |
|
665 | + switch ($skin_parse[1]) |
|
666 | 666 | { |
667 | 667 | case 'themes' : |
668 | 668 | $is_theme = TRUE; |
669 | 669 | $module_name = $skin_parse[count($skin_parse) - 1]; |
670 | - $skin_info->name = $theme_name . '|@|' . $module_name; |
|
670 | + $skin_info->name = $theme_name.'|@|'.$module_name; |
|
671 | 671 | break; |
672 | 672 | |
673 | 673 | case 'modules' : |
@@ -681,9 +681,9 @@ discard block |
||
681 | 681 | $skin_info->is_theme = $is_theme; |
682 | 682 | $skins[$module_name] = $skin_info; |
683 | 683 | |
684 | - if($is_theme) |
|
684 | + if ($is_theme) |
|
685 | 685 | { |
686 | - if(!$GLOBALS['__ThemeModuleSkin__'][$module_name]) |
|
686 | + if (!$GLOBALS['__ThemeModuleSkin__'][$module_name]) |
|
687 | 687 | { |
688 | 688 | $GLOBALS['__ThemeModuleSkin__'][$module_name] = array(); |
689 | 689 | $GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array(); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | */ |
706 | 706 | function getModulesSkinList() |
707 | 707 | { |
708 | - if($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__']) |
|
708 | + if ($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__']) |
|
709 | 709 | { |
710 | 710 | return $GLOBALS['__ThemeModuleSkin__']; |
711 | 711 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | sort($searched_list); |
714 | 714 | |
715 | 715 | $searched_count = count($searched_list); |
716 | - if(!$searched_count) |
|
716 | + if (!$searched_count) |
|
717 | 717 | { |
718 | 718 | return; |
719 | 719 | } |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | $exceptionModule = array('editor', 'poll', 'homepage', 'textyle'); |
722 | 722 | |
723 | 723 | $oModuleModel = getModel('module'); |
724 | - foreach($searched_list as $val) |
|
724 | + foreach ($searched_list as $val) |
|
725 | 725 | { |
726 | - $skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/' . $val); |
|
726 | + $skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/'.$val); |
|
727 | 727 | |
728 | - if(is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule)) |
|
728 | + if (is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule)) |
|
729 | 729 | { |
730 | - if(!$GLOBALS['__ThemeModuleSkin__'][$val]) |
|
730 | + if (!$GLOBALS['__ThemeModuleSkin__'][$val]) |
|
731 | 731 | { |
732 | 732 | $GLOBALS['__ThemeModuleSkin__'][$val] = array(); |
733 | 733 | $moduleInfo = $oModuleModel->getModuleInfoXml($val); |
@@ -751,23 +751,23 @@ discard block |
||
751 | 751 | static $lang = false; |
752 | 752 | |
753 | 753 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
754 | - if($lang === false && $oCacheHandler->isSupport()) |
|
754 | + if ($lang === false && $oCacheHandler->isSupport()) |
|
755 | 755 | { |
756 | - $cache_key = 'admin_menu_langs:' . Context::getLangType(); |
|
756 | + $cache_key = 'admin_menu_langs:'.Context::getLangType(); |
|
757 | 757 | $lang = $oCacheHandler->get($cache_key); |
758 | 758 | |
759 | - if($lang === false) |
|
759 | + if ($lang === false) |
|
760 | 760 | { |
761 | 761 | $lang = array(); |
762 | 762 | $oModuleModel = getModel('module'); |
763 | 763 | $installed_module_list = $oModuleModel->getModulesXmlInfo(); |
764 | 764 | |
765 | - foreach($installed_module_list as $key => $value) |
|
765 | + foreach ($installed_module_list as $key => $value) |
|
766 | 766 | { |
767 | 767 | $moduleActionInfo = $oModuleModel->getModuleActionXml($value->module); |
768 | - if(is_object($moduleActionInfo->menu)) |
|
768 | + if (is_object($moduleActionInfo->menu)) |
|
769 | 769 | { |
770 | - foreach($moduleActionInfo->menu as $key2 => $value2) |
|
770 | + foreach ($moduleActionInfo->menu as $key2 => $value2) |
|
771 | 771 | { |
772 | 772 | $lang[$key2] = $value2->title; |
773 | 773 | } |
@@ -792,19 +792,19 @@ discard block |
||
792 | 792 | $args = new stdClass(); |
793 | 793 | $args->site_srl = $siteSrl; |
794 | 794 | $output = executeQueryArray('admin.getFavoriteList', $args); |
795 | - if(!$output->toBool()) |
|
795 | + if (!$output->toBool()) |
|
796 | 796 | { |
797 | 797 | return $output; |
798 | 798 | } |
799 | - if(!$output->data) |
|
799 | + if (!$output->data) |
|
800 | 800 | { |
801 | 801 | return new BaseObject(); |
802 | 802 | } |
803 | 803 | |
804 | - if($isGetModuleInfo && is_array($output->data)) |
|
804 | + if ($isGetModuleInfo && is_array($output->data)) |
|
805 | 805 | { |
806 | 806 | $oModuleModel = getModel('module'); |
807 | - foreach($output->data AS $key => $value) |
|
807 | + foreach ($output->data AS $key => $value) |
|
808 | 808 | { |
809 | 809 | $moduleInfo = $oModuleModel->getModuleInfoXml($value->module); |
810 | 810 | $output->data[$key]->admin_index_act = $moduleInfo->admin_index_act; |
@@ -829,13 +829,13 @@ discard block |
||
829 | 829 | $args->site_srl = $siteSrl; |
830 | 830 | $args->module = $module; |
831 | 831 | $output = executeQuery('admin.getFavorite', $args); |
832 | - if(!$output->toBool()) |
|
832 | + if (!$output->toBool()) |
|
833 | 833 | { |
834 | 834 | return $output; |
835 | 835 | } |
836 | 836 | |
837 | 837 | $returnObject = new BaseObject(); |
838 | - if($output->data) |
|
838 | + if ($output->data) |
|
839 | 839 | { |
840 | 840 | $returnObject->add('result', TRUE); |
841 | 841 | $returnObject->add('favoriteSrl', $output->data->admin_favorite_srl); |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | */ |
855 | 855 | function getSiteAllList() |
856 | 856 | { |
857 | - if(Context::get('domain')) |
|
857 | + if (Context::get('domain')) |
|
858 | 858 | { |
859 | 859 | $domain = Context::get('domain'); |
860 | 860 | } |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | function getAllSitesThatHaveModules($domain = NULL) |
872 | 872 | { |
873 | 873 | $args = new stdClass(); |
874 | - if($domain) |
|
874 | + if ($domain) |
|
875 | 875 | { |
876 | 876 | $args->domain = $domain; |
877 | 877 | } |
@@ -879,31 +879,31 @@ discard block |
||
879 | 879 | |
880 | 880 | $siteList = array(); |
881 | 881 | $output = executeQueryArray('admin.getSiteAllList', $args, $columnList); |
882 | - if($output->toBool()) |
|
882 | + if ($output->toBool()) |
|
883 | 883 | { |
884 | 884 | $siteList = $output->data; |
885 | 885 | } |
886 | 886 | |
887 | 887 | $oModuleModel = getModel('module'); |
888 | - foreach($siteList as $key => $value) |
|
888 | + foreach ($siteList as $key => $value) |
|
889 | 889 | { |
890 | 890 | $args->site_srl = $value->site_srl; |
891 | 891 | $list = $oModuleModel->getModuleSrlList($args); |
892 | 892 | |
893 | - if(!is_array($list)) |
|
893 | + if (!is_array($list)) |
|
894 | 894 | { |
895 | 895 | $list = array($list); |
896 | 896 | } |
897 | 897 | |
898 | - foreach($list as $k => $v) |
|
898 | + foreach ($list as $k => $v) |
|
899 | 899 | { |
900 | - if(!is_dir(_XE_PATH_ . 'modules/' . $v->module)) |
|
900 | + if (!is_dir(_XE_PATH_.'modules/'.$v->module)) |
|
901 | 901 | { |
902 | 902 | unset($list[$k]); |
903 | 903 | } |
904 | 904 | } |
905 | 905 | |
906 | - if(!count($list)) |
|
906 | + if (!count($list)) |
|
907 | 907 | { |
908 | 908 | unset($siteList[$key]); |
909 | 909 | } |
@@ -920,13 +920,13 @@ discard block |
||
920 | 920 | { |
921 | 921 | $args = new stdClass(); |
922 | 922 | |
923 | - if($date) |
|
923 | + if ($date) |
|
924 | 924 | { |
925 | 925 | $args->regDate = date('Ymd', strtotime($date)); |
926 | 926 | } |
927 | 927 | |
928 | 928 | $output = executeQuery('admin.getSiteCountByDate', $args); |
929 | - if(!$output->toBool()) |
|
929 | + if (!$output->toBool()) |
|
930 | 930 | { |
931 | 931 | return 0; |
932 | 932 | } |
@@ -948,21 +948,21 @@ discard block |
||
948 | 948 | { |
949 | 949 | $site_info = Context::get('site_module_info'); |
950 | 950 | $virtual_site = ''; |
951 | - if($site_info->site_srl) |
|
951 | + if ($site_info->site_srl) |
|
952 | 952 | { |
953 | - $virtual_site = $site_info->site_srl . '/'; |
|
953 | + $virtual_site = $site_info->site_srl.'/'; |
|
954 | 954 | } |
955 | 955 | |
956 | - $file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
|
957 | - if(!$file_exsit && $default === true) |
|
956 | + $file_exsit = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname); |
|
957 | + if (!$file_exsit && $default === true) |
|
958 | 958 | { |
959 | - $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
|
959 | + $icon_url = './modules/admin/tpl/img/'.$default_icon_name; |
|
960 | 960 | } |
961 | - elseif($file_exsit) |
|
961 | + elseif ($file_exsit) |
|
962 | 962 | { |
963 | 963 | $default_url = Context::GetUrl(); |
964 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
965 | - $icon_url = $default_url . '/files/attach/xeicon/' . $virtual_site . $iconname; |
|
964 | + if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
965 | + $icon_url = $default_url.'/files/attach/xeicon/'.$virtual_site.$iconname; |
|
966 | 966 | } |
967 | 967 | return $icon_url; |
968 | 968 | } |
@@ -303,8 +303,7 @@ discard block |
||
303 | 303 | if(is_dir($curpwd . $file)) |
304 | 304 | { |
305 | 305 | $file .= "/"; |
306 | - } |
|
307 | - else |
|
306 | + } else |
|
308 | 307 | { |
309 | 308 | continue; |
310 | 309 | } |
@@ -359,8 +358,7 @@ discard block |
||
359 | 358 | { |
360 | 359 | $_list = $oFtp->ftp_rawlist($this->pwd); |
361 | 360 | $oFtp->ftp_quit(); |
362 | - } |
|
363 | - else |
|
361 | + } else |
|
364 | 362 | { |
365 | 363 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
366 | 364 | } |
@@ -380,8 +378,7 @@ discard block |
||
380 | 378 | $list[] = substr(strrchr($v, ' '), 1) . '/'; |
381 | 379 | } |
382 | 380 | } |
383 | - } |
|
384 | - else |
|
381 | + } else |
|
385 | 382 | { |
386 | 383 | return new BaseObject(-1, 'msg_ftp_no_directory'); |
387 | 384 | } |
@@ -434,11 +431,13 @@ discard block |
||
434 | 431 | $info['module'] = ''; |
435 | 432 | $oModuleModel = getModel('module'); |
436 | 433 | $module_list = $oModuleModel->getModuleList(); |
437 | - if($module_list) foreach($module_list as $module) |
|
434 | + if($module_list) { |
|
435 | + foreach($module_list as $module) |
|
438 | 436 | { |
439 | 437 | if(in_array($module->module, $skip['module'])) |
440 | 438 | { |
441 | 439 | continue; |
440 | + } |
|
442 | 441 | } |
443 | 442 | $info['module'] .= '|' . $module->module; |
444 | 443 | } |
@@ -447,11 +446,13 @@ discard block |
||
447 | 446 | $info['addon'] = ''; |
448 | 447 | $oAddonAdminModel = getAdminModel('addon'); |
449 | 448 | $addon_list = $oAddonAdminModel->getAddonList(); |
450 | - if($addon_list) foreach($addon_list as $addon) |
|
449 | + if($addon_list) { |
|
450 | + foreach($addon_list as $addon) |
|
451 | 451 | { |
452 | 452 | if(in_array($addon->addon, $skip['addon'])) |
453 | 453 | { |
454 | 454 | continue; |
455 | + } |
|
455 | 456 | } |
456 | 457 | $info['addon'] .= '|' . $addon->addon; |
457 | 458 | } |
@@ -460,11 +461,13 @@ discard block |
||
460 | 461 | $info['layout'] = ""; |
461 | 462 | $oLayoutModel = getModel('layout'); |
462 | 463 | $layout_list = $oLayoutModel->getDownloadedLayoutList(); |
463 | - if($layout_list) foreach($layout_list as $layout) |
|
464 | + if($layout_list) { |
|
465 | + foreach($layout_list as $layout) |
|
464 | 466 | { |
465 | 467 | if(in_array($layout->layout, $skip['layout'])) |
466 | 468 | { |
467 | 469 | continue; |
470 | + } |
|
468 | 471 | } |
469 | 472 | $info['layout'] .= '|' . $layout->layout; |
470 | 473 | } |
@@ -473,11 +476,13 @@ discard block |
||
473 | 476 | $info['widget'] = ""; |
474 | 477 | $oWidgetModel = getModel('widget'); |
475 | 478 | $widget_list = $oWidgetModel->getDownloadedWidgetList(); |
476 | - if($widget_list) foreach($widget_list as $widget) |
|
479 | + if($widget_list) { |
|
480 | + foreach($widget_list as $widget) |
|
477 | 481 | { |
478 | 482 | if(in_array($widget->widget, $skip['widget'])) |
479 | 483 | { |
480 | 484 | continue; |
485 | + } |
|
481 | 486 | } |
482 | 487 | $info['widget'] .= '|' . $widget->widget; |
483 | 488 | } |
@@ -486,11 +491,13 @@ discard block |
||
486 | 491 | $info['widgetstyle'] = ""; |
487 | 492 | $oWidgetModel = getModel('widget'); |
488 | 493 | $widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList(); |
489 | - if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle) |
|
494 | + if($widgetstyle_list) { |
|
495 | + foreach($widgetstyle_list as $widgetstyle) |
|
490 | 496 | { |
491 | 497 | if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
492 | 498 | { |
493 | 499 | continue; |
500 | + } |
|
494 | 501 | } |
495 | 502 | $info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle; |
496 | 503 | } |
@@ -575,8 +582,7 @@ discard block |
||
575 | 582 | { |
576 | 583 | $publisher_list = array(); |
577 | 584 | $publisher_list[] = $xml_obj->publisher; |
578 | - } |
|
579 | - else |
|
585 | + } else |
|
580 | 586 | { |
581 | 587 | $publisher_list = $xml_obj->publisher; |
582 | 588 | } |
@@ -649,8 +655,7 @@ discard block |
||
649 | 655 | if(is_array($skin_infos->skininfo)) |
650 | 656 | { |
651 | 657 | $skin_list = $skin_infos->skininfo; |
652 | - } |
|
653 | - else |
|
658 | + } else |
|
654 | 659 | { |
655 | 660 | $skin_list = array($skin_infos->skininfo); |
656 | 661 | } |
@@ -839,8 +844,7 @@ discard block |
||
839 | 844 | { |
840 | 845 | $returnObject->add('result', TRUE); |
841 | 846 | $returnObject->add('favoriteSrl', $output->data->admin_favorite_srl); |
842 | - } |
|
843 | - else |
|
847 | + } else |
|
844 | 848 | { |
845 | 849 | $returnObject->add('result', FALSE); |
846 | 850 | } |
@@ -957,11 +961,12 @@ discard block |
||
957 | 961 | if(!$file_exsit && $default === true) |
958 | 962 | { |
959 | 963 | $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
960 | - } |
|
961 | - elseif($file_exsit) |
|
964 | + } elseif($file_exsit) |
|
962 | 965 | { |
963 | 966 | $default_url = Context::GetUrl(); |
964 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
967 | + if($default_url && substr_compare($default_url, '/', -1) === 0) { |
|
968 | + $default_url = substr($default_url, 0, -1); |
|
969 | + } |
|
965 | 970 | $icon_url = $default_url . '/files/attach/xeicon/' . $virtual_site . $iconname; |
966 | 971 | } |
967 | 972 | return $icon_url; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | /** |
25 | 25 | * Add a form fot comment setting on the additional setting of module |
26 | 26 | * @param string $obj |
27 | - * @return string |
|
27 | + * @return BaseObject |
|
28 | 28 | */ |
29 | 29 | function triggerDispCommentAdditionSetup(&$obj) |
30 | 30 | { |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | $current_module_srl = Context::get('module_srl'); |
32 | 32 | $current_module_srls = Context::get('module_srls'); |
33 | 33 | |
34 | - if(!$current_module_srl && !$current_module_srls) |
|
34 | + if (!$current_module_srl && !$current_module_srls) |
|
35 | 35 | { |
36 | 36 | // get information of the selected module |
37 | 37 | $current_module_info = Context::get('current_module_info'); |
38 | 38 | $current_module_srl = $current_module_info->module_srl; |
39 | - if(!$current_module_srl) |
|
39 | + if (!$current_module_srl) |
|
40 | 40 | { |
41 | 41 | return new BaseObject(); |
42 | 42 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | // Set a template file |
56 | 56 | $oTemplate = TemplateHandler::getInstance(); |
57 | - $tpl = $oTemplate->compile($this->module_path . 'tpl', 'comment_module_config'); |
|
57 | + $tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config'); |
|
58 | 58 | $obj .= $tpl; |
59 | 59 | |
60 | 60 | return new BaseObject(); |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | /** |
497 | 497 | * Show pop-up menu of the selected posts |
498 | 498 | * Printing, scrap, recommendations and negative, reported the Add Features |
499 | - * @return void |
|
499 | + * @return BaseObject|null |
|
500 | 500 | */ |
501 | 501 | function getDocumentMenu() |
502 | 502 | { |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | * Setting sort index |
1267 | 1267 | * @param object $obj |
1268 | 1268 | * @param bool $load_extra_vars |
1269 | - * @return object |
|
1269 | + * @return stdClass |
|
1270 | 1270 | */ |
1271 | 1271 | function _setSortIndex($obj, $load_extra_vars) |
1272 | 1272 | { |
@@ -58,18 +58,24 @@ discard block |
||
58 | 58 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
59 | 59 | |
60 | 60 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
61 | - if(count($_document_list) <= 0) return; |
|
61 | + if(count($_document_list) <= 0) { |
|
62 | + return; |
|
63 | + } |
|
62 | 64 | |
63 | 65 | // Find all called the document object variable has been set extension |
64 | 66 | $document_srls = array(); |
65 | 67 | foreach($_document_list as $key => $val) |
66 | 68 | { |
67 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
69 | + if(!$val->document_srl || $checked_documents[$val->document_srl]) { |
|
70 | + continue; |
|
71 | + } |
|
68 | 72 | $checked_documents[$val->document_srl] = true; |
69 | 73 | $document_srls[] = $val->document_srl; |
70 | 74 | } |
71 | 75 | // If the document number, return detected |
72 | - if(!count($document_srls)) return; |
|
76 | + if(!count($document_srls)) { |
|
77 | + return; |
|
78 | + } |
|
73 | 79 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
74 | 80 | //$obj->document_srl = implode(',',$document_srls); |
75 | 81 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
@@ -77,8 +83,12 @@ discard block |
||
77 | 83 | { |
78 | 84 | foreach($output->data as $key => $val) |
79 | 85 | { |
80 | - if(!isset($val->value)) continue; |
|
81 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
86 | + if(!isset($val->value)) { |
|
87 | + continue; |
|
88 | + } |
|
89 | + if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) { |
|
90 | + $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
91 | + } |
|
82 | 92 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
83 | 93 | } |
84 | 94 | } |
@@ -89,7 +99,9 @@ discard block |
||
89 | 99 | $document_srl = $document_srls[$i]; |
90 | 100 | unset($vars); |
91 | 101 | |
92 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
102 | + if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) { |
|
103 | + continue; |
|
104 | + } |
|
93 | 105 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
94 | 106 | $extra_keys = $this->getExtraKeys($module_srl); |
95 | 107 | $vars = $extra_vars[$document_srl]; |
@@ -101,10 +113,15 @@ discard block |
||
101 | 113 | { |
102 | 114 | $extra_keys[$idx] = clone($key); |
103 | 115 | $val = $vars[$idx]; |
104 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
105 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
106 | - else if(isset($val[0])) $v = $val[0]; |
|
107 | - else $v = null; |
|
116 | + if(isset($val[$user_lang_code])) { |
|
117 | + $v = $val[$user_lang_code]; |
|
118 | + } else if(isset($val[$document_lang_code])) { |
|
119 | + $v = $val[$document_lang_code]; |
|
120 | + } else if(isset($val[0])) { |
|
121 | + $v = $val[0]; |
|
122 | + } else { |
|
123 | + $v = null; |
|
124 | + } |
|
108 | 125 | $extra_keys[$idx]->value = $v; |
109 | 126 | } |
110 | 127 | } |
@@ -113,9 +130,13 @@ discard block |
||
113 | 130 | $evars = new ExtraVar($module_srl); |
114 | 131 | $evars->setExtraVarKeys($extra_keys); |
115 | 132 | // Title Processing |
116 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
133 | + if($vars[-1][$user_lang_code]) { |
|
134 | + $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
135 | + } |
|
117 | 136 | // Information processing |
118 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
137 | + if($vars[-2][$user_lang_code]) { |
|
138 | + $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
139 | + } |
|
119 | 140 | |
120 | 141 | // static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남 |
121 | 142 | /* |
@@ -139,7 +160,9 @@ discard block |
||
139 | 160 | */ |
140 | 161 | function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
141 | 162 | { |
142 | - if(!$document_srl) return new documentItem(); |
|
163 | + if(!$document_srl) { |
|
164 | + return new documentItem(); |
|
165 | + } |
|
143 | 166 | |
144 | 167 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
145 | 168 | { |
@@ -149,9 +172,13 @@ discard block |
||
149 | 172 | return $oDocument; |
150 | 173 | } |
151 | 174 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
152 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
175 | + if($load_extra_vars) { |
|
176 | + $this->setToAllDocumentExtraVars(); |
|
177 | + } |
|
178 | + } |
|
179 | + if($is_admin) { |
|
180 | + $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
153 | 181 | } |
154 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
155 | 182 | |
156 | 183 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
157 | 184 | } |
@@ -170,8 +197,7 @@ discard block |
||
170 | 197 | { |
171 | 198 | $list_count = count($document_srls); |
172 | 199 | $document_srls = implode(',',$document_srls); |
173 | - } |
|
174 | - else |
|
200 | + } else |
|
175 | 201 | { |
176 | 202 | $list_count = 1; |
177 | 203 | } |
@@ -182,28 +208,38 @@ discard block |
||
182 | 208 | |
183 | 209 | $output = executeQuery('document.getDocuments', $args, $columnList); |
184 | 210 | $document_list = $output->data; |
185 | - if(!$document_list) return; |
|
186 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
211 | + if(!$document_list) { |
|
212 | + return; |
|
213 | + } |
|
214 | + if(!is_array($document_list)) { |
|
215 | + $document_list = array($document_list); |
|
216 | + } |
|
187 | 217 | |
188 | 218 | $document_count = count($document_list); |
189 | 219 | foreach($document_list as $key => $attribute) |
190 | 220 | { |
191 | 221 | $document_srl = $attribute->document_srl; |
192 | - if(!$document_srl) continue; |
|
222 | + if(!$document_srl) { |
|
223 | + continue; |
|
224 | + } |
|
193 | 225 | |
194 | 226 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
195 | 227 | { |
196 | 228 | $oDocument = null; |
197 | 229 | $oDocument = new documentItem(); |
198 | 230 | $oDocument->setAttribute($attribute, false); |
199 | - if($is_admin) $oDocument->setGrant(); |
|
231 | + if($is_admin) { |
|
232 | + $oDocument->setGrant(); |
|
233 | + } |
|
200 | 234 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
201 | 235 | } |
202 | 236 | |
203 | 237 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
204 | 238 | } |
205 | 239 | |
206 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
240 | + if($load_extra_vars) { |
|
241 | + $this->setToAllDocumentExtraVars(); |
|
242 | + } |
|
207 | 243 | |
208 | 244 | $output = null; |
209 | 245 | if(count($result)) |
@@ -251,18 +287,15 @@ discard block |
||
251 | 287 | { |
252 | 288 | $output = $obj->use_alternate_output; |
253 | 289 | unset($obj->use_alternate_output); |
254 | - } |
|
255 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
290 | + } elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
256 | 291 | { |
257 | 292 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
258 | 293 | $args->sort_index = str_replace('documents.','',$args->sort_index); |
259 | 294 | $output = executeQueryArray($query_id, $args); |
260 | - } |
|
261 | - elseif ($sort_check->isExtraVars) |
|
295 | + } elseif ($sort_check->isExtraVars) |
|
262 | 296 | { |
263 | 297 | $output = executeQueryArray($query_id, $args); |
264 | - } |
|
265 | - else |
|
298 | + } else |
|
266 | 299 | { |
267 | 300 | // document.getDocumentList query execution |
268 | 301 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
@@ -272,11 +305,15 @@ discard block |
||
272 | 305 | $group_args = clone($args); |
273 | 306 | $group_args->sort_index = 'documents.'.$args->sort_index; |
274 | 307 | $output = executeQueryArray($query_id, $group_args); |
275 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
308 | + if(!$output->toBool()||!count($output->data)) { |
|
309 | + return $output; |
|
310 | + } |
|
276 | 311 | |
277 | 312 | foreach($output->data as $key => $val) |
278 | 313 | { |
279 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
314 | + if($val->document_srl) { |
|
315 | + $target_srls[] = $val->document_srl; |
|
316 | + } |
|
280 | 317 | } |
281 | 318 | |
282 | 319 | $page_navigation = $output->page_navigation; |
@@ -294,14 +331,15 @@ discard block |
||
294 | 331 | $output->total_count = $page_navigation->total_count; |
295 | 332 | $output->total_page = $page_navigation->total_page; |
296 | 333 | $output->page = $page_navigation->cur_page; |
297 | - } |
|
298 | - else |
|
334 | + } else |
|
299 | 335 | { |
300 | 336 | $output = executeQueryArray($query_id, $args, $columnList); |
301 | 337 | } |
302 | 338 | } |
303 | 339 | // Return if no result or an error occurs |
304 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
340 | + if(!$output->toBool()||!count($output->data)) { |
|
341 | + return $output; |
|
342 | + } |
|
305 | 343 | $idx = 0; |
306 | 344 | $data = $output->data; |
307 | 345 | unset($output->data); |
@@ -316,20 +354,26 @@ discard block |
||
316 | 354 | { |
317 | 355 | foreach($data as $key => $attribute) |
318 | 356 | { |
319 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
357 | + if($attribute->is_notice == 'Y') { |
|
358 | + $virtual_number --; |
|
359 | + } |
|
320 | 360 | } |
321 | 361 | } |
322 | 362 | |
323 | 363 | foreach($data as $key => $attribute) |
324 | 364 | { |
325 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
365 | + if($except_notice && $attribute->is_notice == 'Y') { |
|
366 | + continue; |
|
367 | + } |
|
326 | 368 | $document_srl = $attribute->document_srl; |
327 | 369 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
328 | 370 | { |
329 | 371 | $oDocument = null; |
330 | 372 | $oDocument = new documentItem(); |
331 | 373 | $oDocument->setAttribute($attribute, false); |
332 | - if($is_admin) $oDocument->setGrant(); |
|
374 | + if($is_admin) { |
|
375 | + $oDocument->setGrant(); |
|
376 | + } |
|
333 | 377 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
334 | 378 | } |
335 | 379 | |
@@ -337,7 +381,9 @@ discard block |
||
337 | 381 | $virtual_number--; |
338 | 382 | } |
339 | 383 | |
340 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
384 | + if($load_extra_vars) { |
|
385 | + $this->setToAllDocumentExtraVars(); |
|
386 | + } |
|
341 | 387 | |
342 | 388 | if(count($output->data)) |
343 | 389 | { |
@@ -365,12 +411,16 @@ discard block |
||
365 | 411 | $args->module_srl = $obj->module_srl; |
366 | 412 | $args->category_srl= $obj->category_srl; |
367 | 413 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
368 | - if(!$output->toBool()||!$output->data) return; |
|
414 | + if(!$output->toBool()||!$output->data) { |
|
415 | + return; |
|
416 | + } |
|
369 | 417 | |
370 | 418 | foreach($output->data as $key => $val) |
371 | 419 | { |
372 | 420 | $document_srl = $val->document_srl; |
373 | - if(!$document_srl) continue; |
|
421 | + if(!$document_srl) { |
|
422 | + continue; |
|
423 | + } |
|
374 | 424 | |
375 | 425 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
376 | 426 | { |
@@ -466,7 +516,9 @@ discard block |
||
466 | 516 | |
467 | 517 | $oExtraVar->setExtraVarKeys($output->data); |
468 | 518 | $keys = $oExtraVar->getExtraVars(); |
469 | - if(!$keys) $keys = array(); |
|
519 | + if(!$keys) { |
|
520 | + $keys = array(); |
|
521 | + } |
|
470 | 522 | |
471 | 523 | if($oCacheHandler->isSupport()) |
472 | 524 | { |
@@ -496,7 +548,9 @@ discard block |
||
496 | 548 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
497 | 549 | $this->setToAllDocumentExtraVars(); |
498 | 550 | } |
499 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
551 | + if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) { |
|
552 | + ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
553 | + } |
|
500 | 554 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
501 | 555 | } |
502 | 556 | |
@@ -526,7 +580,9 @@ discard block |
||
526 | 580 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
527 | 581 | $module_srl = $oDocument->get('module_srl'); |
528 | 582 | $member_srl = $oDocument->get('member_srl'); |
529 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
583 | + if(!$module_srl) { |
|
584 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
585 | + } |
|
530 | 586 | |
531 | 587 | $oModuleModel = getModel('module'); |
532 | 588 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
@@ -599,7 +655,9 @@ discard block |
||
599 | 655 | */ |
600 | 656 | function getDocumentCount($module_srl, $search_obj = NULL) |
601 | 657 | { |
602 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
658 | + if(is_null($search_obj)) { |
|
659 | + $search_obj = new stdClass(); |
|
660 | + } |
|
603 | 661 | $search_obj->module_srl = $module_srl; |
604 | 662 | |
605 | 663 | $output = executeQuery('document.getDocumentCount', $search_obj); |
@@ -616,7 +674,9 @@ discard block |
||
616 | 674 | function getDocumentCountByGroupStatus($search_obj = NULL) |
617 | 675 | { |
618 | 676 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
619 | - if(!$output->toBool()) return array(); |
|
677 | + if(!$output->toBool()) { |
|
678 | + return array(); |
|
679 | + } |
|
620 | 680 | |
621 | 681 | return $output->data; |
622 | 682 | } |
@@ -655,34 +715,29 @@ discard block |
||
655 | 715 | if($sort_check->isExtraVars) |
656 | 716 | { |
657 | 717 | return 1; |
658 | - } |
|
659 | - else |
|
718 | + } else |
|
660 | 719 | { |
661 | 720 | if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
662 | 721 | { |
663 | 722 | if($args->order_type === 'desc') |
664 | 723 | { |
665 | 724 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
666 | - } |
|
667 | - else |
|
725 | + } else |
|
668 | 726 | { |
669 | 727 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
670 | 728 | } |
671 | - } |
|
672 | - elseif($sort_check->sort_index === 'regdate') |
|
729 | + } elseif($sort_check->sort_index === 'regdate') |
|
673 | 730 | { |
674 | 731 | |
675 | 732 | if($args->order_type === 'asc') |
676 | 733 | { |
677 | 734 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
678 | - } |
|
679 | - else |
|
735 | + } else |
|
680 | 736 | { |
681 | 737 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
682 | 738 | } |
683 | 739 | |
684 | - } |
|
685 | - else |
|
740 | + } else |
|
686 | 741 | { |
687 | 742 | return 1; |
688 | 743 | } |
@@ -708,15 +763,16 @@ discard block |
||
708 | 763 | $output = executeQuery('document.getCategory', $args, $columnList); |
709 | 764 | |
710 | 765 | $node = $output->data; |
711 | - if(!$node) return; |
|
766 | + if(!$node) { |
|
767 | + return; |
|
768 | + } |
|
712 | 769 | |
713 | 770 | if($node->group_srls) |
714 | 771 | { |
715 | 772 | $group_srls = explode(',',$node->group_srls); |
716 | 773 | unset($node->group_srls); |
717 | 774 | $node->group_srls = $group_srls; |
718 | - } |
|
719 | - else |
|
775 | + } else |
|
720 | 776 | { |
721 | 777 | unset($node->group_srls); |
722 | 778 | $node->group_srls = array(); |
@@ -734,7 +790,9 @@ discard block |
||
734 | 790 | $args = new stdClass(); |
735 | 791 | $args->category_srl = $category_srl; |
736 | 792 | $output = executeQuery('document.getChildCategoryCount',$args); |
737 | - if($output->data->count > 0) return true; |
|
793 | + if($output->data->count > 0) { |
|
794 | + return true; |
|
795 | + } |
|
738 | 796 | return false; |
739 | 797 | } |
740 | 798 | |
@@ -753,7 +811,9 @@ discard block |
||
753 | 811 | if(!file_exists($filename)) |
754 | 812 | { |
755 | 813 | $oDocumentController = getController('document'); |
756 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
814 | + if(!$oDocumentController->makeCategoryFile($module_srl)) { |
|
815 | + return array(); |
|
816 | + } |
|
757 | 817 | } |
758 | 818 | |
759 | 819 | include($filename); |
@@ -773,7 +833,9 @@ discard block |
||
773 | 833 | */ |
774 | 834 | function _arrangeCategory(&$document_category, $list, $depth) |
775 | 835 | { |
776 | - if(!count($list)) return; |
|
836 | + if(!count($list)) { |
|
837 | + return; |
|
838 | + } |
|
777 | 839 | $idx = 0; |
778 | 840 | $list_order = array(); |
779 | 841 | foreach($list as $key => $val) |
@@ -793,8 +855,11 @@ discard block |
||
793 | 855 | $obj->childs = array(); |
794 | 856 | $obj->grant = $val['grant']; |
795 | 857 | |
796 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
797 | - else $selected = false; |
|
858 | + if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) { |
|
859 | + $selected = true; |
|
860 | + } else { |
|
861 | + $selected = false; |
|
862 | + } |
|
798 | 863 | |
799 | 864 | $obj->selected = $selected; |
800 | 865 | |
@@ -805,14 +870,18 @@ discard block |
||
805 | 870 | $parent_srl = $obj->parent_srl; |
806 | 871 | $document_count = $obj->document_count; |
807 | 872 | $expand = $obj->expand; |
808 | - if($selected) $expand = true; |
|
873 | + if($selected) { |
|
874 | + $expand = true; |
|
875 | + } |
|
809 | 876 | |
810 | 877 | while($parent_srl) |
811 | 878 | { |
812 | 879 | $document_category[$parent_srl]->document_count += $document_count; |
813 | 880 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
814 | 881 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
815 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
882 | + if($expand) { |
|
883 | + $document_category[$parent_srl]->expand = $expand; |
|
884 | + } |
|
816 | 885 | |
817 | 886 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
818 | 887 | } |
@@ -820,7 +889,9 @@ discard block |
||
820 | 889 | |
821 | 890 | $document_category[$key] = $obj; |
822 | 891 | |
823 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
892 | + if(count($val['list'])) { |
|
893 | + $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
894 | + } |
|
824 | 895 | } |
825 | 896 | $document_category[$list_order[0]]->first = true; |
826 | 897 | $document_category[$list_order[count($list_order)-1]]->last = true; |
@@ -888,13 +959,20 @@ discard block |
||
888 | 959 | } |
889 | 960 | // Module_srl passed the array may be a check whether the array |
890 | 961 | $args = new stdClass; |
891 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
892 | - else $args->module_srl = $obj->module_srl; |
|
962 | + if(is_array($obj->module_srl)) { |
|
963 | + $args->module_srl = implode(',', $obj->module_srl); |
|
964 | + } else { |
|
965 | + $args->module_srl = $obj->module_srl; |
|
966 | + } |
|
893 | 967 | |
894 | 968 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
895 | - if(!$output->toBool()||!$output->data) return $output; |
|
969 | + if(!$output->toBool()||!$output->data) { |
|
970 | + return $output; |
|
971 | + } |
|
896 | 972 | |
897 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
973 | + if(!is_array($output->data)) { |
|
974 | + $output->data = array($output->data); |
|
975 | + } |
|
898 | 976 | |
899 | 977 | return $output; |
900 | 978 | } |
@@ -914,14 +992,21 @@ discard block |
||
914 | 992 | } |
915 | 993 | // Module_srl passed the array may be a check whether the array |
916 | 994 | $args = new stdClass; |
917 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
918 | - else $args->module_srl = $obj->module_srl; |
|
995 | + if(is_array($obj->module_srl)) { |
|
996 | + $args->module_srl = implode(',', $obj->module_srl); |
|
997 | + } else { |
|
998 | + $args->module_srl = $obj->module_srl; |
|
999 | + } |
|
919 | 1000 | $args->regdate = $obj->regdate; |
920 | 1001 | |
921 | 1002 | $output = executeQuery('document.getDailyArchivedList', $args); |
922 | - if(!$output->toBool()) return $output; |
|
1003 | + if(!$output->toBool()) { |
|
1004 | + return $output; |
|
1005 | + } |
|
923 | 1006 | |
924 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
1007 | + if(!is_array($output->data)) { |
|
1008 | + $output->data = array($output->data); |
|
1009 | + } |
|
925 | 1010 | |
926 | 1011 | return $output; |
927 | 1012 | } |
@@ -932,7 +1017,9 @@ discard block |
||
932 | 1017 | */ |
933 | 1018 | function getDocumentCategories() |
934 | 1019 | { |
935 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
1020 | + if(!Context::get('is_logged')) { |
|
1021 | + return new BaseObject(-1,'msg_not_permitted'); |
|
1022 | + } |
|
936 | 1023 | $module_srl = Context::get('module_srl'); |
937 | 1024 | $categories= $this->getCategoryList($module_srl); |
938 | 1025 | $lang = Context::get('lang'); |
@@ -1027,7 +1114,9 @@ discard block |
||
1027 | 1114 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
1028 | 1115 | // Check permissions |
1029 | 1116 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
1030 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
1117 | + if(!$grant->manager) { |
|
1118 | + return new BaseObject(-1,'msg_not_permitted'); |
|
1119 | + } |
|
1031 | 1120 | |
1032 | 1121 | $category_srl = Context::get('category_srl'); |
1033 | 1122 | $category_info = $this->getCategory($category_srl); |
@@ -1047,15 +1136,20 @@ discard block |
||
1047 | 1136 | */ |
1048 | 1137 | function getDocumentSrlByAlias($mid, $alias) |
1049 | 1138 | { |
1050 | - if(!$mid || !$alias) return null; |
|
1139 | + if(!$mid || !$alias) { |
|
1140 | + return null; |
|
1141 | + } |
|
1051 | 1142 | $site_module_info = Context::get('site_module_info'); |
1052 | 1143 | $args = new stdClass; |
1053 | 1144 | $args->mid = $mid; |
1054 | 1145 | $args->alias_title = $alias; |
1055 | 1146 | $args->site_srl = $site_module_info->site_srl; |
1056 | 1147 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
1057 | - if(!$output->data) return null; |
|
1058 | - else return $output->data->document_srl; |
|
1148 | + if(!$output->data) { |
|
1149 | + return null; |
|
1150 | + } else { |
|
1151 | + return $output->data->document_srl; |
|
1152 | + } |
|
1059 | 1153 | } |
1060 | 1154 | |
1061 | 1155 | /** |
@@ -1066,15 +1160,20 @@ discard block |
||
1066 | 1160 | */ |
1067 | 1161 | function getDocumentSrlByTitle($module_srl, $title) |
1068 | 1162 | { |
1069 | - if(!$module_srl || !$title) return null; |
|
1163 | + if(!$module_srl || !$title) { |
|
1164 | + return null; |
|
1165 | + } |
|
1070 | 1166 | $args = new stdClass; |
1071 | 1167 | $args->module_srl = $module_srl; |
1072 | 1168 | $args->title = $title; |
1073 | 1169 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
1074 | - if(!$output->data) return null; |
|
1075 | - else |
|
1170 | + if(!$output->data) { |
|
1171 | + return null; |
|
1172 | + } else |
|
1076 | 1173 | { |
1077 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
1174 | + if(is_array($output->data)) { |
|
1175 | + return $output->data[0]->document_srl; |
|
1176 | + } |
|
1078 | 1177 | return $output->data->document_srl; |
1079 | 1178 | } |
1080 | 1179 | } |
@@ -1086,13 +1185,18 @@ discard block |
||
1086 | 1185 | */ |
1087 | 1186 | function getAlias($document_srl) |
1088 | 1187 | { |
1089 | - if(!$document_srl) return null; |
|
1188 | + if(!$document_srl) { |
|
1189 | + return null; |
|
1190 | + } |
|
1090 | 1191 | $args = new stdClass; |
1091 | 1192 | $args->document_srl = $document_srl; |
1092 | 1193 | $output = executeQueryArray('document.getAliases', $args); |
1093 | 1194 | |
1094 | - if(!$output->data) return null; |
|
1095 | - else return $output->data[0]->alias_title; |
|
1195 | + if(!$output->data) { |
|
1196 | + return null; |
|
1197 | + } else { |
|
1198 | + return $output->data[0]->alias_title; |
|
1199 | + } |
|
1096 | 1200 | } |
1097 | 1201 | |
1098 | 1202 | /** |
@@ -1149,17 +1253,23 @@ discard block |
||
1149 | 1253 | { |
1150 | 1254 | case 'title' : |
1151 | 1255 | case 'content' : |
1152 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1256 | + if($search_keyword) { |
|
1257 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1258 | + } |
|
1153 | 1259 | $args->{"s_".$search_target} = $search_keyword; |
1154 | 1260 | $use_division = true; |
1155 | 1261 | break; |
1156 | 1262 | case 'title_content' : |
1157 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1263 | + if($search_keyword) { |
|
1264 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1265 | + } |
|
1158 | 1266 | $args->s_title = $search_keyword; |
1159 | 1267 | $args->s_content = $search_keyword; |
1160 | 1268 | break; |
1161 | 1269 | case 'user_id' : |
1162 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1270 | + if($search_keyword) { |
|
1271 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1272 | + } |
|
1163 | 1273 | $args->s_user_id = $search_keyword; |
1164 | 1274 | $args->sort_index = 'documents.'.$args->sort_index; |
1165 | 1275 | break; |
@@ -1167,13 +1277,18 @@ discard block |
||
1167 | 1277 | case 'nick_name' : |
1168 | 1278 | case 'email_address' : |
1169 | 1279 | case 'homepage' : |
1170 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1280 | + if($search_keyword) { |
|
1281 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1282 | + } |
|
1171 | 1283 | $args->{"s_".$search_target} = $search_keyword; |
1172 | 1284 | break; |
1173 | 1285 | case 'is_notice' : |
1174 | 1286 | case 'is_secret' : |
1175 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1176 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1287 | + if($search_keyword=='N') { |
|
1288 | + $args->statusList = array($this->getConfigStatus('public')); |
|
1289 | + } elseif($search_keyword=='Y') { |
|
1290 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
1291 | + } |
|
1177 | 1292 | break; |
1178 | 1293 | case 'member_srl' : |
1179 | 1294 | case 'readed_count' : |
@@ -1215,34 +1330,45 @@ discard block |
||
1215 | 1330 | { |
1216 | 1331 | $args = new stdClass; |
1217 | 1332 | $document_srl = Context::get('document_srl'); |
1218 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
1333 | + if(!$document_srl) { |
|
1334 | + return new BaseObject(-1,'msg_invalid_request'); |
|
1335 | + } |
|
1219 | 1336 | |
1220 | 1337 | $point = Context::get('point'); |
1221 | - if($point != -1) $point = 1; |
|
1338 | + if($point != -1) { |
|
1339 | + $point = 1; |
|
1340 | + } |
|
1222 | 1341 | |
1223 | 1342 | $oDocumentModel = getModel('document'); |
1224 | 1343 | $columnList = array('document_srl', 'module_srl'); |
1225 | 1344 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
1226 | 1345 | $module_srl = $oDocument->get('module_srl'); |
1227 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1346 | + if(!$module_srl) { |
|
1347 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
1348 | + } |
|
1228 | 1349 | |
1229 | 1350 | $oModuleModel = getModel('module'); |
1230 | 1351 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
1231 | 1352 | if($point == -1) |
1232 | 1353 | { |
1233 | - if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1354 | + if($document_config->use_vote_down!='S') { |
|
1355 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
1356 | + } |
|
1234 | 1357 | $args->below_point = 0; |
1235 | - } |
|
1236 | - else |
|
1358 | + } else |
|
1237 | 1359 | { |
1238 | - if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1360 | + if($document_config->use_vote_up!='S') { |
|
1361 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
1362 | + } |
|
1239 | 1363 | $args->more_point = 0; |
1240 | 1364 | } |
1241 | 1365 | |
1242 | 1366 | $args->document_srl = $document_srl; |
1243 | 1367 | |
1244 | 1368 | $output = executeQueryArray('document.getVotedMemberList',$args); |
1245 | - if(!$output->toBool()) return $output; |
|
1369 | + if(!$output->toBool()) { |
|
1370 | + return $output; |
|
1371 | + } |
|
1246 | 1372 | |
1247 | 1373 | $oMemberModel = getModel('member'); |
1248 | 1374 | if($output->data) |
@@ -1264,9 +1390,11 @@ discard block |
||
1264 | 1390 | function getStatusNameList() |
1265 | 1391 | { |
1266 | 1392 | global $lang; |
1267 | - if(!isset($lang->status_name_list)) |
|
1268 | - return array_flip($this->getStatusList()); |
|
1269 | - else return $lang->status_name_list; |
|
1393 | + if(!isset($lang->status_name_list)) { |
|
1394 | + return array_flip($this->getStatusList()); |
|
1395 | + } else { |
|
1396 | + return $lang->status_name_list; |
|
1397 | + } |
|
1270 | 1398 | } |
1271 | 1399 | |
1272 | 1400 | /** |
@@ -1290,20 +1418,22 @@ discard block |
||
1290 | 1418 | if (!$extra_output->data || !$extra_output->toBool()) |
1291 | 1419 | { |
1292 | 1420 | $sortIndex = 'list_order'; |
1293 | - } |
|
1294 | - else |
|
1421 | + } else |
|
1295 | 1422 | { |
1296 | 1423 | $check_array = array(); |
1297 | 1424 | foreach($extra_output->data as $val) |
1298 | 1425 | { |
1299 | 1426 | $check_array[] = $val->eid; |
1300 | 1427 | } |
1301 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1302 | - else $isExtraVars = true; |
|
1428 | + if(!in_array($sortIndex, $check_array)) { |
|
1429 | + $sortIndex = 'list_order'; |
|
1430 | + } else { |
|
1431 | + $isExtraVars = true; |
|
1432 | + } |
|
1303 | 1433 | } |
1434 | + } else { |
|
1435 | + $sortIndex = 'list_order'; |
|
1304 | 1436 | } |
1305 | - else |
|
1306 | - $sortIndex = 'list_order'; |
|
1307 | 1437 | } |
1308 | 1438 | $returnObj = new stdClass(); |
1309 | 1439 | $returnObj->sort_index = $sortIndex; |
@@ -1342,7 +1472,9 @@ discard block |
||
1342 | 1472 | |
1343 | 1473 | // Check the target and sequence alignment |
1344 | 1474 | $orderType = array('desc' => 1, 'asc' => 1); |
1345 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1475 | + if(!isset($orderType[$args->order_type])) { |
|
1476 | + $args->order_type = 'asc'; |
|
1477 | + } |
|
1346 | 1478 | |
1347 | 1479 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
1348 | 1480 | if($searchOpt->mid) |
@@ -1353,21 +1485,29 @@ discard block |
||
1353 | 1485 | } |
1354 | 1486 | |
1355 | 1487 | // Module_srl passed the array may be a check whether the array |
1356 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1357 | - else $args->module_srl = $searchOpt->module_srl; |
|
1488 | + if(is_array($searchOpt->module_srl)) { |
|
1489 | + $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1490 | + } else { |
|
1491 | + $args->module_srl = $searchOpt->module_srl; |
|
1492 | + } |
|
1358 | 1493 | |
1359 | 1494 | // Except for the test module_srl |
1360 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1361 | - else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
1495 | + if(is_array($searchOpt->exclude_module_srl)) { |
|
1496 | + $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1497 | + } else { |
|
1498 | + $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
1499 | + } |
|
1362 | 1500 | |
1363 | 1501 | // only admin document list, temp document showing |
1364 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1365 | - else |
|
1502 | + if($searchOpt->statusList) { |
|
1503 | + $args->statusList = $searchOpt->statusList; |
|
1504 | + } else |
|
1366 | 1505 | { |
1367 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1368 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
1369 | - else |
|
1370 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
1506 | + if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) { |
|
1507 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
1508 | + } else { |
|
1509 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
1510 | + } |
|
1371 | 1511 | } |
1372 | 1512 | |
1373 | 1513 | // Category is selected, further sub-categories until all conditions |
@@ -1395,18 +1535,24 @@ discard block |
||
1395 | 1535 | { |
1396 | 1536 | case 'title' : |
1397 | 1537 | case 'content' : |
1398 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1538 | + if($search_keyword) { |
|
1539 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1540 | + } |
|
1399 | 1541 | $args->{"s_".$search_target} = $search_keyword; |
1400 | 1542 | $use_division = true; |
1401 | 1543 | break; |
1402 | 1544 | case 'title_content' : |
1403 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1545 | + if($search_keyword) { |
|
1546 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1547 | + } |
|
1404 | 1548 | $args->s_title = $search_keyword; |
1405 | 1549 | $args->s_content = $search_keyword; |
1406 | 1550 | $use_division = true; |
1407 | 1551 | break; |
1408 | 1552 | case 'user_id' : |
1409 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1553 | + if($search_keyword) { |
|
1554 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1555 | + } |
|
1410 | 1556 | $args->s_user_id = $search_keyword; |
1411 | 1557 | $args->sort_index = 'documents.'.$args->sort_index; |
1412 | 1558 | break; |
@@ -1414,18 +1560,28 @@ discard block |
||
1414 | 1560 | case 'nick_name' : |
1415 | 1561 | case 'email_address' : |
1416 | 1562 | case 'homepage' : |
1417 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1563 | + if($search_keyword) { |
|
1564 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
1565 | + } |
|
1418 | 1566 | $args->{"s_".$search_target} = $search_keyword; |
1419 | 1567 | break; |
1420 | 1568 | case 'is_notice' : |
1421 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
1422 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
1423 | - else $args->{"s_".$search_target} = ''; |
|
1569 | + if($search_keyword=='N') { |
|
1570 | + $args->{"s_".$search_target} = 'N'; |
|
1571 | + } elseif($search_keyword=='Y') { |
|
1572 | + $args->{"s_".$search_target} = 'Y'; |
|
1573 | + } else { |
|
1574 | + $args->{"s_".$search_target} = ''; |
|
1575 | + } |
|
1424 | 1576 | break; |
1425 | 1577 | case 'is_secret' : |
1426 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1427 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1428 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1578 | + if($search_keyword=='N') { |
|
1579 | + $args->statusList = array($this->getConfigStatus('public')); |
|
1580 | + } elseif($search_keyword=='Y') { |
|
1581 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
1582 | + } elseif($search_keyword=='temp') { |
|
1583 | + $args->statusList = array($this->getConfigStatus('temp')); |
|
1584 | + } |
|
1429 | 1585 | break; |
1430 | 1586 | case 'member_srl' : |
1431 | 1587 | case 'readed_count' : |
@@ -1488,13 +1644,14 @@ discard block |
||
1488 | 1644 | if ($searchOpt->isExtraVars) |
1489 | 1645 | { |
1490 | 1646 | $query_id = 'document.getDocumentListExtraSort'; |
1491 | - } |
|
1492 | - else |
|
1647 | + } else |
|
1493 | 1648 | { |
1494 | 1649 | /** |
1495 | 1650 | * list_order asc sort of division that can be used only when |
1496 | 1651 | */ |
1497 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1652 | + if($args->sort_index != 'list_order' || $args->order_type != 'asc') { |
|
1653 | + $use_division = false; |
|
1654 | + } |
|
1498 | 1655 | |
1499 | 1656 | /** |
1500 | 1657 | * If it is true, use_division changed to use the document division |
@@ -1509,8 +1666,7 @@ discard block |
||
1509 | 1666 | { |
1510 | 1667 | $listSqlID = 'document.getDocumentListUseIndex'; |
1511 | 1668 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
1512 | - } |
|
1513 | - else |
|
1669 | + } else |
|
1514 | 1670 | { |
1515 | 1671 | $listSqlID = 'document.getDocumentList'; |
1516 | 1672 | $divisionSqlID = 'document.getDocumentDivision'; |
@@ -1567,7 +1723,9 @@ discard block |
||
1567 | 1723 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
1568 | 1724 | $last_division_args->list_order = $last_division; |
1569 | 1725 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
1570 | - if($output->data->count<1) $last_division = null; |
|
1726 | + if($output->data->count<1) { |
|
1727 | + $last_division = null; |
|
1728 | + } |
|
1571 | 1729 | } |
1572 | 1730 | |
1573 | 1731 | $args->division = $division; |
@@ -1608,8 +1766,12 @@ discard block |
||
1608 | 1766 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
1609 | 1767 | $document_list = $output->data; |
1610 | 1768 | |
1611 | - if(!$document_list) return array(); |
|
1612 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
1769 | + if(!$document_list) { |
|
1770 | + return array(); |
|
1771 | + } |
|
1772 | + if(!is_array($document_list)) { |
|
1773 | + $document_list = array($document_list); |
|
1774 | + } |
|
1613 | 1775 | |
1614 | 1776 | return $document_list; |
1615 | 1777 | } |
@@ -1624,8 +1786,7 @@ discard block |
||
1624 | 1786 | if(Mobile::isFromMobilePhone()) |
1625 | 1787 | { |
1626 | 1788 | $iconSkin = $documentConfig->micons; |
1627 | - } |
|
1628 | - else |
|
1789 | + } else |
|
1629 | 1790 | { |
1630 | 1791 | $iconSkin = $documentConfig->icons; |
1631 | 1792 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function getDocumentExtraVarsFromDB($documentSrls) |
39 | 39 | { |
40 | - if(!is_array($documentSrls) || count($documentSrls) == 0) |
|
40 | + if (!is_array($documentSrls) || count($documentSrls) == 0) |
|
41 | 41 | { |
42 | 42 | return new BaseObject(-1, 'msg_invalid_request'); |
43 | 43 | } |
@@ -58,52 +58,52 @@ discard block |
||
58 | 58 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
59 | 59 | |
60 | 60 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
61 | - if(count($_document_list) <= 0) return; |
|
61 | + if (count($_document_list) <= 0) return; |
|
62 | 62 | |
63 | 63 | // Find all called the document object variable has been set extension |
64 | 64 | $document_srls = array(); |
65 | - foreach($_document_list as $key => $val) |
|
65 | + foreach ($_document_list as $key => $val) |
|
66 | 66 | { |
67 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
67 | + if (!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
68 | 68 | $checked_documents[$val->document_srl] = true; |
69 | 69 | $document_srls[] = $val->document_srl; |
70 | 70 | } |
71 | 71 | // If the document number, return detected |
72 | - if(!count($document_srls)) return; |
|
72 | + if (!count($document_srls)) return; |
|
73 | 73 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
74 | 74 | //$obj->document_srl = implode(',',$document_srls); |
75 | 75 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
76 | - if($output->toBool() && $output->data) |
|
76 | + if ($output->toBool() && $output->data) |
|
77 | 77 | { |
78 | - foreach($output->data as $key => $val) |
|
78 | + foreach ($output->data as $key => $val) |
|
79 | 79 | { |
80 | - if(!isset($val->value)) continue; |
|
81 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
80 | + if (!isset($val->value)) continue; |
|
81 | + if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
82 | 82 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | $user_lang_code = Context::getLangType(); |
87 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
87 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
88 | 88 | { |
89 | 89 | $document_srl = $document_srls[$i]; |
90 | 90 | unset($vars); |
91 | 91 | |
92 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
92 | + if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
93 | 93 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
94 | 94 | $extra_keys = $this->getExtraKeys($module_srl); |
95 | 95 | $vars = $extra_vars[$document_srl]; |
96 | 96 | $document_lang_code = $_document_list[$document_srl]->get('lang_code'); |
97 | 97 | // Expand the variable processing |
98 | - if(count($extra_keys)) |
|
98 | + if (count($extra_keys)) |
|
99 | 99 | { |
100 | - foreach($extra_keys as $idx => $key) |
|
100 | + foreach ($extra_keys as $idx => $key) |
|
101 | 101 | { |
102 | 102 | $extra_keys[$idx] = clone($key); |
103 | 103 | $val = $vars[$idx]; |
104 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
105 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
106 | - else if(isset($val[0])) $v = $val[0]; |
|
104 | + if (isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
105 | + else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
106 | + else if (isset($val[0])) $v = $val[0]; |
|
107 | 107 | else $v = null; |
108 | 108 | $extra_keys[$idx]->value = $v; |
109 | 109 | } |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | $evars = new ExtraVar($module_srl); |
114 | 114 | $evars->setExtraVarKeys($extra_keys); |
115 | 115 | // Title Processing |
116 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
116 | + if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]); |
|
117 | 117 | // Information processing |
118 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
118 | + if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]); |
|
119 | 119 | |
120 | 120 | // static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남 |
121 | 121 | /* |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | * @param array $columnList |
138 | 138 | * @return documentItem |
139 | 139 | */ |
140 | - function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
140 | + function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
141 | 141 | { |
142 | - if(!$document_srl) return new documentItem(); |
|
142 | + if (!$document_srl) return new documentItem(); |
|
143 | 143 | |
144 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
144 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
145 | 145 | { |
146 | 146 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
147 | - if(!$oDocument->isExists()) |
|
147 | + if (!$oDocument->isExists()) |
|
148 | 148 | { |
149 | 149 | return $oDocument; |
150 | 150 | } |
151 | 151 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
152 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
152 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
153 | 153 | } |
154 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
154 | + if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
155 | 155 | |
156 | 156 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
157 | 157 | } |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | * @param array $columnList |
165 | 165 | * @return array value type is documentItem |
166 | 166 | */ |
167 | - function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
167 | + function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
168 | 168 | { |
169 | - if(is_array($document_srls)) |
|
169 | + if (is_array($document_srls)) |
|
170 | 170 | { |
171 | 171 | $list_count = count($document_srls); |
172 | - $document_srls = implode(',',$document_srls); |
|
172 | + $document_srls = implode(',', $document_srls); |
|
173 | 173 | } |
174 | 174 | else |
175 | 175 | { |
@@ -182,33 +182,33 @@ discard block |
||
182 | 182 | |
183 | 183 | $output = executeQuery('document.getDocuments', $args, $columnList); |
184 | 184 | $document_list = $output->data; |
185 | - if(!$document_list) return; |
|
186 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
185 | + if (!$document_list) return; |
|
186 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
187 | 187 | |
188 | 188 | $document_count = count($document_list); |
189 | - foreach($document_list as $key => $attribute) |
|
189 | + foreach ($document_list as $key => $attribute) |
|
190 | 190 | { |
191 | 191 | $document_srl = $attribute->document_srl; |
192 | - if(!$document_srl) continue; |
|
192 | + if (!$document_srl) continue; |
|
193 | 193 | |
194 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
194 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
195 | 195 | { |
196 | 196 | $oDocument = null; |
197 | 197 | $oDocument = new documentItem(); |
198 | 198 | $oDocument->setAttribute($attribute, false); |
199 | - if($is_admin) $oDocument->setGrant(); |
|
199 | + if ($is_admin) $oDocument->setGrant(); |
|
200 | 200 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
201 | 201 | } |
202 | 202 | |
203 | 203 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
204 | 204 | } |
205 | 205 | |
206 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
206 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
207 | 207 | |
208 | 208 | $output = null; |
209 | - if(count($result)) |
|
209 | + if (count($result)) |
|
210 | 210 | { |
211 | - foreach($result as $document_srl => $val) |
|
211 | + foreach ($result as $document_srl => $val) |
|
212 | 212 | { |
213 | 213 | $output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
214 | 214 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param array $columnList |
226 | 226 | * @return BaseObject |
227 | 227 | */ |
228 | - function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) |
|
228 | + function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array()) |
|
229 | 229 | { |
230 | 230 | $sort_check = $this->_setSortIndex($obj, $load_extra_vars); |
231 | 231 | $obj->sort_index = $sort_check->sort_index; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | // Call trigger (before) |
236 | 236 | // This trigger can be used to set an alternative output using a different search method |
237 | 237 | $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj); |
238 | - if($output instanceof BaseObject && !$output->toBool()) |
|
238 | + if ($output instanceof BaseObject && !$output->toBool()) |
|
239 | 239 | { |
240 | 240 | return $output; |
241 | 241 | } |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | $output = $obj->use_alternate_output; |
253 | 253 | unset($obj->use_alternate_output); |
254 | 254 | } |
255 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
255 | + elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars')) |
|
256 | 256 | { |
257 | 257 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
258 | - $args->sort_index = str_replace('documents.','',$args->sort_index); |
|
258 | + $args->sort_index = str_replace('documents.', '', $args->sort_index); |
|
259 | 259 | $output = executeQueryArray($query_id, $args); |
260 | 260 | } |
261 | 261 | elseif ($sort_check->isExtraVars) |
@@ -267,16 +267,16 @@ discard block |
||
267 | 267 | // document.getDocumentList query execution |
268 | 268 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
269 | 269 | $groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1); |
270 | - if(isset($groupByQuery[$query_id])) |
|
270 | + if (isset($groupByQuery[$query_id])) |
|
271 | 271 | { |
272 | 272 | $group_args = clone($args); |
273 | 273 | $group_args->sort_index = 'documents.'.$args->sort_index; |
274 | 274 | $output = executeQueryArray($query_id, $group_args); |
275 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
275 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
276 | 276 | |
277 | - foreach($output->data as $key => $val) |
|
277 | + foreach ($output->data as $key => $val) |
|
278 | 278 | { |
279 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
279 | + if ($val->document_srl) $target_srls[] = $val->document_srl; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | $page_navigation = $output->page_navigation; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $virtual_number = $keys[0]; |
285 | 285 | |
286 | 286 | $target_args = new stdClass(); |
287 | - $target_args->document_srls = implode(',',$target_srls); |
|
287 | + $target_args->document_srls = implode(',', $target_srls); |
|
288 | 288 | $target_args->list_order = $args->sort_index; |
289 | 289 | $target_args->order_type = $args->order_type; |
290 | 290 | $target_args->list_count = $args->list_count; |
@@ -301,35 +301,35 @@ discard block |
||
301 | 301 | } |
302 | 302 | } |
303 | 303 | // Return if no result or an error occurs |
304 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
304 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
305 | 305 | $idx = 0; |
306 | 306 | $data = $output->data; |
307 | 307 | unset($output->data); |
308 | 308 | |
309 | - if(!isset($virtual_number)) |
|
309 | + if (!isset($virtual_number)) |
|
310 | 310 | { |
311 | 311 | $keys = array_keys($data); |
312 | 312 | $virtual_number = $keys[0]; |
313 | 313 | } |
314 | 314 | |
315 | - if($except_notice) |
|
315 | + if ($except_notice) |
|
316 | 316 | { |
317 | - foreach($data as $key => $attribute) |
|
317 | + foreach ($data as $key => $attribute) |
|
318 | 318 | { |
319 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
319 | + if ($attribute->is_notice == 'Y') $virtual_number--; |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - foreach($data as $key => $attribute) |
|
323 | + foreach ($data as $key => $attribute) |
|
324 | 324 | { |
325 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
325 | + if ($except_notice && $attribute->is_notice == 'Y') continue; |
|
326 | 326 | $document_srl = $attribute->document_srl; |
327 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
327 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
328 | 328 | { |
329 | 329 | $oDocument = null; |
330 | 330 | $oDocument = new documentItem(); |
331 | 331 | $oDocument->setAttribute($attribute, false); |
332 | - if($is_admin) $oDocument->setGrant(); |
|
332 | + if ($is_admin) $oDocument->setGrant(); |
|
333 | 333 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
334 | 334 | } |
335 | 335 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | $virtual_number--; |
338 | 338 | } |
339 | 339 | |
340 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
340 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
341 | 341 | |
342 | - if(count($output->data)) |
|
342 | + if (count($output->data)) |
|
343 | 343 | { |
344 | - foreach($output->data as $number => $document) |
|
344 | + foreach ($output->data as $number => $document) |
|
345 | 345 | { |
346 | 346 | $output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl]; |
347 | 347 | } |
@@ -363,16 +363,16 @@ discard block |
||
363 | 363 | { |
364 | 364 | $args = new stdClass(); |
365 | 365 | $args->module_srl = $obj->module_srl; |
366 | - $args->category_srl= $obj->category_srl; |
|
366 | + $args->category_srl = $obj->category_srl; |
|
367 | 367 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
368 | - if(!$output->toBool()||!$output->data) return; |
|
368 | + if (!$output->toBool() || !$output->data) return; |
|
369 | 369 | |
370 | - foreach($output->data as $key => $val) |
|
370 | + foreach ($output->data as $key => $val) |
|
371 | 371 | { |
372 | 372 | $document_srl = $val->document_srl; |
373 | - if(!$document_srl) continue; |
|
373 | + if (!$document_srl) continue; |
|
374 | 374 | |
375 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
375 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
376 | 376 | { |
377 | 377 | $oDocument = null; |
378 | 378 | $oDocument = new documentItem(); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | } |
384 | 384 | $this->setToAllDocumentExtraVars(); |
385 | 385 | |
386 | - foreach($result->data as $document_srl => $val) |
|
386 | + foreach ($result->data as $document_srl => $val) |
|
387 | 387 | { |
388 | 388 | $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
389 | 389 | } |
@@ -399,20 +399,20 @@ discard block |
||
399 | 399 | */ |
400 | 400 | function getExtraKeys($module_srl) |
401 | 401 | { |
402 | - if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
402 | + if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
403 | 403 | { |
404 | 404 | $keys = false; |
405 | 405 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
406 | - if($oCacheHandler->isSupport()) |
|
406 | + if ($oCacheHandler->isSupport()) |
|
407 | 407 | { |
408 | - $object_key = 'module_document_extra_keys:' . $module_srl; |
|
408 | + $object_key = 'module_document_extra_keys:'.$module_srl; |
|
409 | 409 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
410 | 410 | $keys = $oCacheHandler->get($cache_key); |
411 | 411 | } |
412 | 412 | |
413 | 413 | $oExtraVar = ExtraVar::getInstance($module_srl); |
414 | 414 | |
415 | - if($keys === false) |
|
415 | + if ($keys === false) |
|
416 | 416 | { |
417 | 417 | $obj = new stdClass(); |
418 | 418 | $obj->module_srl = $module_srl; |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | |
423 | 423 | // correcting index order |
424 | 424 | $isFixed = FALSE; |
425 | - if(is_array($output->data)) |
|
425 | + if (is_array($output->data)) |
|
426 | 426 | { |
427 | 427 | $prevIdx = 0; |
428 | - foreach($output->data as $no => $value) |
|
428 | + foreach ($output->data as $no => $value) |
|
429 | 429 | { |
430 | 430 | // case first |
431 | - if($prevIdx == 0 && $value->idx != 1) |
|
431 | + if ($prevIdx == 0 && $value->idx != 1) |
|
432 | 432 | { |
433 | 433 | $args = new stdClass(); |
434 | 434 | $args->module_srl = $module_srl; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | // case others |
445 | - if($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
445 | + if ($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
446 | 446 | { |
447 | 447 | $args = new stdClass(); |
448 | 448 | $args->module_srl = $module_srl; |
@@ -459,16 +459,16 @@ discard block |
||
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | - if($isFixed) |
|
462 | + if ($isFixed) |
|
463 | 463 | { |
464 | 464 | $output = executeQueryArray('document.getDocumentExtraKeys', $obj); |
465 | 465 | } |
466 | 466 | |
467 | 467 | $oExtraVar->setExtraVarKeys($output->data); |
468 | 468 | $keys = $oExtraVar->getExtraVars(); |
469 | - if(!$keys) $keys = array(); |
|
469 | + if (!$keys) $keys = array(); |
|
470 | 470 | |
471 | - if($oCacheHandler->isSupport()) |
|
471 | + if ($oCacheHandler->isSupport()) |
|
472 | 472 | { |
473 | 473 | $oCacheHandler->put($cache_key, $keys); |
474 | 474 | } |
@@ -489,14 +489,14 @@ discard block |
||
489 | 489 | */ |
490 | 490 | function getExtraVars($module_srl, $document_srl) |
491 | 491 | { |
492 | - if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
492 | + if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
493 | 493 | { |
494 | 494 | // Extended to extract the values of variables set |
495 | 495 | $oDocument = $this->getDocument($document_srl, false); |
496 | 496 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
497 | 497 | $this->setToAllDocumentExtraVars(); |
498 | 498 | } |
499 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
499 | + if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
500 | 500 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
501 | 501 | } |
502 | 502 | |
@@ -519,71 +519,71 @@ discard block |
||
519 | 519 | |
520 | 520 | $oDocumentController = getController('document'); |
521 | 521 | // Members must be a possible feature |
522 | - if($logged_info->member_srl) |
|
522 | + if ($logged_info->member_srl) |
|
523 | 523 | { |
524 | 524 | $oDocumentModel = getModel('document'); |
525 | 525 | $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress'); |
526 | 526 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
527 | 527 | $module_srl = $oDocument->get('module_srl'); |
528 | 528 | $member_srl = $oDocument->get('member_srl'); |
529 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
529 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
530 | 530 | |
531 | 531 | $oModuleModel = getModel('module'); |
532 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
533 | - if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl) |
|
532 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
533 | + if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
534 | 534 | { |
535 | 535 | // Add a Referral Button |
536 | 536 | $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); |
537 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); |
|
537 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript'); |
|
538 | 538 | } |
539 | 539 | |
540 | - if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl) |
|
540 | + if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
541 | 541 | { |
542 | 542 | // Add button to negative |
543 | - $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
544 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); |
|
543 | + $url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
544 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | // Adding Report |
548 | 548 | $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl); |
549 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript'); |
|
549 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript'); |
|
550 | 550 | |
551 | 551 | // Add Bookmark button |
552 | 552 | $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); |
553 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript'); |
|
553 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript'); |
|
554 | 554 | } |
555 | 555 | // Add print button |
556 | - $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl); |
|
557 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument'); |
|
556 | + $url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl); |
|
557 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument'); |
|
558 | 558 | // Call a trigger (after) |
559 | 559 | ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list); |
560 | - if($this->grant->manager) |
|
560 | + if ($this->grant->manager) |
|
561 | 561 | { |
562 | 562 | $str_confirm = Context::getLang('confirm_move'); |
563 | 563 | $url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl); |
564 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript'); |
|
564 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript'); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | // If you are managing to find posts by ip |
568 | - if($logged_info->is_admin == 'Y') |
|
568 | + if ($logged_info->is_admin == 'Y') |
|
569 | 569 | { |
570 | 570 | $oDocumentModel = getModel('document'); |
571 | - $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
571 | + $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
572 | 572 | |
573 | - if($oDocument->isExists()) |
|
573 | + if ($oDocument->isExists()) |
|
574 | 574 | { |
575 | 575 | // Find a post equivalent to ip address |
576 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress()); |
|
577 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); |
|
576 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress()); |
|
577 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); |
|
578 | 578 | |
579 | 579 | $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress()); |
580 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript'); |
|
580 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript'); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | // Changing the language of pop-up menu |
584 | 584 | $menus = Context::get('document_popup_menu_list'); |
585 | 585 | $menus_count = count($menus); |
586 | - for($i=0;$i<$menus_count;$i++) |
|
586 | + for ($i = 0; $i < $menus_count; $i++) |
|
587 | 587 | { |
588 | 588 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
589 | 589 | } |
@@ -599,13 +599,13 @@ discard block |
||
599 | 599 | */ |
600 | 600 | function getDocumentCount($module_srl, $search_obj = NULL) |
601 | 601 | { |
602 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
602 | + if (is_null($search_obj)) $search_obj = new stdClass(); |
|
603 | 603 | $search_obj->module_srl = $module_srl; |
604 | 604 | |
605 | 605 | $output = executeQuery('document.getDocumentCount', $search_obj); |
606 | 606 | // Return total number of |
607 | 607 | $total_count = $output->data->count; |
608 | - return (int)$total_count; |
|
608 | + return (int) $total_count; |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | function getDocumentCountByGroupStatus($search_obj = NULL) |
617 | 617 | { |
618 | 618 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
619 | - if(!$output->toBool()) return array(); |
|
619 | + if (!$output->toBool()) return array(); |
|
620 | 620 | |
621 | 621 | return $output->data; |
622 | 622 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | $output = executeQuery('document.getDocumentExtraVarsCount', $args); |
636 | 636 | // Return total number of |
637 | 637 | $total_count = $output->data->count; |
638 | - return (int)$total_count; |
|
638 | + return (int) $total_count; |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | /** |
@@ -652,29 +652,29 @@ discard block |
||
652 | 652 | |
653 | 653 | $this->_setSearchOption($opt, $args, $query_id, $use_division); |
654 | 654 | |
655 | - if($sort_check->isExtraVars) |
|
655 | + if ($sort_check->isExtraVars) |
|
656 | 656 | { |
657 | 657 | return 1; |
658 | 658 | } |
659 | 659 | else |
660 | 660 | { |
661 | - if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
661 | + if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
662 | 662 | { |
663 | - if($args->order_type === 'desc') |
|
663 | + if ($args->order_type === 'desc') |
|
664 | 664 | { |
665 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
665 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
666 | 666 | } |
667 | 667 | else |
668 | 668 | { |
669 | 669 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
670 | 670 | } |
671 | 671 | } |
672 | - elseif($sort_check->sort_index === 'regdate') |
|
672 | + elseif ($sort_check->sort_index === 'regdate') |
|
673 | 673 | { |
674 | 674 | |
675 | - if($args->order_type === 'asc') |
|
675 | + if ($args->order_type === 'asc') |
|
676 | 676 | { |
677 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
677 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
678 | 678 | } |
679 | 679 | else |
680 | 680 | { |
@@ -689,9 +689,9 @@ discard block |
||
689 | 689 | } |
690 | 690 | |
691 | 691 | // Guhanhu total number of the article search page |
692 | - $output = executeQuery($query_id . 'Page', $args); |
|
692 | + $output = executeQuery($query_id.'Page', $args); |
|
693 | 693 | $count = $output->data->count; |
694 | - $page = (int)(($count-1)/$opt->list_count)+1; |
|
694 | + $page = (int) (($count - 1) / $opt->list_count) + 1; |
|
695 | 695 | return $page; |
696 | 696 | } |
697 | 697 | |
@@ -703,16 +703,16 @@ discard block |
||
703 | 703 | */ |
704 | 704 | function getCategory($category_srl, $columnList = array()) |
705 | 705 | { |
706 | - $args =new stdClass(); |
|
706 | + $args = new stdClass(); |
|
707 | 707 | $args->category_srl = $category_srl; |
708 | 708 | $output = executeQuery('document.getCategory', $args, $columnList); |
709 | 709 | |
710 | 710 | $node = $output->data; |
711 | - if(!$node) return; |
|
711 | + if (!$node) return; |
|
712 | 712 | |
713 | - if($node->group_srls) |
|
713 | + if ($node->group_srls) |
|
714 | 714 | { |
715 | - $group_srls = explode(',',$node->group_srls); |
|
715 | + $group_srls = explode(',', $node->group_srls); |
|
716 | 716 | unset($node->group_srls); |
717 | 717 | $node->group_srls = $group_srls; |
718 | 718 | } |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | { |
734 | 734 | $args = new stdClass(); |
735 | 735 | $args->category_srl = $category_srl; |
736 | - $output = executeQuery('document.getChildCategoryCount',$args); |
|
737 | - if($output->data->count > 0) return true; |
|
736 | + $output = executeQuery('document.getChildCategoryCount', $args); |
|
737 | + if ($output->data->count > 0) return true; |
|
738 | 738 | return false; |
739 | 739 | } |
740 | 740 | |
@@ -747,15 +747,15 @@ discard block |
||
747 | 747 | */ |
748 | 748 | function getCategoryList($module_srl, $columnList = array()) |
749 | 749 | { |
750 | - $module_srl = (int)$module_srl; |
|
750 | + $module_srl = (int) $module_srl; |
|
751 | 751 | |
752 | 752 | // Category of the target module file swollen |
753 | 753 | $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); |
754 | 754 | // If the target file to the cache file regeneration category |
755 | - if(!file_exists($filename)) |
|
755 | + if (!file_exists($filename)) |
|
756 | 756 | { |
757 | 757 | $oDocumentController = getController('document'); |
758 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
758 | + if (!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | include($filename); |
@@ -775,10 +775,10 @@ discard block |
||
775 | 775 | */ |
776 | 776 | function _arrangeCategory(&$document_category, $list, $depth) |
777 | 777 | { |
778 | - if(!count($list)) return; |
|
778 | + if (!count($list)) return; |
|
779 | 779 | $idx = 0; |
780 | 780 | $list_order = array(); |
781 | - foreach($list as $key => $val) |
|
781 | + foreach ($list as $key => $val) |
|
782 | 782 | { |
783 | 783 | $obj = new stdClass; |
784 | 784 | $obj->mid = $val['mid']; |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | $obj->parent_srl = $val['parent_srl']; |
788 | 788 | $obj->title = $obj->text = $val['text']; |
789 | 789 | $obj->description = $val['description']; |
790 | - $obj->expand = $val['expand']=='Y'?true:false; |
|
790 | + $obj->expand = $val['expand'] == 'Y' ?true:false; |
|
791 | 791 | $obj->color = $val['color']; |
792 | 792 | $obj->document_count = $val['document_count']; |
793 | 793 | $obj->depth = $depth; |
@@ -795,26 +795,26 @@ discard block |
||
795 | 795 | $obj->childs = array(); |
796 | 796 | $obj->grant = $val['grant']; |
797 | 797 | |
798 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
798 | + if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
799 | 799 | else $selected = false; |
800 | 800 | |
801 | 801 | $obj->selected = $selected; |
802 | 802 | |
803 | 803 | $list_order[$idx++] = $obj->category_srl; |
804 | 804 | // If you have a parent category of child nodes apply data |
805 | - if($obj->parent_srl) |
|
805 | + if ($obj->parent_srl) |
|
806 | 806 | { |
807 | 807 | $parent_srl = $obj->parent_srl; |
808 | 808 | $document_count = $obj->document_count; |
809 | 809 | $expand = $obj->expand; |
810 | - if($selected) $expand = true; |
|
810 | + if ($selected) $expand = true; |
|
811 | 811 | |
812 | - while($parent_srl) |
|
812 | + while ($parent_srl) |
|
813 | 813 | { |
814 | 814 | $document_category[$parent_srl]->document_count += $document_count; |
815 | 815 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
816 | 816 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
817 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
817 | + if ($expand) $document_category[$parent_srl]->expand = $expand; |
|
818 | 818 | |
819 | 819 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
820 | 820 | } |
@@ -822,10 +822,10 @@ discard block |
||
822 | 822 | |
823 | 823 | $document_category[$key] = $obj; |
824 | 824 | |
825 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
825 | + if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1); |
|
826 | 826 | } |
827 | 827 | $document_category[$list_order[0]]->first = true; |
828 | - $document_category[$list_order[count($list_order)-1]]->last = true; |
|
828 | + $document_category[$list_order[count($list_order) - 1]]->last = true; |
|
829 | 829 | } |
830 | 830 | |
831 | 831 | /** |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | $args->module_srl = $module_srl; |
841 | 841 | $args->category_srl = $category_srl; |
842 | 842 | $output = executeQuery('document.getCategoryDocumentCount', $args); |
843 | - return (int)$output->data->count; |
|
843 | + return (int) $output->data->count; |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | /** |
@@ -850,8 +850,8 @@ discard block |
||
850 | 850 | */ |
851 | 851 | function getCategoryXmlFile($module_srl) |
852 | 852 | { |
853 | - $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); |
|
854 | - if(!file_exists($xml_file)) |
|
853 | + $xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl); |
|
854 | + if (!file_exists($xml_file)) |
|
855 | 855 | { |
856 | 856 | $oDocumentController = getController('document'); |
857 | 857 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -866,8 +866,8 @@ discard block |
||
866 | 866 | */ |
867 | 867 | function getCategoryPhpFile($module_srl) |
868 | 868 | { |
869 | - $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); |
|
870 | - if(!file_exists($php_file)) |
|
869 | + $php_file = sprintf('files/cache/document_category/%s.php', $module_srl); |
|
870 | + if (!file_exists($php_file)) |
|
871 | 871 | { |
872 | 872 | $oDocumentController = getController('document'); |
873 | 873 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | */ |
883 | 883 | function getMonthlyArchivedList($obj) |
884 | 884 | { |
885 | - if($obj->mid) |
|
885 | + if ($obj->mid) |
|
886 | 886 | { |
887 | 887 | $oModuleModel = getModel('module'); |
888 | 888 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -890,13 +890,13 @@ discard block |
||
890 | 890 | } |
891 | 891 | // Module_srl passed the array may be a check whether the array |
892 | 892 | $args = new stdClass; |
893 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
893 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
894 | 894 | else $args->module_srl = $obj->module_srl; |
895 | 895 | |
896 | 896 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
897 | - if(!$output->toBool()||!$output->data) return $output; |
|
897 | + if (!$output->toBool() || !$output->data) return $output; |
|
898 | 898 | |
899 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
899 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
900 | 900 | |
901 | 901 | return $output; |
902 | 902 | } |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | */ |
909 | 909 | function getDailyArchivedList($obj) |
910 | 910 | { |
911 | - if($obj->mid) |
|
911 | + if ($obj->mid) |
|
912 | 912 | { |
913 | 913 | $oModuleModel = getModel('module'); |
914 | 914 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -916,14 +916,14 @@ discard block |
||
916 | 916 | } |
917 | 917 | // Module_srl passed the array may be a check whether the array |
918 | 918 | $args = new stdClass; |
919 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
919 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
920 | 920 | else $args->module_srl = $obj->module_srl; |
921 | 921 | $args->regdate = $obj->regdate; |
922 | 922 | |
923 | 923 | $output = executeQuery('document.getDailyArchivedList', $args); |
924 | - if(!$output->toBool()) return $output; |
|
924 | + if (!$output->toBool()) return $output; |
|
925 | 925 | |
926 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
926 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
927 | 927 | |
928 | 928 | return $output; |
929 | 929 | } |
@@ -934,17 +934,17 @@ discard block |
||
934 | 934 | */ |
935 | 935 | function getDocumentCategories() |
936 | 936 | { |
937 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
937 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
938 | 938 | $module_srl = Context::get('module_srl'); |
939 | - $categories= $this->getCategoryList($module_srl); |
|
939 | + $categories = $this->getCategoryList($module_srl); |
|
940 | 940 | $lang = Context::get('lang'); |
941 | 941 | // No additional category |
942 | 942 | $output = "0,0,{$lang->none_category}\n"; |
943 | - if($categories) |
|
943 | + if ($categories) |
|
944 | 944 | { |
945 | - foreach($categories as $category_srl => $category) |
|
945 | + foreach ($categories as $category_srl => $category) |
|
946 | 946 | { |
947 | - $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title); |
|
947 | + $output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | $this->add('categories', $output); |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | */ |
957 | 957 | function getDocumentConfig() |
958 | 958 | { |
959 | - if($this->documentConfig === NULL) |
|
959 | + if ($this->documentConfig === NULL) |
|
960 | 960 | { |
961 | 961 | $oModuleModel = getModel('module'); |
962 | 962 | $config = $oModuleModel->getModuleConfig('document'); |
@@ -1029,11 +1029,11 @@ discard block |
||
1029 | 1029 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
1030 | 1030 | // Check permissions |
1031 | 1031 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
1032 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
1032 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
1033 | 1033 | |
1034 | 1034 | $category_srl = Context::get('category_srl'); |
1035 | 1035 | $category_info = $this->getCategory($category_srl); |
1036 | - if(!$category_info) |
|
1036 | + if (!$category_info) |
|
1037 | 1037 | { |
1038 | 1038 | return new BaseObject(-1, 'msg_invalid_request'); |
1039 | 1039 | } |
@@ -1049,14 +1049,14 @@ discard block |
||
1049 | 1049 | */ |
1050 | 1050 | function getDocumentSrlByAlias($mid, $alias) |
1051 | 1051 | { |
1052 | - if(!$mid || !$alias) return null; |
|
1052 | + if (!$mid || !$alias) return null; |
|
1053 | 1053 | $site_module_info = Context::get('site_module_info'); |
1054 | 1054 | $args = new stdClass; |
1055 | 1055 | $args->mid = $mid; |
1056 | 1056 | $args->alias_title = $alias; |
1057 | 1057 | $args->site_srl = $site_module_info->site_srl; |
1058 | 1058 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
1059 | - if(!$output->data) return null; |
|
1059 | + if (!$output->data) return null; |
|
1060 | 1060 | else return $output->data->document_srl; |
1061 | 1061 | } |
1062 | 1062 | |
@@ -1068,15 +1068,15 @@ discard block |
||
1068 | 1068 | */ |
1069 | 1069 | function getDocumentSrlByTitle($module_srl, $title) |
1070 | 1070 | { |
1071 | - if(!$module_srl || !$title) return null; |
|
1071 | + if (!$module_srl || !$title) return null; |
|
1072 | 1072 | $args = new stdClass; |
1073 | 1073 | $args->module_srl = $module_srl; |
1074 | 1074 | $args->title = $title; |
1075 | 1075 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
1076 | - if(!$output->data) return null; |
|
1076 | + if (!$output->data) return null; |
|
1077 | 1077 | else |
1078 | 1078 | { |
1079 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
1079 | + if (is_array($output->data)) return $output->data[0]->document_srl; |
|
1080 | 1080 | return $output->data->document_srl; |
1081 | 1081 | } |
1082 | 1082 | } |
@@ -1088,12 +1088,12 @@ discard block |
||
1088 | 1088 | */ |
1089 | 1089 | function getAlias($document_srl) |
1090 | 1090 | { |
1091 | - if(!$document_srl) return null; |
|
1091 | + if (!$document_srl) return null; |
|
1092 | 1092 | $args = new stdClass; |
1093 | 1093 | $args->document_srl = $document_srl; |
1094 | 1094 | $output = executeQueryArray('document.getAliases', $args); |
1095 | 1095 | |
1096 | - if(!$output->data) return null; |
|
1096 | + if (!$output->data) return null; |
|
1097 | 1097 | else return $output->data[0]->alias_title; |
1098 | 1098 | } |
1099 | 1099 | |
@@ -1136,32 +1136,32 @@ discard block |
||
1136 | 1136 | { |
1137 | 1137 | // Variable check |
1138 | 1138 | $args = new stdClass; |
1139 | - $args->category_srl = $obj->category_srl?$obj->category_srl:null; |
|
1139 | + $args->category_srl = $obj->category_srl ? $obj->category_srl : null; |
|
1140 | 1140 | $args->sort_index = $obj->sort_index; |
1141 | - $args->order_type = $obj->order_type?$obj->order_type:'desc'; |
|
1142 | - $args->page = $obj->page?$obj->page:1; |
|
1143 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
1144 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
1141 | + $args->order_type = $obj->order_type ? $obj->order_type : 'desc'; |
|
1142 | + $args->page = $obj->page ? $obj->page : 1; |
|
1143 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
1144 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
1145 | 1145 | // Search options |
1146 | 1146 | $search_target = $obj->search_target; |
1147 | 1147 | $search_keyword = $obj->search_keyword; |
1148 | - if($search_target && $search_keyword) |
|
1148 | + if ($search_target && $search_keyword) |
|
1149 | 1149 | { |
1150 | - switch($search_target) |
|
1150 | + switch ($search_target) |
|
1151 | 1151 | { |
1152 | 1152 | case 'title' : |
1153 | 1153 | case 'content' : |
1154 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1154 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1155 | 1155 | $args->{"s_".$search_target} = $search_keyword; |
1156 | 1156 | $use_division = true; |
1157 | 1157 | break; |
1158 | 1158 | case 'title_content' : |
1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1159 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1160 | 1160 | $args->s_title = $search_keyword; |
1161 | 1161 | $args->s_content = $search_keyword; |
1162 | 1162 | break; |
1163 | 1163 | case 'user_id' : |
1164 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1164 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1165 | 1165 | $args->s_user_id = $search_keyword; |
1166 | 1166 | $args->sort_index = 'documents.'.$args->sort_index; |
1167 | 1167 | break; |
@@ -1169,13 +1169,13 @@ discard block |
||
1169 | 1169 | case 'nick_name' : |
1170 | 1170 | case 'email_address' : |
1171 | 1171 | case 'homepage' : |
1172 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1172 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1173 | 1173 | $args->{"s_".$search_target} = $search_keyword; |
1174 | 1174 | break; |
1175 | 1175 | case 'is_notice' : |
1176 | 1176 | case 'is_secret' : |
1177 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1178 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1177 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
1178 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1179 | 1179 | break; |
1180 | 1180 | case 'member_srl' : |
1181 | 1181 | case 'readed_count' : |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | case 'comment_count' : |
1185 | 1185 | case 'trackback_count' : |
1186 | 1186 | case 'uploaded_count' : |
1187 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
1187 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
1188 | 1188 | break; |
1189 | 1189 | case 'regdate' : |
1190 | 1190 | case 'last_update' : |
@@ -1196,9 +1196,9 @@ discard block |
||
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | $output = executeQueryArray('document.getTrashList', $args); |
1199 | - if($output->data) |
|
1199 | + if ($output->data) |
|
1200 | 1200 | { |
1201 | - foreach($output->data as $key => $attribute) |
|
1201 | + foreach ($output->data as $key => $attribute) |
|
1202 | 1202 | { |
1203 | 1203 | $oDocument = null; |
1204 | 1204 | $oDocument = new documentItem(); |
@@ -1217,46 +1217,46 @@ discard block |
||
1217 | 1217 | { |
1218 | 1218 | $args = new stdClass; |
1219 | 1219 | $document_srl = Context::get('document_srl'); |
1220 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
1220 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1221 | 1221 | |
1222 | 1222 | $point = Context::get('point'); |
1223 | - if($point != -1) $point = 1; |
|
1223 | + if ($point != -1) $point = 1; |
|
1224 | 1224 | |
1225 | 1225 | $oDocumentModel = getModel('document'); |
1226 | 1226 | $columnList = array('document_srl', 'module_srl'); |
1227 | 1227 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
1228 | 1228 | $module_srl = $oDocument->get('module_srl'); |
1229 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1229 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1230 | 1230 | |
1231 | 1231 | $oModuleModel = getModel('module'); |
1232 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
1233 | - if($point == -1) |
|
1232 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
1233 | + if ($point == -1) |
|
1234 | 1234 | { |
1235 | - if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1235 | + if ($document_config->use_vote_down != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1236 | 1236 | $args->below_point = 0; |
1237 | 1237 | } |
1238 | 1238 | else |
1239 | 1239 | { |
1240 | - if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1240 | + if ($document_config->use_vote_up != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
1241 | 1241 | $args->more_point = 0; |
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | $args->document_srl = $document_srl; |
1245 | 1245 | |
1246 | - $output = executeQueryArray('document.getVotedMemberList',$args); |
|
1247 | - if(!$output->toBool()) return $output; |
|
1246 | + $output = executeQueryArray('document.getVotedMemberList', $args); |
|
1247 | + if (!$output->toBool()) return $output; |
|
1248 | 1248 | |
1249 | 1249 | $oMemberModel = getModel('member'); |
1250 | - if($output->data) |
|
1250 | + if ($output->data) |
|
1251 | 1251 | { |
1252 | - foreach($output->data as $k => $d) |
|
1252 | + foreach ($output->data as $k => $d) |
|
1253 | 1253 | { |
1254 | 1254 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
1255 | 1255 | $output->data[$k]->src = $profile_image->src; |
1256 | 1256 | } |
1257 | 1257 | } |
1258 | 1258 | |
1259 | - $this->add('voted_member_list',$output->data); |
|
1259 | + $this->add('voted_member_list', $output->data); |
|
1260 | 1260 | } |
1261 | 1261 | |
1262 | 1262 | /** |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | function getStatusNameList() |
1267 | 1267 | { |
1268 | 1268 | global $lang; |
1269 | - if(!isset($lang->status_name_list)) |
|
1269 | + if (!isset($lang->status_name_list)) |
|
1270 | 1270 | return array_flip($this->getStatusList()); |
1271 | 1271 | else return $lang->status_name_list; |
1272 | 1272 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | { |
1282 | 1282 | $sortIndex = $obj->sort_index; |
1283 | 1283 | $isExtraVars = false; |
1284 | - if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) |
|
1284 | + if (!in_array($sortIndex, array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl'))) |
|
1285 | 1285 | { |
1286 | 1286 | // get module_srl extra_vars list |
1287 | 1287 | if ($load_extra_vars) |
@@ -1296,11 +1296,11 @@ discard block |
||
1296 | 1296 | else |
1297 | 1297 | { |
1298 | 1298 | $check_array = array(); |
1299 | - foreach($extra_output->data as $val) |
|
1299 | + foreach ($extra_output->data as $val) |
|
1300 | 1300 | { |
1301 | 1301 | $check_array[] = $val->eid; |
1302 | 1302 | } |
1303 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1303 | + if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
1304 | 1304 | else $isExtraVars = true; |
1305 | 1305 | } |
1306 | 1306 | } |
@@ -1328,13 +1328,13 @@ discard block |
||
1328 | 1328 | { |
1329 | 1329 | // Variable check |
1330 | 1330 | $args = new stdClass(); |
1331 | - $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null; |
|
1331 | + $args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null; |
|
1332 | 1332 | $args->order_type = $searchOpt->order_type; |
1333 | - $args->page = $searchOpt->page?$searchOpt->page:1; |
|
1334 | - $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20; |
|
1335 | - $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10; |
|
1336 | - $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null; |
|
1337 | - $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null; |
|
1333 | + $args->page = $searchOpt->page ? $searchOpt->page : 1; |
|
1334 | + $args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20; |
|
1335 | + $args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10; |
|
1336 | + $args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null; |
|
1337 | + $args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null; |
|
1338 | 1338 | $args->member_srl = $searchOpt->member_srl; |
1339 | 1339 | $args->member_srls = $searchOpt->member_srls; |
1340 | 1340 | |
@@ -1344,10 +1344,10 @@ discard block |
||
1344 | 1344 | |
1345 | 1345 | // Check the target and sequence alignment |
1346 | 1346 | $orderType = array('desc' => 1, 'asc' => 1); |
1347 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1347 | + if (!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
1348 | 1348 | |
1349 | 1349 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
1350 | - if($searchOpt->mid) |
|
1350 | + if ($searchOpt->mid) |
|
1351 | 1351 | { |
1352 | 1352 | $oModuleModel = getModel('module'); |
1353 | 1353 | $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -1355,30 +1355,30 @@ discard block |
||
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | // Module_srl passed the array may be a check whether the array |
1358 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1358 | + if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
1359 | 1359 | else $args->module_srl = $searchOpt->module_srl; |
1360 | 1360 | |
1361 | 1361 | // Except for the test module_srl |
1362 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1362 | + if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
1363 | 1363 | else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
1364 | 1364 | |
1365 | 1365 | // only admin document list, temp document showing |
1366 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1366 | + if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
1367 | 1367 | else |
1368 | 1368 | { |
1369 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1369 | + if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
1370 | 1370 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
1371 | 1371 | else |
1372 | 1372 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | // Category is selected, further sub-categories until all conditions |
1376 | - if($args->category_srl) |
|
1376 | + if ($args->category_srl) |
|
1377 | 1377 | { |
1378 | 1378 | $category_list = $this->getCategoryList($args->module_srl); |
1379 | 1379 | $category_info = $category_list[$args->category_srl]; |
1380 | 1380 | $category_info->childs[] = $args->category_srl; |
1381 | - $args->category_srl = implode(',',$category_info->childs); |
|
1381 | + $args->category_srl = implode(',', $category_info->childs); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | // Used to specify the default query id (based on several search options to query id modified) |
@@ -1391,24 +1391,24 @@ discard block |
||
1391 | 1391 | $search_target = $searchOpt->search_target; |
1392 | 1392 | $search_keyword = $searchOpt->search_keyword; |
1393 | 1393 | |
1394 | - if($search_target && $search_keyword) |
|
1394 | + if ($search_target && $search_keyword) |
|
1395 | 1395 | { |
1396 | - switch($search_target) |
|
1396 | + switch ($search_target) |
|
1397 | 1397 | { |
1398 | 1398 | case 'title' : |
1399 | 1399 | case 'content' : |
1400 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1400 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1401 | 1401 | $args->{"s_".$search_target} = $search_keyword; |
1402 | 1402 | $use_division = true; |
1403 | 1403 | break; |
1404 | 1404 | case 'title_content' : |
1405 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1405 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1406 | 1406 | $args->s_title = $search_keyword; |
1407 | 1407 | $args->s_content = $search_keyword; |
1408 | 1408 | $use_division = true; |
1409 | 1409 | break; |
1410 | 1410 | case 'user_id' : |
1411 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1411 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1412 | 1412 | $args->s_user_id = $search_keyword; |
1413 | 1413 | $args->sort_index = 'documents.'.$args->sort_index; |
1414 | 1414 | break; |
@@ -1416,18 +1416,18 @@ discard block |
||
1416 | 1416 | case 'nick_name' : |
1417 | 1417 | case 'email_address' : |
1418 | 1418 | case 'homepage' : |
1419 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
1419 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
1420 | 1420 | $args->{"s_".$search_target} = $search_keyword; |
1421 | 1421 | break; |
1422 | 1422 | case 'is_notice' : |
1423 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
1424 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
1423 | + if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N'; |
|
1424 | + elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y'; |
|
1425 | 1425 | else $args->{"s_".$search_target} = ''; |
1426 | 1426 | break; |
1427 | 1427 | case 'is_secret' : |
1428 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
1429 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1430 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1428 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
1429 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
1430 | + elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
1431 | 1431 | break; |
1432 | 1432 | case 'member_srl' : |
1433 | 1433 | case 'readed_count' : |
@@ -1435,17 +1435,17 @@ discard block |
||
1435 | 1435 | case 'comment_count' : |
1436 | 1436 | case 'trackback_count' : |
1437 | 1437 | case 'uploaded_count' : |
1438 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
1438 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
1439 | 1439 | break; |
1440 | 1440 | case 'member_srls' : |
1441 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
1441 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
1442 | 1442 | |
1443 | - if($logged_info->member_srl) |
|
1443 | + if ($logged_info->member_srl) |
|
1444 | 1444 | { |
1445 | 1445 | $srls = explode(',', $search_keyword); |
1446 | - foreach($srls as $srl) |
|
1446 | + foreach ($srls as $srl) |
|
1447 | 1447 | { |
1448 | - if(abs($srl) != $logged_info->member_srl) |
|
1448 | + if (abs($srl) != $logged_info->member_srl) |
|
1449 | 1449 | { |
1450 | 1450 | break; // foreach |
1451 | 1451 | } |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | } |
1457 | 1457 | break; |
1458 | 1458 | case 'blamed_count' : |
1459 | - $args->{"s_".$search_target} = (int)$search_keyword * -1; |
|
1459 | + $args->{"s_".$search_target} = (int) $search_keyword * -1; |
|
1460 | 1460 | break; |
1461 | 1461 | case 'regdate' : |
1462 | 1462 | case 'last_update' : |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | $use_division = true; |
1470 | 1470 | break; |
1471 | 1471 | case 'tag' : |
1472 | - $args->s_tags = str_replace(' ','%',$search_keyword); |
|
1472 | + $args->s_tags = str_replace(' ', '%', $search_keyword); |
|
1473 | 1473 | $query_id = 'document.getDocumentListWithinTag'; |
1474 | 1474 | break; |
1475 | 1475 | case 'extra_vars': |
@@ -1477,9 +1477,9 @@ discard block |
||
1477 | 1477 | $query_id = 'document.getDocumentListWithinExtraVars'; |
1478 | 1478 | break; |
1479 | 1479 | default : |
1480 | - if(strpos($search_target,'extra_vars')!==false) { |
|
1480 | + if (strpos($search_target, 'extra_vars') !== false) { |
|
1481 | 1481 | $args->var_idx = substr($search_target, strlen('extra_vars')); |
1482 | - $args->var_value = str_replace(' ','%',$search_keyword); |
|
1482 | + $args->var_value = str_replace(' ', '%', $search_keyword); |
|
1483 | 1483 | $args->sort_index = 'documents.'.$args->sort_index; |
1484 | 1484 | $query_id = 'document.getDocumentListWithExtraVars'; |
1485 | 1485 | } |
@@ -1496,18 +1496,18 @@ discard block |
||
1496 | 1496 | /** |
1497 | 1497 | * list_order asc sort of division that can be used only when |
1498 | 1498 | */ |
1499 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1499 | + if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
1500 | 1500 | |
1501 | 1501 | /** |
1502 | 1502 | * If it is true, use_division changed to use the document division |
1503 | 1503 | */ |
1504 | - if($use_division) |
|
1504 | + if ($use_division) |
|
1505 | 1505 | { |
1506 | 1506 | // Division begins |
1507 | - $division = (int)Context::get('division'); |
|
1507 | + $division = (int) Context::get('division'); |
|
1508 | 1508 | |
1509 | 1509 | // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan |
1510 | - if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
1510 | + if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
1511 | 1511 | { |
1512 | 1512 | $listSqlID = 'document.getDocumentListUseIndex'; |
1513 | 1513 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | // If you do not value the best division top |
1522 | - if(!$division) |
|
1522 | + if (!$division) |
|
1523 | 1523 | { |
1524 | 1524 | $division_args = new stdClass(); |
1525 | 1525 | $division_args->module_srl = $args->module_srl; |
@@ -1530,7 +1530,7 @@ discard block |
||
1530 | 1530 | $division_args->statusList = $args->statusList; |
1531 | 1531 | |
1532 | 1532 | $output = executeQuery($divisionSqlID, $division_args, array('list_order')); |
1533 | - if($output->data) |
|
1533 | + if ($output->data) |
|
1534 | 1534 | { |
1535 | 1535 | $item = array_pop($output->data); |
1536 | 1536 | $division = $item->list_order; |
@@ -1539,10 +1539,10 @@ discard block |
||
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | // The last division |
1542 | - $last_division = (int)Context::get('last_division'); |
|
1542 | + $last_division = (int) Context::get('last_division'); |
|
1543 | 1543 | |
1544 | 1544 | // Division after division from the 5000 value of the specified Wanted |
1545 | - if(!$last_division) |
|
1545 | + if (!$last_division) |
|
1546 | 1546 | { |
1547 | 1547 | $last_division_args = new stdClass(); |
1548 | 1548 | $last_division_args->module_srl = $args->module_srl; |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | $last_division_args->page = 5001; |
1555 | 1555 | |
1556 | 1556 | $output = executeQuery($divisionSqlID, $last_division_args, array('list_order')); |
1557 | - if($output->data) |
|
1557 | + if ($output->data) |
|
1558 | 1558 | { |
1559 | 1559 | $item = array_pop($output->data); |
1560 | 1560 | $last_division = $item->list_order; |
@@ -1562,14 +1562,14 @@ discard block |
||
1562 | 1562 | } |
1563 | 1563 | |
1564 | 1564 | // Make sure that after last_division article |
1565 | - if($last_division) |
|
1565 | + if ($last_division) |
|
1566 | 1566 | { |
1567 | 1567 | $last_division_args = new stdClass(); |
1568 | 1568 | $last_division_args->module_srl = $args->module_srl; |
1569 | 1569 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
1570 | 1570 | $last_division_args->list_order = $last_division; |
1571 | 1571 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
1572 | - if($output->data->count<1) $last_division = null; |
|
1572 | + if ($output->data->count < 1) $last_division = null; |
|
1573 | 1573 | } |
1574 | 1574 | |
1575 | 1575 | $args->division = $division; |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | * @param int $count |
1603 | 1603 | * @return object |
1604 | 1604 | */ |
1605 | - function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 ) |
|
1605 | + function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0) |
|
1606 | 1606 | { |
1607 | 1607 | $args = new stdClass(); |
1608 | 1608 | $args->member_srl = $member_srl; |
@@ -1610,8 +1610,8 @@ discard block |
||
1610 | 1610 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
1611 | 1611 | $document_list = $output->data; |
1612 | 1612 | |
1613 | - if(!$document_list) return array(); |
|
1614 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
1613 | + if (!$document_list) return array(); |
|
1614 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
1615 | 1615 | |
1616 | 1616 | return $document_list; |
1617 | 1617 | } |
@@ -1623,7 +1623,7 @@ discard block |
||
1623 | 1623 | function getDocumentExtraImagePath() |
1624 | 1624 | { |
1625 | 1625 | $documentConfig = getModel('document')->getDocumentConfig(); |
1626 | - if(Mobile::isFromMobilePhone()) |
|
1626 | + if (Mobile::isFromMobilePhone()) |
|
1627 | 1627 | { |
1628 | 1628 | $iconSkin = $documentConfig->micons; |
1629 | 1629 | } |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | { |
1632 | 1632 | $iconSkin = $documentConfig->icons; |
1633 | 1633 | } |
1634 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
1634 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
1635 | 1635 | |
1636 | 1636 | return $path; |
1637 | 1637 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Preview |
55 | - * @return void |
|
55 | + * @return BaseObject|null |
|
56 | 56 | */ |
57 | 57 | function dispDocumentPreview() |
58 | 58 | { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Document temp saved list |
158 | - * @return void |
|
158 | + * @return ModuleObject|null |
|
159 | 159 | */ |
160 | 160 | function dispTempSavedList() |
161 | 161 | { |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | $oDocumentModel = getModel('document'); |
37 | 37 | // Creates an object for displaying the selected document |
38 | 38 | $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager); |
39 | - if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request'); |
|
39 | + if (!$oDocument->isExists()) return new BaseObject(-1, 'msg_invalid_request'); |
|
40 | 40 | // Check permissions |
41 | - if(!$oDocument->isAccessible()) return new BaseObject(-1,'msg_not_permitted'); |
|
41 | + if (!$oDocument->isAccessible()) return new BaseObject(-1, 'msg_not_permitted'); |
|
42 | 42 | // Information setting module |
43 | 43 | //Context::set('module_info', $module_info); //module_info not use in UI |
44 | 44 | // Browser title settings |
45 | 45 | Context::setBrowserTitle($oDocument->getTitleText()); |
46 | 46 | Context::set('oDocument', $oDocument); |
47 | 47 | |
48 | - Context::set('layout','none'); |
|
48 | + Context::set('layout', 'none'); |
|
49 | 49 | $this->setTemplatePath($this->module_path.'tpl'); |
50 | 50 | $this->setTemplateFile('print_page'); |
51 | 51 | } |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | */ |
57 | 57 | function dispDocumentPreview() |
58 | 58 | { |
59 | - if(!checkCSRF()) |
|
59 | + if (!checkCSRF()) |
|
60 | 60 | { |
61 | 61 | return new BaseObject(-1, 'msg_invalid_request'); |
62 | 62 | } |
63 | 63 | |
64 | - if(Context::get('logged_info')->is_admin != 'Y') |
|
64 | + if (Context::get('logged_info')->is_admin != 'Y') |
|
65 | 65 | { |
66 | 66 | Context::set('content', removeHackTag(Context::get('content'))); |
67 | 67 | } |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | */ |
79 | 79 | function dispDocumentManageDocument() |
80 | 80 | { |
81 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
81 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
82 | 82 | // Taken from a list of selected sessions |
83 | 83 | $flag_list = $_SESSION['document_management']; |
84 | - if(count($flag_list)) |
|
84 | + if (count($flag_list)) |
|
85 | 85 | { |
86 | - foreach($flag_list as $key => $val) |
|
86 | + foreach ($flag_list as $key => $val) |
|
87 | 87 | { |
88 | - if(!is_bool($val)) continue; |
|
88 | + if (!is_bool($val)) continue; |
|
89 | 89 | $document_srl_list[] = $key; |
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - if(count($document_srl_list)) |
|
93 | + if (count($document_srl_list)) |
|
94 | 94 | { |
95 | 95 | $oDocumentModel = getModel('document'); |
96 | 96 | $document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin); |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | |
100 | 100 | $oModuleModel = getModel('module'); |
101 | 101 | // The combination of module categories list and the list of modules |
102 | - if(count($module_list)>1) Context::set('module_list', $module_categories); |
|
102 | + if (count($module_list) > 1) Context::set('module_list', $module_categories); |
|
103 | 103 | |
104 | - $module_srl=Context::get('module_srl'); |
|
105 | - Context::set('module_srl',$module_srl); |
|
104 | + $module_srl = Context::get('module_srl'); |
|
105 | + Context::set('module_srl', $module_srl); |
|
106 | 106 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
107 | - Context::set('mid',$module_info->mid); |
|
108 | - Context::set('browser_title',$module_info->browser_title); |
|
107 | + Context::set('mid', $module_info->mid); |
|
108 | + Context::set('browser_title', $module_info->browser_title); |
|
109 | 109 | |
110 | 110 | // Select Pop-up layout |
111 | 111 | $this->setLayoutPath('./common/tpl'); |
@@ -126,24 +126,24 @@ discard block |
||
126 | 126 | $current_module_srl = Context::get('module_srl'); |
127 | 127 | $current_module_srls = Context::get('module_srls'); |
128 | 128 | |
129 | - if(!$current_module_srl && !$current_module_srls) |
|
129 | + if (!$current_module_srl && !$current_module_srls) |
|
130 | 130 | { |
131 | 131 | // Get information of the current module |
132 | 132 | $current_module_info = Context::get('current_module_info'); |
133 | 133 | $current_module_srl = $current_module_info->module_srl; |
134 | - if(!$current_module_srl) return new BaseObject(); |
|
134 | + if (!$current_module_srl) return new BaseObject(); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $oModuleModel = getModel('module'); |
138 | - if($current_module_srl) |
|
138 | + if ($current_module_srl) |
|
139 | 139 | { |
140 | 140 | $document_config = $oModuleModel->getModulePartConfig('document', $current_module_srl); |
141 | 141 | } |
142 | - if(!$document_config) |
|
142 | + if (!$document_config) |
|
143 | 143 | { |
144 | 144 | $document_config = new stdClass(); |
145 | 145 | } |
146 | - if(!isset($document_config->use_history)) $document_config->use_history = 'N'; |
|
146 | + if (!isset($document_config->use_history)) $document_config->use_history = 'N'; |
|
147 | 147 | Context::set('document_config', $document_config); |
148 | 148 | |
149 | 149 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | |
164 | 164 | $oMemberModel = getModel('member'); |
165 | 165 | // A message appears if the user is not logged-in |
166 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
166 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
167 | 167 | // Get the saved document (module_srl is set to member_srl instead) |
168 | 168 | $logged_info = Context::get('logged_info'); |
169 | 169 | $args = new stdClass(); |
170 | 170 | $args->member_srl = $logged_info->member_srl; |
171 | 171 | $args->statusList = array($this->getConfigStatus('temp')); |
172 | - $args->page = (int)Context::get('page'); |
|
172 | + $args->page = (int) Context::get('page'); |
|
173 | 173 | $args->list_count = 10; |
174 | 174 | |
175 | 175 | $oDocumentModel = getModel('document'); |
@@ -36,9 +36,13 @@ discard block |
||
36 | 36 | $oDocumentModel = getModel('document'); |
37 | 37 | // Creates an object for displaying the selected document |
38 | 38 | $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager); |
39 | - if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request'); |
|
39 | + if(!$oDocument->isExists()) { |
|
40 | + return new BaseObject(-1,'msg_invalid_request'); |
|
41 | + } |
|
40 | 42 | // Check permissions |
41 | - if(!$oDocument->isAccessible()) return new BaseObject(-1,'msg_not_permitted'); |
|
43 | + if(!$oDocument->isAccessible()) { |
|
44 | + return new BaseObject(-1,'msg_not_permitted'); |
|
45 | + } |
|
42 | 46 | // Information setting module |
43 | 47 | //Context::set('module_info', $module_info); //module_info not use in UI |
44 | 48 | // Browser title settings |
@@ -78,14 +82,18 @@ discard block |
||
78 | 82 | */ |
79 | 83 | function dispDocumentManageDocument() |
80 | 84 | { |
81 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
85 | + if(!Context::get('is_logged')) { |
|
86 | + return new BaseObject(-1,'msg_not_permitted'); |
|
87 | + } |
|
82 | 88 | // Taken from a list of selected sessions |
83 | 89 | $flag_list = $_SESSION['document_management']; |
84 | 90 | if(count($flag_list)) |
85 | 91 | { |
86 | 92 | foreach($flag_list as $key => $val) |
87 | 93 | { |
88 | - if(!is_bool($val)) continue; |
|
94 | + if(!is_bool($val)) { |
|
95 | + continue; |
|
96 | + } |
|
89 | 97 | $document_srl_list[] = $key; |
90 | 98 | } |
91 | 99 | } |
@@ -99,7 +107,9 @@ discard block |
||
99 | 107 | |
100 | 108 | $oModuleModel = getModel('module'); |
101 | 109 | // The combination of module categories list and the list of modules |
102 | - if(count($module_list)>1) Context::set('module_list', $module_categories); |
|
110 | + if(count($module_list)>1) { |
|
111 | + Context::set('module_list', $module_categories); |
|
112 | + } |
|
103 | 113 | |
104 | 114 | $module_srl=Context::get('module_srl'); |
105 | 115 | Context::set('module_srl',$module_srl); |
@@ -131,7 +141,9 @@ discard block |
||
131 | 141 | // Get information of the current module |
132 | 142 | $current_module_info = Context::get('current_module_info'); |
133 | 143 | $current_module_srl = $current_module_info->module_srl; |
134 | - if(!$current_module_srl) return new BaseObject(); |
|
144 | + if(!$current_module_srl) { |
|
145 | + return new BaseObject(); |
|
146 | + } |
|
135 | 147 | } |
136 | 148 | |
137 | 149 | $oModuleModel = getModel('module'); |
@@ -143,7 +155,9 @@ discard block |
||
143 | 155 | { |
144 | 156 | $document_config = new stdClass(); |
145 | 157 | } |
146 | - if(!isset($document_config->use_history)) $document_config->use_history = 'N'; |
|
158 | + if(!isset($document_config->use_history)) { |
|
159 | + $document_config->use_history = 'N'; |
|
160 | + } |
|
147 | 161 | Context::set('document_config', $document_config); |
148 | 162 | |
149 | 163 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -163,7 +177,9 @@ discard block |
||
163 | 177 | |
164 | 178 | $oMemberModel = getModel('member'); |
165 | 179 | // A message appears if the user is not logged-in |
166 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
180 | + if(!$oMemberModel->isLogged()) { |
|
181 | + return $this->stop('msg_not_logged'); |
|
182 | + } |
|
167 | 183 | // Get the saved document (module_srl is set to member_srl instead) |
168 | 184 | $logged_info = Context::get('logged_info'); |
169 | 185 | $args = new stdClass(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Delete selected files from the administrator page |
58 | 58 | * |
59 | - * @return BaseObject |
|
59 | + * @return ModuleObject|null |
|
60 | 60 | */ |
61 | 61 | function procFileAdminDeleteChecked() |
62 | 62 | { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | /** |
111 | 111 | * Add file information for each module |
112 | 112 | * |
113 | - * @return void |
|
113 | + * @return BaseObject|null |
|
114 | 114 | */ |
115 | 115 | function procFileAdminInsertModuleConfig() |
116 | 116 | { |
@@ -26,29 +26,29 @@ discard block |
||
26 | 26 | $args = new stdClass(); |
27 | 27 | $args->module_srl = $module_srl; |
28 | 28 | $columnList = array('file_srl', 'uploaded_filename'); |
29 | - $output = executeQueryArray('file.getModuleFiles',$args, $columnList); |
|
30 | - if(!$output) return $output; |
|
29 | + $output = executeQueryArray('file.getModuleFiles', $args, $columnList); |
|
30 | + if (!$output) return $output; |
|
31 | 31 | $files = $output->data; |
32 | 32 | // Remove from the DB |
33 | 33 | $args->module_srl = $module_srl; |
34 | 34 | $output = executeQuery('file.deleteModuleFiles', $args); |
35 | - if(!$output->toBool()) return $output; |
|
35 | + if (!$output->toBool()) return $output; |
|
36 | 36 | // Remove the file |
37 | - FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ; |
|
38 | - FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) ); |
|
37 | + FileHandler::removeDir(sprintf("./files/attach/images/%s/", $module_srl)); |
|
38 | + FileHandler::removeDir(sprintf("./files/attach/binaries/%s/", $module_srl)); |
|
39 | 39 | // Remove the file list obtained from the DB |
40 | 40 | $path = array(); |
41 | 41 | $cnt = count($files); |
42 | - for($i=0;$i<$cnt;$i++) |
|
42 | + for ($i = 0; $i < $cnt; $i++) |
|
43 | 43 | { |
44 | 44 | $uploaded_filename = $files[$i]->uploaded_filename; |
45 | 45 | FileHandler::removeFile($uploaded_filename); |
46 | 46 | |
47 | 47 | $path_info = pathinfo($uploaded_filename); |
48 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
48 | + if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
49 | 49 | } |
50 | 50 | // Remove a file directory of the document |
51 | - for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]); |
|
51 | + for ($i = 0; $i < count($path); $i++) FileHandler::removeBlankDir($path[$i]); |
|
52 | 52 | |
53 | 53 | return $output; |
54 | 54 | } |
@@ -62,23 +62,23 @@ discard block |
||
62 | 62 | { |
63 | 63 | // An error appears if no document is selected |
64 | 64 | $cart = Context::get('cart'); |
65 | - if(!$cart) return $this->stop('msg_file_cart_is_null'); |
|
66 | - if(!is_array($cart)) $file_srl_list= explode('|@|', $cart); |
|
65 | + if (!$cart) return $this->stop('msg_file_cart_is_null'); |
|
66 | + if (!is_array($cart)) $file_srl_list = explode('|@|', $cart); |
|
67 | 67 | else $file_srl_list = $cart; |
68 | 68 | $file_count = count($file_srl_list); |
69 | - if(!$file_count) return $this->stop('msg_file_cart_is_null'); |
|
69 | + if (!$file_count) return $this->stop('msg_file_cart_is_null'); |
|
70 | 70 | |
71 | 71 | $oFileController = getController('file'); |
72 | 72 | // Delete the post |
73 | - for($i=0;$i<$file_count;$i++) |
|
73 | + for ($i = 0; $i < $file_count; $i++) |
|
74 | 74 | { |
75 | 75 | $file_srl = trim($file_srl_list[$i]); |
76 | - if(!$file_srl) continue; |
|
76 | + if (!$file_srl) continue; |
|
77 | 77 | |
78 | 78 | $oFileController->deleteFile($file_srl); |
79 | 79 | } |
80 | 80 | |
81 | - $this->setMessage( sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count) ); |
|
81 | + $this->setMessage(sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count)); |
|
82 | 82 | |
83 | 83 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminList'); |
84 | 84 | $this->setRedirectUrl($returnUrl); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $config->allow_outlink_site = Context::get('allow_outlink_site'); |
102 | 102 | // Create module Controller object |
103 | 103 | $oModuleController = getController('module'); |
104 | - $output = $oModuleController->insertModuleConfig('file',$config); |
|
104 | + $output = $oModuleController->insertModuleConfig('file', $config); |
|
105 | 105 | |
106 | 106 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminConfig'); |
107 | 107 | return $this->setRedirectUrl($returnUrl, $output); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // Get variables |
118 | 118 | $module_srl = Context::get('target_module_srl'); |
119 | 119 | // In order to configure multiple modules at once |
120 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
120 | + if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl); |
|
121 | 121 | else $module_srl = array($module_srl); |
122 | 122 | |
123 | 123 | $download_grant = Context::get('download_grant'); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $file_config->allowed_attach_size = Context::get('allowed_attach_size'); |
131 | 131 | $file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes')); |
132 | 132 | |
133 | - if(!is_array($download_grant)) $file_config->download_grant = explode('|@|',$download_grant); |
|
133 | + if (!is_array($download_grant)) $file_config->download_grant = explode('|@|', $download_grant); |
|
134 | 134 | else $file_config->download_grant = $download_grant; |
135 | 135 | |
136 | 136 | //관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | $iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize')); |
141 | 141 | $iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize); |
142 | 142 | |
143 | - if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie) |
|
143 | + if ($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie) |
|
144 | 144 | return new BaseObject(-1, 'input size over than config in php.ini'); |
145 | 145 | |
146 | 146 | $oModuleController = getController('module'); |
147 | - for($i=0;$i<count($module_srl);$i++) |
|
147 | + for ($i = 0; $i < count($module_srl); $i++) |
|
148 | 148 | { |
149 | 149 | $srl = trim($module_srl[$i]); |
150 | - if(!$srl) continue; |
|
151 | - $oModuleController->insertModulePartConfig('file',$srl,$file_config); |
|
150 | + if (!$srl) continue; |
|
151 | + $oModuleController->insertModulePartConfig('file', $srl, $file_config); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $this->setError(-1); |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | */ |
166 | 166 | function procFileAdminAddCart() |
167 | 167 | { |
168 | - $file_srl = (int)Context::get('file_srl'); |
|
168 | + $file_srl = (int) Context::get('file_srl'); |
|
169 | 169 | //$fileSrlList = array(500, 502); |
170 | 170 | |
171 | 171 | $oFileModel = getModel('file'); |
172 | 172 | $output = $oFileModel->getFile($file_srl); |
173 | 173 | //$output = $oFileModel->getFile($fileSrlList); |
174 | 174 | |
175 | - if($output->file_srl) |
|
175 | + if ($output->file_srl) |
|
176 | 176 | { |
177 | - if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]); |
|
177 | + if ($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]); |
|
178 | 178 | else $_SESSION['file_management'][$output->file_srl] = true; |
179 | 179 | } |
180 | 180 | } |
@@ -27,12 +27,16 @@ discard block |
||
27 | 27 | $args->module_srl = $module_srl; |
28 | 28 | $columnList = array('file_srl', 'uploaded_filename'); |
29 | 29 | $output = executeQueryArray('file.getModuleFiles',$args, $columnList); |
30 | - if(!$output) return $output; |
|
30 | + if(!$output) { |
|
31 | + return $output; |
|
32 | + } |
|
31 | 33 | $files = $output->data; |
32 | 34 | // Remove from the DB |
33 | 35 | $args->module_srl = $module_srl; |
34 | 36 | $output = executeQuery('file.deleteModuleFiles', $args); |
35 | - if(!$output->toBool()) return $output; |
|
37 | + if(!$output->toBool()) { |
|
38 | + return $output; |
|
39 | + } |
|
36 | 40 | // Remove the file |
37 | 41 | FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ; |
38 | 42 | FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) ); |
@@ -45,10 +49,14 @@ discard block |
||
45 | 49 | FileHandler::removeFile($uploaded_filename); |
46 | 50 | |
47 | 51 | $path_info = pathinfo($uploaded_filename); |
48 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
52 | + if(!in_array($path_info['dirname'], $path)) { |
|
53 | + $path[] = $path_info['dirname']; |
|
54 | + } |
|
49 | 55 | } |
50 | 56 | // Remove a file directory of the document |
51 | - for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]); |
|
57 | + for($i=0;$i<count($path);$i++) { |
|
58 | + FileHandler::removeBlankDir($path[$i]); |
|
59 | + } |
|
52 | 60 | |
53 | 61 | return $output; |
54 | 62 | } |
@@ -62,18 +70,27 @@ discard block |
||
62 | 70 | { |
63 | 71 | // An error appears if no document is selected |
64 | 72 | $cart = Context::get('cart'); |
65 | - if(!$cart) return $this->stop('msg_file_cart_is_null'); |
|
66 | - if(!is_array($cart)) $file_srl_list= explode('|@|', $cart); |
|
67 | - else $file_srl_list = $cart; |
|
73 | + if(!$cart) { |
|
74 | + return $this->stop('msg_file_cart_is_null'); |
|
75 | + } |
|
76 | + if(!is_array($cart)) { |
|
77 | + $file_srl_list= explode('|@|', $cart); |
|
78 | + } else { |
|
79 | + $file_srl_list = $cart; |
|
80 | + } |
|
68 | 81 | $file_count = count($file_srl_list); |
69 | - if(!$file_count) return $this->stop('msg_file_cart_is_null'); |
|
82 | + if(!$file_count) { |
|
83 | + return $this->stop('msg_file_cart_is_null'); |
|
84 | + } |
|
70 | 85 | |
71 | 86 | $oFileController = getController('file'); |
72 | 87 | // Delete the post |
73 | 88 | for($i=0;$i<$file_count;$i++) |
74 | 89 | { |
75 | 90 | $file_srl = trim($file_srl_list[$i]); |
76 | - if(!$file_srl) continue; |
|
91 | + if(!$file_srl) { |
|
92 | + continue; |
|
93 | + } |
|
77 | 94 | |
78 | 95 | $oFileController->deleteFile($file_srl); |
79 | 96 | } |
@@ -117,8 +134,11 @@ discard block |
||
117 | 134 | // Get variables |
118 | 135 | $module_srl = Context::get('target_module_srl'); |
119 | 136 | // In order to configure multiple modules at once |
120 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
121 | - else $module_srl = array($module_srl); |
|
137 | + if(preg_match('/^([0-9,]+)$/',$module_srl)) { |
|
138 | + $module_srl = explode(',',$module_srl); |
|
139 | + } else { |
|
140 | + $module_srl = array($module_srl); |
|
141 | + } |
|
122 | 142 | |
123 | 143 | $download_grant = Context::get('download_grant'); |
124 | 144 | |
@@ -130,8 +150,11 @@ discard block |
||
130 | 150 | $file_config->allowed_attach_size = Context::get('allowed_attach_size'); |
131 | 151 | $file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes')); |
132 | 152 | |
133 | - if(!is_array($download_grant)) $file_config->download_grant = explode('|@|',$download_grant); |
|
134 | - else $file_config->download_grant = $download_grant; |
|
153 | + if(!is_array($download_grant)) { |
|
154 | + $file_config->download_grant = explode('|@|',$download_grant); |
|
155 | + } else { |
|
156 | + $file_config->download_grant = $download_grant; |
|
157 | + } |
|
135 | 158 | |
136 | 159 | //관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas |
137 | 160 | $userFileAllowSize = FileHandler::returnbytes($file_config->allowed_filesize.'M'); |
@@ -140,14 +163,17 @@ discard block |
||
140 | 163 | $iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize')); |
141 | 164 | $iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize); |
142 | 165 | |
143 | - if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie) |
|
144 | - return new BaseObject(-1, 'input size over than config in php.ini'); |
|
166 | + if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie) { |
|
167 | + return new BaseObject(-1, 'input size over than config in php.ini'); |
|
168 | + } |
|
145 | 169 | |
146 | 170 | $oModuleController = getController('module'); |
147 | 171 | for($i=0;$i<count($module_srl);$i++) |
148 | 172 | { |
149 | 173 | $srl = trim($module_srl[$i]); |
150 | - if(!$srl) continue; |
|
174 | + if(!$srl) { |
|
175 | + continue; |
|
176 | + } |
|
151 | 177 | $oModuleController->insertModulePartConfig('file',$srl,$file_config); |
152 | 178 | } |
153 | 179 | |
@@ -174,8 +200,11 @@ discard block |
||
174 | 200 | |
175 | 201 | if($output->file_srl) |
176 | 202 | { |
177 | - if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]); |
|
178 | - else $_SESSION['file_management'][$output->file_srl] = true; |
|
203 | + if($_SESSION['file_management'][$output->file_srl]) { |
|
204 | + unset($_SESSION['file_management'][$output->file_srl]); |
|
205 | + } else { |
|
206 | + $_SESSION['file_management'][$output->file_srl] = true; |
|
207 | + } |
|
179 | 208 | } |
180 | 209 | } |
181 | 210 | } |
@@ -276,7 +276,7 @@ |
||
276 | 276 | |
277 | 277 | /** |
278 | 278 | * Migrate data after completing xml file extraction |
279 | - * @return void |
|
279 | + * @return BaseObject|null |
|
280 | 280 | */ |
281 | 281 | function procImporterAdminImport() |
282 | 282 | { |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | $filename = Context::get('filename'); |
44 | 44 | $isExists = 'false'; |
45 | 45 | |
46 | - if(strncasecmp('http://', $filename, 7) === 0) |
|
46 | + if (strncasecmp('http://', $filename, 7) === 0) |
|
47 | 47 | { |
48 | - if(ini_get('allow_url_fopen')) |
|
48 | + if (ini_get('allow_url_fopen')) |
|
49 | 49 | { |
50 | 50 | $fp = @fopen($filename, "r"); |
51 | - if($fp) |
|
51 | + if ($fp) |
|
52 | 52 | { |
53 | 53 | $str = fgets($fp, 100); |
54 | - if(strlen($str) > 0) |
|
54 | + if (strlen($str) > 0) |
|
55 | 55 | { |
56 | 56 | $isExists = 'true'; |
57 | 57 | $type = 'XML'; |
58 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
58 | + if (stristr($str, 'tattertools')) $type = 'TTXML'; |
|
59 | 59 | |
60 | 60 | $this->add('type', $type); |
61 | 61 | } |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | { |
73 | 73 | $realPath = FileHandler::getRealPath($filename); |
74 | 74 | |
75 | - if(file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
75 | + if (file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
76 | 76 | $this->add('exists', $isExists); |
77 | 77 | |
78 | - if($isExists == 'true') |
|
78 | + if ($isExists == 'true') |
|
79 | 79 | { |
80 | 80 | $type = 'XML'; |
81 | 81 | |
82 | 82 | $fp = fopen($realPath, "r"); |
83 | 83 | $str = fgets($fp, 100); |
84 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
84 | + if (stristr($str, 'tattertools')) $type = 'TTXML'; |
|
85 | 85 | fclose($fp); |
86 | 86 | |
87 | 87 | $this->add('type', $type); |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | |
108 | 108 | /* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다. |
109 | 109 | CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */ |
110 | - $db_info = Context::getDBInfo (); |
|
111 | - if($db_info->db_type != "cubrid") |
|
110 | + $db_info = Context::getDBInfo(); |
|
111 | + if ($db_info->db_type != "cubrid") |
|
112 | 112 | { |
113 | 113 | $output = executeQuery('importer.updateDocumentSync'.$postFix); |
114 | 114 | $output = executeQuery('importer.updateCommentSync'.$postFix); |
115 | 115 | } |
116 | 116 | else |
117 | 117 | { |
118 | - $output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix); |
|
119 | - if(is_array ($output->data) && count ($output->data)) |
|
118 | + $output = executeQueryArray('importer.getDocumentMemberSrlWithUserID'.$postFix); |
|
119 | + if (is_array($output->data) && count($output->data)) |
|
120 | 120 | { |
121 | 121 | $success_count = 0; |
122 | 122 | $error_count = 0; |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | { |
126 | 126 | $args->user_id = $val->user_id; |
127 | 127 | $args->member_srl = $val->member_srl; |
128 | - $tmp = executeQuery ('importer.updateDocumentSyncForCUBRID'.$postFix, $args); |
|
129 | - if($tmp->toBool () === true) |
|
128 | + $tmp = executeQuery('importer.updateDocumentSyncForCUBRID'.$postFix, $args); |
|
129 | + if ($tmp->toBool() === true) |
|
130 | 130 | { |
131 | 131 | $success_count++; |
132 | 132 | } |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | } |
139 | 139 | } // documents section |
140 | 140 | |
141 | - $output = executeQueryArray ('importer.getCommentMemberSrlWithUserID'.$postFix); |
|
142 | - if(is_array ($output->data) && count ($output->data)) |
|
141 | + $output = executeQueryArray('importer.getCommentMemberSrlWithUserID'.$postFix); |
|
142 | + if (is_array($output->data) && count($output->data)) |
|
143 | 143 | { |
144 | 144 | $success_count = 0; |
145 | 145 | $error_count = 0; |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | { |
149 | 149 | $args->user_id = $val->user_id; |
150 | 150 | $args->member_srl = $val->member_srl; |
151 | - $tmp = executeQuery ('importer.updateCommentSyncForCUBRID'.$postFix, $args); |
|
152 | - if($tmp->toBool () === true) |
|
151 | + $tmp = executeQuery('importer.updateCommentSyncForCUBRID'.$postFix, $args); |
|
152 | + if ($tmp->toBool() === true) |
|
153 | 153 | { |
154 | 154 | $success_count++; |
155 | 155 | } |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | // Extract and cache information from the xml file |
179 | 179 | $oExtract = new extract(); |
180 | 180 | |
181 | - switch($type) |
|
181 | + switch ($type) |
|
182 | 182 | { |
183 | 183 | case 'member' : |
184 | - $output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>'); |
|
185 | - if($output->toBool()) $oExtract->saveItems(); |
|
184 | + $output = $oExtract->set($xml_file, '<members ', '</members>', '<member>', '</member>'); |
|
185 | + if ($output->toBool()) $oExtract->saveItems(); |
|
186 | 186 | break; |
187 | 187 | case 'message' : |
188 | - $output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>'); |
|
189 | - if($output->toBool()) $oExtract->saveItems(); |
|
188 | + $output = $oExtract->set($xml_file, '<messages ', '</messages>', '<message>', '</message>'); |
|
189 | + if ($output->toBool()) $oExtract->saveItems(); |
|
190 | 190 | break; |
191 | 191 | case 'ttxml' : |
192 | 192 | // Category information |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | while (!feof($oExtract->fd)) |
200 | 200 | { |
201 | 201 | $str = fgets($oExtract->fd, 1024); |
202 | - if(strstr($str, '<category>')) |
|
202 | + if (strstr($str, '<category>')) |
|
203 | 203 | { |
204 | 204 | $started = true; |
205 | 205 | $str = strstr($str, '<category>'); |
206 | 206 | } |
207 | - if(substr($str,0,strlen('<post ')) == '<post ') break; |
|
207 | + if (substr($str, 0, strlen('<post ')) == '<post ') break; |
|
208 | 208 | if ($started) $buff .= $str; |
209 | 209 | } |
210 | 210 | $buff = '<categories>'.$buff.'</categories>'; |
@@ -214,22 +214,22 @@ discard block |
||
214 | 214 | |
215 | 215 | // Guestbook information |
216 | 216 | $output = $oExtract->set($xml_file, '', '', '', ''); |
217 | - if($output->toBool()) |
|
217 | + if ($output->toBool()) |
|
218 | 218 | { |
219 | 219 | $started = false; |
220 | 220 | $buff = ''; |
221 | 221 | while (!feof($oExtract->fd)) |
222 | 222 | { |
223 | 223 | $str = fgets($oExtract->fd, 1024); |
224 | - if(strstr($str, '<guestbook>')) |
|
224 | + if (strstr($str, '<guestbook>')) |
|
225 | 225 | { |
226 | 226 | $started = true; |
227 | 227 | $str = strstr($str, '<guestbook>'); |
228 | 228 | } |
229 | - if($started) |
|
229 | + if ($started) |
|
230 | 230 | { |
231 | 231 | $pos = strpos($str, '</guestbook>'); |
232 | - if($pos !== false) |
|
232 | + if ($pos !== false) |
|
233 | 233 | { |
234 | 234 | $buff .= substr($str, 0, $pos + strlen('</guestbook>')); |
235 | 235 | break; |
@@ -241,37 +241,37 @@ discard block |
||
241 | 241 | $guestbook_filename = sprintf('%s/%s', $oExtract->cache_path, 'guestbook.xml'); |
242 | 242 | FileHandler::writeFile($guestbook_filename, $buff); |
243 | 243 | // Individual items |
244 | - $output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>'); |
|
245 | - if($output->toBool()) $oExtract->saveItems(); |
|
244 | + $output = $oExtract->set($xml_file, '<blog', '</blog>', '<post ', '</post>'); |
|
245 | + if ($output->toBool()) $oExtract->saveItems(); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | default : |
250 | 250 | // First get category information |
251 | - $output = $oExtract->set($xml_file,'<categories>', '</categories>', '<category','</category>'); |
|
252 | - if($output->toBool()) |
|
251 | + $output = $oExtract->set($xml_file, '<categories>', '</categories>', '<category', '</category>'); |
|
252 | + if ($output->toBool()) |
|
253 | 253 | { |
254 | 254 | $oExtract->mergeItems('category.xml'); |
255 | 255 | // Get each item |
256 | - $output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>'); |
|
257 | - if($output->toBool()) $oExtract->saveItems(); |
|
256 | + $output = $oExtract->set($xml_file, '<posts ', '</posts>', '<post>', '</post>'); |
|
257 | + if ($output->toBool()) $oExtract->saveItems(); |
|
258 | 258 | } |
259 | 259 | break; |
260 | 260 | } |
261 | 261 | |
262 | - if(!$output->toBool()) |
|
262 | + if (!$output->toBool()) |
|
263 | 263 | { |
264 | - $this->add('error',0); |
|
265 | - $this->add('status',-1); |
|
264 | + $this->add('error', 0); |
|
265 | + $this->add('status', -1); |
|
266 | 266 | $this->setMessage($output->getMessage()); |
267 | 267 | return; |
268 | 268 | } |
269 | 269 | // Notify that all data completely extracted |
270 | - $this->add('type',$type); |
|
271 | - $this->add('total',$oExtract->getTotalCount()); |
|
272 | - $this->add('cur',0); |
|
270 | + $this->add('type', $type); |
|
271 | + $this->add('total', $oExtract->getTotalCount()); |
|
272 | + $this->add('cur', 0); |
|
273 | 273 | $this->add('key', $oExtract->getKey()); |
274 | - $this->add('status',0); |
|
274 | + $this->add('status', 0); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | $this->unit_count = Context::get('unit_count'); |
292 | 292 | // Check if an index file exists |
293 | 293 | $index_file = './files/cache/importer/'.$key.'/index'; |
294 | - if(!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
294 | + if (!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
295 | 295 | |
296 | - switch($type) |
|
296 | + switch ($type) |
|
297 | 297 | { |
298 | 298 | case 'ttxml' : |
299 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
299 | + if (!$target_module) return new BaseObject(-1, 'msg_invalid_request'); |
|
300 | 300 | |
301 | 301 | $oModuleModel = getModel('module'); |
302 | 302 | $columnList = array('module_srl', 'module'); |
303 | 303 | $target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList); |
304 | 304 | |
305 | - $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php'); |
|
306 | - if($ttimporter) require_once($ttimporter); |
|
305 | + $ttimporter = FileHandler::exists(_XE_PATH_.'modules/importer/ttimport.class.php'); |
|
306 | + if ($ttimporter) require_once($ttimporter); |
|
307 | 307 | |
308 | 308 | $oTT = new ttimport(); |
309 | 309 | $cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module); |
@@ -316,23 +316,23 @@ discard block |
||
316 | 316 | break; |
317 | 317 | case 'module' : |
318 | 318 | // Check if the target module exists |
319 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
319 | + if (!$target_module) return new BaseObject(-1, 'msg_invalid_request'); |
|
320 | 320 | $cur = $this->importModule($key, $cur, $index_file, $target_module); |
321 | 321 | break; |
322 | 322 | } |
323 | 323 | // Notify that all data completely extracted |
324 | - $this->add('type',$type); |
|
325 | - $this->add('total',$total); |
|
326 | - $this->add('cur',$cur); |
|
324 | + $this->add('type', $type); |
|
325 | + $this->add('total', $total); |
|
326 | + $this->add('cur', $cur); |
|
327 | 327 | $this->add('key', $key); |
328 | 328 | $this->add('target_module', $target_module); |
329 | 329 | // When completing, success message appears and remove the cache files |
330 | - if($total <= $cur) |
|
330 | + if ($total <= $cur) |
|
331 | 331 | { |
332 | - $this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); |
|
332 | + $this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total)); |
|
333 | 333 | FileHandler::removeDir('./files/cache/importer/'.$key); |
334 | 334 | } |
335 | - else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
335 | + else $this->setMessage(sprintf(Context::getLang('msg_importing'), $total, $cur)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function importMember($key, $cur, $index_file) |
346 | 346 | { |
347 | - if(!$cur) $cur = 0; |
|
347 | + if (!$cur) $cur = 0; |
|
348 | 348 | // Create the xmlParser object |
349 | 349 | $oXmlParser = new XmlParser(); |
350 | 350 | // Create objects for importing member information |
@@ -357,19 +357,19 @@ discard block |
||
357 | 357 | $oModuleModel = getModel('module'); |
358 | 358 | $member_config = $oModuleModel->getModuleConfig('member'); |
359 | 359 | // Open an index file |
360 | - $f = fopen($index_file,"r"); |
|
360 | + $f = fopen($index_file, "r"); |
|
361 | 361 | // Pass if already read |
362 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
362 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
363 | 363 | // Read by each line until the condition meets |
364 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
364 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
365 | 365 | { |
366 | - if(feof($f)) break; |
|
366 | + if (feof($f)) break; |
|
367 | 367 | // Find a given location |
368 | 368 | $target_file = trim(fgets($f, 1024)); |
369 | 369 | // Load and parse the file |
370 | 370 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
371 | 371 | FileHandler::removeFile($target_file); |
372 | - if(!$xmlObj) continue; |
|
372 | + if (!$xmlObj) continue; |
|
373 | 373 | // List Objects |
374 | 374 | $obj = new stdClass(); |
375 | 375 | $obj->member_srl = getNextSequence(); |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | $obj->password = base64_decode($xmlObj->member->password->body); |
378 | 378 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
379 | 379 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
380 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
380 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
381 | 381 | $obj->email_address = base64_decode($xmlObj->member->email->body); |
382 | 382 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
383 | 383 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
384 | - $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body),0,8); |
|
384 | + $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body), 0, 8); |
|
385 | 385 | $obj->allow_mailing = base64_decode($xmlObj->member->allow_mailing->body); |
386 | 386 | $obj->point = base64_decode($xmlObj->member->point->body); |
387 | 387 | $obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body); |
@@ -391,38 +391,38 @@ discard block |
||
391 | 391 | $obj->regdate = base64_decode($xmlObj->member->regdate->body); |
392 | 392 | $obj->last_login = base64_decode($xmlObj->member->last_login->body); |
393 | 393 | |
394 | - if($xmlObj->member->extra_vars) |
|
394 | + if ($xmlObj->member->extra_vars) |
|
395 | 395 | { |
396 | - foreach($xmlObj->member->extra_vars as $key => $val) |
|
396 | + foreach ($xmlObj->member->extra_vars as $key => $val) |
|
397 | 397 | { |
398 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
398 | + if (in_array($key, array('node_name', 'attrs', 'body'))) continue; |
|
399 | 399 | $obj->extra_vars->{$key} = base64_decode($val->body); |
400 | 400 | } |
401 | 401 | } |
402 | 402 | // Create url for homepage and blog |
403 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
403 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
404 | 404 | // Check user ID |
405 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
405 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
406 | 406 | { |
407 | 407 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
408 | 408 | } |
409 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
409 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
410 | 410 | { |
411 | - $obj->user_id = 't' . $obj->member_srl; |
|
411 | + $obj->user_id = 't'.$obj->member_srl; |
|
412 | 412 | } |
413 | 413 | // Check email address |
414 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
414 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
415 | 415 | { |
416 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
416 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
417 | 417 | } |
418 | 418 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email_address); |
419 | 419 | // Set the mailing option |
420 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
420 | + if ($obj->allow_mailing != 'Y') $obj->allow_mailing = 'N'; |
|
421 | 421 | // Set the message option |
422 | 422 | $obj->allow_message = 'Y'; |
423 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
423 | + if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) $obj->allow_message = 'Y'; |
|
424 | 424 | // Get member-join date if the last login time is not found |
425 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
425 | + if (!$obj->last_login) $obj->last_login = $obj->regdate; |
|
426 | 426 | // Set the list order |
427 | 427 | $obj->list_order = -1 * $obj->member_srl; |
428 | 428 | // List extra vars |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $args = new stdClass; |
434 | 434 | $args->user_id = $obj->user_id; |
435 | 435 | $output = executeQuery('member.getMemberSrl', $args); |
436 | - if(!$output->toBool() || $output->data) |
|
436 | + if (!$output->toBool() || $output->data) |
|
437 | 437 | { |
438 | 438 | $obj->user_id .= '_'.$obj->member_srl; |
439 | 439 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $args = new stdClass; |
442 | 442 | $args->nick_name = $obj->nick_name; |
443 | 443 | $output = executeQuery('member.getMemberSrl', $args); |
444 | - if(!$output->toBool() || $output->data) |
|
444 | + if (!$output->toBool() || $output->data) |
|
445 | 445 | { |
446 | 446 | $obj->user_id .= '_'.$obj->member_srl; |
447 | 447 | } |
@@ -449,67 +449,67 @@ discard block |
||
449 | 449 | $args = new stdClass; |
450 | 450 | $args->email_address = $obj->email_address; |
451 | 451 | $output = executeQuery('member.getMemberSrl', $args); |
452 | - if(!$output->toBool() || $output->data) |
|
452 | + if (!$output->toBool() || $output->data) |
|
453 | 453 | { |
454 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
454 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | // Add a member |
458 | 458 | $output = executeQuery('member.insertMember', $obj); |
459 | 459 | |
460 | - if($output->toBool() && !($obj->password)) |
|
460 | + if ($output->toBool() && !($obj->password)) |
|
461 | 461 | { |
462 | 462 | // Send a mail telling the user to reset his password. |
463 | 463 | $oMail = new Mail(); |
464 | - $oMail->setTitle("Password update for your " . getFullSiteUrl() . " account"); |
|
465 | - $webmaster_name = $member_config->webmaster_name?$member_config->webmaster_name:'Webmaster'; |
|
464 | + $oMail->setTitle("Password update for your ".getFullSiteUrl()." account"); |
|
465 | + $webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster'; |
|
466 | 466 | $oMail->setContent("Dear $obj->user_name, <br /><br /> |
467 | 467 | We recently migrated our site to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link: |
468 | - <a href='" . getFullSiteUrl() . "/?act=dispMemberFindAccount' >" . getFullSiteUrl() . "?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br /> |
|
468 | + <a href='".getFullSiteUrl()."/?act=dispMemberFindAccount' >".getFullSiteUrl()."?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br /> |
|
469 | 469 | |
470 | 470 | Thank you for your understanding,<br /> |
471 | 471 | {$webmaster_name}" |
472 | 472 | ); |
473 | 473 | $oMail->setSender($webmaster_name, $member_config->webmaster_email); |
474 | - $oMail->setReceiptor( $obj->user_name, $obj->email); |
|
474 | + $oMail->setReceiptor($obj->user_name, $obj->email); |
|
475 | 475 | $oMail->send(); |
476 | 476 | } |
477 | 477 | |
478 | 478 | // add group join/image name-mark-signiture and so on if a new member successfully added |
479 | - if($output->toBool()) |
|
479 | + if ($output->toBool()) |
|
480 | 480 | { |
481 | 481 | // Join to the default group |
482 | 482 | $obj->group_srl = $default_group_srl; |
483 | - executeQuery('member.addMemberToGroup',$obj); |
|
483 | + executeQuery('member.addMemberToGroup', $obj); |
|
484 | 484 | // Image name |
485 | - if($obj->image_nickname) |
|
485 | + if ($obj->image_nickname) |
|
486 | 486 | { |
487 | 487 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl)); |
488 | 488 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
489 | 489 | FileHandler::writeFile($target_filename, $obj->image_nickname); |
490 | 490 | } |
491 | 491 | // Image mark |
492 | - if($obj->image_mark && file_exists($obj->image_mark)) |
|
492 | + if ($obj->image_mark && file_exists($obj->image_mark)) |
|
493 | 493 | { |
494 | 494 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl)); |
495 | 495 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
496 | 496 | FileHandler::writeFile($target_filename, $obj->image_mark); |
497 | 497 | } |
498 | 498 | // Profile image |
499 | - if($obj->profile_image) |
|
499 | + if ($obj->profile_image) |
|
500 | 500 | { |
501 | 501 | $target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl)); |
502 | 502 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
503 | 503 | FileHandler::writeFile($target_filename, $obj->profile_image); |
504 | 504 | } |
505 | 505 | // Signiture |
506 | - if($obj->signature) |
|
506 | + if ($obj->signature) |
|
507 | 507 | { |
508 | 508 | $signature = removeHackTag($obj->signature); |
509 | 509 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
510 | 510 | |
511 | 511 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
512 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
512 | + if (!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
513 | 513 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
514 | 514 | |
515 | 515 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | fclose($f); |
521 | 521 | |
522 | - return $idx-1; |
|
522 | + return $idx - 1; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
@@ -531,58 +531,58 @@ discard block |
||
531 | 531 | */ |
532 | 532 | function importMessage($key, $cur, $index_file) |
533 | 533 | { |
534 | - if(!$cur) $cur = 0; |
|
534 | + if (!$cur) $cur = 0; |
|
535 | 535 | // Create the xmlParser object |
536 | 536 | $oXmlParser = new XmlParser(); |
537 | 537 | // Open an index file |
538 | - $f = fopen($index_file,"r"); |
|
538 | + $f = fopen($index_file, "r"); |
|
539 | 539 | // Pass if already read |
540 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
540 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
541 | 541 | // Read each line until the condition meets |
542 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
542 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
543 | 543 | { |
544 | - if(feof($f)) break; |
|
544 | + if (feof($f)) break; |
|
545 | 545 | // Find a location |
546 | 546 | $target_file = trim(fgets($f, 1024)); |
547 | 547 | // Load and parse the file |
548 | 548 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
549 | 549 | FileHandler::removeFile($target_file); |
550 | - if(!$xmlObj) continue; |
|
550 | + if (!$xmlObj) continue; |
|
551 | 551 | // List objects |
552 | 552 | $obj = null; |
553 | 553 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
554 | 554 | $obj->sender = base64_decode($xmlObj->message->sender->body); |
555 | 555 | $obj->title = base64_decode($xmlObj->message->title->body); |
556 | 556 | $obj->content = base64_decode($xmlObj->message->content->body); |
557 | - $obj->readed = base64_decode($xmlObj->message->readed->body)=='Y'?'Y':'N'; |
|
557 | + $obj->readed = base64_decode($xmlObj->message->readed->body) == 'Y' ? 'Y' : 'N'; |
|
558 | 558 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
559 | 559 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
560 | 560 | // Get member_srl of sender/recipient (If not exists, pass) |
561 | - if(!$obj->sender) continue; |
|
561 | + if (!$obj->sender) continue; |
|
562 | 562 | $sender_args->user_id = $obj->sender; |
563 | - $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
|
563 | + $sender_output = executeQuery('member.getMemberInfo', $sender_args); |
|
564 | 564 | $sender_srl = $sender_output->data->member_srl; |
565 | - if(!$sender_srl) |
|
565 | + if (!$sender_srl) |
|
566 | 566 | { |
567 | 567 | unset($sender_args); |
568 | 568 | $sender_args->email_address = $obj->sender; |
569 | - $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
|
569 | + $sender_output = executeQuery('member.getMemberInfoByEmailAddress', $sender_args); |
|
570 | 570 | $sender_srl = $sender_output->data->member_srl; |
571 | 571 | } |
572 | - if(!$sender_srl) continue; |
|
572 | + if (!$sender_srl) continue; |
|
573 | 573 | |
574 | 574 | $receiver_args->user_id = $obj->receiver; |
575 | - if(!$obj->receiver) continue; |
|
576 | - $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
|
575 | + if (!$obj->receiver) continue; |
|
576 | + $receiver_output = executeQuery('member.getMemberInfo', $receiver_args); |
|
577 | 577 | $receiver_srl = $receiver_output->data->member_srl; |
578 | - if(!$receiver_srl) |
|
578 | + if (!$receiver_srl) |
|
579 | 579 | { |
580 | 580 | unset($receiver_args); |
581 | 581 | $receiver_args->email_address = $obj->receiver; |
582 | - $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
|
582 | + $receiver_output = executeQuery('member.getMemberInfoByEmailAddress', $receiver_args); |
|
583 | 583 | $receiver_srl = $receiver_output->data->member_srl; |
584 | 584 | } |
585 | - if(!$receiver_srl) continue; |
|
585 | + if (!$receiver_srl) continue; |
|
586 | 586 | // Message to save into sender's message box |
587 | 587 | $sender_args->sender_srl = $sender_srl; |
588 | 588 | $sender_args->receiver_srl = $receiver_srl; |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | $sender_args->list_order = $sender_args->message_srl * -1; |
598 | 598 | |
599 | 599 | $output = executeQuery('communication.sendMessage', $sender_args); |
600 | - if($output->toBool()) |
|
600 | + if ($output->toBool()) |
|
601 | 601 | { |
602 | 602 | // Message to save into recipient's massage box |
603 | 603 | $receiver_args->message_srl = $sender_args->related_srl; |
604 | - $receiver_args->list_order = $sender_args->related_srl*-1; |
|
604 | + $receiver_args->list_order = $sender_args->related_srl * -1; |
|
605 | 605 | $receiver_args->sender_srl = $sender_srl; |
606 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
606 | + if (!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
607 | 607 | $receiver_args->receiver_srl = $receiver_srl; |
608 | 608 | $receiver_args->message_type = 'R'; |
609 | 609 | $receiver_args->title = $obj->title; |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | |
618 | 618 | fclose($f); |
619 | 619 | |
620 | - return $idx-1; |
|
620 | + return $idx - 1; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | /** |
@@ -637,10 +637,10 @@ discard block |
||
637 | 637 | $oDocumentModel = getModel('document'); |
638 | 638 | $category_list = $category_titles = array(); |
639 | 639 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
640 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
640 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
641 | 641 | // Extract category information |
642 | 642 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
643 | - if(file_exists($category_file)) |
|
643 | + if (file_exists($category_file)) |
|
644 | 644 | { |
645 | 645 | $buff = FileHandler::readFile($category_file); |
646 | 646 | |
@@ -648,14 +648,14 @@ discard block |
||
648 | 648 | $xmlDoc = $this->oXmlParser->loadXmlFile($category_file); |
649 | 649 | |
650 | 650 | $categories = $xmlDoc->items->category; |
651 | - if($categories) |
|
651 | + if ($categories) |
|
652 | 652 | { |
653 | - if(!is_array($categories)) $categories = array($categories); |
|
653 | + if (!is_array($categories)) $categories = array($categories); |
|
654 | 654 | $match_sequence = array(); |
655 | - foreach($categories as $k => $v) |
|
655 | + foreach ($categories as $k => $v) |
|
656 | 656 | { |
657 | 657 | $category = trim(base64_decode($v->body)); |
658 | - if(!$category || $category_titles[$category]) continue; |
|
658 | + if (!$category || $category_titles[$category]) continue; |
|
659 | 659 | |
660 | 660 | $sequence = $v->attrs->sequence; |
661 | 661 | $parent = $v->attrs->parent; |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | $obj = null; |
664 | 664 | $obj->title = $category; |
665 | 665 | $obj->module_srl = $module_srl; |
666 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
666 | + if ($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
667 | 667 | |
668 | 668 | $output = $oDocumentController->insertCategory($obj); |
669 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
669 | + if ($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
670 | 670 | } |
671 | 671 | $oDocumentController = getController('document'); |
672 | 672 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -676,31 +676,31 @@ discard block |
||
676 | 676 | |
677 | 677 | $category_list = $category_titles = array(); |
678 | 678 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
679 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
679 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
680 | 680 | |
681 | 681 | $ek_args->module_srl = $module_srl; |
682 | 682 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
683 | - if($output->data) |
|
683 | + if ($output->data) |
|
684 | 684 | { |
685 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
685 | + foreach ($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
686 | 686 | } |
687 | 687 | |
688 | - if(!$cur) $cur = 0; |
|
688 | + if (!$cur) $cur = 0; |
|
689 | 689 | // Open an index file |
690 | - $f = fopen($index_file,"r"); |
|
690 | + $f = fopen($index_file, "r"); |
|
691 | 691 | // Pass if already read |
692 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
692 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
693 | 693 | // Read each line until the condition meets |
694 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
694 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
695 | 695 | { |
696 | - if(feof($f)) break; |
|
696 | + if (feof($f)) break; |
|
697 | 697 | // Find a location |
698 | 698 | $target_file = trim(fgets($f, 1024)); |
699 | 699 | |
700 | - if(!file_exists($target_file)) continue; |
|
700 | + if (!file_exists($target_file)) continue; |
|
701 | 701 | // Importing data from now on |
702 | - $fp = fopen($target_file,"r"); |
|
703 | - if(!$fp) continue; |
|
702 | + $fp = fopen($target_file, "r"); |
|
703 | + if (!$fp) continue; |
|
704 | 704 | |
705 | 705 | $obj = new stdClass; |
706 | 706 | $obj->module_srl = $module_srl; |
@@ -712,51 +712,51 @@ discard block |
||
712 | 712 | $started = false; |
713 | 713 | $buff = array(); |
714 | 714 | // Start from the body data |
715 | - while(!feof($fp)) |
|
715 | + while (!feof($fp)) |
|
716 | 716 | { |
717 | 717 | $str = fgets($fp, 1024); |
718 | 718 | // Prepare an item |
719 | - if(trim($str) == '<post>') |
|
719 | + if (trim($str) == '<post>') |
|
720 | 720 | { |
721 | 721 | $started = true; |
722 | 722 | // Trackback inserted |
723 | 723 | } |
724 | - else if(substr($str,0,11) == '<trackbacks') |
|
724 | + else if (substr($str, 0, 11) == '<trackbacks') |
|
725 | 725 | { |
726 | 726 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
727 | 727 | continue; |
728 | 728 | // Comments inserted |
729 | 729 | } |
730 | - else if(substr($str,0,9) == '<comments') |
|
730 | + else if (substr($str, 0, 9) == '<comments') |
|
731 | 731 | { |
732 | 732 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
733 | 733 | continue; |
734 | 734 | // Attachment inserted |
735 | 735 | } |
736 | - else if(substr($str,0,9) == '<attaches') |
|
736 | + else if (substr($str, 0, 9) == '<attaches') |
|
737 | 737 | { |
738 | 738 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
739 | 739 | continue; |
740 | 740 | // When starting extra variabls |
741 | 741 | } |
742 | - elseif(trim($str) == '<extra_vars>') |
|
742 | + elseif (trim($str) == '<extra_vars>') |
|
743 | 743 | { |
744 | 744 | $extra_vars = $this->importExtraVars($fp); |
745 | 745 | continue; |
746 | 746 | } |
747 | 747 | |
748 | - if($started) $buff[] = $str; |
|
748 | + if ($started) $buff[] = $str; |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
752 | 752 | |
753 | 753 | $category = base64_decode($xmlDoc->post->category->body); |
754 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
754 | + if ($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
755 | 755 | |
756 | 756 | $obj->member_srl = 0; |
757 | 757 | |
758 | - $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body)=='Y'?'Y':'N'; |
|
759 | - $obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public'); |
|
758 | + $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body) == 'Y' ? 'Y' : 'N'; |
|
759 | + $obj->status = base64_decode($xmlDoc->post->is_secret->body) == 'Y' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public'); |
|
760 | 760 | $obj->title = base64_decode($xmlDoc->post->title->body); |
761 | 761 | $obj->content = base64_decode($xmlDoc->post->content->body); |
762 | 762 | $obj->readed_count = base64_decode($xmlDoc->post->readed_count->body); |
@@ -765,53 +765,53 @@ discard block |
||
765 | 765 | $obj->password = base64_decode($xmlDoc->post->password->body); |
766 | 766 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
767 | 767 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
768 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
768 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
769 | 769 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
770 | 770 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
771 | 771 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
772 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
772 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
773 | 773 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
774 | 774 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
775 | 775 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
776 | 776 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
777 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
777 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
778 | 778 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
779 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
|
780 | - $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
|
781 | - $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N'; |
|
779 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1; |
|
780 | + $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body) != 'N' ? 'ALLOW' : 'DENY'; |
|
781 | + $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body) != 'N' ? 'Y' : 'N'; |
|
782 | 782 | $obj->notify_message = base64_decode($xmlDoc->post->is_notice->body); |
783 | 783 | // Check user ID |
784 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
784 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
785 | 785 | { |
786 | 786 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
787 | 787 | } |
788 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
788 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
789 | 789 | { |
790 | - $obj->user_id = 't' . $obj->member_srl; |
|
790 | + $obj->user_id = 't'.$obj->member_srl; |
|
791 | 791 | } |
792 | 792 | // Check email address |
793 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
793 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
794 | 794 | { |
795 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
795 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
796 | 796 | } |
797 | 797 | // Change content information (attachment) |
798 | - if(count($files)) |
|
798 | + if (count($files)) |
|
799 | 799 | { |
800 | - foreach($files as $key => $val) |
|
800 | + foreach ($files as $key => $val) |
|
801 | 801 | { |
802 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
803 | - $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
804 | - $obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
802 | + $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content); |
|
803 | + $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content); |
|
804 | + $obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content); |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 | |
808 | 808 | $output = executeQuery('document.insertDocument', $obj); |
809 | 809 | |
810 | - if($output->toBool() && $obj->tags) |
|
810 | + if ($output->toBool() && $obj->tags) |
|
811 | 811 | { |
812 | - $tag_list = explode(',',$obj->tags); |
|
812 | + $tag_list = explode(',', $obj->tags); |
|
813 | 813 | $tag_count = count($tag_list); |
814 | - for($i=0;$i<$tag_count;$i++) |
|
814 | + for ($i = 0; $i < $tag_count; $i++) |
|
815 | 815 | { |
816 | 816 | $args = new stdClass; |
817 | 817 | $args->tag_srl = getNextSequence(); |
@@ -819,17 +819,17 @@ discard block |
||
819 | 819 | $args->document_srl = $obj->document_srl; |
820 | 820 | $args->tag = trim($tag_list[$i]); |
821 | 821 | $args->regdate = $obj->regdate; |
822 | - if(!$args->tag) continue; |
|
822 | + if (!$args->tag) continue; |
|
823 | 823 | $output = executeQuery('tag.insertTag', $args); |
824 | 824 | } |
825 | 825 | |
826 | 826 | } |
827 | 827 | // Add extra variables |
828 | - if(count($extra_vars)) |
|
828 | + if (count($extra_vars)) |
|
829 | 829 | { |
830 | - foreach($extra_vars as $key => $val) |
|
830 | + foreach ($extra_vars as $key => $val) |
|
831 | 831 | { |
832 | - if(!$val->value) continue; |
|
832 | + if (!$val->value) continue; |
|
833 | 833 | unset($e_args); |
834 | 834 | $e_args->module_srl = $module_srl; |
835 | 835 | $e_args->document_srl = $obj->document_srl; |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | $e_args->lang_code = $val->lang_code; |
839 | 839 | $e_args->eid = $val->eid; |
840 | 840 | // Create a key for extra vars if not exists (except vars for title and content) |
841 | - if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid]) |
|
841 | + if (!preg_match('/^(title|content)_(.+)$/i', $e_args->eid) && !$extra_keys[$e_args->eid]) |
|
842 | 842 | { |
843 | 843 | unset($ek_args); |
844 | 844 | $ek_args->module_srl = $module_srl; |
@@ -862,9 +862,9 @@ discard block |
||
862 | 862 | |
863 | 863 | fclose($f); |
864 | 864 | // Sync category counts |
865 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
865 | + if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
866 | 866 | |
867 | - return $idx-1; |
|
867 | + return $idx - 1; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -880,17 +880,17 @@ discard block |
||
880 | 880 | $buff = null; |
881 | 881 | $cnt = 0; |
882 | 882 | |
883 | - while(!feof($fp)) |
|
883 | + while (!feof($fp)) |
|
884 | 884 | { |
885 | 885 | $str = fgets($fp, 1024); |
886 | 886 | // If </trackbacks> is, break |
887 | - if(trim($str) == '</trackbacks>') break; |
|
887 | + if (trim($str) == '</trackbacks>') break; |
|
888 | 888 | // If <trackback>, start importing |
889 | - if(trim($str) == '<trackback>') $started = true; |
|
889 | + if (trim($str) == '<trackback>') $started = true; |
|
890 | 890 | |
891 | - if($started) $buff .= $str; |
|
891 | + if ($started) $buff .= $str; |
|
892 | 892 | // If </trackback>, insert to the DB |
893 | - if(trim($str) == '</trackback>') |
|
893 | + if (trim($str) == '</trackback>') |
|
894 | 894 | { |
895 | 895 | $xmlDoc = $this->oXmlParser->parse($buff); |
896 | 896 | |
@@ -904,9 +904,9 @@ discard block |
||
904 | 904 | $obj->excerpt = base64_decode($xmlDoc->trackback->excerpt->body); |
905 | 905 | $obj->regdate = base64_decode($xmlDoc->trackback->regdate->body); |
906 | 906 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
907 | - $obj->list_order = -1*$obj->trackback_srl; |
|
907 | + $obj->list_order = -1 * $obj->trackback_srl; |
|
908 | 908 | $output = executeQuery('trackback.insertTrackback', $obj); |
909 | - if($output->toBool()) $cnt++; |
|
909 | + if ($output->toBool()) $cnt++; |
|
910 | 910 | |
911 | 911 | $buff = null; |
912 | 912 | $started = false; |
@@ -930,13 +930,13 @@ discard block |
||
930 | 930 | |
931 | 931 | $sequences = array(); |
932 | 932 | |
933 | - while(!feof($fp)) |
|
933 | + while (!feof($fp)) |
|
934 | 934 | { |
935 | 935 | $str = fgets($fp, 1024); |
936 | 936 | // If </comments> is, break |
937 | - if(trim($str) == '</comments>') break; |
|
937 | + if (trim($str) == '</comments>') break; |
|
938 | 938 | // If <comment> is, start importing |
939 | - if(trim($str) == '<comment>') |
|
939 | + if (trim($str) == '<comment>') |
|
940 | 940 | { |
941 | 941 | $started = true; |
942 | 942 | $obj = new stdClass; |
@@ -944,15 +944,15 @@ discard block |
||
944 | 944 | $files = array(); |
945 | 945 | } |
946 | 946 | // If <attaches is, start importing attachments |
947 | - if(substr($str,0,9) == '<attaches') |
|
947 | + if (substr($str, 0, 9) == '<attaches') |
|
948 | 948 | { |
949 | 949 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files); |
950 | 950 | continue; |
951 | 951 | } |
952 | 952 | |
953 | - if($started) $buff .= $str; |
|
953 | + if ($started) $buff .= $str; |
|
954 | 954 | // If </comment> is, insert to the DB |
955 | - if(trim($str) == '</comment>') |
|
955 | + if (trim($str) == '</comment>') |
|
956 | 956 | { |
957 | 957 | $xmlDoc = $this->oXmlParser->parse($buff); |
958 | 958 | |
@@ -962,49 +962,49 @@ discard block |
||
962 | 962 | |
963 | 963 | $obj->module_srl = $module_srl; |
964 | 964 | |
965 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
965 | + if ($parent) $obj->parent_srl = $sequences[$parent]; |
|
966 | 966 | else $obj->parent_srl = 0; |
967 | 967 | |
968 | 968 | $obj->document_srl = $document_srl; |
969 | - $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
|
970 | - $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body)=='Y'?'Y':'N'; |
|
969 | + $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body) == 'Y' ? 'Y' : 'N'; |
|
970 | + $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body) == 'Y' ? 'Y' : 'N'; |
|
971 | 971 | $obj->content = base64_decode($xmlDoc->comment->content->body); |
972 | 972 | $obj->voted_count = base64_decode($xmlDoc->comment->voted_count->body); |
973 | 973 | $obj->blamed_count = base64_decode($xmlDoc->comment->blamed_count->body); |
974 | 974 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
975 | - $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
|
975 | + $obj->user_name = base64_decode($xmlDoc->comment->user_name->body); |
|
976 | 976 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
977 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
977 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
978 | 978 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
979 | 979 | $obj->member_srl = 0; |
980 | 980 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
981 | 981 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
982 | 982 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
983 | 983 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
984 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
984 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
985 | 985 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
986 | - $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
|
987 | - $obj->list_order = $obj->comment_srl*-1; |
|
986 | + $obj->status = base64_decode($xmlDoc->comment->status->body) == '' ? '1' : base64_decode($xmlDoc->comment->status->body); |
|
987 | + $obj->list_order = $obj->comment_srl * -1; |
|
988 | 988 | // Check user ID |
989 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
989 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
990 | 990 | { |
991 | 991 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
992 | 992 | } |
993 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
993 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
994 | 994 | { |
995 | - $obj->user_id = 't' . $obj->member_srl; |
|
995 | + $obj->user_id = 't'.$obj->member_srl; |
|
996 | 996 | } |
997 | 997 | // Check email address |
998 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
998 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
999 | 999 | { |
1000 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
1000 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
1001 | 1001 | } |
1002 | 1002 | // Change content information (attachment) |
1003 | - if(count($files)) |
|
1003 | + if (count($files)) |
|
1004 | 1004 | { |
1005 | - foreach($files as $key => $val) |
|
1005 | + foreach ($files as $key => $val) |
|
1006 | 1006 | { |
1007 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
1007 | + $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content); |
|
1008 | 1008 | } |
1009 | 1009 | } |
1010 | 1010 | // Comment list first |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | $list_args->module_srl = $obj->module_srl; |
1015 | 1015 | $list_args->regdate = $obj->regdate; |
1016 | 1016 | // Set data directly if parent comment doesn't exist |
1017 | - if(!$obj->parent_srl) |
|
1017 | + if (!$obj->parent_srl) |
|
1018 | 1018 | { |
1019 | 1019 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
1020 | 1020 | $list_args->depth = 0; |
@@ -1026,25 +1026,25 @@ discard block |
||
1026 | 1026 | $parent_args->comment_srl = $obj->parent_srl; |
1027 | 1027 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
1028 | 1028 | // Return if parent comment doesn't exist |
1029 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
1029 | + if (!$parent_output->toBool() || !$parent_output->data) continue; |
|
1030 | 1030 | $parent = $parent_output->data; |
1031 | 1031 | |
1032 | 1032 | $list_args->head = $parent->head; |
1033 | - $list_args->depth = $parent->depth+1; |
|
1034 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
1033 | + $list_args->depth = $parent->depth + 1; |
|
1034 | + if ($list_args->depth < 2) $list_args->arrange = $obj->comment_srl; |
|
1035 | 1035 | else |
1036 | 1036 | { |
1037 | 1037 | $list_args->arrange = $parent->arrange; |
1038 | 1038 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
1039 | - if(!$output->toBool()) return $output; |
|
1039 | + if (!$output->toBool()) return $output; |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | $output = executeQuery('comment.insertCommentList', $list_args); |
1044 | - if($output->toBool()) |
|
1044 | + if ($output->toBool()) |
|
1045 | 1045 | { |
1046 | 1046 | $output = executeQuery('comment.insertComment', $obj); |
1047 | - if($output->toBool()) $cnt++; |
|
1047 | + if ($output->toBool()) $cnt++; |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | $buff = null; |
@@ -1070,13 +1070,13 @@ discard block |
||
1070 | 1070 | $buff = null; |
1071 | 1071 | |
1072 | 1072 | $file_obj = new stdClass; |
1073 | - while(!feof($fp)) |
|
1073 | + while (!feof($fp)) |
|
1074 | 1074 | { |
1075 | 1075 | $str = trim(fgets($fp, 1024)); |
1076 | 1076 | // If it ends with </attaches>, break |
1077 | - if(trim($str) == '</attaches>') break; |
|
1077 | + if (trim($str) == '</attaches>') break; |
|
1078 | 1078 | // If it starts with <attach>, collect attachments |
1079 | - if(trim($str) == '<attach>') |
|
1079 | + if (trim($str) == '<attach>') |
|
1080 | 1080 | { |
1081 | 1081 | $file_obj->file_srl = getNextSequence(); |
1082 | 1082 | $file_obj->upload_target_srl = $upload_target_srl; |
@@ -1086,26 +1086,26 @@ discard block |
||
1086 | 1086 | $buff = null; |
1087 | 1087 | // If it starts with <file>, handle the attachement in xml file |
1088 | 1088 | } |
1089 | - else if(trim($str) == '<file>') |
|
1089 | + else if (trim($str) == '<file>') |
|
1090 | 1090 | { |
1091 | 1091 | $file_obj->file = $this->saveTemporaryFile($fp); |
1092 | 1092 | continue; |
1093 | 1093 | } |
1094 | 1094 | |
1095 | - if($started) $buff .= $str; |
|
1095 | + if ($started) $buff .= $str; |
|
1096 | 1096 | // If it ends with </attach>, handle attachements |
1097 | - if(trim($str) == '</attach>') |
|
1097 | + if (trim($str) == '</attach>') |
|
1098 | 1098 | { |
1099 | 1099 | $xmlDoc = $this->oXmlParser->parse($buff.$str); |
1100 | 1100 | |
1101 | 1101 | $file_obj->source_filename = base64_decode($xmlDoc->attach->filename->body); |
1102 | 1102 | $file_obj->download_count = base64_decode($xmlDoc->attach->download_count->body); |
1103 | 1103 | |
1104 | - if(!$file_obj->file) |
|
1104 | + if (!$file_obj->file) |
|
1105 | 1105 | { |
1106 | 1106 | $url = base64_decode($xmlDoc->attach->url->body); |
1107 | 1107 | $path = base64_decode($xmlDoc->attach->path->body); |
1108 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
1108 | + if ($path && file_exists($path)) $file_obj->file = $path; |
|
1109 | 1109 | else |
1110 | 1110 | { |
1111 | 1111 | $file_obj->file = $this->getTmpFilename(); |
@@ -1113,11 +1113,11 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | |
1116 | - if(file_exists($file_obj->file)) |
|
1116 | + if (file_exists($file_obj->file)) |
|
1117 | 1117 | { |
1118 | 1118 | $random = new Password(); |
1119 | 1119 | // Set upload path by checking if the attachement is an image or other kind of file |
1120 | - if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
1120 | + if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
1121 | 1121 | { |
1122 | 1122 | // Immediately remove the direct file if it has any kind of extensions for hacking |
1123 | 1123 | $file_obj->source_filename = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_obj->source_filename); |
@@ -1125,14 +1125,14 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
1127 | 1127 | |
1128 | - $ext = substr(strrchr($file_obj->source_filename,'.'),1); |
|
1128 | + $ext = substr(strrchr($file_obj->source_filename, '.'), 1); |
|
1129 | 1129 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; |
1130 | 1130 | $filename = $path.$_filename; |
1131 | 1131 | |
1132 | 1132 | $idx = 1; |
1133 | - while(file_exists($filename)) |
|
1133 | + while (file_exists($filename)) |
|
1134 | 1134 | { |
1135 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1', $_filename); |
|
1135 | + $filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); |
|
1136 | 1136 | $idx++; |
1137 | 1137 | } |
1138 | 1138 | |
@@ -1140,14 +1140,14 @@ discard block |
||
1140 | 1140 | } |
1141 | 1141 | else |
1142 | 1142 | { |
1143 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
1143 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
1144 | 1144 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
1145 | 1145 | $file_obj->direct_download = 'N'; |
1146 | 1146 | } |
1147 | 1147 | // Create a directory |
1148 | - if(!FileHandler::makeDir($path)) continue; |
|
1148 | + if (!FileHandler::makeDir($path)) continue; |
|
1149 | 1149 | |
1150 | - if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
1150 | + if (strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
1151 | 1151 | { |
1152 | 1152 | FileHandler::rename($file_obj->file, $filename); |
1153 | 1153 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | |
1159 | 1159 | // Insert the file to the DB |
1160 | 1160 | unset($file_obj->file); |
1161 | - if(file_exists($filename)) |
|
1161 | + if (file_exists($filename)) |
|
1162 | 1162 | { |
1163 | 1163 | $file_obj->uploaded_filename = $filename; |
1164 | 1164 | $file_obj->file_size = filesize($filename); |
@@ -1168,13 +1168,13 @@ discard block |
||
1168 | 1168 | $file_obj->isvalid = 'Y'; |
1169 | 1169 | $output = executeQuery('file.insertFile', $file_obj); |
1170 | 1170 | |
1171 | - if($output->toBool()) |
|
1171 | + if ($output->toBool()) |
|
1172 | 1172 | { |
1173 | 1173 | $uploaded_count++; |
1174 | 1174 | $tmp_obj = null; |
1175 | 1175 | $tmp_obj->source_filename = $file_obj->source_filename; |
1176 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1177 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1176 | + if ($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1177 | + else $files[$file_obj->source_filename] = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid); |
|
1178 | 1178 | } |
1179 | 1179 | } |
1180 | 1180 | } |
@@ -1191,8 +1191,8 @@ discard block |
||
1191 | 1191 | { |
1192 | 1192 | $path = "./files/cache/importer"; |
1193 | 1193 | FileHandler::makeDir($path); |
1194 | - $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
|
1195 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
1194 | + $filename = sprintf("%s/%d", $path, rand(11111111, 99999999)); |
|
1195 | + if (file_exists($filename)) $filename .= rand(111, 999); |
|
1196 | 1196 | return $filename; |
1197 | 1197 | } |
1198 | 1198 | |
@@ -1207,14 +1207,14 @@ discard block |
||
1207 | 1207 | $f = fopen($temp_filename, "w"); |
1208 | 1208 | |
1209 | 1209 | $buff = ''; |
1210 | - while(!feof($fp)) |
|
1210 | + while (!feof($fp)) |
|
1211 | 1211 | { |
1212 | 1212 | $str = trim(fgets($fp, 1024)); |
1213 | - if(trim($str) == '</file>') break; |
|
1213 | + if (trim($str) == '</file>') break; |
|
1214 | 1214 | |
1215 | 1215 | $buff .= $str; |
1216 | 1216 | |
1217 | - if(substr($buff,-7)=='</buff>') |
|
1217 | + if (substr($buff, -7) == '</buff>') |
|
1218 | 1218 | { |
1219 | 1219 | fwrite($f, base64_decode(substr($buff, 6, -7))); |
1220 | 1220 | $buff = ''; |
@@ -1233,23 +1233,23 @@ discard block |
||
1233 | 1233 | function importExtraVars($fp) |
1234 | 1234 | { |
1235 | 1235 | $buff = null; |
1236 | - while(!feof($fp)) |
|
1236 | + while (!feof($fp)) |
|
1237 | 1237 | { |
1238 | 1238 | $buff .= $str = trim(fgets($fp, 1024)); |
1239 | - if(trim($str) == '</extra_vars>') break; |
|
1239 | + if (trim($str) == '</extra_vars>') break; |
|
1240 | 1240 | } |
1241 | - if(!$buff) return array(); |
|
1241 | + if (!$buff) return array(); |
|
1242 | 1242 | |
1243 | 1243 | $buff = '<extra_vars>'.$buff; |
1244 | 1244 | $oXmlParser = new XmlParser(); |
1245 | 1245 | $xmlDoc = $this->oXmlParser->parse($buff); |
1246 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
1246 | + if (!count($xmlDoc->extra_vars->key)) return array(); |
|
1247 | 1247 | |
1248 | 1248 | $index = 1; |
1249 | - foreach($xmlDoc->extra_vars->key as $k => $v) |
|
1249 | + foreach ($xmlDoc->extra_vars->key as $k => $v) |
|
1250 | 1250 | { |
1251 | 1251 | unset($vobj); |
1252 | - if($v->var_idx) |
|
1252 | + if ($v->var_idx) |
|
1253 | 1253 | { |
1254 | 1254 | $vobj->var_idx = base64_decode($v->var_idx->body); |
1255 | 1255 | $vobj->lang_code = base64_decode($v->lang_code->body); |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | $vobj->eid = base64_decode($v->eid->body); |
1258 | 1258 | |
1259 | 1259 | } |
1260 | - else if($v->body) |
|
1260 | + else if ($v->body) |
|
1261 | 1261 | { |
1262 | 1262 | $vobj->var_idx = $index; |
1263 | 1263 | $vobj->lang_code = Context::getLangType(); |
@@ -55,24 +55,29 @@ discard block |
||
55 | 55 | { |
56 | 56 | $isExists = 'true'; |
57 | 57 | $type = 'XML'; |
58 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
58 | + if(stristr($str, 'tattertools')) { |
|
59 | + $type = 'TTXML'; |
|
60 | + } |
|
59 | 61 | |
60 | 62 | $this->add('type', $type); |
61 | 63 | } |
62 | 64 | fclose($fp); |
63 | 65 | $resultMessage = $lang->found_xml_file; |
66 | + } else { |
|
67 | + $resultMessage = $lang->cannot_url_file; |
|
64 | 68 | } |
65 | - else $resultMessage = $lang->cannot_url_file; |
|
69 | + } else { |
|
70 | + $resultMessage = $lang->cannot_allow_fopen_in_phpini; |
|
66 | 71 | } |
67 | - else $resultMessage = $lang->cannot_allow_fopen_in_phpini; |
|
68 | 72 | |
69 | 73 | $this->add('exists', $isExists); |
70 | - } |
|
71 | - else |
|
74 | + } else |
|
72 | 75 | { |
73 | 76 | $realPath = FileHandler::getRealPath($filename); |
74 | 77 | |
75 | - if(file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
78 | + if(file_exists($realPath) && is_file($realPath)) { |
|
79 | + $isExists = 'true'; |
|
80 | + } |
|
76 | 81 | $this->add('exists', $isExists); |
77 | 82 | |
78 | 83 | if($isExists == 'true') |
@@ -81,13 +86,16 @@ discard block |
||
81 | 86 | |
82 | 87 | $fp = fopen($realPath, "r"); |
83 | 88 | $str = fgets($fp, 100); |
84 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
89 | + if(stristr($str, 'tattertools')) { |
|
90 | + $type = 'TTXML'; |
|
91 | + } |
|
85 | 92 | fclose($fp); |
86 | 93 | |
87 | 94 | $this->add('type', $type); |
88 | 95 | $resultMessage = $lang->found_xml_file; |
96 | + } else { |
|
97 | + $resultMessage = $lang->not_found_xml_file; |
|
89 | 98 | } |
90 | - else $resultMessage = $lang->not_found_xml_file; |
|
91 | 99 | } |
92 | 100 | $this->add('result_message', $resultMessage); |
93 | 101 | } |
@@ -112,8 +120,7 @@ discard block |
||
112 | 120 | { |
113 | 121 | $output = executeQuery('importer.updateDocumentSync'.$postFix); |
114 | 122 | $output = executeQuery('importer.updateCommentSync'.$postFix); |
115 | - } |
|
116 | - else |
|
123 | + } else |
|
117 | 124 | { |
118 | 125 | $output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix); |
119 | 126 | if(is_array ($output->data) && count ($output->data)) |
@@ -129,8 +136,7 @@ discard block |
||
129 | 136 | if($tmp->toBool () === true) |
130 | 137 | { |
131 | 138 | $success_count++; |
132 | - } |
|
133 | - else |
|
139 | + } else |
|
134 | 140 | { |
135 | 141 | $error_count++; |
136 | 142 | } |
@@ -152,8 +158,7 @@ discard block |
||
152 | 158 | if($tmp->toBool () === true) |
153 | 159 | { |
154 | 160 | $success_count++; |
155 | - } |
|
156 | - else |
|
161 | + } else |
|
157 | 162 | { |
158 | 163 | $error_count++; |
159 | 164 | } |
@@ -182,11 +187,15 @@ discard block |
||
182 | 187 | { |
183 | 188 | case 'member' : |
184 | 189 | $output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>'); |
185 | - if($output->toBool()) $oExtract->saveItems(); |
|
190 | + if($output->toBool()) { |
|
191 | + $oExtract->saveItems(); |
|
192 | + } |
|
186 | 193 | break; |
187 | 194 | case 'message' : |
188 | 195 | $output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>'); |
189 | - if($output->toBool()) $oExtract->saveItems(); |
|
196 | + if($output->toBool()) { |
|
197 | + $oExtract->saveItems(); |
|
198 | + } |
|
190 | 199 | break; |
191 | 200 | case 'ttxml' : |
192 | 201 | // Category information |
@@ -204,8 +213,12 @@ discard block |
||
204 | 213 | $started = true; |
205 | 214 | $str = strstr($str, '<category>'); |
206 | 215 | } |
207 | - if(substr($str,0,strlen('<post ')) == '<post ') break; |
|
208 | - if ($started) $buff .= $str; |
|
216 | + if(substr($str,0,strlen('<post ')) == '<post ') { |
|
217 | + break; |
|
218 | + } |
|
219 | + if ($started) { |
|
220 | + $buff .= $str; |
|
221 | + } |
|
209 | 222 | } |
210 | 223 | $buff = '<categories>'.$buff.'</categories>'; |
211 | 224 | $oExtract->closeFile(); |
@@ -242,7 +255,9 @@ discard block |
||
242 | 255 | FileHandler::writeFile($guestbook_filename, $buff); |
243 | 256 | // Individual items |
244 | 257 | $output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>'); |
245 | - if($output->toBool()) $oExtract->saveItems(); |
|
258 | + if($output->toBool()) { |
|
259 | + $oExtract->saveItems(); |
|
260 | + } |
|
246 | 261 | } |
247 | 262 | } |
248 | 263 | break; |
@@ -254,7 +269,9 @@ discard block |
||
254 | 269 | $oExtract->mergeItems('category.xml'); |
255 | 270 | // Get each item |
256 | 271 | $output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>'); |
257 | - if($output->toBool()) $oExtract->saveItems(); |
|
272 | + if($output->toBool()) { |
|
273 | + $oExtract->saveItems(); |
|
274 | + } |
|
258 | 275 | } |
259 | 276 | break; |
260 | 277 | } |
@@ -291,19 +308,25 @@ discard block |
||
291 | 308 | $this->unit_count = Context::get('unit_count'); |
292 | 309 | // Check if an index file exists |
293 | 310 | $index_file = './files/cache/importer/'.$key.'/index'; |
294 | - if(!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
311 | + if(!file_exists($index_file)) { |
|
312 | + return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
313 | + } |
|
295 | 314 | |
296 | 315 | switch($type) |
297 | 316 | { |
298 | 317 | case 'ttxml' : |
299 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
318 | + if(!$target_module) { |
|
319 | + return new BaseObject(-1,'msg_invalid_request'); |
|
320 | + } |
|
300 | 321 | |
301 | 322 | $oModuleModel = getModel('module'); |
302 | 323 | $columnList = array('module_srl', 'module'); |
303 | 324 | $target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList); |
304 | 325 | |
305 | 326 | $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php'); |
306 | - if($ttimporter) require_once($ttimporter); |
|
327 | + if($ttimporter) { |
|
328 | + require_once($ttimporter); |
|
329 | + } |
|
307 | 330 | |
308 | 331 | $oTT = new ttimport(); |
309 | 332 | $cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module); |
@@ -316,7 +339,9 @@ discard block |
||
316 | 339 | break; |
317 | 340 | case 'module' : |
318 | 341 | // Check if the target module exists |
319 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
342 | + if(!$target_module) { |
|
343 | + return new BaseObject(-1,'msg_invalid_request'); |
|
344 | + } |
|
320 | 345 | $cur = $this->importModule($key, $cur, $index_file, $target_module); |
321 | 346 | break; |
322 | 347 | } |
@@ -331,8 +356,9 @@ discard block |
||
331 | 356 | { |
332 | 357 | $this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); |
333 | 358 | FileHandler::removeDir('./files/cache/importer/'.$key); |
359 | + } else { |
|
360 | + $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
334 | 361 | } |
335 | - else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
336 | 362 | } |
337 | 363 | |
338 | 364 | /** |
@@ -344,7 +370,9 @@ discard block |
||
344 | 370 | */ |
345 | 371 | function importMember($key, $cur, $index_file) |
346 | 372 | { |
347 | - if(!$cur) $cur = 0; |
|
373 | + if(!$cur) { |
|
374 | + $cur = 0; |
|
375 | + } |
|
348 | 376 | // Create the xmlParser object |
349 | 377 | $oXmlParser = new XmlParser(); |
350 | 378 | // Create objects for importing member information |
@@ -359,17 +387,23 @@ discard block |
||
359 | 387 | // Open an index file |
360 | 388 | $f = fopen($index_file,"r"); |
361 | 389 | // Pass if already read |
362 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
390 | + for($i=0;$i<$cur;$i++) { |
|
391 | + fgets($f, 1024); |
|
392 | + } |
|
363 | 393 | // Read by each line until the condition meets |
364 | 394 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
365 | 395 | { |
366 | - if(feof($f)) break; |
|
396 | + if(feof($f)) { |
|
397 | + break; |
|
398 | + } |
|
367 | 399 | // Find a given location |
368 | 400 | $target_file = trim(fgets($f, 1024)); |
369 | 401 | // Load and parse the file |
370 | 402 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
371 | 403 | FileHandler::removeFile($target_file); |
372 | - if(!$xmlObj) continue; |
|
404 | + if(!$xmlObj) { |
|
405 | + continue; |
|
406 | + } |
|
373 | 407 | // List Objects |
374 | 408 | $obj = new stdClass(); |
375 | 409 | $obj->member_srl = getNextSequence(); |
@@ -377,7 +411,9 @@ discard block |
||
377 | 411 | $obj->password = base64_decode($xmlObj->member->password->body); |
378 | 412 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
379 | 413 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
380 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
414 | + if(!$obj->user_name) { |
|
415 | + $obj->user_name = $obj->nick_name; |
|
416 | + } |
|
381 | 417 | $obj->email_address = base64_decode($xmlObj->member->email->body); |
382 | 418 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
383 | 419 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
@@ -395,12 +431,16 @@ discard block |
||
395 | 431 | { |
396 | 432 | foreach($xmlObj->member->extra_vars as $key => $val) |
397 | 433 | { |
398 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
434 | + if(in_array($key, array('node_name','attrs','body'))) { |
|
435 | + continue; |
|
436 | + } |
|
399 | 437 | $obj->extra_vars->{$key} = base64_decode($val->body); |
400 | 438 | } |
401 | 439 | } |
402 | 440 | // Create url for homepage and blog |
403 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
441 | + if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) { |
|
442 | + $obj->homepage = 'http://'.$obj->homepage; |
|
443 | + } |
|
404 | 444 | // Check user ID |
405 | 445 | if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
406 | 446 | { |
@@ -417,12 +457,18 @@ discard block |
||
417 | 457 | } |
418 | 458 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email_address); |
419 | 459 | // Set the mailing option |
420 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
460 | + if($obj->allow_mailing!='Y') { |
|
461 | + $obj->allow_mailing = 'N'; |
|
462 | + } |
|
421 | 463 | // Set the message option |
422 | 464 | $obj->allow_message = 'Y'; |
423 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
465 | + if(!in_array($obj->allow_message, array('Y','N','F'))) { |
|
466 | + $obj->allow_message= 'Y'; |
|
467 | + } |
|
424 | 468 | // Get member-join date if the last login time is not found |
425 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
469 | + if(!$obj->last_login) { |
|
470 | + $obj->last_login = $obj->regdate; |
|
471 | + } |
|
426 | 472 | // Set the list order |
427 | 473 | $obj->list_order = -1 * $obj->member_srl; |
428 | 474 | // List extra vars |
@@ -509,7 +555,9 @@ discard block |
||
509 | 555 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
510 | 556 | |
511 | 557 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
512 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
558 | + if(!is_dir($target_path)) { |
|
559 | + FileHandler::makeDir($target_path); |
|
560 | + } |
|
513 | 561 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
514 | 562 | |
515 | 563 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -531,23 +579,31 @@ discard block |
||
531 | 579 | */ |
532 | 580 | function importMessage($key, $cur, $index_file) |
533 | 581 | { |
534 | - if(!$cur) $cur = 0; |
|
582 | + if(!$cur) { |
|
583 | + $cur = 0; |
|
584 | + } |
|
535 | 585 | // Create the xmlParser object |
536 | 586 | $oXmlParser = new XmlParser(); |
537 | 587 | // Open an index file |
538 | 588 | $f = fopen($index_file,"r"); |
539 | 589 | // Pass if already read |
540 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
590 | + for($i=0;$i<$cur;$i++) { |
|
591 | + fgets($f, 1024); |
|
592 | + } |
|
541 | 593 | // Read each line until the condition meets |
542 | 594 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
543 | 595 | { |
544 | - if(feof($f)) break; |
|
596 | + if(feof($f)) { |
|
597 | + break; |
|
598 | + } |
|
545 | 599 | // Find a location |
546 | 600 | $target_file = trim(fgets($f, 1024)); |
547 | 601 | // Load and parse the file |
548 | 602 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
549 | 603 | FileHandler::removeFile($target_file); |
550 | - if(!$xmlObj) continue; |
|
604 | + if(!$xmlObj) { |
|
605 | + continue; |
|
606 | + } |
|
551 | 607 | // List objects |
552 | 608 | $obj = null; |
553 | 609 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
@@ -558,7 +614,9 @@ discard block |
||
558 | 614 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
559 | 615 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
560 | 616 | // Get member_srl of sender/recipient (If not exists, pass) |
561 | - if(!$obj->sender) continue; |
|
617 | + if(!$obj->sender) { |
|
618 | + continue; |
|
619 | + } |
|
562 | 620 | $sender_args->user_id = $obj->sender; |
563 | 621 | $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
564 | 622 | $sender_srl = $sender_output->data->member_srl; |
@@ -569,10 +627,14 @@ discard block |
||
569 | 627 | $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
570 | 628 | $sender_srl = $sender_output->data->member_srl; |
571 | 629 | } |
572 | - if(!$sender_srl) continue; |
|
630 | + if(!$sender_srl) { |
|
631 | + continue; |
|
632 | + } |
|
573 | 633 | |
574 | 634 | $receiver_args->user_id = $obj->receiver; |
575 | - if(!$obj->receiver) continue; |
|
635 | + if(!$obj->receiver) { |
|
636 | + continue; |
|
637 | + } |
|
576 | 638 | $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
577 | 639 | $receiver_srl = $receiver_output->data->member_srl; |
578 | 640 | if(!$receiver_srl) |
@@ -582,7 +644,9 @@ discard block |
||
582 | 644 | $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
583 | 645 | $receiver_srl = $receiver_output->data->member_srl; |
584 | 646 | } |
585 | - if(!$receiver_srl) continue; |
|
647 | + if(!$receiver_srl) { |
|
648 | + continue; |
|
649 | + } |
|
586 | 650 | // Message to save into sender's message box |
587 | 651 | $sender_args->sender_srl = $sender_srl; |
588 | 652 | $sender_args->receiver_srl = $receiver_srl; |
@@ -603,7 +667,9 @@ discard block |
||
603 | 667 | $receiver_args->message_srl = $sender_args->related_srl; |
604 | 668 | $receiver_args->list_order = $sender_args->related_srl*-1; |
605 | 669 | $receiver_args->sender_srl = $sender_srl; |
606 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
670 | + if(!$receiver_args->sender_srl) { |
|
671 | + $receiver_args->sender_srl = $receiver_srl; |
|
672 | + } |
|
607 | 673 | $receiver_args->receiver_srl = $receiver_srl; |
608 | 674 | $receiver_args->message_type = 'R'; |
609 | 675 | $receiver_args->title = $obj->title; |
@@ -637,7 +703,9 @@ discard block |
||
637 | 703 | $oDocumentModel = getModel('document'); |
638 | 704 | $category_list = $category_titles = array(); |
639 | 705 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
640 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
706 | + if(count($category_list)) { |
|
707 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
708 | + } |
|
641 | 709 | // Extract category information |
642 | 710 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
643 | 711 | if(file_exists($category_file)) |
@@ -650,12 +718,16 @@ discard block |
||
650 | 718 | $categories = $xmlDoc->items->category; |
651 | 719 | if($categories) |
652 | 720 | { |
653 | - if(!is_array($categories)) $categories = array($categories); |
|
721 | + if(!is_array($categories)) { |
|
722 | + $categories = array($categories); |
|
723 | + } |
|
654 | 724 | $match_sequence = array(); |
655 | 725 | foreach($categories as $k => $v) |
656 | 726 | { |
657 | 727 | $category = trim(base64_decode($v->body)); |
658 | - if(!$category || $category_titles[$category]) continue; |
|
728 | + if(!$category || $category_titles[$category]) { |
|
729 | + continue; |
|
730 | + } |
|
659 | 731 | |
660 | 732 | $sequence = $v->attrs->sequence; |
661 | 733 | $parent = $v->attrs->parent; |
@@ -663,10 +735,14 @@ discard block |
||
663 | 735 | $obj = null; |
664 | 736 | $obj->title = $category; |
665 | 737 | $obj->module_srl = $module_srl; |
666 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
738 | + if($parent) { |
|
739 | + $obj->parent_srl = $match_sequence[$parent]; |
|
740 | + } |
|
667 | 741 | |
668 | 742 | $output = $oDocumentController->insertCategory($obj); |
669 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
743 | + if($output->toBool()) { |
|
744 | + $match_sequence[$sequence] = $output->get('category_srl'); |
|
745 | + } |
|
670 | 746 | } |
671 | 747 | $oDocumentController = getController('document'); |
672 | 748 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -676,31 +752,45 @@ discard block |
||
676 | 752 | |
677 | 753 | $category_list = $category_titles = array(); |
678 | 754 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
679 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
755 | + if(count($category_list)) { |
|
756 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
757 | + } |
|
680 | 758 | |
681 | 759 | $ek_args->module_srl = $module_srl; |
682 | 760 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
683 | 761 | if($output->data) |
684 | 762 | { |
685 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
763 | + foreach($output->data as $key => $val) { |
|
764 | + $extra_keys[$val->eid] = true; |
|
765 | + } |
|
686 | 766 | } |
687 | 767 | |
688 | - if(!$cur) $cur = 0; |
|
768 | + if(!$cur) { |
|
769 | + $cur = 0; |
|
770 | + } |
|
689 | 771 | // Open an index file |
690 | 772 | $f = fopen($index_file,"r"); |
691 | 773 | // Pass if already read |
692 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
774 | + for($i=0;$i<$cur;$i++) { |
|
775 | + fgets($f, 1024); |
|
776 | + } |
|
693 | 777 | // Read each line until the condition meets |
694 | 778 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
695 | 779 | { |
696 | - if(feof($f)) break; |
|
780 | + if(feof($f)) { |
|
781 | + break; |
|
782 | + } |
|
697 | 783 | // Find a location |
698 | 784 | $target_file = trim(fgets($f, 1024)); |
699 | 785 | |
700 | - if(!file_exists($target_file)) continue; |
|
786 | + if(!file_exists($target_file)) { |
|
787 | + continue; |
|
788 | + } |
|
701 | 789 | // Importing data from now on |
702 | 790 | $fp = fopen($target_file,"r"); |
703 | - if(!$fp) continue; |
|
791 | + if(!$fp) { |
|
792 | + continue; |
|
793 | + } |
|
704 | 794 | |
705 | 795 | $obj = new stdClass; |
706 | 796 | $obj->module_srl = $module_srl; |
@@ -720,38 +810,38 @@ discard block |
||
720 | 810 | { |
721 | 811 | $started = true; |
722 | 812 | // Trackback inserted |
723 | - } |
|
724 | - else if(substr($str,0,11) == '<trackbacks') |
|
813 | + } else if(substr($str,0,11) == '<trackbacks') |
|
725 | 814 | { |
726 | 815 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
727 | 816 | continue; |
728 | 817 | // Comments inserted |
729 | - } |
|
730 | - else if(substr($str,0,9) == '<comments') |
|
818 | + } else if(substr($str,0,9) == '<comments') |
|
731 | 819 | { |
732 | 820 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
733 | 821 | continue; |
734 | 822 | // Attachment inserted |
735 | - } |
|
736 | - else if(substr($str,0,9) == '<attaches') |
|
823 | + } else if(substr($str,0,9) == '<attaches') |
|
737 | 824 | { |
738 | 825 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
739 | 826 | continue; |
740 | 827 | // When starting extra variabls |
741 | - } |
|
742 | - elseif(trim($str) == '<extra_vars>') |
|
828 | + } elseif(trim($str) == '<extra_vars>') |
|
743 | 829 | { |
744 | 830 | $extra_vars = $this->importExtraVars($fp); |
745 | 831 | continue; |
746 | 832 | } |
747 | 833 | |
748 | - if($started) $buff[] = $str; |
|
834 | + if($started) { |
|
835 | + $buff[] = $str; |
|
836 | + } |
|
749 | 837 | } |
750 | 838 | |
751 | 839 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
752 | 840 | |
753 | 841 | $category = base64_decode($xmlDoc->post->category->body); |
754 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
842 | + if($category_titles[$category]) { |
|
843 | + $obj->category_srl = $category_titles[$category]; |
|
844 | + } |
|
755 | 845 | |
756 | 846 | $obj->member_srl = 0; |
757 | 847 | |
@@ -765,16 +855,22 @@ discard block |
||
765 | 855 | $obj->password = base64_decode($xmlDoc->post->password->body); |
766 | 856 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
767 | 857 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
768 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
858 | + if(!$obj->user_name) { |
|
859 | + $obj->user_name = $obj->nick_name; |
|
860 | + } |
|
769 | 861 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
770 | 862 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
771 | 863 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
772 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
864 | + if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) { |
|
865 | + $obj->homepage = 'http://'.$obj->homepage; |
|
866 | + } |
|
773 | 867 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
774 | 868 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
775 | 869 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
776 | 870 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
777 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
871 | + if(!$obj->last_update) { |
|
872 | + $obj->last_update = $obj->regdate; |
|
873 | + } |
|
778 | 874 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
779 | 875 | $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
780 | 876 | $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
@@ -819,7 +915,9 @@ discard block |
||
819 | 915 | $args->document_srl = $obj->document_srl; |
820 | 916 | $args->tag = trim($tag_list[$i]); |
821 | 917 | $args->regdate = $obj->regdate; |
822 | - if(!$args->tag) continue; |
|
918 | + if(!$args->tag) { |
|
919 | + continue; |
|
920 | + } |
|
823 | 921 | $output = executeQuery('tag.insertTag', $args); |
824 | 922 | } |
825 | 923 | |
@@ -829,7 +927,9 @@ discard block |
||
829 | 927 | { |
830 | 928 | foreach($extra_vars as $key => $val) |
831 | 929 | { |
832 | - if(!$val->value) continue; |
|
930 | + if(!$val->value) { |
|
931 | + continue; |
|
932 | + } |
|
833 | 933 | unset($e_args); |
834 | 934 | $e_args->module_srl = $module_srl; |
835 | 935 | $e_args->document_srl = $obj->document_srl; |
@@ -862,7 +962,9 @@ discard block |
||
862 | 962 | |
863 | 963 | fclose($f); |
864 | 964 | // Sync category counts |
865 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
965 | + if(count($category_list)) { |
|
966 | + foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
967 | + } |
|
866 | 968 | |
867 | 969 | return $idx-1; |
868 | 970 | } |
@@ -884,11 +986,17 @@ discard block |
||
884 | 986 | { |
885 | 987 | $str = fgets($fp, 1024); |
886 | 988 | // If </trackbacks> is, break |
887 | - if(trim($str) == '</trackbacks>') break; |
|
989 | + if(trim($str) == '</trackbacks>') { |
|
990 | + break; |
|
991 | + } |
|
888 | 992 | // If <trackback>, start importing |
889 | - if(trim($str) == '<trackback>') $started = true; |
|
993 | + if(trim($str) == '<trackback>') { |
|
994 | + $started = true; |
|
995 | + } |
|
890 | 996 | |
891 | - if($started) $buff .= $str; |
|
997 | + if($started) { |
|
998 | + $buff .= $str; |
|
999 | + } |
|
892 | 1000 | // If </trackback>, insert to the DB |
893 | 1001 | if(trim($str) == '</trackback>') |
894 | 1002 | { |
@@ -906,7 +1014,9 @@ discard block |
||
906 | 1014 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
907 | 1015 | $obj->list_order = -1*$obj->trackback_srl; |
908 | 1016 | $output = executeQuery('trackback.insertTrackback', $obj); |
909 | - if($output->toBool()) $cnt++; |
|
1017 | + if($output->toBool()) { |
|
1018 | + $cnt++; |
|
1019 | + } |
|
910 | 1020 | |
911 | 1021 | $buff = null; |
912 | 1022 | $started = false; |
@@ -934,7 +1044,9 @@ discard block |
||
934 | 1044 | { |
935 | 1045 | $str = fgets($fp, 1024); |
936 | 1046 | // If </comments> is, break |
937 | - if(trim($str) == '</comments>') break; |
|
1047 | + if(trim($str) == '</comments>') { |
|
1048 | + break; |
|
1049 | + } |
|
938 | 1050 | // If <comment> is, start importing |
939 | 1051 | if(trim($str) == '<comment>') |
940 | 1052 | { |
@@ -950,7 +1062,9 @@ discard block |
||
950 | 1062 | continue; |
951 | 1063 | } |
952 | 1064 | |
953 | - if($started) $buff .= $str; |
|
1065 | + if($started) { |
|
1066 | + $buff .= $str; |
|
1067 | + } |
|
954 | 1068 | // If </comment> is, insert to the DB |
955 | 1069 | if(trim($str) == '</comment>') |
956 | 1070 | { |
@@ -962,8 +1076,11 @@ discard block |
||
962 | 1076 | |
963 | 1077 | $obj->module_srl = $module_srl; |
964 | 1078 | |
965 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
966 | - else $obj->parent_srl = 0; |
|
1079 | + if($parent) { |
|
1080 | + $obj->parent_srl = $sequences[$parent]; |
|
1081 | + } else { |
|
1082 | + $obj->parent_srl = 0; |
|
1083 | + } |
|
967 | 1084 | |
968 | 1085 | $obj->document_srl = $document_srl; |
969 | 1086 | $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
@@ -974,14 +1091,18 @@ discard block |
||
974 | 1091 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
975 | 1092 | $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
976 | 1093 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
977 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
1094 | + if(!$obj->user_name) { |
|
1095 | + $obj->user_name = $obj->nick_name; |
|
1096 | + } |
|
978 | 1097 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
979 | 1098 | $obj->member_srl = 0; |
980 | 1099 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
981 | 1100 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
982 | 1101 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
983 | 1102 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
984 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
1103 | + if(!$obj->last_update) { |
|
1104 | + $obj->last_update = $obj->regdate; |
|
1105 | + } |
|
985 | 1106 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
986 | 1107 | $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
987 | 1108 | $obj->list_order = $obj->comment_srl*-1; |
@@ -1019,24 +1140,28 @@ discard block |
||
1019 | 1140 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
1020 | 1141 | $list_args->depth = 0; |
1021 | 1142 | // Get parent_srl if parent comment exists |
1022 | - } |
|
1023 | - else |
|
1143 | + } else |
|
1024 | 1144 | { |
1025 | 1145 | // Get parent comment infomation |
1026 | 1146 | $parent_args->comment_srl = $obj->parent_srl; |
1027 | 1147 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
1028 | 1148 | // Return if parent comment doesn't exist |
1029 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
1149 | + if(!$parent_output->toBool() || !$parent_output->data) { |
|
1150 | + continue; |
|
1151 | + } |
|
1030 | 1152 | $parent = $parent_output->data; |
1031 | 1153 | |
1032 | 1154 | $list_args->head = $parent->head; |
1033 | 1155 | $list_args->depth = $parent->depth+1; |
1034 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
1035 | - else |
|
1156 | + if($list_args->depth<2) { |
|
1157 | + $list_args->arrange = $obj->comment_srl; |
|
1158 | + } else |
|
1036 | 1159 | { |
1037 | 1160 | $list_args->arrange = $parent->arrange; |
1038 | 1161 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
1039 | - if(!$output->toBool()) return $output; |
|
1162 | + if(!$output->toBool()) { |
|
1163 | + return $output; |
|
1164 | + } |
|
1040 | 1165 | } |
1041 | 1166 | } |
1042 | 1167 | |
@@ -1044,7 +1169,9 @@ discard block |
||
1044 | 1169 | if($output->toBool()) |
1045 | 1170 | { |
1046 | 1171 | $output = executeQuery('comment.insertComment', $obj); |
1047 | - if($output->toBool()) $cnt++; |
|
1172 | + if($output->toBool()) { |
|
1173 | + $cnt++; |
|
1174 | + } |
|
1048 | 1175 | } |
1049 | 1176 | |
1050 | 1177 | $buff = null; |
@@ -1074,7 +1201,9 @@ discard block |
||
1074 | 1201 | { |
1075 | 1202 | $str = trim(fgets($fp, 1024)); |
1076 | 1203 | // If it ends with </attaches>, break |
1077 | - if(trim($str) == '</attaches>') break; |
|
1204 | + if(trim($str) == '</attaches>') { |
|
1205 | + break; |
|
1206 | + } |
|
1078 | 1207 | // If it starts with <attach>, collect attachments |
1079 | 1208 | if(trim($str) == '<attach>') |
1080 | 1209 | { |
@@ -1085,14 +1214,15 @@ discard block |
||
1085 | 1214 | $started = true; |
1086 | 1215 | $buff = null; |
1087 | 1216 | // If it starts with <file>, handle the attachement in xml file |
1088 | - } |
|
1089 | - else if(trim($str) == '<file>') |
|
1217 | + } else if(trim($str) == '<file>') |
|
1090 | 1218 | { |
1091 | 1219 | $file_obj->file = $this->saveTemporaryFile($fp); |
1092 | 1220 | continue; |
1093 | 1221 | } |
1094 | 1222 | |
1095 | - if($started) $buff .= $str; |
|
1223 | + if($started) { |
|
1224 | + $buff .= $str; |
|
1225 | + } |
|
1096 | 1226 | // If it ends with </attach>, handle attachements |
1097 | 1227 | if(trim($str) == '</attach>') |
1098 | 1228 | { |
@@ -1105,8 +1235,9 @@ discard block |
||
1105 | 1235 | { |
1106 | 1236 | $url = base64_decode($xmlDoc->attach->url->body); |
1107 | 1237 | $path = base64_decode($xmlDoc->attach->path->body); |
1108 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
1109 | - else |
|
1238 | + if($path && file_exists($path)) { |
|
1239 | + $file_obj->file = $path; |
|
1240 | + } else |
|
1110 | 1241 | { |
1111 | 1242 | $file_obj->file = $this->getTmpFilename(); |
1112 | 1243 | FileHandler::getRemoteFile($url, $file_obj->file); |
@@ -1137,21 +1268,21 @@ discard block |
||
1137 | 1268 | } |
1138 | 1269 | |
1139 | 1270 | $file_obj->direct_download = 'Y'; |
1140 | - } |
|
1141 | - else |
|
1271 | + } else |
|
1142 | 1272 | { |
1143 | 1273 | $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
1144 | 1274 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
1145 | 1275 | $file_obj->direct_download = 'N'; |
1146 | 1276 | } |
1147 | 1277 | // Create a directory |
1148 | - if(!FileHandler::makeDir($path)) continue; |
|
1278 | + if(!FileHandler::makeDir($path)) { |
|
1279 | + continue; |
|
1280 | + } |
|
1149 | 1281 | |
1150 | 1282 | if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
1151 | 1283 | { |
1152 | 1284 | FileHandler::rename($file_obj->file, $filename); |
1153 | - } |
|
1154 | - else |
|
1285 | + } else |
|
1155 | 1286 | { |
1156 | 1287 | copy($file_obj->file, $filename); |
1157 | 1288 | } |
@@ -1173,8 +1304,11 @@ discard block |
||
1173 | 1304 | $uploaded_count++; |
1174 | 1305 | $tmp_obj = null; |
1175 | 1306 | $tmp_obj->source_filename = $file_obj->source_filename; |
1176 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1177 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1307 | + if($file_obj->direct_download == 'Y') { |
|
1308 | + $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1309 | + } else { |
|
1310 | + $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1311 | + } |
|
1178 | 1312 | } |
1179 | 1313 | } |
1180 | 1314 | } |
@@ -1192,7 +1326,9 @@ discard block |
||
1192 | 1326 | $path = "./files/cache/importer"; |
1193 | 1327 | FileHandler::makeDir($path); |
1194 | 1328 | $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
1195 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
1329 | + if(file_exists($filename)) { |
|
1330 | + $filename .= rand(111,999); |
|
1331 | + } |
|
1196 | 1332 | return $filename; |
1197 | 1333 | } |
1198 | 1334 | |
@@ -1210,7 +1346,9 @@ discard block |
||
1210 | 1346 | while(!feof($fp)) |
1211 | 1347 | { |
1212 | 1348 | $str = trim(fgets($fp, 1024)); |
1213 | - if(trim($str) == '</file>') break; |
|
1349 | + if(trim($str) == '</file>') { |
|
1350 | + break; |
|
1351 | + } |
|
1214 | 1352 | |
1215 | 1353 | $buff .= $str; |
1216 | 1354 | |
@@ -1236,14 +1374,20 @@ discard block |
||
1236 | 1374 | while(!feof($fp)) |
1237 | 1375 | { |
1238 | 1376 | $buff .= $str = trim(fgets($fp, 1024)); |
1239 | - if(trim($str) == '</extra_vars>') break; |
|
1377 | + if(trim($str) == '</extra_vars>') { |
|
1378 | + break; |
|
1379 | + } |
|
1380 | + } |
|
1381 | + if(!$buff) { |
|
1382 | + return array(); |
|
1240 | 1383 | } |
1241 | - if(!$buff) return array(); |
|
1242 | 1384 | |
1243 | 1385 | $buff = '<extra_vars>'.$buff; |
1244 | 1386 | $oXmlParser = new XmlParser(); |
1245 | 1387 | $xmlDoc = $this->oXmlParser->parse($buff); |
1246 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
1388 | + if(!count($xmlDoc->extra_vars->key)) { |
|
1389 | + return array(); |
|
1390 | + } |
|
1247 | 1391 | |
1248 | 1392 | $index = 1; |
1249 | 1393 | foreach($xmlDoc->extra_vars->key as $k => $v) |
@@ -1256,8 +1400,7 @@ discard block |
||
1256 | 1400 | $vobj->value = base64_decode($v->value->body); |
1257 | 1401 | $vobj->eid = base64_decode($v->eid->body); |
1258 | 1402 | |
1259 | - } |
|
1260 | - else if($v->body) |
|
1403 | + } else if($v->body) |
|
1261 | 1404 | { |
1262 | 1405 | $vobj->var_idx = $index; |
1263 | 1406 | $vobj->lang_code = Context::getLangType(); |