@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $skin = $this->member_config->skin; |
| 27 | 27 | // Set the template path |
| 28 | - if(!$skin) |
|
| 28 | + if (!$skin) |
|
| 29 | 29 | { |
| 30 | 30 | $skin = 'default'; |
| 31 | 31 | $template_path = sprintf('%sskins/%s', $this->module_path, $skin); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $oLayoutModel = getModel('layout'); |
| 50 | 50 | $layout_info = $oLayoutModel->getLayout($this->member_config->layout_srl); |
| 51 | - if($layout_info) |
|
| 51 | + if ($layout_info) |
|
| 52 | 52 | { |
| 53 | 53 | $this->module_info->layout_srl = $this->member_config->layout_srl; |
| 54 | 54 | $this->setLayoutPath($layout_info->path); |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | $oMemberModel = getModel('member'); |
| 64 | 64 | $logged_info = Context::get('logged_info'); |
| 65 | 65 | // Don't display member info to non-logged user |
| 66 | - if(!$logged_info->member_srl) return $this->stop('msg_not_permitted'); |
|
| 66 | + if (!$logged_info->member_srl) return $this->stop('msg_not_permitted'); |
|
| 67 | 67 | |
| 68 | 68 | $member_srl = Context::get('member_srl'); |
| 69 | - if(!$member_srl && Context::get('is_logged')) |
|
| 69 | + if (!$member_srl && Context::get('is_logged')) |
|
| 70 | 70 | { |
| 71 | 71 | $member_srl = $logged_info->member_srl; |
| 72 | 72 | } |
| 73 | - elseif(!$member_srl) |
|
| 73 | + elseif (!$member_srl) |
|
| 74 | 74 | { |
| 75 | 75 | return $this->dispMemberSignUpForm(); |
| 76 | 76 | } |
@@ -82,14 +82,14 @@ discard block |
||
| 82 | 82 | unset($member_info->email_id); |
| 83 | 83 | unset($member_info->email_host); |
| 84 | 84 | |
| 85 | - if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl)) |
|
| 85 | + if ($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl)) |
|
| 86 | 86 | { |
| 87 | - $start = strpos($member_info->email_address, '@')+1; |
|
| 87 | + $start = strpos($member_info->email_address, '@') + 1; |
|
| 88 | 88 | $replaceStr = str_repeat('*', (strlen($member_info->email_address) - $start)); |
| 89 | 89 | $member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if(!$member_info->member_srl) return $this->dispMemberSignUpForm(); |
|
| 92 | + if (!$member_info->member_srl) return $this->dispMemberSignUpForm(); |
|
| 93 | 93 | |
| 94 | 94 | Context::set('memberInfo', get_object_vars($member_info)); |
| 95 | 95 | |
@@ -107,46 +107,46 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $logged_info = Context::get('logged_info'); |
| 109 | 109 | $displayDatas = array(); |
| 110 | - foreach($memberConfig->signupForm as $no=>$formInfo) |
|
| 110 | + foreach ($memberConfig->signupForm as $no=>$formInfo) |
|
| 111 | 111 | { |
| 112 | - if(!$formInfo->isUse) |
|
| 112 | + if (!$formInfo->isUse) |
|
| 113 | 113 | { |
| 114 | 114 | continue; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if($formInfo->name == 'password' || $formInfo->name == 'find_account_question') |
|
| 117 | + if ($formInfo->name == 'password' || $formInfo->name == 'find_account_question') |
|
| 118 | 118 | { |
| 119 | 119 | continue; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y') |
|
| 122 | + if ($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y') |
|
| 123 | 123 | { |
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $item = $formInfo; |
| 128 | 128 | |
| 129 | - if($formInfo->isDefaultForm) |
|
| 129 | + if ($formInfo->isDefaultForm) |
|
| 130 | 130 | { |
| 131 | 131 | $item->title = Context::getLang($formInfo->name); |
| 132 | 132 | $item->value = $memberInfo->{$formInfo->name}; |
| 133 | 133 | |
| 134 | - if($formInfo->name == 'profile_image' && $memberInfo->profile_image) |
|
| 134 | + if ($formInfo->name == 'profile_image' && $memberInfo->profile_image) |
|
| 135 | 135 | { |
| 136 | 136 | $target = $memberInfo->profile_image; |
| 137 | 137 | $item->value = '<img src="'.$target->src.'" />'; |
| 138 | 138 | } |
| 139 | - elseif($formInfo->name == 'image_name' && $memberInfo->image_name) |
|
| 139 | + elseif ($formInfo->name == 'image_name' && $memberInfo->image_name) |
|
| 140 | 140 | { |
| 141 | 141 | $target = $memberInfo->image_name; |
| 142 | 142 | $item->value = '<img src="'.$target->src.'" />'; |
| 143 | 143 | } |
| 144 | - elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark) |
|
| 144 | + elseif ($formInfo->name == 'image_mark' && $memberInfo->image_mark) |
|
| 145 | 145 | { |
| 146 | 146 | $target = $memberInfo->image_mark; |
| 147 | 147 | $item->value = '<img src="'.$target->src.'" />'; |
| 148 | 148 | } |
| 149 | - elseif($formInfo->name == 'birthday' && $memberInfo->birthday) |
|
| 149 | + elseif ($formInfo->name == 'birthday' && $memberInfo->birthday) |
|
| 150 | 150 | { |
| 151 | 151 | $item->value = zdate($item->value, 'Y-m-d'); |
| 152 | 152 | } |
@@ -155,19 +155,19 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | $item->title = $extendFormInfo[$formInfo->member_join_form_srl]->column_title; |
| 157 | 157 | $orgValue = $extendFormInfo[$formInfo->member_join_form_srl]->value; |
| 158 | - if($formInfo->type=='tel' && is_array($orgValue)) |
|
| 158 | + if ($formInfo->type == 'tel' && is_array($orgValue)) |
|
| 159 | 159 | { |
| 160 | 160 | $item->value = implode('-', $orgValue); |
| 161 | 161 | } |
| 162 | - elseif($formInfo->type=='kr_zip' && is_array($orgValue)) |
|
| 162 | + elseif ($formInfo->type == 'kr_zip' && is_array($orgValue)) |
|
| 163 | 163 | { |
| 164 | 164 | $item->value = implode(' ', $orgValue); |
| 165 | 165 | } |
| 166 | - elseif($formInfo->type=='checkbox' && is_array($orgValue)) |
|
| 166 | + elseif ($formInfo->type == 'checkbox' && is_array($orgValue)) |
|
| 167 | 167 | { |
| 168 | - $item->value = implode(", ",$orgValue); |
|
| 168 | + $item->value = implode(", ", $orgValue); |
|
| 169 | 169 | } |
| 170 | - elseif($formInfo->type=='date') |
|
| 170 | + elseif ($formInfo->type == 'date') |
|
| 171 | 171 | { |
| 172 | 172 | $item->value = zdate($orgValue, "Y-m-d"); |
| 173 | 173 | } |
@@ -198,12 +198,12 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $oMemberModel = getModel('member'); |
| 200 | 200 | // Get the member information if logged-in |
| 201 | - if($oMemberModel->isLogged()) return $this->stop('msg_already_logged'); |
|
| 201 | + if ($oMemberModel->isLogged()) return $this->stop('msg_already_logged'); |
|
| 202 | 202 | // call a trigger (before) |
| 203 | 203 | $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config); |
| 204 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 204 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 205 | 205 | // Error appears if the member is not allowed to join |
| 206 | - if($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
| 206 | + if ($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
| 207 | 207 | |
| 208 | 208 | $oMemberAdminView = getAdminView('member'); |
| 209 | 209 | $formTags = $oMemberAdminView->_getMemberInputTag($member_info); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | $logged_info = Context::get('logged_info'); |
| 228 | 228 | $oMemberModel = getModel('member'); |
| 229 | - if(!$oMemberModel->isLogged() || empty($logged_info)) |
|
| 229 | + if (!$oMemberModel->isLogged() || empty($logged_info)) |
|
| 230 | 230 | { |
| 231 | 231 | return $this->stop('msg_not_logged'); |
| 232 | 232 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $_SESSION['rechecked_password_step'] = 'INPUT_PASSWORD'; |
| 235 | 235 | |
| 236 | 236 | $templateFile = $this->getTemplatePath().'rechecked_password.html'; |
| 237 | - if(!is_readable($templateFile)) |
|
| 237 | + if (!is_readable($templateFile)) |
|
| 238 | 238 | { |
| 239 | 239 | $templatePath = sprintf('%sskins/default', $this->module_path); |
| 240 | 240 | $this->setTemplatePath($templatePath); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function dispMemberModifyInfo() |
| 261 | 261 | { |
| 262 | - if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 262 | + if ($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 263 | 263 | { |
| 264 | 264 | $this->dispMemberModifyInfoBefore(); |
| 265 | 265 | return; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | $oMemberModel = getModel('member'); |
| 273 | 273 | // A message appears if the user is not logged-in |
| 274 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 274 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 275 | 275 | |
| 276 | 276 | $logged_info = Context::get('logged_info'); |
| 277 | 277 | $member_srl = $logged_info->member_srl; |
@@ -279,13 +279,13 @@ discard block |
||
| 279 | 279 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address', 'find_account_answer', 'homepage', 'blog', 'birthday', 'allow_mailing'); |
| 280 | 280 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 281 | 281 | $member_info->signature = $oMemberModel->getSignature($member_srl); |
| 282 | - Context::set('member_info',$member_info); |
|
| 282 | + Context::set('member_info', $member_info); |
|
| 283 | 283 | |
| 284 | 284 | // Get a list of extend join form |
| 285 | 285 | Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info)); |
| 286 | 286 | |
| 287 | 287 | // Editor of the module set for signing by calling getEditor |
| 288 | - if($member_info->member_srl) |
|
| 288 | + if ($member_info->member_srl) |
|
| 289 | 289 | { |
| 290 | 290 | $oEditorModel = getModel('editor'); |
| 291 | 291 | $option = new stdClass(); |
@@ -330,14 +330,14 @@ discard block |
||
| 330 | 330 | { |
| 331 | 331 | $oMemberModel = getModel('member'); |
| 332 | 332 | // A message appears if the user is not logged-in |
| 333 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 333 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 334 | 334 | |
| 335 | 335 | $logged_info = Context::get('logged_info'); |
| 336 | 336 | $member_srl = $logged_info->member_srl; |
| 337 | 337 | |
| 338 | 338 | $module_srl = Context::get('module_srl'); |
| 339 | - Context::set('module_srl',Context::get('selected_module_srl')); |
|
| 340 | - Context::set('search_target','member_srls'); |
|
| 339 | + Context::set('module_srl', Context::get('selected_module_srl')); |
|
| 340 | + Context::set('search_target', 'member_srls'); |
|
| 341 | 341 | Context::set('search_keyword', implode(',', array($member_srl, $member_srl * -1))); |
| 342 | 342 | |
| 343 | 343 | |
@@ -358,12 +358,12 @@ discard block |
||
| 358 | 358 | { |
| 359 | 359 | $oMemberModel = getModel('member'); |
| 360 | 360 | // A message appears if the user is not logged-in |
| 361 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 361 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 362 | 362 | |
| 363 | 363 | $logged_info = Context::get('logged_info'); |
| 364 | 364 | $args = new stdClass(); |
| 365 | 365 | $args->member_srl = $logged_info->member_srl; |
| 366 | - $args->page = (int)Context::get('page'); |
|
| 366 | + $args->page = (int) Context::get('page'); |
|
| 367 | 367 | |
| 368 | 368 | $output = executeQuery('member.getScrapDocumentList', $args); |
| 369 | 369 | Context::set('total_count', $output->total_count); |
@@ -385,12 +385,12 @@ discard block |
||
| 385 | 385 | { |
| 386 | 386 | $oMemberModel = getModel('member'); |
| 387 | 387 | // A message appears if the user is not logged-in |
| 388 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 388 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 389 | 389 | // Get the saved document(module_srl is set to member_srl instead) |
| 390 | 390 | $logged_info = Context::get('logged_info'); |
| 391 | 391 | $args = new stdClass(); |
| 392 | 392 | $args->member_srl = $logged_info->member_srl; |
| 393 | - $args->page = (int)Context::get('page'); |
|
| 393 | + $args->page = (int) Context::get('page'); |
|
| 394 | 394 | $args->statusList = array('TEMP'); |
| 395 | 395 | |
| 396 | 396 | $oDocumentModel = getModel('document'); |
@@ -409,9 +409,9 @@ discard block |
||
| 409 | 409 | */ |
| 410 | 410 | function dispMemberLoginForm() |
| 411 | 411 | { |
| 412 | - if(Context::get('is_logged')) |
|
| 412 | + if (Context::get('is_logged')) |
|
| 413 | 413 | { |
| 414 | - Context::set('redirect_url', getNotEncodedUrl('act','')); |
|
| 414 | + Context::set('redirect_url', getNotEncodedUrl('act', '')); |
|
| 415 | 415 | $this->setTemplatePath($this->module_path.'tpl'); |
| 416 | 416 | $this->setTemplateFile('redirect.html'); |
| 417 | 417 | return; |
@@ -424,10 +424,10 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | $XE_VALIDATOR_MESSAGE = Context::get('XE_VALIDATOR_MESSAGE'); |
| 426 | 426 | $XE_VALIDATOR_ERROR = Context::get('XE_VALIDATOR_ERROR'); |
| 427 | - if($XE_VALIDATOR_ERROR == -11) |
|
| 428 | - Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description); |
|
| 427 | + if ($XE_VALIDATOR_ERROR == -11) |
|
| 428 | + Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE.$config->limit_day_description); |
|
| 429 | 429 | |
| 430 | - if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) |
|
| 430 | + if ($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) |
|
| 431 | 431 | Context::set('referer_url', getUrl('')); |
| 432 | 432 | else |
| 433 | 433 | Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | { |
| 444 | 444 | $oMemberModel = getModel('member'); |
| 445 | 445 | // A message appears if the user is not logged-in |
| 446 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 446 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 447 | 447 | |
| 448 | 448 | $memberConfig = $this->member_config; |
| 449 | 449 | |
@@ -452,9 +452,9 @@ discard block |
||
| 452 | 452 | |
| 453 | 453 | $columnList = array('member_srl', 'user_id'); |
| 454 | 454 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 455 | - Context::set('member_info',$member_info); |
|
| 455 | + Context::set('member_info', $member_info); |
|
| 456 | 456 | |
| 457 | - if($memberConfig->identifier == 'user_id') |
|
| 457 | + if ($memberConfig->identifier == 'user_id') |
|
| 458 | 458 | { |
| 459 | 459 | Context::set('identifier', 'user_id'); |
| 460 | 460 | Context::set('formValue', $member_info->user_id); |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | { |
| 476 | 476 | $oMemberModel = getModel('member'); |
| 477 | 477 | // A message appears if the user is not logged-in |
| 478 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 478 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 479 | 479 | |
| 480 | 480 | $memberConfig = $this->member_config; |
| 481 | 481 | |
@@ -483,9 +483,9 @@ discard block |
||
| 483 | 483 | $member_srl = $logged_info->member_srl; |
| 484 | 484 | |
| 485 | 485 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
| 486 | - Context::set('member_info',$member_info); |
|
| 486 | + Context::set('member_info', $member_info); |
|
| 487 | 487 | |
| 488 | - if($memberConfig->identifier == 'user_id') |
|
| 488 | + if ($memberConfig->identifier == 'user_id') |
|
| 489 | 489 | { |
| 490 | 490 | Context::set('identifier', 'user_id'); |
| 491 | 491 | Context::set('formValue', $member_info->user_id); |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | { |
| 507 | 507 | $oMemberController = getController('member'); |
| 508 | 508 | $output = $oMemberController->procMemberLogout(); |
| 509 | - if(!$output->redirect_url) |
|
| 509 | + if (!$output->redirect_url) |
|
| 510 | 510 | $this->setRedirectUrl(getNotEncodedUrl('act', '')); |
| 511 | 511 | else |
| 512 | 512 | $this->setRedirectUrl($output->redirect_url); |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | */ |
| 529 | 529 | function dispMemberFindAccount() |
| 530 | 530 | { |
| 531 | - if(Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 531 | + if (Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 532 | 532 | |
| 533 | 533 | $config = $this->member_config; |
| 534 | 534 | |
@@ -542,13 +542,13 @@ discard block |
||
| 542 | 542 | */ |
| 543 | 543 | function dispMemberGetTempPassword() |
| 544 | 544 | { |
| 545 | - if(Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 545 | + if (Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 546 | 546 | |
| 547 | 547 | $user_id = Context::get('user_id'); |
| 548 | 548 | $temp_password = $_SESSION['xe_temp_password_'.$user_id]; |
| 549 | 549 | unset($_SESSION['xe_temp_password_'.$user_id]); |
| 550 | 550 | |
| 551 | - if(!$user_id||!$temp_password) return new BaseObject(-1,'msg_invaild_request'); |
|
| 551 | + if (!$user_id || !$temp_password) return new BaseObject(-1, 'msg_invaild_request'); |
|
| 552 | 552 | |
| 553 | 553 | Context::set('temp_password', $temp_password); |
| 554 | 554 | |
@@ -563,12 +563,12 @@ discard block |
||
| 563 | 563 | $authMemberSrl = $_SESSION['auth_member_srl']; |
| 564 | 564 | unset($_SESSION['auth_member_srl']); |
| 565 | 565 | |
| 566 | - if(Context::get('is_logged')) |
|
| 566 | + if (Context::get('is_logged')) |
|
| 567 | 567 | { |
| 568 | 568 | return $this->stop('already_logged'); |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - if($authMemberSrl) |
|
| 571 | + if ($authMemberSrl) |
|
| 572 | 572 | { |
| 573 | 573 | $oMemberModel = getModel('member'); |
| 574 | 574 | $memberInfo = $oMemberModel->getMemberInfoByMemberSrl($authMemberSrl); |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | |
| 586 | 586 | function dispMemberModifyEmailAddress() |
| 587 | 587 | { |
| 588 | - if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 588 | + if ($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 589 | 589 | { |
| 590 | 590 | Context::set('success_return_url', getUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyEmailAddress')); |
| 591 | 591 | $this->dispMemberModifyInfoBefore(); |
@@ -613,10 +613,10 @@ discard block |
||
| 613 | 613 | $js_code[] = 'if(!validator) return false;'; |
| 614 | 614 | |
| 615 | 615 | $errorLang = array(); |
| 616 | - foreach($extraList as $val) |
|
| 616 | + foreach ($extraList as $val) |
|
| 617 | 617 | { |
| 618 | 618 | $title = str_ireplace(array('<script', '</script'), array('<scr"+"ipt', '</scr"+"ipt'), addslashes($val->column_title)); |
| 619 | - if($val->column_type == 'kr_zip' || $val->column_type == 'tel') |
|
| 619 | + if ($val->column_type == 'kr_zip' || $val->column_type == 'tel') |
|
| 620 | 620 | { |
| 621 | 621 | $js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s[]","%s"]);', $val->column_name, $title); |
| 622 | 622 | } |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | **/ |
| 643 | 643 | function dispMemberSpammer() |
| 644 | 644 | { |
| 645 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 645 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 646 | 646 | |
| 647 | 647 | $member_srl = Context::get('member_srl'); |
| 648 | 648 | $module_srl = Context::get('module_srl'); |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 654 | 654 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 655 | 655 | |
| 656 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 656 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 657 | 657 | |
| 658 | 658 | $oMemberModel = getModel('member'); |
| 659 | 659 | |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * setup the module general information |
| 25 | 25 | **/ |
| 26 | - if($this->module_info->list_count) |
|
| 26 | + if ($this->module_info->list_count) |
|
| 27 | 27 | { |
| 28 | 28 | $this->list_count = $this->module_info->list_count; |
| 29 | 29 | } |
| 30 | - if($this->module_info->search_list_count) |
|
| 30 | + if ($this->module_info->search_list_count) |
|
| 31 | 31 | { |
| 32 | 32 | $this->search_list_count = $this->module_info->search_list_count; |
| 33 | 33 | } |
| 34 | - if($this->module_info->page_count) |
|
| 34 | + if ($this->module_info->page_count) |
|
| 35 | 35 | { |
| 36 | 36 | $this->page_count = $this->module_info->page_count; |
| 37 | 37 | } |
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | $oDocumentModel = getModel('document'); |
| 42 | 42 | |
| 43 | 43 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 44 | - if(isset($statusList['SECRET'])) |
|
| 44 | + if (isset($statusList['SECRET'])) |
|
| 45 | 45 | { |
| 46 | 46 | $this->module_info->secret = 'Y'; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // use_category <=1.5.x, hide_category >=1.7.x |
| 50 | 50 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
| 51 | - if($count_category) |
|
| 51 | + if ($count_category) |
|
| 52 | 52 | { |
| 53 | - if($this->module_info->hide_category) |
|
| 53 | + if ($this->module_info->hide_category) |
|
| 54 | 54 | { |
| 55 | 55 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
| 56 | 56 | } |
| 57 | - else if($this->module_info->use_category) |
|
| 57 | + else if ($this->module_info->use_category) |
|
| 58 | 58 | { |
| 59 | 59 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
| 60 | 60 | } |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * check the consultation function, if the user is admin then swich off consultation function |
| 75 | 75 | * if the user is not logged, then disppear write document/write comment./ view document |
| 76 | 76 | **/ |
| 77 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
| 77 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
| 78 | 78 | { |
| 79 | 79 | $this->consultation = TRUE; |
| 80 | - if(!Context::get('is_logged')) |
|
| 80 | + if (!Context::get('is_logged')) |
|
| 81 | 81 | { |
| 82 | 82 | $this->grant->list = FALSE; |
| 83 | 83 | $this->grant->write_document = FALSE; |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | * setup the template path based on the skin |
| 95 | 95 | * the default skin is default |
| 96 | 96 | **/ |
| 97 | - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
|
| 98 | - if(!is_dir($template_path)||!$this->module_info->skin) |
|
| 97 | + $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); |
|
| 98 | + if (!is_dir($template_path) || !$this->module_info->skin) |
|
| 99 | 99 | { |
| 100 | 100 | $this->module_info->skin = 'default'; |
| 101 | - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
|
| 101 | + $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); |
|
| 102 | 102 | } |
| 103 | 103 | $this->setTemplatePath($template_path); |
| 104 | 104 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | **/ |
| 115 | 115 | if (is_array($extra_keys)) |
| 116 | 116 | { |
| 117 | - foreach($extra_keys as $val) |
|
| 117 | + foreach ($extra_keys as $val) |
|
| 118 | 118 | { |
| 119 | 119 | $this->order_target[] = $val->eid; |
| 120 | 120 | } |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | // remove [document_srl]_cpage from get_vars |
| 129 | 129 | $args = Context::getRequestVars(); |
| 130 | - foreach($args as $name => $value) |
|
| 130 | + foreach ($args as $name => $value) |
|
| 131 | 131 | { |
| 132 | - if(preg_match('/[0-9]+_cpage/', $name)) |
|
| 132 | + if (preg_match('/[0-9]+_cpage/', $name)) |
|
| 133 | 133 | { |
| 134 | 134 | Context::set($name, '', TRUE); |
| 135 | 135 | Context::set($name, $value); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | /** |
| 146 | 146 | * check the access grant (all the grant has been set by the module object) |
| 147 | 147 | **/ |
| 148 | - if(!$this->grant->access || !$this->grant->list) |
|
| 148 | + if (!$this->grant->access || !$this->grant->list) |
|
| 149 | 149 | { |
| 150 | 150 | return $this->dispBoardMessage('msg_not_permitted'); |
| 151 | 151 | } |
@@ -160,22 +160,22 @@ discard block |
||
| 160 | 160 | * add extra vaiables to the search options |
| 161 | 161 | **/ |
| 162 | 162 | // use search options on the template (the search options key has been declared, based on the language selected) |
| 163 | - foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
| 163 | + foreach ($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
| 164 | 164 | $extra_keys = Context::get('extra_keys'); |
| 165 | - if($extra_keys) |
|
| 165 | + if ($extra_keys) |
|
| 166 | 166 | { |
| 167 | - foreach($extra_keys as $key => $val) |
|
| 167 | + foreach ($extra_keys as $key => $val) |
|
| 168 | 168 | { |
| 169 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
| 169 | + if ($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | // remove a search option that is not public in member config |
| 173 | 173 | $memberConfig = getModel('module')->getModuleConfig('member'); |
| 174 | - foreach($memberConfig->signupForm as $signupFormElement) |
|
| 174 | + foreach ($memberConfig->signupForm as $signupFormElement) |
|
| 175 | 175 | { |
| 176 | - if(in_array($signupFormElement->title, $search_option)) |
|
| 176 | + if (in_array($signupFormElement->title, $search_option)) |
|
| 177 | 177 | { |
| 178 | - if($signupFormElement->isPublic == 'N') |
|
| 178 | + if ($signupFormElement->isPublic == 'N') |
|
| 179 | 179 | unset($search_option[$signupFormElement->name]); |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $oDocumentModel = getModel('document'); |
| 185 | 185 | $statusNameList = $this->_getStatusNameList($oDocumentModel); |
| 186 | - if(count($statusNameList) > 0) |
|
| 186 | + if (count($statusNameList) > 0) |
|
| 187 | 187 | { |
| 188 | 188 | Context::set('status_list', $statusNameList); |
| 189 | 189 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | // list config, columnList setting |
| 195 | 195 | $oBoardModel = getModel('board'); |
| 196 | 196 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
| 197 | - if(!$this->listConfig) $this->listConfig = array(); |
|
| 197 | + if (!$this->listConfig) $this->listConfig = array(); |
|
| 198 | 198 | $this->_makeListColumnList(); |
| 199 | 199 | |
| 200 | 200 | // display the notice list |
@@ -218,12 +218,12 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * @brief display the category list |
| 220 | 220 | **/ |
| 221 | - function dispBoardCategoryList(){ |
|
| 221 | + function dispBoardCategoryList() { |
|
| 222 | 222 | // check if the use_category option is enabled |
| 223 | - if($this->module_info->use_category=='Y') |
|
| 223 | + if ($this->module_info->use_category == 'Y') |
|
| 224 | 224 | { |
| 225 | 225 | // check the grant |
| 226 | - if(!$this->grant->list) |
|
| 226 | + if (!$this->grant->list) |
|
| 227 | 227 | { |
| 228 | 228 | Context::set('category_list', array()); |
| 229 | 229 | return; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | /** |
| 241 | 241 | * @brief display the board conent view |
| 242 | 242 | **/ |
| 243 | - function dispBoardContentView(){ |
|
| 243 | + function dispBoardContentView() { |
|
| 244 | 244 | // get the variable value |
| 245 | 245 | $document_srl = Context::get('document_srl'); |
| 246 | 246 | $page = Context::get('page'); |
@@ -251,36 +251,36 @@ discard block |
||
| 251 | 251 | /** |
| 252 | 252 | * if the document exists, then get the document information |
| 253 | 253 | **/ |
| 254 | - if($document_srl) |
|
| 254 | + if ($document_srl) |
|
| 255 | 255 | { |
| 256 | 256 | $oDocument = $oDocumentModel->getDocument($document_srl, false, true); |
| 257 | 257 | |
| 258 | 258 | // if the document is existed |
| 259 | - if($oDocument->isExists()) |
|
| 259 | + if ($oDocument->isExists()) |
|
| 260 | 260 | { |
| 261 | 261 | // if the module srl is not consistent |
| 262 | - if($oDocument->get('module_srl')!=$this->module_info->module_srl ) |
|
| 262 | + if ($oDocument->get('module_srl') != $this->module_info->module_srl) |
|
| 263 | 263 | { |
| 264 | 264 | return $this->stop('msg_invalid_request'); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // check the manage grant |
| 268 | - if($this->grant->manager) $oDocument->setGrant(); |
|
| 268 | + if ($this->grant->manager) $oDocument->setGrant(); |
|
| 269 | 269 | |
| 270 | 270 | // if the consultation function is enabled, and the document is not a notice |
| 271 | - if($this->consultation && !$oDocument->isNotice()) |
|
| 271 | + if ($this->consultation && !$oDocument->isNotice()) |
|
| 272 | 272 | { |
| 273 | 273 | $logged_info = Context::get('logged_info'); |
| 274 | - if(abs($oDocument->get('member_srl')) != $logged_info->member_srl) |
|
| 274 | + if (abs($oDocument->get('member_srl')) != $logged_info->member_srl) |
|
| 275 | 275 | { |
| 276 | 276 | $oDocument = $oDocumentModel->getDocument(0); |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // if the document is TEMP saved, check Grant |
| 281 | - if($oDocument->getStatus() == 'TEMP') |
|
| 281 | + if ($oDocument->getStatus() == 'TEMP') |
|
| 282 | 282 | { |
| 283 | - if(!$oDocument->isGranted()) |
|
| 283 | + if (!$oDocument->isGranted()) |
|
| 284 | 284 | { |
| 285 | 285 | $oDocument = $oDocumentModel->getDocument(0); |
| 286 | 286 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | else |
| 291 | 291 | { |
| 292 | 292 | // if the document is not existed, then alert a warning message |
| 293 | - Context::set('document_srl','',true); |
|
| 293 | + Context::set('document_srl', '', true); |
|
| 294 | 294 | $this->alertMessage('msg_not_founded'); |
| 295 | 295 | } |
| 296 | 296 | |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | /** |
| 307 | 307 | *check the document view grant |
| 308 | 308 | **/ |
| 309 | - if($oDocument->isExists()) |
|
| 309 | + if ($oDocument->isExists()) |
|
| 310 | 310 | { |
| 311 | - if(!$this->grant->view && !$oDocument->isGranted()) |
|
| 311 | + if (!$this->grant->view && !$oDocument->isGranted()) |
|
| 312 | 312 | { |
| 313 | 313 | $oDocument = $oDocumentModel->getDocument(0); |
| 314 | - Context::set('document_srl','',true); |
|
| 314 | + Context::set('document_srl', '', true); |
|
| 315 | 315 | $this->alertMessage('msg_not_permitted'); |
| 316 | 316 | } |
| 317 | 317 | else |
@@ -320,15 +320,15 @@ discard block |
||
| 320 | 320 | Context::addBrowserTitle($oDocument->getTitleText()); |
| 321 | 321 | |
| 322 | 322 | // update the document view count (if the document is not secret) |
| 323 | - if(!$oDocument->isSecret() || $oDocument->isGranted()) |
|
| 323 | + if (!$oDocument->isSecret() || $oDocument->isGranted()) |
|
| 324 | 324 | { |
| 325 | 325 | $oDocument->updateReadedCount(); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | // disappear the document if it is secret |
| 329 | - if($oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 329 | + if ($oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 330 | 330 | { |
| 331 | - $oDocument->add('content',Context::getLang('thisissecret')); |
|
| 331 | + $oDocument->add('content', Context::getLang('thisissecret')); |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | } |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | /** |
| 349 | 349 | * @brief display the document file list (can be used by API) |
| 350 | 350 | **/ |
| 351 | - function dispBoardContentFileList(){ |
|
| 351 | + function dispBoardContentFileList() { |
|
| 352 | 352 | /** |
| 353 | 353 | * check the access grant (all the grant has been set by the module object) |
| 354 | 354 | **/ |
| 355 | - if(!$this->grant->access) |
|
| 355 | + if (!$this->grant->access) |
|
| 356 | 356 | { |
| 357 | 357 | return $this->dispBoardMessage('msg_not_permitted'); |
| 358 | 358 | } |
@@ -363,41 +363,41 @@ discard block |
||
| 363 | 363 | // Check if a permission for file download is granted |
| 364 | 364 | // Get configurations (using module model object) |
| 365 | 365 | $oModuleModel = getModel('module'); |
| 366 | - $file_module_config = $oModuleModel->getModulePartConfig('file',$this->module_srl); |
|
| 366 | + $file_module_config = $oModuleModel->getModulePartConfig('file', $this->module_srl); |
|
| 367 | 367 | |
| 368 | 368 | $downloadGrantCount = 0; |
| 369 | - if(is_array($file_module_config->download_grant)) |
|
| 369 | + if (is_array($file_module_config->download_grant)) |
|
| 370 | 370 | { |
| 371 | - foreach($file_module_config->download_grant AS $value) |
|
| 372 | - if($value) $downloadGrantCount++; |
|
| 371 | + foreach ($file_module_config->download_grant AS $value) |
|
| 372 | + if ($value) $downloadGrantCount++; |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
| 375 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
| 376 | 376 | { |
| 377 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 377 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 378 | 378 | $logged_info = Context::get('logged_info'); |
| 379 | - if($logged_info->is_admin != 'Y') |
|
| 379 | + if ($logged_info->is_admin != 'Y') |
|
| 380 | 380 | { |
| 381 | - $oModuleModel =& getModel('module'); |
|
| 381 | + $oModuleModel = & getModel('module'); |
|
| 382 | 382 | $columnList = array('module_srl', 'site_srl'); |
| 383 | 383 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl, $columnList); |
| 384 | 384 | |
| 385 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 385 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 386 | 386 | { |
| 387 | - $oMemberModel =& getModel('member'); |
|
| 387 | + $oMemberModel = & getModel('member'); |
|
| 388 | 388 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
| 389 | 389 | |
| 390 | 390 | $is_permitted = false; |
| 391 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
| 391 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
| 392 | 392 | { |
| 393 | 393 | $group_srl = $file_module_config->download_grant[$i]; |
| 394 | - if($member_groups[$group_srl]) |
|
| 394 | + if ($member_groups[$group_srl]) |
|
| 395 | 395 | { |
| 396 | 396 | $is_permitted = true; |
| 397 | 397 | break; |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 400 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $document_srl = Context::get('document_srl'); |
| 407 | 407 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 408 | 408 | Context::set('oDocument', $oDocument); |
| 409 | - Context::set('file_list',$oDocument->getUploadedFiles()); |
|
| 409 | + Context::set('file_list', $oDocument->getUploadedFiles()); |
|
| 410 | 410 | |
| 411 | 411 | $oSecurity = new Security(); |
| 412 | 412 | $oSecurity->encodeHTML('file_list..source_filename'); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | /** |
| 416 | 416 | * @brief display the document comment list (can be used by API) |
| 417 | 417 | **/ |
| 418 | - function dispBoardContentCommentList(){ |
|
| 418 | + function dispBoardContentCommentList() { |
|
| 419 | 419 | // check document view grant |
| 420 | 420 | $this->dispBoardContentView(); |
| 421 | 421 | |
@@ -425,26 +425,26 @@ discard block |
||
| 425 | 425 | $comment_list = $oDocument->getComments(); |
| 426 | 426 | |
| 427 | 427 | // setup the comment list |
| 428 | - if(is_array($comment_list)) |
|
| 428 | + if (is_array($comment_list)) |
|
| 429 | 429 | { |
| 430 | - foreach($comment_list as $key => $val) |
|
| 430 | + foreach ($comment_list as $key => $val) |
|
| 431 | 431 | { |
| 432 | - if(!$val->isAccessible()) |
|
| 432 | + if (!$val->isAccessible()) |
|
| 433 | 433 | { |
| 434 | - $val->add('content',Context::getLang('thisissecret')); |
|
| 434 | + $val->add('content', Context::getLang('thisissecret')); |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | - Context::set('comment_list',$comment_list); |
|
| 438 | + Context::set('comment_list', $comment_list); |
|
| 439 | 439 | |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
| 443 | 443 | * @brief display notice list (can be used by API) |
| 444 | 444 | **/ |
| 445 | - function dispBoardNoticeList(){ |
|
| 445 | + function dispBoardNoticeList() { |
|
| 446 | 446 | // check the grant |
| 447 | - if(!$this->grant->list) |
|
| 447 | + if (!$this->grant->list) |
|
| 448 | 448 | { |
| 449 | 449 | Context::set('notice_list', array()); |
| 450 | 450 | return; |
@@ -460,15 +460,15 @@ discard block |
||
| 460 | 460 | /** |
| 461 | 461 | * @brief display board content list |
| 462 | 462 | **/ |
| 463 | - function dispBoardContentList(){ |
|
| 463 | + function dispBoardContentList() { |
|
| 464 | 464 | // check the grant |
| 465 | - if(!$this->grant->list) |
|
| 465 | + if (!$this->grant->list) |
|
| 466 | 466 | { |
| 467 | 467 | Context::set('document_list', array()); |
| 468 | 468 | Context::set('total_count', 0); |
| 469 | 469 | Context::set('total_page', 1); |
| 470 | 470 | Context::set('page', 1); |
| 471 | - Context::set('page_navigation', new PageHandler(0,0,1,10)); |
|
| 471 | + Context::set('page_navigation', new PageHandler(0, 0, 1, 10)); |
|
| 472 | 472 | return; |
| 473 | 473 | } |
| 474 | 474 | |
@@ -486,17 +486,17 @@ discard block |
||
| 486 | 486 | $args->search_keyword = Context::get('search_keyword'); |
| 487 | 487 | |
| 488 | 488 | $search_option = Context::get('search_option'); |
| 489 | - if($search_option==FALSE) |
|
| 489 | + if ($search_option == FALSE) |
|
| 490 | 490 | { |
| 491 | 491 | $search_option = $this->search_option; |
| 492 | 492 | } |
| 493 | - if(isset($search_option[$args->search_target])==FALSE) |
|
| 493 | + if (isset($search_option[$args->search_target]) == FALSE) |
|
| 494 | 494 | { |
| 495 | 495 | $args->search_target = ''; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | // if the category is enabled, then get the category |
| 499 | - if($this->module_info->use_category=='Y') |
|
| 499 | + if ($this->module_info->use_category == 'Y') |
|
| 500 | 500 | { |
| 501 | 501 | $args->category_srl = Context::get('category'); |
| 502 | 502 | } |
@@ -504,21 +504,21 @@ discard block |
||
| 504 | 504 | // setup the sort index and order index |
| 505 | 505 | $args->sort_index = Context::get('sort_index'); |
| 506 | 506 | $args->order_type = Context::get('order_type'); |
| 507 | - if(!in_array($args->sort_index, $this->order_target)) |
|
| 507 | + if (!in_array($args->sort_index, $this->order_target)) |
|
| 508 | 508 | { |
| 509 | - $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; |
|
| 509 | + $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; |
|
| 510 | 510 | } |
| 511 | - if(!in_array($args->order_type, array('asc','desc'))) |
|
| 511 | + if (!in_array($args->order_type, array('asc', 'desc'))) |
|
| 512 | 512 | { |
| 513 | - $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc'; |
|
| 513 | + $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | // set the current page of documents |
| 517 | 517 | $document_srl = Context::get('document_srl'); |
| 518 | - if(!$args->page && $document_srl) |
|
| 518 | + if (!$args->page && $document_srl) |
|
| 519 | 519 | { |
| 520 | 520 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 521 | - if($oDocument->isExists() && !$oDocument->isNotice()) |
|
| 521 | + if ($oDocument->isExists() && !$oDocument->isNotice()) |
|
| 522 | 522 | { |
| 523 | 523 | $page = $oDocumentModel->getDocumentPage($oDocument, $args); |
| 524 | 524 | Context::set('page', $page); |
@@ -527,21 +527,21 @@ discard block |
||
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | // setup the list count to be serach list count, if the category or search keyword has been set |
| 530 | - if($args->category_srl || $args->search_keyword) |
|
| 530 | + if ($args->category_srl || $args->search_keyword) |
|
| 531 | 531 | { |
| 532 | 532 | $args->list_count = $this->search_list_count; |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | // if the consultation function is enabled, the get the logged user information |
| 536 | - if($this->consultation) |
|
| 536 | + if ($this->consultation) |
|
| 537 | 537 | { |
| 538 | 538 | $logged_info = Context::get('logged_info'); |
| 539 | 539 | $args->member_srl = $logged_info->member_srl; |
| 540 | 540 | |
| 541 | - if($this->module_info->use_anonymous === 'Y') |
|
| 541 | + if ($this->module_info->use_anonymous === 'Y') |
|
| 542 | 542 | { |
| 543 | 543 | unset($args->member_srl); |
| 544 | - $args->member_srls = $logged_info->member_srl . ',' . $logged_info->member_srl * -1; |
|
| 544 | + $args->member_srls = $logged_info->member_srl.','.$logged_info->member_srl * -1; |
|
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | |
@@ -567,18 +567,18 @@ discard block |
||
| 567 | 567 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
| 568 | 568 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
| 569 | 569 | |
| 570 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
| 570 | + if (in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
| 571 | 571 | |
| 572 | 572 | // default column list add |
| 573 | 573 | $defaultColumn = array('document_srl', 'module_srl', 'category_srl', 'lang_code', 'member_srl', 'last_update', 'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'title_bold', 'title_color'); |
| 574 | 574 | |
| 575 | 575 | //TODO guestbook, blog style supports legacy codes. |
| 576 | - if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
| 576 | + if ($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
| 577 | 577 | { |
| 578 | 578 | $defaultColumn = $tableColumnList; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - if (in_array('last_post', $configColumList)){ |
|
| 581 | + if (in_array('last_post', $configColumList)) { |
|
| 582 | 582 | array_push($this->columnList, 'last_updater'); |
| 583 | 583 | } |
| 584 | 584 | |
@@ -590,9 +590,9 @@ discard block |
||
| 590 | 590 | $this->columnList = array_unique(array_merge($this->columnList, $defaultColumn)); |
| 591 | 591 | |
| 592 | 592 | // add table name |
| 593 | - foreach($this->columnList as $no => $value) |
|
| 593 | + foreach ($this->columnList as $no => $value) |
|
| 594 | 594 | { |
| 595 | - $this->columnList[$no] = 'documents.' . $value; |
|
| 595 | + $this->columnList[$no] = 'documents.'.$value; |
|
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | function dispBoardTagList() |
| 603 | 603 | { |
| 604 | 604 | // check if there is not grant fot view list, then alert an warning message |
| 605 | - if(!$this->grant->list) |
|
| 605 | + if (!$this->grant->list) |
|
| 606 | 606 | { |
| 607 | 607 | return $this->dispBoardMessage('msg_not_permitted'); |
| 608 | 608 | } |
@@ -616,14 +616,14 @@ discard block |
||
| 616 | 616 | $output = $oTagModel->getTagList($obj); |
| 617 | 617 | |
| 618 | 618 | // automatically order |
| 619 | - if(count($output->data)) |
|
| 619 | + if (count($output->data)) |
|
| 620 | 620 | { |
| 621 | 621 | $numbers = array_keys($output->data); |
| 622 | 622 | shuffle($numbers); |
| 623 | 623 | |
| 624 | - if(count($output->data)) |
|
| 624 | + if (count($output->data)) |
|
| 625 | 625 | { |
| 626 | - foreach($numbers as $k => $v) |
|
| 626 | + foreach ($numbers as $k => $v) |
|
| 627 | 627 | { |
| 628 | 628 | $tag_list[] = $output->data[$v]; |
| 629 | 629 | } |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | function dispBoardWrite() |
| 645 | 645 | { |
| 646 | 646 | // check grant |
| 647 | - if(!$this->grant->write_document) |
|
| 647 | + if (!$this->grant->write_document) |
|
| 648 | 648 | { |
| 649 | 649 | return $this->dispBoardMessage('msg_not_permitted'); |
| 650 | 650 | } |
@@ -654,10 +654,10 @@ discard block |
||
| 654 | 654 | /** |
| 655 | 655 | * check if the category option is enabled not not |
| 656 | 656 | **/ |
| 657 | - if($this->module_info->use_category=='Y') |
|
| 657 | + if ($this->module_info->use_category == 'Y') |
|
| 658 | 658 | { |
| 659 | 659 | // get the user group information |
| 660 | - if(Context::get('is_logged')) |
|
| 660 | + if (Context::get('is_logged')) |
|
| 661 | 661 | { |
| 662 | 662 | $logged_info = Context::get('logged_info'); |
| 663 | 663 | $group_srls = array_keys($logged_info->group_list); |
@@ -670,19 +670,19 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | // check the grant after obtained the category list |
| 672 | 672 | $normal_category_list = $oDocumentModel->getCategoryList($this->module_srl); |
| 673 | - if(count($normal_category_list)) |
|
| 673 | + if (count($normal_category_list)) |
|
| 674 | 674 | { |
| 675 | - foreach($normal_category_list as $category_srl => $category) |
|
| 675 | + foreach ($normal_category_list as $category_srl => $category) |
|
| 676 | 676 | { |
| 677 | 677 | $is_granted = TRUE; |
| 678 | - if($category->group_srls) |
|
| 678 | + if ($category->group_srls) |
|
| 679 | 679 | { |
| 680 | - $category_group_srls = explode(',',$category->group_srls); |
|
| 680 | + $category_group_srls = explode(',', $category->group_srls); |
|
| 681 | 681 | $is_granted = FALSE; |
| 682 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
| 682 | + if (count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
| 683 | 683 | |
| 684 | 684 | } |
| 685 | - if($is_granted) $category_list[$category_srl] = $category; |
|
| 685 | + if ($is_granted) $category_list[$category_srl] = $category; |
|
| 686 | 686 | } |
| 687 | 687 | } |
| 688 | 688 | Context::set('category_list', $category_list); |
@@ -693,46 +693,46 @@ discard block |
||
| 693 | 693 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
| 694 | 694 | $oDocument->setDocument($document_srl); |
| 695 | 695 | |
| 696 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
| 696 | + if ($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
| 697 | 697 | $oDocument->add('module_srl', $this->module_srl); |
| 698 | 698 | |
| 699 | - if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 699 | + if ($oDocument->isExists() && $this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 700 | 700 | { |
| 701 | 701 | return new BaseObject(-1, 'msg_protect_content'); |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | // if the document is not granted, then back to the password input form |
| 705 | 705 | $oModuleModel = getModel('module'); |
| 706 | - if($oDocument->isExists()&&!$oDocument->isGranted()) |
|
| 706 | + if ($oDocument->isExists() && !$oDocument->isGranted()) |
|
| 707 | 707 | { |
| 708 | 708 | return $this->setTemplateFile('input_password_form'); |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | - if(!$oDocument->isExists()) |
|
| 711 | + if (!$oDocument->isExists()) |
|
| 712 | 712 | { |
| 713 | - $point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl); |
|
| 713 | + $point_config = $oModuleModel->getModulePartConfig('point', $this->module_srl); |
|
| 714 | 714 | $logged_info = Context::get('logged_info'); |
| 715 | 715 | $oPointModel = getModel('point'); |
| 716 | 716 | $pointForInsert = $point_config["insert_document"]; |
| 717 | - if($pointForInsert < 0) |
|
| 717 | + if ($pointForInsert < 0) |
|
| 718 | 718 | { |
| 719 | - if( !$logged_info ) |
|
| 719 | + if (!$logged_info) |
|
| 720 | 720 | { |
| 721 | 721 | return $this->dispBoardMessage('msg_not_permitted'); |
| 722 | 722 | } |
| 723 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
| 723 | + else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert) < 0) |
|
| 724 | 724 | { |
| 725 | 725 | return $this->dispBoardMessage('msg_not_enough_point'); |
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | 728 | } |
| 729 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 729 | + if (!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 730 | 730 | |
| 731 | 731 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 732 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
| 732 | + if (count($statusList) > 0) Context::set('status_list', $statusList); |
|
| 733 | 733 | |
| 734 | 734 | // get Document status config value |
| 735 | - Context::set('document_srl',$document_srl); |
|
| 735 | + Context::set('document_srl', $document_srl); |
|
| 736 | 736 | Context::set('oDocument', $oDocument); |
| 737 | 737 | |
| 738 | 738 | // apply xml_js_filter on header |
@@ -740,12 +740,12 @@ discard block |
||
| 740 | 740 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
| 741 | 741 | |
| 742 | 742 | // if the document exists, then setup extra variabels on context |
| 743 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 743 | + if ($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 744 | 744 | |
| 745 | 745 | /** |
| 746 | 746 | * add JS filters |
| 747 | 747 | **/ |
| 748 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 748 | + if (Context::get('logged_info')->is_admin == 'Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 749 | 749 | else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
| 750 | 750 | |
| 751 | 751 | $oSecurity = new Security(); |
@@ -757,14 +757,14 @@ discard block |
||
| 757 | 757 | function _getStatusNameList(&$oDocumentModel) |
| 758 | 758 | { |
| 759 | 759 | $resultList = array(); |
| 760 | - if(!empty($this->module_info->use_status)) |
|
| 760 | + if (!empty($this->module_info->use_status)) |
|
| 761 | 761 | { |
| 762 | 762 | $statusNameList = $oDocumentModel->getStatusNameList(); |
| 763 | 763 | $statusList = explode('|@|', $this->module_info->use_status); |
| 764 | 764 | |
| 765 | - if(is_array($statusList)) |
|
| 765 | + if (is_array($statusList)) |
|
| 766 | 766 | { |
| 767 | - foreach($statusList as $key => $value) |
|
| 767 | + foreach ($statusList as $key => $value) |
|
| 768 | 768 | { |
| 769 | 769 | $resultList[$value] = $statusNameList[$value]; |
| 770 | 770 | } |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | function dispBoardDelete() |
| 780 | 780 | { |
| 781 | 781 | // check grant |
| 782 | - if(!$this->grant->write_document) |
|
| 782 | + if (!$this->grant->write_document) |
|
| 783 | 783 | { |
| 784 | 784 | return $this->dispBoardMessage('msg_not_permitted'); |
| 785 | 785 | } |
@@ -788,30 +788,30 @@ discard block |
||
| 788 | 788 | $document_srl = Context::get('document_srl'); |
| 789 | 789 | |
| 790 | 790 | // if document exists, get the document information |
| 791 | - if($document_srl) |
|
| 791 | + if ($document_srl) |
|
| 792 | 792 | { |
| 793 | 793 | $oDocumentModel = getModel('document'); |
| 794 | 794 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | // if the document is not existed, then back to the board content page |
| 798 | - if(!$oDocument || !$oDocument->isExists()) |
|
| 798 | + if (!$oDocument || !$oDocument->isExists()) |
|
| 799 | 799 | { |
| 800 | 800 | return $this->dispBoardContent(); |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | // if the document is not granted, then back to the password input form |
| 804 | - if(!$oDocument->isGranted()) |
|
| 804 | + if (!$oDocument->isGranted()) |
|
| 805 | 805 | { |
| 806 | 806 | return $this->setTemplateFile('input_password_form'); |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 809 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 810 | 810 | { |
| 811 | 811 | return $this->dispBoardMessage('msg_protect_content'); |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | - Context::set('oDocument',$oDocument); |
|
| 814 | + Context::set('oDocument', $oDocument); |
|
| 815 | 815 | |
| 816 | 816 | /** |
| 817 | 817 | * add JS filters |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | $document_srl = Context::get('document_srl'); |
| 830 | 830 | |
| 831 | 831 | // check grant |
| 832 | - if(!$this->grant->write_comment) |
|
| 832 | + if (!$this->grant->write_comment) |
|
| 833 | 833 | { |
| 834 | 834 | return $this->dispBoardMessage('msg_not_permitted'); |
| 835 | 835 | } |
@@ -837,13 +837,13 @@ discard block |
||
| 837 | 837 | // get the document information |
| 838 | 838 | $oDocumentModel = getModel('document'); |
| 839 | 839 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 840 | - if(!$oDocument->isExists()) |
|
| 840 | + if (!$oDocument->isExists()) |
|
| 841 | 841 | { |
| 842 | 842 | return $this->dispBoardMessage('msg_invalid_request'); |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | // Check allow comment |
| 846 | - if(!$oDocument->allowComment()) |
|
| 846 | + if (!$oDocument->allowComment()) |
|
| 847 | 847 | { |
| 848 | 848 | return $this->dispBoardMessage('msg_not_allow_comment'); |
| 849 | 849 | } |
@@ -855,9 +855,9 @@ discard block |
||
| 855 | 855 | $oComment->add('module_srl', $this->module_srl); |
| 856 | 856 | |
| 857 | 857 | // setup document variables on context |
| 858 | - Context::set('oDocument',$oDocument); |
|
| 859 | - Context::set('oSourceComment',$oSourceComment); |
|
| 860 | - Context::set('oComment',$oComment); |
|
| 858 | + Context::set('oDocument', $oDocument); |
|
| 859 | + Context::set('oSourceComment', $oSourceComment); |
|
| 860 | + Context::set('oComment', $oComment); |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * add JS filter |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | function dispBoardReplyComment() |
| 874 | 874 | { |
| 875 | 875 | // check grant |
| 876 | - if(!$this->grant->write_comment) |
|
| 876 | + if (!$this->grant->write_comment) |
|
| 877 | 877 | { |
| 878 | 878 | return $this->dispBoardMessage('msg_not_permitted'); |
| 879 | 879 | } |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | $parent_srl = Context::get('comment_srl'); |
| 883 | 883 | |
| 884 | 884 | // if the parent comment is not existed |
| 885 | - if(!$parent_srl) |
|
| 885 | + if (!$parent_srl) |
|
| 886 | 886 | { |
| 887 | 887 | return new BaseObject(-1, 'msg_invalid_request'); |
| 888 | 888 | } |
@@ -892,11 +892,11 @@ discard block |
||
| 892 | 892 | $oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager); |
| 893 | 893 | |
| 894 | 894 | // if the comment is not existed, opoup an error message |
| 895 | - if(!$oSourceComment->isExists()) |
|
| 895 | + if (!$oSourceComment->isExists()) |
|
| 896 | 896 | { |
| 897 | 897 | return $this->dispBoardMessage('msg_invalid_request'); |
| 898 | 898 | } |
| 899 | - if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
| 899 | + if (Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
| 900 | 900 | { |
| 901 | 901 | return $this->dispBoardMessage('msg_invalid_request'); |
| 902 | 902 | } |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | // Check allow comment |
| 905 | 905 | $oDocumentModel = getModel('document'); |
| 906 | 906 | $oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl')); |
| 907 | - if(!$oDocument->allowComment()) |
|
| 907 | + if (!$oDocument->allowComment()) |
|
| 908 | 908 | { |
| 909 | 909 | return $this->dispBoardMessage('msg_not_allow_comment'); |
| 910 | 910 | } |
@@ -915,9 +915,9 @@ discard block |
||
| 915 | 915 | $oComment->add('document_srl', $oSourceComment->get('document_srl')); |
| 916 | 916 | |
| 917 | 917 | // setup comment variables |
| 918 | - Context::set('oSourceComment',$oSourceComment); |
|
| 919 | - Context::set('oComment',$oComment); |
|
| 920 | - Context::set('module_srl',$this->module_info->module_srl); |
|
| 918 | + Context::set('oSourceComment', $oSourceComment); |
|
| 919 | + Context::set('oComment', $oComment); |
|
| 920 | + Context::set('module_srl', $this->module_info->module_srl); |
|
| 921 | 921 | |
| 922 | 922 | /** |
| 923 | 923 | * add JS filters |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | function dispBoardModifyComment() |
| 934 | 934 | { |
| 935 | 935 | // check grant |
| 936 | - if(!$this->grant->write_comment) |
|
| 936 | + if (!$this->grant->write_comment) |
|
| 937 | 937 | { |
| 938 | 938 | return $this->dispBoardMessage('msg_not_permitted'); |
| 939 | 939 | } |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | $comment_srl = Context::get('comment_srl'); |
| 944 | 944 | |
| 945 | 945 | // if the comment is not existed |
| 946 | - if(!$comment_srl) |
|
| 946 | + if (!$comment_srl) |
|
| 947 | 947 | { |
| 948 | 948 | return new BaseObject(-1, 'msg_invalid_request'); |
| 949 | 949 | } |
@@ -953,13 +953,13 @@ discard block |
||
| 953 | 953 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
| 954 | 954 | |
| 955 | 955 | // if the comment is not exited, alert an error message |
| 956 | - if(!$oComment->isExists()) |
|
| 956 | + if (!$oComment->isExists()) |
|
| 957 | 957 | { |
| 958 | 958 | return $this->dispBoardMessage('msg_invalid_request'); |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | // if the comment is not granted, then back to the password input form |
| 962 | - if(!$oComment->isGranted()) |
|
| 962 | + if (!$oComment->isGranted()) |
|
| 963 | 963 | { |
| 964 | 964 | return $this->setTemplateFile('input_password_form'); |
| 965 | 965 | } |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | function dispBoardDeleteComment() |
| 983 | 983 | { |
| 984 | 984 | // check grant |
| 985 | - if(!$this->grant->write_comment) |
|
| 985 | + if (!$this->grant->write_comment) |
|
| 986 | 986 | { |
| 987 | 987 | return $this->dispBoardMessage('msg_not_permitted'); |
| 988 | 988 | } |
@@ -991,25 +991,25 @@ discard block |
||
| 991 | 991 | $comment_srl = Context::get('comment_srl'); |
| 992 | 992 | |
| 993 | 993 | // if the comment exists, then get the comment information |
| 994 | - if($comment_srl) |
|
| 994 | + if ($comment_srl) |
|
| 995 | 995 | { |
| 996 | 996 | $oCommentModel = getModel('comment'); |
| 997 | 997 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | // if the comment is not existed, then back to the board content page |
| 1001 | - if(!$oComment->isExists() ) |
|
| 1001 | + if (!$oComment->isExists()) |
|
| 1002 | 1002 | { |
| 1003 | 1003 | return $this->dispBoardContent(); |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | // if the comment is not granted, then back to the password input form |
| 1007 | - if(!$oComment->isGranted()) |
|
| 1007 | + if (!$oComment->isGranted()) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | return $this->setTemplateFile('input_password_form'); |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | - Context::set('oComment',$oComment); |
|
| 1012 | + Context::set('oComment', $oComment); |
|
| 1013 | 1013 | |
| 1014 | 1014 | /** |
| 1015 | 1015 | * add JS filters |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | { |
| 1027 | 1027 | $oTrackbackModel = getModel('trackback'); |
| 1028 | 1028 | |
| 1029 | - if(!$oTrackbackModel) |
|
| 1029 | + if (!$oTrackbackModel) |
|
| 1030 | 1030 | { |
| 1031 | 1031 | return; |
| 1032 | 1032 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | $trackback = $output->data; |
| 1041 | 1041 | |
| 1042 | 1042 | // if no trackback, then display the board content |
| 1043 | - if(!$trackback) |
|
| 1043 | + if (!$trackback) |
|
| 1044 | 1044 | { |
| 1045 | 1045 | return $this->dispBoardContent(); |
| 1046 | 1046 | } |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | function dispBoardMessage($msg_code) |
| 1062 | 1062 | { |
| 1063 | 1063 | $msg = Context::getLang($msg_code); |
| 1064 | - if(!$msg) $msg = $msg_code; |
|
| 1064 | + if (!$msg) $msg = $msg_code; |
|
| 1065 | 1065 | Context::set('message', $msg); |
| 1066 | 1066 | $this->setTemplateFile('message'); |
| 1067 | 1067 | } |
@@ -1072,8 +1072,8 @@ discard block |
||
| 1072 | 1072 | **/ |
| 1073 | 1073 | function alertMessage($message) |
| 1074 | 1074 | { |
| 1075 | - $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
| 1076 | - Context::addHtmlFooter( $script ); |
|
| 1075 | + $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
| 1076 | + Context::addHtmlFooter($script); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | } |
@@ -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,15 +851,15 @@ 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 | } |
@@ -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,14 +960,14 @@ discard block |
||
| 960 | 960 | FileHandler::removeFile($thumbnail_lockfile); |
| 961 | 961 | |
| 962 | 962 | // Return the thumbnail path if it was successfully generated |
| 963 | - if($output_file) |
|
| 963 | + if ($output_file) |
|
| 964 | 964 | { |
| 965 | 965 | return $thumbnail_url; |
| 966 | 966 | } |
| 967 | 967 | // Create an empty file if thumbnail generation failed |
| 968 | 968 | else |
| 969 | 969 | { |
| 970 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 970 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | return; |
@@ -981,21 +981,21 @@ discard block |
||
| 981 | 981 | */ |
| 982 | 982 | function getExtraImages($time_interval = 43200) |
| 983 | 983 | { |
| 984 | - if(!$this->document_srl) return; |
|
| 984 | + if (!$this->document_srl) return; |
|
| 985 | 985 | // variables for icon list |
| 986 | 986 | $buffs = array(); |
| 987 | 987 | |
| 988 | 988 | $check_files = false; |
| 989 | 989 | |
| 990 | 990 | // Check if secret post is |
| 991 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 991 | + if ($this->isSecret()) $buffs[] = "secret"; |
|
| 992 | 992 | |
| 993 | 993 | // Set the latest time |
| 994 | - $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
|
| 994 | + $time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval); |
|
| 995 | 995 | |
| 996 | 996 | // Check new post |
| 997 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 998 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 997 | + if ($this->get('regdate') > $time_check) $buffs[] = "new"; |
|
| 998 | + else if ($this->get('last_update') > $time_check) $buffs[] = "update"; |
|
| 999 | 999 | |
| 1000 | 1000 | /* |
| 1001 | 1001 | $content = $this->get('content'); |
@@ -1018,14 +1018,14 @@ discard block |
||
| 1018 | 1018 | */ |
| 1019 | 1019 | |
| 1020 | 1020 | // Check the attachment |
| 1021 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1021 | + if ($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1022 | 1022 | |
| 1023 | 1023 | return $buffs; |
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | function getStatus() |
| 1027 | 1027 | { |
| 1028 | - if(!$this->get('status')) { |
|
| 1028 | + if (!$this->get('status')) { |
|
| 1029 | 1029 | $oDocumentClass = getClass('document'); |
| 1030 | 1030 | return $oDocumentClass->getDefaultStatus(); |
| 1031 | 1031 | } |
@@ -1039,11 +1039,11 @@ discard block |
||
| 1039 | 1039 | */ |
| 1040 | 1040 | function printExtraImages($time_check = 43200) |
| 1041 | 1041 | { |
| 1042 | - if(!$this->document_srl) return; |
|
| 1042 | + if (!$this->document_srl) return; |
|
| 1043 | 1043 | |
| 1044 | 1044 | $oDocumentModel = getModel('document'); |
| 1045 | 1045 | $documentConfig = $oDocumentModel->getDocumentConfig(); |
| 1046 | - if(Mobile::isFromMobilePhone()) |
|
| 1046 | + if (Mobile::isFromMobilePhone()) |
|
| 1047 | 1047 | { |
| 1048 | 1048 | $iconSkin = $documentConfig->micons; |
| 1049 | 1049 | } |
@@ -1051,13 +1051,13 @@ discard block |
||
| 1051 | 1051 | { |
| 1052 | 1052 | $iconSkin = $documentConfig->icons; |
| 1053 | 1053 | } |
| 1054 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1054 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1055 | 1055 | |
| 1056 | 1056 | $buffs = $this->getExtraImages($time_check); |
| 1057 | - if(!count($buffs)) return; |
|
| 1057 | + if (!count($buffs)) return; |
|
| 1058 | 1058 | |
| 1059 | 1059 | $buff = array(); |
| 1060 | - foreach($buffs as $key => $val) |
|
| 1060 | + foreach ($buffs as $key => $val) |
|
| 1061 | 1061 | { |
| 1062 | 1062 | $buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val); |
| 1063 | 1063 | } |
@@ -1066,20 +1066,20 @@ discard block |
||
| 1066 | 1066 | |
| 1067 | 1067 | function hasUploadedFiles() |
| 1068 | 1068 | { |
| 1069 | - if(!$this->document_srl) return; |
|
| 1069 | + if (!$this->document_srl) return; |
|
| 1070 | 1070 | |
| 1071 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1072 | - return $this->get('uploaded_count')? true : false; |
|
| 1071 | + if ($this->isSecret() && !$this->isGranted()) return false; |
|
| 1072 | + return $this->get('uploaded_count') ? true : false; |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1076 | 1076 | { |
| 1077 | - if(!$this->document_srl) return; |
|
| 1077 | + if (!$this->document_srl) return; |
|
| 1078 | 1078 | |
| 1079 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1080 | - if(!$this->get('uploaded_count')) return; |
|
| 1079 | + if ($this->isSecret() && !$this->isGranted()) return; |
|
| 1080 | + if (!$this->get('uploaded_count')) return; |
|
| 1081 | 1081 | |
| 1082 | - if(!$this->uploadedFiles[$sortIndex]) |
|
| 1082 | + if (!$this->uploadedFiles[$sortIndex]) |
|
| 1083 | 1083 | { |
| 1084 | 1084 | $oFileModel = getModel('file'); |
| 1085 | 1085 | $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true); |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | function getEditor() |
| 1096 | 1096 | { |
| 1097 | 1097 | $module_srl = $this->get('module_srl'); |
| 1098 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1098 | + if (!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1099 | 1099 | |
| 1100 | 1100 | $oEditorModel = getModel('editor'); |
| 1101 | 1101 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | { |
| 1111 | 1111 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1112 | 1112 | if (!$this->allowComment()) return false; |
| 1113 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1113 | + if (!$this->isGranted() && $this->isSecret()) return false; |
|
| 1114 | 1114 | |
| 1115 | 1115 | return true; |
| 1116 | 1116 | } |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | */ |
| 1122 | 1122 | function getCommentEditor() |
| 1123 | 1123 | { |
| 1124 | - if(!$this->isEnableComment()) return; |
|
| 1124 | + if (!$this->isEnableComment()) return; |
|
| 1125 | 1125 | |
| 1126 | 1126 | $oEditorModel = getModel('editor'); |
| 1127 | 1127 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1133,10 +1133,10 @@ discard block |
||
| 1133 | 1133 | */ |
| 1134 | 1134 | function getProfileImage() |
| 1135 | 1135 | { |
| 1136 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1136 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1137 | 1137 | $oMemberModel = getModel('member'); |
| 1138 | 1138 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1139 | - if(!$profile_info) return; |
|
| 1139 | + if (!$profile_info) return; |
|
| 1140 | 1140 | |
| 1141 | 1141 | return $profile_info->src; |
| 1142 | 1142 | } |
@@ -1148,21 +1148,21 @@ discard block |
||
| 1148 | 1148 | function getSignature() |
| 1149 | 1149 | { |
| 1150 | 1150 | // Pass if a document doesn't exist |
| 1151 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1151 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1152 | 1152 | // Get signature information |
| 1153 | 1153 | $oMemberModel = getModel('member'); |
| 1154 | 1154 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
| 1155 | 1155 | // Check if a maximum height of signiture is set in the member module |
| 1156 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1156 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1157 | 1157 | { |
| 1158 | 1158 | $oModuleModel = getModel('module'); |
| 1159 | 1159 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1160 | 1160 | $GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height; |
| 1161 | 1161 | } |
| 1162 | - if($signature) |
|
| 1162 | + if ($signature) |
|
| 1163 | 1163 | { |
| 1164 | 1164 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1165 | - 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); |
|
| 1165 | + 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); |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | return $signature; |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | */ |
| 1176 | 1176 | function replaceResourceRealPath($matches) |
| 1177 | 1177 | { |
| 1178 | - return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1178 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | 1181 | /** |
@@ -1186,19 +1186,19 @@ discard block |
||
| 1186 | 1186 | function _checkAccessibleFromStatus() |
| 1187 | 1187 | { |
| 1188 | 1188 | $logged_info = Context::get('logged_info'); |
| 1189 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1189 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 1190 | 1190 | |
| 1191 | 1191 | $status = $this->get('status'); |
| 1192 | - if(empty($status)) return false; |
|
| 1192 | + if (empty($status)) return false; |
|
| 1193 | 1193 | |
| 1194 | 1194 | $oDocumentModel = getModel('document'); |
| 1195 | 1195 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1196 | 1196 | |
| 1197 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1197 | + if ($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1198 | 1198 | return true; |
| 1199 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1199 | + else if ($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1200 | 1200 | { |
| 1201 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1201 | + if ($this->get('member_srl') == $logged_info->member_srl) |
|
| 1202 | 1202 | return true; |
| 1203 | 1203 | } |
| 1204 | 1204 | 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; |
| 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; |
@@ -981,21 +1086,28 @@ discard block |
||
| 981 | 1086 | */ |
| 982 | 1087 | function getExtraImages($time_interval = 43200) |
| 983 | 1088 | { |
| 984 | - if(!$this->document_srl) return; |
|
| 1089 | + if(!$this->document_srl) { |
|
| 1090 | + return; |
|
| 1091 | + } |
|
| 985 | 1092 | // variables for icon list |
| 986 | 1093 | $buffs = array(); |
| 987 | 1094 | |
| 988 | 1095 | $check_files = false; |
| 989 | 1096 | |
| 990 | 1097 | // Check if secret post is |
| 991 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 1098 | + if($this->isSecret()) { |
|
| 1099 | + $buffs[] = "secret"; |
|
| 1100 | + } |
|
| 992 | 1101 | |
| 993 | 1102 | // Set the latest time |
| 994 | 1103 | $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
| 995 | 1104 | |
| 996 | 1105 | // Check new post |
| 997 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 998 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 1106 | + if($this->get('regdate')>$time_check) { |
|
| 1107 | + $buffs[] = "new"; |
|
| 1108 | + } else if($this->get('last_update')>$time_check) { |
|
| 1109 | + $buffs[] = "update"; |
|
| 1110 | + } |
|
| 999 | 1111 | |
| 1000 | 1112 | /* |
| 1001 | 1113 | $content = $this->get('content'); |
@@ -1018,7 +1130,9 @@ discard block |
||
| 1018 | 1130 | */ |
| 1019 | 1131 | |
| 1020 | 1132 | // Check the attachment |
| 1021 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1133 | + if($this->hasUploadedFiles()) { |
|
| 1134 | + $buffs[] = "file"; |
|
| 1135 | + } |
|
| 1022 | 1136 | |
| 1023 | 1137 | return $buffs; |
| 1024 | 1138 | } |
@@ -1039,22 +1153,25 @@ discard block |
||
| 1039 | 1153 | */ |
| 1040 | 1154 | function printExtraImages($time_check = 43200) |
| 1041 | 1155 | { |
| 1042 | - if(!$this->document_srl) return; |
|
| 1156 | + if(!$this->document_srl) { |
|
| 1157 | + return; |
|
| 1158 | + } |
|
| 1043 | 1159 | |
| 1044 | 1160 | $oDocumentModel = getModel('document'); |
| 1045 | 1161 | $documentConfig = $oDocumentModel->getDocumentConfig(); |
| 1046 | 1162 | if(Mobile::isFromMobilePhone()) |
| 1047 | 1163 | { |
| 1048 | 1164 | $iconSkin = $documentConfig->micons; |
| 1049 | - } |
|
| 1050 | - else |
|
| 1165 | + } else |
|
| 1051 | 1166 | { |
| 1052 | 1167 | $iconSkin = $documentConfig->icons; |
| 1053 | 1168 | } |
| 1054 | 1169 | $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
| 1055 | 1170 | |
| 1056 | 1171 | $buffs = $this->getExtraImages($time_check); |
| 1057 | - if(!count($buffs)) return; |
|
| 1172 | + if(!count($buffs)) { |
|
| 1173 | + return; |
|
| 1174 | + } |
|
| 1058 | 1175 | |
| 1059 | 1176 | $buff = array(); |
| 1060 | 1177 | foreach($buffs as $key => $val) |
@@ -1066,18 +1183,28 @@ discard block |
||
| 1066 | 1183 | |
| 1067 | 1184 | function hasUploadedFiles() |
| 1068 | 1185 | { |
| 1069 | - if(!$this->document_srl) return; |
|
| 1186 | + if(!$this->document_srl) { |
|
| 1187 | + return; |
|
| 1188 | + } |
|
| 1070 | 1189 | |
| 1071 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1190 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1191 | + return false; |
|
| 1192 | + } |
|
| 1072 | 1193 | return $this->get('uploaded_count')? true : false; |
| 1073 | 1194 | } |
| 1074 | 1195 | |
| 1075 | 1196 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1076 | 1197 | { |
| 1077 | - if(!$this->document_srl) return; |
|
| 1198 | + if(!$this->document_srl) { |
|
| 1199 | + return; |
|
| 1200 | + } |
|
| 1078 | 1201 | |
| 1079 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1080 | - if(!$this->get('uploaded_count')) return; |
|
| 1202 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1203 | + return; |
|
| 1204 | + } |
|
| 1205 | + if(!$this->get('uploaded_count')) { |
|
| 1206 | + return; |
|
| 1207 | + } |
|
| 1081 | 1208 | |
| 1082 | 1209 | if(!$this->uploadedFiles[$sortIndex]) |
| 1083 | 1210 | { |
@@ -1095,7 +1222,9 @@ discard block |
||
| 1095 | 1222 | function getEditor() |
| 1096 | 1223 | { |
| 1097 | 1224 | $module_srl = $this->get('module_srl'); |
| 1098 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1225 | + if(!$module_srl) { |
|
| 1226 | + $module_srl = Context::get('module_srl'); |
|
| 1227 | + } |
|
| 1099 | 1228 | |
| 1100 | 1229 | $oEditorModel = getModel('editor'); |
| 1101 | 1230 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1109,8 +1238,12 @@ discard block |
||
| 1109 | 1238 | function isEnableComment() |
| 1110 | 1239 | { |
| 1111 | 1240 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1112 | - if (!$this->allowComment()) return false; |
|
| 1113 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1241 | + if (!$this->allowComment()) { |
|
| 1242 | + return false; |
|
| 1243 | + } |
|
| 1244 | + if(!$this->isGranted() && $this->isSecret()) { |
|
| 1245 | + return false; |
|
| 1246 | + } |
|
| 1114 | 1247 | |
| 1115 | 1248 | return true; |
| 1116 | 1249 | } |
@@ -1121,7 +1254,9 @@ discard block |
||
| 1121 | 1254 | */ |
| 1122 | 1255 | function getCommentEditor() |
| 1123 | 1256 | { |
| 1124 | - if(!$this->isEnableComment()) return; |
|
| 1257 | + if(!$this->isEnableComment()) { |
|
| 1258 | + return; |
|
| 1259 | + } |
|
| 1125 | 1260 | |
| 1126 | 1261 | $oEditorModel = getModel('editor'); |
| 1127 | 1262 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1133,10 +1268,14 @@ discard block |
||
| 1133 | 1268 | */ |
| 1134 | 1269 | function getProfileImage() |
| 1135 | 1270 | { |
| 1136 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1271 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1272 | + return; |
|
| 1273 | + } |
|
| 1137 | 1274 | $oMemberModel = getModel('member'); |
| 1138 | 1275 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1139 | - if(!$profile_info) return; |
|
| 1276 | + if(!$profile_info) { |
|
| 1277 | + return; |
|
| 1278 | + } |
|
| 1140 | 1279 | |
| 1141 | 1280 | return $profile_info->src; |
| 1142 | 1281 | } |
@@ -1148,7 +1287,9 @@ discard block |
||
| 1148 | 1287 | function getSignature() |
| 1149 | 1288 | { |
| 1150 | 1289 | // Pass if a document doesn't exist |
| 1151 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1290 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1291 | + return; |
|
| 1292 | + } |
|
| 1152 | 1293 | // Get signature information |
| 1153 | 1294 | $oMemberModel = getModel('member'); |
| 1154 | 1295 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
@@ -1162,7 +1303,9 @@ discard block |
||
| 1162 | 1303 | if($signature) |
| 1163 | 1304 | { |
| 1164 | 1305 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1165 | - 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); |
|
| 1306 | + if($max_signature_height) { |
|
| 1307 | + $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); |
|
| 1308 | + } |
|
| 1166 | 1309 | } |
| 1167 | 1310 | |
| 1168 | 1311 | return $signature; |
@@ -1186,20 +1329,25 @@ discard block |
||
| 1186 | 1329 | function _checkAccessibleFromStatus() |
| 1187 | 1330 | { |
| 1188 | 1331 | $logged_info = Context::get('logged_info'); |
| 1189 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1332 | + if($logged_info->is_admin == 'Y') { |
|
| 1333 | + return true; |
|
| 1334 | + } |
|
| 1190 | 1335 | |
| 1191 | 1336 | $status = $this->get('status'); |
| 1192 | - if(empty($status)) return false; |
|
| 1337 | + if(empty($status)) { |
|
| 1338 | + return false; |
|
| 1339 | + } |
|
| 1193 | 1340 | |
| 1194 | 1341 | $oDocumentModel = getModel('document'); |
| 1195 | 1342 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1196 | 1343 | |
| 1197 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1198 | - return true; |
|
| 1199 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1344 | + if($status == $configStatusList['public'] || $status == $configStatusList['publish']) { |
|
| 1345 | + return true; |
|
| 1346 | + } else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1200 | 1347 | { |
| 1201 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1202 | - return true; |
|
| 1348 | + if($this->get('member_srl') == $logged_info->member_srl) { |
|
| 1349 | + return true; |
|
| 1350 | + } |
|
| 1203 | 1351 | } |
| 1204 | 1352 | return false; |
| 1205 | 1353 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function getDocumentExtraVarsFromDB($documentSrls) |
| 39 | 39 | { |
| 40 | - if(!is_array($documentSrls) || count($documentSrls) == 0) |
|
| 40 | + if (!is_array($documentSrls) || count($documentSrls) == 0) |
|
| 41 | 41 | { |
| 42 | 42 | return new BaseObject(-1, 'msg_invalid_request'); |
| 43 | 43 | } |
@@ -58,52 +58,52 @@ discard block |
||
| 58 | 58 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
| 59 | 59 | |
| 60 | 60 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
| 61 | - if(count($_document_list) <= 0) return; |
|
| 61 | + if (count($_document_list) <= 0) return; |
|
| 62 | 62 | |
| 63 | 63 | // Find all called the document object variable has been set extension |
| 64 | 64 | $document_srls = array(); |
| 65 | - foreach($_document_list as $key => $val) |
|
| 65 | + foreach ($_document_list as $key => $val) |
|
| 66 | 66 | { |
| 67 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 67 | + if (!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 68 | 68 | $checked_documents[$val->document_srl] = true; |
| 69 | 69 | $document_srls[] = $val->document_srl; |
| 70 | 70 | } |
| 71 | 71 | // If the document number, return detected |
| 72 | - if(!count($document_srls)) return; |
|
| 72 | + if (!count($document_srls)) return; |
|
| 73 | 73 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
| 74 | 74 | //$obj->document_srl = implode(',',$document_srls); |
| 75 | 75 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
| 76 | - if($output->toBool() && $output->data) |
|
| 76 | + if ($output->toBool() && $output->data) |
|
| 77 | 77 | { |
| 78 | - foreach($output->data as $key => $val) |
|
| 78 | + foreach ($output->data as $key => $val) |
|
| 79 | 79 | { |
| 80 | - if(!isset($val->value)) continue; |
|
| 81 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 80 | + if (!isset($val->value)) continue; |
|
| 81 | + if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 82 | 82 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $user_lang_code = Context::getLangType(); |
| 87 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
| 87 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
| 88 | 88 | { |
| 89 | 89 | $document_srl = $document_srls[$i]; |
| 90 | 90 | unset($vars); |
| 91 | 91 | |
| 92 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 92 | + if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 93 | 93 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
| 94 | 94 | $extra_keys = $this->getExtraKeys($module_srl); |
| 95 | 95 | $vars = $extra_vars[$document_srl]; |
| 96 | 96 | $document_lang_code = $_document_list[$document_srl]->get('lang_code'); |
| 97 | 97 | // Expand the variable processing |
| 98 | - if(count($extra_keys)) |
|
| 98 | + if (count($extra_keys)) |
|
| 99 | 99 | { |
| 100 | - foreach($extra_keys as $idx => $key) |
|
| 100 | + foreach ($extra_keys as $idx => $key) |
|
| 101 | 101 | { |
| 102 | 102 | $extra_keys[$idx] = clone($key); |
| 103 | 103 | $val = $vars[$idx]; |
| 104 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 105 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 106 | - else if(isset($val[0])) $v = $val[0]; |
|
| 104 | + if (isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 105 | + else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 106 | + else if (isset($val[0])) $v = $val[0]; |
|
| 107 | 107 | else $v = null; |
| 108 | 108 | $extra_keys[$idx]->value = $v; |
| 109 | 109 | } |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | $evars = new ExtraVar($module_srl); |
| 114 | 114 | $evars->setExtraVarKeys($extra_keys); |
| 115 | 115 | // Title Processing |
| 116 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
| 116 | + if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]); |
|
| 117 | 117 | // Information processing |
| 118 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
| 118 | + if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]); |
|
| 119 | 119 | |
| 120 | - if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
|
| 120 | + if ($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
|
| 121 | 121 | { |
| 122 | 122 | unset($checked_documents[$document_srl]); |
| 123 | 123 | } |
@@ -134,21 +134,21 @@ discard block |
||
| 134 | 134 | * @param array $columnList |
| 135 | 135 | * @return documentItem |
| 136 | 136 | */ |
| 137 | - function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
| 137 | + function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
| 138 | 138 | { |
| 139 | - if(!$document_srl) return new documentItem(); |
|
| 139 | + if (!$document_srl) return new documentItem(); |
|
| 140 | 140 | |
| 141 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 141 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 142 | 142 | { |
| 143 | 143 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
| 144 | - if(!$oDocument->isExists()) |
|
| 144 | + if (!$oDocument->isExists()) |
|
| 145 | 145 | { |
| 146 | 146 | return $oDocument; |
| 147 | 147 | } |
| 148 | 148 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 149 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 149 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 150 | 150 | } |
| 151 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 151 | + if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 152 | 152 | |
| 153 | 153 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 154 | 154 | } |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | * @param array $columnList |
| 162 | 162 | * @return array value type is documentItem |
| 163 | 163 | */ |
| 164 | - function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
| 164 | + function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
| 165 | 165 | { |
| 166 | - if(is_array($document_srls)) |
|
| 166 | + if (is_array($document_srls)) |
|
| 167 | 167 | { |
| 168 | 168 | $list_count = count($document_srls); |
| 169 | - $document_srls = implode(',',$document_srls); |
|
| 169 | + $document_srls = implode(',', $document_srls); |
|
| 170 | 170 | } |
| 171 | 171 | else |
| 172 | 172 | { |
@@ -179,33 +179,33 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $output = executeQuery('document.getDocuments', $args, $columnList); |
| 181 | 181 | $document_list = $output->data; |
| 182 | - if(!$document_list) return; |
|
| 183 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 182 | + if (!$document_list) return; |
|
| 183 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 184 | 184 | |
| 185 | 185 | $document_count = count($document_list); |
| 186 | - foreach($document_list as $key => $attribute) |
|
| 186 | + foreach ($document_list as $key => $attribute) |
|
| 187 | 187 | { |
| 188 | 188 | $document_srl = $attribute->document_srl; |
| 189 | - if(!$document_srl) continue; |
|
| 189 | + if (!$document_srl) continue; |
|
| 190 | 190 | |
| 191 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 191 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 192 | 192 | { |
| 193 | 193 | $oDocument = null; |
| 194 | 194 | $oDocument = new documentItem(); |
| 195 | 195 | $oDocument->setAttribute($attribute, false); |
| 196 | - if($is_admin) $oDocument->setGrant(); |
|
| 196 | + if ($is_admin) $oDocument->setGrant(); |
|
| 197 | 197 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 203 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 204 | 204 | |
| 205 | 205 | $output = null; |
| 206 | - if(count($result)) |
|
| 206 | + if (count($result)) |
|
| 207 | 207 | { |
| 208 | - foreach($result as $document_srl => $val) |
|
| 208 | + foreach ($result as $document_srl => $val) |
|
| 209 | 209 | { |
| 210 | 210 | $output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 211 | 211 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @param array $columnList |
| 223 | 223 | * @return BaseObject |
| 224 | 224 | */ |
| 225 | - function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) |
|
| 225 | + function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array()) |
|
| 226 | 226 | { |
| 227 | 227 | $sort_check = $this->_setSortIndex($obj, $load_extra_vars); |
| 228 | 228 | $obj->sort_index = $sort_check->sort_index; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | // Call trigger (before) |
| 233 | 233 | // This trigger can be used to set an alternative output using a different search method |
| 234 | 234 | $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj); |
| 235 | - if($output instanceof BaseObject && !$output->toBool()) |
|
| 235 | + if ($output instanceof BaseObject && !$output->toBool()) |
|
| 236 | 236 | { |
| 237 | 237 | return $output; |
| 238 | 238 | } |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | $output = $obj->use_alternate_output; |
| 250 | 250 | unset($obj->use_alternate_output); |
| 251 | 251 | } |
| 252 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
| 252 | + elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars')) |
|
| 253 | 253 | { |
| 254 | 254 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
| 255 | - $args->sort_index = str_replace('documents.','',$args->sort_index); |
|
| 255 | + $args->sort_index = str_replace('documents.', '', $args->sort_index); |
|
| 256 | 256 | $output = executeQueryArray($query_id, $args); |
| 257 | 257 | } |
| 258 | 258 | elseif ($sort_check->isExtraVars) |
@@ -264,16 +264,16 @@ discard block |
||
| 264 | 264 | // document.getDocumentList query execution |
| 265 | 265 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
| 266 | 266 | $groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1); |
| 267 | - if(isset($groupByQuery[$query_id])) |
|
| 267 | + if (isset($groupByQuery[$query_id])) |
|
| 268 | 268 | { |
| 269 | 269 | $group_args = clone($args); |
| 270 | 270 | $group_args->sort_index = 'documents.'.$args->sort_index; |
| 271 | 271 | $output = executeQueryArray($query_id, $group_args); |
| 272 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 272 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 273 | 273 | |
| 274 | - foreach($output->data as $key => $val) |
|
| 274 | + foreach ($output->data as $key => $val) |
|
| 275 | 275 | { |
| 276 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 276 | + if ($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $page_navigation = $output->page_navigation; |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $virtual_number = $keys[0]; |
| 282 | 282 | |
| 283 | 283 | $target_args = new stdClass(); |
| 284 | - $target_args->document_srls = implode(',',$target_srls); |
|
| 284 | + $target_args->document_srls = implode(',', $target_srls); |
|
| 285 | 285 | $target_args->list_order = $args->sort_index; |
| 286 | 286 | $target_args->order_type = $args->order_type; |
| 287 | 287 | $target_args->list_count = $args->list_count; |
@@ -298,35 +298,35 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | // Return if no result or an error occurs |
| 301 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 301 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 302 | 302 | $idx = 0; |
| 303 | 303 | $data = $output->data; |
| 304 | 304 | unset($output->data); |
| 305 | 305 | |
| 306 | - if(!isset($virtual_number)) |
|
| 306 | + if (!isset($virtual_number)) |
|
| 307 | 307 | { |
| 308 | 308 | $keys = array_keys($data); |
| 309 | 309 | $virtual_number = $keys[0]; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - if($except_notice) |
|
| 312 | + if ($except_notice) |
|
| 313 | 313 | { |
| 314 | - foreach($data as $key => $attribute) |
|
| 314 | + foreach ($data as $key => $attribute) |
|
| 315 | 315 | { |
| 316 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
| 316 | + if ($attribute->is_notice == 'Y') $virtual_number--; |
|
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - foreach($data as $key => $attribute) |
|
| 320 | + foreach ($data as $key => $attribute) |
|
| 321 | 321 | { |
| 322 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 322 | + if ($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 323 | 323 | $document_srl = $attribute->document_srl; |
| 324 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 324 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 325 | 325 | { |
| 326 | 326 | $oDocument = null; |
| 327 | 327 | $oDocument = new documentItem(); |
| 328 | 328 | $oDocument->setAttribute($attribute, false); |
| 329 | - if($is_admin) $oDocument->setGrant(); |
|
| 329 | + if ($is_admin) $oDocument->setGrant(); |
|
| 330 | 330 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 331 | 331 | } |
| 332 | 332 | |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | $virtual_number--; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 337 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 338 | 338 | |
| 339 | - if(count($output->data)) |
|
| 339 | + if (count($output->data)) |
|
| 340 | 340 | { |
| 341 | - foreach($output->data as $number => $document) |
|
| 341 | + foreach ($output->data as $number => $document) |
|
| 342 | 342 | { |
| 343 | 343 | $output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl]; |
| 344 | 344 | } |
@@ -360,16 +360,16 @@ discard block |
||
| 360 | 360 | { |
| 361 | 361 | $args = new stdClass(); |
| 362 | 362 | $args->module_srl = $obj->module_srl; |
| 363 | - $args->category_srl= $obj->category_srl; |
|
| 363 | + $args->category_srl = $obj->category_srl; |
|
| 364 | 364 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
| 365 | - if(!$output->toBool()||!$output->data) return; |
|
| 365 | + if (!$output->toBool() || !$output->data) return; |
|
| 366 | 366 | |
| 367 | - foreach($output->data as $key => $val) |
|
| 367 | + foreach ($output->data as $key => $val) |
|
| 368 | 368 | { |
| 369 | 369 | $document_srl = $val->document_srl; |
| 370 | - if(!$document_srl) continue; |
|
| 370 | + if (!$document_srl) continue; |
|
| 371 | 371 | |
| 372 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 372 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 373 | 373 | { |
| 374 | 374 | $oDocument = null; |
| 375 | 375 | $oDocument = new documentItem(); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | $this->setToAllDocumentExtraVars(); |
| 382 | 382 | |
| 383 | - foreach($result->data as $document_srl => $val) |
|
| 383 | + foreach ($result->data as $document_srl => $val) |
|
| 384 | 384 | { |
| 385 | 385 | $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 386 | 386 | } |
@@ -396,20 +396,20 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | function getExtraKeys($module_srl) |
| 398 | 398 | { |
| 399 | - if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
| 399 | + if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
| 400 | 400 | { |
| 401 | 401 | $keys = false; |
| 402 | 402 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 403 | - if($oCacheHandler->isSupport()) |
|
| 403 | + if ($oCacheHandler->isSupport()) |
|
| 404 | 404 | { |
| 405 | - $object_key = 'module_document_extra_keys:' . $module_srl; |
|
| 405 | + $object_key = 'module_document_extra_keys:'.$module_srl; |
|
| 406 | 406 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 407 | 407 | $keys = $oCacheHandler->get($cache_key); |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | $oExtraVar = ExtraVar::getInstance($module_srl); |
| 411 | 411 | |
| 412 | - if($keys === false) |
|
| 412 | + if ($keys === false) |
|
| 413 | 413 | { |
| 414 | 414 | $obj = new stdClass(); |
| 415 | 415 | $obj->module_srl = $module_srl; |
@@ -419,13 +419,13 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | // correcting index order |
| 421 | 421 | $isFixed = FALSE; |
| 422 | - if(is_array($output->data)) |
|
| 422 | + if (is_array($output->data)) |
|
| 423 | 423 | { |
| 424 | 424 | $prevIdx = 0; |
| 425 | - foreach($output->data as $no => $value) |
|
| 425 | + foreach ($output->data as $no => $value) |
|
| 426 | 426 | { |
| 427 | 427 | // case first |
| 428 | - if($prevIdx == 0 && $value->idx != 1) |
|
| 428 | + if ($prevIdx == 0 && $value->idx != 1) |
|
| 429 | 429 | { |
| 430 | 430 | $args = new stdClass(); |
| 431 | 431 | $args->module_srl = $module_srl; |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // case others |
| 442 | - if($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
| 442 | + if ($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
| 443 | 443 | { |
| 444 | 444 | $args = new stdClass(); |
| 445 | 445 | $args->module_srl = $module_srl; |
@@ -456,16 +456,16 @@ discard block |
||
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - if($isFixed) |
|
| 459 | + if ($isFixed) |
|
| 460 | 460 | { |
| 461 | 461 | $output = executeQueryArray('document.getDocumentExtraKeys', $obj); |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | $oExtraVar->setExtraVarKeys($output->data); |
| 465 | 465 | $keys = $oExtraVar->getExtraVars(); |
| 466 | - if(!$keys) $keys = array(); |
|
| 466 | + if (!$keys) $keys = array(); |
|
| 467 | 467 | |
| 468 | - if($oCacheHandler->isSupport()) |
|
| 468 | + if ($oCacheHandler->isSupport()) |
|
| 469 | 469 | { |
| 470 | 470 | $oCacheHandler->put($cache_key, $keys); |
| 471 | 471 | } |
@@ -486,14 +486,14 @@ discard block |
||
| 486 | 486 | */ |
| 487 | 487 | function getExtraVars($module_srl, $document_srl) |
| 488 | 488 | { |
| 489 | - if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
| 489 | + if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
| 490 | 490 | { |
| 491 | 491 | // Extended to extract the values of variables set |
| 492 | 492 | $oDocument = $this->getDocument($document_srl, false); |
| 493 | 493 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 494 | 494 | $this->setToAllDocumentExtraVars(); |
| 495 | 495 | } |
| 496 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 496 | + if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 497 | 497 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
| 498 | 498 | } |
| 499 | 499 | |
@@ -516,71 +516,71 @@ discard block |
||
| 516 | 516 | |
| 517 | 517 | $oDocumentController = getController('document'); |
| 518 | 518 | // Members must be a possible feature |
| 519 | - if($logged_info->member_srl) |
|
| 519 | + if ($logged_info->member_srl) |
|
| 520 | 520 | { |
| 521 | 521 | $oDocumentModel = getModel('document'); |
| 522 | 522 | $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress'); |
| 523 | 523 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 524 | 524 | $module_srl = $oDocument->get('module_srl'); |
| 525 | 525 | $member_srl = $oDocument->get('member_srl'); |
| 526 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 526 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 527 | 527 | |
| 528 | 528 | $oModuleModel = getModel('module'); |
| 529 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 530 | - if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl) |
|
| 529 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 530 | + if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
| 531 | 531 | { |
| 532 | 532 | // Add a Referral Button |
| 533 | 533 | $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); |
| 534 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); |
|
| 534 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript'); |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl) |
|
| 537 | + if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
| 538 | 538 | { |
| 539 | 539 | // Add button to negative |
| 540 | - $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
| 541 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); |
|
| 540 | + $url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
| 541 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | // Adding Report |
| 545 | 545 | $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl); |
| 546 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript'); |
|
| 546 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript'); |
|
| 547 | 547 | |
| 548 | 548 | // Add Bookmark button |
| 549 | 549 | $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); |
| 550 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript'); |
|
| 550 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript'); |
|
| 551 | 551 | } |
| 552 | 552 | // Add print button |
| 553 | - $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl); |
|
| 554 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument'); |
|
| 553 | + $url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl); |
|
| 554 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument'); |
|
| 555 | 555 | // Call a trigger (after) |
| 556 | 556 | ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list); |
| 557 | - if($this->grant->manager) |
|
| 557 | + if ($this->grant->manager) |
|
| 558 | 558 | { |
| 559 | 559 | $str_confirm = Context::getLang('confirm_move'); |
| 560 | 560 | $url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl); |
| 561 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript'); |
|
| 561 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript'); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | // If you are managing to find posts by ip |
| 565 | - if($logged_info->is_admin == 'Y') |
|
| 565 | + if ($logged_info->is_admin == 'Y') |
|
| 566 | 566 | { |
| 567 | 567 | $oDocumentModel = getModel('document'); |
| 568 | - $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
| 568 | + $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
| 569 | 569 | |
| 570 | - if($oDocument->isExists()) |
|
| 570 | + if ($oDocument->isExists()) |
|
| 571 | 571 | { |
| 572 | 572 | // Find a post equivalent to ip address |
| 573 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress()); |
|
| 574 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); |
|
| 573 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress()); |
|
| 574 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); |
|
| 575 | 575 | |
| 576 | 576 | $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress()); |
| 577 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript'); |
|
| 577 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript'); |
|
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | // Changing the language of pop-up menu |
| 581 | 581 | $menus = Context::get('document_popup_menu_list'); |
| 582 | 582 | $menus_count = count($menus); |
| 583 | - for($i=0;$i<$menus_count;$i++) |
|
| 583 | + for ($i = 0; $i < $menus_count; $i++) |
|
| 584 | 584 | { |
| 585 | 585 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
| 586 | 586 | } |
@@ -596,13 +596,13 @@ discard block |
||
| 596 | 596 | */ |
| 597 | 597 | function getDocumentCount($module_srl, $search_obj = NULL) |
| 598 | 598 | { |
| 599 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
| 599 | + if (is_null($search_obj)) $search_obj = new stdClass(); |
|
| 600 | 600 | $search_obj->module_srl = $module_srl; |
| 601 | 601 | |
| 602 | 602 | $output = executeQuery('document.getDocumentCount', $search_obj); |
| 603 | 603 | // Return total number of |
| 604 | 604 | $total_count = $output->data->count; |
| 605 | - return (int)$total_count; |
|
| 605 | + return (int) $total_count; |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | /** |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | function getDocumentCountByGroupStatus($search_obj = NULL) |
| 614 | 614 | { |
| 615 | 615 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
| 616 | - if(!$output->toBool()) return array(); |
|
| 616 | + if (!$output->toBool()) return array(); |
|
| 617 | 617 | |
| 618 | 618 | return $output->data; |
| 619 | 619 | } |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | $output = executeQuery('document.getDocumentExtraVarsCount', $args); |
| 633 | 633 | // Return total number of |
| 634 | 634 | $total_count = $output->data->count; |
| 635 | - return (int)$total_count; |
|
| 635 | + return (int) $total_count; |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | /** |
@@ -649,29 +649,29 @@ discard block |
||
| 649 | 649 | |
| 650 | 650 | $this->_setSearchOption($opt, $args, $query_id, $use_division); |
| 651 | 651 | |
| 652 | - if($sort_check->isExtraVars) |
|
| 652 | + if ($sort_check->isExtraVars) |
|
| 653 | 653 | { |
| 654 | 654 | return 1; |
| 655 | 655 | } |
| 656 | 656 | else |
| 657 | 657 | { |
| 658 | - if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
| 658 | + if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
| 659 | 659 | { |
| 660 | - if($args->order_type === 'desc') |
|
| 660 | + if ($args->order_type === 'desc') |
|
| 661 | 661 | { |
| 662 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 662 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 663 | 663 | } |
| 664 | 664 | else |
| 665 | 665 | { |
| 666 | 666 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | - elseif($sort_check->sort_index === 'regdate') |
|
| 669 | + elseif ($sort_check->sort_index === 'regdate') |
|
| 670 | 670 | { |
| 671 | 671 | |
| 672 | - if($args->order_type === 'asc') |
|
| 672 | + if ($args->order_type === 'asc') |
|
| 673 | 673 | { |
| 674 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 674 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 675 | 675 | } |
| 676 | 676 | else |
| 677 | 677 | { |
@@ -686,9 +686,9 @@ discard block |
||
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | // Guhanhu total number of the article search page |
| 689 | - $output = executeQuery($query_id . 'Page', $args); |
|
| 689 | + $output = executeQuery($query_id.'Page', $args); |
|
| 690 | 690 | $count = $output->data->count; |
| 691 | - $page = (int)(($count-1)/$opt->list_count)+1; |
|
| 691 | + $page = (int) (($count - 1) / $opt->list_count) + 1; |
|
| 692 | 692 | return $page; |
| 693 | 693 | } |
| 694 | 694 | |
@@ -700,16 +700,16 @@ discard block |
||
| 700 | 700 | */ |
| 701 | 701 | function getCategory($category_srl, $columnList = array()) |
| 702 | 702 | { |
| 703 | - $args =new stdClass(); |
|
| 703 | + $args = new stdClass(); |
|
| 704 | 704 | $args->category_srl = $category_srl; |
| 705 | 705 | $output = executeQuery('document.getCategory', $args, $columnList); |
| 706 | 706 | |
| 707 | 707 | $node = $output->data; |
| 708 | - if(!$node) return; |
|
| 708 | + if (!$node) return; |
|
| 709 | 709 | |
| 710 | - if($node->group_srls) |
|
| 710 | + if ($node->group_srls) |
|
| 711 | 711 | { |
| 712 | - $group_srls = explode(',',$node->group_srls); |
|
| 712 | + $group_srls = explode(',', $node->group_srls); |
|
| 713 | 713 | unset($node->group_srls); |
| 714 | 714 | $node->group_srls = $group_srls; |
| 715 | 715 | } |
@@ -730,8 +730,8 @@ discard block |
||
| 730 | 730 | { |
| 731 | 731 | $args = new stdClass(); |
| 732 | 732 | $args->category_srl = $category_srl; |
| 733 | - $output = executeQuery('document.getChildCategoryCount',$args); |
|
| 734 | - if($output->data->count > 0) return true; |
|
| 733 | + $output = executeQuery('document.getChildCategoryCount', $args); |
|
| 734 | + if ($output->data->count > 0) return true; |
|
| 735 | 735 | return false; |
| 736 | 736 | } |
| 737 | 737 | |
@@ -747,10 +747,10 @@ discard block |
||
| 747 | 747 | // Category of the target module file swollen |
| 748 | 748 | $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); |
| 749 | 749 | // If the target file to the cache file regeneration category |
| 750 | - if(!file_exists($filename)) |
|
| 750 | + if (!file_exists($filename)) |
|
| 751 | 751 | { |
| 752 | 752 | $oDocumentController = getController('document'); |
| 753 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 753 | + if (!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | include($filename); |
@@ -770,10 +770,10 @@ discard block |
||
| 770 | 770 | */ |
| 771 | 771 | function _arrangeCategory(&$document_category, $list, $depth) |
| 772 | 772 | { |
| 773 | - if(!count($list)) return; |
|
| 773 | + if (!count($list)) return; |
|
| 774 | 774 | $idx = 0; |
| 775 | 775 | $list_order = array(); |
| 776 | - foreach($list as $key => $val) |
|
| 776 | + foreach ($list as $key => $val) |
|
| 777 | 777 | { |
| 778 | 778 | $obj = new stdClass; |
| 779 | 779 | $obj->mid = $val['mid']; |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | $obj->parent_srl = $val['parent_srl']; |
| 783 | 783 | $obj->title = $obj->text = $val['text']; |
| 784 | 784 | $obj->description = $val['description']; |
| 785 | - $obj->expand = $val['expand']=='Y'?true:false; |
|
| 785 | + $obj->expand = $val['expand'] == 'Y' ?true:false; |
|
| 786 | 786 | $obj->color = $val['color']; |
| 787 | 787 | $obj->document_count = $val['document_count']; |
| 788 | 788 | $obj->depth = $depth; |
@@ -790,26 +790,26 @@ discard block |
||
| 790 | 790 | $obj->childs = array(); |
| 791 | 791 | $obj->grant = $val['grant']; |
| 792 | 792 | |
| 793 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 793 | + if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 794 | 794 | else $selected = false; |
| 795 | 795 | |
| 796 | 796 | $obj->selected = $selected; |
| 797 | 797 | |
| 798 | 798 | $list_order[$idx++] = $obj->category_srl; |
| 799 | 799 | // If you have a parent category of child nodes apply data |
| 800 | - if($obj->parent_srl) |
|
| 800 | + if ($obj->parent_srl) |
|
| 801 | 801 | { |
| 802 | 802 | $parent_srl = $obj->parent_srl; |
| 803 | 803 | $document_count = $obj->document_count; |
| 804 | 804 | $expand = $obj->expand; |
| 805 | - if($selected) $expand = true; |
|
| 805 | + if ($selected) $expand = true; |
|
| 806 | 806 | |
| 807 | - while($parent_srl) |
|
| 807 | + while ($parent_srl) |
|
| 808 | 808 | { |
| 809 | 809 | $document_category[$parent_srl]->document_count += $document_count; |
| 810 | 810 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
| 811 | 811 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
| 812 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 812 | + if ($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 813 | 813 | |
| 814 | 814 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
| 815 | 815 | } |
@@ -817,10 +817,10 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | $document_category[$key] = $obj; |
| 819 | 819 | |
| 820 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 820 | + if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1); |
|
| 821 | 821 | } |
| 822 | 822 | $document_category[$list_order[0]]->first = true; |
| 823 | - $document_category[$list_order[count($list_order)-1]]->last = true; |
|
| 823 | + $document_category[$list_order[count($list_order) - 1]]->last = true; |
|
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | /** |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | $args->module_srl = $module_srl; |
| 836 | 836 | $args->category_srl = $category_srl; |
| 837 | 837 | $output = executeQuery('document.getCategoryDocumentCount', $args); |
| 838 | - return (int)$output->data->count; |
|
| 838 | + return (int) $output->data->count; |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | /** |
@@ -845,8 +845,8 @@ discard block |
||
| 845 | 845 | */ |
| 846 | 846 | function getCategoryXmlFile($module_srl) |
| 847 | 847 | { |
| 848 | - $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); |
|
| 849 | - if(!file_exists($xml_file)) |
|
| 848 | + $xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl); |
|
| 849 | + if (!file_exists($xml_file)) |
|
| 850 | 850 | { |
| 851 | 851 | $oDocumentController = getController('document'); |
| 852 | 852 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -861,8 +861,8 @@ discard block |
||
| 861 | 861 | */ |
| 862 | 862 | function getCategoryPhpFile($module_srl) |
| 863 | 863 | { |
| 864 | - $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); |
|
| 865 | - if(!file_exists($php_file)) |
|
| 864 | + $php_file = sprintf('files/cache/document_category/%s.php', $module_srl); |
|
| 865 | + if (!file_exists($php_file)) |
|
| 866 | 866 | { |
| 867 | 867 | $oDocumentController = getController('document'); |
| 868 | 868 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | */ |
| 878 | 878 | function getMonthlyArchivedList($obj) |
| 879 | 879 | { |
| 880 | - if($obj->mid) |
|
| 880 | + if ($obj->mid) |
|
| 881 | 881 | { |
| 882 | 882 | $oModuleModel = getModel('module'); |
| 883 | 883 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -885,13 +885,13 @@ discard block |
||
| 885 | 885 | } |
| 886 | 886 | // Module_srl passed the array may be a check whether the array |
| 887 | 887 | $args = new stdClass; |
| 888 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 888 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 889 | 889 | else $args->module_srl = $obj->module_srl; |
| 890 | 890 | |
| 891 | 891 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
| 892 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 892 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 893 | 893 | |
| 894 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 894 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 895 | 895 | |
| 896 | 896 | return $output; |
| 897 | 897 | } |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | */ |
| 904 | 904 | function getDailyArchivedList($obj) |
| 905 | 905 | { |
| 906 | - if($obj->mid) |
|
| 906 | + if ($obj->mid) |
|
| 907 | 907 | { |
| 908 | 908 | $oModuleModel = getModel('module'); |
| 909 | 909 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -911,14 +911,14 @@ discard block |
||
| 911 | 911 | } |
| 912 | 912 | // Module_srl passed the array may be a check whether the array |
| 913 | 913 | $args = new stdClass; |
| 914 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 914 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 915 | 915 | else $args->module_srl = $obj->module_srl; |
| 916 | 916 | $args->regdate = $obj->regdate; |
| 917 | 917 | |
| 918 | 918 | $output = executeQuery('document.getDailyArchivedList', $args); |
| 919 | - if(!$output->toBool()) return $output; |
|
| 919 | + if (!$output->toBool()) return $output; |
|
| 920 | 920 | |
| 921 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 921 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 922 | 922 | |
| 923 | 923 | return $output; |
| 924 | 924 | } |
@@ -929,17 +929,17 @@ discard block |
||
| 929 | 929 | */ |
| 930 | 930 | function getDocumentCategories() |
| 931 | 931 | { |
| 932 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 932 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 933 | 933 | $module_srl = Context::get('module_srl'); |
| 934 | - $categories= $this->getCategoryList($module_srl); |
|
| 934 | + $categories = $this->getCategoryList($module_srl); |
|
| 935 | 935 | $lang = Context::get('lang'); |
| 936 | 936 | // No additional category |
| 937 | 937 | $output = "0,0,{$lang->none_category}\n"; |
| 938 | - if($categories) |
|
| 938 | + if ($categories) |
|
| 939 | 939 | { |
| 940 | - foreach($categories as $category_srl => $category) |
|
| 940 | + foreach ($categories as $category_srl => $category) |
|
| 941 | 941 | { |
| 942 | - $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title); |
|
| 942 | + $output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title); |
|
| 943 | 943 | } |
| 944 | 944 | } |
| 945 | 945 | $this->add('categories', $output); |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | */ |
| 952 | 952 | function getDocumentConfig() |
| 953 | 953 | { |
| 954 | - if($this->documentConfig === NULL) |
|
| 954 | + if ($this->documentConfig === NULL) |
|
| 955 | 955 | { |
| 956 | 956 | $oModuleModel = getModel('module'); |
| 957 | 957 | $config = $oModuleModel->getModuleConfig('document'); |
@@ -1024,11 +1024,11 @@ discard block |
||
| 1024 | 1024 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 1025 | 1025 | // Check permissions |
| 1026 | 1026 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1027 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1027 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1028 | 1028 | |
| 1029 | 1029 | $category_srl = Context::get('category_srl'); |
| 1030 | 1030 | $category_info = $this->getCategory($category_srl); |
| 1031 | - if(!$category_info) |
|
| 1031 | + if (!$category_info) |
|
| 1032 | 1032 | { |
| 1033 | 1033 | return new BaseObject(-1, 'msg_invalid_request'); |
| 1034 | 1034 | } |
@@ -1044,14 +1044,14 @@ discard block |
||
| 1044 | 1044 | */ |
| 1045 | 1045 | function getDocumentSrlByAlias($mid, $alias) |
| 1046 | 1046 | { |
| 1047 | - if(!$mid || !$alias) return null; |
|
| 1047 | + if (!$mid || !$alias) return null; |
|
| 1048 | 1048 | $site_module_info = Context::get('site_module_info'); |
| 1049 | 1049 | $args = new stdClass; |
| 1050 | 1050 | $args->mid = $mid; |
| 1051 | 1051 | $args->alias_title = $alias; |
| 1052 | 1052 | $args->site_srl = $site_module_info->site_srl; |
| 1053 | 1053 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
| 1054 | - if(!$output->data) return null; |
|
| 1054 | + if (!$output->data) return null; |
|
| 1055 | 1055 | else return $output->data->document_srl; |
| 1056 | 1056 | } |
| 1057 | 1057 | |
@@ -1063,15 +1063,15 @@ discard block |
||
| 1063 | 1063 | */ |
| 1064 | 1064 | function getDocumentSrlByTitle($module_srl, $title) |
| 1065 | 1065 | { |
| 1066 | - if(!$module_srl || !$title) return null; |
|
| 1066 | + if (!$module_srl || !$title) return null; |
|
| 1067 | 1067 | $args = new stdClass; |
| 1068 | 1068 | $args->module_srl = $module_srl; |
| 1069 | 1069 | $args->title = $title; |
| 1070 | 1070 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
| 1071 | - if(!$output->data) return null; |
|
| 1071 | + if (!$output->data) return null; |
|
| 1072 | 1072 | else |
| 1073 | 1073 | { |
| 1074 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1074 | + if (is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1075 | 1075 | return $output->data->document_srl; |
| 1076 | 1076 | } |
| 1077 | 1077 | } |
@@ -1083,12 +1083,12 @@ discard block |
||
| 1083 | 1083 | */ |
| 1084 | 1084 | function getAlias($document_srl) |
| 1085 | 1085 | { |
| 1086 | - if(!$document_srl) return null; |
|
| 1086 | + if (!$document_srl) return null; |
|
| 1087 | 1087 | $args = new stdClass; |
| 1088 | 1088 | $args->document_srl = $document_srl; |
| 1089 | 1089 | $output = executeQueryArray('document.getAliases', $args); |
| 1090 | 1090 | |
| 1091 | - if(!$output->data) return null; |
|
| 1091 | + if (!$output->data) return null; |
|
| 1092 | 1092 | else return $output->data[0]->alias_title; |
| 1093 | 1093 | } |
| 1094 | 1094 | |
@@ -1131,32 +1131,32 @@ discard block |
||
| 1131 | 1131 | { |
| 1132 | 1132 | // Variable check |
| 1133 | 1133 | $args = new stdClass; |
| 1134 | - $args->category_srl = $obj->category_srl?$obj->category_srl:null; |
|
| 1134 | + $args->category_srl = $obj->category_srl ? $obj->category_srl : null; |
|
| 1135 | 1135 | $args->sort_index = $obj->sort_index; |
| 1136 | - $args->order_type = $obj->order_type?$obj->order_type:'desc'; |
|
| 1137 | - $args->page = $obj->page?$obj->page:1; |
|
| 1138 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
| 1139 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
| 1136 | + $args->order_type = $obj->order_type ? $obj->order_type : 'desc'; |
|
| 1137 | + $args->page = $obj->page ? $obj->page : 1; |
|
| 1138 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
| 1139 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
| 1140 | 1140 | // Search options |
| 1141 | 1141 | $search_target = $obj->search_target; |
| 1142 | 1142 | $search_keyword = $obj->search_keyword; |
| 1143 | - if($search_target && $search_keyword) |
|
| 1143 | + if ($search_target && $search_keyword) |
|
| 1144 | 1144 | { |
| 1145 | - switch($search_target) |
|
| 1145 | + switch ($search_target) |
|
| 1146 | 1146 | { |
| 1147 | 1147 | case 'title' : |
| 1148 | 1148 | case 'content' : |
| 1149 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1149 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1150 | 1150 | $args->{"s_".$search_target} = $search_keyword; |
| 1151 | 1151 | $use_division = true; |
| 1152 | 1152 | break; |
| 1153 | 1153 | case 'title_content' : |
| 1154 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1154 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1155 | 1155 | $args->s_title = $search_keyword; |
| 1156 | 1156 | $args->s_content = $search_keyword; |
| 1157 | 1157 | break; |
| 1158 | 1158 | case 'user_id' : |
| 1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1159 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1160 | 1160 | $args->s_user_id = $search_keyword; |
| 1161 | 1161 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1162 | 1162 | break; |
@@ -1164,13 +1164,13 @@ discard block |
||
| 1164 | 1164 | case 'nick_name' : |
| 1165 | 1165 | case 'email_address' : |
| 1166 | 1166 | case 'homepage' : |
| 1167 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1167 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1168 | 1168 | $args->{"s_".$search_target} = $search_keyword; |
| 1169 | 1169 | break; |
| 1170 | 1170 | case 'is_notice' : |
| 1171 | 1171 | case 'is_secret' : |
| 1172 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1173 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1172 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1173 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1174 | 1174 | break; |
| 1175 | 1175 | case 'member_srl' : |
| 1176 | 1176 | case 'readed_count' : |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | case 'comment_count' : |
| 1180 | 1180 | case 'trackback_count' : |
| 1181 | 1181 | case 'uploaded_count' : |
| 1182 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1182 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1183 | 1183 | break; |
| 1184 | 1184 | case 'regdate' : |
| 1185 | 1185 | case 'last_update' : |
@@ -1191,9 +1191,9 @@ discard block |
||
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | 1193 | $output = executeQueryArray('document.getTrashList', $args); |
| 1194 | - if($output->data) |
|
| 1194 | + if ($output->data) |
|
| 1195 | 1195 | { |
| 1196 | - foreach($output->data as $key => $attribute) |
|
| 1196 | + foreach ($output->data as $key => $attribute) |
|
| 1197 | 1197 | { |
| 1198 | 1198 | $oDocument = null; |
| 1199 | 1199 | $oDocument = new documentItem(); |
@@ -1212,46 +1212,46 @@ discard block |
||
| 1212 | 1212 | { |
| 1213 | 1213 | $args = new stdClass; |
| 1214 | 1214 | $document_srl = Context::get('document_srl'); |
| 1215 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1215 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1216 | 1216 | |
| 1217 | 1217 | $point = Context::get('point'); |
| 1218 | - if($point != -1) $point = 1; |
|
| 1218 | + if ($point != -1) $point = 1; |
|
| 1219 | 1219 | |
| 1220 | 1220 | $oDocumentModel = getModel('document'); |
| 1221 | 1221 | $columnList = array('document_srl', 'module_srl'); |
| 1222 | 1222 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 1223 | 1223 | $module_srl = $oDocument->get('module_srl'); |
| 1224 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1224 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1225 | 1225 | |
| 1226 | 1226 | $oModuleModel = getModel('module'); |
| 1227 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 1228 | - if($point == -1) |
|
| 1227 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 1228 | + if ($point == -1) |
|
| 1229 | 1229 | { |
| 1230 | - if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1230 | + if ($document_config->use_vote_down != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1231 | 1231 | $args->below_point = 0; |
| 1232 | 1232 | } |
| 1233 | 1233 | else |
| 1234 | 1234 | { |
| 1235 | - if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1235 | + if ($document_config->use_vote_up != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1236 | 1236 | $args->more_point = 0; |
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | $args->document_srl = $document_srl; |
| 1240 | 1240 | |
| 1241 | - $output = executeQueryArray('document.getVotedMemberList',$args); |
|
| 1242 | - if(!$output->toBool()) return $output; |
|
| 1241 | + $output = executeQueryArray('document.getVotedMemberList', $args); |
|
| 1242 | + if (!$output->toBool()) return $output; |
|
| 1243 | 1243 | |
| 1244 | 1244 | $oMemberModel = getModel('member'); |
| 1245 | - if($output->data) |
|
| 1245 | + if ($output->data) |
|
| 1246 | 1246 | { |
| 1247 | - foreach($output->data as $k => $d) |
|
| 1247 | + foreach ($output->data as $k => $d) |
|
| 1248 | 1248 | { |
| 1249 | 1249 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
| 1250 | 1250 | $output->data[$k]->src = $profile_image->src; |
| 1251 | 1251 | } |
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | - $this->add('voted_member_list',$output->data); |
|
| 1254 | + $this->add('voted_member_list', $output->data); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | /** |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | function getStatusNameList() |
| 1262 | 1262 | { |
| 1263 | 1263 | global $lang; |
| 1264 | - if(!isset($lang->status_name_list)) |
|
| 1264 | + if (!isset($lang->status_name_list)) |
|
| 1265 | 1265 | return array_flip($this->getStatusList()); |
| 1266 | 1266 | else return $lang->status_name_list; |
| 1267 | 1267 | } |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | { |
| 1277 | 1277 | $sortIndex = $obj->sort_index; |
| 1278 | 1278 | $isExtraVars = false; |
| 1279 | - if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) |
|
| 1279 | + if (!in_array($sortIndex, array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl'))) |
|
| 1280 | 1280 | { |
| 1281 | 1281 | // get module_srl extra_vars list |
| 1282 | 1282 | if ($load_extra_vars) |
@@ -1291,11 +1291,11 @@ discard block |
||
| 1291 | 1291 | else |
| 1292 | 1292 | { |
| 1293 | 1293 | $check_array = array(); |
| 1294 | - foreach($extra_output->data as $val) |
|
| 1294 | + foreach ($extra_output->data as $val) |
|
| 1295 | 1295 | { |
| 1296 | 1296 | $check_array[] = $val->eid; |
| 1297 | 1297 | } |
| 1298 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1298 | + if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1299 | 1299 | else $isExtraVars = true; |
| 1300 | 1300 | } |
| 1301 | 1301 | } |
@@ -1323,13 +1323,13 @@ discard block |
||
| 1323 | 1323 | { |
| 1324 | 1324 | // Variable check |
| 1325 | 1325 | $args = new stdClass(); |
| 1326 | - $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null; |
|
| 1326 | + $args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null; |
|
| 1327 | 1327 | $args->order_type = $searchOpt->order_type; |
| 1328 | - $args->page = $searchOpt->page?$searchOpt->page:1; |
|
| 1329 | - $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20; |
|
| 1330 | - $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10; |
|
| 1331 | - $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null; |
|
| 1332 | - $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null; |
|
| 1328 | + $args->page = $searchOpt->page ? $searchOpt->page : 1; |
|
| 1329 | + $args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20; |
|
| 1330 | + $args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10; |
|
| 1331 | + $args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null; |
|
| 1332 | + $args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null; |
|
| 1333 | 1333 | $args->member_srl = $searchOpt->member_srl; |
| 1334 | 1334 | $args->member_srls = $searchOpt->member_srls; |
| 1335 | 1335 | |
@@ -1339,10 +1339,10 @@ discard block |
||
| 1339 | 1339 | |
| 1340 | 1340 | // Check the target and sequence alignment |
| 1341 | 1341 | $orderType = array('desc' => 1, 'asc' => 1); |
| 1342 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1342 | + if (!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1343 | 1343 | |
| 1344 | 1344 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
| 1345 | - if($searchOpt->mid) |
|
| 1345 | + if ($searchOpt->mid) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | $oModuleModel = getModel('module'); |
| 1348 | 1348 | $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -1350,30 +1350,30 @@ discard block |
||
| 1350 | 1350 | } |
| 1351 | 1351 | |
| 1352 | 1352 | // Module_srl passed the array may be a check whether the array |
| 1353 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1353 | + if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1354 | 1354 | else $args->module_srl = $searchOpt->module_srl; |
| 1355 | 1355 | |
| 1356 | 1356 | // Except for the test module_srl |
| 1357 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1357 | + if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1358 | 1358 | else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
| 1359 | 1359 | |
| 1360 | 1360 | // only admin document list, temp document showing |
| 1361 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1361 | + if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1362 | 1362 | else |
| 1363 | 1363 | { |
| 1364 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1364 | + if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1365 | 1365 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
| 1366 | 1366 | else |
| 1367 | 1367 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | // Category is selected, further sub-categories until all conditions |
| 1371 | - if($args->category_srl) |
|
| 1371 | + if ($args->category_srl) |
|
| 1372 | 1372 | { |
| 1373 | 1373 | $category_list = $this->getCategoryList($args->module_srl); |
| 1374 | 1374 | $category_info = $category_list[$args->category_srl]; |
| 1375 | 1375 | $category_info->childs[] = $args->category_srl; |
| 1376 | - $args->category_srl = implode(',',$category_info->childs); |
|
| 1376 | + $args->category_srl = implode(',', $category_info->childs); |
|
| 1377 | 1377 | } |
| 1378 | 1378 | |
| 1379 | 1379 | // Used to specify the default query id (based on several search options to query id modified) |
@@ -1386,24 +1386,24 @@ discard block |
||
| 1386 | 1386 | $search_target = $searchOpt->search_target; |
| 1387 | 1387 | $search_keyword = $searchOpt->search_keyword; |
| 1388 | 1388 | |
| 1389 | - if($search_target && $search_keyword) |
|
| 1389 | + if ($search_target && $search_keyword) |
|
| 1390 | 1390 | { |
| 1391 | - switch($search_target) |
|
| 1391 | + switch ($search_target) |
|
| 1392 | 1392 | { |
| 1393 | 1393 | case 'title' : |
| 1394 | 1394 | case 'content' : |
| 1395 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1395 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1396 | 1396 | $args->{"s_".$search_target} = $search_keyword; |
| 1397 | 1397 | $use_division = true; |
| 1398 | 1398 | break; |
| 1399 | 1399 | case 'title_content' : |
| 1400 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1400 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1401 | 1401 | $args->s_title = $search_keyword; |
| 1402 | 1402 | $args->s_content = $search_keyword; |
| 1403 | 1403 | $use_division = true; |
| 1404 | 1404 | break; |
| 1405 | 1405 | case 'user_id' : |
| 1406 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1406 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1407 | 1407 | $args->s_user_id = $search_keyword; |
| 1408 | 1408 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1409 | 1409 | break; |
@@ -1411,18 +1411,18 @@ discard block |
||
| 1411 | 1411 | case 'nick_name' : |
| 1412 | 1412 | case 'email_address' : |
| 1413 | 1413 | case 'homepage' : |
| 1414 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1414 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1415 | 1415 | $args->{"s_".$search_target} = $search_keyword; |
| 1416 | 1416 | break; |
| 1417 | 1417 | case 'is_notice' : |
| 1418 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
| 1419 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1418 | + if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N'; |
|
| 1419 | + elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1420 | 1420 | else $args->{"s_".$search_target} = ''; |
| 1421 | 1421 | break; |
| 1422 | 1422 | case 'is_secret' : |
| 1423 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1424 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1425 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1423 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1424 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1425 | + elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1426 | 1426 | break; |
| 1427 | 1427 | case 'member_srl' : |
| 1428 | 1428 | case 'readed_count' : |
@@ -1430,17 +1430,17 @@ discard block |
||
| 1430 | 1430 | case 'comment_count' : |
| 1431 | 1431 | case 'trackback_count' : |
| 1432 | 1432 | case 'uploaded_count' : |
| 1433 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1433 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1434 | 1434 | break; |
| 1435 | 1435 | case 'member_srls' : |
| 1436 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1436 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1437 | 1437 | |
| 1438 | - if($logged_info->member_srl) |
|
| 1438 | + if ($logged_info->member_srl) |
|
| 1439 | 1439 | { |
| 1440 | 1440 | $srls = explode(',', $search_keyword); |
| 1441 | - foreach($srls as $srl) |
|
| 1441 | + foreach ($srls as $srl) |
|
| 1442 | 1442 | { |
| 1443 | - if(abs($srl) != $logged_info->member_srl) |
|
| 1443 | + if (abs($srl) != $logged_info->member_srl) |
|
| 1444 | 1444 | { |
| 1445 | 1445 | break; // foreach |
| 1446 | 1446 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
| 1451 | 1451 | } |
| 1452 | 1452 | break; |
| 1453 | 1453 | case 'blamed_count' : |
| 1454 | - $args->{"s_".$search_target} = (int)$search_keyword * -1; |
|
| 1454 | + $args->{"s_".$search_target} = (int) $search_keyword * -1; |
|
| 1455 | 1455 | break; |
| 1456 | 1456 | case 'regdate' : |
| 1457 | 1457 | case 'last_update' : |
@@ -1464,7 +1464,7 @@ discard block |
||
| 1464 | 1464 | $use_division = true; |
| 1465 | 1465 | break; |
| 1466 | 1466 | case 'tag' : |
| 1467 | - $args->s_tags = str_replace(' ','%',$search_keyword); |
|
| 1467 | + $args->s_tags = str_replace(' ', '%', $search_keyword); |
|
| 1468 | 1468 | $query_id = 'document.getDocumentListWithinTag'; |
| 1469 | 1469 | break; |
| 1470 | 1470 | case 'extra_vars': |
@@ -1472,9 +1472,9 @@ discard block |
||
| 1472 | 1472 | $query_id = 'document.getDocumentListWithinExtraVars'; |
| 1473 | 1473 | break; |
| 1474 | 1474 | default : |
| 1475 | - if(strpos($search_target,'extra_vars')!==false) { |
|
| 1475 | + if (strpos($search_target, 'extra_vars') !== false) { |
|
| 1476 | 1476 | $args->var_idx = substr($search_target, strlen('extra_vars')); |
| 1477 | - $args->var_value = str_replace(' ','%',$search_keyword); |
|
| 1477 | + $args->var_value = str_replace(' ', '%', $search_keyword); |
|
| 1478 | 1478 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1479 | 1479 | $query_id = 'document.getDocumentListWithExtraVars'; |
| 1480 | 1480 | } |
@@ -1491,18 +1491,18 @@ discard block |
||
| 1491 | 1491 | /** |
| 1492 | 1492 | * list_order asc sort of division that can be used only when |
| 1493 | 1493 | */ |
| 1494 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1494 | + if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1495 | 1495 | |
| 1496 | 1496 | /** |
| 1497 | 1497 | * If it is true, use_division changed to use the document division |
| 1498 | 1498 | */ |
| 1499 | - if($use_division) |
|
| 1499 | + if ($use_division) |
|
| 1500 | 1500 | { |
| 1501 | 1501 | // Division begins |
| 1502 | - $division = (int)Context::get('division'); |
|
| 1502 | + $division = (int) Context::get('division'); |
|
| 1503 | 1503 | |
| 1504 | 1504 | // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan |
| 1505 | - if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1505 | + if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1506 | 1506 | { |
| 1507 | 1507 | $listSqlID = 'document.getDocumentListUseIndex'; |
| 1508 | 1508 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
@@ -1514,7 +1514,7 @@ discard block |
||
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | 1516 | // If you do not value the best division top |
| 1517 | - if(!$division) |
|
| 1517 | + if (!$division) |
|
| 1518 | 1518 | { |
| 1519 | 1519 | $division_args = new stdClass(); |
| 1520 | 1520 | $division_args->module_srl = $args->module_srl; |
@@ -1525,7 +1525,7 @@ discard block |
||
| 1525 | 1525 | $division_args->statusList = $args->statusList; |
| 1526 | 1526 | |
| 1527 | 1527 | $output = executeQuery($divisionSqlID, $division_args, array('list_order')); |
| 1528 | - if($output->data) |
|
| 1528 | + if ($output->data) |
|
| 1529 | 1529 | { |
| 1530 | 1530 | $item = array_pop($output->data); |
| 1531 | 1531 | $division = $item->list_order; |
@@ -1534,10 +1534,10 @@ discard block |
||
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | // The last division |
| 1537 | - $last_division = (int)Context::get('last_division'); |
|
| 1537 | + $last_division = (int) Context::get('last_division'); |
|
| 1538 | 1538 | |
| 1539 | 1539 | // Division after division from the 5000 value of the specified Wanted |
| 1540 | - if(!$last_division) |
|
| 1540 | + if (!$last_division) |
|
| 1541 | 1541 | { |
| 1542 | 1542 | $last_division_args = new stdClass(); |
| 1543 | 1543 | $last_division_args->module_srl = $args->module_srl; |
@@ -1549,7 +1549,7 @@ discard block |
||
| 1549 | 1549 | $last_division_args->page = 5001; |
| 1550 | 1550 | |
| 1551 | 1551 | $output = executeQuery($divisionSqlID, $last_division_args, array('list_order')); |
| 1552 | - if($output->data) |
|
| 1552 | + if ($output->data) |
|
| 1553 | 1553 | { |
| 1554 | 1554 | $item = array_pop($output->data); |
| 1555 | 1555 | $last_division = $item->list_order; |
@@ -1557,14 +1557,14 @@ discard block |
||
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | // Make sure that after last_division article |
| 1560 | - if($last_division) |
|
| 1560 | + if ($last_division) |
|
| 1561 | 1561 | { |
| 1562 | 1562 | $last_division_args = new stdClass(); |
| 1563 | 1563 | $last_division_args->module_srl = $args->module_srl; |
| 1564 | 1564 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
| 1565 | 1565 | $last_division_args->list_order = $last_division; |
| 1566 | 1566 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
| 1567 | - if($output->data->count<1) $last_division = null; |
|
| 1567 | + if ($output->data->count < 1) $last_division = null; |
|
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | 1570 | $args->division = $division; |
@@ -1597,7 +1597,7 @@ discard block |
||
| 1597 | 1597 | * @param int $count |
| 1598 | 1598 | * @return object |
| 1599 | 1599 | */ |
| 1600 | - function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 ) |
|
| 1600 | + function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0) |
|
| 1601 | 1601 | { |
| 1602 | 1602 | $args = new stdClass(); |
| 1603 | 1603 | $args->member_srl = $member_srl; |
@@ -1605,8 +1605,8 @@ discard block |
||
| 1605 | 1605 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
| 1606 | 1606 | $document_list = $output->data; |
| 1607 | 1607 | |
| 1608 | - if(!$document_list) return array(); |
|
| 1609 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 1608 | + if (!$document_list) return array(); |
|
| 1609 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 1610 | 1610 | |
| 1611 | 1611 | return $document_list; |
| 1612 | 1612 | } |
@@ -1618,7 +1618,7 @@ discard block |
||
| 1618 | 1618 | function getDocumentExtraImagePath() |
| 1619 | 1619 | { |
| 1620 | 1620 | $documentConfig = getModel('document')->getDocumentConfig(); |
| 1621 | - if(Mobile::isFromMobilePhone()) |
|
| 1621 | + if (Mobile::isFromMobilePhone()) |
|
| 1622 | 1622 | { |
| 1623 | 1623 | $iconSkin = $documentConfig->micons; |
| 1624 | 1624 | } |
@@ -1626,7 +1626,7 @@ discard block |
||
| 1626 | 1626 | { |
| 1627 | 1627 | $iconSkin = $documentConfig->icons; |
| 1628 | 1628 | } |
| 1629 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1629 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1630 | 1630 | |
| 1631 | 1631 | return $path; |
| 1632 | 1632 | } |