@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->setTemplatePath($this->module_path.'tpl'); |
29 | 29 | |
30 | 30 | $source_type = Context::get('source_type'); |
31 | - switch($source_type) |
|
31 | + switch ($source_type) |
|
32 | 32 | { |
33 | 33 | case 'member' : |
34 | 34 | $template_filename = "member"; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function dispImporterAdminImportForm() |
69 | 69 | { |
70 | - $oDocumentModel = getModel('document'); //for document lang use in this page |
|
70 | + $oDocumentModel = getModel('document'); //for document lang use in this page |
|
71 | 71 | |
72 | 72 | $this->setTemplatePath($this->module_path.'tpl'); |
73 | 73 | $this->setTemplateFile('index'); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | // Get configurations (using module model object) |
60 | 60 | $oModuleModel = getModel('module'); |
61 | 61 | $config = $oModuleModel->getModuleConfig('spamfilter'); |
62 | - Context::set('config',$config); |
|
62 | + Context::set('config', $config); |
|
63 | 63 | |
64 | 64 | $this->setTemplateFile('config_block'); |
65 | 65 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | // Get configurations (using module model object) |
32 | 32 | $config = $oModuleModel->getModuleConfig('message'); |
33 | - Context::set('config',$config); |
|
33 | + Context::set('config', $config); |
|
34 | 34 | |
35 | 35 | // Set a template file |
36 | 36 | $this->setTemplatePath($this->module_path.'tpl'); |
@@ -333,8 +333,7 @@ discard block |
||
333 | 333 | '<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->', $this->comment_srl, $memberSrl, $this->comment_srl, $memberSrl, $content, $this->comment_srl, $memberSrl |
334 | 334 | ); |
335 | 335 | // xe_content class name should be specified although content access is not necessary. |
336 | - } |
|
337 | - else |
|
336 | + } else |
|
338 | 337 | { |
339 | 338 | if($add_xe_content_class) |
340 | 339 | { |
@@ -569,7 +568,9 @@ discard block |
||
569 | 568 | } |
570 | 569 | } |
571 | 570 | |
572 | - if(!preg_match("!<img!is", $content)) return; |
|
571 | + if(!preg_match("!<img!is", $content)) { |
|
572 | + return; |
|
573 | + } |
|
573 | 574 | } |
574 | 575 | |
575 | 576 | // get thumbail generation info on the doc module configuration. |
@@ -589,8 +590,7 @@ discard block |
||
589 | 590 | if(filesize($thumbnail_file) < 1) |
590 | 591 | { |
591 | 592 | return FALSE; |
592 | - } |
|
593 | - else |
|
593 | + } else |
|
594 | 594 | { |
595 | 595 | return $thumbnail_url; |
596 | 596 | } |
@@ -608,7 +608,9 @@ discard block |
||
608 | 608 | $first_image = null; |
609 | 609 | foreach($file_list as $file) |
610 | 610 | { |
611 | - if($file->direct_download !== 'Y') continue; |
|
611 | + if($file->direct_download !== 'Y') { |
|
612 | + continue; |
|
613 | + } |
|
612 | 614 | |
613 | 615 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
614 | 616 | { |
@@ -616,7 +618,9 @@ discard block |
||
616 | 618 | break; |
617 | 619 | } |
618 | 620 | |
619 | - if($first_image) continue; |
|
621 | + if($first_image) { |
|
622 | + continue; |
|
623 | + } |
|
620 | 624 | |
621 | 625 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
622 | 626 | { |
@@ -644,7 +648,9 @@ discard block |
||
644 | 648 | foreach($matches as $target_image) |
645 | 649 | { |
646 | 650 | $target_src = trim($target_image[1]); |
647 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
651 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
652 | + continue; |
|
653 | + } |
|
648 | 654 | |
649 | 655 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
650 | 656 | { |
@@ -655,7 +661,9 @@ discard block |
||
655 | 661 | |
656 | 662 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
657 | 663 | FileHandler::getRemoteFile($target_src, $tmp_file); |
658 | - if(!file_exists($tmp_file)) continue; |
|
664 | + if(!file_exists($tmp_file)) { |
|
665 | + continue; |
|
666 | + } |
|
659 | 667 | |
660 | 668 | $imageinfo = getimagesize($tmp_file); |
661 | 669 | list($_w, $_h) = $imageinfo; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function _loadFromDB() |
51 | 51 | { |
52 | - if(!$this->comment_srl) |
|
52 | + if (!$this->comment_srl) |
|
53 | 53 | { |
54 | 54 | return; |
55 | 55 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function setAttribute($attribute) |
69 | 69 | { |
70 | - if(!$attribute->comment_srl) |
|
70 | + if (!$attribute->comment_srl) |
|
71 | 71 | { |
72 | 72 | $this->comment_srl = NULL; |
73 | 73 | return; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | $this->adds($attribute); |
78 | 78 | |
79 | 79 | // define vars on the object for backward compatibility of skins |
80 | - if(count($attribute)) |
|
80 | + if (count($attribute)) |
|
81 | 81 | { |
82 | - foreach($attribute as $key => $val) |
|
82 | + foreach ($attribute as $key => $val) |
|
83 | 83 | { |
84 | 84 | $this->{$key} = $val; |
85 | 85 | } |
@@ -93,29 +93,29 @@ discard block |
||
93 | 93 | |
94 | 94 | function isGranted() |
95 | 95 | { |
96 | - if($_SESSION['own_comment'][$this->comment_srl]) |
|
96 | + if ($_SESSION['own_comment'][$this->comment_srl]) |
|
97 | 97 | { |
98 | 98 | return TRUE; |
99 | 99 | } |
100 | 100 | |
101 | - if(!Context::get('is_logged')) |
|
101 | + if (!Context::get('is_logged')) |
|
102 | 102 | { |
103 | 103 | return FALSE; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $logged_info = Context::get('logged_info'); |
107 | - if($logged_info->is_admin == 'Y') |
|
107 | + if ($logged_info->is_admin == 'Y') |
|
108 | 108 | { |
109 | 109 | return TRUE; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $grant = Context::get('grant'); |
113 | - if($grant->manager) |
|
113 | + if ($grant->manager) |
|
114 | 114 | { |
115 | 115 | return TRUE; |
116 | 116 | } |
117 | 117 | |
118 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
118 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
119 | 119 | { |
120 | 120 | return TRUE; |
121 | 121 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | function isEditable() |
138 | 138 | { |
139 | - if($this->isGranted() || !$this->get('member_srl')) |
|
139 | + if ($this->isGranted() || !$this->get('member_srl')) |
|
140 | 140 | { |
141 | 141 | return TRUE; |
142 | 142 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | |
151 | 151 | function isAccessible() |
152 | 152 | { |
153 | - if($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
153 | + if ($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
154 | 154 | { |
155 | 155 | return TRUE; |
156 | 156 | } |
157 | 157 | |
158 | - if($this->isGranted() || !$this->isSecret()) |
|
158 | + if ($this->isGranted() || !$this->isSecret()) |
|
159 | 159 | { |
160 | 160 | $this->setAccessible(); |
161 | 161 | return TRUE; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $oDocumentModel = getModel('document'); |
165 | 165 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
166 | - if($oDocument->isGranted()) |
|
166 | + if ($oDocument->isGranted()) |
|
167 | 167 | { |
168 | 168 | $this->setAccessible(); |
169 | 169 | return TRUE; |
@@ -184,20 +184,20 @@ discard block |
||
184 | 184 | function notify($type, $content) |
185 | 185 | { |
186 | 186 | // return if not useNotify |
187 | - if(!$this->useNotify()) |
|
187 | + if (!$this->useNotify()) |
|
188 | 188 | { |
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | 192 | // pass if the author is not logged-in user |
193 | - if(!$this->get('member_srl')) |
|
193 | + if (!$this->get('member_srl')) |
|
194 | 194 | { |
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | 198 | // return if the currently logged-in user is an author of the comment. |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if($logged_info->member_srl == $this->get('member_srl')) |
|
200 | + if ($logged_info->member_srl == $this->get('member_srl')) |
|
201 | 201 | { |
202 | 202 | return; |
203 | 203 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
208 | 208 | |
209 | 209 | // Variables |
210 | - if($type) |
|
210 | + if ($type) |
|
211 | 211 | { |
212 | - $title = "[" . $type . "] "; |
|
212 | + $title = "[".$type."] "; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $title .= cut_str(strip_tags($content), 30, '...'); |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | |
225 | 225 | function getIpAddress() |
226 | 226 | { |
227 | - if($this->isGranted()) |
|
227 | + if ($this->isGranted()) |
|
228 | 228 | { |
229 | 229 | return $this->get('ipaddress'); |
230 | 230 | } |
231 | 231 | |
232 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
232 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | function isExistsHomepage() |
236 | 236 | { |
237 | - if(trim($this->get('homepage'))) |
|
237 | + if (trim($this->get('homepage'))) |
|
238 | 238 | { |
239 | 239 | return TRUE; |
240 | 240 | } |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | function getHomepageUrl() |
246 | 246 | { |
247 | 247 | $url = trim($this->get('homepage')); |
248 | - if(!$url) |
|
248 | + if (!$url) |
|
249 | 249 | { |
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | - if(strncasecmp('http://', $url, 7) !== 0) |
|
253 | + if (strncasecmp('http://', $url, 7) !== 0) |
|
254 | 254 | { |
255 | - $url = "http://" . $url; |
|
255 | + $url = "http://".$url; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function getContentText($strlen = 0) |
286 | 286 | { |
287 | - if($this->isSecret() && !$this->isAccessible()) |
|
287 | + if ($this->isSecret() && !$this->isAccessible()) |
|
288 | 288 | { |
289 | 289 | return Context::getLang('msg_is_secret'); |
290 | 290 | } |
291 | 291 | |
292 | 292 | $content = $this->get('content'); |
293 | 293 | |
294 | - if($strlen) |
|
294 | + if ($strlen) |
|
295 | 295 | { |
296 | 296 | return cut_str(strip_tags($content), $strlen, '...'); |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE) |
307 | 307 | { |
308 | - if($this->isSecret() && !$this->isAccessible()) |
|
308 | + if ($this->isSecret() && !$this->isAccessible()) |
|
309 | 309 | { |
310 | 310 | return Context::getLang('msg_is_secret'); |
311 | 311 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | stripEmbedTagForAdmin($content, $this->get('member_srl')); |
315 | 315 | |
316 | 316 | // when displaying the comment on the pop-up menu |
317 | - if($add_popup_menu && Context::get('is_logged')) |
|
317 | + if ($add_popup_menu && Context::get('is_logged')) |
|
318 | 318 | { |
319 | 319 | $content = sprintf( |
320 | 320 | '%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do') |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | // if additional information which can access contents is set |
325 | - if($add_content_info) |
|
325 | + if ($add_content_info) |
|
326 | 326 | { |
327 | 327 | $memberSrl = $this->get('member_srl'); |
328 | - if($memberSrl < 0) |
|
328 | + if ($memberSrl < 0) |
|
329 | 329 | { |
330 | 330 | $memberSrl = 0; |
331 | 331 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | else |
338 | 338 | { |
339 | - if($add_xe_content_class) |
|
339 | + if ($add_xe_content_class) |
|
340 | 340 | { |
341 | 341 | $content = sprintf('<div class="xe_content">%s</div>', $content); |
342 | 342 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | function getRegdateGM() |
398 | 398 | { |
399 | - return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone']; |
|
399 | + return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone']; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | function getPermanentUrl() |
408 | 408 | { |
409 | - return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl'); |
|
409 | + return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl'); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | function getUpdateTime() |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | function hasUploadedFiles() |
429 | 429 | { |
430 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
430 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
431 | 431 | { |
432 | 432 | return FALSE; |
433 | 433 | } |
@@ -436,12 +436,12 @@ discard block |
||
436 | 436 | |
437 | 437 | function getUploadedFiles() |
438 | 438 | { |
439 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
439 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
440 | 440 | { |
441 | 441 | return; |
442 | 442 | } |
443 | 443 | |
444 | - if(!$this->get('uploaded_count')) |
|
444 | + if (!$this->get('uploaded_count')) |
|
445 | 445 | { |
446 | 446 | return; |
447 | 447 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | function getEditor() |
459 | 459 | { |
460 | 460 | $module_srl = $this->get('module_srl'); |
461 | - if(!$module_srl) |
|
461 | + if (!$module_srl) |
|
462 | 462 | { |
463 | 463 | $module_srl = Context::get('module_srl'); |
464 | 464 | } |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | */ |
473 | 473 | function getProfileImage() |
474 | 474 | { |
475 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
475 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
476 | 476 | { |
477 | 477 | return; |
478 | 478 | } |
479 | 479 | $oMemberModel = getModel('member'); |
480 | 480 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
481 | - if(!$profile_info) |
|
481 | + if (!$profile_info) |
|
482 | 482 | { |
483 | 483 | return; |
484 | 484 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | function getSignature() |
494 | 494 | { |
495 | 495 | // pass if the posting not exists. |
496 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
496 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
497 | 497 | { |
498 | 498 | return; |
499 | 499 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
504 | 504 | |
505 | 505 | // check if max height of the signiture is specified on the member module |
506 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
506 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
507 | 507 | { |
508 | 508 | $oModuleModel = getModel('module'); |
509 | 509 | $member_config = $oModuleModel->getModuleConfig('member'); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
514 | 514 | |
515 | - if($max_signature_height) |
|
515 | + if ($max_signature_height) |
|
516 | 516 | { |
517 | 517 | $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
518 | 518 | } |
@@ -522,12 +522,12 @@ discard block |
||
522 | 522 | |
523 | 523 | function thumbnailExists($width = 80, $height = 0, $type = '') |
524 | 524 | { |
525 | - if(!$this->comment_srl) |
|
525 | + if (!$this->comment_srl) |
|
526 | 526 | { |
527 | 527 | return FALSE; |
528 | 528 | } |
529 | 529 | |
530 | - if(!$this->getThumbnail($width, $height, $type)) |
|
530 | + if (!$this->getThumbnail($width, $height, $type)) |
|
531 | 531 | { |
532 | 532 | return FALSE; |
533 | 533 | } |
@@ -538,42 +538,42 @@ discard block |
||
538 | 538 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
539 | 539 | { |
540 | 540 | // return false if no doc exists |
541 | - if(!$this->comment_srl) |
|
541 | + if (!$this->comment_srl) |
|
542 | 542 | { |
543 | 543 | return; |
544 | 544 | } |
545 | 545 | |
546 | - if($this->isSecret() && !$this->isGranted()) |
|
546 | + if ($this->isSecret() && !$this->isGranted()) |
|
547 | 547 | { |
548 | 548 | return; |
549 | 549 | } |
550 | 550 | |
551 | 551 | // If signiture height setting is omitted, create a square |
552 | - if(!$height) |
|
552 | + if (!$height) |
|
553 | 553 | { |
554 | 554 | $height = $width; |
555 | 555 | } |
556 | 556 | |
557 | 557 | $content = $this->get('content'); |
558 | - if(!$this->hasUploadedFiles()) |
|
558 | + if (!$this->hasUploadedFiles()) |
|
559 | 559 | { |
560 | - if(!$content) |
|
560 | + if (!$content) |
|
561 | 561 | { |
562 | 562 | $args = new stdClass(); |
563 | 563 | $args->comment_srl = $this->comment_srl; |
564 | 564 | $output = executeQuery('document.getComment', $args, array('content')); |
565 | - if($output->toBool() && $output->data) |
|
565 | + if ($output->toBool() && $output->data) |
|
566 | 566 | { |
567 | 567 | $content = $output->data->content; |
568 | 568 | $this->add('content', $content); |
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | - if(!preg_match("!<img!is", $content)) return; |
|
572 | + if (!preg_match("!<img!is", $content)) return; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | // get thumbail generation info on the doc module configuration. |
576 | - if(!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
576 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
577 | 577 | { |
578 | 578 | $thumbnail_type = 'crop'; |
579 | 579 | } |
@@ -582,12 +582,12 @@ discard block |
||
582 | 582 | $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3)); |
583 | 583 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
584 | 584 | $thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type); |
585 | - $thumbnail_url = Context::getRequestUri() . $thumbnail_file; |
|
585 | + $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
|
586 | 586 | |
587 | 587 | // return false if a size of existing thumbnail file is 0. otherwise return the file path |
588 | - if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
588 | + if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
589 | 589 | { |
590 | - if(filesize($thumbnail_file) < 1) |
|
590 | + if (filesize($thumbnail_file) < 1) |
|
591 | 591 | { |
592 | 592 | return FALSE; |
593 | 593 | } |
@@ -605,33 +605,33 @@ discard block |
||
605 | 605 | $is_tmp_file = FALSE; |
606 | 606 | |
607 | 607 | // find an image file among attached files |
608 | - if($this->hasUploadedFiles()) |
|
608 | + if ($this->hasUploadedFiles()) |
|
609 | 609 | { |
610 | 610 | $file_list = $this->getUploadedFiles(); |
611 | 611 | |
612 | 612 | $first_image = null; |
613 | - foreach($file_list as $file) |
|
613 | + foreach ($file_list as $file) |
|
614 | 614 | { |
615 | - if($file->direct_download !== 'Y') continue; |
|
615 | + if ($file->direct_download !== 'Y') continue; |
|
616 | 616 | |
617 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
617 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
618 | 618 | { |
619 | 619 | $source_file = $file->uploaded_filename; |
620 | 620 | break; |
621 | 621 | } |
622 | 622 | |
623 | - if($first_image) continue; |
|
623 | + if ($first_image) continue; |
|
624 | 624 | |
625 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
625 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
626 | 626 | { |
627 | - if(file_exists($file->uploaded_filename)) |
|
627 | + if (file_exists($file->uploaded_filename)) |
|
628 | 628 | { |
629 | 629 | $first_image = $file->uploaded_filename; |
630 | 630 | } |
631 | 631 | } |
632 | 632 | } |
633 | 633 | |
634 | - if(!$source_file && $first_image) |
|
634 | + if (!$source_file && $first_image) |
|
635 | 635 | { |
636 | 636 | $source_file = $first_image; |
637 | 637 | } |
@@ -639,31 +639,31 @@ discard block |
||
639 | 639 | |
640 | 640 | // get an image file from the doc content if no file attached. |
641 | 641 | $is_tmp_file = false; |
642 | - if(!$source_file) |
|
642 | + if (!$source_file) |
|
643 | 643 | { |
644 | 644 | $random = new Password(); |
645 | 645 | |
646 | 646 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
647 | 647 | |
648 | - foreach($matches as $target_image) |
|
648 | + foreach ($matches as $target_image) |
|
649 | 649 | { |
650 | 650 | $target_src = trim($target_image[1]); |
651 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
651 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
652 | 652 | |
653 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
653 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
654 | 654 | { |
655 | 655 | $target_src = Context::getRequestUri().$target_src; |
656 | 656 | } |
657 | 657 | |
658 | 658 | $target_src = htmlspecialchars_decode($target_src); |
659 | 659 | |
660 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
660 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
661 | 661 | FileHandler::getRemoteFile($target_src, $tmp_file); |
662 | - if(!file_exists($tmp_file)) continue; |
|
662 | + if (!file_exists($tmp_file)) continue; |
|
663 | 663 | |
664 | 664 | $imageinfo = getimagesize($tmp_file); |
665 | 665 | list($_w, $_h) = $imageinfo; |
666 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
666 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
667 | 667 | FileHandler::removeFile($tmp_file); |
668 | 668 | continue; |
669 | 669 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
678 | 678 | |
679 | 679 | // Remove source file if it was temporary |
680 | - if($is_tmp_file) |
|
680 | + if ($is_tmp_file) |
|
681 | 681 | { |
682 | 682 | FileHandler::removeFile($source_file); |
683 | 683 | } |
@@ -686,14 +686,14 @@ discard block |
||
686 | 686 | FileHandler::removeFile($thumbnail_lockfile); |
687 | 687 | |
688 | 688 | // Return the thumbnail path if it was successfully generated |
689 | - if($output) |
|
689 | + if ($output) |
|
690 | 690 | { |
691 | 691 | return $thumbnail_url; |
692 | 692 | } |
693 | 693 | // Create an empty file if thumbnail generation failed |
694 | 694 | else |
695 | 695 | { |
696 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
696 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | return; |
@@ -19,11 +19,11 @@ |
||
19 | 19 | { |
20 | 20 | $event = $subject->getLastEvent(); |
21 | 21 | |
22 | - switch($event['name']) |
|
22 | + switch ($event['name']) |
|
23 | 23 | { |
24 | 24 | case 'receivedHeaders': |
25 | 25 | $this->fp = @fopen($this->filename, 'wb'); |
26 | - if(!$this->fp) |
|
26 | + if (!$this->fp) |
|
27 | 27 | { |
28 | 28 | throw new Exception("Cannot open target file '{$filename}'"); |
29 | 29 | } |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | { |
9 | 9 | // If member_srl < 0, then return text only in the body |
10 | 10 | $member_srl = $matches[3]; |
11 | - if($member_srl < 0) |
|
11 | + if ($member_srl < 0) |
|
12 | 12 | { |
13 | 13 | return $matches[5]; |
14 | 14 | } |
15 | 15 | // If member_srl=o(not a member), return the entire body |
16 | - if(!$member_srl) |
|
16 | + if (!$member_srl) |
|
17 | 17 | { |
18 | 18 | return $matches[0]; |
19 | 19 | } |
@@ -22,22 +22,22 @@ discard block |
||
22 | 22 | $nick_name = $matches[5]; |
23 | 23 | |
24 | 24 | // Initialize global variable for cache |
25 | - if(!isset($GLOBALS['_transImageNameList'][$member_srl])) |
|
25 | + if (!isset($GLOBALS['_transImageNameList'][$member_srl])) |
|
26 | 26 | { |
27 | 27 | $GLOBALS['_transImageNameList'][$member_srl] = new stdClass(); |
28 | 28 | } |
29 | 29 | $_tmp = &$GLOBALS['_transImageNameList'][$member_srl]; |
30 | 30 | |
31 | 31 | // If pre-defined data in the global variables, return it |
32 | - if(!$_tmp->cached) |
|
32 | + if (!$_tmp->cached) |
|
33 | 33 | { |
34 | 34 | $_tmp->cached = true; |
35 | 35 | $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
36 | 36 | $image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
37 | 37 | |
38 | - if(file_exists(_XE_PATH_ . $image_name_file)) |
|
38 | + if (file_exists(_XE_PATH_.$image_name_file)) |
|
39 | 39 | { |
40 | - $_tmp->image_name_file = $image_name_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_name_file)); |
|
40 | + $_tmp->image_name_file = $image_name_file.'?'.date('YmdHis', filemtime(_XE_PATH_.$image_name_file)); |
|
41 | 41 | $image_name_file = $_tmp->image_name_file; |
42 | 42 | } |
43 | 43 | else |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $image_name_file = ''; |
46 | 46 | } |
47 | 47 | |
48 | - if(file_exists(_XE_PATH_ . $image_mark_file)) |
|
48 | + if (file_exists(_XE_PATH_.$image_mark_file)) |
|
49 | 49 | { |
50 | - $_tmp->image_mark_file = $image_mark_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_mark_file)); |
|
50 | + $_tmp->image_mark_file = $image_mark_file.'?'.date('YmdHis', filemtime(_XE_PATH_.$image_mark_file)); |
|
51 | 51 | $image_mark_file = $_tmp->image_mark_file; |
52 | 52 | } |
53 | 53 | else |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // If image name and mark doesn't exist, set the original information |
70 | - if(!$image_name_file && !$image_mark_file && !$group_image) |
|
70 | + if (!$image_name_file && !$image_mark_file && !$group_image) |
|
71 | 71 | { |
72 | 72 | return $matches[0]; |
73 | 73 | } |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | |
77 | 77 | $config = $oMemberModel->getMemberConfig(); |
78 | 78 | |
79 | - if($config->image_name == 'Y' && $image_name_file) |
|
79 | + if ($config->image_name == 'Y' && $image_name_file) |
|
80 | 80 | { |
81 | 81 | $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id: %s" style="border:0;vertical-align:middle;margin-right:3px" />', Context::getRequestUri(), $image_name_file, strip_tags($nick_name), strip_tags($nick_name)); |
82 | 82 | } |
83 | - if($config->image_mark == 'Y' && $image_mark_file) |
|
83 | + if ($config->image_mark == 'Y' && $image_mark_file) |
|
84 | 84 | { |
85 | 85 | $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id : %s" style="border:0;vertical-align:middle;margin-right:3px"/>%s', Context::getRequestUri(), $image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name); |
86 | 86 | } |
87 | 87 | |
88 | - if($group_image) |
|
88 | + if ($group_image) |
|
89 | 89 | { |
90 | 90 | $nick_name = sprintf('<img src="%s" style="border:0;max-height:16px;vertical-align:middle;margin-right:3px" alt="%s" title="%s" />%s', $group_image->src, $group_image->title, $group_image->description, $nick_name); |
91 | 91 | } |
92 | 92 | |
93 | - return preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]) . $nick_name . '</' . $matches[6] . '>'; |
|
93 | + return preg_replace('/'.preg_quote($matches[5], '/').'<\/'.$matches[6].'>$/', '', $matches[0]).$nick_name.'</'.$matches[6].'>'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /* End of file member_extra_info.lib.php */ |
@@ -39,8 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $_tmp->image_name_file = $image_name_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_name_file)); |
41 | 41 | $image_name_file = $_tmp->image_name_file; |
42 | - } |
|
43 | - else |
|
42 | + } else |
|
44 | 43 | { |
45 | 44 | $image_name_file = ''; |
46 | 45 | } |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | { |
50 | 49 | $_tmp->image_mark_file = $image_mark_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_mark_file)); |
51 | 50 | $image_mark_file = $_tmp->image_mark_file; |
52 | - } |
|
53 | - else |
|
51 | + } else |
|
54 | 52 | { |
55 | 53 | $image_mark_file = ''; |
56 | 54 | } |
@@ -58,8 +56,7 @@ discard block |
||
58 | 56 | $site_module_info = Context::get('site_module_info'); |
59 | 57 | $group_image = $oMemberModel->getGroupImageMark($member_srl, $site_module_info->site_srl); |
60 | 58 | $_tmp->group_image = $group_image; |
61 | - } |
|
62 | - else |
|
59 | + } else |
|
63 | 60 | { |
64 | 61 | $group_image = $_tmp->group_image; |
65 | 62 | $image_name_file = $_tmp->image_name_file; |
@@ -296,10 +296,11 @@ discard block |
||
296 | 296 | $num_args = func_num_args(); |
297 | 297 | $args_list = func_get_args(); |
298 | 298 | |
299 | - if($num_args) |
|
300 | - $url = Context::getUrl($num_args, $args_list); |
|
301 | - else |
|
302 | - $url = Context::getRequestUri(); |
|
299 | + if($num_args) { |
|
300 | + $url = Context::getUrl($num_args, $args_list); |
|
301 | + } else { |
|
302 | + $url = Context::getRequestUri(); |
|
303 | + } |
|
303 | 304 | |
304 | 305 | return preg_replace('@\berror_return_url=[^&]*|\w+=(?:&|$)@', '', $url); |
305 | 306 | } |
@@ -318,8 +319,7 @@ discard block |
||
318 | 319 | if($num_args) |
319 | 320 | { |
320 | 321 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
321 | - } |
|
322 | - else |
|
322 | + } else |
|
323 | 323 | { |
324 | 324 | $url = Context::getRequestUri(); |
325 | 325 | } |
@@ -341,8 +341,7 @@ discard block |
||
341 | 341 | if($num_args) |
342 | 342 | { |
343 | 343 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
344 | - } |
|
345 | - else |
|
344 | + } else |
|
346 | 345 | { |
347 | 346 | $url = Context::getRequestUri(); |
348 | 347 | } |
@@ -531,13 +530,11 @@ discard block |
||
531 | 530 | { |
532 | 531 | $char_width += (int) $chars[$c - 32]; |
533 | 532 | $idx++; |
534 | - } |
|
535 | - else if(191 < $c && $c < 224) |
|
533 | + } else if(191 < $c && $c < 224) |
|
536 | 534 | { |
537 | 535 | $char_width += $chars[4]; |
538 | 536 | $idx += 2; |
539 | - } |
|
540 | - else |
|
537 | + } else |
|
541 | 538 | { |
542 | 539 | $char_width += $chars[0]; |
543 | 540 | $idx += 3; |
@@ -564,8 +561,7 @@ discard block |
||
564 | 561 | if($time_zone < 0) |
565 | 562 | { |
566 | 563 | $to = -1; |
567 | - } |
|
568 | - else |
|
564 | + } else |
|
569 | 565 | { |
570 | 566 | $to = 1; |
571 | 567 | } |
@@ -577,8 +573,7 @@ discard block |
||
577 | 573 | if($server_time_zone < 0) |
578 | 574 | { |
579 | 575 | $so = -1; |
580 | - } |
|
581 | - else |
|
576 | + } else |
|
582 | 577 | { |
583 | 578 | $so = 1; |
584 | 579 | } |
@@ -615,8 +610,7 @@ discard block |
||
615 | 610 | if(strlen($str) <= 8) |
616 | 611 | { |
617 | 612 | $gap = 0; |
618 | - } |
|
619 | - else |
|
613 | + } else |
|
620 | 614 | { |
621 | 615 | $gap = zgap(); |
622 | 616 | } |
@@ -639,20 +633,16 @@ discard block |
||
639 | 633 | if($gap < 60) |
640 | 634 | { |
641 | 635 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
642 | - } |
|
643 | - elseif($gap < 60 * 60) |
|
636 | + } elseif($gap < 60 * 60) |
|
644 | 637 | { |
645 | 638 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
646 | - } |
|
647 | - elseif($gap < 60 * 60 * 2) |
|
639 | + } elseif($gap < 60 * 60 * 2) |
|
648 | 640 | { |
649 | 641 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
650 | - } |
|
651 | - elseif($gap < 60 * 60 * 24) |
|
642 | + } elseif($gap < 60 * 60 * 24) |
|
652 | 643 | { |
653 | 644 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
654 | - } |
|
655 | - else |
|
645 | + } else |
|
656 | 646 | { |
657 | 647 | $buff = zdate($date, $format); |
658 | 648 | } |
@@ -699,12 +689,10 @@ discard block |
||
699 | 689 | if($format == 'Y-m-d') |
700 | 690 | { |
701 | 691 | $format = 'M d, Y'; |
702 | - } |
|
703 | - elseif($format == 'Y-m-d H:i:s') |
|
692 | + } elseif($format == 'Y-m-d H:i:s') |
|
704 | 693 | { |
705 | 694 | $format = 'M d, Y H:i:s'; |
706 | - } |
|
707 | - elseif($format == 'Y-m-d H:i') |
|
695 | + } elseif($format == 'Y-m-d H:i') |
|
708 | 696 | { |
709 | 697 | $format = 'M d, Y H:i'; |
710 | 698 | } |
@@ -713,12 +701,10 @@ discard block |
||
713 | 701 | if($format == 'Y-m-d') |
714 | 702 | { |
715 | 703 | $format = 'd-m-Y'; |
716 | - } |
|
717 | - elseif($format == 'Y-m-d H:i:s') |
|
704 | + } elseif($format == 'Y-m-d H:i:s') |
|
718 | 705 | { |
719 | 706 | $format = 'H:i:s d-m-Y'; |
720 | - } |
|
721 | - elseif($format == 'Y-m-d H:i') |
|
707 | + } elseif($format == 'Y-m-d H:i') |
|
722 | 708 | { |
723 | 709 | $format = 'H:i d-m-Y'; |
724 | 710 | } |
@@ -754,8 +740,7 @@ discard block |
||
754 | 740 | ); |
755 | 741 | |
756 | 742 | $string = strtr($format, $trans); |
757 | - } |
|
758 | - else |
|
743 | + } else |
|
759 | 744 | { |
760 | 745 | // if year value is greater than 1970, get unixtime by using ztime() for date() function's argument. |
761 | 746 | $string = date($format, ztime($str)); |
@@ -842,8 +827,7 @@ discard block |
||
842 | 827 | } |
843 | 828 | |
844 | 829 | $firephp->fb($debug_output, $label, $type); |
845 | - } |
|
846 | - else |
|
830 | + } else |
|
847 | 831 | { |
848 | 832 | if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
849 | 833 | { |
@@ -855,7 +839,9 @@ discard block |
||
855 | 839 | { |
856 | 840 | $debug_file = _XE_PATH_ . 'files/' . $file; |
857 | 841 | } |
858 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
842 | + if(!file_exists($debug_file)) { |
|
843 | + $print[] = '<?php exit() ?>'; |
|
844 | + } |
|
859 | 845 | |
860 | 846 | if($display_option === TRUE || $display_option === 'ERROR') |
861 | 847 | { |
@@ -868,13 +854,11 @@ discard block |
||
868 | 854 | if($display_option === 'ERROR') |
869 | 855 | { |
870 | 856 | $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
871 | - } |
|
872 | - else |
|
857 | + } else |
|
873 | 858 | { |
874 | 859 | $print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; |
875 | 860 | } |
876 | - } |
|
877 | - else |
|
861 | + } else |
|
878 | 862 | { |
879 | 863 | $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
880 | 864 | } |
@@ -901,7 +885,9 @@ discard block |
||
901 | 885 | */ |
902 | 886 | function writeSlowlog($type, $elapsed_time, $obj) |
903 | 887 | { |
904 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
888 | + if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) { |
|
889 | + return; |
|
890 | + } |
|
905 | 891 | |
906 | 892 | static $log_filename = array( |
907 | 893 | 'query' => 'files/_slowlog_query.php', |
@@ -921,25 +907,21 @@ discard block |
||
921 | 907 | { |
922 | 908 | $buff[] = "\tCaller : " . $obj->caller; |
923 | 909 | $buff[] = "\tCalled : " . $obj->called; |
924 | - } |
|
925 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
910 | + } else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
926 | 911 | { |
927 | 912 | $buff[] = "\tAddon : " . $obj->called; |
928 | 913 | $buff[] = "\tCalled position : " . $obj->caller; |
929 | - } |
|
930 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
914 | + } else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
931 | 915 | { |
932 | 916 | $buff[] = "\tWidget : " . $obj->called; |
933 | - } |
|
934 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
917 | + } else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
935 | 918 | { |
936 | 919 | |
937 | 920 | $buff[] = $obj->query; |
938 | 921 | $buff[] = "\tQuery ID : " . $obj->query_id; |
939 | 922 | $buff[] = "\tCaller : " . $obj->caller; |
940 | 923 | $buff[] = "\tConnection : " . $obj->connection; |
941 | - } |
|
942 | - else |
|
924 | + } else |
|
943 | 925 | { |
944 | 926 | $write_file = false; |
945 | 927 | } |
@@ -1031,8 +1013,11 @@ discard block |
||
1031 | 1013 | |
1032 | 1014 | foreach($del_vars as $var) |
1033 | 1015 | { |
1034 | - if(is_array($vars)) unset($vars[$var]); |
|
1035 | - else if(is_object($vars)) unset($vars->$var); |
|
1016 | + if(is_array($vars)) { |
|
1017 | + unset($vars[$var]); |
|
1018 | + } else if(is_object($vars)) { |
|
1019 | + unset($vars->$var); |
|
1020 | + } |
|
1036 | 1021 | } |
1037 | 1022 | |
1038 | 1023 | return $vars; |
@@ -1169,8 +1154,7 @@ discard block |
||
1169 | 1154 | if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
1170 | 1155 | { |
1171 | 1156 | $content .= '</xmp>'; |
1172 | - } |
|
1173 | - else if($close_xmp < $start_xmp) |
|
1157 | + } else if($close_xmp < $start_xmp) |
|
1174 | 1158 | { |
1175 | 1159 | $content .= '</xmp>'; |
1176 | 1160 | } |
@@ -1227,12 +1211,18 @@ discard block |
||
1227 | 1211 | |
1228 | 1212 | $filter_arrts = array('style', 'src', 'href'); |
1229 | 1213 | |
1230 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
1231 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
1214 | + if($tag === 'object') { |
|
1215 | + array_push($filter_arrts, 'data'); |
|
1216 | + } |
|
1217 | + if($tag === 'param') { |
|
1218 | + array_push($filter_arrts, 'value'); |
|
1219 | + } |
|
1232 | 1220 | |
1233 | 1221 | foreach($filter_arrts as $attr) |
1234 | 1222 | { |
1235 | - if(!isset($attrs[$attr])) continue; |
|
1223 | + if(!isset($attrs[$attr])) { |
|
1224 | + continue; |
|
1225 | + } |
|
1236 | 1226 | |
1237 | 1227 | $attr_value = rawurldecode($attrs[$attr]); |
1238 | 1228 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
@@ -1395,16 +1385,14 @@ discard block |
||
1395 | 1385 | $unicode = hexdec($unicodeHexVal); |
1396 | 1386 | $decodedStr .= _code2utf($unicode); |
1397 | 1387 | $pos += 4; |
1398 | - } |
|
1399 | - else |
|
1388 | + } else |
|
1400 | 1389 | { |
1401 | 1390 | // we have an escaped ascii character |
1402 | 1391 | $hexVal = substr($source, $pos, 2); |
1403 | 1392 | $decodedStr .= chr(hexdec($hexVal)); |
1404 | 1393 | $pos += 2; |
1405 | 1394 | } |
1406 | - } |
|
1407 | - else |
|
1395 | + } else |
|
1408 | 1396 | { |
1409 | 1397 | $decodedStr .= $charAt; |
1410 | 1398 | $pos++; |
@@ -1596,8 +1584,7 @@ discard block |
||
1596 | 1584 | if(version_compare(PHP_VERSION, "5.3.0") < 0) |
1597 | 1585 | { |
1598 | 1586 | set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
1599 | - } |
|
1600 | - else |
|
1587 | + } else |
|
1601 | 1588 | { |
1602 | 1589 | set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
1603 | 1590 | } |
@@ -1634,8 +1621,7 @@ discard block |
||
1634 | 1621 | { |
1635 | 1622 | return FALSE; |
1636 | 1623 | } |
1637 | - } |
|
1638 | - else |
|
1624 | + } else |
|
1639 | 1625 | { |
1640 | 1626 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
1641 | 1627 | if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $module_name The module name to get a instance |
75 | 75 | * @param string $type disp, proc, controller, class |
76 | 76 | * @param string $kind admin, null |
77 | - * @return mixed Module instance |
|
77 | + * @return ModuleObject Module instance |
|
78 | 78 | */ |
79 | 79 | function getModule($module_name, $type = 'view', $kind = '') |
80 | 80 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * Create a controller instance of the module |
86 | 86 | * |
87 | 87 | * @param string $module_name The module name to get a controller instance |
88 | - * @return mixed Module controller instance |
|
88 | + * @return ModuleObject Module controller instance |
|
89 | 89 | */ |
90 | 90 | function getController($module_name) |
91 | 91 | { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * Create a admin controller instance of the module |
97 | 97 | * |
98 | 98 | * @param string $module_name The module name to get a admin controller instance |
99 | - * @return mixed Module admin controller instance |
|
99 | + * @return ModuleObject Module admin controller instance |
|
100 | 100 | */ |
101 | 101 | function getAdminController($module_name) |
102 | 102 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * Create a view instance of the module |
108 | 108 | * |
109 | 109 | * @param string $module_name The module name to get a view instance |
110 | - * @return mixed Module view instance |
|
110 | + * @return ModuleObject Module view instance |
|
111 | 111 | */ |
112 | 112 | function getView($module_name) |
113 | 113 | { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * Create a mobile instance of the module |
119 | 119 | * |
120 | 120 | * @param string $module_name The module name to get a mobile instance |
121 | - * @return mixed Module mobile instance |
|
121 | + * @return ModuleObject Module mobile instance |
|
122 | 122 | */ |
123 | 123 | function &getMobile($module_name) |
124 | 124 | { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * Create a admin view instance of the module |
130 | 130 | * |
131 | 131 | * @param string $module_name The module name to get a admin view instance |
132 | - * @return mixed Module admin view instance |
|
132 | + * @return ModuleObject Module admin view instance |
|
133 | 133 | */ |
134 | 134 | function getAdminView($module_name) |
135 | 135 | { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * Create a model instance of the module |
141 | 141 | * |
142 | 142 | * @param string $module_name The module name to get a model instance |
143 | - * @return mixed Module model instance |
|
143 | + * @return ModuleObject Module model instance |
|
144 | 144 | */ |
145 | 145 | function getModel($module_name) |
146 | 146 | { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * Create an admin model instance of the module |
152 | 152 | * |
153 | 153 | * @param string $module_name The module name to get a admin model instance |
154 | - * @return mixed Module admin model instance |
|
154 | + * @return ModuleObject Module admin model instance |
|
155 | 155 | */ |
156 | 156 | function getAdminModel($module_name) |
157 | 157 | { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * Create an api instance of the module |
163 | 163 | * |
164 | 164 | * @param string $module_name The module name to get a api instance |
165 | - * @return mixed Module api class instance |
|
165 | + * @return ModuleObject Module api class instance |
|
166 | 166 | */ |
167 | 167 | function getAPI($module_name) |
168 | 168 | { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * Create a wap instance of the module |
174 | 174 | * |
175 | 175 | * @param string $module_name The module name to get a wap instance |
176 | - * @return mixed Module wap class instance |
|
176 | + * @return ModuleObject Module wap class instance |
|
177 | 177 | */ |
178 | 178 | function getWAP($module_name) |
179 | 179 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * Create a class instance of the module |
185 | 185 | * |
186 | 186 | * @param string $module_name The module name to get a class instance |
187 | - * @return mixed Module class instance |
|
187 | + * @return ModuleObject Module class instance |
|
188 | 188 | */ |
189 | 189 | function getClass($module_name) |
190 | 190 | { |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * Return if domain of the virtual site is url type or id type |
488 | 488 | * |
489 | 489 | * @param string $domain |
490 | - * @return bool |
|
490 | + * @return integer |
|
491 | 491 | */ |
492 | 492 | function isSiteID($domain) |
493 | 493 | { |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | /** |
557 | 557 | * Get a time gap between server's timezone and XE's timezone |
558 | 558 | * |
559 | - * @return int |
|
559 | + * @return double |
|
560 | 560 | */ |
561 | 561 | function zgap() |
562 | 562 | { |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * YYYYMMDDHHIISS format changed to unix time value |
598 | 598 | * |
599 | 599 | * @param string $str Time value in format of YYYYMMDDHHIISS |
600 | - * @return int |
|
600 | + * @return null|double |
|
601 | 601 | */ |
602 | 602 | function ztime($str) |
603 | 603 | { |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | /** |
898 | 898 | * @param string $type query, trigger |
899 | 899 | * @param float $elapsed_time |
900 | - * @param object $obj |
|
900 | + * @param stdClass $obj |
|
901 | 901 | */ |
902 | 902 | function writeSlowlog($type, $elapsed_time, $obj) |
903 | 903 | { |
@@ -1671,6 +1671,9 @@ discard block |
||
1671 | 1671 | } |
1672 | 1672 | } |
1673 | 1673 | |
1674 | +/** |
|
1675 | + * @param string $key |
|
1676 | + */ |
|
1674 | 1677 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
1675 | 1678 | { |
1676 | 1679 | if($requestKey != $dbKey) |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @author NAVER ([email protected]) |
8 | 8 | */ |
9 | -if(!defined('__XE__')) |
|
9 | +if (!defined('__XE__')) |
|
10 | 10 | { |
11 | 11 | exit(); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist |
15 | -if(!function_exists('iconv')) |
|
15 | +if (!function_exists('iconv')) |
|
16 | 16 | { |
17 | 17 | eval(' |
18 | 18 | function iconv($in_charset, $out_charset, $str) |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | $oDB = DB::getInstance(); |
222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns); |
223 | - if(!is_array($output->data) && count($output->data) > 0) |
|
223 | + if (!is_array($output->data) && count($output->data) > 0) |
|
224 | 224 | { |
225 | 225 | $output->data = array($output->data); |
226 | 226 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | function setUserSequence($seq) |
251 | 251 | { |
252 | 252 | $arr_seq = array(); |
253 | - if(isset($_SESSION['seq'])) |
|
253 | + if (isset($_SESSION['seq'])) |
|
254 | 254 | { |
255 | 255 | $arr_seq = $_SESSION['seq']; |
256 | 256 | } |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | */ |
267 | 267 | function checkUserSequence($seq) |
268 | 268 | { |
269 | - if(!isset($_SESSION['seq'])) |
|
269 | + if (!isset($_SESSION['seq'])) |
|
270 | 270 | { |
271 | 271 | return false; |
272 | 272 | } |
273 | - if(!in_array($seq, $_SESSION['seq'])) |
|
273 | + if (!in_array($seq, $_SESSION['seq'])) |
|
274 | 274 | { |
275 | 275 | return false; |
276 | 276 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $num_args = func_num_args(); |
297 | 297 | $args_list = func_get_args(); |
298 | 298 | |
299 | - if($num_args) |
|
299 | + if ($num_args) |
|
300 | 300 | $url = Context::getUrl($num_args, $args_list); |
301 | 301 | else |
302 | 302 | $url = Context::getRequestUri(); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $num_args = func_num_args(); |
316 | 316 | $args_list = func_get_args(); |
317 | 317 | |
318 | - if($num_args) |
|
318 | + if ($num_args) |
|
319 | 319 | { |
320 | 320 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
321 | 321 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $num_args = func_num_args(); |
339 | 339 | $args_list = func_get_args(); |
340 | 340 | |
341 | - if($num_args) |
|
341 | + if ($num_args) |
|
342 | 342 | { |
343 | 343 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
344 | 344 | } |
@@ -360,16 +360,16 @@ discard block |
||
360 | 360 | $num_args = func_num_args(); |
361 | 361 | $args_list = func_get_args(); |
362 | 362 | $request_uri = Context::getRequestUri(); |
363 | - if(!$num_args) |
|
363 | + if (!$num_args) |
|
364 | 364 | { |
365 | 365 | return $request_uri; |
366 | 366 | } |
367 | 367 | |
368 | 368 | $url = Context::getUrl($num_args, $args_list); |
369 | - if(strncasecmp('http', $url, 4) !== 0) |
|
369 | + if (strncasecmp('http', $url, 4) !== 0) |
|
370 | 370 | { |
371 | 371 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
372 | - return substr($match[0], 0, -1) . $url; |
|
372 | + return substr($match[0], 0, -1).$url; |
|
373 | 373 | } |
374 | 374 | return $url; |
375 | 375 | } |
@@ -384,17 +384,17 @@ discard block |
||
384 | 384 | $num_args = func_num_args(); |
385 | 385 | $args_list = func_get_args(); |
386 | 386 | $request_uri = Context::getRequestUri(); |
387 | - if(!$num_args) |
|
387 | + if (!$num_args) |
|
388 | 388 | { |
389 | 389 | return $request_uri; |
390 | 390 | } |
391 | 391 | |
392 | 392 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
393 | - if(strncasecmp('http', $url, 4) !== 0) |
|
393 | + if (strncasecmp('http', $url, 4) !== 0) |
|
394 | 394 | { |
395 | 395 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
396 | 396 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
397 | - return substr($match[0], 0, -1) . $url; |
|
397 | + return substr($match[0], 0, -1).$url; |
|
398 | 398 | } |
399 | 399 | return $url; |
400 | 400 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $num_args = func_num_args(); |
411 | 411 | $args_list = func_get_args(); |
412 | 412 | |
413 | - if(!$num_args) |
|
413 | + if (!$num_args) |
|
414 | 414 | { |
415 | 415 | return Context::getRequestUri(); |
416 | 416 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $num_args = func_num_args(); |
433 | 433 | $args_list = func_get_args(); |
434 | 434 | |
435 | - if(!$num_args) |
|
435 | + if (!$num_args) |
|
436 | 436 | { |
437 | 437 | return Context::getRequestUri(); |
438 | 438 | } |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $args_list = func_get_args(); |
455 | 455 | |
456 | 456 | $request_uri = Context::getRequestUri(); |
457 | - if(!$num_args) |
|
457 | + if (!$num_args) |
|
458 | 458 | { |
459 | 459 | return $request_uri; |
460 | 460 | } |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | $num_args = count($args_list); |
464 | 464 | |
465 | 465 | $url = Context::getUrl($num_args, $args_list, $domain); |
466 | - if(strncasecmp('http', $url, 4) !== 0) |
|
466 | + if (strncasecmp('http', $url, 4) !== 0) |
|
467 | 467 | { |
468 | 468 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
469 | - return substr($match[0], 0, -1) . $url; |
|
469 | + return substr($match[0], 0, -1).$url; |
|
470 | 470 | } |
471 | 471 | return $url; |
472 | 472 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | function getCurrentPageUrl() |
480 | 480 | { |
481 | 481 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; |
482 | - $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
482 | + $url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
483 | 483 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE); |
484 | 484 | } |
485 | 485 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | static $secure = null; |
510 | 510 | static $db_info = null; |
511 | 511 | |
512 | - if($db_info === null) |
|
512 | + if ($db_info === null) |
|
513 | 513 | { |
514 | 514 | $db_info = Context::getDBInfo(); |
515 | 515 | } |
@@ -517,9 +517,9 @@ discard block |
||
517 | 517 | $path = '/'; |
518 | 518 | $domain = ''; |
519 | 519 | |
520 | - if($db_info->disable_cookie_secure !== 'Y') |
|
520 | + if ($db_info->disable_cookie_secure !== 'Y') |
|
521 | 521 | { |
522 | - if($secure === null) |
|
522 | + if ($secure === null) |
|
523 | 523 | { |
524 | 524 | $secure = (Context::getSslStatus() === 'always') ? true : false; |
525 | 525 | } |
@@ -542,12 +542,12 @@ discard block |
||
542 | 542 | */ |
543 | 543 | function cut_str($string, $cut_size = 0, $tail = '...') |
544 | 544 | { |
545 | - if($cut_size < 1 || !$string) |
|
545 | + if ($cut_size < 1 || !$string) |
|
546 | 546 | { |
547 | 547 | return $string; |
548 | 548 | } |
549 | 549 | |
550 | - if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
550 | + if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
551 | 551 | { |
552 | 552 | $GLOBALS['use_mb_strimwidth'] = TRUE; |
553 | 553 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8'); |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | $char_count = 0; |
562 | 562 | |
563 | 563 | $idx = 0; |
564 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
564 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
565 | 565 | { |
566 | 566 | $c = ord(substr($string, $idx, 1)); |
567 | 567 | $char_count++; |
568 | - if($c < 128) |
|
568 | + if ($c < 128) |
|
569 | 569 | { |
570 | 570 | $char_width += (int) $chars[$c - 32]; |
571 | 571 | $idx++; |
572 | 572 | } |
573 | - else if(191 < $c && $c < 224) |
|
573 | + else if (191 < $c && $c < 224) |
|
574 | 574 | { |
575 | 575 | $char_width += $chars[4]; |
576 | 576 | $idx += 2; |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | } |
584 | 584 | |
585 | 585 | $output = substr($string, 0, $idx); |
586 | - if(strlen($output) < $string_length) |
|
586 | + if (strlen($output) < $string_length) |
|
587 | 587 | { |
588 | 588 | $output .= $tail; |
589 | 589 | } |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | function zgap() |
600 | 600 | { |
601 | 601 | $time_zone = $GLOBALS['_time_zone']; |
602 | - if($time_zone < 0) |
|
602 | + if ($time_zone < 0) |
|
603 | 603 | { |
604 | 604 | $to = -1; |
605 | 605 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | $t_min = substr($time_zone, 3, 2) * $to; |
613 | 613 | |
614 | 614 | $server_time_zone = date("O"); |
615 | - if($server_time_zone < 0) |
|
615 | + if ($server_time_zone < 0) |
|
616 | 616 | { |
617 | 617 | $so = -1; |
618 | 618 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | */ |
640 | 640 | function ztime($str) |
641 | 641 | { |
642 | - if(!$str) |
|
642 | + if (!$str) |
|
643 | 643 | { |
644 | 644 | return; |
645 | 645 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $year = (int) substr($str, 0, 4); |
651 | 651 | $month = (int) substr($str, 4, 2); |
652 | 652 | $day = (int) substr($str, 6, 2); |
653 | - if(strlen($str) <= 8) |
|
653 | + if (strlen($str) <= 8) |
|
654 | 654 | { |
655 | 655 | $gap = 0; |
656 | 656 | } |
@@ -674,19 +674,19 @@ discard block |
||
674 | 674 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
675 | 675 | |
676 | 676 | $lang_time_gap = Context::getLang('time_gap'); |
677 | - if($gap < 60) |
|
677 | + if ($gap < 60) |
|
678 | 678 | { |
679 | 679 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
680 | 680 | } |
681 | - elseif($gap < 60 * 60) |
|
681 | + elseif ($gap < 60 * 60) |
|
682 | 682 | { |
683 | 683 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
684 | 684 | } |
685 | - elseif($gap < 60 * 60 * 2) |
|
685 | + elseif ($gap < 60 * 60 * 2) |
|
686 | 686 | { |
687 | 687 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
688 | 688 | } |
689 | - elseif($gap < 60 * 60 * 24) |
|
689 | + elseif ($gap < 60 * 60 * 24) |
|
690 | 690 | { |
691 | 691 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
692 | 692 | } |
@@ -723,40 +723,40 @@ discard block |
||
723 | 723 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
724 | 724 | { |
725 | 725 | // return null if no target time is specified |
726 | - if(!$str) |
|
726 | + if (!$str) |
|
727 | 727 | { |
728 | 728 | return; |
729 | 729 | } |
730 | 730 | // convert the date format according to the language |
731 | - if($conversion == TRUE) |
|
731 | + if ($conversion == TRUE) |
|
732 | 732 | { |
733 | - switch(Context::getLangType()) |
|
733 | + switch (Context::getLangType()) |
|
734 | 734 | { |
735 | 735 | case 'en' : |
736 | 736 | case 'es' : |
737 | - if($format == 'Y-m-d') |
|
737 | + if ($format == 'Y-m-d') |
|
738 | 738 | { |
739 | 739 | $format = 'M d, Y'; |
740 | 740 | } |
741 | - elseif($format == 'Y-m-d H:i:s') |
|
741 | + elseif ($format == 'Y-m-d H:i:s') |
|
742 | 742 | { |
743 | 743 | $format = 'M d, Y H:i:s'; |
744 | 744 | } |
745 | - elseif($format == 'Y-m-d H:i') |
|
745 | + elseif ($format == 'Y-m-d H:i') |
|
746 | 746 | { |
747 | 747 | $format = 'M d, Y H:i'; |
748 | 748 | } |
749 | 749 | break; |
750 | 750 | case 'vi' : |
751 | - if($format == 'Y-m-d') |
|
751 | + if ($format == 'Y-m-d') |
|
752 | 752 | { |
753 | 753 | $format = 'd-m-Y'; |
754 | 754 | } |
755 | - elseif($format == 'Y-m-d H:i:s') |
|
755 | + elseif ($format == 'Y-m-d H:i:s') |
|
756 | 756 | { |
757 | 757 | $format = 'H:i:s d-m-Y'; |
758 | 758 | } |
759 | - elseif($format == 'Y-m-d H:i') |
|
759 | + elseif ($format == 'Y-m-d H:i') |
|
760 | 760 | { |
761 | 761 | $format = 'H:i d-m-Y'; |
762 | 762 | } |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | } |
766 | 766 | |
767 | 767 | // If year value is less than 1970, handle it separately. |
768 | - if((int) substr($str, 0, 4) < 1970) |
|
768 | + if ((int) substr($str, 0, 4) < 1970) |
|
769 | 769 | { |
770 | 770 | $hour = (int) substr($str, 8, 2); |
771 | 771 | $min = (int) substr($str, 10, 2); |
@@ -815,9 +815,9 @@ discard block |
||
815 | 815 | function getEncodeEmailAddress($email) |
816 | 816 | { |
817 | 817 | $return = ''; |
818 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
818 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
819 | 819 | { |
820 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
820 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
821 | 821 | } |
822 | 822 | return $return; |
823 | 823 | } |
@@ -837,25 +837,25 @@ discard block |
||
837 | 837 | { |
838 | 838 | static $debug_file; |
839 | 839 | |
840 | - if(!(__DEBUG__ & 1)) |
|
840 | + if (!(__DEBUG__ & 1)) |
|
841 | 841 | { |
842 | 842 | return; |
843 | 843 | } |
844 | 844 | |
845 | 845 | static $firephp; |
846 | 846 | $bt = debug_backtrace(); |
847 | - if(is_array($bt)) |
|
847 | + if (is_array($bt)) |
|
848 | 848 | { |
849 | 849 | $bt_debug_print = array_shift($bt); |
850 | 850 | $bt_called_function = array_shift($bt); |
851 | 851 | } |
852 | 852 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
853 | 853 | $line_num = $bt_debug_print['line']; |
854 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
854 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
855 | 855 | |
856 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
856 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
857 | 857 | { |
858 | - if(!isset($firephp)) |
|
858 | + if (!isset($firephp)) |
|
859 | 859 | { |
860 | 860 | $firephp = FirePHP::getInstance(TRUE); |
861 | 861 | } |
@@ -864,16 +864,16 @@ discard block |
||
864 | 864 | $label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); |
865 | 865 | |
866 | 866 | // Check a FirePHP option |
867 | - if($display_option === 'TABLE') |
|
867 | + if ($display_option === 'TABLE') |
|
868 | 868 | { |
869 | 869 | $label = $display_option; |
870 | 870 | } |
871 | - if($display_option === 'ERROR') |
|
871 | + if ($display_option === 'ERROR') |
|
872 | 872 | { |
873 | 873 | $type = $display_option; |
874 | 874 | } |
875 | 875 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
876 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
876 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
877 | 877 | { |
878 | 878 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
879 | 879 | $label = NULL; |
@@ -883,52 +883,52 @@ discard block |
||
883 | 883 | } |
884 | 884 | else |
885 | 885 | { |
886 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
886 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
887 | 887 | { |
888 | 888 | return; |
889 | 889 | } |
890 | 890 | |
891 | 891 | $print = array(); |
892 | - if(!$debug_file) |
|
892 | + if (!$debug_file) |
|
893 | 893 | { |
894 | - $debug_file = _XE_PATH_ . 'files/' . $file; |
|
894 | + $debug_file = _XE_PATH_.'files/'.$file; |
|
895 | 895 | } |
896 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
896 | + if (!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
897 | 897 | |
898 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
898 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
899 | 899 | { |
900 | - $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));; |
|
900 | + $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ; |
|
901 | 901 | $print[] = str_repeat('=', 80); |
902 | 902 | } |
903 | 903 | $type = gettype($debug_output); |
904 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
904 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
905 | 905 | { |
906 | - if($display_option === 'ERROR') |
|
906 | + if ($display_option === 'ERROR') |
|
907 | 907 | { |
908 | - $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
|
908 | + $print[] = 'ERROR : '.var_export($debug_output, TRUE); |
|
909 | 909 | } |
910 | 910 | else |
911 | 911 | { |
912 | - $print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; |
|
912 | + $print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')'; |
|
913 | 913 | } |
914 | 914 | } |
915 | 915 | else |
916 | 916 | { |
917 | - $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
|
917 | + $print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".' ', print_r($debug_output, true))); |
|
918 | 918 | } |
919 | 919 | $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
920 | 920 | $backtrace = debug_backtrace($backtrace_args); |
921 | 921 | |
922 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
922 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
923 | 923 | { |
924 | 924 | array_shift($backtrace); |
925 | 925 | } |
926 | - foreach($backtrace as $val) |
|
926 | + foreach ($backtrace as $val) |
|
927 | 927 | { |
928 | - $print[] = ' - ' . $val['file'] . ' : ' . $val['line']; |
|
928 | + $print[] = ' - '.$val['file'].' : '.$val['line']; |
|
929 | 929 | } |
930 | 930 | $print[] = PHP_EOL; |
931 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
931 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | */ |
940 | 940 | function writeSlowlog($type, $elapsed_time, $obj) |
941 | 941 | { |
942 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
942 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
943 | 943 | |
944 | 944 | static $log_filename = array( |
945 | 945 | 'query' => 'files/_slowlog_query.php', |
@@ -949,47 +949,47 @@ discard block |
||
949 | 949 | ); |
950 | 950 | $write_file = true; |
951 | 951 | |
952 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
952 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
953 | 953 | |
954 | 954 | $buff = array(); |
955 | 955 | $buff[] = '<?php exit(); ?>'; |
956 | 956 | $buff[] = date('c'); |
957 | 957 | |
958 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
958 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
959 | 959 | { |
960 | - $buff[] = "\tCaller : " . $obj->caller; |
|
961 | - $buff[] = "\tCalled : " . $obj->called; |
|
960 | + $buff[] = "\tCaller : ".$obj->caller; |
|
961 | + $buff[] = "\tCalled : ".$obj->called; |
|
962 | 962 | } |
963 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
963 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
964 | 964 | { |
965 | - $buff[] = "\tAddon : " . $obj->called; |
|
966 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
965 | + $buff[] = "\tAddon : ".$obj->called; |
|
966 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
967 | 967 | } |
968 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
968 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
969 | 969 | { |
970 | - $buff[] = "\tWidget : " . $obj->called; |
|
970 | + $buff[] = "\tWidget : ".$obj->called; |
|
971 | 971 | } |
972 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
972 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
973 | 973 | { |
974 | 974 | |
975 | 975 | $buff[] = $obj->query; |
976 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
977 | - $buff[] = "\tCaller : " . $obj->caller; |
|
978 | - $buff[] = "\tConnection : " . $obj->connection; |
|
976 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
977 | + $buff[] = "\tCaller : ".$obj->caller; |
|
978 | + $buff[] = "\tConnection : ".$obj->connection; |
|
979 | 979 | } |
980 | 980 | else |
981 | 981 | { |
982 | 982 | $write_file = false; |
983 | 983 | } |
984 | 984 | |
985 | - if($write_file) |
|
985 | + if ($write_file) |
|
986 | 986 | { |
987 | 987 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
988 | - $buff[] = PHP_EOL . PHP_EOL; |
|
988 | + $buff[] = PHP_EOL.PHP_EOL; |
|
989 | 989 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
990 | 990 | } |
991 | 991 | |
992 | - if($type != 'query') |
|
992 | + if ($type != 'query') |
|
993 | 993 | { |
994 | 994 | $trigger_args = $obj; |
995 | 995 | $trigger_args->_log_type = $type; |
@@ -1029,11 +1029,11 @@ discard block |
||
1029 | 1029 | */ |
1030 | 1030 | function delObjectVars($target_obj, $del_obj) |
1031 | 1031 | { |
1032 | - if(!is_object($target_obj)) |
|
1032 | + if (!is_object($target_obj)) |
|
1033 | 1033 | { |
1034 | 1034 | return; |
1035 | 1035 | } |
1036 | - if(!is_object($del_obj)) |
|
1036 | + if (!is_object($del_obj)) |
|
1037 | 1037 | { |
1038 | 1038 | return; |
1039 | 1039 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | |
1044 | 1044 | $target = array_keys($target_vars); |
1045 | 1045 | $del = array_keys($del_vars); |
1046 | - if(!count($target) || !count($del)) |
|
1046 | + if (!count($target) || !count($del)) |
|
1047 | 1047 | { |
1048 | 1048 | return $target_obj; |
1049 | 1049 | } |
@@ -1051,10 +1051,10 @@ discard block |
||
1051 | 1051 | $return_obj = new stdClass(); |
1052 | 1052 | |
1053 | 1053 | $target_count = count($target); |
1054 | - for($i = 0; $i < $target_count; $i++) |
|
1054 | + for ($i = 0; $i < $target_count; $i++) |
|
1055 | 1055 | { |
1056 | 1056 | $target_key = $target[$i]; |
1057 | - if(!in_array($target_key, $del)) |
|
1057 | + if (!in_array($target_key, $del)) |
|
1058 | 1058 | { |
1059 | 1059 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
1060 | 1060 | } |
@@ -1067,10 +1067,10 @@ discard block |
||
1067 | 1067 | { |
1068 | 1068 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
1069 | 1069 | |
1070 | - foreach($del_vars as $var) |
|
1070 | + foreach ($del_vars as $var) |
|
1071 | 1071 | { |
1072 | - if(is_array($vars)) unset($vars[$var]); |
|
1073 | - else if(is_object($vars)) unset($vars->$var); |
|
1072 | + if (is_array($vars)) unset($vars[$var]); |
|
1073 | + else if (is_object($vars)) unset($vars->$var); |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | return $vars; |
@@ -1087,12 +1087,12 @@ discard block |
||
1087 | 1087 | */ |
1088 | 1088 | function handleError($errno, $errstr, $file, $line) |
1089 | 1089 | { |
1090 | - if(!__DEBUG__) |
|
1090 | + if (!__DEBUG__) |
|
1091 | 1091 | { |
1092 | 1092 | return; |
1093 | 1093 | } |
1094 | 1094 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
1095 | - if(!in_array($errno, $errors)) |
|
1095 | + if (!in_array($errno, $errors)) |
|
1096 | 1096 | { |
1097 | 1097 | return; |
1098 | 1098 | } |
@@ -1112,8 +1112,8 @@ discard block |
||
1112 | 1112 | function getNumberingPath($no, $size = 3) |
1113 | 1113 | { |
1114 | 1114 | $mod = pow(10, $size); |
1115 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
1116 | - if($no >= $mod) |
|
1115 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
1116 | + if ($no >= $mod) |
|
1117 | 1117 | { |
1118 | 1118 | $output .= getNumberingPath((int) $no / $mod, $size); |
1119 | 1119 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | |
1134 | 1134 | function purifierHtml(&$content) |
1135 | 1135 | { |
1136 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
1136 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
1137 | 1137 | $oPurifier = Purifier::getInstance(); |
1138 | 1138 | $oPurifier->purify($content); |
1139 | 1139 | } |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | */ |
1147 | 1147 | function removeHackTag($content) |
1148 | 1148 | { |
1149 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
1149 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
1150 | 1150 | $oEmbedFilter = EmbedFilter::getInstance(); |
1151 | 1151 | $oEmbedFilter->check($content); |
1152 | 1152 | |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | */ |
1189 | 1189 | function checkUploadedFile($file) |
1190 | 1190 | { |
1191 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
1191 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
1192 | 1192 | return UploadFileFilter::check($file); |
1193 | 1193 | } |
1194 | 1194 | |
@@ -1202,13 +1202,13 @@ discard block |
||
1202 | 1202 | { |
1203 | 1203 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
1204 | 1204 | |
1205 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1205 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1206 | 1206 | { |
1207 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1207 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1208 | 1208 | { |
1209 | 1209 | $content .= '</xmp>'; |
1210 | 1210 | } |
1211 | - else if($close_xmp < $start_xmp) |
|
1211 | + else if ($close_xmp < $start_xmp) |
|
1212 | 1212 | { |
1213 | 1213 | $content .= '</xmp>'; |
1214 | 1214 | } |
@@ -1228,33 +1228,33 @@ discard block |
||
1228 | 1228 | $tag = strtolower($match[2]); |
1229 | 1229 | |
1230 | 1230 | // xmp tag ?뺣━ |
1231 | - if($tag == 'xmp') |
|
1231 | + if ($tag == 'xmp') |
|
1232 | 1232 | { |
1233 | 1233 | return "<{$match[1]}xmp>"; |
1234 | 1234 | } |
1235 | - if($match[1]) |
|
1235 | + if ($match[1]) |
|
1236 | 1236 | { |
1237 | 1237 | return $match[0]; |
1238 | 1238 | } |
1239 | - if($match[4]) |
|
1239 | + if ($match[4]) |
|
1240 | 1240 | { |
1241 | - $match[4] = ' ' . $match[4]; |
|
1241 | + $match[4] = ' '.$match[4]; |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | $attrs = array(); |
1245 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1245 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1246 | 1246 | { |
1247 | - foreach($m[1] as $idx => $name) |
|
1247 | + foreach ($m[1] as $idx => $name) |
|
1248 | 1248 | { |
1249 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1249 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1250 | 1250 | { |
1251 | 1251 | continue; |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); |
|
1254 | + $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); |
|
1255 | 1255 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
1256 | 1256 | |
1257 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
1257 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
1258 | 1258 | { |
1259 | 1259 | continue; |
1260 | 1260 | } |
@@ -1265,60 +1265,60 @@ discard block |
||
1265 | 1265 | |
1266 | 1266 | $filter_arrts = array('style', 'src', 'href'); |
1267 | 1267 | |
1268 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
1269 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
1268 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
1269 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
1270 | 1270 | |
1271 | - foreach($filter_arrts as $attr) |
|
1271 | + foreach ($filter_arrts as $attr) |
|
1272 | 1272 | { |
1273 | - if(!isset($attrs[$attr])) continue; |
|
1273 | + if (!isset($attrs[$attr])) continue; |
|
1274 | 1274 | |
1275 | 1275 | $attr_value = rawurldecode($attrs[$attr]); |
1276 | 1276 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
1277 | 1277 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
1278 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1278 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1279 | 1279 | { |
1280 | 1280 | unset($attrs[$attr]); |
1281 | 1281 | } |
1282 | 1282 | } |
1283 | 1283 | |
1284 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1284 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1285 | 1285 | { |
1286 | 1286 | unset($attrs['style']); |
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | $attr = array(); |
1290 | - foreach($attrs as $name => $val) |
|
1290 | + foreach ($attrs as $name => $val) |
|
1291 | 1291 | { |
1292 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1292 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1293 | 1293 | { |
1294 | 1294 | $attribute = strtolower(trim($name)); |
1295 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1295 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1296 | 1296 | { |
1297 | - if(stripos($val, 'data:') === 0) |
|
1297 | + if (stripos($val, 'data:') === 0) |
|
1298 | 1298 | { |
1299 | 1299 | continue; |
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | } |
1303 | 1303 | |
1304 | - if($tag == 'img') |
|
1304 | + if ($tag == 'img') |
|
1305 | 1305 | { |
1306 | 1306 | $attribute = strtolower(trim($name)); |
1307 | - if(stripos($val, 'data:') === 0) |
|
1307 | + if (stripos($val, 'data:') === 0) |
|
1308 | 1308 | { |
1309 | 1309 | continue; |
1310 | 1310 | } |
1311 | 1311 | } |
1312 | 1312 | $val = str_replace('"', '"', $val); |
1313 | - $attr[] = $name . "=\"{$val}\""; |
|
1313 | + $attr[] = $name."=\"{$val}\""; |
|
1314 | 1314 | } |
1315 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
1315 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
1316 | 1316 | |
1317 | 1317 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | // convert hexa value to RGB |
1321 | -if(!function_exists('hexrgb')) |
|
1321 | +if (!function_exists('hexrgb')) |
|
1322 | 1322 | { |
1323 | 1323 | |
1324 | 1324 | /** |
@@ -1354,9 +1354,9 @@ discard block |
||
1354 | 1354 | |
1355 | 1355 | settype($password, "string"); |
1356 | 1356 | |
1357 | - for($i = 0; $i < strlen($password); $i++) |
|
1357 | + for ($i = 0; $i < strlen($password); $i++) |
|
1358 | 1358 | { |
1359 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
1359 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
1360 | 1360 | { |
1361 | 1361 | continue; |
1362 | 1362 | } |
@@ -1368,11 +1368,11 @@ discard block |
||
1368 | 1368 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
1369 | 1369 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
1370 | 1370 | |
1371 | - if($result1 == '80000000') |
|
1371 | + if ($result1 == '80000000') |
|
1372 | 1372 | { |
1373 | 1373 | $nr += 0x80000000; |
1374 | 1374 | } |
1375 | - if($result2 == '80000000') |
|
1375 | + if ($result2 == '80000000') |
|
1376 | 1376 | { |
1377 | 1377 | $nr2 += 0x80000000; |
1378 | 1378 | } |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | function getScriptPath() |
1389 | 1389 | { |
1390 | 1390 | static $url = NULL; |
1391 | - if($url == NULL) |
|
1391 | + if ($url == NULL) |
|
1392 | 1392 | { |
1393 | 1393 | $script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); |
1394 | 1394 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path))); |
@@ -1419,14 +1419,14 @@ discard block |
||
1419 | 1419 | $decodedStr = ''; |
1420 | 1420 | $pos = 0; |
1421 | 1421 | $len = strlen($source); |
1422 | - while($pos < $len) |
|
1422 | + while ($pos < $len) |
|
1423 | 1423 | { |
1424 | 1424 | $charAt = substr($source, $pos, 1); |
1425 | - if($charAt == '%') |
|
1425 | + if ($charAt == '%') |
|
1426 | 1426 | { |
1427 | 1427 | $pos++; |
1428 | 1428 | $charAt = substr($source, $pos, 1); |
1429 | - if($charAt == 'u') |
|
1429 | + if ($charAt == 'u') |
|
1430 | 1430 | { |
1431 | 1431 | // we got a unicode character |
1432 | 1432 | $pos++; |
@@ -1460,21 +1460,21 @@ discard block |
||
1460 | 1460 | */ |
1461 | 1461 | function _code2utf($num) |
1462 | 1462 | { |
1463 | - if($num < 128) |
|
1463 | + if ($num < 128) |
|
1464 | 1464 | { |
1465 | 1465 | return chr($num); |
1466 | 1466 | } |
1467 | - if($num < 2048) |
|
1467 | + if ($num < 2048) |
|
1468 | 1468 | { |
1469 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1469 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
1470 | 1470 | } |
1471 | - if($num < 65536) |
|
1471 | + if ($num < 65536) |
|
1472 | 1472 | { |
1473 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1473 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1474 | 1474 | } |
1475 | - if($num < 2097152) |
|
1475 | + if ($num < 2097152) |
|
1476 | 1476 | { |
1477 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1477 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1478 | 1478 | } |
1479 | 1479 | return ''; |
1480 | 1480 | } |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | */ |
1490 | 1490 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
1491 | 1491 | { |
1492 | - if($urldecode) |
|
1492 | + if ($urldecode) |
|
1493 | 1493 | { |
1494 | 1494 | $string = urldecode($string); |
1495 | 1495 | } |
@@ -1497,12 +1497,12 @@ discard block |
||
1497 | 1497 | $sample = iconv('utf-8', 'utf-8', $string); |
1498 | 1498 | $is_utf8 = (md5($sample) === md5($string)); |
1499 | 1499 | |
1500 | - if(!$urldecode) |
|
1500 | + if (!$urldecode) |
|
1501 | 1501 | { |
1502 | 1502 | $string = urldecode($string); |
1503 | 1503 | } |
1504 | 1504 | |
1505 | - if($return_convert) |
|
1505 | + if ($return_convert) |
|
1506 | 1506 | { |
1507 | 1507 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
1508 | 1508 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | */ |
1519 | 1519 | function json_encode2($data) |
1520 | 1520 | { |
1521 | - switch(gettype($data)) |
|
1521 | + switch (gettype($data)) |
|
1522 | 1522 | { |
1523 | 1523 | case 'boolean': |
1524 | 1524 | return $data ? 'true' : 'false'; |
@@ -1526,15 +1526,15 @@ discard block |
||
1526 | 1526 | case 'double': |
1527 | 1527 | return $data; |
1528 | 1528 | case 'string': |
1529 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
1529 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
1530 | 1530 | case 'object': |
1531 | 1531 | $data = get_object_vars($data); |
1532 | 1532 | case 'array': |
1533 | 1533 | $rel = FALSE; // relative array? |
1534 | 1534 | $key = array_keys($data); |
1535 | - foreach($key as $v) |
|
1535 | + foreach ($key as $v) |
|
1536 | 1536 | { |
1537 | - if(!is_int($v)) |
|
1537 | + if (!is_int($v)) |
|
1538 | 1538 | { |
1539 | 1539 | $rel = TRUE; |
1540 | 1540 | break; |
@@ -1542,12 +1542,12 @@ discard block |
||
1542 | 1542 | } |
1543 | 1543 | |
1544 | 1544 | $arr = array(); |
1545 | - foreach($data as $k => $v) |
|
1545 | + foreach ($data as $k => $v) |
|
1546 | 1546 | { |
1547 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
1547 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
1548 | 1548 | } |
1549 | 1549 | |
1550 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
1550 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
1551 | 1551 | default: |
1552 | 1552 | return '""'; |
1553 | 1553 | } |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | */ |
1562 | 1562 | function isCrawler($agent = NULL) |
1563 | 1563 | { |
1564 | - if(!$agent) |
|
1564 | + if (!$agent) |
|
1565 | 1565 | { |
1566 | 1566 | $agent = $_SERVER['HTTP_USER_AGENT']; |
1567 | 1567 | } |
@@ -1571,9 +1571,9 @@ discard block |
||
1571 | 1571 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
1572 | 1572 | ); |
1573 | 1573 | |
1574 | - foreach($check_agent as $str) |
|
1574 | + foreach ($check_agent as $str) |
|
1575 | 1575 | { |
1576 | - if(stristr($agent, $str) != FALSE) |
|
1576 | + if (stristr($agent, $str) != FALSE) |
|
1577 | 1577 | { |
1578 | 1578 | return TRUE; |
1579 | 1579 | } |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | */ |
1592 | 1592 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
1593 | 1593 | { |
1594 | - if(!Context::get('is_logged')) |
|
1594 | + if (!Context::get('is_logged')) |
|
1595 | 1595 | { |
1596 | 1596 | return; |
1597 | 1597 | } |
@@ -1599,18 +1599,18 @@ discard block |
||
1599 | 1599 | $oModuleModel = getModel('module'); |
1600 | 1600 | $logged_info = Context::get('logged_info'); |
1601 | 1601 | |
1602 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1602 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1603 | 1603 | { |
1604 | - if($writer_member_srl) |
|
1604 | + if ($writer_member_srl) |
|
1605 | 1605 | { |
1606 | 1606 | $oMemberModel = getModel('member'); |
1607 | 1607 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
1608 | - if($member_info->is_admin == "Y") |
|
1608 | + if ($member_info->is_admin == "Y") |
|
1609 | 1609 | { |
1610 | 1610 | return; |
1611 | 1611 | } |
1612 | 1612 | } |
1613 | - $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; |
|
1613 | + $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; |
|
1614 | 1614 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
1615 | 1615 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
1616 | 1616 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1627,18 +1627,18 @@ discard block |
||
1627 | 1627 | function requirePear() |
1628 | 1628 | { |
1629 | 1629 | static $required = false; |
1630 | - if($required) |
|
1630 | + if ($required) |
|
1631 | 1631 | { |
1632 | 1632 | return; |
1633 | 1633 | } |
1634 | 1634 | |
1635 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1635 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1636 | 1636 | { |
1637 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
1637 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
1638 | 1638 | } |
1639 | 1639 | else |
1640 | 1640 | { |
1641 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
1641 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
1642 | 1642 | } |
1643 | 1643 | |
1644 | 1644 | $required = true; |
@@ -1648,23 +1648,23 @@ discard block |
||
1648 | 1648 | { |
1649 | 1649 | static $disable_csrf_token = null; |
1650 | 1650 | |
1651 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1651 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1652 | 1652 | { |
1653 | 1653 | return FALSE; |
1654 | 1654 | } |
1655 | 1655 | |
1656 | - if($disable_csrf_token === null) |
|
1656 | + if ($disable_csrf_token === null) |
|
1657 | 1657 | { |
1658 | 1658 | $db_info = Context::getDBinfo(); |
1659 | 1659 | $disable_csrf_token = $db_info->disable_csrf_token; |
1660 | 1660 | } |
1661 | 1661 | |
1662 | - if($disable_csrf_token !== 'Y') |
|
1662 | + if ($disable_csrf_token !== 'Y') |
|
1663 | 1663 | { |
1664 | 1664 | $csrf_token = ($_SERVER['HTTP_X_CSRF_TOKEN']) ? $_SERVER['HTTP_X_CSRF_TOKEN'] : $_POST['_token']; |
1665 | 1665 | |
1666 | 1666 | // Token |
1667 | - if(!$csrf_token || $_SESSION['csrf_token'] !== $csrf_token) |
|
1667 | + if (!$csrf_token || $_SESSION['csrf_token'] !== $csrf_token) |
|
1668 | 1668 | { |
1669 | 1669 | header("HTTP/1.1 403 Forbidden"); |
1670 | 1670 | return FALSE; |
@@ -1674,9 +1674,9 @@ discard block |
||
1674 | 1674 | $default_url = Context::getDefaultUrl(); |
1675 | 1675 | $referer = $_SERVER["HTTP_REFERER"]; |
1676 | 1676 | |
1677 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1677 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1678 | 1678 | { |
1679 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
1679 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
1680 | 1680 | $IDN = new idna_convert(array('idn_version' => 2008)); |
1681 | 1681 | $referer = $IDN->encode($referer); |
1682 | 1682 | } |
@@ -1687,9 +1687,9 @@ discard block |
||
1687 | 1687 | $oModuleModel = getModel('module'); |
1688 | 1688 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
1689 | 1689 | |
1690 | - if($siteModuleInfo->site_srl == 0) |
|
1690 | + if ($siteModuleInfo->site_srl == 0) |
|
1691 | 1691 | { |
1692 | - if($default_url['host'] !== $referer['host']) |
|
1692 | + if ($default_url['host'] !== $referer['host']) |
|
1693 | 1693 | { |
1694 | 1694 | return FALSE; |
1695 | 1695 | } |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | else |
1698 | 1698 | { |
1699 | 1699 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
1700 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1700 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1701 | 1701 | { |
1702 | 1702 | return FALSE; |
1703 | 1703 | } |
@@ -1713,15 +1713,15 @@ discard block |
||
1713 | 1713 | */ |
1714 | 1714 | function recurciveExposureCheck(&$menu) |
1715 | 1715 | { |
1716 | - if(is_array($menu)) |
|
1716 | + if (is_array($menu)) |
|
1717 | 1717 | { |
1718 | - foreach($menu AS $key=>$value) |
|
1718 | + foreach ($menu AS $key=>$value) |
|
1719 | 1719 | { |
1720 | - if(!$value['isShow']) |
|
1720 | + if (!$value['isShow']) |
|
1721 | 1721 | { |
1722 | 1722 | unset($menu[$key]); |
1723 | 1723 | } |
1724 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
1724 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
1725 | 1725 | { |
1726 | 1726 | recurciveExposureCheck($menu[$key]['list']); |
1727 | 1727 | } |
@@ -1731,14 +1731,14 @@ discard block |
||
1731 | 1731 | |
1732 | 1732 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
1733 | 1733 | { |
1734 | - if($requestKey != $dbKey) |
|
1734 | + if ($requestKey != $dbKey) |
|
1735 | 1735 | { |
1736 | 1736 | $arrayUrl = parse_url(Context::get('success_return_url')); |
1737 | - if($arrayUrl['query']) |
|
1737 | + if ($arrayUrl['query']) |
|
1738 | 1738 | { |
1739 | 1739 | parse_str($arrayUrl['query'], $parsedStr); |
1740 | 1740 | |
1741 | - if(isset($parsedStr[$key])) |
|
1741 | + if (isset($parsedStr[$key])) |
|
1742 | 1742 | { |
1743 | 1743 | $parsedStr[$key] = $requestKey; |
1744 | 1744 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1781,14 +1781,14 @@ discard block |
||
1781 | 1781 | */ |
1782 | 1782 | function alertScript($msg) |
1783 | 1783 | { |
1784 | - if(!$msg) |
|
1784 | + if (!$msg) |
|
1785 | 1785 | { |
1786 | 1786 | return; |
1787 | 1787 | } |
1788 | 1788 | |
1789 | 1789 | echo '<script type="text/javascript"> |
1790 | 1790 | //<![CDATA[ |
1791 | -alert("' . $msg . '"); |
|
1791 | +alert("' . $msg.'"); |
|
1792 | 1792 | //]]> |
1793 | 1793 | </script>'; |
1794 | 1794 | } |
@@ -1819,7 +1819,7 @@ discard block |
||
1819 | 1819 | |
1820 | 1820 | echo '<script type="text/javascript"> |
1821 | 1821 | //<![CDATA[ |
1822 | -' . $reloadScript . ' |
|
1822 | +' . $reloadScript.' |
|
1823 | 1823 | //]]> |
1824 | 1824 | </script>'; |
1825 | 1825 | } |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function LimitTag($index) |
50 | 50 | { |
51 | - if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
|
51 | + if ($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
|
52 | 52 | { |
53 | - if(!isset($index->page->attrs->default)) |
|
53 | + if (!isset($index->page->attrs->default)) |
|
54 | 54 | $index->page->attrs->default = 1; |
55 | - if(!isset($index->page_count->attrs->default)) |
|
55 | + if (!isset($index->page_count->attrs->default)) |
|
56 | 56 | $index->page_count->attrs->default = 10; |
57 | 57 | $this->page = new QueryArgument($index->page); |
58 | 58 | $this->page_count = new QueryArgument($index->page_count); |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $this->arguments[] = $this->page_count; |
61 | 61 | } |
62 | 62 | |
63 | - if(!isset($index->list_count->attrs->default)) |
|
63 | + if (!isset($index->list_count->attrs->default)) |
|
64 | 64 | $index->list_count->attrs->default = 0; |
65 | 65 | $this->list_count = new QueryArgument($index->list_count); |
66 | 66 | $this->arguments[] = $this->list_count; |
67 | 67 | |
68 | - if(isset($index->offset) && isset($index->offset->attrs)) |
|
68 | + if (isset($index->offset) && isset($index->offset->attrs)) |
|
69 | 69 | { |
70 | 70 | $this->offset = new QueryArgument($index->offset); |
71 | 71 | $this->arguments[] = $this->offset; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | |
75 | 75 | function toString() |
76 | 76 | { |
77 | - if($this->page) |
|
77 | + if ($this->page) |
|
78 | 78 | { |
79 | 79 | return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName()); |
80 | 80 | } |
81 | - elseif($this->offset) |
|
81 | + elseif ($this->offset) |
|
82 | 82 | { |
83 | 83 | return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName()); |
84 | 84 | } |
@@ -50,18 +50,21 @@ discard block |
||
50 | 50 | { |
51 | 51 | if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
52 | 52 | { |
53 | - if(!isset($index->page->attrs->default)) |
|
54 | - $index->page->attrs->default = 1; |
|
55 | - if(!isset($index->page_count->attrs->default)) |
|
56 | - $index->page_count->attrs->default = 10; |
|
53 | + if(!isset($index->page->attrs->default)) { |
|
54 | + $index->page->attrs->default = 1; |
|
55 | + } |
|
56 | + if(!isset($index->page_count->attrs->default)) { |
|
57 | + $index->page_count->attrs->default = 10; |
|
58 | + } |
|
57 | 59 | $this->page = new QueryArgument($index->page); |
58 | 60 | $this->page_count = new QueryArgument($index->page_count); |
59 | 61 | $this->arguments[] = $this->page; |
60 | 62 | $this->arguments[] = $this->page_count; |
61 | 63 | } |
62 | 64 | |
63 | - if(!isset($index->list_count->attrs->default)) |
|
64 | - $index->list_count->attrs->default = 0; |
|
65 | + if(!isset($index->list_count->attrs->default)) { |
|
66 | + $index->list_count->attrs->default = 0; |
|
67 | + } |
|
65 | 68 | $this->list_count = new QueryArgument($index->list_count); |
66 | 69 | $this->arguments[] = $this->list_count; |
67 | 70 | |
@@ -77,12 +80,10 @@ discard block |
||
77 | 80 | if($this->page) |
78 | 81 | { |
79 | 82 | return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName()); |
80 | - } |
|
81 | - elseif($this->offset) |
|
83 | + } elseif($this->offset) |
|
82 | 84 | { |
83 | 85 | return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName()); |
84 | - } |
|
85 | - else |
|
86 | + } else |
|
86 | 87 | { |
87 | 88 | return sprintf('new Limit(${\'%s_argument\'})', $this->list_count->getArgumentName()); |
88 | 89 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | function Limit($list_count, $page = NULL, $page_count = NULL, $offset = NULL) |
45 | 45 | { |
46 | 46 | $this->list_count = $list_count; |
47 | - if($page) |
|
47 | + if ($page) |
|
48 | 48 | { |
49 | 49 | $list_count_value = $list_count->getValue(); |
50 | 50 | $page_value = $page->getValue(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->page_count = $page_count; |
53 | 53 | $this->page = $page; |
54 | 54 | } |
55 | - elseif($offset) |
|
55 | + elseif ($offset) |
|
56 | 56 | { |
57 | 57 | $this->start = $offset->getValue(); |
58 | 58 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | function isPageHandler() |
66 | 66 | { |
67 | - if($this->page) |
|
67 | + if ($this->page) |
|
68 | 68 | { |
69 | 69 | return true; |
70 | 70 | } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | |
87 | 87 | function toString() |
88 | 88 | { |
89 | - if($this->page || $this->start) |
|
89 | + if ($this->page || $this->start) |
|
90 | 90 | { |
91 | - return $this->start . ' , ' . $this->list_count->getValue(); |
|
91 | + return $this->start.' , '.$this->list_count->getValue(); |
|
92 | 92 | } |
93 | 93 | else |
94 | 94 | { |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | $this->start = ($page_value - 1) * $list_count_value; |
52 | 52 | $this->page_count = $page_count; |
53 | 53 | $this->page = $page; |
54 | - } |
|
55 | - elseif($offset) |
|
54 | + } elseif($offset) |
|
56 | 55 | { |
57 | 56 | $this->start = $offset->getValue(); |
58 | 57 | } |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | if($this->page) |
68 | 67 | { |
69 | 68 | return true; |
70 | - } |
|
71 | - else |
|
69 | + } else |
|
72 | 70 | { |
73 | 71 | return false; |
74 | 72 | } |
@@ -89,8 +87,7 @@ discard block |
||
89 | 87 | if($this->page || $this->start) |
90 | 88 | { |
91 | 89 | return $this->start . ' , ' . $this->list_count->getValue(); |
92 | - } |
|
93 | - else |
|
90 | + } else |
|
94 | 91 | { |
95 | 92 | return $this->list_count->getValue(); |
96 | 93 | } |