@@ -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,18 +582,18 @@ 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 | } |
| 594 | 594 | else |
| 595 | 595 | { |
| 596 | - return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
|
| 596 | + return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file)); |
|
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | |
@@ -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,12 +686,12 @@ discard block |
||
| 686 | 686 | FileHandler::removeFile($thumbnail_lockfile); |
| 687 | 687 | |
| 688 | 688 | // Create an empty file if thumbnail generation failed |
| 689 | - if(!$output) |
|
| 689 | + if (!$output) |
|
| 690 | 690 | { |
| 691 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 691 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | - return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
|
| 694 | + return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file)); |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | function isCarted() |
@@ -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. |
@@ -590,8 +591,7 @@ discard block |
||
| 590 | 591 | if(filesize($thumbnail_file) < 1) |
| 591 | 592 | { |
| 592 | 593 | return FALSE; |
| 593 | - } |
|
| 594 | - else |
|
| 594 | + } else |
|
| 595 | 595 | { |
| 596 | 596 | return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
| 597 | 597 | } |
@@ -612,7 +612,9 @@ discard block |
||
| 612 | 612 | $first_image = null; |
| 613 | 613 | foreach($file_list as $file) |
| 614 | 614 | { |
| 615 | - if($file->direct_download !== 'Y') continue; |
|
| 615 | + if($file->direct_download !== 'Y') { |
|
| 616 | + continue; |
|
| 617 | + } |
|
| 616 | 618 | |
| 617 | 619 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
| 618 | 620 | { |
@@ -620,7 +622,9 @@ discard block |
||
| 620 | 622 | break; |
| 621 | 623 | } |
| 622 | 624 | |
| 623 | - if($first_image) continue; |
|
| 625 | + if($first_image) { |
|
| 626 | + continue; |
|
| 627 | + } |
|
| 624 | 628 | |
| 625 | 629 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
| 626 | 630 | { |
@@ -648,7 +652,9 @@ discard block |
||
| 648 | 652 | foreach($matches as $target_image) |
| 649 | 653 | { |
| 650 | 654 | $target_src = trim($target_image[1]); |
| 651 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 655 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
| 656 | + continue; |
|
| 657 | + } |
|
| 652 | 658 | |
| 653 | 659 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
| 654 | 660 | { |
@@ -659,7 +665,9 @@ discard block |
||
| 659 | 665 | |
| 660 | 666 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
| 661 | 667 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 662 | - if(!file_exists($tmp_file)) continue; |
|
| 668 | + if(!file_exists($tmp_file)) { |
|
| 669 | + continue; |
|
| 670 | + } |
|
| 663 | 671 | |
| 664 | 672 | $imageinfo = getimagesize($tmp_file); |
| 665 | 673 | list($_w, $_h) = $imageinfo; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | function _loadFromDB($load_extra_vars = true) |
| 81 | 81 | { |
| 82 | - if(!$this->document_srl) return; |
|
| 82 | + if (!$this->document_srl) return; |
|
| 83 | 83 | |
| 84 | 84 | $document_item = false; |
| 85 | 85 | $cache_put = false; |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | // cache controll |
| 90 | 90 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 91 | - if($oCacheHandler->isSupport()) |
|
| 91 | + if ($oCacheHandler->isSupport()) |
|
| 92 | 92 | { |
| 93 | - $cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl; |
|
| 93 | + $cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl; |
|
| 94 | 94 | $document_item = $oCacheHandler->get($cache_key); |
| 95 | - if($document_item !== false) |
|
| 95 | + if ($document_item !== false) |
|
| 96 | 96 | { |
| 97 | 97 | $columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count'); |
| 98 | 98 | } |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | $args->document_srl = $this->document_srl; |
| 103 | 103 | $output = executeQuery('document.getDocument', $args, $columnList); |
| 104 | 104 | |
| 105 | - if($document_item === false) |
|
| 105 | + if ($document_item === false) |
|
| 106 | 106 | { |
| 107 | 107 | $document_item = $output->data; |
| 108 | 108 | |
| 109 | 109 | //insert in cache |
| 110 | - if($document_item && $oCacheHandler->isSupport()) |
|
| 110 | + if ($document_item && $oCacheHandler->isSupport()) |
|
| 111 | 111 | { |
| 112 | 112 | $oCacheHandler->put($cache_key, $document_item); |
| 113 | 113 | } |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | $this->setAttribute($document_item, $load_extra_vars); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - function setAttribute($attribute, $load_extra_vars=true) |
|
| 127 | + function setAttribute($attribute, $load_extra_vars = true) |
|
| 128 | 128 | { |
| 129 | - if(!$attribute->document_srl) |
|
| 129 | + if (!$attribute->document_srl) |
|
| 130 | 130 | { |
| 131 | 131 | $this->document_srl = null; |
| 132 | 132 | return; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $this->adds($attribute); |
| 137 | 137 | |
| 138 | 138 | // Tags |
| 139 | - if($this->get('tags')) |
|
| 139 | + if ($this->get('tags')) |
|
| 140 | 140 | { |
| 141 | 141 | $tag_list = explode(',', $this->get('tags')); |
| 142 | 142 | $tag_list = array_map('trim', $tag_list); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $oDocumentModel = getModel('document'); |
| 147 | - if($load_extra_vars) |
|
| 147 | + if ($load_extra_vars) |
|
| 148 | 148 | { |
| 149 | 149 | $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this; |
| 150 | 150 | $oDocumentModel->setToAllDocumentExtraVars(); |
@@ -159,23 +159,23 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | function isGranted() |
| 161 | 161 | { |
| 162 | - if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true; |
|
| 162 | + if ($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true; |
|
| 163 | 163 | |
| 164 | - if($this->grant_cache !== null) |
|
| 164 | + if ($this->grant_cache !== null) |
|
| 165 | 165 | { |
| 166 | 166 | return $this->grant_cache; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if(!Context::get('is_logged')) return $this->grant_cache = false; |
|
| 169 | + if (!Context::get('is_logged')) return $this->grant_cache = false; |
|
| 170 | 170 | |
| 171 | 171 | $logged_info = Context::get('logged_info'); |
| 172 | - if($logged_info->is_admin == 'Y') return $this->grant_cache = true; |
|
| 172 | + if ($logged_info->is_admin == 'Y') return $this->grant_cache = true; |
|
| 173 | 173 | |
| 174 | 174 | $oModuleModel = getModel('module'); |
| 175 | 175 | $grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info); |
| 176 | - if($grant->manager) return $this->grant_cache = true; |
|
| 176 | + if ($grant->manager) return $this->grant_cache = true; |
|
| 177 | 177 | |
| 178 | - if($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl) |
|
| 178 | + if ($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl) |
|
| 179 | 179 | { |
| 180 | 180 | return $this->grant_cache = true; |
| 181 | 181 | } |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | function isAccessible() |
| 193 | 193 | { |
| 194 | - return $_SESSION['accessible'][$this->document_srl]==true?true:false; |
|
| 194 | + return $_SESSION['accessible'][$this->document_srl] == true ?true:false; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | function allowComment() |
| 198 | 198 | { |
| 199 | 199 | // init write, document is not exists. so allow comment status is true |
| 200 | - if(!$this->isExists()) return true; |
|
| 200 | + if (!$this->isExists()) return true; |
|
| 201 | 201 | |
| 202 | 202 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
| 203 | 203 | } |
@@ -205,11 +205,11 @@ discard block |
||
| 205 | 205 | function allowTrackback() |
| 206 | 206 | { |
| 207 | 207 | static $allow_trackback_status = null; |
| 208 | - if(is_null($allow_trackback_status)) |
|
| 208 | + if (is_null($allow_trackback_status)) |
|
| 209 | 209 | { |
| 210 | 210 | |
| 211 | 211 | // Check the tarckback module exist |
| 212 | - if(!getClass('trackback')) |
|
| 212 | + if (!getClass('trackback')) |
|
| 213 | 213 | { |
| 214 | 214 | $allow_trackback_status = false; |
| 215 | 215 | } |
@@ -219,20 +219,20 @@ discard block |
||
| 219 | 219 | $oModuleModel = getModel('module'); |
| 220 | 220 | $trackback_config = $oModuleModel->getModuleConfig('trackback'); |
| 221 | 221 | |
| 222 | - if(!$trackback_config) |
|
| 222 | + if (!$trackback_config) |
|
| 223 | 223 | { |
| 224 | 224 | $trackback_config = new stdClass(); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 228 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 227 | + if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 228 | + if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 229 | 229 | else |
| 230 | 230 | { |
| 231 | 231 | $module_srl = $this->get('module_srl'); |
| 232 | 232 | // Check settings of each module |
| 233 | 233 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
| 234 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 235 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 234 | + if ($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 235 | + else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | } |
@@ -241,14 +241,14 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | function isLocked() |
| 243 | 243 | { |
| 244 | - if(!$this->isExists()) return false; |
|
| 244 | + if (!$this->isExists()) return false; |
|
| 245 | 245 | |
| 246 | 246 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | function isEditable() |
| 250 | 250 | { |
| 251 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 251 | + if ($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 252 | 252 | return false; |
| 253 | 253 | } |
| 254 | 254 | |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | function useNotify() |
| 267 | 267 | { |
| 268 | - return $this->get('notify_message')=='Y' ? true : false; |
|
| 268 | + return $this->get('notify_message') == 'Y' ? true : false; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | function doCart() |
| 272 | 272 | { |
| 273 | - if(!$this->document_srl) return false; |
|
| 274 | - if($this->isCarted()) $this->removeCart(); |
|
| 273 | + if (!$this->document_srl) return false; |
|
| 274 | + if ($this->isCarted()) $this->removeCart(); |
|
| 275 | 275 | else $this->addCart(); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -298,18 +298,18 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | function notify($type, $content) |
| 300 | 300 | { |
| 301 | - if(!$this->document_srl) return; |
|
| 301 | + if (!$this->document_srl) return; |
|
| 302 | 302 | // return if it is not useNotify |
| 303 | - if(!$this->useNotify()) return; |
|
| 303 | + if (!$this->useNotify()) return; |
|
| 304 | 304 | // Pass if an author is not a logged-in user |
| 305 | - if(!$this->get('member_srl')) return; |
|
| 305 | + if (!$this->get('member_srl')) return; |
|
| 306 | 306 | // Return if the currently logged-in user is an author |
| 307 | 307 | $logged_info = Context::get('logged_info'); |
| 308 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 308 | + if ($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 309 | 309 | // List variables |
| 310 | - if($type) $title = "[".$type."] "; |
|
| 310 | + if ($type) $title = "[".$type."] "; |
|
| 311 | 311 | $title .= cut_str(strip_tags($content), 10, '...'); |
| 312 | - $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); |
|
| 312 | + $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl)); |
|
| 313 | 313 | $receiver_srl = $this->get('member_srl'); |
| 314 | 314 | $sender_member_srl = $logged_info->member_srl; |
| 315 | 315 | // Send a message |
@@ -324,26 +324,26 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | function getIpAddress() |
| 326 | 326 | { |
| 327 | - if($this->isGranted()) |
|
| 327 | + if ($this->isGranted()) |
|
| 328 | 328 | { |
| 329 | 329 | return $this->get('ipaddress'); |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
| 332 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | function isExistsHomepage() |
| 336 | 336 | { |
| 337 | - if(trim($this->get('homepage'))) return true; |
|
| 337 | + if (trim($this->get('homepage'))) return true; |
|
| 338 | 338 | return false; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | function getHomepageUrl() |
| 342 | 342 | { |
| 343 | 343 | $url = trim($this->get('homepage')); |
| 344 | - if(!$url) return; |
|
| 344 | + if (!$url) return; |
|
| 345 | 345 | |
| 346 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
| 346 | + if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://'.$url; |
|
| 347 | 347 | |
| 348 | 348 | return $url; |
| 349 | 349 | } |
@@ -373,52 +373,52 @@ discard block |
||
| 373 | 373 | return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - function getTitleText($cut_size = 0, $tail='...') |
|
| 376 | + function getTitleText($cut_size = 0, $tail = '...') |
|
| 377 | 377 | { |
| 378 | - if(!$this->document_srl) return; |
|
| 378 | + if (!$this->document_srl) return; |
|
| 379 | 379 | |
| 380 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 380 | + if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 381 | 381 | else $title = $this->get('title'); |
| 382 | 382 | |
| 383 | 383 | return $title; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - function getTitle($cut_size = 0, $tail='...') |
|
| 386 | + function getTitle($cut_size = 0, $tail = '...') |
|
| 387 | 387 | { |
| 388 | - if(!$this->document_srl) return; |
|
| 388 | + if (!$this->document_srl) return; |
|
| 389 | 389 | |
| 390 | 390 | $title = $this->getTitleText($cut_size, $tail); |
| 391 | 391 | |
| 392 | 392 | $attrs = array(); |
| 393 | 393 | $this->add('title_color', trim($this->get('title_color'))); |
| 394 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
| 395 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 394 | + if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;"; |
|
| 395 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 396 | 396 | |
| 397 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 397 | + if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 398 | 398 | else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | function getContentText($strlen = 0) |
| 402 | 402 | { |
| 403 | - if(!$this->document_srl) return; |
|
| 403 | + if (!$this->document_srl) return; |
|
| 404 | 404 | |
| 405 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 405 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 406 | 406 | |
| 407 | 407 | $result = $this->_checkAccessibleFromStatus(); |
| 408 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 408 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 409 | 409 | |
| 410 | 410 | $content = $this->get('content'); |
| 411 | 411 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
| 412 | 412 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
| 413 | 413 | |
| 414 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
| 414 | + if ($strlen) return cut_str(strip_tags($content), $strlen, '...'); |
|
| 415 | 415 | |
| 416 | 416 | return htmlspecialchars($content); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | function _addAllowScriptAccess($m) |
| 420 | 420 | { |
| 421 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 421 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 422 | 422 | { |
| 423 | 423 | $m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>'; |
| 424 | 424 | } |
@@ -428,26 +428,26 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | function _checkAllowScriptAccess($m) |
| 430 | 430 | { |
| 431 | - if($m[1] == 'object') |
|
| 431 | + if ($m[1] == 'object') |
|
| 432 | 432 | { |
| 433 | 433 | $this->allowscriptaccessList[] = 1; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | - if($m[1] == 'param') |
|
| 436 | + if ($m[1] == 'param') |
|
| 437 | 437 | { |
| 438 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 438 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 439 | 439 | { |
| 440 | 440 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
| 441 | - if(substr($m[0], -1) == '/') |
|
| 441 | + if (substr($m[0], -1) == '/') |
|
| 442 | 442 | { |
| 443 | 443 | $m[0] .= '/'; |
| 444 | 444 | } |
| 445 | - $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
|
| 445 | + $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
|
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | - else if($m[1] == 'embed') |
|
| 448 | + else if ($m[1] == 'embed') |
|
| 449 | 449 | { |
| 450 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 450 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 451 | 451 | { |
| 452 | 452 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 453 | 453 | } |
@@ -461,24 +461,24 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
| 463 | 463 | { |
| 464 | - if(!$this->document_srl) return; |
|
| 464 | + if (!$this->document_srl) return; |
|
| 465 | 465 | |
| 466 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 466 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 467 | 467 | |
| 468 | 468 | $result = $this->_checkAccessibleFromStatus(); |
| 469 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 469 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 470 | 470 | |
| 471 | 471 | $content = $this->get('content'); |
| 472 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 472 | + if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 473 | 473 | |
| 474 | 474 | // Define a link if using a rewrite module |
| 475 | 475 | $oContext = &Context::getInstance(); |
| 476 | - if($oContext->allow_rewrite) |
|
| 476 | + if ($oContext->allow_rewrite) |
|
| 477 | 477 | { |
| 478 | - $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content); |
|
| 478 | + $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content); |
|
| 479 | 479 | } |
| 480 | 480 | // To display a pop-up menu |
| 481 | - if($add_popup_menu) |
|
| 481 | + if ($add_popup_menu) |
|
| 482 | 482 | { |
| 483 | 483 | $content = sprintf( |
| 484 | 484 | '%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>', |
@@ -487,10 +487,10 @@ discard block |
||
| 487 | 487 | ); |
| 488 | 488 | } |
| 489 | 489 | // If additional content information is set |
| 490 | - if($add_content_info) |
|
| 490 | + if ($add_content_info) |
|
| 491 | 491 | { |
| 492 | 492 | $memberSrl = $this->get('member_srl'); |
| 493 | - if($memberSrl < 0) |
|
| 493 | + if ($memberSrl < 0) |
|
| 494 | 494 | { |
| 495 | 495 | $memberSrl = 0; |
| 496 | 496 | } |
@@ -506,12 +506,12 @@ discard block |
||
| 506 | 506 | } |
| 507 | 507 | else |
| 508 | 508 | { |
| 509 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 509 | + if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 510 | 510 | } |
| 511 | 511 | // Change the image path to a valid absolute path if resource_realpath is true |
| 512 | - if($resource_realpath) |
|
| 512 | + if ($resource_realpath) |
|
| 513 | 513 | { |
| 514 | - $content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content); |
|
| 514 | + $content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | return $content; |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | $content = trim(cut_str($content, $str_size, $tail)); |
| 561 | 561 | |
| 562 | 562 | // Replace back < , <, " |
| 563 | - $content = str_replace(array('<', '>', '"'),array('<', '>', '"'), $content); |
|
| 563 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
| 564 | 564 | |
| 565 | 565 | return $content; |
| 566 | 566 | } |
@@ -573,13 +573,13 @@ discard block |
||
| 573 | 573 | function getRegdateTime() |
| 574 | 574 | { |
| 575 | 575 | $regdate = $this->get('regdate'); |
| 576 | - $year = substr($regdate,0,4); |
|
| 577 | - $month = substr($regdate,4,2); |
|
| 578 | - $day = substr($regdate,6,2); |
|
| 579 | - $hour = substr($regdate,8,2); |
|
| 580 | - $min = substr($regdate,10,2); |
|
| 581 | - $sec = substr($regdate,12,2); |
|
| 582 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
| 576 | + $year = substr($regdate, 0, 4); |
|
| 577 | + $month = substr($regdate, 4, 2); |
|
| 578 | + $day = substr($regdate, 6, 2); |
|
| 579 | + $hour = substr($regdate, 8, 2); |
|
| 580 | + $min = substr($regdate, 10, 2); |
|
| 581 | + $sec = substr($regdate, 12, 2); |
|
| 582 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | function getRegdateGM() |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | function getRegdateDT() |
| 591 | 591 | { |
| 592 | - return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
| 592 | + return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -599,13 +599,13 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | function getUpdateTime() |
| 601 | 601 | { |
| 602 | - $year = substr($this->get('last_update'),0,4); |
|
| 603 | - $month = substr($this->get('last_update'),4,2); |
|
| 604 | - $day = substr($this->get('last_update'),6,2); |
|
| 605 | - $hour = substr($this->get('last_update'),8,2); |
|
| 606 | - $min = substr($this->get('last_update'),10,2); |
|
| 607 | - $sec = substr($this->get('last_update'),12,2); |
|
| 608 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
| 602 | + $year = substr($this->get('last_update'), 0, 4); |
|
| 603 | + $month = substr($this->get('last_update'), 4, 2); |
|
| 604 | + $day = substr($this->get('last_update'), 6, 2); |
|
| 605 | + $hour = substr($this->get('last_update'), 8, 2); |
|
| 606 | + $min = substr($this->get('last_update'), 10, 2); |
|
| 607 | + $sec = substr($this->get('last_update'), 12, 2); |
|
| 608 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | function getUpdateGM() |
@@ -615,21 +615,21 @@ discard block |
||
| 615 | 615 | |
| 616 | 616 | function getUpdateDT() |
| 617 | 617 | { |
| 618 | - return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
| 618 | + return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | function getPermanentUrl() |
| 622 | 622 | { |
| 623 | - return getFullUrl('','mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl')); |
|
| 623 | + return getFullUrl('', 'mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl')); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | function getTrackbackUrl() |
| 627 | 627 | { |
| 628 | - if(!$this->document_srl) return; |
|
| 628 | + if (!$this->document_srl) return; |
|
| 629 | 629 | |
| 630 | 630 | // Generate a key to prevent spams |
| 631 | 631 | $oTrackbackModel = getModel('trackback'); |
| 632 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 632 | + if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | /** |
@@ -639,24 +639,24 @@ discard block |
||
| 639 | 639 | function updateReadedCount() |
| 640 | 640 | { |
| 641 | 641 | $oDocumentController = getController('document'); |
| 642 | - if($oDocumentController->updateReadedCount($this)) |
|
| 642 | + if ($oDocumentController->updateReadedCount($this)) |
|
| 643 | 643 | { |
| 644 | 644 | $readed_count = $this->get('readed_count'); |
| 645 | - $this->add('readed_count', $readed_count+1); |
|
| 645 | + $this->add('readed_count', $readed_count + 1); |
|
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | function isExtraVarsExists() |
| 650 | 650 | { |
| 651 | - if(!$this->get('module_srl')) return false; |
|
| 651 | + if (!$this->get('module_srl')) return false; |
|
| 652 | 652 | $oDocumentModel = getModel('document'); |
| 653 | 653 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
| 654 | - return count($extra_keys)?true:false; |
|
| 654 | + return count($extra_keys) ?true:false; |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | function getExtraVars() |
| 658 | 658 | { |
| 659 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 659 | + if (!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 660 | 660 | |
| 661 | 661 | $oDocumentModel = getModel('document'); |
| 662 | 662 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | function getExtraValue($idx) |
| 666 | 666 | { |
| 667 | 667 | $extra_vars = $this->getExtraVars(); |
| 668 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
| 668 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
| 669 | 669 | { |
| 670 | 670 | return $extra_vars[$idx]->getValue(); |
| 671 | 671 | } |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | function getExtraValueHTML($idx) |
| 679 | 679 | { |
| 680 | 680 | $extra_vars = $this->getExtraVars(); |
| 681 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
| 681 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
| 682 | 682 | { |
| 683 | 683 | return $extra_vars[$idx]->getValueHTML(); |
| 684 | 684 | } |
@@ -692,16 +692,16 @@ discard block |
||
| 692 | 692 | { |
| 693 | 693 | $extra_vars = $this->getExtraVars(); |
| 694 | 694 | |
| 695 | - if($extra_vars) |
|
| 695 | + if ($extra_vars) |
|
| 696 | 696 | { |
| 697 | 697 | // Handle extra variable(eid) |
| 698 | - foreach($extra_vars as $idx => $key) |
|
| 698 | + foreach ($extra_vars as $idx => $key) |
|
| 699 | 699 | { |
| 700 | 700 | $extra_eid[$key->eid] = $key; |
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
| 704 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
| 705 | 705 | { |
| 706 | 706 | return $extra_eid[$eid]->getValue(); |
| 707 | 707 | } |
@@ -715,12 +715,12 @@ discard block |
||
| 715 | 715 | { |
| 716 | 716 | $extra_vars = $this->getExtraVars(); |
| 717 | 717 | // Handle extra variable(eid) |
| 718 | - foreach($extra_vars as $idx => $key) |
|
| 718 | + foreach ($extra_vars as $idx => $key) |
|
| 719 | 719 | { |
| 720 | 720 | $extra_eid[$key->eid] = $key; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
| 723 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
| 724 | 724 | { |
| 725 | 725 | return $extra_eid[$eid]->getValueHTML(); |
| 726 | 726 | } |
@@ -744,13 +744,13 @@ discard block |
||
| 744 | 744 | |
| 745 | 745 | function getComments() |
| 746 | 746 | { |
| 747 | - if(!$this->getCommentCount()) return; |
|
| 748 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
| 747 | + if (!$this->getCommentCount()) return; |
|
| 748 | + if (!$this->isGranted() && $this->isSecret()) return; |
|
| 749 | 749 | // cpage is a number of comment pages |
| 750 | 750 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
| 751 | 751 | $cpage = Context::get($cpageStr); |
| 752 | 752 | |
| 753 | - if(!$cpage) |
|
| 753 | + if (!$cpage) |
|
| 754 | 754 | { |
| 755 | 755 | $cpage = Context::get('cpage'); |
| 756 | 756 | } |
@@ -758,19 +758,19 @@ discard block |
||
| 758 | 758 | // Get a list of comments |
| 759 | 759 | $oCommentModel = getModel('comment'); |
| 760 | 760 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
| 761 | - if(!$output->toBool() || !count($output->data)) return; |
|
| 761 | + if (!$output->toBool() || !count($output->data)) return; |
|
| 762 | 762 | // Create commentItem object from a comment list |
| 763 | 763 | // If admin priviledge is granted on parent posts, you can read its child posts. |
| 764 | 764 | $accessible = array(); |
| 765 | 765 | $comment_list = array(); |
| 766 | - foreach($output->data as $key => $val) |
|
| 766 | + foreach ($output->data as $key => $val) |
|
| 767 | 767 | { |
| 768 | 768 | $oCommentItem = new commentItem(); |
| 769 | 769 | $oCommentItem->setAttribute($val); |
| 770 | 770 | // If permission is granted to the post, you can access it temporarily |
| 771 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 771 | + if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 772 | 772 | // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post |
| 773 | - if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
|
| 773 | + if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) |
|
| 774 | 774 | { |
| 775 | 775 | $oCommentItem->setAccessible(); |
| 776 | 776 | } |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | // Variable setting to be displayed on the skin |
| 780 | 780 | Context::set($cpageStr, $output->page_navigation->cur_page); |
| 781 | 781 | Context::set('cpage', $output->page_navigation->cur_page); |
| 782 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
| 782 | + if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation; |
|
| 783 | 783 | |
| 784 | 784 | return $comment_list; |
| 785 | 785 | } |
@@ -791,9 +791,9 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | function getTrackbacks() |
| 793 | 793 | { |
| 794 | - if(!$this->document_srl) return; |
|
| 794 | + if (!$this->document_srl) return; |
|
| 795 | 795 | |
| 796 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 796 | + if (!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 797 | 797 | |
| 798 | 798 | $oTrackbackModel = getModel('trackback'); |
| 799 | 799 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -801,47 +801,47 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 803 | 803 | { |
| 804 | - if(!$this->document_srl) return false; |
|
| 805 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 804 | + if (!$this->document_srl) return false; |
|
| 805 | + if (!$this->getThumbnail($width, $height, $type)) return false; |
|
| 806 | 806 | return true; |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 810 | 810 | { |
| 811 | 811 | // Return false if the document doesn't exist |
| 812 | - if(!$this->document_srl) return; |
|
| 812 | + if (!$this->document_srl) return; |
|
| 813 | 813 | |
| 814 | - if($this->isSecret() && !$this->isGranted()) |
|
| 814 | + if ($this->isSecret() && !$this->isGranted()) |
|
| 815 | 815 | { |
| 816 | 816 | return; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | // If not specify its height, create a square |
| 820 | - if(!$height) $height = $width; |
|
| 820 | + if (!$height) $height = $width; |
|
| 821 | 821 | |
| 822 | 822 | // Return false if neither attachement nor image files in the document |
| 823 | 823 | $content = $this->get('content'); |
| 824 | - if(!$this->get('uploaded_count')) |
|
| 824 | + if (!$this->get('uploaded_count')) |
|
| 825 | 825 | { |
| 826 | - if(!$content) |
|
| 826 | + if (!$content) |
|
| 827 | 827 | { |
| 828 | 828 | $args = new stdClass(); |
| 829 | 829 | $args->document_srl = $this->document_srl; |
| 830 | 830 | $output = executeQuery('document.getDocument', $args, array('content')); |
| 831 | - if($output->toBool() && $output->data) |
|
| 831 | + if ($output->toBool() && $output->data) |
|
| 832 | 832 | { |
| 833 | 833 | $content = $output->data->content; |
| 834 | 834 | $this->add('content', $content); |
| 835 | 835 | } |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - if(!preg_match("!<img!is", $content)) return; |
|
| 838 | + if (!preg_match("!<img!is", $content)) return; |
|
| 839 | 839 | } |
| 840 | 840 | // Get thumbnai_type information from document module's configuration |
| 841 | - if(!in_array($thumbnail_type, array('crop','ratio'))) |
|
| 841 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
| 842 | 842 | { |
| 843 | 843 | $config = $GLOBALS['__document_config__']; |
| 844 | - if(!$config) |
|
| 844 | + if (!$config) |
|
| 845 | 845 | { |
| 846 | 846 | $oDocumentModel = getModel('document'); |
| 847 | 847 | $config = $oDocumentModel->getDocumentConfig(); |
@@ -851,21 +851,21 @@ discard block |
||
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | // Define thumbnail information |
| 854 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3)); |
|
| 854 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3)); |
|
| 855 | 855 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
| 856 | 856 | $thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type); |
| 857 | 857 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
| 858 | 858 | |
| 859 | 859 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
| 860 | - if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
| 860 | + if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
| 861 | 861 | { |
| 862 | - if(filesize($thumbnail_file) < 1) |
|
| 862 | + if (filesize($thumbnail_file) < 1) |
|
| 863 | 863 | { |
| 864 | 864 | return FALSE; |
| 865 | 865 | } |
| 866 | 866 | else |
| 867 | 867 | { |
| 868 | - return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
|
| 868 | + return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file)); |
|
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | |
@@ -877,64 +877,64 @@ discard block |
||
| 877 | 877 | $is_tmp_file = false; |
| 878 | 878 | |
| 879 | 879 | // Find an iamge file among attached files if exists |
| 880 | - if($this->hasUploadedFiles()) |
|
| 880 | + if ($this->hasUploadedFiles()) |
|
| 881 | 881 | { |
| 882 | 882 | $file_list = $this->getUploadedFiles(); |
| 883 | 883 | |
| 884 | 884 | $first_image = null; |
| 885 | - foreach($file_list as $file) |
|
| 885 | + foreach ($file_list as $file) |
|
| 886 | 886 | { |
| 887 | - if($file->direct_download !== 'Y') continue; |
|
| 887 | + if ($file->direct_download !== 'Y') continue; |
|
| 888 | 888 | |
| 889 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 889 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 890 | 890 | { |
| 891 | 891 | $source_file = $file->uploaded_filename; |
| 892 | 892 | break; |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | - if($first_image) continue; |
|
| 895 | + if ($first_image) continue; |
|
| 896 | 896 | |
| 897 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 897 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 898 | 898 | { |
| 899 | - if(file_exists($file->uploaded_filename)) |
|
| 899 | + if (file_exists($file->uploaded_filename)) |
|
| 900 | 900 | { |
| 901 | 901 | $first_image = $file->uploaded_filename; |
| 902 | 902 | } |
| 903 | 903 | } |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | - if(!$source_file && $first_image) |
|
| 906 | + if (!$source_file && $first_image) |
|
| 907 | 907 | { |
| 908 | 908 | $source_file = $first_image; |
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | // If not exists, file an image file from the content |
| 912 | 912 | $is_tmp_file = false; |
| 913 | - if(!$source_file) |
|
| 913 | + if (!$source_file) |
|
| 914 | 914 | { |
| 915 | 915 | $random = new Password(); |
| 916 | 916 | |
| 917 | 917 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
| 918 | 918 | |
| 919 | - foreach($matches as $target_image) |
|
| 919 | + foreach ($matches as $target_image) |
|
| 920 | 920 | { |
| 921 | 921 | $target_src = trim($target_image[1]); |
| 922 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 922 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 923 | 923 | |
| 924 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
| 924 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
| 925 | 925 | { |
| 926 | 926 | $target_src = Context::getRequestUri().$target_src; |
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | $target_src = htmlspecialchars_decode($target_src); |
| 930 | 930 | |
| 931 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
| 931 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
| 932 | 932 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 933 | - if(!file_exists($tmp_file)) continue; |
|
| 933 | + if (!file_exists($tmp_file)) continue; |
|
| 934 | 934 | |
| 935 | 935 | $imageinfo = getimagesize($tmp_file); |
| 936 | 936 | list($_w, $_h) = $imageinfo; |
| 937 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 937 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 938 | 938 | FileHandler::removeFile($tmp_file); |
| 939 | 939 | continue; |
| 940 | 940 | } |
@@ -945,13 +945,13 @@ discard block |
||
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | - if($source_file) |
|
| 948 | + if ($source_file) |
|
| 949 | 949 | { |
| 950 | 950 | $output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | // Remove source file if it was temporary |
| 954 | - if($is_tmp_file) |
|
| 954 | + if ($is_tmp_file) |
|
| 955 | 955 | { |
| 956 | 956 | FileHandler::removeFile($source_file); |
| 957 | 957 | } |
@@ -960,12 +960,12 @@ discard block |
||
| 960 | 960 | FileHandler::removeFile($thumbnail_lockfile); |
| 961 | 961 | |
| 962 | 962 | // Create an empty file if thumbnail generation failed |
| 963 | - if(!$output_file) |
|
| 963 | + if (!$output_file) |
|
| 964 | 964 | { |
| 965 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 965 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | - return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
|
| 968 | + return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file)); |
|
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | /** |
@@ -976,21 +976,21 @@ discard block |
||
| 976 | 976 | */ |
| 977 | 977 | function getExtraImages($time_interval = 43200) |
| 978 | 978 | { |
| 979 | - if(!$this->document_srl) return; |
|
| 979 | + if (!$this->document_srl) return; |
|
| 980 | 980 | // variables for icon list |
| 981 | 981 | $buffs = array(); |
| 982 | 982 | |
| 983 | 983 | $check_files = false; |
| 984 | 984 | |
| 985 | 985 | // Check if secret post is |
| 986 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 986 | + if ($this->isSecret()) $buffs[] = "secret"; |
|
| 987 | 987 | |
| 988 | 988 | // Set the latest time |
| 989 | - $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
|
| 989 | + $time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval); |
|
| 990 | 990 | |
| 991 | 991 | // Check new post |
| 992 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 993 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 992 | + if ($this->get('regdate') > $time_check) $buffs[] = "new"; |
|
| 993 | + else if ($this->get('last_update') > $time_check) $buffs[] = "update"; |
|
| 994 | 994 | |
| 995 | 995 | /* |
| 996 | 996 | $content = $this->get('content'); |
@@ -1013,14 +1013,14 @@ discard block |
||
| 1013 | 1013 | */ |
| 1014 | 1014 | |
| 1015 | 1015 | // Check the attachment |
| 1016 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1016 | + if ($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1017 | 1017 | |
| 1018 | 1018 | return $buffs; |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | function getStatus() |
| 1022 | 1022 | { |
| 1023 | - if(!$this->get('status')) { |
|
| 1023 | + if (!$this->get('status')) { |
|
| 1024 | 1024 | $oDocumentClass = getClass('document'); |
| 1025 | 1025 | return $oDocumentClass->getDefaultStatus(); |
| 1026 | 1026 | } |
@@ -1034,11 +1034,11 @@ discard block |
||
| 1034 | 1034 | */ |
| 1035 | 1035 | function printExtraImages($time_check = 43200) |
| 1036 | 1036 | { |
| 1037 | - if(!$this->document_srl) return; |
|
| 1037 | + if (!$this->document_srl) return; |
|
| 1038 | 1038 | |
| 1039 | 1039 | $oDocumentModel = getModel('document'); |
| 1040 | 1040 | $documentConfig = $oDocumentModel->getDocumentConfig(); |
| 1041 | - if(Mobile::isFromMobilePhone()) |
|
| 1041 | + if (Mobile::isFromMobilePhone()) |
|
| 1042 | 1042 | { |
| 1043 | 1043 | $iconSkin = $documentConfig->micons; |
| 1044 | 1044 | } |
@@ -1046,13 +1046,13 @@ discard block |
||
| 1046 | 1046 | { |
| 1047 | 1047 | $iconSkin = $documentConfig->icons; |
| 1048 | 1048 | } |
| 1049 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1049 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1050 | 1050 | |
| 1051 | 1051 | $buffs = $this->getExtraImages($time_check); |
| 1052 | - if(!count($buffs)) return; |
|
| 1052 | + if (!count($buffs)) return; |
|
| 1053 | 1053 | |
| 1054 | 1054 | $buff = array(); |
| 1055 | - foreach($buffs as $key => $val) |
|
| 1055 | + foreach ($buffs as $key => $val) |
|
| 1056 | 1056 | { |
| 1057 | 1057 | $buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val); |
| 1058 | 1058 | } |
@@ -1061,20 +1061,20 @@ discard block |
||
| 1061 | 1061 | |
| 1062 | 1062 | function hasUploadedFiles() |
| 1063 | 1063 | { |
| 1064 | - if(!$this->document_srl) return; |
|
| 1064 | + if (!$this->document_srl) return; |
|
| 1065 | 1065 | |
| 1066 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1067 | - return $this->get('uploaded_count')? true : false; |
|
| 1066 | + if ($this->isSecret() && !$this->isGranted()) return false; |
|
| 1067 | + return $this->get('uploaded_count') ? true : false; |
|
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1071 | 1071 | { |
| 1072 | - if(!$this->document_srl) return; |
|
| 1072 | + if (!$this->document_srl) return; |
|
| 1073 | 1073 | |
| 1074 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1075 | - if(!$this->get('uploaded_count')) return; |
|
| 1074 | + if ($this->isSecret() && !$this->isGranted()) return; |
|
| 1075 | + if (!$this->get('uploaded_count')) return; |
|
| 1076 | 1076 | |
| 1077 | - if(!$this->uploadedFiles[$sortIndex]) |
|
| 1077 | + if (!$this->uploadedFiles[$sortIndex]) |
|
| 1078 | 1078 | { |
| 1079 | 1079 | $oFileModel = getModel('file'); |
| 1080 | 1080 | $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true); |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | function getEditor() |
| 1091 | 1091 | { |
| 1092 | 1092 | $module_srl = $this->get('module_srl'); |
| 1093 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1093 | + if (!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1094 | 1094 | |
| 1095 | 1095 | $oEditorModel = getModel('editor'); |
| 1096 | 1096 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | { |
| 1106 | 1106 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1107 | 1107 | if (!$this->allowComment()) return false; |
| 1108 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1108 | + if (!$this->isGranted() && $this->isSecret()) return false; |
|
| 1109 | 1109 | |
| 1110 | 1110 | return true; |
| 1111 | 1111 | } |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | */ |
| 1117 | 1117 | function getCommentEditor() |
| 1118 | 1118 | { |
| 1119 | - if(!$this->isEnableComment()) return; |
|
| 1119 | + if (!$this->isEnableComment()) return; |
|
| 1120 | 1120 | |
| 1121 | 1121 | $oEditorModel = getModel('editor'); |
| 1122 | 1122 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1128,10 +1128,10 @@ discard block |
||
| 1128 | 1128 | */ |
| 1129 | 1129 | function getProfileImage() |
| 1130 | 1130 | { |
| 1131 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1131 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1132 | 1132 | $oMemberModel = getModel('member'); |
| 1133 | 1133 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1134 | - if(!$profile_info) return; |
|
| 1134 | + if (!$profile_info) return; |
|
| 1135 | 1135 | |
| 1136 | 1136 | return $profile_info->src; |
| 1137 | 1137 | } |
@@ -1143,21 +1143,21 @@ discard block |
||
| 1143 | 1143 | function getSignature() |
| 1144 | 1144 | { |
| 1145 | 1145 | // Pass if a document doesn't exist |
| 1146 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1146 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1147 | 1147 | // Get signature information |
| 1148 | 1148 | $oMemberModel = getModel('member'); |
| 1149 | 1149 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
| 1150 | 1150 | // Check if a maximum height of signiture is set in the member module |
| 1151 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1151 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1152 | 1152 | { |
| 1153 | 1153 | $oModuleModel = getModel('module'); |
| 1154 | 1154 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1155 | 1155 | $GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height; |
| 1156 | 1156 | } |
| 1157 | - if($signature) |
|
| 1157 | + if ($signature) |
|
| 1158 | 1158 | { |
| 1159 | 1159 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1160 | - if($max_signature_height) $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); |
|
| 1160 | + if ($max_signature_height) $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); |
|
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | 1163 | return $signature; |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | */ |
| 1171 | 1171 | function replaceResourceRealPath($matches) |
| 1172 | 1172 | { |
| 1173 | - return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1173 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | /** |
@@ -1181,19 +1181,19 @@ discard block |
||
| 1181 | 1181 | function _checkAccessibleFromStatus() |
| 1182 | 1182 | { |
| 1183 | 1183 | $logged_info = Context::get('logged_info'); |
| 1184 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1184 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 1185 | 1185 | |
| 1186 | 1186 | $status = $this->get('status'); |
| 1187 | - if(empty($status)) return false; |
|
| 1187 | + if (empty($status)) return false; |
|
| 1188 | 1188 | |
| 1189 | 1189 | $oDocumentModel = getModel('document'); |
| 1190 | 1190 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1191 | 1191 | |
| 1192 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1192 | + if ($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1193 | 1193 | return true; |
| 1194 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1194 | + else if ($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1195 | 1195 | { |
| 1196 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1196 | + if ($this->get('member_srl') == $logged_info->member_srl) |
|
| 1197 | 1197 | return true; |
| 1198 | 1198 | } |
| 1199 | 1199 | return false; |
@@ -79,7 +79,9 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | function _loadFromDB($load_extra_vars = true) |
| 81 | 81 | { |
| 82 | - if(!$this->document_srl) return; |
|
| 82 | + if(!$this->document_srl) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 83 | 85 | |
| 84 | 86 | $document_item = false; |
| 85 | 87 | $cache_put = false; |
@@ -111,8 +113,7 @@ discard block |
||
| 111 | 113 | { |
| 112 | 114 | $oCacheHandler->put($cache_key, $document_item); |
| 113 | 115 | } |
| 114 | - } |
|
| 115 | - else |
|
| 116 | + } else |
|
| 116 | 117 | { |
| 117 | 118 | $document_item->readed_count = $output->data->readed_count; |
| 118 | 119 | $document_item->voted_count = $output->data->voted_count; |
@@ -159,21 +160,29 @@ discard block |
||
| 159 | 160 | |
| 160 | 161 | function isGranted() |
| 161 | 162 | { |
| 162 | - if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true; |
|
| 163 | + if($_SESSION['own_document'][$this->document_srl]) { |
|
| 164 | + return $this->grant_cache = true; |
|
| 165 | + } |
|
| 163 | 166 | |
| 164 | 167 | if($this->grant_cache !== null) |
| 165 | 168 | { |
| 166 | 169 | return $this->grant_cache; |
| 167 | 170 | } |
| 168 | 171 | |
| 169 | - if(!Context::get('is_logged')) return $this->grant_cache = false; |
|
| 172 | + if(!Context::get('is_logged')) { |
|
| 173 | + return $this->grant_cache = false; |
|
| 174 | + } |
|
| 170 | 175 | |
| 171 | 176 | $logged_info = Context::get('logged_info'); |
| 172 | - if($logged_info->is_admin == 'Y') return $this->grant_cache = true; |
|
| 177 | + if($logged_info->is_admin == 'Y') { |
|
| 178 | + return $this->grant_cache = true; |
|
| 179 | + } |
|
| 173 | 180 | |
| 174 | 181 | $oModuleModel = getModel('module'); |
| 175 | 182 | $grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info); |
| 176 | - if($grant->manager) return $this->grant_cache = true; |
|
| 183 | + if($grant->manager) { |
|
| 184 | + return $this->grant_cache = true; |
|
| 185 | + } |
|
| 177 | 186 | |
| 178 | 187 | if($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl) |
| 179 | 188 | { |
@@ -197,7 +206,9 @@ discard block |
||
| 197 | 206 | function allowComment() |
| 198 | 207 | { |
| 199 | 208 | // init write, document is not exists. so allow comment status is true |
| 200 | - if(!$this->isExists()) return true; |
|
| 209 | + if(!$this->isExists()) { |
|
| 210 | + return true; |
|
| 211 | + } |
|
| 201 | 212 | |
| 202 | 213 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
| 203 | 214 | } |
@@ -212,8 +223,7 @@ discard block |
||
| 212 | 223 | if(!getClass('trackback')) |
| 213 | 224 | { |
| 214 | 225 | $allow_trackback_status = false; |
| 215 | - } |
|
| 216 | - else |
|
| 226 | + } else |
|
| 217 | 227 | { |
| 218 | 228 | // If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module. |
| 219 | 229 | $oModuleModel = getModel('module'); |
@@ -224,15 +234,21 @@ discard block |
||
| 224 | 234 | $trackback_config = new stdClass(); |
| 225 | 235 | } |
| 226 | 236 | |
| 227 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 228 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 229 | - else |
|
| 237 | + if(!isset($trackback_config->enable_trackback)) { |
|
| 238 | + $trackback_config->enable_trackback = 'Y'; |
|
| 239 | + } |
|
| 240 | + if($trackback_config->enable_trackback != 'Y') { |
|
| 241 | + $allow_trackback_status = false; |
|
| 242 | + } else |
|
| 230 | 243 | { |
| 231 | 244 | $module_srl = $this->get('module_srl'); |
| 232 | 245 | // Check settings of each module |
| 233 | 246 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
| 234 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 235 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 247 | + if($module_config->enable_trackback == 'N') { |
|
| 248 | + $allow_trackback_status = false; |
|
| 249 | + } else if($this->get('allow_trackback')=='Y' || !$this->isExists()) { |
|
| 250 | + $allow_trackback_status = true; |
|
| 251 | + } |
|
| 236 | 252 | } |
| 237 | 253 | } |
| 238 | 254 | } |
@@ -241,14 +257,18 @@ discard block |
||
| 241 | 257 | |
| 242 | 258 | function isLocked() |
| 243 | 259 | { |
| 244 | - if(!$this->isExists()) return false; |
|
| 260 | + if(!$this->isExists()) { |
|
| 261 | + return false; |
|
| 262 | + } |
|
| 245 | 263 | |
| 246 | 264 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
| 247 | 265 | } |
| 248 | 266 | |
| 249 | 267 | function isEditable() |
| 250 | 268 | { |
| 251 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 269 | + if($this->isGranted() || !$this->get('member_srl')) { |
|
| 270 | + return true; |
|
| 271 | + } |
|
| 252 | 272 | return false; |
| 253 | 273 | } |
| 254 | 274 | |
@@ -270,9 +290,14 @@ discard block |
||
| 270 | 290 | |
| 271 | 291 | function doCart() |
| 272 | 292 | { |
| 273 | - if(!$this->document_srl) return false; |
|
| 274 | - if($this->isCarted()) $this->removeCart(); |
|
| 275 | - else $this->addCart(); |
|
| 293 | + if(!$this->document_srl) { |
|
| 294 | + return false; |
|
| 295 | + } |
|
| 296 | + if($this->isCarted()) { |
|
| 297 | + $this->removeCart(); |
|
| 298 | + } else { |
|
| 299 | + $this->addCart(); |
|
| 300 | + } |
|
| 276 | 301 | } |
| 277 | 302 | |
| 278 | 303 | function addCart() |
@@ -298,16 +323,26 @@ discard block |
||
| 298 | 323 | */ |
| 299 | 324 | function notify($type, $content) |
| 300 | 325 | { |
| 301 | - if(!$this->document_srl) return; |
|
| 326 | + if(!$this->document_srl) { |
|
| 327 | + return; |
|
| 328 | + } |
|
| 302 | 329 | // return if it is not useNotify |
| 303 | - if(!$this->useNotify()) return; |
|
| 330 | + if(!$this->useNotify()) { |
|
| 331 | + return; |
|
| 332 | + } |
|
| 304 | 333 | // Pass if an author is not a logged-in user |
| 305 | - if(!$this->get('member_srl')) return; |
|
| 334 | + if(!$this->get('member_srl')) { |
|
| 335 | + return; |
|
| 336 | + } |
|
| 306 | 337 | // Return if the currently logged-in user is an author |
| 307 | 338 | $logged_info = Context::get('logged_info'); |
| 308 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 339 | + if($logged_info->member_srl == $this->get('member_srl')) { |
|
| 340 | + return; |
|
| 341 | + } |
|
| 309 | 342 | // List variables |
| 310 | - if($type) $title = "[".$type."] "; |
|
| 343 | + if($type) { |
|
| 344 | + $title = "[".$type."] "; |
|
| 345 | + } |
|
| 311 | 346 | $title .= cut_str(strip_tags($content), 10, '...'); |
| 312 | 347 | $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); |
| 313 | 348 | $receiver_srl = $this->get('member_srl'); |
@@ -334,16 +369,22 @@ discard block |
||
| 334 | 369 | |
| 335 | 370 | function isExistsHomepage() |
| 336 | 371 | { |
| 337 | - if(trim($this->get('homepage'))) return true; |
|
| 372 | + if(trim($this->get('homepage'))) { |
|
| 373 | + return true; |
|
| 374 | + } |
|
| 338 | 375 | return false; |
| 339 | 376 | } |
| 340 | 377 | |
| 341 | 378 | function getHomepageUrl() |
| 342 | 379 | { |
| 343 | 380 | $url = trim($this->get('homepage')); |
| 344 | - if(!$url) return; |
|
| 381 | + if(!$url) { |
|
| 382 | + return; |
|
| 383 | + } |
|
| 345 | 384 | |
| 346 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
| 385 | + if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) { |
|
| 386 | + $url = 'http://' . $url; |
|
| 387 | + } |
|
| 347 | 388 | |
| 348 | 389 | return $url; |
| 349 | 390 | } |
@@ -375,43 +416,65 @@ discard block |
||
| 375 | 416 | |
| 376 | 417 | function getTitleText($cut_size = 0, $tail='...') |
| 377 | 418 | { |
| 378 | - if(!$this->document_srl) return; |
|
| 419 | + if(!$this->document_srl) { |
|
| 420 | + return; |
|
| 421 | + } |
|
| 379 | 422 | |
| 380 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 381 | - else $title = $this->get('title'); |
|
| 423 | + if($cut_size) { |
|
| 424 | + $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 425 | + } else { |
|
| 426 | + $title = $this->get('title'); |
|
| 427 | + } |
|
| 382 | 428 | |
| 383 | 429 | return $title; |
| 384 | 430 | } |
| 385 | 431 | |
| 386 | 432 | function getTitle($cut_size = 0, $tail='...') |
| 387 | 433 | { |
| 388 | - if(!$this->document_srl) return; |
|
| 434 | + if(!$this->document_srl) { |
|
| 435 | + return; |
|
| 436 | + } |
|
| 389 | 437 | |
| 390 | 438 | $title = $this->getTitleText($cut_size, $tail); |
| 391 | 439 | |
| 392 | 440 | $attrs = array(); |
| 393 | 441 | $this->add('title_color', trim($this->get('title_color'))); |
| 394 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
| 395 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 442 | + if($this->get('title_bold')=='Y') { |
|
| 443 | + $attrs[] = "font-weight:bold;"; |
|
| 444 | + } |
|
| 445 | + if($this->get('title_color') && $this->get('title_color') != 'N') { |
|
| 446 | + $attrs[] = "color:#".$this->get('title_color'); |
|
| 447 | + } |
|
| 396 | 448 | |
| 397 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 398 | - else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 449 | + if(count($attrs)) { |
|
| 450 | + return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 451 | + } else { |
|
| 452 | + return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 453 | + } |
|
| 399 | 454 | } |
| 400 | 455 | |
| 401 | 456 | function getContentText($strlen = 0) |
| 402 | 457 | { |
| 403 | - if(!$this->document_srl) return; |
|
| 458 | + if(!$this->document_srl) { |
|
| 459 | + return; |
|
| 460 | + } |
|
| 404 | 461 | |
| 405 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 462 | + if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) { |
|
| 463 | + return Context::getLang('msg_is_secret'); |
|
| 464 | + } |
|
| 406 | 465 | |
| 407 | 466 | $result = $this->_checkAccessibleFromStatus(); |
| 408 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 467 | + if($result) { |
|
| 468 | + $_SESSION['accessible'][$this->document_srl] = true; |
|
| 469 | + } |
|
| 409 | 470 | |
| 410 | 471 | $content = $this->get('content'); |
| 411 | 472 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
| 412 | 473 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
| 413 | 474 | |
| 414 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
| 475 | + if($strlen) { |
|
| 476 | + return cut_str(strip_tags($content),$strlen,'...'); |
|
| 477 | + } |
|
| 415 | 478 | |
| 416 | 479 | return htmlspecialchars($content); |
| 417 | 480 | } |
@@ -444,14 +507,12 @@ discard block |
||
| 444 | 507 | } |
| 445 | 508 | $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
| 446 | 509 | } |
| 447 | - } |
|
| 448 | - else if($m[1] == 'embed') |
|
| 510 | + } else if($m[1] == 'embed') |
|
| 449 | 511 | { |
| 450 | 512 | if(stripos($m[0], 'allowscriptaccess')) |
| 451 | 513 | { |
| 452 | 514 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 453 | - } |
|
| 454 | - else |
|
| 515 | + } else |
|
| 455 | 516 | { |
| 456 | 517 | $m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]); |
| 457 | 518 | } |
@@ -461,15 +522,23 @@ discard block |
||
| 461 | 522 | |
| 462 | 523 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
| 463 | 524 | { |
| 464 | - if(!$this->document_srl) return; |
|
| 525 | + if(!$this->document_srl) { |
|
| 526 | + return; |
|
| 527 | + } |
|
| 465 | 528 | |
| 466 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 529 | + if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) { |
|
| 530 | + return Context::getLang('msg_is_secret'); |
|
| 531 | + } |
|
| 467 | 532 | |
| 468 | 533 | $result = $this->_checkAccessibleFromStatus(); |
| 469 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 534 | + if($result) { |
|
| 535 | + $_SESSION['accessible'][$this->document_srl] = true; |
|
| 536 | + } |
|
| 470 | 537 | |
| 471 | 538 | $content = $this->get('content'); |
| 472 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 539 | + if(!$stripEmbedTagException) { |
|
| 540 | + stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 541 | + } |
|
| 473 | 542 | |
| 474 | 543 | // Define a link if using a rewrite module |
| 475 | 544 | $oContext = &Context::getInstance(); |
@@ -503,10 +572,11 @@ discard block |
||
| 503 | 572 | $this->document_srl, $memberSrl |
| 504 | 573 | ); |
| 505 | 574 | // Add xe_content class although accessing content is not required |
| 506 | - } |
|
| 507 | - else |
|
| 575 | + } else |
|
| 508 | 576 | { |
| 509 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 577 | + if($add_xe_content_class) { |
|
| 578 | + $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 579 | + } |
|
| 510 | 580 | } |
| 511 | 581 | // Change the image path to a valid absolute path if resource_realpath is true |
| 512 | 582 | if($resource_realpath) |
@@ -625,11 +695,15 @@ discard block |
||
| 625 | 695 | |
| 626 | 696 | function getTrackbackUrl() |
| 627 | 697 | { |
| 628 | - if(!$this->document_srl) return; |
|
| 698 | + if(!$this->document_srl) { |
|
| 699 | + return; |
|
| 700 | + } |
|
| 629 | 701 | |
| 630 | 702 | // Generate a key to prevent spams |
| 631 | 703 | $oTrackbackModel = getModel('trackback'); |
| 632 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 704 | + if($oTrackbackModel) { |
|
| 705 | + return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 706 | + } |
|
| 633 | 707 | } |
| 634 | 708 | |
| 635 | 709 | /** |
@@ -648,7 +722,9 @@ discard block |
||
| 648 | 722 | |
| 649 | 723 | function isExtraVarsExists() |
| 650 | 724 | { |
| 651 | - if(!$this->get('module_srl')) return false; |
|
| 725 | + if(!$this->get('module_srl')) { |
|
| 726 | + return false; |
|
| 727 | + } |
|
| 652 | 728 | $oDocumentModel = getModel('document'); |
| 653 | 729 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
| 654 | 730 | return count($extra_keys)?true:false; |
@@ -656,7 +732,9 @@ discard block |
||
| 656 | 732 | |
| 657 | 733 | function getExtraVars() |
| 658 | 734 | { |
| 659 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 735 | + if(!$this->get('module_srl') || !$this->document_srl) { |
|
| 736 | + return null; |
|
| 737 | + } |
|
| 660 | 738 | |
| 661 | 739 | $oDocumentModel = getModel('document'); |
| 662 | 740 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -668,8 +746,7 @@ discard block |
||
| 668 | 746 | if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
| 669 | 747 | { |
| 670 | 748 | return $extra_vars[$idx]->getValue(); |
| 671 | - } |
|
| 672 | - else |
|
| 749 | + } else |
|
| 673 | 750 | { |
| 674 | 751 | return ''; |
| 675 | 752 | } |
@@ -681,8 +758,7 @@ discard block |
||
| 681 | 758 | if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
| 682 | 759 | { |
| 683 | 760 | return $extra_vars[$idx]->getValueHTML(); |
| 684 | - } |
|
| 685 | - else |
|
| 761 | + } else |
|
| 686 | 762 | { |
| 687 | 763 | return ''; |
| 688 | 764 | } |
@@ -704,8 +780,7 @@ discard block |
||
| 704 | 780 | if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
| 705 | 781 | { |
| 706 | 782 | return $extra_eid[$eid]->getValue(); |
| 707 | - } |
|
| 708 | - else |
|
| 783 | + } else |
|
| 709 | 784 | { |
| 710 | 785 | return ''; |
| 711 | 786 | } |
@@ -723,8 +798,7 @@ discard block |
||
| 723 | 798 | if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
| 724 | 799 | { |
| 725 | 800 | return $extra_eid[$eid]->getValueHTML(); |
| 726 | - } |
|
| 727 | - else |
|
| 801 | + } else |
|
| 728 | 802 | { |
| 729 | 803 | return ''; |
| 730 | 804 | } |
@@ -744,8 +818,12 @@ discard block |
||
| 744 | 818 | |
| 745 | 819 | function getComments() |
| 746 | 820 | { |
| 747 | - if(!$this->getCommentCount()) return; |
|
| 748 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
| 821 | + if(!$this->getCommentCount()) { |
|
| 822 | + return; |
|
| 823 | + } |
|
| 824 | + if(!$this->isGranted() && $this->isSecret()) { |
|
| 825 | + return; |
|
| 826 | + } |
|
| 749 | 827 | // cpage is a number of comment pages |
| 750 | 828 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
| 751 | 829 | $cpage = Context::get($cpageStr); |
@@ -758,7 +836,9 @@ discard block |
||
| 758 | 836 | // Get a list of comments |
| 759 | 837 | $oCommentModel = getModel('comment'); |
| 760 | 838 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
| 761 | - if(!$output->toBool() || !count($output->data)) return; |
|
| 839 | + if(!$output->toBool() || !count($output->data)) { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 762 | 842 | // Create commentItem object from a comment list |
| 763 | 843 | // If admin priviledge is granted on parent posts, you can read its child posts. |
| 764 | 844 | $accessible = array(); |
@@ -768,7 +848,9 @@ discard block |
||
| 768 | 848 | $oCommentItem = new commentItem(); |
| 769 | 849 | $oCommentItem->setAttribute($val); |
| 770 | 850 | // If permission is granted to the post, you can access it temporarily |
| 771 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 851 | + if($oCommentItem->isGranted()) { |
|
| 852 | + $accessible[$val->comment_srl] = true; |
|
| 853 | + } |
|
| 772 | 854 | // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post |
| 773 | 855 | if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
| 774 | 856 | { |
@@ -779,7 +861,9 @@ discard block |
||
| 779 | 861 | // Variable setting to be displayed on the skin |
| 780 | 862 | Context::set($cpageStr, $output->page_navigation->cur_page); |
| 781 | 863 | Context::set('cpage', $output->page_navigation->cur_page); |
| 782 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
| 864 | + if($output->total_page>1) { |
|
| 865 | + $this->comment_page_navigation = $output->page_navigation; |
|
| 866 | + } |
|
| 783 | 867 | |
| 784 | 868 | return $comment_list; |
| 785 | 869 | } |
@@ -791,9 +875,13 @@ discard block |
||
| 791 | 875 | |
| 792 | 876 | function getTrackbacks() |
| 793 | 877 | { |
| 794 | - if(!$this->document_srl) return; |
|
| 878 | + if(!$this->document_srl) { |
|
| 879 | + return; |
|
| 880 | + } |
|
| 795 | 881 | |
| 796 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 882 | + if(!$this->allowTrackback() || !$this->get('trackback_count')) { |
|
| 883 | + return; |
|
| 884 | + } |
|
| 797 | 885 | |
| 798 | 886 | $oTrackbackModel = getModel('trackback'); |
| 799 | 887 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -801,15 +889,21 @@ discard block |
||
| 801 | 889 | |
| 802 | 890 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 803 | 891 | { |
| 804 | - if(!$this->document_srl) return false; |
|
| 805 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 892 | + if(!$this->document_srl) { |
|
| 893 | + return false; |
|
| 894 | + } |
|
| 895 | + if(!$this->getThumbnail($width, $height, $type)) { |
|
| 896 | + return false; |
|
| 897 | + } |
|
| 806 | 898 | return true; |
| 807 | 899 | } |
| 808 | 900 | |
| 809 | 901 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 810 | 902 | { |
| 811 | 903 | // Return false if the document doesn't exist |
| 812 | - if(!$this->document_srl) return; |
|
| 904 | + if(!$this->document_srl) { |
|
| 905 | + return; |
|
| 906 | + } |
|
| 813 | 907 | |
| 814 | 908 | if($this->isSecret() && !$this->isGranted()) |
| 815 | 909 | { |
@@ -817,7 +911,9 @@ discard block |
||
| 817 | 911 | } |
| 818 | 912 | |
| 819 | 913 | // If not specify its height, create a square |
| 820 | - if(!$height) $height = $width; |
|
| 914 | + if(!$height) { |
|
| 915 | + $height = $width; |
|
| 916 | + } |
|
| 821 | 917 | |
| 822 | 918 | // Return false if neither attachement nor image files in the document |
| 823 | 919 | $content = $this->get('content'); |
@@ -835,7 +931,9 @@ discard block |
||
| 835 | 931 | } |
| 836 | 932 | } |
| 837 | 933 | |
| 838 | - if(!preg_match("!<img!is", $content)) return; |
|
| 934 | + if(!preg_match("!<img!is", $content)) { |
|
| 935 | + return; |
|
| 936 | + } |
|
| 839 | 937 | } |
| 840 | 938 | // Get thumbnai_type information from document module's configuration |
| 841 | 939 | if(!in_array($thumbnail_type, array('crop','ratio'))) |
@@ -862,8 +960,7 @@ discard block |
||
| 862 | 960 | if(filesize($thumbnail_file) < 1) |
| 863 | 961 | { |
| 864 | 962 | return FALSE; |
| 865 | - } |
|
| 866 | - else |
|
| 963 | + } else |
|
| 867 | 964 | { |
| 868 | 965 | return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
| 869 | 966 | } |
@@ -884,7 +981,9 @@ discard block |
||
| 884 | 981 | $first_image = null; |
| 885 | 982 | foreach($file_list as $file) |
| 886 | 983 | { |
| 887 | - if($file->direct_download !== 'Y') continue; |
|
| 984 | + if($file->direct_download !== 'Y') { |
|
| 985 | + continue; |
|
| 986 | + } |
|
| 888 | 987 | |
| 889 | 988 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
| 890 | 989 | { |
@@ -892,7 +991,9 @@ discard block |
||
| 892 | 991 | break; |
| 893 | 992 | } |
| 894 | 993 | |
| 895 | - if($first_image) continue; |
|
| 994 | + if($first_image) { |
|
| 995 | + continue; |
|
| 996 | + } |
|
| 896 | 997 | |
| 897 | 998 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
| 898 | 999 | { |
@@ -919,7 +1020,9 @@ discard block |
||
| 919 | 1020 | foreach($matches as $target_image) |
| 920 | 1021 | { |
| 921 | 1022 | $target_src = trim($target_image[1]); |
| 922 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 1023 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
| 1024 | + continue; |
|
| 1025 | + } |
|
| 923 | 1026 | |
| 924 | 1027 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
| 925 | 1028 | { |
@@ -930,7 +1033,9 @@ discard block |
||
| 930 | 1033 | |
| 931 | 1034 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
| 932 | 1035 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 933 | - if(!file_exists($tmp_file)) continue; |
|
| 1036 | + if(!file_exists($tmp_file)) { |
|
| 1037 | + continue; |
|
| 1038 | + } |
|
| 934 | 1039 | |
| 935 | 1040 | $imageinfo = getimagesize($tmp_file); |
| 936 | 1041 | list($_w, $_h) = $imageinfo; |
@@ -976,21 +1081,28 @@ discard block |
||
| 976 | 1081 | */ |
| 977 | 1082 | function getExtraImages($time_interval = 43200) |
| 978 | 1083 | { |
| 979 | - if(!$this->document_srl) return; |
|
| 1084 | + if(!$this->document_srl) { |
|
| 1085 | + return; |
|
| 1086 | + } |
|
| 980 | 1087 | // variables for icon list |
| 981 | 1088 | $buffs = array(); |
| 982 | 1089 | |
| 983 | 1090 | $check_files = false; |
| 984 | 1091 | |
| 985 | 1092 | // Check if secret post is |
| 986 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 1093 | + if($this->isSecret()) { |
|
| 1094 | + $buffs[] = "secret"; |
|
| 1095 | + } |
|
| 987 | 1096 | |
| 988 | 1097 | // Set the latest time |
| 989 | 1098 | $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
| 990 | 1099 | |
| 991 | 1100 | // Check new post |
| 992 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 993 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 1101 | + if($this->get('regdate')>$time_check) { |
|
| 1102 | + $buffs[] = "new"; |
|
| 1103 | + } else if($this->get('last_update')>$time_check) { |
|
| 1104 | + $buffs[] = "update"; |
|
| 1105 | + } |
|
| 994 | 1106 | |
| 995 | 1107 | /* |
| 996 | 1108 | $content = $this->get('content'); |
@@ -1013,7 +1125,9 @@ discard block |
||
| 1013 | 1125 | */ |
| 1014 | 1126 | |
| 1015 | 1127 | // Check the attachment |
| 1016 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1128 | + if($this->hasUploadedFiles()) { |
|
| 1129 | + $buffs[] = "file"; |
|
| 1130 | + } |
|
| 1017 | 1131 | |
| 1018 | 1132 | return $buffs; |
| 1019 | 1133 | } |
@@ -1034,22 +1148,25 @@ discard block |
||
| 1034 | 1148 | */ |
| 1035 | 1149 | function printExtraImages($time_check = 43200) |
| 1036 | 1150 | { |
| 1037 | - if(!$this->document_srl) return; |
|
| 1151 | + if(!$this->document_srl) { |
|
| 1152 | + return; |
|
| 1153 | + } |
|
| 1038 | 1154 | |
| 1039 | 1155 | $oDocumentModel = getModel('document'); |
| 1040 | 1156 | $documentConfig = $oDocumentModel->getDocumentConfig(); |
| 1041 | 1157 | if(Mobile::isFromMobilePhone()) |
| 1042 | 1158 | { |
| 1043 | 1159 | $iconSkin = $documentConfig->micons; |
| 1044 | - } |
|
| 1045 | - else |
|
| 1160 | + } else |
|
| 1046 | 1161 | { |
| 1047 | 1162 | $iconSkin = $documentConfig->icons; |
| 1048 | 1163 | } |
| 1049 | 1164 | $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
| 1050 | 1165 | |
| 1051 | 1166 | $buffs = $this->getExtraImages($time_check); |
| 1052 | - if(!count($buffs)) return; |
|
| 1167 | + if(!count($buffs)) { |
|
| 1168 | + return; |
|
| 1169 | + } |
|
| 1053 | 1170 | |
| 1054 | 1171 | $buff = array(); |
| 1055 | 1172 | foreach($buffs as $key => $val) |
@@ -1061,18 +1178,28 @@ discard block |
||
| 1061 | 1178 | |
| 1062 | 1179 | function hasUploadedFiles() |
| 1063 | 1180 | { |
| 1064 | - if(!$this->document_srl) return; |
|
| 1181 | + if(!$this->document_srl) { |
|
| 1182 | + return; |
|
| 1183 | + } |
|
| 1065 | 1184 | |
| 1066 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1185 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1186 | + return false; |
|
| 1187 | + } |
|
| 1067 | 1188 | return $this->get('uploaded_count')? true : false; |
| 1068 | 1189 | } |
| 1069 | 1190 | |
| 1070 | 1191 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1071 | 1192 | { |
| 1072 | - if(!$this->document_srl) return; |
|
| 1193 | + if(!$this->document_srl) { |
|
| 1194 | + return; |
|
| 1195 | + } |
|
| 1073 | 1196 | |
| 1074 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1075 | - if(!$this->get('uploaded_count')) return; |
|
| 1197 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1198 | + return; |
|
| 1199 | + } |
|
| 1200 | + if(!$this->get('uploaded_count')) { |
|
| 1201 | + return; |
|
| 1202 | + } |
|
| 1076 | 1203 | |
| 1077 | 1204 | if(!$this->uploadedFiles[$sortIndex]) |
| 1078 | 1205 | { |
@@ -1090,7 +1217,9 @@ discard block |
||
| 1090 | 1217 | function getEditor() |
| 1091 | 1218 | { |
| 1092 | 1219 | $module_srl = $this->get('module_srl'); |
| 1093 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1220 | + if(!$module_srl) { |
|
| 1221 | + $module_srl = Context::get('module_srl'); |
|
| 1222 | + } |
|
| 1094 | 1223 | |
| 1095 | 1224 | $oEditorModel = getModel('editor'); |
| 1096 | 1225 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1104,8 +1233,12 @@ discard block |
||
| 1104 | 1233 | function isEnableComment() |
| 1105 | 1234 | { |
| 1106 | 1235 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1107 | - if (!$this->allowComment()) return false; |
|
| 1108 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1236 | + if (!$this->allowComment()) { |
|
| 1237 | + return false; |
|
| 1238 | + } |
|
| 1239 | + if(!$this->isGranted() && $this->isSecret()) { |
|
| 1240 | + return false; |
|
| 1241 | + } |
|
| 1109 | 1242 | |
| 1110 | 1243 | return true; |
| 1111 | 1244 | } |
@@ -1116,7 +1249,9 @@ discard block |
||
| 1116 | 1249 | */ |
| 1117 | 1250 | function getCommentEditor() |
| 1118 | 1251 | { |
| 1119 | - if(!$this->isEnableComment()) return; |
|
| 1252 | + if(!$this->isEnableComment()) { |
|
| 1253 | + return; |
|
| 1254 | + } |
|
| 1120 | 1255 | |
| 1121 | 1256 | $oEditorModel = getModel('editor'); |
| 1122 | 1257 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1128,10 +1263,14 @@ discard block |
||
| 1128 | 1263 | */ |
| 1129 | 1264 | function getProfileImage() |
| 1130 | 1265 | { |
| 1131 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1266 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1267 | + return; |
|
| 1268 | + } |
|
| 1132 | 1269 | $oMemberModel = getModel('member'); |
| 1133 | 1270 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1134 | - if(!$profile_info) return; |
|
| 1271 | + if(!$profile_info) { |
|
| 1272 | + return; |
|
| 1273 | + } |
|
| 1135 | 1274 | |
| 1136 | 1275 | return $profile_info->src; |
| 1137 | 1276 | } |
@@ -1143,7 +1282,9 @@ discard block |
||
| 1143 | 1282 | function getSignature() |
| 1144 | 1283 | { |
| 1145 | 1284 | // Pass if a document doesn't exist |
| 1146 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1285 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1286 | + return; |
|
| 1287 | + } |
|
| 1147 | 1288 | // Get signature information |
| 1148 | 1289 | $oMemberModel = getModel('member'); |
| 1149 | 1290 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
@@ -1157,7 +1298,9 @@ discard block |
||
| 1157 | 1298 | if($signature) |
| 1158 | 1299 | { |
| 1159 | 1300 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1160 | - if($max_signature_height) $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); |
|
| 1301 | + if($max_signature_height) { |
|
| 1302 | + $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); |
|
| 1303 | + } |
|
| 1161 | 1304 | } |
| 1162 | 1305 | |
| 1163 | 1306 | return $signature; |
@@ -1181,20 +1324,25 @@ discard block |
||
| 1181 | 1324 | function _checkAccessibleFromStatus() |
| 1182 | 1325 | { |
| 1183 | 1326 | $logged_info = Context::get('logged_info'); |
| 1184 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1327 | + if($logged_info->is_admin == 'Y') { |
|
| 1328 | + return true; |
|
| 1329 | + } |
|
| 1185 | 1330 | |
| 1186 | 1331 | $status = $this->get('status'); |
| 1187 | - if(empty($status)) return false; |
|
| 1332 | + if(empty($status)) { |
|
| 1333 | + return false; |
|
| 1334 | + } |
|
| 1188 | 1335 | |
| 1189 | 1336 | $oDocumentModel = getModel('document'); |
| 1190 | 1337 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1191 | 1338 | |
| 1192 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1193 | - return true; |
|
| 1194 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1339 | + if($status == $configStatusList['public'] || $status == $configStatusList['publish']) { |
|
| 1340 | + return true; |
|
| 1341 | + } else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1195 | 1342 | { |
| 1196 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1197 | - return true; |
|
| 1343 | + if($this->get('member_srl') == $logged_info->member_srl) { |
|
| 1344 | + return true; |
|
| 1345 | + } |
|
| 1198 | 1346 | } |
| 1199 | 1347 | return false; |
| 1200 | 1348 | } |