@@ -21,7 +21,7 @@ |
||
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Get the board module admin simple setting page |
| 24 | - * @return void |
|
| 24 | + * @return null|string |
|
| 25 | 25 | */ |
| 26 | 26 | public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl) |
| 27 | 27 | { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl) |
| 27 | 27 | { |
| 28 | - if(!$moduleSrl) |
|
| 28 | + if (!$moduleSrl) |
|
| 29 | 29 | { |
| 30 | 30 | return; |
| 31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $oModuleModel = getModel('module'); |
| 36 | 36 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
| 37 | 37 | $moduleInfo->use_status = explode('|@|', $moduleInfo->use_status); |
| 38 | - if($moduleInfo) |
|
| 38 | + if ($moduleInfo) |
|
| 39 | 39 | { |
| 40 | 40 | Context::set('module_info', $moduleInfo); |
| 41 | 41 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | Context::set('document_status_list', $documentStatusList); |
| 47 | 47 | |
| 48 | 48 | // set order target list |
| 49 | - foreach($this->order_target AS $key) |
|
| 49 | + foreach ($this->order_target AS $key) |
|
| 50 | 50 | { |
| 51 | 51 | $order_target[$key] = Context::getLang($key); |
| 52 | 52 | } |
@@ -87,6 +87,9 @@ discard block |
||
| 87 | 87 | $oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list')));
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | + /** |
|
| 91 | + * @param string $content_list |
|
| 92 | + */ |
|
| 90 | 93 | function arrangeContentList($content_list) {
|
| 91 | 94 | $output = array(); |
| 92 | 95 | if(count($content_list)) {
|
@@ -120,6 +123,9 @@ discard block |
||
| 120 | 123 | return $output; |
| 121 | 124 | } |
| 122 | 125 | |
| 126 | + /** |
|
| 127 | + * @param string $comment_list |
|
| 128 | + */ |
|
| 123 | 129 | function arrangeComment($comment_list) {
|
| 124 | 130 | $output = array(); |
| 125 | 131 | if(count($comment_list) > 0 ) {
|
@@ -133,6 +139,9 @@ discard block |
||
| 133 | 139 | } |
| 134 | 140 | |
| 135 | 141 | |
| 142 | + /** |
|
| 143 | + * @param string $file_list |
|
| 144 | + */ |
|
| 136 | 145 | function arrangeFile($file_list) {
|
| 137 | 146 | $output = array(); |
| 138 | 147 | if(count($file_list) > 0) {
|
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @brief notice list |
| 19 | 19 | **/ |
| 20 | 20 | function dispBoardNoticeList(&$oModule) {
|
| 21 | - $oModule->add('notice_list',$this->arrangeContentList(Context::get('notice_list')));
|
|
| 21 | + $oModule->add('notice_list', $this->arrangeContentList(Context::get('notice_list')));
|
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | $api_type = Context::get('api_type');
|
| 30 | 30 | $document_list = $this->arrangeContentList(Context::get('document_list'));
|
| 31 | 31 | |
| 32 | - if($api_type =='summary') |
|
| 32 | + if ($api_type == 'summary') |
|
| 33 | 33 | {
|
| 34 | 34 | $content_cut_size = Context::get('content_cut_size');
|
| 35 | - $content_cut_size = $content_cut_size?$content_cut_size:50; |
|
| 36 | - foreach($document_list as $k=>$v) |
|
| 35 | + $content_cut_size = $content_cut_size ? $content_cut_size : 50; |
|
| 36 | + foreach ($document_list as $k=>$v) |
|
| 37 | 37 | {
|
| 38 | 38 | $oDocument = new documentItem(); |
| 39 | 39 | $oDocument->setAttribute($v, false); |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $oModule->add('document_list',$document_list);
|
|
| 46 | - $oModule->add('page_navigation',Context::get('page_navigation'));
|
|
| 45 | + $oModule->add('document_list', $document_list);
|
|
| 46 | + $oModule->add('page_navigation', Context::get('page_navigation'));
|
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @brief category list |
| 52 | 52 | **/ |
| 53 | 53 | function dispBoardCategoryList(&$oModule) {
|
| 54 | - $oModule->add('category_list',Context::get('category_list'));
|
|
| 54 | + $oModule->add('category_list', Context::get('category_list'));
|
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | function dispBoardContentView(&$oModule) {
|
| 61 | 61 | $oDocument = Context::get('oDocument');
|
| 62 | 62 | $extra_vars = $oDocument->getExtraVars(); |
| 63 | - $oDocument->add('extra_vars',$this->arrangeExtraVars($extra_vars));
|
|
| 64 | - $oModule->add('oDocument',$this->arrangeContent($oDocument));
|
|
| 63 | + $oDocument->add('extra_vars', $this->arrangeExtraVars($extra_vars));
|
|
| 64 | + $oModule->add('oDocument', $this->arrangeContent($oDocument));
|
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @brief contents file list |
| 70 | 70 | **/ |
| 71 | 71 | function dispBoardContentFileList(&$oModule) {
|
| 72 | - $oModule->add('file_list',$this->arrangeFile(Context::get('file_list')));
|
|
| 72 | + $oModule->add('file_list', $this->arrangeFile(Context::get('file_list')));
|
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -77,20 +77,20 @@ discard block |
||
| 77 | 77 | * @brief tag list |
| 78 | 78 | **/ |
| 79 | 79 | function dispBoardTagList(&$oModule) {
|
| 80 | - $oModule->add('tag_list',Context::get('tag_list'));
|
|
| 80 | + $oModule->add('tag_list', Context::get('tag_list'));
|
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * @brief comments list |
| 85 | 85 | **/ |
| 86 | 86 | function dispBoardContentCommentList(&$oModule) {
|
| 87 | - $oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list')));
|
|
| 87 | + $oModule->add('comment_list', $this->arrangeComment(Context::get('comment_list')));
|
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | function arrangeContentList($content_list) {
|
| 91 | 91 | $output = array(); |
| 92 | - if(count($content_list)) {
|
|
| 93 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 92 | + if (count($content_list)) {
|
|
| 93 | + foreach ($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 94 | 94 | } |
| 95 | 95 | return $output; |
| 96 | 96 | } |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | function arrangeContent($content) {
|
| 100 | 100 | $oBoardView = getView('board');
|
| 101 | 101 | $output = new stdClass; |
| 102 | - if($content){
|
|
| 103 | - $output = $content->gets('document_srl','category_srl','member_srl','nick_name','user_id','user_name','title','content','tags','readed_count','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status');
|
|
| 102 | + if ($content) {
|
|
| 103 | + $output = $content->gets('document_srl', 'category_srl', 'member_srl', 'nick_name', 'user_id', 'user_name', 'title', 'content', 'tags', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'regdate', 'last_update', 'extra_vars', 'status');
|
|
| 104 | 104 | |
| 105 | - if(!$oBoardView->grant->view) |
|
| 105 | + if (!$oBoardView->grant->view) |
|
| 106 | 106 | {
|
| 107 | 107 | unset($output->content); |
| 108 | 108 | unset($output->tags); |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | function arrangeComment($comment_list) {
|
| 124 | 124 | $output = array(); |
| 125 | - if(count($comment_list) > 0 ) {
|
|
| 126 | - foreach($comment_list as $key => $val){
|
|
| 125 | + if (count($comment_list) > 0) {
|
|
| 126 | + foreach ($comment_list as $key => $val) {
|
|
| 127 | 127 | $item = null; |
| 128 | - $item = $val->gets('comment_srl','parent_srl','depth','is_secret','content','voted_count','blamed_count','user_id','user_name','nick_name','email_address','homepage','regdate','last_update');
|
|
| 128 | + $item = $val->gets('comment_srl', 'parent_srl', 'depth', 'is_secret', 'content', 'voted_count', 'blamed_count', 'user_id', 'user_name', 'nick_name', 'email_address', 'homepage', 'regdate', 'last_update');
|
|
| 129 | 129 | $output[] = $item; |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | function arrangeFile($file_list) {
|
| 137 | 137 | $output = array(); |
| 138 | - if(count($file_list) > 0) {
|
|
| 139 | - foreach($file_list as $key => $val){
|
|
| 138 | + if (count($file_list) > 0) {
|
|
| 139 | + foreach ($file_list as $key => $val) {
|
|
| 140 | 140 | $item = new stdClass; |
| 141 | 141 | $item->sid = $val->sid; |
| 142 | 142 | $item->download_count = $val->download_count; |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | function arrangeExtraVars($list) {
|
| 155 | 155 | $output = array(); |
| 156 | - if(count($list)) {
|
|
| 157 | - foreach($list as $key => $val){
|
|
| 156 | + if (count($list)) {
|
|
| 157 | + foreach ($list as $key => $val) {
|
|
| 158 | 158 | $item = new stdClass; |
| 159 | 159 | $item->name = $val->name; |
| 160 | 160 | $item->type = $val->type; |
@@ -90,7 +90,9 @@ |
||
| 90 | 90 | function arrangeContentList($content_list) {
|
| 91 | 91 | $output = array(); |
| 92 | 92 | if(count($content_list)) {
|
| 93 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 93 | + foreach($content_list as $key => $val) { |
|
| 94 | + $output[] = $this->arrangeContent($val); |
|
| 95 | + } |
|
| 94 | 96 | } |
| 95 | 97 | return $output; |
| 96 | 98 | } |
@@ -747,6 +747,9 @@ |
||
| 747 | 747 | $this->setTemplateFile('write_form'); |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | + /** |
|
| 751 | + * @param ModuleObject $oDocumentModel |
|
| 752 | + */ |
|
| 750 | 753 | function _getStatusNameList(&$oDocumentModel) |
| 751 | 754 | { |
| 752 | 755 | $resultList = array(); |
@@ -53,18 +53,15 @@ discard block |
||
| 53 | 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 | - } |
|
| 57 | - else if($this->module_info->use_category) |
|
| 56 | + } else if($this->module_info->use_category) |
|
| 58 | 57 | { |
| 59 | 58 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
| 60 | - } |
|
| 61 | - else |
|
| 59 | + } else |
|
| 62 | 60 | { |
| 63 | 61 | $this->module_info->hide_category = 'N'; |
| 64 | 62 | $this->module_info->use_category = 'Y'; |
| 65 | 63 | } |
| 66 | - } |
|
| 67 | - else |
|
| 64 | + } else |
|
| 68 | 65 | { |
| 69 | 66 | $this->module_info->hide_category = 'Y'; |
| 70 | 67 | $this->module_info->use_category = 'N'; |
@@ -84,8 +81,7 @@ discard block |
||
| 84 | 81 | $this->grant->write_comment = FALSE; |
| 85 | 82 | $this->grant->view = FALSE; |
| 86 | 83 | } |
| 87 | - } |
|
| 88 | - else |
|
| 84 | + } else |
|
| 89 | 85 | { |
| 90 | 86 | $this->consultation = FALSE; |
| 91 | 87 | } |
@@ -160,13 +156,17 @@ discard block |
||
| 160 | 156 | * add extra vaiables to the search options |
| 161 | 157 | **/ |
| 162 | 158 | // 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); |
|
| 159 | + foreach($this->search_option as $opt) { |
|
| 160 | + $search_option[$opt] = Context::getLang($opt); |
|
| 161 | + } |
|
| 164 | 162 | $extra_keys = Context::get('extra_keys'); |
| 165 | 163 | if($extra_keys) |
| 166 | 164 | { |
| 167 | 165 | foreach($extra_keys as $key => $val) |
| 168 | 166 | { |
| 169 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
| 167 | + if($val->search == 'Y') { |
|
| 168 | + $search_option['extra_vars'.$val->idx] = $val->name; |
|
| 169 | + } |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | // remove a search option that is not public in member config |
@@ -175,8 +175,9 @@ discard block |
||
| 175 | 175 | { |
| 176 | 176 | if(in_array($signupFormElement->title, $search_option)) |
| 177 | 177 | { |
| 178 | - if($signupFormElement->isPublic == 'N') |
|
| 179 | - unset($search_option[$signupFormElement->name]); |
|
| 178 | + if($signupFormElement->isPublic == 'N') { |
|
| 179 | + unset($search_option[$signupFormElement->name]); |
|
| 180 | + } |
|
| 180 | 181 | } |
| 181 | 182 | } |
| 182 | 183 | Context::set('search_option', $search_option); |
@@ -194,7 +195,9 @@ discard block |
||
| 194 | 195 | // list config, columnList setting |
| 195 | 196 | $oBoardModel = getModel('board'); |
| 196 | 197 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
| 197 | - if(!$this->listConfig) $this->listConfig = array(); |
|
| 198 | + if(!$this->listConfig) { |
|
| 199 | + $this->listConfig = array(); |
|
| 200 | + } |
|
| 198 | 201 | $this->_makeListColumnList(); |
| 199 | 202 | |
| 200 | 203 | // display the notice list |
@@ -265,7 +268,9 @@ discard block |
||
| 265 | 268 | } |
| 266 | 269 | |
| 267 | 270 | // check the manage grant |
| 268 | - if($this->grant->manager) $oDocument->setGrant(); |
|
| 271 | + if($this->grant->manager) { |
|
| 272 | + $oDocument->setGrant(); |
|
| 273 | + } |
|
| 269 | 274 | |
| 270 | 275 | // if the consultation function is enabled, and the document is not a notice |
| 271 | 276 | if($this->consultation && !$oDocument->isNotice()) |
@@ -286,8 +291,7 @@ discard block |
||
| 286 | 291 | } |
| 287 | 292 | } |
| 288 | 293 | |
| 289 | - } |
|
| 290 | - else |
|
| 294 | + } else |
|
| 291 | 295 | { |
| 292 | 296 | // if the document is not existed, then alert a warning message |
| 293 | 297 | Context::set('document_srl','',true); |
@@ -297,8 +301,7 @@ discard block |
||
| 297 | 301 | /** |
| 298 | 302 | * if the document is not existed, get an empty document |
| 299 | 303 | **/ |
| 300 | - } |
|
| 301 | - else |
|
| 304 | + } else |
|
| 302 | 305 | { |
| 303 | 306 | $oDocument = $oDocumentModel->getDocument(0); |
| 304 | 307 | } |
@@ -313,8 +316,7 @@ discard block |
||
| 313 | 316 | $oDocument = $oDocumentModel->getDocument(0); |
| 314 | 317 | Context::set('document_srl','',true); |
| 315 | 318 | $this->alertMessage('msg_not_permitted'); |
| 316 | - } |
|
| 317 | - else |
|
| 319 | + } else |
|
| 318 | 320 | { |
| 319 | 321 | // add the document title to the browser |
| 320 | 322 | Context::addBrowserTitle($oDocument->getTitleText()); |
@@ -368,13 +370,16 @@ discard block |
||
| 368 | 370 | $downloadGrantCount = 0; |
| 369 | 371 | if(is_array($file_module_config->download_grant)) |
| 370 | 372 | { |
| 371 | - foreach($file_module_config->download_grant AS $value) |
|
| 372 | - if($value) $downloadGrantCount++; |
|
| 373 | + foreach($file_module_config->download_grant AS $value) { |
|
| 374 | + if($value) $downloadGrantCount++; |
|
| 375 | + } |
|
| 373 | 376 | } |
| 374 | 377 | |
| 375 | 378 | if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
| 376 | 379 | { |
| 377 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 380 | + if(!Context::get('is_logged')) { |
|
| 381 | + return $this->stop('msg_not_permitted_download'); |
|
| 382 | + } |
|
| 378 | 383 | $logged_info = Context::get('logged_info'); |
| 379 | 384 | if($logged_info->is_admin != 'Y') |
| 380 | 385 | { |
@@ -397,7 +402,9 @@ discard block |
||
| 397 | 402 | break; |
| 398 | 403 | } |
| 399 | 404 | } |
| 400 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 405 | + if(!$is_permitted) { |
|
| 406 | + return $this->stop('msg_not_permitted_download'); |
|
| 407 | + } |
|
| 401 | 408 | } |
| 402 | 409 | } |
| 403 | 410 | } |
@@ -560,7 +567,9 @@ discard block |
||
| 560 | 567 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
| 561 | 568 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
| 562 | 569 | |
| 563 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
| 570 | + if(in_array('summary', $configColumList)) { |
|
| 571 | + array_push($this->columnList, 'content'); |
|
| 572 | + } |
|
| 564 | 573 | |
| 565 | 574 | // default column list add |
| 566 | 575 | $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'); |
@@ -654,8 +663,7 @@ discard block |
||
| 654 | 663 | { |
| 655 | 664 | $logged_info = Context::get('logged_info'); |
| 656 | 665 | $group_srls = array_keys($logged_info->group_list); |
| 657 | - } |
|
| 658 | - else |
|
| 666 | + } else |
|
| 659 | 667 | { |
| 660 | 668 | $group_srls = array(); |
| 661 | 669 | } |
@@ -672,10 +680,14 @@ discard block |
||
| 672 | 680 | { |
| 673 | 681 | $category_group_srls = explode(',',$category->group_srls); |
| 674 | 682 | $is_granted = FALSE; |
| 675 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
| 683 | + if(count(array_intersect($group_srls, $category_group_srls))) { |
|
| 684 | + $is_granted = TRUE; |
|
| 685 | + } |
|
| 676 | 686 | |
| 677 | 687 | } |
| 678 | - if($is_granted) $category_list[$category_srl] = $category; |
|
| 688 | + if($is_granted) { |
|
| 689 | + $category_list[$category_srl] = $category; |
|
| 690 | + } |
|
| 679 | 691 | } |
| 680 | 692 | } |
| 681 | 693 | Context::set('category_list', $category_list); |
@@ -686,7 +698,9 @@ discard block |
||
| 686 | 698 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
| 687 | 699 | $oDocument->setDocument($document_srl); |
| 688 | 700 | |
| 689 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
| 701 | + if($oDocument->get('module_srl') == $oDocument->get('member_srl')) { |
|
| 702 | + $savedDoc = TRUE; |
|
| 703 | + } |
|
| 690 | 704 | $oDocument->add('module_srl', $this->module_srl); |
| 691 | 705 | |
| 692 | 706 | if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
@@ -712,17 +726,20 @@ discard block |
||
| 712 | 726 | if( !$logged_info ) |
| 713 | 727 | { |
| 714 | 728 | return $this->dispBoardMessage('msg_not_permitted'); |
| 715 | - } |
|
| 716 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
| 729 | + } else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
| 717 | 730 | { |
| 718 | 731 | return $this->dispBoardMessage('msg_not_enough_point'); |
| 719 | 732 | } |
| 720 | 733 | } |
| 721 | 734 | } |
| 722 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 735 | + if(!$oDocument->get('status')) { |
|
| 736 | + $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 737 | + } |
|
| 723 | 738 | |
| 724 | 739 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 725 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
| 740 | + if(count($statusList) > 0) { |
|
| 741 | + Context::set('status_list', $statusList); |
|
| 742 | + } |
|
| 726 | 743 | |
| 727 | 744 | // get Document status config value |
| 728 | 745 | Context::set('document_srl',$document_srl); |
@@ -733,13 +750,18 @@ discard block |
||
| 733 | 750 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
| 734 | 751 | |
| 735 | 752 | // if the document exists, then setup extra variabels on context |
| 736 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 753 | + if($oDocument->isExists() && !$savedDoc) { |
|
| 754 | + Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 755 | + } |
|
| 737 | 756 | |
| 738 | 757 | /** |
| 739 | 758 | * add JS filters |
| 740 | 759 | **/ |
| 741 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 742 | - else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
| 760 | + if(Context::get('logged_info')->is_admin=='Y') { |
|
| 761 | + Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 762 | + } else { |
|
| 763 | + Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
| 764 | + } |
|
| 743 | 765 | |
| 744 | 766 | $oSecurity = new Security(); |
| 745 | 767 | $oSecurity->encodeHTML('category_list.text', 'category_list.title'); |
@@ -1054,7 +1076,9 @@ discard block |
||
| 1054 | 1076 | function dispBoardMessage($msg_code) |
| 1055 | 1077 | { |
| 1056 | 1078 | $msg = Context::getLang($msg_code); |
| 1057 | - if(!$msg) $msg = $msg_code; |
|
| 1079 | + if(!$msg) { |
|
| 1080 | + $msg = $msg_code; |
|
| 1081 | + } |
|
| 1058 | 1082 | Context::set('message', $msg); |
| 1059 | 1083 | $this->setTemplateFile('message'); |
| 1060 | 1084 | } |
@@ -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($oDocument->get('member_srl')!=$logged_info->member_srl) |
|
| 274 | + if ($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 | } |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $oDocumentModel = getModel('document'); |
| 406 | 406 | $document_srl = Context::get('document_srl'); |
| 407 | 407 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 408 | - Context::set('file_list',$oDocument->getUploadedFiles()); |
|
| 408 | + Context::set('file_list', $oDocument->getUploadedFiles()); |
|
| 409 | 409 | |
| 410 | 410 | $oSecurity = new Security(); |
| 411 | 411 | $oSecurity->encodeHTML('file_list..source_filename'); |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | /** |
| 415 | 415 | * @brief display the document comment list (can be used by API) |
| 416 | 416 | **/ |
| 417 | - function dispBoardContentCommentList(){ |
|
| 417 | + function dispBoardContentCommentList() { |
|
| 418 | 418 | // check document view grant |
| 419 | 419 | $this->dispBoardContentView(); |
| 420 | 420 | |
@@ -424,26 +424,26 @@ discard block |
||
| 424 | 424 | $comment_list = $oDocument->getComments(); |
| 425 | 425 | |
| 426 | 426 | // setup the comment list |
| 427 | - if(is_array($comment_list)) |
|
| 427 | + if (is_array($comment_list)) |
|
| 428 | 428 | { |
| 429 | - foreach($comment_list as $key => $val) |
|
| 429 | + foreach ($comment_list as $key => $val) |
|
| 430 | 430 | { |
| 431 | - if(!$val->isAccessible()) |
|
| 431 | + if (!$val->isAccessible()) |
|
| 432 | 432 | { |
| 433 | - $val->add('content',Context::getLang('thisissecret')); |
|
| 433 | + $val->add('content', Context::getLang('thisissecret')); |
|
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | - Context::set('comment_list',$comment_list); |
|
| 437 | + Context::set('comment_list', $comment_list); |
|
| 438 | 438 | |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
| 442 | 442 | * @brief display notice list (can be used by API) |
| 443 | 443 | **/ |
| 444 | - function dispBoardNoticeList(){ |
|
| 444 | + function dispBoardNoticeList() { |
|
| 445 | 445 | // check the grant |
| 446 | - if(!$this->grant->list) |
|
| 446 | + if (!$this->grant->list) |
|
| 447 | 447 | { |
| 448 | 448 | Context::set('notice_list', array()); |
| 449 | 449 | return; |
@@ -459,15 +459,15 @@ discard block |
||
| 459 | 459 | /** |
| 460 | 460 | * @brief display board content list |
| 461 | 461 | **/ |
| 462 | - function dispBoardContentList(){ |
|
| 462 | + function dispBoardContentList() { |
|
| 463 | 463 | // check the grant |
| 464 | - if(!$this->grant->list) |
|
| 464 | + if (!$this->grant->list) |
|
| 465 | 465 | { |
| 466 | 466 | Context::set('document_list', array()); |
| 467 | 467 | Context::set('total_count', 0); |
| 468 | 468 | Context::set('total_page', 1); |
| 469 | 469 | Context::set('page', 1); |
| 470 | - Context::set('page_navigation', new PageHandler(0,0,1,10)); |
|
| 470 | + Context::set('page_navigation', new PageHandler(0, 0, 1, 10)); |
|
| 471 | 471 | return; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -485,17 +485,17 @@ discard block |
||
| 485 | 485 | $args->search_keyword = Context::get('search_keyword'); |
| 486 | 486 | |
| 487 | 487 | $search_option = Context::get('search_option'); |
| 488 | - if($search_option==FALSE) |
|
| 488 | + if ($search_option == FALSE) |
|
| 489 | 489 | { |
| 490 | 490 | $search_option = $this->search_option; |
| 491 | 491 | } |
| 492 | - if(isset($search_option[$args->search_target])==FALSE) |
|
| 492 | + if (isset($search_option[$args->search_target]) == FALSE) |
|
| 493 | 493 | { |
| 494 | 494 | $args->search_target = ''; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | // if the category is enabled, then get the category |
| 498 | - if($this->module_info->use_category=='Y') |
|
| 498 | + if ($this->module_info->use_category == 'Y') |
|
| 499 | 499 | { |
| 500 | 500 | $args->category_srl = Context::get('category'); |
| 501 | 501 | } |
@@ -503,21 +503,21 @@ discard block |
||
| 503 | 503 | // setup the sort index and order index |
| 504 | 504 | $args->sort_index = Context::get('sort_index'); |
| 505 | 505 | $args->order_type = Context::get('order_type'); |
| 506 | - if(!in_array($args->sort_index, $this->order_target)) |
|
| 506 | + if (!in_array($args->sort_index, $this->order_target)) |
|
| 507 | 507 | { |
| 508 | - $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; |
|
| 508 | + $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; |
|
| 509 | 509 | } |
| 510 | - if(!in_array($args->order_type, array('asc','desc'))) |
|
| 510 | + if (!in_array($args->order_type, array('asc', 'desc'))) |
|
| 511 | 511 | { |
| 512 | - $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc'; |
|
| 512 | + $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; |
|
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | // set the current page of documents |
| 516 | 516 | $document_srl = Context::get('document_srl'); |
| 517 | - if(!$args->page && $document_srl) |
|
| 517 | + if (!$args->page && $document_srl) |
|
| 518 | 518 | { |
| 519 | 519 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 520 | - if($oDocument->isExists() && !$oDocument->isNotice()) |
|
| 520 | + if ($oDocument->isExists() && !$oDocument->isNotice()) |
|
| 521 | 521 | { |
| 522 | 522 | $page = $oDocumentModel->getDocumentPage($oDocument, $args); |
| 523 | 523 | Context::set('page', $page); |
@@ -526,13 +526,13 @@ discard block |
||
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | // setup the list count to be serach list count, if the category or search keyword has been set |
| 529 | - if($args->category_srl || $args->search_keyword) |
|
| 529 | + if ($args->category_srl || $args->search_keyword) |
|
| 530 | 530 | { |
| 531 | 531 | $args->list_count = $this->search_list_count; |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // if the consultation function is enabled, the get the logged user information |
| 535 | - if($this->consultation) |
|
| 535 | + if ($this->consultation) |
|
| 536 | 536 | { |
| 537 | 537 | $logged_info = Context::get('logged_info'); |
| 538 | 538 | $args->member_srl = $logged_info->member_srl; |
@@ -560,18 +560,18 @@ discard block |
||
| 560 | 560 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
| 561 | 561 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
| 562 | 562 | |
| 563 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
| 563 | + if (in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
| 564 | 564 | |
| 565 | 565 | // default column list add |
| 566 | 566 | $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'); |
| 567 | 567 | |
| 568 | 568 | //TODO guestbook, blog style supports legacy codes. |
| 569 | - if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
| 569 | + if ($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
| 570 | 570 | { |
| 571 | 571 | $defaultColumn = $tableColumnList; |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | - if (in_array('last_post', $configColumList)){ |
|
| 574 | + if (in_array('last_post', $configColumList)) { |
|
| 575 | 575 | array_push($this->columnList, 'last_updater'); |
| 576 | 576 | } |
| 577 | 577 | |
@@ -583,9 +583,9 @@ discard block |
||
| 583 | 583 | $this->columnList = array_unique(array_merge($this->columnList, $defaultColumn)); |
| 584 | 584 | |
| 585 | 585 | // add table name |
| 586 | - foreach($this->columnList as $no => $value) |
|
| 586 | + foreach ($this->columnList as $no => $value) |
|
| 587 | 587 | { |
| 588 | - $this->columnList[$no] = 'documents.' . $value; |
|
| 588 | + $this->columnList[$no] = 'documents.'.$value; |
|
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | 591 | |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | function dispBoardTagList() |
| 596 | 596 | { |
| 597 | 597 | // check if there is not grant fot view list, then alert an warning message |
| 598 | - if(!$this->grant->list) |
|
| 598 | + if (!$this->grant->list) |
|
| 599 | 599 | { |
| 600 | 600 | return $this->dispBoardMessage('msg_not_permitted'); |
| 601 | 601 | } |
@@ -609,14 +609,14 @@ discard block |
||
| 609 | 609 | $output = $oTagModel->getTagList($obj); |
| 610 | 610 | |
| 611 | 611 | // automatically order |
| 612 | - if(count($output->data)) |
|
| 612 | + if (count($output->data)) |
|
| 613 | 613 | { |
| 614 | 614 | $numbers = array_keys($output->data); |
| 615 | 615 | shuffle($numbers); |
| 616 | 616 | |
| 617 | - if(count($output->data)) |
|
| 617 | + if (count($output->data)) |
|
| 618 | 618 | { |
| 619 | - foreach($numbers as $k => $v) |
|
| 619 | + foreach ($numbers as $k => $v) |
|
| 620 | 620 | { |
| 621 | 621 | $tag_list[] = $output->data[$v]; |
| 622 | 622 | } |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | function dispBoardWrite() |
| 638 | 638 | { |
| 639 | 639 | // check grant |
| 640 | - if(!$this->grant->write_document) |
|
| 640 | + if (!$this->grant->write_document) |
|
| 641 | 641 | { |
| 642 | 642 | return $this->dispBoardMessage('msg_not_permitted'); |
| 643 | 643 | } |
@@ -647,10 +647,10 @@ discard block |
||
| 647 | 647 | /** |
| 648 | 648 | * check if the category option is enabled not not |
| 649 | 649 | **/ |
| 650 | - if($this->module_info->use_category=='Y') |
|
| 650 | + if ($this->module_info->use_category == 'Y') |
|
| 651 | 651 | { |
| 652 | 652 | // get the user group information |
| 653 | - if(Context::get('is_logged')) |
|
| 653 | + if (Context::get('is_logged')) |
|
| 654 | 654 | { |
| 655 | 655 | $logged_info = Context::get('logged_info'); |
| 656 | 656 | $group_srls = array_keys($logged_info->group_list); |
@@ -663,19 +663,19 @@ discard block |
||
| 663 | 663 | |
| 664 | 664 | // check the grant after obtained the category list |
| 665 | 665 | $normal_category_list = $oDocumentModel->getCategoryList($this->module_srl); |
| 666 | - if(count($normal_category_list)) |
|
| 666 | + if (count($normal_category_list)) |
|
| 667 | 667 | { |
| 668 | - foreach($normal_category_list as $category_srl => $category) |
|
| 668 | + foreach ($normal_category_list as $category_srl => $category) |
|
| 669 | 669 | { |
| 670 | 670 | $is_granted = TRUE; |
| 671 | - if($category->group_srls) |
|
| 671 | + if ($category->group_srls) |
|
| 672 | 672 | { |
| 673 | - $category_group_srls = explode(',',$category->group_srls); |
|
| 673 | + $category_group_srls = explode(',', $category->group_srls); |
|
| 674 | 674 | $is_granted = FALSE; |
| 675 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
| 675 | + if (count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
| 676 | 676 | |
| 677 | 677 | } |
| 678 | - if($is_granted) $category_list[$category_srl] = $category; |
|
| 678 | + if ($is_granted) $category_list[$category_srl] = $category; |
|
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | Context::set('category_list', $category_list); |
@@ -686,46 +686,46 @@ discard block |
||
| 686 | 686 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
| 687 | 687 | $oDocument->setDocument($document_srl); |
| 688 | 688 | |
| 689 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
| 689 | + if ($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
| 690 | 690 | $oDocument->add('module_srl', $this->module_srl); |
| 691 | 691 | |
| 692 | - if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 692 | + if ($oDocument->isExists() && $this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 693 | 693 | { |
| 694 | 694 | return new Object(-1, 'msg_protect_content'); |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | // if the document is not granted, then back to the password input form |
| 698 | 698 | $oModuleModel = getModel('module'); |
| 699 | - if($oDocument->isExists()&&!$oDocument->isGranted()) |
|
| 699 | + if ($oDocument->isExists() && !$oDocument->isGranted()) |
|
| 700 | 700 | { |
| 701 | 701 | return $this->setTemplateFile('input_password_form'); |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - if(!$oDocument->isExists()) |
|
| 704 | + if (!$oDocument->isExists()) |
|
| 705 | 705 | { |
| 706 | - $point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl); |
|
| 706 | + $point_config = $oModuleModel->getModulePartConfig('point', $this->module_srl); |
|
| 707 | 707 | $logged_info = Context::get('logged_info'); |
| 708 | 708 | $oPointModel = getModel('point'); |
| 709 | 709 | $pointForInsert = $point_config["insert_document"]; |
| 710 | - if($pointForInsert < 0) |
|
| 710 | + if ($pointForInsert < 0) |
|
| 711 | 711 | { |
| 712 | - if( !$logged_info ) |
|
| 712 | + if (!$logged_info) |
|
| 713 | 713 | { |
| 714 | 714 | return $this->dispBoardMessage('msg_not_permitted'); |
| 715 | 715 | } |
| 716 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
| 716 | + else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert) < 0) |
|
| 717 | 717 | { |
| 718 | 718 | return $this->dispBoardMessage('msg_not_enough_point'); |
| 719 | 719 | } |
| 720 | 720 | } |
| 721 | 721 | } |
| 722 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 722 | + if (!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 723 | 723 | |
| 724 | 724 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 725 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
| 725 | + if (count($statusList) > 0) Context::set('status_list', $statusList); |
|
| 726 | 726 | |
| 727 | 727 | // get Document status config value |
| 728 | - Context::set('document_srl',$document_srl); |
|
| 728 | + Context::set('document_srl', $document_srl); |
|
| 729 | 729 | Context::set('oDocument', $oDocument); |
| 730 | 730 | |
| 731 | 731 | // apply xml_js_filter on header |
@@ -733,12 +733,12 @@ discard block |
||
| 733 | 733 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
| 734 | 734 | |
| 735 | 735 | // if the document exists, then setup extra variabels on context |
| 736 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 736 | + if ($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 737 | 737 | |
| 738 | 738 | /** |
| 739 | 739 | * add JS filters |
| 740 | 740 | **/ |
| 741 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 741 | + if (Context::get('logged_info')->is_admin == 'Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 742 | 742 | else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
| 743 | 743 | |
| 744 | 744 | $oSecurity = new Security(); |
@@ -750,14 +750,14 @@ discard block |
||
| 750 | 750 | function _getStatusNameList(&$oDocumentModel) |
| 751 | 751 | { |
| 752 | 752 | $resultList = array(); |
| 753 | - if(!empty($this->module_info->use_status)) |
|
| 753 | + if (!empty($this->module_info->use_status)) |
|
| 754 | 754 | { |
| 755 | 755 | $statusNameList = $oDocumentModel->getStatusNameList(); |
| 756 | 756 | $statusList = explode('|@|', $this->module_info->use_status); |
| 757 | 757 | |
| 758 | - if(is_array($statusList)) |
|
| 758 | + if (is_array($statusList)) |
|
| 759 | 759 | { |
| 760 | - foreach($statusList as $key => $value) |
|
| 760 | + foreach ($statusList as $key => $value) |
|
| 761 | 761 | { |
| 762 | 762 | $resultList[$value] = $statusNameList[$value]; |
| 763 | 763 | } |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | function dispBoardDelete() |
| 773 | 773 | { |
| 774 | 774 | // check grant |
| 775 | - if(!$this->grant->write_document) |
|
| 775 | + if (!$this->grant->write_document) |
|
| 776 | 776 | { |
| 777 | 777 | return $this->dispBoardMessage('msg_not_permitted'); |
| 778 | 778 | } |
@@ -781,30 +781,30 @@ discard block |
||
| 781 | 781 | $document_srl = Context::get('document_srl'); |
| 782 | 782 | |
| 783 | 783 | // if document exists, get the document information |
| 784 | - if($document_srl) |
|
| 784 | + if ($document_srl) |
|
| 785 | 785 | { |
| 786 | 786 | $oDocumentModel = getModel('document'); |
| 787 | 787 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | // if the document is not existed, then back to the board content page |
| 791 | - if(!$oDocument || !$oDocument->isExists()) |
|
| 791 | + if (!$oDocument || !$oDocument->isExists()) |
|
| 792 | 792 | { |
| 793 | 793 | return $this->dispBoardContent(); |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | // if the document is not granted, then back to the password input form |
| 797 | - if(!$oDocument->isGranted()) |
|
| 797 | + if (!$oDocument->isGranted()) |
|
| 798 | 798 | { |
| 799 | 799 | return $this->setTemplateFile('input_password_form'); |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 802 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 803 | 803 | { |
| 804 | 804 | return $this->dispBoardMessage('msg_protect_content'); |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | - Context::set('oDocument',$oDocument); |
|
| 807 | + Context::set('oDocument', $oDocument); |
|
| 808 | 808 | |
| 809 | 809 | /** |
| 810 | 810 | * add JS filters |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | $document_srl = Context::get('document_srl'); |
| 823 | 823 | |
| 824 | 824 | // check grant |
| 825 | - if(!$this->grant->write_comment) |
|
| 825 | + if (!$this->grant->write_comment) |
|
| 826 | 826 | { |
| 827 | 827 | return $this->dispBoardMessage('msg_not_permitted'); |
| 828 | 828 | } |
@@ -830,13 +830,13 @@ discard block |
||
| 830 | 830 | // get the document information |
| 831 | 831 | $oDocumentModel = getModel('document'); |
| 832 | 832 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 833 | - if(!$oDocument->isExists()) |
|
| 833 | + if (!$oDocument->isExists()) |
|
| 834 | 834 | { |
| 835 | 835 | return $this->dispBoardMessage('msg_invalid_request'); |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | // Check allow comment |
| 839 | - if(!$oDocument->allowComment()) |
|
| 839 | + if (!$oDocument->allowComment()) |
|
| 840 | 840 | { |
| 841 | 841 | return $this->dispBoardMessage('msg_not_allow_comment'); |
| 842 | 842 | } |
@@ -848,9 +848,9 @@ discard block |
||
| 848 | 848 | $oComment->add('module_srl', $this->module_srl); |
| 849 | 849 | |
| 850 | 850 | // setup document variables on context |
| 851 | - Context::set('oDocument',$oDocument); |
|
| 852 | - Context::set('oSourceComment',$oSourceComment); |
|
| 853 | - Context::set('oComment',$oComment); |
|
| 851 | + Context::set('oDocument', $oDocument); |
|
| 852 | + Context::set('oSourceComment', $oSourceComment); |
|
| 853 | + Context::set('oComment', $oComment); |
|
| 854 | 854 | |
| 855 | 855 | /** |
| 856 | 856 | * add JS filter |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | function dispBoardReplyComment() |
| 867 | 867 | { |
| 868 | 868 | // check grant |
| 869 | - if(!$this->grant->write_comment) |
|
| 869 | + if (!$this->grant->write_comment) |
|
| 870 | 870 | { |
| 871 | 871 | return $this->dispBoardMessage('msg_not_permitted'); |
| 872 | 872 | } |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | $parent_srl = Context::get('comment_srl'); |
| 876 | 876 | |
| 877 | 877 | // if the parent comment is not existed |
| 878 | - if(!$parent_srl) |
|
| 878 | + if (!$parent_srl) |
|
| 879 | 879 | { |
| 880 | 880 | return new Object(-1, 'msg_invalid_request'); |
| 881 | 881 | } |
@@ -885,11 +885,11 @@ discard block |
||
| 885 | 885 | $oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager); |
| 886 | 886 | |
| 887 | 887 | // if the comment is not existed, opoup an error message |
| 888 | - if(!$oSourceComment->isExists()) |
|
| 888 | + if (!$oSourceComment->isExists()) |
|
| 889 | 889 | { |
| 890 | 890 | return $this->dispBoardMessage('msg_invalid_request'); |
| 891 | 891 | } |
| 892 | - if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
| 892 | + if (Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
| 893 | 893 | { |
| 894 | 894 | return $this->dispBoardMessage('msg_invalid_request'); |
| 895 | 895 | } |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | // Check allow comment |
| 898 | 898 | $oDocumentModel = getModel('document'); |
| 899 | 899 | $oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl')); |
| 900 | - if(!$oDocument->allowComment()) |
|
| 900 | + if (!$oDocument->allowComment()) |
|
| 901 | 901 | { |
| 902 | 902 | return $this->dispBoardMessage('msg_not_allow_comment'); |
| 903 | 903 | } |
@@ -908,9 +908,9 @@ discard block |
||
| 908 | 908 | $oComment->add('document_srl', $oSourceComment->get('document_srl')); |
| 909 | 909 | |
| 910 | 910 | // setup comment variables |
| 911 | - Context::set('oSourceComment',$oSourceComment); |
|
| 912 | - Context::set('oComment',$oComment); |
|
| 913 | - Context::set('module_srl',$this->module_info->module_srl); |
|
| 911 | + Context::set('oSourceComment', $oSourceComment); |
|
| 912 | + Context::set('oComment', $oComment); |
|
| 913 | + Context::set('module_srl', $this->module_info->module_srl); |
|
| 914 | 914 | |
| 915 | 915 | /** |
| 916 | 916 | * add JS filters |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | function dispBoardModifyComment() |
| 927 | 927 | { |
| 928 | 928 | // check grant |
| 929 | - if(!$this->grant->write_comment) |
|
| 929 | + if (!$this->grant->write_comment) |
|
| 930 | 930 | { |
| 931 | 931 | return $this->dispBoardMessage('msg_not_permitted'); |
| 932 | 932 | } |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | $comment_srl = Context::get('comment_srl'); |
| 937 | 937 | |
| 938 | 938 | // if the comment is not existed |
| 939 | - if(!$comment_srl) |
|
| 939 | + if (!$comment_srl) |
|
| 940 | 940 | { |
| 941 | 941 | return new Object(-1, 'msg_invalid_request'); |
| 942 | 942 | } |
@@ -946,13 +946,13 @@ discard block |
||
| 946 | 946 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
| 947 | 947 | |
| 948 | 948 | // if the comment is not exited, alert an error message |
| 949 | - if(!$oComment->isExists()) |
|
| 949 | + if (!$oComment->isExists()) |
|
| 950 | 950 | { |
| 951 | 951 | return $this->dispBoardMessage('msg_invalid_request'); |
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | // if the comment is not granted, then back to the password input form |
| 955 | - if(!$oComment->isGranted()) |
|
| 955 | + if (!$oComment->isGranted()) |
|
| 956 | 956 | { |
| 957 | 957 | return $this->setTemplateFile('input_password_form'); |
| 958 | 958 | } |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | function dispBoardDeleteComment() |
| 976 | 976 | { |
| 977 | 977 | // check grant |
| 978 | - if(!$this->grant->write_comment) |
|
| 978 | + if (!$this->grant->write_comment) |
|
| 979 | 979 | { |
| 980 | 980 | return $this->dispBoardMessage('msg_not_permitted'); |
| 981 | 981 | } |
@@ -984,25 +984,25 @@ discard block |
||
| 984 | 984 | $comment_srl = Context::get('comment_srl'); |
| 985 | 985 | |
| 986 | 986 | // if the comment exists, then get the comment information |
| 987 | - if($comment_srl) |
|
| 987 | + if ($comment_srl) |
|
| 988 | 988 | { |
| 989 | 989 | $oCommentModel = getModel('comment'); |
| 990 | 990 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | // if the comment is not existed, then back to the board content page |
| 994 | - if(!$oComment->isExists() ) |
|
| 994 | + if (!$oComment->isExists()) |
|
| 995 | 995 | { |
| 996 | 996 | return $this->dispBoardContent(); |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | // if the comment is not granted, then back to the password input form |
| 1000 | - if(!$oComment->isGranted()) |
|
| 1000 | + if (!$oComment->isGranted()) |
|
| 1001 | 1001 | { |
| 1002 | 1002 | return $this->setTemplateFile('input_password_form'); |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | - Context::set('oComment',$oComment); |
|
| 1005 | + Context::set('oComment', $oComment); |
|
| 1006 | 1006 | |
| 1007 | 1007 | /** |
| 1008 | 1008 | * add JS filters |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | { |
| 1020 | 1020 | $oTrackbackModel = getModel('trackback'); |
| 1021 | 1021 | |
| 1022 | - if(!$oTrackbackModel) |
|
| 1022 | + if (!$oTrackbackModel) |
|
| 1023 | 1023 | { |
| 1024 | 1024 | return; |
| 1025 | 1025 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | $trackback = $output->data; |
| 1034 | 1034 | |
| 1035 | 1035 | // if no trackback, then display the board content |
| 1036 | - if(!$trackback) |
|
| 1036 | + if (!$trackback) |
|
| 1037 | 1037 | { |
| 1038 | 1038 | return $this->dispBoardContent(); |
| 1039 | 1039 | } |
@@ -1054,7 +1054,7 @@ discard block |
||
| 1054 | 1054 | function dispBoardMessage($msg_code) |
| 1055 | 1055 | { |
| 1056 | 1056 | $msg = Context::getLang($msg_code); |
| 1057 | - if(!$msg) $msg = $msg_code; |
|
| 1057 | + if (!$msg) $msg = $msg_code; |
|
| 1058 | 1058 | Context::set('message', $msg); |
| 1059 | 1059 | $this->setTemplateFile('message'); |
| 1060 | 1060 | } |
@@ -1065,8 +1065,8 @@ discard block |
||
| 1065 | 1065 | **/ |
| 1066 | 1066 | function alertMessage($message) |
| 1067 | 1067 | { |
| 1068 | - $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
| 1069 | - Context::addHtmlFooter( $script ); |
|
| 1068 | + $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
| 1069 | + Context::addHtmlFooter($script); |
|
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | } |
@@ -279,6 +279,9 @@ discard block |
||
| 279 | 279 | $this->setRedirectUrl($returnUrl); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | + /** |
|
| 283 | + * @param string $message_content |
|
| 284 | + */ |
|
| 282 | 285 | private function _sendMessageForComment($message_content, $comment_srl_list) |
| 283 | 286 | { |
| 284 | 287 | $oCommunicationController = getController('communication'); |
@@ -308,6 +311,9 @@ discard block |
||
| 308 | 311 | |
| 309 | 312 | /** |
| 310 | 313 | * comment move to trash |
| 314 | + * @param ModuleObject $oCommentController |
|
| 315 | + * @param DB $oDB |
|
| 316 | + * @param string $message_content |
|
| 311 | 317 | * @return void|object |
| 312 | 318 | */ |
| 313 | 319 | function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB, $message_content = NULL) |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | //mail to author of thread - START |
| 135 | 135 | /** |
| 136 | - * @todo Removed code send email to document author. |
|
| 137 | - */ |
|
| 136 | + * @todo Removed code send email to document author. |
|
| 137 | + */ |
|
| 138 | 138 | /* |
| 139 | 139 | if($document_author_email != $comment->email_address && $logged_info->email_address != $document_author_email) |
| 140 | 140 | { |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
| 344 | - * @fn procCommentAdminMoveToTrash |
|
| 345 | - * @brief move a comment to trash |
|
| 346 | - * @see commentModel::getCommentMenu |
|
| 347 | - */ |
|
| 344 | + * @fn procCommentAdminMoveToTrash |
|
| 345 | + * @brief move a comment to trash |
|
| 346 | + * @see commentModel::getCommentMenu |
|
| 347 | + */ |
|
| 348 | 348 | function procCommentAdminMoveToTrash() |
| 349 | 349 | { |
| 350 | 350 | $oDB = DB::getInstance(); |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | if(!is_array($cart)) |
| 33 | 33 | { |
| 34 | 34 | $comment_srl_list = explode('|@|', $cart); |
| 35 | - } |
|
| 36 | - else |
|
| 35 | + } else |
|
| 37 | 36 | { |
| 38 | 37 | $comment_srl_list = $cart; |
| 39 | 38 | } |
@@ -61,8 +60,7 @@ discard block |
||
| 61 | 60 | if(!is_array($cart)) |
| 62 | 61 | { |
| 63 | 62 | $comment_srl_list = explode('|@|', $cart); |
| 64 | - } |
|
| 65 | - else |
|
| 63 | + } else |
|
| 66 | 64 | { |
| 67 | 65 | $comment_srl_list = $cart; |
| 68 | 66 | } |
@@ -74,8 +72,7 @@ discard block |
||
| 74 | 72 | if(!$output->toBool()) |
| 75 | 73 | { |
| 76 | 74 | return $output; |
| 77 | - } |
|
| 78 | - else |
|
| 75 | + } else |
|
| 79 | 76 | { |
| 80 | 77 | //update comment count for document |
| 81 | 78 | $updated_documents_arr = array(); |
@@ -202,8 +199,7 @@ discard block |
||
| 202 | 199 | if(!is_array($cart)) |
| 203 | 200 | { |
| 204 | 201 | $comment_srl_list = explode('|@|', $cart); |
| 205 | - } |
|
| 206 | - else |
|
| 202 | + } else |
|
| 207 | 203 | { |
| 208 | 204 | $comment_srl_list = $cart; |
| 209 | 205 | } |
@@ -262,8 +258,7 @@ discard block |
||
| 262 | 258 | if($isTrash == 'true') |
| 263 | 259 | { |
| 264 | 260 | $msgCode = 'success_trashed'; |
| 265 | - } |
|
| 266 | - else |
|
| 261 | + } else |
|
| 267 | 262 | { |
| 268 | 263 | $msgCode = 'success_deleted'; |
| 269 | 264 | } |
@@ -355,7 +350,9 @@ discard block |
||
| 355 | 350 | $oCommentController = getController('comment'); |
| 356 | 351 | $oComment = $oCommentModel->getComment($comment_srl, false); |
| 357 | 352 | |
| 358 | - if(!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 353 | + if(!$oComment->isGranted()) { |
|
| 354 | + return $this->stop('msg_not_permitted'); |
|
| 355 | + } |
|
| 359 | 356 | |
| 360 | 357 | $message_content = ""; |
| 361 | 358 | $this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content); |
@@ -410,8 +407,7 @@ discard block |
||
| 410 | 407 | if($_SESSION['comment_management'][$key]) |
| 411 | 408 | { |
| 412 | 409 | unset($_SESSION['comment_management'][$key]); |
| 413 | - } |
|
| 414 | - else |
|
| 410 | + } else |
|
| 415 | 411 | { |
| 416 | 412 | $_SESSION['comment_management'][$key] = TRUE; |
| 417 | 413 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | // Error display if none is selected |
| 31 | 31 | $cart = Context::get('cart'); |
| 32 | - if(!is_array($cart)) |
|
| 32 | + if (!is_array($cart)) |
|
| 33 | 33 | { |
| 34 | 34 | $comment_srl_list = explode('|@|', $cart); |
| 35 | 35 | } |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // Error display if none is selected |
| 56 | 56 | $cart = Context::get('cart'); |
| 57 | - if(!$cart) |
|
| 57 | + if (!$cart) |
|
| 58 | 58 | { |
| 59 | 59 | return $this->stop('msg_cart_is_null'); |
| 60 | 60 | } |
| 61 | - if(!is_array($cart)) |
|
| 61 | + if (!is_array($cart)) |
|
| 62 | 62 | { |
| 63 | 63 | $comment_srl_list = explode('|@|', $cart); |
| 64 | 64 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $args->status = $will_publish; |
| 72 | 72 | $args->comment_srls_list = $comment_srl_list; |
| 73 | 73 | $output = executeQuery('comment.updatePublishedStatus', $args); |
| 74 | - if(!$output->toBool()) |
|
| 74 | + if (!$output->toBool()) |
|
| 75 | 75 | { |
| 76 | 76 | return $output; |
| 77 | 77 | } |
@@ -90,16 +90,16 @@ discard block |
||
| 90 | 90 | //$oMemberModule = getModel("member"); |
| 91 | 91 | //$logged_info = $oMemberModule->getMemberInfoByMemberSrl($logged_member_srl); |
| 92 | 92 | $new_status = ($will_publish) ? "published" : "unpublished"; |
| 93 | - foreach($comment_srl_list as $comment_srl) |
|
| 93 | + foreach ($comment_srl_list as $comment_srl) |
|
| 94 | 94 | { |
| 95 | 95 | // check if comment already exists |
| 96 | 96 | $comment = $oCommentModel->getComment($comment_srl); |
| 97 | - if($comment->comment_srl != $comment_srl) |
|
| 97 | + if ($comment->comment_srl != $comment_srl) |
|
| 98 | 98 | { |
| 99 | 99 | return new Object(-1, 'msg_invalid_request'); |
| 100 | 100 | } |
| 101 | 101 | $document_srl = $comment->document_srl; |
| 102 | - if(!in_array($document_srl, $updated_documents_arr)) |
|
| 102 | + if (!in_array($document_srl, $updated_documents_arr)) |
|
| 103 | 103 | { |
| 104 | 104 | $updated_documents_arr[] = $document_srl; |
| 105 | 105 | // update the number of comments |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | // send email to comment's author, all admins and thread(document) subscribers - START |
| 118 | 118 | // ------------------------------------------------------- |
| 119 | 119 | $oMail = new Mail(); |
| 120 | - $mail_title = "[XE - " . $module_info->mid . "] comment(s) status changed to " . $new_status . " on document: \"" . $oDocument->getTitleText() . "\""; |
|
| 120 | + $mail_title = "[XE - ".$module_info->mid."] comment(s) status changed to ".$new_status." on document: \"".$oDocument->getTitleText()."\""; |
|
| 121 | 121 | $oMail->setTitle($mail_title); |
| 122 | 122 | $mail_content = " |
| 123 | - The comment #" . $comment_srl . " on document \"" . $oDocument->getTitleText() . "\" has been " . $new_status . " by admin of <strong><i>" . strtoupper($module_info->mid) . "</i></strong> module. |
|
| 123 | + The comment #" . $comment_srl." on document \"".$oDocument->getTitleText()."\" has been ".$new_status." by admin of <strong><i>".strtoupper($module_info->mid)."</i></strong> module. |
|
| 124 | 124 | <br /> |
| 125 | 125 | <br />Comment content: |
| 126 | - " . $comment->content . " |
|
| 126 | + " . $comment->content." |
|
| 127 | 127 | <br /> |
| 128 | 128 | "; |
| 129 | 129 | $oMail->setContent($mail_content); |
@@ -145,17 +145,17 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | //mail to author of thread - STOP |
| 147 | 147 | //mail to all emails set for administrators - START |
| 148 | - if($module_info->admin_mail) |
|
| 148 | + if ($module_info->admin_mail) |
|
| 149 | 149 | { |
| 150 | 150 | $target_mail = explode(',', $module_info->admin_mail); |
| 151 | - for($i = 0; $i < count($target_mail); $i++) |
|
| 151 | + for ($i = 0; $i < count($target_mail); $i++) |
|
| 152 | 152 | { |
| 153 | 153 | $email_address = trim($target_mail[$i]); |
| 154 | - if(!$email_address) |
|
| 154 | + if (!$email_address) |
|
| 155 | 155 | { |
| 156 | 156 | continue; |
| 157 | 157 | } |
| 158 | - if($author_email != $email_address) |
|
| 158 | + if ($author_email != $email_address) |
|
| 159 | 159 | { |
| 160 | 160 | $oMail->setReceiptor($email_address, $email_address); |
| 161 | 161 | $oMail->send(); |
@@ -173,12 +173,12 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // for message send - start |
| 175 | 175 | $message_content = Context::get('message_content'); |
| 176 | - if($message_content) |
|
| 176 | + if ($message_content) |
|
| 177 | 177 | { |
| 178 | 178 | $message_content = nl2br($message_content); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if($message_content) |
|
| 181 | + if ($message_content) |
|
| 182 | 182 | { |
| 183 | 183 | $this->_sendMessageForComment($message_content, $comment_srl_list); |
| 184 | 184 | } |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | // Error display if none is selected |
| 197 | 197 | $cart = Context::get('cart'); |
| 198 | - if(!$cart) |
|
| 198 | + if (!$cart) |
|
| 199 | 199 | { |
| 200 | 200 | return $this->stop('msg_cart_is_null'); |
| 201 | 201 | } |
| 202 | - if(!is_array($cart)) |
|
| 202 | + if (!is_array($cart)) |
|
| 203 | 203 | { |
| 204 | 204 | $comment_srl_list = explode('|@|', $cart); |
| 205 | 205 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $comment_srl_list = $cart; |
| 209 | 209 | } |
| 210 | 210 | $comment_count = count($comment_srl_list); |
| 211 | - if(!$comment_count) |
|
| 211 | + if (!$comment_count) |
|
| 212 | 212 | { |
| 213 | 213 | return $this->stop('msg_cart_is_null'); |
| 214 | 214 | } |
@@ -220,34 +220,34 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // for message send - start |
| 222 | 222 | $message_content = Context::get('message_content'); |
| 223 | - if($message_content) |
|
| 223 | + if ($message_content) |
|
| 224 | 224 | { |
| 225 | 225 | $message_content = nl2br($message_content); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if($message_content) |
|
| 228 | + if ($message_content) |
|
| 229 | 229 | { |
| 230 | 230 | $this->_sendMessageForComment($message_content, $comment_srl_list); |
| 231 | 231 | } |
| 232 | 232 | // for message send - end |
| 233 | 233 | // comment into trash |
| 234 | - if($isTrash == 'true') |
|
| 234 | + if ($isTrash == 'true') |
|
| 235 | 235 | { |
| 236 | 236 | $this->_moveCommentToTrash($comment_srl_list, $oCommentController, $oDB, $message_content); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $deleted_count = 0; |
| 240 | 240 | // Delete the comment posting |
| 241 | - for($i = 0; $i < $comment_count; $i++) |
|
| 241 | + for ($i = 0; $i < $comment_count; $i++) |
|
| 242 | 242 | { |
| 243 | 243 | $comment_srl = trim($comment_srl_list[$i]); |
| 244 | - if(!$comment_srl) |
|
| 244 | + if (!$comment_srl) |
|
| 245 | 245 | { |
| 246 | 246 | continue; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $output = $oCommentController->deleteComment($comment_srl, TRUE, $isTrash); |
| 250 | - if(!$output->toBool()) |
|
| 250 | + if (!$output->toBool()) |
|
| 251 | 251 | { |
| 252 | 252 | $oDB->rollback(); |
| 253 | 253 | return $output; |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $oDB->commit(); |
| 260 | 260 | |
| 261 | 261 | $msgCode = ''; |
| 262 | - if($isTrash == 'true') |
|
| 262 | + if ($isTrash == 'true') |
|
| 263 | 263 | { |
| 264 | 264 | $msgCode = 'success_trashed'; |
| 265 | 265 | } |
@@ -290,12 +290,12 @@ discard block |
||
| 290 | 290 | $sender_member_srl = $logged_info->member_srl; |
| 291 | 291 | |
| 292 | 292 | $comment_count = count($comment_srl_list); |
| 293 | - for($i = 0; $i < $comment_count; $i++) |
|
| 293 | + for ($i = 0; $i < $comment_count; $i++) |
|
| 294 | 294 | { |
| 295 | 295 | $comment_srl = $comment_srl_list[$i]; |
| 296 | 296 | $oComment = $oCommentModel->getComment($comment_srl, TRUE); |
| 297 | 297 | |
| 298 | - if(!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl) |
|
| 298 | + if (!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl) |
|
| 299 | 299 | { |
| 300 | 300 | continue; |
| 301 | 301 | } |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB, $message_content = NULL) |
| 314 | 314 | { |
| 315 | - require_once(_XE_PATH_ . 'modules/trash/model/TrashVO.php'); |
|
| 315 | + require_once(_XE_PATH_.'modules/trash/model/TrashVO.php'); |
|
| 316 | 316 | |
| 317 | - if(is_array($commentSrlList)) |
|
| 317 | + if (is_array($commentSrlList)) |
|
| 318 | 318 | { |
| 319 | 319 | $logged_info = Context::get('logged_info'); |
| 320 | 320 | $oCommentModel = getModel('comment'); |
| 321 | 321 | $commentItemList = $oCommentModel->getComments($commentSrlList); |
| 322 | 322 | $oTrashAdminController = getAdminController('trash'); |
| 323 | 323 | |
| 324 | - foreach($commentItemList AS $key => $oComment) |
|
| 324 | + foreach ($commentItemList AS $key => $oComment) |
|
| 325 | 325 | { |
| 326 | 326 | $oTrashVO = new TrashVO(); |
| 327 | 327 | $oTrashVO->setTrashSrl(getNextSequence()); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $oTrashVO->setDescription($message_content); |
| 332 | 332 | |
| 333 | 333 | $output = $oTrashAdminController->insertTrash($oTrashVO); |
| 334 | - if(!$output->toBool()) |
|
| 334 | + if (!$output->toBool()) |
|
| 335 | 335 | { |
| 336 | 336 | $oDB->rollback(); |
| 337 | 337 | return $output; |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | $oCommentController = getController('comment'); |
| 356 | 356 | $oComment = $oCommentModel->getComment($comment_srl, false); |
| 357 | 357 | |
| 358 | - if(!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 358 | + if (!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 359 | 359 | |
| 360 | 360 | $message_content = ""; |
| 361 | 361 | $this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content); |
@@ -377,12 +377,12 @@ discard block |
||
| 377 | 377 | { |
| 378 | 378 | $comment_srl = trim(Context::get('comment_srl')); |
| 379 | 379 | |
| 380 | - if($comment_srl) |
|
| 380 | + if ($comment_srl) |
|
| 381 | 381 | { |
| 382 | 382 | $args = new stdClass(); |
| 383 | 383 | $args->comment_srl = $comment_srl; |
| 384 | 384 | $output = executeQuery('comment.deleteDeclaredComments', $args); |
| 385 | - if(!$output->toBool()) |
|
| 385 | + if (!$output->toBool()) |
|
| 386 | 386 | { |
| 387 | 387 | return $output; |
| 388 | 388 | } |
@@ -403,11 +403,11 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | $output = $oCommentModel->getComments($commentSrlList); |
| 405 | 405 | |
| 406 | - if(is_array($output)) |
|
| 406 | + if (is_array($output)) |
|
| 407 | 407 | { |
| 408 | - foreach($output AS $key => $value) |
|
| 408 | + foreach ($output AS $key => $value) |
|
| 409 | 409 | { |
| 410 | - if($_SESSION['comment_management'][$key]) |
|
| 410 | + if ($_SESSION['comment_management'][$key]) |
|
| 411 | 411 | { |
| 412 | 412 | unset($_SESSION['comment_management'][$key]); |
| 413 | 413 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $args = new stdClass(); |
| 429 | 429 | $args->module_srl = $module_srl; |
| 430 | 430 | $output = executeQuery('comment.deleteModuleComments', $args); |
| 431 | - if(!$output->toBool()) |
|
| 431 | + if (!$output->toBool()) |
|
| 432 | 432 | { |
| 433 | 433 | return $output; |
| 434 | 434 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | //remove from cache |
| 439 | 439 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 440 | - if($oCacheHandler->isSupport()) |
|
| 440 | + if ($oCacheHandler->isSupport()) |
|
| 441 | 441 | { |
| 442 | 442 | // Invalidate newest comments. Per document cache is invalidated inside document admin controller. |
| 443 | 443 | $oCacheHandler->invalidateGroupKey('newestCommentsList'); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | function restoreTrash($originObject) |
| 454 | 454 | { |
| 455 | - if(is_array($originObject)) |
|
| 455 | + if (is_array($originObject)) |
|
| 456 | 456 | { |
| 457 | 457 | $originObject = (object) $originObject; |
| 458 | 458 | } |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | function emptyTrash($originObject) |
| 486 | 486 | { |
| 487 | 487 | $originObject = unserialize($originObject); |
| 488 | - if(is_array($originObject)) |
|
| 488 | + if (is_array($originObject)) |
|
| 489 | 489 | { |
| 490 | 490 | $originObject = (object) $originObject; |
| 491 | 491 | } |
@@ -160,7 +160,6 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | /** |
| 162 | 162 | * Check if module is using comment validation system |
| 163 | - * @param int $document_srl |
|
| 164 | 163 | * @param int $module_srl |
| 165 | 164 | * @return bool |
| 166 | 165 | */ |
@@ -1151,7 +1150,7 @@ discard block |
||
| 1151 | 1150 | |
| 1152 | 1151 | /** |
| 1153 | 1152 | * Report a blamed comment |
| 1154 | - * @param $comment_srl |
|
| 1153 | + * @param string $comment_srl |
|
| 1155 | 1154 | * @return void |
| 1156 | 1155 | */ |
| 1157 | 1156 | function declaredComment($comment_srl) |
@@ -1356,7 +1355,7 @@ discard block |
||
| 1356 | 1355 | /** |
| 1357 | 1356 | * Comment module config setting |
| 1358 | 1357 | * @param int $srl |
| 1359 | - * @param object $comment_config |
|
| 1358 | + * @param stdClass $comment_config |
|
| 1360 | 1359 | * @return Object |
| 1361 | 1360 | */ |
| 1362 | 1361 | function setCommentModuleConfig($srl, $comment_config) |
@@ -1368,7 +1367,7 @@ discard block |
||
| 1368 | 1367 | |
| 1369 | 1368 | /** |
| 1370 | 1369 | * Get comment all list |
| 1371 | - * @return void |
|
| 1370 | + * @return Object|null |
|
| 1372 | 1371 | */ |
| 1373 | 1372 | function procCommentGetList() |
| 1374 | 1373 | { |
@@ -581,7 +581,7 @@ |
||
| 581 | 581 | //mail to author of thread - START |
| 582 | 582 | /** |
| 583 | 583 | * @todo Removed code send email to document author. |
| 584 | - */ |
|
| 584 | + */ |
|
| 585 | 585 | /* |
| 586 | 586 | if($document_author_email != $obj->email_address && $logged_info->email_address != $document_author_email) |
| 587 | 587 | { |
@@ -211,14 +211,12 @@ discard block |
||
| 211 | 211 | if($logged_info->is_admin == 'Y') |
| 212 | 212 | { |
| 213 | 213 | $is_admin = TRUE; |
| 214 | - } |
|
| 215 | - else |
|
| 214 | + } else |
|
| 216 | 215 | { |
| 217 | 216 | $is_admin = FALSE; |
| 218 | 217 | } |
| 219 | 218 | } |
| 220 | - } |
|
| 221 | - else |
|
| 219 | + } else |
|
| 222 | 220 | { |
| 223 | 221 | $is_admin = FALSE; |
| 224 | 222 | } |
@@ -226,14 +224,12 @@ discard block |
||
| 226 | 224 | if(!$using_validation) |
| 227 | 225 | { |
| 228 | 226 | $obj->status = 1; |
| 229 | - } |
|
| 230 | - else |
|
| 227 | + } else |
|
| 231 | 228 | { |
| 232 | 229 | if($is_admin) |
| 233 | 230 | { |
| 234 | 231 | $obj->status = 1; |
| 235 | - } |
|
| 236 | - else |
|
| 232 | + } else |
|
| 237 | 233 | { |
| 238 | 234 | $obj->status = 0; |
| 239 | 235 | } |
@@ -310,8 +306,7 @@ discard block |
||
| 310 | 306 | if(!$obj->comment_srl) |
| 311 | 307 | { |
| 312 | 308 | $obj->comment_srl = getNextSequence(); |
| 313 | - } |
|
| 314 | - elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) |
|
| 309 | + } elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) |
|
| 315 | 310 | { |
| 316 | 311 | return new Object(-1, 'msg_not_permitted'); |
| 317 | 312 | } |
@@ -369,8 +364,7 @@ discard block |
||
| 369 | 364 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
| 370 | 365 | $list_args->depth = 0; |
| 371 | 366 | // If parent comment exists, get information of the parent comment |
| 372 | - } |
|
| 373 | - else |
|
| 367 | + } else |
|
| 374 | 368 | { |
| 375 | 369 | // get information of the parent comment posting |
| 376 | 370 | $parent_args = new stdClass(); |
@@ -393,8 +387,7 @@ discard block |
||
| 393 | 387 | { |
| 394 | 388 | $list_args->arrange = $obj->comment_srl; |
| 395 | 389 | // if the depth of comments is greater than 2, execute update. |
| 396 | - } |
|
| 397 | - else |
|
| 390 | + } else |
|
| 398 | 391 | { |
| 399 | 392 | // get the top listed comment among those in lower depth and same head with parent's. |
| 400 | 393 | $p_args = new stdClass(); |
@@ -407,8 +400,7 @@ discard block |
||
| 407 | 400 | { |
| 408 | 401 | $list_args->arrange = $output->data->arrange; |
| 409 | 402 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
| 410 | - } |
|
| 411 | - else |
|
| 403 | + } else |
|
| 412 | 404 | { |
| 413 | 405 | $list_args->arrange = $obj->comment_srl; |
| 414 | 406 | } |
@@ -442,8 +434,7 @@ discard block |
||
| 442 | 434 | if(!$using_validation) |
| 443 | 435 | { |
| 444 | 436 | $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, TRUE); |
| 445 | - } |
|
| 446 | - else |
|
| 437 | + } else |
|
| 447 | 438 | { |
| 448 | 439 | if($is_admin) |
| 449 | 440 | { |
@@ -511,8 +502,7 @@ discard block |
||
| 511 | 502 | if(isset($obj->member_srl) && !is_null($obj->member_srl)) |
| 512 | 503 | { |
| 513 | 504 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->member_srl); |
| 514 | - } |
|
| 515 | - else |
|
| 505 | + } else |
|
| 516 | 506 | { |
| 517 | 507 | $member_info = new stdClass(); |
| 518 | 508 | $member_info->is_admin = "N"; |
@@ -558,8 +548,7 @@ discard block |
||
| 558 | 548 | <br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "\">" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "</a> |
| 559 | 549 | "; |
| 560 | 550 | $oMail->setContent($mail_content); |
| 561 | - } |
|
| 562 | - else |
|
| 551 | + } else |
|
| 563 | 552 | { |
| 564 | 553 | $mail_content = " |
| 565 | 554 | Author: " . $member_info->nick_name . " |
@@ -832,8 +821,7 @@ discard block |
||
| 832 | 821 | if(!$deleteAllComment) |
| 833 | 822 | { |
| 834 | 823 | return new Object(-1, 'fail_to_delete_have_children'); |
| 835 | - } |
|
| 836 | - else |
|
| 824 | + } else |
|
| 837 | 825 | { |
| 838 | 826 | foreach($childs as $val) |
| 839 | 827 | { |
@@ -897,8 +885,7 @@ discard block |
||
| 897 | 885 | { |
| 898 | 886 | $this->_deleteDeclaredComments($args); |
| 899 | 887 | $this->_deleteVotedComments($args); |
| 900 | - } |
|
| 901 | - else |
|
| 888 | + } else |
|
| 902 | 889 | { |
| 903 | 890 | $args = new stdClass(); |
| 904 | 891 | $args->upload_target_srl = $comment_srl; |
@@ -941,8 +928,7 @@ discard block |
||
| 941 | 928 | { |
| 942 | 929 | $oDocument = new documentItem(); |
| 943 | 930 | $oDocument->setAttribute($obj); |
| 944 | - } |
|
| 945 | - else |
|
| 931 | + } else |
|
| 946 | 932 | { |
| 947 | 933 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 948 | 934 | } |
@@ -1035,8 +1021,7 @@ discard block |
||
| 1035 | 1021 | { |
| 1036 | 1022 | $failed_voted = 'failed_voted'; |
| 1037 | 1023 | $success_message = 'success_voted'; |
| 1038 | - } |
|
| 1039 | - else |
|
| 1024 | + } else |
|
| 1040 | 1025 | { |
| 1041 | 1026 | $failed_voted = 'failed_blamed'; |
| 1042 | 1027 | $success_message = 'success_blamed'; |
@@ -1079,8 +1064,7 @@ discard block |
||
| 1079 | 1064 | if($member_srl) |
| 1080 | 1065 | { |
| 1081 | 1066 | $args->member_srl = $member_srl; |
| 1082 | - } |
|
| 1083 | - else |
|
| 1067 | + } else |
|
| 1084 | 1068 | { |
| 1085 | 1069 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1086 | 1070 | } |
@@ -1104,8 +1088,7 @@ discard block |
||
| 1104 | 1088 | { |
| 1105 | 1089 | $args->blamed_count = $oComment->get('blamed_count') + $point; |
| 1106 | 1090 | $output = executeQuery('comment.updateBlamedCount', $args); |
| 1107 | - } |
|
| 1108 | - else |
|
| 1091 | + } else |
|
| 1109 | 1092 | { |
| 1110 | 1093 | $args->voted_count = $oComment->get('voted_count') + $point; |
| 1111 | 1094 | $output = executeQuery('comment.updateVotedCount', $args); |
@@ -1140,8 +1123,7 @@ discard block |
||
| 1140 | 1123 | if($point > 0) |
| 1141 | 1124 | { |
| 1142 | 1125 | $output->add('voted_count', $obj->after_point); |
| 1143 | - } |
|
| 1144 | - else |
|
| 1126 | + } else |
|
| 1145 | 1127 | { |
| 1146 | 1128 | $output->add('blamed_count', $obj->after_point); |
| 1147 | 1129 | } |
@@ -1213,8 +1195,7 @@ discard block |
||
| 1213 | 1195 | if($member_srl) |
| 1214 | 1196 | { |
| 1215 | 1197 | $args->member_srl = $member_srl; |
| 1216 | - } |
|
| 1217 | - else |
|
| 1198 | + } else |
|
| 1218 | 1199 | { |
| 1219 | 1200 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1220 | 1201 | } |
@@ -1236,8 +1217,7 @@ discard block |
||
| 1236 | 1217 | if($output->data->declared_count > 0) |
| 1237 | 1218 | { |
| 1238 | 1219 | $output = executeQuery('comment.updateDeclaredComment', $args); |
| 1239 | - } |
|
| 1240 | - else |
|
| 1220 | + } else |
|
| 1241 | 1221 | { |
| 1242 | 1222 | $output = executeQuery('comment.insertDeclaredComment', $args); |
| 1243 | 1223 | } |
@@ -1304,8 +1284,7 @@ discard block |
||
| 1304 | 1284 | if(preg_match('/^([0-9,]+)$/', $module_srl)) |
| 1305 | 1285 | { |
| 1306 | 1286 | $module_srl = explode(',', $module_srl); |
| 1307 | - } |
|
| 1308 | - else |
|
| 1287 | + } else |
|
| 1309 | 1288 | { |
| 1310 | 1289 | $module_srl = array($module_srl); |
| 1311 | 1290 | } |
@@ -1395,8 +1374,7 @@ discard block |
||
| 1395 | 1374 | $value->content = strip_tags($value->content); |
| 1396 | 1375 | } |
| 1397 | 1376 | } |
| 1398 | - } |
|
| 1399 | - else |
|
| 1377 | + } else |
|
| 1400 | 1378 | { |
| 1401 | 1379 | global $lang; |
| 1402 | 1380 | $commentList = array(); |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | function procCommentVoteUp() |
| 29 | 29 | { |
| 30 | - if(!Context::get('is_logged')) |
|
| 30 | + if (!Context::get('is_logged')) |
|
| 31 | 31 | { |
| 32 | 32 | return new Object(-1, 'msg_invalid_request'); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $comment_srl = Context::get('target_srl'); |
| 36 | - if(!$comment_srl) |
|
| 36 | + if (!$comment_srl) |
|
| 37 | 37 | { |
| 38 | 38 | return new Object(-1, 'msg_invalid_request'); |
| 39 | 39 | } |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | $oCommentModel = getModel('comment'); |
| 42 | 42 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
| 43 | 43 | $module_srl = $oComment->get('module_srl'); |
| 44 | - if(!$module_srl) |
|
| 44 | + if (!$module_srl) |
|
| 45 | 45 | { |
| 46 | 46 | return new Object(-1, 'msg_invalid_request'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $oModuleModel = getModel('module'); |
| 50 | 50 | $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); |
| 51 | - if($comment_config->use_vote_up == 'N') |
|
| 51 | + if ($comment_config->use_vote_up == 'N') |
|
| 52 | 52 | { |
| 53 | 53 | return new Object(-1, 'msg_invalid_request'); |
| 54 | 54 | } |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function procCommentVoteDown() |
| 67 | 67 | { |
| 68 | - if(!Context::get('is_logged')) |
|
| 68 | + if (!Context::get('is_logged')) |
|
| 69 | 69 | { |
| 70 | 70 | return new Object(-1, 'msg_invalid_request'); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $comment_srl = Context::get('target_srl'); |
| 74 | - if(!$comment_srl) |
|
| 74 | + if (!$comment_srl) |
|
| 75 | 75 | { |
| 76 | 76 | return new Object(-1, 'msg_invalid_request'); |
| 77 | 77 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | $oCommentModel = getModel('comment'); |
| 80 | 80 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
| 81 | 81 | $module_srl = $oComment->get('module_srl'); |
| 82 | - if(!$module_srl) |
|
| 82 | + if (!$module_srl) |
|
| 83 | 83 | { |
| 84 | 84 | return new Object(-1, 'msg_invalid_request'); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $oModuleModel = getModel('module'); |
| 88 | 88 | $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); |
| 89 | - if($comment_config->use_vote_down == 'N') |
|
| 89 | + if ($comment_config->use_vote_down == 'N') |
|
| 90 | 90 | { |
| 91 | 91 | return new Object(-1, 'msg_invalid_request'); |
| 92 | 92 | } |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | function procCommentDeclare() |
| 105 | 105 | { |
| 106 | - if(!Context::get('is_logged')) |
|
| 106 | + if (!Context::get('is_logged')) |
|
| 107 | 107 | { |
| 108 | 108 | return new Object(-1, 'msg_invalid_request'); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $comment_srl = Context::get('target_srl'); |
| 112 | - if(!$comment_srl) |
|
| 112 | + if (!$comment_srl) |
|
| 113 | 113 | { |
| 114 | 114 | return new Object(-1, 'msg_invalid_request'); |
| 115 | 115 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | function triggerDeleteDocumentComments(&$obj) |
| 125 | 125 | { |
| 126 | 126 | $document_srl = $obj->document_srl; |
| 127 | - if(!$document_srl) |
|
| 127 | + if (!$document_srl) |
|
| 128 | 128 | { |
| 129 | 129 | return new Object(); |
| 130 | 130 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | function triggerDeleteModuleComments(&$obj) |
| 140 | 140 | { |
| 141 | 141 | $module_srl = $obj->module_srl; |
| 142 | - if(!$module_srl) |
|
| 142 | + if (!$module_srl) |
|
| 143 | 143 | { |
| 144 | 144 | return new Object(); |
| 145 | 145 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | function isModuleUsingPublishValidation($module_srl = NULL) |
| 168 | 168 | { |
| 169 | - if($module_srl == NULL) |
|
| 169 | + if ($module_srl == NULL) |
|
| 170 | 170 | { |
| 171 | 171 | return FALSE; |
| 172 | 172 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 176 | 176 | $module_part_config = $oModuleModel->getModulePartConfig('comment', $module_info->module_srl); |
| 177 | 177 | $use_validation = FALSE; |
| 178 | - if(isset($module_part_config->use_comment_validation) && $module_part_config->use_comment_validation == "Y") |
|
| 178 | + if (isset($module_part_config->use_comment_validation) && $module_part_config->use_comment_validation == "Y") |
|
| 179 | 179 | { |
| 180 | 180 | $use_validation = TRUE; |
| 181 | 181 | } |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | function insertComment($obj, $manual_inserted = FALSE) |
| 192 | 192 | { |
| 193 | - if(!$manual_inserted && !checkCSRF()) |
|
| 193 | + if (!$manual_inserted && !checkCSRF()) |
|
| 194 | 194 | { |
| 195 | 195 | return new Object(-1, 'msg_invalid_request'); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if(!is_object($obj)) |
|
| 198 | + if (!is_object($obj)) |
|
| 199 | 199 | { |
| 200 | 200 | $obj = new stdClass(); |
| 201 | 201 | } |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | // check if comment's module is using comment validation and set the publish status to 0 (false) |
| 204 | 204 | // for inserting query, otherwise default is 1 (true - means comment is published) |
| 205 | 205 | $using_validation = $this->isModuleUsingPublishValidation($obj->module_srl); |
| 206 | - if(!$manual_inserted) |
|
| 206 | + if (!$manual_inserted) |
|
| 207 | 207 | { |
| 208 | - if(Context::get('is_logged')) |
|
| 208 | + if (Context::get('is_logged')) |
|
| 209 | 209 | { |
| 210 | 210 | $logged_info = Context::get('logged_info'); |
| 211 | - if($logged_info->is_admin == 'Y') |
|
| 211 | + if ($logged_info->is_admin == 'Y') |
|
| 212 | 212 | { |
| 213 | 213 | $is_admin = TRUE; |
| 214 | 214 | } |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | $is_admin = FALSE; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if(!$using_validation) |
|
| 226 | + if (!$using_validation) |
|
| 227 | 227 | { |
| 228 | 228 | $obj->status = 1; |
| 229 | 229 | } |
| 230 | 230 | else |
| 231 | 231 | { |
| 232 | - if($is_admin) |
|
| 232 | + if ($is_admin) |
|
| 233 | 233 | { |
| 234 | 234 | $obj->status = 1; |
| 235 | 235 | } |
@@ -242,14 +242,14 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | // call a trigger (before) |
| 244 | 244 | $output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj); |
| 245 | - if(!$output->toBool()) |
|
| 245 | + if (!$output->toBool()) |
|
| 246 | 246 | { |
| 247 | 247 | return $output; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // check if a posting of the corresponding document_srl exists |
| 251 | 251 | $document_srl = $obj->document_srl; |
| 252 | - if(!$document_srl) |
|
| 252 | + if (!$document_srl) |
|
| 253 | 253 | { |
| 254 | 254 | return new Object(-1, 'msg_invalid_document'); |
| 255 | 255 | } |
@@ -258,36 +258,36 @@ discard block |
||
| 258 | 258 | $oDocumentModel = getModel('document'); |
| 259 | 259 | |
| 260 | 260 | // even for manual_inserted if password exists, hash it. |
| 261 | - if($obj->password) |
|
| 261 | + if ($obj->password) |
|
| 262 | 262 | { |
| 263 | 263 | $obj->password = getModel('member')->hashPassword($obj->password); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // get the original posting |
| 267 | - if(!$manual_inserted) |
|
| 267 | + if (!$manual_inserted) |
|
| 268 | 268 | { |
| 269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 270 | 270 | |
| 271 | - if($document_srl != $oDocument->document_srl) |
|
| 271 | + if ($document_srl != $oDocument->document_srl) |
|
| 272 | 272 | { |
| 273 | 273 | return new Object(-1, 'msg_invalid_document'); |
| 274 | 274 | } |
| 275 | - if($oDocument->isLocked()) |
|
| 275 | + if ($oDocument->isLocked()) |
|
| 276 | 276 | { |
| 277 | 277 | return new Object(-1, 'msg_invalid_request'); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if($obj->homepage) |
|
| 280 | + if ($obj->homepage) |
|
| 281 | 281 | { |
| 282 | 282 | $obj->homepage = removeHackTag($obj->homepage); |
| 283 | - if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage)) |
|
| 283 | + if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage)) |
|
| 284 | 284 | { |
| 285 | 285 | $obj->homepage = 'http://'.$obj->homepage; |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // input the member's information if logged-in |
| 290 | - if(Context::get('is_logged')) |
|
| 290 | + if (Context::get('is_logged')) |
|
| 291 | 291 | { |
| 292 | 292 | $logged_info = Context::get('logged_info'); |
| 293 | 293 | $obj->member_srl = $logged_info->member_srl; |
@@ -302,16 +302,16 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // error display if neither of log-in info and user name exist. |
| 305 | - if(!$logged_info->member_srl && !$obj->nick_name) |
|
| 305 | + if (!$logged_info->member_srl && !$obj->nick_name) |
|
| 306 | 306 | { |
| 307 | 307 | return new Object(-1, 'msg_invalid_request'); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if(!$obj->comment_srl) |
|
| 310 | + if (!$obj->comment_srl) |
|
| 311 | 311 | { |
| 312 | 312 | $obj->comment_srl = getNextSequence(); |
| 313 | 313 | } |
| 314 | - elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) |
|
| 314 | + elseif (!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) |
|
| 315 | 315 | { |
| 316 | 316 | return new Object(-1, 'msg_not_permitted'); |
| 317 | 317 | } |
@@ -322,32 +322,32 @@ discard block |
||
| 322 | 322 | // remove XE's own tags from the contents |
| 323 | 323 | $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); |
| 324 | 324 | |
| 325 | - if(Mobile::isFromMobilePhone()) |
|
| 325 | + if (Mobile::isFromMobilePhone()) |
|
| 326 | 326 | { |
| 327 | - if($obj->use_html != 'Y') |
|
| 327 | + if ($obj->use_html != 'Y') |
|
| 328 | 328 | { |
| 329 | 329 | $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 330 | 330 | } |
| 331 | 331 | $obj->content = nl2br($obj->content); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if(!$obj->regdate) |
|
| 334 | + if (!$obj->regdate) |
|
| 335 | 335 | { |
| 336 | 336 | $obj->regdate = date("YmdHis"); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | // remove iframe and script if not a top administrator on the session. |
| 340 | - if($logged_info->is_admin != 'Y') |
|
| 340 | + if ($logged_info->is_admin != 'Y') |
|
| 341 | 341 | { |
| 342 | 342 | $obj->content = removeHackTag($obj->content); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if(!$obj->notify_message) |
|
| 345 | + if (!$obj->notify_message) |
|
| 346 | 346 | { |
| 347 | 347 | $obj->notify_message = 'N'; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if(!$obj->is_secret) |
|
| 350 | + if (!$obj->is_secret) |
|
| 351 | 351 | { |
| 352 | 352 | $obj->is_secret = 'N'; |
| 353 | 353 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $list_args->regdate = $obj->regdate; |
| 365 | 365 | |
| 366 | 366 | // If parent comment doesn't exist, set data directly |
| 367 | - if(!$obj->parent_srl) |
|
| 367 | + if (!$obj->parent_srl) |
|
| 368 | 368 | { |
| 369 | 369 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
| 370 | 370 | $list_args->depth = 0; |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
| 379 | 379 | |
| 380 | 380 | // return if no parent comment exists |
| 381 | - if(!$parent_output->toBool() || !$parent_output->data) |
|
| 381 | + if (!$parent_output->toBool() || !$parent_output->data) |
|
| 382 | 382 | { |
| 383 | 383 | return; |
| 384 | 384 | } |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $list_args->depth = $parent->depth + 1; |
| 390 | 390 | |
| 391 | 391 | // if the depth of comments is less than 2, execute insert. |
| 392 | - if($list_args->depth < 2) |
|
| 392 | + if ($list_args->depth < 2) |
|
| 393 | 393 | { |
| 394 | 394 | $list_args->arrange = $obj->comment_srl; |
| 395 | 395 | // if the depth of comments is greater than 2, execute update. |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $p_args->depth = $parent->depth; |
| 404 | 404 | $output = executeQuery('comment.getCommentParentNextSibling', $p_args); |
| 405 | 405 | |
| 406 | - if($output->data->arrange) |
|
| 406 | + if ($output->data->arrange) |
|
| 407 | 407 | { |
| 408 | 408 | $list_args->arrange = $output->data->arrange; |
| 409 | 409 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
@@ -416,14 +416,14 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | $output = executeQuery('comment.insertCommentList', $list_args); |
| 419 | - if(!$output->toBool()) |
|
| 419 | + if (!$output->toBool()) |
|
| 420 | 420 | { |
| 421 | 421 | return $output; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | // insert comment |
| 425 | 425 | $output = executeQuery('comment.insertComment', $obj); |
| 426 | - if(!$output->toBool()) |
|
| 426 | + if (!$output->toBool()) |
|
| 427 | 427 | { |
| 428 | 428 | $oDB->rollback(); |
| 429 | 429 | return $output; |
@@ -439,29 +439,29 @@ discard block |
||
| 439 | 439 | $oDocumentController = getController('document'); |
| 440 | 440 | |
| 441 | 441 | // Update the number of comments in the post |
| 442 | - if(!$using_validation) |
|
| 442 | + if (!$using_validation) |
|
| 443 | 443 | { |
| 444 | 444 | $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, TRUE); |
| 445 | 445 | } |
| 446 | 446 | else |
| 447 | 447 | { |
| 448 | - if($is_admin) |
|
| 448 | + if ($is_admin) |
|
| 449 | 449 | { |
| 450 | 450 | $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, TRUE); |
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // grant autority of the comment |
| 455 | - if(!$manual_inserted) |
|
| 455 | + if (!$manual_inserted) |
|
| 456 | 456 | { |
| 457 | 457 | $this->addGrant($obj->comment_srl); |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | // call a trigger(after) |
| 461 | - if($output->toBool()) |
|
| 461 | + if ($output->toBool()) |
|
| 462 | 462 | { |
| 463 | 463 | $trigger_output = ModuleHandler::triggerCall('comment.insertComment', 'after', $obj); |
| 464 | - if(!$trigger_output->toBool()) |
|
| 464 | + if (!$trigger_output->toBool()) |
|
| 465 | 465 | { |
| 466 | 466 | $oDB->rollback(); |
| 467 | 467 | return $trigger_output; |
@@ -471,16 +471,16 @@ discard block |
||
| 471 | 471 | // commit |
| 472 | 472 | $oDB->commit(); |
| 473 | 473 | |
| 474 | - if(!$manual_inserted) |
|
| 474 | + if (!$manual_inserted) |
|
| 475 | 475 | { |
| 476 | 476 | // send a message if notify_message option in enabled in the original article |
| 477 | 477 | $oDocument->notify(Context::getLang('comment'), $obj->content); |
| 478 | 478 | |
| 479 | 479 | // send a message if notify_message option in enabled in the original comment |
| 480 | - if($obj->parent_srl) |
|
| 480 | + if ($obj->parent_srl) |
|
| 481 | 481 | { |
| 482 | 482 | $oParent = $oCommentModel->getComment($obj->parent_srl); |
| 483 | - if($oParent->get('member_srl') != $oDocument->get('member_srl')) |
|
| 483 | + if ($oParent->get('member_srl') != $oDocument->get('member_srl')) |
|
| 484 | 484 | { |
| 485 | 485 | $oParent->notify(Context::getLang('comment'), $obj->content); |
| 486 | 486 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
| 509 | 509 | |
| 510 | 510 | $oMemberModel = getModel("member"); |
| 511 | - if(isset($obj->member_srl) && !is_null($obj->member_srl)) |
|
| 511 | + if (isset($obj->member_srl) && !is_null($obj->member_srl)) |
|
| 512 | 512 | { |
| 513 | 513 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->member_srl); |
| 514 | 514 | } |
@@ -528,47 +528,47 @@ discard block |
||
| 528 | 528 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($obj->document_srl); |
| 529 | 529 | |
| 530 | 530 | // If there is no problem to register comment then send an email to all admin were set in module admin panel |
| 531 | - if($module_info->admin_mail && $member_info->is_admin != 'Y') |
|
| 531 | + if ($module_info->admin_mail && $member_info->is_admin != 'Y') |
|
| 532 | 532 | { |
| 533 | 533 | $oMail = new Mail(); |
| 534 | 534 | $oMail->setSender($obj->email_address, $obj->email_address); |
| 535 | - $mail_title = "[XE - " . Context::get('mid') . "] A new comment was posted on document: \"" . $oDocument->getTitleText() . "\""; |
|
| 535 | + $mail_title = "[XE - ".Context::get('mid')."] A new comment was posted on document: \"".$oDocument->getTitleText()."\""; |
|
| 536 | 536 | $oMail->setTitle($mail_title); |
| 537 | - $url_comment = getFullUrl('','document_srl',$obj->document_srl).'#comment_'.$obj->comment_srl; |
|
| 538 | - if($using_validation) |
|
| 537 | + $url_comment = getFullUrl('', 'document_srl', $obj->document_srl).'#comment_'.$obj->comment_srl; |
|
| 538 | + if ($using_validation) |
|
| 539 | 539 | { |
| 540 | 540 | $url_approve = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminChangePublishedStatusChecked', 'cart[]', $obj->comment_srl, 'will_publish', '1', 'search_target', 'is_published', 'search_keyword', 'N'); |
| 541 | 541 | $url_trash = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminDeleteChecked', 'cart[]', $obj->comment_srl, 'search_target', 'is_trash', 'search_keyword', 'true'); |
| 542 | 542 | $mail_content = " |
| 543 | - A new comment on the document \"" . $oDocument->getTitleText() . "\" is waiting for your approval. |
|
| 543 | + A new comment on the document \"" . $oDocument->getTitleText()."\" is waiting for your approval. |
|
| 544 | 544 | <br /> |
| 545 | 545 | <br /> |
| 546 | - Author: " . $member_info->nick_name . " |
|
| 547 | - <br />Author e-mail: " . $member_info->email_address . " |
|
| 548 | - <br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a> |
|
| 546 | + Author: " . $member_info->nick_name." |
|
| 547 | + <br />Author e-mail: " . $member_info->email_address." |
|
| 548 | + <br />From : <a href=\"" . $url_comment."\">".$url_comment."</a> |
|
| 549 | 549 | <br />Comment: |
| 550 | - <br />\"" . $obj->content . "\" |
|
| 550 | + <br />\"" . $obj->content."\" |
|
| 551 | 551 | <br />Document: |
| 552 | - <br />\"" . $oDocument->getContentText(). "\" |
|
| 552 | + <br />\"" . $oDocument->getContentText()."\" |
|
| 553 | 553 | <br /> |
| 554 | 554 | <br /> |
| 555 | - Approve it: <a href=\"" . $url_approve . "\">" . $url_approve . "</a> |
|
| 556 | - <br />Trash it: <a href=\"" . $url_trash . "\">" . $url_trash . "</a> |
|
| 557 | - <br />Currently " . $nr_comments_not_approved . " comments on \"" . Context::get('mid') . "\" module are waiting for approval. Please visit the moderation panel: |
|
| 558 | - <br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "\">" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "</a> |
|
| 555 | + Approve it: <a href=\"" . $url_approve."\">".$url_approve."</a> |
|
| 556 | + <br />Trash it: <a href=\"" . $url_trash."\">".$url_trash."</a> |
|
| 557 | + <br />Currently " . $nr_comments_not_approved." comments on \"".Context::get('mid')."\" module are waiting for approval. Please visit the moderation panel: |
|
| 558 | + <br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl)."\">".getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl)."</a> |
|
| 559 | 559 | "; |
| 560 | 560 | $oMail->setContent($mail_content); |
| 561 | 561 | } |
| 562 | 562 | else |
| 563 | 563 | { |
| 564 | 564 | $mail_content = " |
| 565 | - Author: " . $member_info->nick_name . " |
|
| 566 | - <br />Author e-mail: " . $member_info->email_address . " |
|
| 567 | - <br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a> |
|
| 565 | + Author: " . $member_info->nick_name." |
|
| 566 | + <br />Author e-mail: " . $member_info->email_address." |
|
| 567 | + <br />From : <a href=\"" . $url_comment."\">".$url_comment."</a> |
|
| 568 | 568 | <br />Comment: |
| 569 | - <br />\"" . $obj->content . "\" |
|
| 569 | + <br />\"" . $obj->content."\" |
|
| 570 | 570 | <br />Document: |
| 571 | - <br />\"" . $oDocument->getContentText(). "\" |
|
| 571 | + <br />\"" . $oDocument->getContentText()."\" |
|
| 572 | 572 | "; |
| 573 | 573 | $oMail->setContent($mail_content); |
| 574 | 574 | |
@@ -597,10 +597,10 @@ discard block |
||
| 597 | 597 | $target_mail = explode(',', $admins_emails); |
| 598 | 598 | |
| 599 | 599 | // send email to all admins - START |
| 600 | - for($i = 0; $i < count($target_mail); $i++) |
|
| 600 | + for ($i = 0; $i < count($target_mail); $i++) |
|
| 601 | 601 | { |
| 602 | 602 | $email_address = trim($target_mail[$i]); |
| 603 | - if(!$email_address) |
|
| 603 | + if (!$email_address) |
|
| 604 | 604 | { |
| 605 | 605 | continue; |
| 606 | 606 | } |
@@ -646,12 +646,12 @@ discard block |
||
| 646 | 646 | */ |
| 647 | 647 | function updateComment($obj, $is_admin = FALSE, $manual_updated = FALSE) |
| 648 | 648 | { |
| 649 | - if(!$manual_updated && !checkCSRF()) |
|
| 649 | + if (!$manual_updated && !checkCSRF()) |
|
| 650 | 650 | { |
| 651 | 651 | return new Object(-1, 'msg_invalid_request'); |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - if(!is_object($obj)) |
|
| 654 | + if (!is_object($obj)) |
|
| 655 | 655 | { |
| 656 | 656 | $obj = new stdClass(); |
| 657 | 657 | } |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | |
| 661 | 661 | // call a trigger (before) |
| 662 | 662 | $output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj); |
| 663 | - if(!$output->toBool()) |
|
| 663 | + if (!$output->toBool()) |
|
| 664 | 664 | { |
| 665 | 665 | return $output; |
| 666 | 666 | } |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | // get the original data |
| 672 | 672 | $source_obj = $oCommentModel->getComment($obj->comment_srl); |
| 673 | - if(!$source_obj->getMemberSrl()) |
|
| 673 | + if (!$source_obj->getMemberSrl()) |
|
| 674 | 674 | { |
| 675 | 675 | $obj->member_srl = $source_obj->get('member_srl'); |
| 676 | 676 | $obj->user_name = $source_obj->get('user_name'); |
@@ -680,30 +680,30 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | // check if permission is granted |
| 683 | - if(!$is_admin && !$source_obj->isGranted()) |
|
| 683 | + if (!$is_admin && !$source_obj->isGranted()) |
|
| 684 | 684 | { |
| 685 | 685 | return new Object(-1, 'msg_not_permitted'); |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if($obj->password) |
|
| 688 | + if ($obj->password) |
|
| 689 | 689 | { |
| 690 | 690 | $obj->password = getModel('member')->hashPassword($obj->password); |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - if($obj->homepage) |
|
| 693 | + if ($obj->homepage) |
|
| 694 | 694 | { |
| 695 | 695 | $obj->homepage = removeHackTag($obj->homepage); |
| 696 | - if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage)) |
|
| 696 | + if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage)) |
|
| 697 | 697 | { |
| 698 | 698 | $obj->homepage = 'http://'.$obj->homepage; |
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | // set modifier's information if logged-in and posting author and modifier are matched. |
| 703 | - if(Context::get('is_logged')) |
|
| 703 | + if (Context::get('is_logged')) |
|
| 704 | 704 | { |
| 705 | 705 | $logged_info = Context::get('logged_info'); |
| 706 | - if($source_obj->member_srl == $logged_info->member_srl) |
|
| 706 | + if ($source_obj->member_srl == $logged_info->member_srl) |
|
| 707 | 707 | { |
| 708 | 708 | $obj->member_srl = $logged_info->member_srl; |
| 709 | 709 | $obj->user_name = $logged_info->user_name; |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | // if nick_name of the logged-in author doesn't exist |
| 717 | - if($source_obj->get('member_srl') && !$obj->nick_name) |
|
| 717 | + if ($source_obj->get('member_srl') && !$obj->nick_name) |
|
| 718 | 718 | { |
| 719 | 719 | $obj->member_srl = $source_obj->get('member_srl'); |
| 720 | 720 | $obj->user_name = $source_obj->get('user_name'); |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | $obj->homepage = $source_obj->get('homepage'); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - if(!$obj->content) |
|
| 726 | + if (!$obj->content) |
|
| 727 | 727 | { |
| 728 | 728 | $obj->content = $source_obj->get('content'); |
| 729 | 729 | } |
@@ -731,9 +731,9 @@ discard block |
||
| 731 | 731 | // remove XE's wn tags from contents |
| 732 | 732 | $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); |
| 733 | 733 | |
| 734 | - if(Mobile::isFromMobilePhone()) |
|
| 734 | + if (Mobile::isFromMobilePhone()) |
|
| 735 | 735 | { |
| 736 | - if($obj->use_html != 'Y') |
|
| 736 | + if ($obj->use_html != 'Y') |
|
| 737 | 737 | { |
| 738 | 738 | $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 739 | 739 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | // remove iframe and script if not a top administrator on the session |
| 744 | - if($logged_info->is_admin != 'Y') |
|
| 744 | + if ($logged_info->is_admin != 'Y') |
|
| 745 | 745 | { |
| 746 | 746 | $obj->content = removeHackTag($obj->content); |
| 747 | 747 | } |
@@ -752,17 +752,17 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | // Update |
| 754 | 754 | $output = executeQuery('comment.updateComment', $obj); |
| 755 | - if(!$output->toBool()) |
|
| 755 | + if (!$output->toBool()) |
|
| 756 | 756 | { |
| 757 | 757 | $oDB->rollback(); |
| 758 | 758 | return $output; |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | // call a trigger (after) |
| 762 | - if($output->toBool()) |
|
| 762 | + if ($output->toBool()) |
|
| 763 | 763 | { |
| 764 | 764 | $trigger_output = ModuleHandler::triggerCall('comment.updateComment', 'after', $obj); |
| 765 | - if(!$trigger_output->toBool()) |
|
| 765 | + if (!$trigger_output->toBool()) |
|
| 766 | 766 | { |
| 767 | 767 | $oDB->rollback(); |
| 768 | 768 | return $trigger_output; |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | // check if comment already exists |
| 793 | 793 | $comment = $oCommentModel->getComment($comment_srl); |
| 794 | - if($comment->comment_srl != $comment_srl) |
|
| 794 | + if ($comment->comment_srl != $comment_srl) |
|
| 795 | 795 | { |
| 796 | 796 | return new Object(-1, 'msg_invalid_request'); |
| 797 | 797 | } |
@@ -800,28 +800,28 @@ discard block |
||
| 800 | 800 | |
| 801 | 801 | // call a trigger (before) |
| 802 | 802 | $output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment); |
| 803 | - if(!$output->toBool()) |
|
| 803 | + if (!$output->toBool()) |
|
| 804 | 804 | { |
| 805 | 805 | return $output; |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | // check if permission is granted |
| 809 | - if(!$is_admin && !$comment->isGranted()) |
|
| 809 | + if (!$is_admin && !$comment->isGranted()) |
|
| 810 | 810 | { |
| 811 | 811 | return new Object(-1, 'msg_not_permitted'); |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | // check if child comment exists on the comment |
| 815 | 815 | $childs = $oCommentModel->getChildComments($comment_srl); |
| 816 | - if(count($childs) > 0) |
|
| 816 | + if (count($childs) > 0) |
|
| 817 | 817 | { |
| 818 | 818 | $deleteAllComment = TRUE; |
| 819 | - if(!$is_admin) |
|
| 819 | + if (!$is_admin) |
|
| 820 | 820 | { |
| 821 | 821 | $logged_info = Context::get('logged_info'); |
| 822 | - foreach($childs as $val) |
|
| 822 | + foreach ($childs as $val) |
|
| 823 | 823 | { |
| 824 | - if($val->member_srl != $logged_info->member_srl) |
|
| 824 | + if ($val->member_srl != $logged_info->member_srl) |
|
| 825 | 825 | { |
| 826 | 826 | $deleteAllComment = FALSE; |
| 827 | 827 | break; |
@@ -829,16 +829,16 @@ discard block |
||
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - if(!$deleteAllComment) |
|
| 832 | + if (!$deleteAllComment) |
|
| 833 | 833 | { |
| 834 | 834 | return new Object(-1, 'fail_to_delete_have_children'); |
| 835 | 835 | } |
| 836 | 836 | else |
| 837 | 837 | { |
| 838 | - foreach($childs as $val) |
|
| 838 | + foreach ($childs as $val) |
|
| 839 | 839 | { |
| 840 | 840 | $output = $this->deleteComment($val->comment_srl, $is_admin, $isMoveToTrash); |
| 841 | - if(!$output->toBool()) |
|
| 841 | + if (!$output->toBool()) |
|
| 842 | 842 | { |
| 843 | 843 | return $output; |
| 844 | 844 | } |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | $args = new stdClass(); |
| 855 | 855 | $args->comment_srl = $comment_srl; |
| 856 | 856 | $output = executeQuery('comment.deleteComment', $args); |
| 857 | - if(!$output->toBool()) |
|
| 857 | + if (!$output->toBool()) |
|
| 858 | 858 | { |
| 859 | 859 | $oDB->rollback(); |
| 860 | 860 | return $output; |
@@ -866,14 +866,14 @@ discard block |
||
| 866 | 866 | $comment_count = $oCommentModel->getCommentCount($document_srl); |
| 867 | 867 | |
| 868 | 868 | // only document is exists |
| 869 | - if(isset($comment_count)) |
|
| 869 | + if (isset($comment_count)) |
|
| 870 | 870 | { |
| 871 | 871 | // create the controller object of the document |
| 872 | 872 | $oDocumentController = getController('document'); |
| 873 | 873 | |
| 874 | 874 | // update comment count of the article posting |
| 875 | 875 | $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, NULL, FALSE); |
| 876 | - if(!$output->toBool()) |
|
| 876 | + if (!$output->toBool()) |
|
| 877 | 877 | { |
| 878 | 878 | $oDB->rollback(); |
| 879 | 879 | return $output; |
@@ -881,11 +881,11 @@ discard block |
||
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | // call a trigger (after) |
| 884 | - if($output->toBool()) |
|
| 884 | + if ($output->toBool()) |
|
| 885 | 885 | { |
| 886 | 886 | $comment->isMoveToTrash = $isMoveToTrash; |
| 887 | 887 | $trigger_output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment); |
| 888 | - if(!$trigger_output->toBool()) |
|
| 888 | + if (!$trigger_output->toBool()) |
|
| 889 | 889 | { |
| 890 | 890 | $oDB->rollback(); |
| 891 | 891 | return $trigger_output; |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | unset($comment->isMoveToTrash); |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | - if(!$isMoveToTrash) |
|
| 896 | + if (!$isMoveToTrash) |
|
| 897 | 897 | { |
| 898 | 898 | $this->_deleteDeclaredComments($args); |
| 899 | 899 | $this->_deleteVotedComments($args); |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | $oCommentModel = getModel('comment'); |
| 938 | 938 | |
| 939 | 939 | // check if permission is granted |
| 940 | - if(is_object($obj)) |
|
| 940 | + if (is_object($obj)) |
|
| 941 | 941 | { |
| 942 | 942 | $oDocument = new documentItem(); |
| 943 | 943 | $oDocument->setAttribute($obj); |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | - if(!$oDocument->isExists() || !$oDocument->isGranted()) |
|
| 950 | + if (!$oDocument->isExists() || !$oDocument->isGranted()) |
|
| 951 | 951 | { |
| 952 | 952 | return new Object(-1, 'msg_not_permitted'); |
| 953 | 953 | } |
@@ -956,23 +956,23 @@ discard block |
||
| 956 | 956 | $args = new stdClass(); |
| 957 | 957 | $args->document_srl = $document_srl; |
| 958 | 958 | $comments = executeQueryArray('comment.getAllComments', $args); |
| 959 | - if($comments->data) |
|
| 959 | + if ($comments->data) |
|
| 960 | 960 | { |
| 961 | 961 | $commentSrlList = array(); |
| 962 | - foreach($comments->data as $comment) |
|
| 962 | + foreach ($comments->data as $comment) |
|
| 963 | 963 | { |
| 964 | 964 | $commentSrlList[] = $comment->comment_srl; |
| 965 | 965 | |
| 966 | 966 | // call a trigger (before) |
| 967 | 967 | $output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment); |
| 968 | - if(!$output->toBool()) |
|
| 968 | + if (!$output->toBool()) |
|
| 969 | 969 | { |
| 970 | 970 | continue; |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | // call a trigger (after) |
| 974 | 974 | $output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment); |
| 975 | - if(!$output->toBool()) |
|
| 975 | + if (!$output->toBool()) |
|
| 976 | 976 | { |
| 977 | 977 | continue; |
| 978 | 978 | } |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | // delete the comment |
| 983 | 983 | $args->document_srl = $document_srl; |
| 984 | 984 | $output = executeQuery('comment.deleteComments', $args); |
| 985 | - if(!$output->toBool()) |
|
| 985 | + if (!$output->toBool()) |
|
| 986 | 986 | { |
| 987 | 987 | return $output; |
| 988 | 988 | } |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | $output = executeQuery('comment.deleteCommentsList', $args); |
| 992 | 992 | |
| 993 | 993 | //delete declared, declared_log, voted_log |
| 994 | - if(is_array($commentSrlList) && count($commentSrlList) > 0) |
|
| 994 | + if (is_array($commentSrlList) && count($commentSrlList) > 0) |
|
| 995 | 995 | { |
| 996 | 996 | $args = new stdClass(); |
| 997 | 997 | $args->comment_srl = join(',', $commentSrlList); |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | */ |
| 1032 | 1032 | function updateVotedCount($comment_srl, $point = 1) |
| 1033 | 1033 | { |
| 1034 | - if($point > 0) |
|
| 1034 | + if ($point > 0) |
|
| 1035 | 1035 | { |
| 1036 | 1036 | $failed_voted = 'failed_voted'; |
| 1037 | 1037 | $success_message = 'success_voted'; |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | // invalid vote if vote info exists in the session info. |
| 1046 | - if($_SESSION['voted_comment'][$comment_srl]) |
|
| 1046 | + if ($_SESSION['voted_comment'][$comment_srl]) |
|
| 1047 | 1047 | { |
| 1048 | 1048 | return new Object(-1, $failed_voted); |
| 1049 | 1049 | } |
@@ -1052,21 +1052,21 @@ discard block |
||
| 1052 | 1052 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
| 1053 | 1053 | |
| 1054 | 1054 | // invalid vote if both ip addresses between author's and the current user are same. |
| 1055 | - if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1055 | + if ($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1056 | 1056 | { |
| 1057 | 1057 | $_SESSION['voted_comment'][$comment_srl] = TRUE; |
| 1058 | 1058 | return new Object(-1, $failed_voted); |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | // if the comment author is a member |
| 1062 | - if($oComment->get('member_srl')) |
|
| 1062 | + if ($oComment->get('member_srl')) |
|
| 1063 | 1063 | { |
| 1064 | 1064 | // create the member model object |
| 1065 | 1065 | $oMemberModel = getModel('member'); |
| 1066 | 1066 | $member_srl = $oMemberModel->getLoggedMemberSrl(); |
| 1067 | 1067 | |
| 1068 | 1068 | // session registered if the author information matches to the current logged-in user's. |
| 1069 | - if($member_srl && $member_srl == abs($oComment->get('member_srl'))) |
|
| 1069 | + if ($member_srl && $member_srl == abs($oComment->get('member_srl'))) |
|
| 1070 | 1070 | { |
| 1071 | 1071 | $_SESSION['voted_comment'][$comment_srl] = TRUE; |
| 1072 | 1072 | return new Object(-1, $failed_voted); |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | $args = new stdClass(); |
| 1077 | 1077 | |
| 1078 | 1078 | // If logged-in, use the member_srl. otherwise use the ipaddress. |
| 1079 | - if($member_srl) |
|
| 1079 | + if ($member_srl) |
|
| 1080 | 1080 | { |
| 1081 | 1081 | $args->member_srl = $member_srl; |
| 1082 | 1082 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | $output = executeQuery('comment.getCommentVotedLogInfo', $args); |
| 1090 | 1090 | |
| 1091 | 1091 | // session registered if log info contains recommendation vote log. |
| 1092 | - if($output->data->count) |
|
| 1092 | + if ($output->data->count) |
|
| 1093 | 1093 | { |
| 1094 | 1094 | $_SESSION['voted_comment'][$comment_srl] = TRUE; |
| 1095 | 1095 | return new Object(-1, $failed_voted); |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | $oDB->begin(); |
| 1101 | 1101 | |
| 1102 | 1102 | // update the number of votes |
| 1103 | - if($point < 0) |
|
| 1103 | + if ($point < 0) |
|
| 1104 | 1104 | { |
| 1105 | 1105 | $args->blamed_count = $oComment->get('blamed_count') + $point; |
| 1106 | 1106 | $output = executeQuery('comment.updateBlamedCount', $args); |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | $obj->before_point = ($point < 0) ? $oComment->get('blamed_count') : $oComment->get('voted_count'); |
| 1125 | 1125 | $obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count; |
| 1126 | 1126 | $trigger_output = ModuleHandler::triggerCall('comment.updateVotedCount', 'after', $obj); |
| 1127 | - if(!$trigger_output->toBool()) |
|
| 1127 | + if (!$trigger_output->toBool()) |
|
| 1128 | 1128 | { |
| 1129 | 1129 | $oDB->rollback(); |
| 1130 | 1130 | return $trigger_output; |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | |
| 1138 | 1138 | // Return the result |
| 1139 | 1139 | $output = new Object(0, $success_message); |
| 1140 | - if($point > 0) |
|
| 1140 | + if ($point > 0) |
|
| 1141 | 1141 | { |
| 1142 | 1142 | $output->add('voted_count', $obj->after_point); |
| 1143 | 1143 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | function declaredComment($comment_srl) |
| 1158 | 1158 | { |
| 1159 | 1159 | // Fail if session information already has a reported document |
| 1160 | - if($_SESSION['declared_comment'][$comment_srl]) |
|
| 1160 | + if ($_SESSION['declared_comment'][$comment_srl]) |
|
| 1161 | 1161 | { |
| 1162 | 1162 | return new Object(-1, 'failed_declared'); |
| 1163 | 1163 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | $args = new stdClass(); |
| 1167 | 1167 | $args->comment_srl = $comment_srl; |
| 1168 | 1168 | $output = executeQuery('comment.getDeclaredComment', $args); |
| 1169 | - if(!$output->toBool()) |
|
| 1169 | + if (!$output->toBool()) |
|
| 1170 | 1170 | { |
| 1171 | 1171 | return $output; |
| 1172 | 1172 | } |
@@ -1178,7 +1178,7 @@ discard block |
||
| 1178 | 1178 | |
| 1179 | 1179 | // Call a trigger (before) |
| 1180 | 1180 | $trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'before', $trigger_obj); |
| 1181 | - if(!$trigger_output->toBool()) |
|
| 1181 | + if (!$trigger_output->toBool()) |
|
| 1182 | 1182 | { |
| 1183 | 1183 | return $trigger_output; |
| 1184 | 1184 | } |
@@ -1188,21 +1188,21 @@ discard block |
||
| 1188 | 1188 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
| 1189 | 1189 | |
| 1190 | 1190 | // failed if both ip addresses between author's and the current user are same. |
| 1191 | - if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1191 | + if ($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1192 | 1192 | { |
| 1193 | 1193 | $_SESSION['declared_comment'][$comment_srl] = TRUE; |
| 1194 | 1194 | return new Object(-1, 'failed_declared'); |
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | // if the comment author is a member |
| 1198 | - if($oComment->get('member_srl')) |
|
| 1198 | + if ($oComment->get('member_srl')) |
|
| 1199 | 1199 | { |
| 1200 | 1200 | // create the member model object |
| 1201 | 1201 | $oMemberModel = getModel('member'); |
| 1202 | 1202 | $member_srl = $oMemberModel->getLoggedMemberSrl(); |
| 1203 | 1203 | |
| 1204 | 1204 | // session registered if the author information matches to the current logged-in user's. |
| 1205 | - if($member_srl && $member_srl == abs($oComment->get('member_srl'))) |
|
| 1205 | + if ($member_srl && $member_srl == abs($oComment->get('member_srl'))) |
|
| 1206 | 1206 | { |
| 1207 | 1207 | $_SESSION['declared_comment'][$comment_srl] = TRUE; |
| 1208 | 1208 | return new Object(-1, 'failed_declared'); |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | // If logged-in, use the member_srl. otherwise use the ipaddress. |
| 1213 | - if($member_srl) |
|
| 1213 | + if ($member_srl) |
|
| 1214 | 1214 | { |
| 1215 | 1215 | $args->member_srl = $member_srl; |
| 1216 | 1216 | } |
@@ -1222,7 +1222,7 @@ discard block |
||
| 1222 | 1222 | $log_output = executeQuery('comment.getCommentDeclaredLogInfo', $args); |
| 1223 | 1223 | |
| 1224 | 1224 | // session registered if log info contains report log. |
| 1225 | - if($log_output->data->count) |
|
| 1225 | + if ($log_output->data->count) |
|
| 1226 | 1226 | { |
| 1227 | 1227 | $_SESSION['declared_comment'][$comment_srl] = TRUE; |
| 1228 | 1228 | return new Object(-1, 'failed_declared'); |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | $oDB->begin(); |
| 1234 | 1234 | |
| 1235 | 1235 | // execute insert |
| 1236 | - if($output->data->declared_count > 0) |
|
| 1236 | + if ($output->data->declared_count > 0) |
|
| 1237 | 1237 | { |
| 1238 | 1238 | $output = executeQuery('comment.updateDeclaredComment', $args); |
| 1239 | 1239 | } |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | $output = executeQuery('comment.insertDeclaredComment', $args); |
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | - if(!$output->toBool()) |
|
| 1245 | + if (!$output->toBool()) |
|
| 1246 | 1246 | { |
| 1247 | 1247 | $oDB->rollback(); |
| 1248 | 1248 | return $output; |
@@ -1254,7 +1254,7 @@ discard block |
||
| 1254 | 1254 | // Call a trigger (after) |
| 1255 | 1255 | $trigger_obj->declared_count = $declared_count + 1; |
| 1256 | 1256 | $trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'after', $trigger_obj); |
| 1257 | - if(!$trigger_output->toBool()) |
|
| 1257 | + if (!$trigger_output->toBool()) |
|
| 1258 | 1258 | { |
| 1259 | 1259 | $oDB->rollback(); |
| 1260 | 1260 | return $trigger_output; |
@@ -1279,7 +1279,7 @@ discard block |
||
| 1279 | 1279 | function addCommentPopupMenu($url, $str, $icon = '', $target = 'self') |
| 1280 | 1280 | { |
| 1281 | 1281 | $comment_popup_menu_list = Context::get('comment_popup_menu_list'); |
| 1282 | - if(!is_array($comment_popup_menu_list)) |
|
| 1282 | + if (!is_array($comment_popup_menu_list)) |
|
| 1283 | 1283 | { |
| 1284 | 1284 | $comment_popup_menu_list = array(); |
| 1285 | 1285 | } |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | function procCommentInsertModuleConfig() |
| 1302 | 1302 | { |
| 1303 | 1303 | $module_srl = Context::get('target_module_srl'); |
| 1304 | - if(preg_match('/^([0-9,]+)$/', $module_srl)) |
|
| 1304 | + if (preg_match('/^([0-9,]+)$/', $module_srl)) |
|
| 1305 | 1305 | { |
| 1306 | 1306 | $module_srl = explode(',', $module_srl); |
| 1307 | 1307 | } |
@@ -1312,33 +1312,33 @@ discard block |
||
| 1312 | 1312 | |
| 1313 | 1313 | $comment_config = new stdClass(); |
| 1314 | 1314 | $comment_config->comment_count = (int) Context::get('comment_count'); |
| 1315 | - if(!$comment_config->comment_count) |
|
| 1315 | + if (!$comment_config->comment_count) |
|
| 1316 | 1316 | { |
| 1317 | 1317 | $comment_config->comment_count = 50; |
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | 1320 | $comment_config->use_vote_up = Context::get('use_vote_up'); |
| 1321 | - if(!$comment_config->use_vote_up) |
|
| 1321 | + if (!$comment_config->use_vote_up) |
|
| 1322 | 1322 | { |
| 1323 | 1323 | $comment_config->use_vote_up = 'Y'; |
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | 1326 | $comment_config->use_vote_down = Context::get('use_vote_down'); |
| 1327 | - if(!$comment_config->use_vote_down) |
|
| 1327 | + if (!$comment_config->use_vote_down) |
|
| 1328 | 1328 | { |
| 1329 | 1329 | $comment_config->use_vote_down = 'Y'; |
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | $comment_config->use_comment_validation = Context::get('use_comment_validation'); |
| 1333 | - if(!$comment_config->use_comment_validation) |
|
| 1333 | + if (!$comment_config->use_comment_validation) |
|
| 1334 | 1334 | { |
| 1335 | 1335 | $comment_config->use_comment_validation = 'N'; |
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | - for($i = 0; $i < count($module_srl); $i++) |
|
| 1338 | + for ($i = 0; $i < count($module_srl); $i++) |
|
| 1339 | 1339 | { |
| 1340 | 1340 | $srl = trim($module_srl[$i]); |
| 1341 | - if(!$srl) |
|
| 1341 | + if (!$srl) |
|
| 1342 | 1342 | { |
| 1343 | 1343 | continue; |
| 1344 | 1344 | } |
@@ -1372,25 +1372,25 @@ discard block |
||
| 1372 | 1372 | */ |
| 1373 | 1373 | function procCommentGetList() |
| 1374 | 1374 | { |
| 1375 | - if(!Context::get('is_logged')) |
|
| 1375 | + if (!Context::get('is_logged')) |
|
| 1376 | 1376 | { |
| 1377 | 1377 | return new Object(-1, 'msg_not_permitted'); |
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | $commentSrls = Context::get('comment_srls'); |
| 1381 | - if($commentSrls) |
|
| 1381 | + if ($commentSrls) |
|
| 1382 | 1382 | { |
| 1383 | 1383 | $commentSrlList = explode(',', $commentSrls); |
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | - if(count($commentSrlList) > 0) |
|
| 1386 | + if (count($commentSrlList) > 0) |
|
| 1387 | 1387 | { |
| 1388 | 1388 | $oCommentModel = getModel('comment'); |
| 1389 | 1389 | $commentList = $oCommentModel->getComments($commentSrlList); |
| 1390 | 1390 | |
| 1391 | - if(is_array($commentList)) |
|
| 1391 | + if (is_array($commentList)) |
|
| 1392 | 1392 | { |
| 1393 | - foreach($commentList as $value) |
|
| 1393 | + foreach ($commentList as $value) |
|
| 1394 | 1394 | { |
| 1395 | 1395 | $value->content = strip_tags($value->content); |
| 1396 | 1396 | } |
@@ -1415,9 +1415,9 @@ discard block |
||
| 1415 | 1415 | $commentConfig = $oModuleModel->getModulePartConfig('comment', $obj->originModuleSrl); |
| 1416 | 1416 | |
| 1417 | 1417 | $oModuleController = getController('module'); |
| 1418 | - if(is_array($obj->moduleSrlList)) |
|
| 1418 | + if (is_array($obj->moduleSrlList)) |
|
| 1419 | 1419 | { |
| 1420 | - foreach($obj->moduleSrlList as $moduleSrl) |
|
| 1420 | + foreach ($obj->moduleSrlList as $moduleSrl) |
|
| 1421 | 1421 | { |
| 1422 | 1422 | $oModuleController->insertModulePartConfig('comment', $moduleSrl, $commentConfig); |
| 1423 | 1423 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | /** |
| 25 | 25 | * Add a form fot comment setting on the additional setting of module |
| 26 | 26 | * @param string $obj |
| 27 | - * @return string |
|
| 27 | + * @return Object |
|
| 28 | 28 | */ |
| 29 | 29 | function triggerDispCommentAdditionSetup(&$obj) |
| 30 | 30 | { |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | $current_module_srl = Context::get('module_srl'); |
| 32 | 32 | $current_module_srls = Context::get('module_srls'); |
| 33 | 33 | |
| 34 | - if(!$current_module_srl && !$current_module_srls) |
|
| 34 | + if (!$current_module_srl && !$current_module_srls) |
|
| 35 | 35 | { |
| 36 | 36 | // get information of the selected module |
| 37 | 37 | $current_module_info = Context::get('current_module_info'); |
| 38 | 38 | $current_module_srl = $current_module_info->module_srl; |
| 39 | - if(!$current_module_srl) |
|
| 39 | + if (!$current_module_srl) |
|
| 40 | 40 | { |
| 41 | 41 | return new Object(); |
| 42 | 42 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // Set a template file |
| 56 | 56 | $oTemplate = TemplateHandler::getInstance(); |
| 57 | - $tpl = $oTemplate->compile($this->module_path . 'tpl', 'comment_module_config'); |
|
| 57 | + $tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config'); |
|
| 58 | 58 | $obj .= $tpl; |
| 59 | 59 | |
| 60 | 60 | return new Object(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Display message box |
| 37 | - * @return void|Object (void : success, Object : fail) |
|
| 37 | + * @return ModuleObject|null (void : success, Object : fail) |
|
| 38 | 38 | */ |
| 39 | 39 | function dispCommunicationMessages() |
| 40 | 40 | { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * Display message sending |
| 133 | - * @return void|Object (void : success, Object : fail) |
|
| 133 | + * @return ModuleObject|null (void : success, Object : fail) |
|
| 134 | 134 | */ |
| 135 | 135 | function dispCommunicationSendMessage() |
| 136 | 136 | { |
@@ -96,8 +96,7 @@ |
||
| 96 | 96 | stripEmbedTagForAdmin($message->content, $message->sender_srl); |
| 97 | 97 | Context::set('message', $message); |
| 98 | 98 | } |
| 99 | - } |
|
| 100 | - else |
|
| 99 | + } else |
|
| 101 | 100 | { |
| 102 | 101 | $templateFile = 'messages'; |
| 103 | 102 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
| 3 | 3 | |
| 4 | -require_once(_XE_PATH_ . 'modules/communication/communication.view.php'); |
|
| 4 | +require_once(_XE_PATH_.'modules/communication/communication.view.php'); |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * @class communicationMobile |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $oLayoutModel = getModel('layout'); |
| 27 | 27 | $layout_info = $oLayoutModel->getLayout($this->communication_config->mlayout_srl); |
| 28 | - if($layout_info) |
|
| 28 | + if ($layout_info) |
|
| 29 | 29 | { |
| 30 | 30 | $this->module_info->mlayout_srl = $this->communication_config->mlayout_srl; |
| 31 | 31 | $this->setLayoutPath($layout_info->path); |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | function dispCommunicationMessages() |
| 40 | 40 | { |
| 41 | 41 | // Error appears if not logged-in |
| 42 | - if(!Context::get('is_logged')) |
|
| 42 | + if (!Context::get('is_logged')) |
|
| 43 | 43 | { |
| 44 | 44 | return $this->stop('msg_not_logged'); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $logged_info = Context::get('logged_info'); |
| 48 | - if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list)) |
|
| 48 | + if (!array_key_exists('dispCommunicationMessages', $logged_info->menu_list)) |
|
| 49 | 49 | { |
| 50 | 50 | return $this->stop('msg_invalid_request'); |
| 51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // Set the variables |
| 54 | 54 | $message_srl = Context::get('message_srl'); |
| 55 | 55 | $message_type = Context::get('message_type'); |
| 56 | - if(!in_array($message_type, array('R', 'S', 'T'))) |
|
| 56 | + if (!in_array($message_type, array('R', 'S', 'T'))) |
|
| 57 | 57 | { |
| 58 | 58 | $message_type = 'R'; |
| 59 | 59 | Context::set('message_type', $message_type); |
@@ -61,37 +61,37 @@ discard block |
||
| 61 | 61 | $oCommunicationModel = getModel('communication'); |
| 62 | 62 | |
| 63 | 63 | // extract contents if message_srl exists |
| 64 | - if($message_srl) |
|
| 64 | + if ($message_srl) |
|
| 65 | 65 | { |
| 66 | 66 | $templateFile = 'read_message'; |
| 67 | 67 | $columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate'); |
| 68 | 68 | $message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList); |
| 69 | 69 | |
| 70 | - switch($message->message_type) |
|
| 70 | + switch ($message->message_type) |
|
| 71 | 71 | { |
| 72 | 72 | case 'R': |
| 73 | - if($message->receiver_srl != $logged_info->member_srl) |
|
| 73 | + if ($message->receiver_srl != $logged_info->member_srl) |
|
| 74 | 74 | { |
| 75 | 75 | return $this->stop('msg_invalid_request'); |
| 76 | 76 | } |
| 77 | 77 | break; |
| 78 | 78 | |
| 79 | 79 | case 'S': |
| 80 | - if($message->sender_srl != $logged_info->member_srl) |
|
| 80 | + if ($message->sender_srl != $logged_info->member_srl) |
|
| 81 | 81 | { |
| 82 | 82 | return $this->stop('msg_invalid_request'); |
| 83 | 83 | } |
| 84 | 84 | break; |
| 85 | 85 | |
| 86 | 86 | case 'T': |
| 87 | - if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl) |
|
| 87 | + if ($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl) |
|
| 88 | 88 | { |
| 89 | 89 | return $this->stop('msg_invalid_request'); |
| 90 | 90 | } |
| 91 | 91 | break; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl)) |
|
| 94 | + if ($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl)) |
|
| 95 | 95 | { |
| 96 | 96 | stripEmbedTagForAdmin($message->content, $message->sender_srl); |
| 97 | 97 | Context::set('message', $message); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $oMemberModel = getModel('member'); |
| 139 | 139 | |
| 140 | 140 | // Error appears if not logged-in |
| 141 | - if(!Context::get('is_logged')) |
|
| 141 | + if (!Context::get('is_logged')) |
|
| 142 | 142 | { |
| 143 | 143 | return $this->stop('msg_not_logged'); |
| 144 | 144 | } |
@@ -148,32 +148,32 @@ discard block |
||
| 148 | 148 | // get receipient's information |
| 149 | 149 | // check inalid request |
| 150 | 150 | $receiver_srl = Context::get('receiver_srl'); |
| 151 | - if(!$receiver_srl) |
|
| 151 | + if (!$receiver_srl) |
|
| 152 | 152 | { |
| 153 | 153 | return $this->stop('msg_invalid_request'); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // check receiver and sender are same |
| 157 | - if($logged_info->member_srl == $receiver_srl) |
|
| 157 | + if ($logged_info->member_srl == $receiver_srl) |
|
| 158 | 158 | { |
| 159 | 159 | return $this->stop('msg_cannot_send_to_yourself'); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // get message_srl of the original message if it is a reply |
| 163 | 163 | $message_srl = Context::get('message_srl'); |
| 164 | - if($message_srl) |
|
| 164 | + if ($message_srl) |
|
| 165 | 165 | { |
| 166 | 166 | $source_message = $oCommunicationModel->getSelectedMessage($message_srl); |
| 167 | - if($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl) |
|
| 167 | + if ($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl) |
|
| 168 | 168 | { |
| 169 | - $source_message->title = "[re] " . $source_message->title; |
|
| 170 | - $source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">" . trim($source_message->content) . "</div>"; |
|
| 169 | + $source_message->title = "[re] ".$source_message->title; |
|
| 170 | + $source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">".trim($source_message->content)."</div>"; |
|
| 171 | 171 | Context::set('source_message', $source_message); |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl); |
| 176 | - if(!$receiver_info) |
|
| 176 | + if (!$receiver_info) |
|
| 177 | 177 | { |
| 178 | 178 | return $this->stop('msg_invalid_request'); |
| 179 | 179 | } |
@@ -101,7 +101,6 @@ |
||
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * @brief check member's grant |
| 104 | - * @param object $member_info |
|
| 105 | 104 | * @param array $arrGrant |
| 106 | 105 | * @return boolean |
| 107 | 106 | */ |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * @brief get grant array for insert to database. table module_config's config field |
|
| 65 | - * @param string $default |
|
| 66 | - * @param array $group |
|
| 67 | - * @return array |
|
| 68 | - */ |
|
| 64 | + * @brief get grant array for insert to database. table module_config's config field |
|
| 65 | + * @param string $default |
|
| 66 | + * @param array $group |
|
| 67 | + * @return array |
|
| 68 | + */ |
|
| 69 | 69 | function getGrantArray($default, $group) |
| 70 | 70 | { |
| 71 | 71 | $grant = array(); |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | - * @brief check member's grant |
|
| 104 | - * @param object $member_info |
|
| 105 | - * @param array $arrGrant |
|
| 106 | - * @return boolean |
|
| 107 | - */ |
|
| 103 | + * @brief check member's grant |
|
| 104 | + * @param object $member_info |
|
| 105 | + * @param array $arrGrant |
|
| 106 | + * @return boolean |
|
| 107 | + */ |
|
| 108 | 108 | function checkGrant($arrGrant) |
| 109 | 109 | { |
| 110 | 110 | if(!$arrGrant) |
@@ -27,32 +27,32 @@ discard block |
||
| 27 | 27 | $oModuleModel = getModel('module'); |
| 28 | 28 | $communication_config = $oModuleModel->getModuleConfig('communication'); |
| 29 | 29 | |
| 30 | - if(!is_object($communication_config)) |
|
| 30 | + if (!is_object($communication_config)) |
|
| 31 | 31 | { |
| 32 | 32 | $communication_config = new stdClass(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(!$communication_config->skin) |
|
| 35 | + if (!$communication_config->skin) |
|
| 36 | 36 | { |
| 37 | 37 | $communication_config->skin = 'default'; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if(!$communication_config->colorset) |
|
| 40 | + if (!$communication_config->colorset) |
|
| 41 | 41 | { |
| 42 | 42 | $communication_config->colorset = 'white'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if(!$communication_config->editor_skin) |
|
| 45 | + if (!$communication_config->editor_skin) |
|
| 46 | 46 | { |
| 47 | 47 | $communication_config->editor_skin = 'ckeditor'; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if(!$communication_config->mskin) |
|
| 50 | + if (!$communication_config->mskin) |
|
| 51 | 51 | { |
| 52 | 52 | $communication_config->mskin = 'default'; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if(!$communication_config->grant_write) |
|
| 55 | + if (!$communication_config->grant_write) |
|
| 56 | 56 | { |
| 57 | 57 | $communication_config->grant_write = array('default_grant'=>'member'); |
| 58 | 58 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | function getGrantArray($default, $group) |
| 70 | 70 | { |
| 71 | 71 | $grant = array(); |
| 72 | - if($default!="") |
|
| 72 | + if ($default != "") |
|
| 73 | 73 | { |
| 74 | - switch($default) |
|
| 74 | + switch ($default) |
|
| 75 | 75 | { |
| 76 | 76 | case "-2": |
| 77 | 77 | $grant = array("default_grant"=>"site"); |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | break; |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | - else if(is_array($group)) |
|
| 87 | + else if (is_array($group)) |
|
| 88 | 88 | { |
| 89 | 89 | $oMemberModel = getModel('member'); |
| 90 | 90 | $group_list = $oMemberModel->getGroups($this->site_srl); |
| 91 | 91 | |
| 92 | 92 | $group_grant = array(); |
| 93 | - foreach($group as $group_srl) |
|
| 93 | + foreach ($group as $group_srl) |
|
| 94 | 94 | { |
| 95 | 95 | $group_grant[$group_srl] = $group_list[$group_srl]->title; |
| 96 | 96 | } |
@@ -107,37 +107,37 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | function checkGrant($arrGrant) |
| 109 | 109 | { |
| 110 | - if(!$arrGrant) |
|
| 110 | + if (!$arrGrant) |
|
| 111 | 111 | return false; |
| 112 | 112 | |
| 113 | 113 | $logged_info = Context::get('logged_info'); |
| 114 | - if(!$logged_info) |
|
| 114 | + if (!$logged_info) |
|
| 115 | 115 | return false; |
| 116 | 116 | |
| 117 | - if($logged_info->is_admin == "Y") |
|
| 117 | + if ($logged_info->is_admin == "Y") |
|
| 118 | 118 | return true; |
| 119 | 119 | |
| 120 | - if($arrGrant['default_grant']) |
|
| 120 | + if ($arrGrant['default_grant']) |
|
| 121 | 121 | { |
| 122 | - if($arrGrant['default_grant'] == "member" && $logged_info) |
|
| 122 | + if ($arrGrant['default_grant'] == "member" && $logged_info) |
|
| 123 | 123 | return true; |
| 124 | 124 | |
| 125 | - if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
| 125 | + if ($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
| 126 | 126 | return true; |
| 127 | 127 | |
| 128 | - if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
| 128 | + if ($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
| 129 | 129 | return true; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if($arrGrant['group_grant']) |
|
| 132 | + if ($arrGrant['group_grant']) |
|
| 133 | 133 | { |
| 134 | 134 | $group_grant = $arrGrant['group_grant']; |
| 135 | - if(!is_array($group_grant)) |
|
| 135 | + if (!is_array($group_grant)) |
|
| 136 | 136 | return false; |
| 137 | 137 | |
| 138 | - foreach($logged_info->group_list as $group_srl=>$title) |
|
| 138 | + foreach ($logged_info->group_list as $group_srl=>$title) |
|
| 139 | 139 | { |
| 140 | - if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) |
|
| 140 | + if (isset($group_grant[$group_srl]) && $group_grant[$group_srl] == $title) |
|
| 141 | 141 | return true; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $output = executeQuery('communication.getMessage', $args, $columnList); |
| 163 | 163 | |
| 164 | 164 | $message = $output->data; |
| 165 | - if(!$message) |
|
| 165 | + if (!$message) |
|
| 166 | 166 | { |
| 167 | 167 | return; |
| 168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | // get recipient's information if it is a sent message |
| 171 | 171 | $oMemberModel = getModel('member'); |
| 172 | 172 | |
| 173 | - if($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') |
|
| 173 | + if ($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') |
|
| 174 | 174 | { |
| 175 | 175 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->receiver_srl); |
| 176 | 176 | } |
@@ -180,22 +180,22 @@ discard block |
||
| 180 | 180 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->sender_srl); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if($member_info) |
|
| 183 | + if ($member_info) |
|
| 184 | 184 | { |
| 185 | - foreach($member_info as $key => $val) |
|
| 185 | + foreach ($member_info as $key => $val) |
|
| 186 | 186 | { |
| 187 | - if($key === 'title') continue; |
|
| 188 | - if($key === 'content') continue; |
|
| 189 | - if($key === 'sender_srl') continue; |
|
| 190 | - if($key === 'password') continue; |
|
| 191 | - if($key === 'regdate') continue; |
|
| 187 | + if ($key === 'title') continue; |
|
| 188 | + if ($key === 'content') continue; |
|
| 189 | + if ($key === 'sender_srl') continue; |
|
| 190 | + if ($key === 'password') continue; |
|
| 191 | + if ($key === 'regdate') continue; |
|
| 192 | 192 | |
| 193 | 193 | $message->{$key} = $val; |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // change the status if is a received and not yet read message |
| 198 | - if($message->message_type == 'R' && $message->readed != 'Y') |
|
| 198 | + if ($message->message_type == 'R' && $message->readed != 'Y') |
|
| 199 | 199 | { |
| 200 | 200 | $oCommunicationController = getController('communication'); |
| 201 | 201 | $oCommunicationController->setMessageReaded($message_srl); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $args->readed = 'N'; |
| 219 | 219 | |
| 220 | 220 | $output = executeQuery('communication.getNewMessage', $args, $columnList); |
| 221 | - if(!count($output->data)) |
|
| 221 | + if (!count($output->data)) |
|
| 222 | 222 | { |
| 223 | 223 | return; |
| 224 | 224 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $logged_info = Context::get('logged_info'); |
| 243 | 243 | $args = new stdClass(); |
| 244 | 244 | |
| 245 | - switch($message_type) |
|
| 245 | + switch ($message_type) |
|
| 246 | 246 | { |
| 247 | 247 | case 'R' : |
| 248 | 248 | $args->member_srl = $logged_info->member_srl; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $output = executeQueryArray('communication.getFriendGroups', $args); |
| 348 | 348 | |
| 349 | 349 | $group_list = $output->data; |
| 350 | - if(!$group_list) |
|
| 350 | + if (!$group_list) |
|
| 351 | 351 | { |
| 352 | 352 | return; |
| 353 | 353 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | $output = executeQuery('communication.isAddedFriend', $args); |
| 372 | 372 | |
| 373 | - if($output->data->count) |
|
| 373 | + if ($output->data->count) |
|
| 374 | 374 | { |
| 375 | 375 | return TRUE; |
| 376 | 376 | } |
@@ -83,8 +83,7 @@ discard block |
||
| 83 | 83 | $grant = array("default_grant"=>"member"); |
| 84 | 84 | break; |
| 85 | 85 | } |
| 86 | - } |
|
| 87 | - else if(is_array($group)) |
|
| 86 | + } else if(is_array($group)) |
|
| 88 | 87 | { |
| 89 | 88 | $oMemberModel = getModel('member'); |
| 90 | 89 | $group_list = $oMemberModel->getGroups($this->site_srl); |
@@ -107,38 +106,46 @@ discard block |
||
| 107 | 106 | */ |
| 108 | 107 | function checkGrant($arrGrant) |
| 109 | 108 | { |
| 110 | - if(!$arrGrant) |
|
| 111 | - return false; |
|
| 109 | + if(!$arrGrant) { |
|
| 110 | + return false; |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | 113 | $logged_info = Context::get('logged_info'); |
| 114 | - if(!$logged_info) |
|
| 115 | - return false; |
|
| 114 | + if(!$logged_info) { |
|
| 115 | + return false; |
|
| 116 | + } |
|
| 116 | 117 | |
| 117 | - if($logged_info->is_admin == "Y") |
|
| 118 | - return true; |
|
| 118 | + if($logged_info->is_admin == "Y") { |
|
| 119 | + return true; |
|
| 120 | + } |
|
| 119 | 121 | |
| 120 | 122 | if($arrGrant['default_grant']) |
| 121 | 123 | { |
| 122 | - if($arrGrant['default_grant'] == "member" && $logged_info) |
|
| 123 | - return true; |
|
| 124 | + if($arrGrant['default_grant'] == "member" && $logged_info) { |
|
| 125 | + return true; |
|
| 126 | + } |
|
| 124 | 127 | |
| 125 | - if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
| 126 | - return true; |
|
| 128 | + if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) { |
|
| 129 | + return true; |
|
| 130 | + } |
|
| 127 | 131 | |
| 128 | - if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
| 129 | - return true; |
|
| 132 | + if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") { |
|
| 133 | + return true; |
|
| 134 | + } |
|
| 130 | 135 | } |
| 131 | 136 | |
| 132 | 137 | if($arrGrant['group_grant']) |
| 133 | 138 | { |
| 134 | 139 | $group_grant = $arrGrant['group_grant']; |
| 135 | - if(!is_array($group_grant)) |
|
| 136 | - return false; |
|
| 140 | + if(!is_array($group_grant)) { |
|
| 141 | + return false; |
|
| 142 | + } |
|
| 137 | 143 | |
| 138 | 144 | foreach($logged_info->group_list as $group_srl=>$title) |
| 139 | 145 | { |
| 140 | - if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) |
|
| 141 | - return true; |
|
| 146 | + if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) { |
|
| 147 | + return true; |
|
| 148 | + } |
|
| 142 | 149 | } |
| 143 | 150 | |
| 144 | 151 | } |
@@ -184,11 +191,21 @@ discard block |
||
| 184 | 191 | { |
| 185 | 192 | foreach($member_info as $key => $val) |
| 186 | 193 | { |
| 187 | - if($key === 'title') continue; |
|
| 188 | - if($key === 'content') continue; |
|
| 189 | - if($key === 'sender_srl') continue; |
|
| 190 | - if($key === 'password') continue; |
|
| 191 | - if($key === 'regdate') continue; |
|
| 194 | + if($key === 'title') { |
|
| 195 | + continue; |
|
| 196 | + } |
|
| 197 | + if($key === 'content') { |
|
| 198 | + continue; |
|
| 199 | + } |
|
| 200 | + if($key === 'sender_srl') { |
|
| 201 | + continue; |
|
| 202 | + } |
|
| 203 | + if($key === 'password') { |
|
| 204 | + continue; |
|
| 205 | + } |
|
| 206 | + if($key === 'regdate') { |
|
| 207 | + continue; |
|
| 208 | + } |
|
| 192 | 209 | |
| 193 | 210 | $message->{$key} = $val; |
| 194 | 211 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Display message box |
| 49 | - * @return void|Object (void : success, Object : fail) |
|
| 49 | + * @return ModuleObject|null (void : success, Object : fail) |
|
| 50 | 50 | */ |
| 51 | 51 | function dispCommunicationMessages() |
| 52 | 52 | { |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * display a new message |
| 134 | - * @return void|Object (void : success, Object : fail) |
|
| 134 | + * @return ModuleObject|null (void : success, Object : fail) |
|
| 135 | 135 | */ |
| 136 | 136 | function dispCommunicationNewMessage() |
| 137 | 137 | { |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * Display message sending |
| 170 | - * @return void|Object (void : success, Object : fail) |
|
| 170 | + * @return ModuleObject|null (void : success, Object : fail) |
|
| 171 | 171 | */ |
| 172 | 172 | function dispCommunicationSendMessage() |
| 173 | 173 | { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * display a list of friends |
| 245 | - * @return void|Object (void : success, Object : fail) |
|
| 245 | + * @return ModuleObject|null (void : success, Object : fail) |
|
| 246 | 246 | */ |
| 247 | 247 | function dispCommunicationFriend() |
| 248 | 248 | { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | /** |
| 300 | 300 | * display Add a friend |
| 301 | - * @return void|Object (void : success, Object : fail) |
|
| 301 | + * @return ModuleObject|null (void : success, Object : fail) |
|
| 302 | 302 | */ |
| 303 | 303 | function dispCommunicationAddFriend() |
| 304 | 304 | { |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | /** |
| 342 | 342 | * display add a group of friends |
| 343 | - * @return void|Object (void : success, Object : fail) |
|
| 343 | + * @return ModuleObject|null (void : success, Object : fail) |
|
| 344 | 344 | */ |
| 345 | 345 | function dispCommunicationAddFriendGroup() |
| 346 | 346 | { |
@@ -27,8 +27,7 @@ |
||
| 27 | 27 | if(count($config_parse) > 1) |
| 28 | 28 | { |
| 29 | 29 | $tpl_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]); |
| 30 | - } |
|
| 31 | - else |
|
| 30 | + } else |
|
| 32 | 31 | { |
| 33 | 32 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $skin); |
| 34 | 33 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | $config_parse = explode('|@|', $skin); |
| 26 | 26 | |
| 27 | - if(count($config_parse) > 1) |
|
| 27 | + if (count($config_parse) > 1) |
|
| 28 | 28 | { |
| 29 | 29 | $tpl_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]); |
| 30 | 30 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $oLayoutModel = getModel('layout'); |
| 39 | 39 | $layout_info = $oLayoutModel->getLayout($this->communication_config->layout_srl); |
| 40 | - if($layout_info) |
|
| 40 | + if ($layout_info) |
|
| 41 | 41 | { |
| 42 | 42 | $this->module_info->layout_srl = $this->communication_config->layout_srl; |
| 43 | 43 | $this->setLayoutPath($layout_info->path); |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | function dispCommunicationMessages() |
| 52 | 52 | { |
| 53 | 53 | // Error appears if not logged-in |
| 54 | - if(!Context::get('is_logged')) |
|
| 54 | + if (!Context::get('is_logged')) |
|
| 55 | 55 | { |
| 56 | 56 | return $this->stop('msg_not_logged'); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $logged_info = Context::get('logged_info'); |
| 60 | 60 | |
| 61 | - if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list)) |
|
| 61 | + if (!array_key_exists('dispCommunicationMessages', $logged_info->menu_list)) |
|
| 62 | 62 | { |
| 63 | 63 | return $this->stop('msg_invalid_request'); |
| 64 | 64 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $message_srl = Context::get('message_srl'); |
| 68 | 68 | $message_type = Context::get('message_type'); |
| 69 | 69 | |
| 70 | - if(!in_array($message_type, array('R', 'S', 'T'))) |
|
| 70 | + if (!in_array($message_type, array('R', 'S', 'T'))) |
|
| 71 | 71 | { |
| 72 | 72 | $message_type = 'R'; |
| 73 | 73 | Context::set('message_type', $message_type); |
@@ -76,36 +76,36 @@ discard block |
||
| 76 | 76 | $oCommunicationModel = getModel('communication'); |
| 77 | 77 | |
| 78 | 78 | // extract contents if message_srl exists |
| 79 | - if($message_srl) |
|
| 79 | + if ($message_srl) |
|
| 80 | 80 | { |
| 81 | 81 | $columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate'); |
| 82 | 82 | $message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList); |
| 83 | 83 | |
| 84 | - switch($message->message_type) |
|
| 84 | + switch ($message->message_type) |
|
| 85 | 85 | { |
| 86 | 86 | case 'R': |
| 87 | - if($message->receiver_srl != $logged_info->member_srl) |
|
| 87 | + if ($message->receiver_srl != $logged_info->member_srl) |
|
| 88 | 88 | { |
| 89 | 89 | return $this->stop('msg_invalid_request'); |
| 90 | 90 | } |
| 91 | 91 | break; |
| 92 | 92 | |
| 93 | 93 | case 'S': |
| 94 | - if($message->sender_srl != $logged_info->member_srl) |
|
| 94 | + if ($message->sender_srl != $logged_info->member_srl) |
|
| 95 | 95 | { |
| 96 | 96 | return $this->stop('msg_invalid_request'); |
| 97 | 97 | } |
| 98 | 98 | break; |
| 99 | 99 | |
| 100 | 100 | case 'T': |
| 101 | - if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl) |
|
| 101 | + if ($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl) |
|
| 102 | 102 | { |
| 103 | 103 | return $this->stop('msg_invalid_request'); |
| 104 | 104 | } |
| 105 | 105 | break; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl)) |
|
| 108 | + if ($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl)) |
|
| 109 | 109 | { |
| 110 | 110 | stripEmbedTagForAdmin($message->content, $message->sender_srl); |
| 111 | 111 | Context::set('message', $message); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->setLayoutFile('popup_layout'); |
| 140 | 140 | |
| 141 | 141 | // Error appears if not logged-in |
| 142 | - if(!Context::get('is_logged')) |
|
| 142 | + if (!Context::get('is_logged')) |
|
| 143 | 143 | { |
| 144 | 144 | return $this->stop('msg_not_logged'); |
| 145 | 145 | } |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | // get a new message |
| 152 | 152 | $columnList = array('message_srl', 'member_srl', 'nick_name', 'title', 'content', 'sender_srl'); |
| 153 | 153 | $message = $oCommunicationModel->getNewMessage($columnList); |
| 154 | - if($message) |
|
| 154 | + if ($message) |
|
| 155 | 155 | { |
| 156 | 156 | stripEmbedTagForAdmin($message->content, $message->sender_srl); |
| 157 | 157 | Context::set('message', $message); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Delete a flag |
| 161 | - $flag_path = './files/communication_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl); |
|
| 161 | + $flag_path = './files/communication_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl); |
|
| 162 | 162 | $flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl); |
| 163 | 163 | FileHandler::removeFile($flag_file); |
| 164 | 164 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $oMemberModel = getModel('member'); |
| 179 | 179 | |
| 180 | 180 | // Error appears if not logged-in |
| 181 | - if(!Context::get('is_logged')) |
|
| 181 | + if (!Context::get('is_logged')) |
|
| 182 | 182 | { |
| 183 | 183 | return $this->stop('msg_not_logged'); |
| 184 | 184 | } |
@@ -188,32 +188,32 @@ discard block |
||
| 188 | 188 | // get receipient's information |
| 189 | 189 | // check inalid request |
| 190 | 190 | $receiver_srl = Context::get('receiver_srl'); |
| 191 | - if(!$receiver_srl) |
|
| 191 | + if (!$receiver_srl) |
|
| 192 | 192 | { |
| 193 | 193 | return $this->stop('msg_invalid_request'); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // check receiver and sender are same |
| 197 | - if($logged_info->member_srl == $receiver_srl) |
|
| 197 | + if ($logged_info->member_srl == $receiver_srl) |
|
| 198 | 198 | { |
| 199 | 199 | return $this->stop('msg_cannot_send_to_yourself'); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | // get message_srl of the original message if it is a reply |
| 203 | 203 | $message_srl = Context::get('message_srl'); |
| 204 | - if($message_srl) |
|
| 204 | + if ($message_srl) |
|
| 205 | 205 | { |
| 206 | 206 | $source_message = $oCommunicationModel->getSelectedMessage($message_srl); |
| 207 | - if($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl) |
|
| 207 | + if ($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl) |
|
| 208 | 208 | { |
| 209 | - $source_message->title = "[re] " . $source_message->title; |
|
| 210 | - $source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">" . trim($source_message->content) . "</div>"; |
|
| 209 | + $source_message->title = "[re] ".$source_message->title; |
|
| 210 | + $source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">".trim($source_message->content)."</div>"; |
|
| 211 | 211 | Context::set('source_message', $source_message); |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl); |
| 216 | - if(!$receiver_info) |
|
| 216 | + if (!$receiver_info) |
|
| 217 | 217 | { |
| 218 | 218 | return $this->stop('msg_invalid_request'); |
| 219 | 219 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | function dispCommunicationFriend() |
| 248 | 248 | { |
| 249 | 249 | // Error appears if not logged-in |
| 250 | - if(!Context::get('is_logged')) |
|
| 250 | + if (!Context::get('is_logged')) |
|
| 251 | 251 | { |
| 252 | 252 | return $this->stop('msg_not_logged'); |
| 253 | 253 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $tmp_group_list = $oCommunicationModel->getFriendGroups(); |
| 259 | 259 | $group_count = count($tmp_group_list); |
| 260 | 260 | |
| 261 | - for($i = 0; $i < $group_count; $i++) |
|
| 261 | + for ($i = 0; $i < $group_count; $i++) |
|
| 262 | 262 | { |
| 263 | 263 | $friend_group_list[$tmp_group_list[$i]->friend_group_srl] = $tmp_group_list[$i]; |
| 264 | 264 | } |
@@ -272,13 +272,13 @@ discard block |
||
| 272 | 272 | $output = $oCommunicationModel->getFriends($friend_group_srl, $columnList); |
| 273 | 273 | $friend_count = count($output->data); |
| 274 | 274 | |
| 275 | - if($friend_count) |
|
| 275 | + if ($friend_count) |
|
| 276 | 276 | { |
| 277 | - foreach($output->data as $key => $val) |
|
| 277 | + foreach ($output->data as $key => $val) |
|
| 278 | 278 | { |
| 279 | 279 | $group_srl = $val->friend_group_srl; |
| 280 | 280 | $group_title = $friend_group_list[$group_srl]->title; |
| 281 | - if(!$group_title) |
|
| 281 | + if (!$group_title) |
|
| 282 | 282 | { |
| 283 | 283 | $group_title = Context::get('default_friend_group'); |
| 284 | 284 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $this->setLayoutFile("popup_layout"); |
| 307 | 307 | |
| 308 | 308 | // error appears if not logged-in |
| 309 | - if(!Context::get('is_logged')) |
|
| 309 | + if (!Context::get('is_logged')) |
|
| 310 | 310 | { |
| 311 | 311 | return $this->stop('msg_not_logged'); |
| 312 | 312 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $logged_info = Context::get('logged_info'); |
| 315 | 315 | $target_srl = Context::get('target_srl'); |
| 316 | 316 | |
| 317 | - if(!$target_srl) |
|
| 317 | + if (!$target_srl) |
|
| 318 | 318 | { |
| 319 | 319 | return $this->stop('msg_invalid_request'); |
| 320 | 320 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $oCommunicationModel = getModel('communication'); |
| 325 | 325 | $communication_info = $oMemberModel->getMemberInfoByMemberSrl($target_srl); |
| 326 | 326 | |
| 327 | - if($communication_info->member_srl != $target_srl) |
|
| 327 | + if ($communication_info->member_srl != $target_srl) |
|
| 328 | 328 | { |
| 329 | 329 | return $this->stop('msg_invalid_request'); |
| 330 | 330 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $this->setLayoutFile("popup_layout"); |
| 349 | 349 | |
| 350 | 350 | // error apprears if not logged-in |
| 351 | - if(!Context::get('is_logged')) |
|
| 351 | + if (!Context::get('is_logged')) |
|
| 352 | 352 | { |
| 353 | 353 | return $this->stop('msg_not_logged'); |
| 354 | 354 | } |
@@ -357,11 +357,11 @@ discard block |
||
| 357 | 357 | |
| 358 | 358 | // change to edit mode when getting the group_srl |
| 359 | 359 | $friend_group_srl = Context::get('friend_group_srl'); |
| 360 | - if($friend_group_srl) |
|
| 360 | + if ($friend_group_srl) |
|
| 361 | 361 | { |
| 362 | 362 | $oCommunicationModel = getModel('communication'); |
| 363 | 363 | $friend_group = $oCommunicationModel->getFriendGroupInfo($friend_group_srl); |
| 364 | - if($friend_group->friend_group_srl == $friend_group_srl) |
|
| 364 | + if ($friend_group->friend_group_srl == $friend_group_srl) |
|
| 365 | 365 | { |
| 366 | 366 | Context::set('friend_group', $friend_group); |
| 367 | 367 | } |