@@ -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 | { |
@@ -21,8 +21,7 @@ |
||
21 | 21 | if($absolute_url) |
22 | 22 | { |
23 | 23 | return getFullUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
24 | - } |
|
25 | - else |
|
24 | + } else |
|
26 | 25 | { |
27 | 26 | return getUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
28 | 27 | } |
@@ -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 | { |
@@ -21,8 +21,7 @@ |
||
21 | 21 | if($absolute_url) |
22 | 22 | { |
23 | 23 | return getFullUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
24 | - } |
|
25 | - else |
|
24 | + } else |
|
26 | 25 | { |
27 | 26 | return getUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
28 | 27 | } |
@@ -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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Remove the selected docs from admin page |
24 | - * @return void |
|
24 | + * @return ModuleObject|null |
|
25 | 25 | */ |
26 | 26 | function procDocumentAdminDeleteChecked() |
27 | 27 | { |
@@ -519,6 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | /** |
521 | 521 | * Delete thumbnails with subdirectory |
522 | + * @param string $path |
|
522 | 523 | * @return void |
523 | 524 | */ |
524 | 525 | function deleteThumbnailFile($path) |
@@ -861,7 +862,7 @@ discard block |
||
861 | 862 | /** |
862 | 863 | * Restore document from trash module, called by trash module |
863 | 864 | * This method is passived |
864 | - * @param object|array $originObject |
|
865 | + * @param string $originObject |
|
865 | 866 | * @return object |
866 | 867 | */ |
867 | 868 | function restoreTrash($originObject) |
@@ -721,10 +721,10 @@ |
||
721 | 721 | } |
722 | 722 | |
723 | 723 | /** |
724 | - * @fn procDocumentAdminMoveToTrash |
|
725 | - * @brief move a document to trash. |
|
726 | - * @see documentModel::getDocumentMenu |
|
727 | - */ |
|
724 | + * @fn procDocumentAdminMoveToTrash |
|
725 | + * @brief move a document to trash. |
|
726 | + * @see documentModel::getDocumentMenu |
|
727 | + */ |
|
728 | 728 | function procDocumentAdminMoveToTrash() |
729 | 729 | { |
730 | 730 | $document_srl = Context::get('document_srl'); |
@@ -27,16 +27,22 @@ discard block |
||
27 | 27 | { |
28 | 28 | // error appears if no doc is selected |
29 | 29 | $cart = Context::get('cart'); |
30 | - if(!$cart) return $this->stop('msg_cart_is_null'); |
|
30 | + if(!$cart) { |
|
31 | + return $this->stop('msg_cart_is_null'); |
|
32 | + } |
|
31 | 33 | $document_srl_list= explode('|@|', $cart); |
32 | 34 | $document_count = count($document_srl_list); |
33 | - if(!$document_count) return $this->stop('msg_cart_is_null'); |
|
35 | + if(!$document_count) { |
|
36 | + return $this->stop('msg_cart_is_null'); |
|
37 | + } |
|
34 | 38 | // Delete a doc |
35 | 39 | $oDocumentController = getController('document'); |
36 | 40 | for($i=0;$i<$document_count;$i++) |
37 | 41 | { |
38 | 42 | $document_srl = trim($document_srl_list[$i]); |
39 | - if(!$document_srl) continue; |
|
43 | + if(!$document_srl) { |
|
44 | + continue; |
|
45 | + } |
|
40 | 46 | |
41 | 47 | $oDocumentController->deleteDocument($document_srl, true); |
42 | 48 | } |
@@ -53,7 +59,9 @@ discard block |
||
53 | 59 | */ |
54 | 60 | function moveDocumentModule($document_srl_list, $module_srl, $category_srl) |
55 | 61 | { |
56 | - if(!count($document_srl_list)) return; |
|
62 | + if(!count($document_srl_list)) { |
|
63 | + return; |
|
64 | + } |
|
57 | 65 | |
58 | 66 | $oDocumentModel = getModel('document'); |
59 | 67 | $oDocumentController = getController('document'); |
@@ -77,7 +85,9 @@ discard block |
||
77 | 85 | { |
78 | 86 | $document_srl = $document_srl_list[$i]; |
79 | 87 | $oDocument = $oDocumentModel->getDocument($document_srl); |
80 | - if(!$oDocument->isExists()) continue; |
|
88 | + if(!$oDocument->isExists()) { |
|
89 | + continue; |
|
90 | + } |
|
81 | 91 | |
82 | 92 | $source_category_srl = $oDocument->get('category_srl'); |
83 | 93 | |
@@ -113,8 +123,7 @@ discard block |
||
113 | 123 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
114 | 124 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
115 | 125 | // For binary files |
116 | - } |
|
117 | - else |
|
126 | + } else |
|
118 | 127 | { |
119 | 128 | $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); |
120 | 129 | $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); |
@@ -151,8 +160,12 @@ discard block |
||
151 | 160 | // Set 0 if a new category doesn't exist after catergory change |
152 | 161 | if($source_category_srl != $category_srl) |
153 | 162 | { |
154 | - if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
155 | - if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
163 | + if($source_category_srl) { |
|
164 | + $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
165 | + } |
|
166 | + if($category_srl) { |
|
167 | + $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
168 | + } |
|
156 | 169 | } |
157 | 170 | } |
158 | 171 | |
@@ -223,7 +236,9 @@ discard block |
||
223 | 236 | */ |
224 | 237 | function copyDocumentModule($document_srl_list, $module_srl, $category_srl) |
225 | 238 | { |
226 | - if(count($document_srl_list) < 1) return; |
|
239 | + if(count($document_srl_list) < 1) { |
|
240 | + return; |
|
241 | + } |
|
227 | 242 | |
228 | 243 | $oDocumentModel = getModel('document'); |
229 | 244 | $oDocumentController = getController('document'); |
@@ -264,7 +279,9 @@ discard block |
||
264 | 279 | { |
265 | 280 | $document_srl = $document_srl_list[$i]; |
266 | 281 | $oDocument = $oDocumentModel->getDocument($document_srl); |
267 | - if(!$oDocument->isExists()) continue; |
|
282 | + if(!$oDocument->isExists()) { |
|
283 | + continue; |
|
284 | + } |
|
268 | 285 | |
269 | 286 | $obj = $oDocument->getObjectVars(); |
270 | 287 | |
@@ -275,7 +292,9 @@ discard block |
||
275 | 292 | { |
276 | 293 | foreach($extraVars as $extraItem) |
277 | 294 | { |
278 | - if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
295 | + if($extraItem->var_idx >= 0) { |
|
296 | + $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
297 | + } |
|
279 | 298 | } |
280 | 299 | } |
281 | 300 | } |
@@ -304,8 +323,7 @@ discard block |
||
304 | 323 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
305 | 324 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
306 | 325 | // If binary file |
307 | - } |
|
308 | - else |
|
326 | + } else |
|
309 | 327 | { |
310 | 328 | $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); |
311 | 329 | $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); |
@@ -372,8 +390,7 @@ discard block |
||
372 | 390 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
373 | 391 | $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content); |
374 | 392 | // If binary file |
375 | - } |
|
376 | - else |
|
393 | + } else |
|
377 | 394 | { |
378 | 395 | $comment_obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $comment_obj->content); |
379 | 396 | $comment_obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $comment_obj->content); |
@@ -385,10 +402,14 @@ discard block |
||
385 | 402 | $comment_obj->document_srl = $obj->document_srl; |
386 | 403 | $comment_obj->comment_srl = $comment_srl; |
387 | 404 | |
388 | - if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
405 | + if($comment_obj->parent_srl) { |
|
406 | + $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
407 | + } |
|
389 | 408 | |
390 | 409 | $output = $oCommentController->insertComment($comment_obj, true); |
391 | - if($output->toBool()) $success_count ++; |
|
410 | + if($output->toBool()) { |
|
411 | + $success_count ++; |
|
412 | + } |
|
392 | 413 | } |
393 | 414 | $oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true); |
394 | 415 | } |
@@ -408,7 +429,9 @@ discard block |
||
408 | 429 | $trackback_obj->module_srl = $obj->module_srl; |
409 | 430 | $trackback_obj->document_srl = $obj->document_srl; |
410 | 431 | $output = executeQuery('trackback.insertTrackback', $trackback_obj); |
411 | - if($output->toBool()) $success_count++; |
|
432 | + if($output->toBool()) { |
|
433 | + $success_count++; |
|
434 | + } |
|
412 | 435 | } |
413 | 436 | // Update the number of trackbacks |
414 | 437 | $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); |
@@ -499,7 +522,9 @@ discard block |
||
499 | 522 | { |
500 | 523 | $args->document_srl = $document_srl; |
501 | 524 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
502 | - if(!$output->toBool()) return $output; |
|
525 | + if(!$output->toBool()) { |
|
526 | + return $output; |
|
527 | + } |
|
503 | 528 | } |
504 | 529 | } |
505 | 530 | |
@@ -529,7 +554,9 @@ discard block |
||
529 | 554 | if (is_dir($path."/".$entry)) { |
530 | 555 | $this->deleteThumbnailFile($path."/".$entry); |
531 | 556 | } else { |
532 | - if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; |
|
557 | + if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) { |
|
558 | + continue; |
|
559 | + } |
|
533 | 560 | FileHandler::removeFile($path.'/'.$entry); |
534 | 561 | } |
535 | 562 | } |
@@ -554,7 +581,9 @@ discard block |
||
554 | 581 | $eid = Context::get('eid'); |
555 | 582 | $obj = new stdClass(); |
556 | 583 | |
557 | - if(!$module_srl || !$name || !$eid) return new Object(-1,'msg_invalid_request'); |
|
584 | + if(!$module_srl || !$name || !$eid) { |
|
585 | + return new Object(-1,'msg_invalid_request'); |
|
586 | + } |
|
558 | 587 | // set the max value if idx is not specified |
559 | 588 | if(!$var_idx) |
560 | 589 | { |
@@ -576,7 +605,9 @@ discard block |
||
576 | 605 | // insert or update |
577 | 606 | $oDocumentController = getController('document'); |
578 | 607 | $output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid); |
579 | - if(!$output->toBool()) return $output; |
|
608 | + if(!$output->toBool()) { |
|
609 | + return $output; |
|
610 | + } |
|
580 | 611 | |
581 | 612 | $this->setMessage('success_registed'); |
582 | 613 | |
@@ -592,11 +623,15 @@ discard block |
||
592 | 623 | { |
593 | 624 | $module_srl = Context::get('module_srl'); |
594 | 625 | $var_idx = Context::get('var_idx'); |
595 | - if(!$module_srl || !$var_idx) return new Object(-1,'msg_invalid_request'); |
|
626 | + if(!$module_srl || !$var_idx) { |
|
627 | + return new Object(-1,'msg_invalid_request'); |
|
628 | + } |
|
596 | 629 | |
597 | 630 | $oDocumentController = getController('document'); |
598 | 631 | $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); |
599 | - if(!$output->toBool()) return $output; |
|
632 | + if(!$output->toBool()) { |
|
633 | + return $output; |
|
634 | + } |
|
600 | 635 | |
601 | 636 | $this->setMessage('success_deleted'); |
602 | 637 | } |
@@ -611,26 +646,41 @@ discard block |
||
611 | 646 | $module_srl = Context::get('module_srl'); |
612 | 647 | $var_idx = Context::get('var_idx'); |
613 | 648 | |
614 | - if(!$type || !$module_srl || !$var_idx) return new Object(-1,'msg_invalid_request'); |
|
649 | + if(!$type || !$module_srl || !$var_idx) { |
|
650 | + return new Object(-1,'msg_invalid_request'); |
|
651 | + } |
|
615 | 652 | |
616 | 653 | $oModuleModel = getModel('module'); |
617 | 654 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
618 | - if(!$module_info->module_srl) return new Object(-1,'msg_invalid_request'); |
|
655 | + if(!$module_info->module_srl) { |
|
656 | + return new Object(-1,'msg_invalid_request'); |
|
657 | + } |
|
619 | 658 | |
620 | 659 | $oDocumentModel = getModel('document'); |
621 | 660 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
622 | - if(!$extra_keys[$var_idx]) return new Object(-1,'msg_invalid_request'); |
|
661 | + if(!$extra_keys[$var_idx]) { |
|
662 | + return new Object(-1,'msg_invalid_request'); |
|
663 | + } |
|
623 | 664 | |
624 | - if($type == 'up') $new_idx = $var_idx-1; |
|
625 | - else $new_idx = $var_idx+1; |
|
626 | - if($new_idx<1) return new Object(-1,'msg_invalid_request'); |
|
665 | + if($type == 'up') { |
|
666 | + $new_idx = $var_idx-1; |
|
667 | + } else { |
|
668 | + $new_idx = $var_idx+1; |
|
669 | + } |
|
670 | + if($new_idx<1) { |
|
671 | + return new Object(-1,'msg_invalid_request'); |
|
672 | + } |
|
627 | 673 | |
628 | 674 | $args = new stdClass(); |
629 | 675 | $args->module_srl = $module_srl; |
630 | 676 | $args->var_idx = $new_idx; |
631 | 677 | $output = executeQuery('document.getDocumentExtraKeys', $args); |
632 | - if (!$output->toBool()) return $output; |
|
633 | - if (!$output->data) return new Object(-1, 'msg_invalid_request'); |
|
678 | + if (!$output->toBool()) { |
|
679 | + return $output; |
|
680 | + } |
|
681 | + if (!$output->data) { |
|
682 | + return new Object(-1, 'msg_invalid_request'); |
|
683 | + } |
|
634 | 684 | unset($args); |
635 | 685 | |
636 | 686 | // update immediately if there is no idx to change |
@@ -641,35 +691,50 @@ discard block |
||
641 | 691 | $args->var_idx = $var_idx; |
642 | 692 | $args->new_idx = $new_idx; |
643 | 693 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
644 | - if(!$output->toBool()) return $output; |
|
694 | + if(!$output->toBool()) { |
|
695 | + return $output; |
|
696 | + } |
|
645 | 697 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
646 | - if(!$output->toBool()) return $output; |
|
698 | + if(!$output->toBool()) { |
|
699 | + return $output; |
|
700 | + } |
|
647 | 701 | // replace if exists |
648 | - } |
|
649 | - else |
|
702 | + } else |
|
650 | 703 | { |
651 | 704 | $args = new stdClass(); |
652 | 705 | $args->module_srl = $module_srl; |
653 | 706 | $args->var_idx = $new_idx; |
654 | 707 | $args->new_idx = -10000; |
655 | 708 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
656 | - if(!$output->toBool()) return $output; |
|
709 | + if(!$output->toBool()) { |
|
710 | + return $output; |
|
711 | + } |
|
657 | 712 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
658 | - if(!$output->toBool()) return $output; |
|
713 | + if(!$output->toBool()) { |
|
714 | + return $output; |
|
715 | + } |
|
659 | 716 | |
660 | 717 | $args->var_idx = $var_idx; |
661 | 718 | $args->new_idx = $new_idx; |
662 | 719 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
663 | - if(!$output->toBool()) return $output; |
|
720 | + if(!$output->toBool()) { |
|
721 | + return $output; |
|
722 | + } |
|
664 | 723 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
665 | - if(!$output->toBool()) return $output; |
|
724 | + if(!$output->toBool()) { |
|
725 | + return $output; |
|
726 | + } |
|
666 | 727 | |
667 | 728 | $args->var_idx = -10000; |
668 | 729 | $args->new_idx = $var_idx; |
669 | 730 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
670 | - if(!$output->toBool()) return $output; |
|
731 | + if(!$output->toBool()) { |
|
732 | + return $output; |
|
733 | + } |
|
671 | 734 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
672 | - if(!$output->toBool()) return $output; |
|
735 | + if(!$output->toBool()) { |
|
736 | + return $output; |
|
737 | + } |
|
673 | 738 | } |
674 | 739 | |
675 | 740 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
@@ -693,8 +758,7 @@ discard block |
||
693 | 758 | { |
694 | 759 | $args->alias_srl = getNextSequence(); |
695 | 760 | $query = "document.insertAlias"; |
696 | - } |
|
697 | - else |
|
761 | + } else |
|
698 | 762 | { |
699 | 763 | $args->alias_srl = $alias_srl; |
700 | 764 | $query = "document.updateAlias"; |
@@ -732,7 +796,9 @@ discard block |
||
732 | 796 | $oDocumentModel = getModel('document'); |
733 | 797 | $oDocumentController = getController('document'); |
734 | 798 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
735 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
799 | + if(!$oDocument->isGranted()) { |
|
800 | + return $this->stop('msg_not_permitted'); |
|
801 | + } |
|
736 | 802 | |
737 | 803 | $oModuleModel = getModel('module'); |
738 | 804 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); |
@@ -754,8 +820,9 @@ discard block |
||
754 | 820 | parse_str($arrUrl['query'], $arrQuery); |
755 | 821 | |
756 | 822 | // set query |
757 | - if(isset($arrQuery['document_srl'])) |
|
758 | - unset($arrQuery['document_srl']); |
|
823 | + if(isset($arrQuery['document_srl'])) { |
|
824 | + unset($arrQuery['document_srl']); |
|
825 | + } |
|
759 | 826 | |
760 | 827 | $searchArgs = new stdClass; |
761 | 828 | foreach($arrQuery as $key=>$val) |
@@ -763,13 +830,15 @@ discard block |
||
763 | 830 | $searchArgs->{$key} = $val; |
764 | 831 | } |
765 | 832 | |
766 | - if(!isset($searchArgs->sort_index)) |
|
767 | - $searchArgs->sort_index = $module_info->order_target; |
|
833 | + if(!isset($searchArgs->sort_index)) { |
|
834 | + $searchArgs->sort_index = $module_info->order_target; |
|
835 | + } |
|
768 | 836 | |
769 | 837 | foreach($module_info as $key=>$val) |
770 | 838 | { |
771 | - if(!isset($searchArgs->{$key})) |
|
772 | - $searchArgs->{$key} = $val; |
|
839 | + if(!isset($searchArgs->{$key})) { |
|
840 | + $searchArgs->{$key} = $val; |
|
841 | + } |
|
773 | 842 | } |
774 | 843 | |
775 | 844 | $oDocumentModel = getModel('document'); |
@@ -781,12 +850,14 @@ discard block |
||
781 | 850 | } |
782 | 851 | |
783 | 852 | |
784 | - if($cur_page>1 && count($output->data) == 0) |
|
785 | - $arrQuery['page'] = $cur_page - 1; |
|
853 | + if($cur_page>1 && count($output->data) == 0) { |
|
854 | + $arrQuery['page'] = $cur_page - 1; |
|
855 | + } |
|
786 | 856 | |
787 | 857 | $query = "?"; |
788 | - foreach($arrQuery as $key=>$val) |
|
789 | - $query .= sprintf("%s=%s&", $key, $val); |
|
858 | + foreach($arrQuery as $key=>$val) { |
|
859 | + $query .= sprintf("%s=%s&", $key, $val); |
|
860 | + } |
|
790 | 861 | $query = substr($query, 0, -1); |
791 | 862 | } |
792 | 863 | $returnUrl = $arrUrl['path'] . $query; |
@@ -866,7 +937,9 @@ discard block |
||
866 | 937 | */ |
867 | 938 | function restoreTrash($originObject) |
868 | 939 | { |
869 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
940 | + if(is_array($originObject)) { |
|
941 | + $originObject = (object)$originObject; |
|
942 | + } |
|
870 | 943 | |
871 | 944 | $oDocumentController = getController('document'); |
872 | 945 | $oDocumentModel = getModel('document'); |
@@ -876,7 +949,9 @@ discard block |
||
876 | 949 | |
877 | 950 | //DB restore |
878 | 951 | $output = $oDocumentController->insertDocument($originObject, false, true, false); |
879 | - if(!$output->toBool()) return new Object(-1, $output->getMessage()); |
|
952 | + if(!$output->toBool()) { |
|
953 | + return new Object(-1, $output->getMessage()); |
|
954 | + } |
|
880 | 955 | |
881 | 956 | //FILE restore |
882 | 957 | $oDocument = $oDocumentModel->getDocument($originObject->document_srl); |
@@ -914,7 +989,9 @@ discard block |
||
914 | 989 | function emptyTrash($originObject) |
915 | 990 | { |
916 | 991 | $originObject = unserialize($originObject); |
917 | - if(is_array($originObject)) $originObject = (object) $originObject; |
|
992 | + if(is_array($originObject)) { |
|
993 | + $originObject = (object) $originObject; |
|
994 | + } |
|
918 | 995 | |
919 | 996 | $oDocument = new documentItem(); |
920 | 997 | $oDocument->setAttribute($originObject); |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | { |
28 | 28 | // error appears if no doc is selected |
29 | 29 | $cart = Context::get('cart'); |
30 | - if(!$cart) return $this->stop('msg_cart_is_null'); |
|
31 | - $document_srl_list= explode('|@|', $cart); |
|
30 | + if (!$cart) return $this->stop('msg_cart_is_null'); |
|
31 | + $document_srl_list = explode('|@|', $cart); |
|
32 | 32 | $document_count = count($document_srl_list); |
33 | - if(!$document_count) return $this->stop('msg_cart_is_null'); |
|
33 | + if (!$document_count) return $this->stop('msg_cart_is_null'); |
|
34 | 34 | // Delete a doc |
35 | 35 | $oDocumentController = getController('document'); |
36 | - for($i=0;$i<$document_count;$i++) |
|
36 | + for ($i = 0; $i < $document_count; $i++) |
|
37 | 37 | { |
38 | 38 | $document_srl = trim($document_srl_list[$i]); |
39 | - if(!$document_srl) continue; |
|
39 | + if (!$document_srl) continue; |
|
40 | 40 | |
41 | 41 | $oDocumentController->deleteDocument($document_srl, true); |
42 | 42 | } |
43 | 43 | |
44 | - $this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) ); |
|
44 | + $this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count)); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function moveDocumentModule($document_srl_list, $module_srl, $category_srl) |
55 | 55 | { |
56 | - if(!count($document_srl_list)) return; |
|
56 | + if (!count($document_srl_list)) return; |
|
57 | 57 | |
58 | 58 | $oDocumentModel = getModel('document'); |
59 | 59 | $oDocumentController = getController('document'); |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | $oDB->begin(); |
63 | 63 | |
64 | 64 | $triggerObj = new stdClass(); |
65 | - $triggerObj->document_srls = implode(',',$document_srl_list); |
|
65 | + $triggerObj->document_srls = implode(',', $document_srl_list); |
|
66 | 66 | $triggerObj->module_srl = $module_srl; |
67 | 67 | $triggerObj->category_srl = $category_srl; |
68 | 68 | // Call a trigger (before) |
69 | 69 | $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj); |
70 | - if(!$output->toBool()) |
|
70 | + if (!$output->toBool()) |
|
71 | 71 | { |
72 | 72 | $oDB->rollback(); |
73 | 73 | return $output; |
74 | 74 | } |
75 | 75 | |
76 | - for($i=count($document_srl_list)-1;$i>=0;$i--) |
|
76 | + for ($i = count($document_srl_list) - 1; $i >= 0; $i--) |
|
77 | 77 | { |
78 | 78 | $document_srl = $document_srl_list[$i]; |
79 | 79 | $oDocument = $oDocumentModel->getDocument($document_srl); |
80 | - if(!$oDocument->isExists()) continue; |
|
80 | + if (!$oDocument->isExists()) continue; |
|
81 | 81 | |
82 | 82 | $source_category_srl = $oDocument->get('category_srl'); |
83 | 83 | |
@@ -90,27 +90,27 @@ discard block |
||
90 | 90 | $obj->content = $output_ori->data->content; |
91 | 91 | |
92 | 92 | // Move the attached file if the target module is different |
93 | - if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) |
|
93 | + if ($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) |
|
94 | 94 | { |
95 | 95 | $oFileController = getController('file'); |
96 | 96 | |
97 | 97 | $files = $oDocument->getUploadedFiles(); |
98 | 98 | $delete_file_srls = array(); |
99 | - if(is_array($files)) |
|
99 | + if (is_array($files)) |
|
100 | 100 | { |
101 | - foreach($files as $val) |
|
101 | + foreach ($files as $val) |
|
102 | 102 | { |
103 | 103 | $file_info = array(); |
104 | 104 | $file_info['tmp_name'] = $val->uploaded_filename; |
105 | 105 | $file_info['name'] = $val->source_filename; |
106 | 106 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true); |
107 | - if($inserted_file && $inserted_file->toBool()) |
|
107 | + if ($inserted_file && $inserted_file->toBool()) |
|
108 | 108 | { |
109 | 109 | // for image/video files |
110 | - if($val->direct_download == 'Y') |
|
110 | + if ($val->direct_download == 'Y') |
|
111 | 111 | { |
112 | - $source_filename = substr($val->uploaded_filename,2); |
|
113 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
112 | + $source_filename = substr($val->uploaded_filename, 2); |
|
113 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
114 | 114 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
115 | 115 | // For binary files |
116 | 116 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $oFileController->setFilesValid($obj->document_srl); |
130 | 130 | } |
131 | 131 | |
132 | - if($module_srl != $obj->module_srl) |
|
132 | + if ($module_srl != $obj->module_srl) |
|
133 | 133 | { |
134 | 134 | $oDocumentController->deleteDocumentAliasByDocument($obj->document_srl); |
135 | 135 | } |
@@ -137,48 +137,48 @@ discard block |
||
137 | 137 | $obj->module_srl = $module_srl; |
138 | 138 | $obj->category_srl = $category_srl; |
139 | 139 | $output = executeQuery('document.updateDocumentModule', $obj); |
140 | - if(!$output->toBool()) { |
|
140 | + if (!$output->toBool()) { |
|
141 | 141 | $oDB->rollback(); |
142 | 142 | return $output; |
143 | 143 | } |
144 | 144 | |
145 | 145 | //Move a module of the extra vars |
146 | 146 | $output = executeQuery('document.moveDocumentExtraVars', $obj); |
147 | - if(!$output->toBool()) { |
|
147 | + if (!$output->toBool()) { |
|
148 | 148 | $oDB->rollback(); |
149 | 149 | return $output; |
150 | 150 | } |
151 | 151 | // Set 0 if a new category doesn't exist after catergory change |
152 | - if($source_category_srl != $category_srl) |
|
152 | + if ($source_category_srl != $category_srl) |
|
153 | 153 | { |
154 | - if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
155 | - if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
154 | + if ($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
155 | + if ($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | 159 | $args = new stdClass(); |
160 | - $args->document_srls = implode(',',$document_srl_list); |
|
160 | + $args->document_srls = implode(',', $document_srl_list); |
|
161 | 161 | $args->module_srl = $module_srl; |
162 | 162 | // move the comment |
163 | 163 | $output = executeQuery('comment.updateCommentModule', $args); |
164 | - if(!$output->toBool()) |
|
164 | + if (!$output->toBool()) |
|
165 | 165 | { |
166 | 166 | $oDB->rollback(); |
167 | 167 | return $output; |
168 | 168 | } |
169 | 169 | |
170 | 170 | $output = executeQuery('comment.updateCommentListModule', $args); |
171 | - if(!$output->toBool()) |
|
171 | + if (!$output->toBool()) |
|
172 | 172 | { |
173 | 173 | $oDB->rollback(); |
174 | 174 | return $output; |
175 | 175 | } |
176 | 176 | |
177 | 177 | // move the trackback |
178 | - if(getClass('trackback')) |
|
178 | + if (getClass('trackback')) |
|
179 | 179 | { |
180 | 180 | $output = executeQuery('trackback.updateTrackbackModule', $args); |
181 | - if(!$output->toBool()) |
|
181 | + if (!$output->toBool()) |
|
182 | 182 | { |
183 | 183 | $oDB->rollback(); |
184 | 184 | return $output; |
@@ -187,14 +187,14 @@ discard block |
||
187 | 187 | |
188 | 188 | // Tags |
189 | 189 | $output = executeQuery('tag.updateTagModule', $args); |
190 | - if(!$output->toBool()) |
|
190 | + if (!$output->toBool()) |
|
191 | 191 | { |
192 | 192 | $oDB->rollback(); |
193 | 193 | return $output; |
194 | 194 | } |
195 | 195 | // Call a trigger (before) |
196 | 196 | $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj); |
197 | - if(!$output->toBool()) |
|
197 | + if (!$output->toBool()) |
|
198 | 198 | { |
199 | 199 | $oDB->rollback(); |
200 | 200 | return $output; |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | $oDB->commit(); |
204 | 204 | //remove from cache |
205 | 205 | $oCacheHandler = CacheHandler::getInstance('object'); |
206 | - if($oCacheHandler->isSupport()) |
|
206 | + if ($oCacheHandler->isSupport()) |
|
207 | 207 | { |
208 | - foreach($document_srl_list as $document_srl) |
|
208 | + foreach ($document_srl_list as $document_srl) |
|
209 | 209 | { |
210 | - $cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
210 | + $cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
211 | 211 | $oCacheHandler->delete($cache_key_item); |
212 | 212 | } |
213 | 213 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function copyDocumentModule($document_srl_list, $module_srl, $category_srl) |
225 | 225 | { |
226 | - if(count($document_srl_list) < 1) return; |
|
226 | + if (count($document_srl_list) < 1) return; |
|
227 | 227 | |
228 | 228 | $oDocumentModel = getModel('document'); |
229 | 229 | $oDocumentController = getController('document'); |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | $oDB->begin(); |
235 | 235 | |
236 | 236 | $triggerObj = new stdClass(); |
237 | - $triggerObj->document_srls = implode(',',$document_srl_list); |
|
237 | + $triggerObj->document_srls = implode(',', $document_srl_list); |
|
238 | 238 | $triggerObj->module_srl = $module_srl; |
239 | 239 | $triggerObj->category_srl = $category_srl; |
240 | 240 | // Call a trigger (before) |
241 | 241 | $output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $triggerObj); |
242 | - if(!$output->toBool()) |
|
242 | + if (!$output->toBool()) |
|
243 | 243 | { |
244 | 244 | $oDB->rollback(); |
245 | 245 | return $output; |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | |
248 | 248 | $extraVarsList = $oDocumentModel->getDocumentExtraVarsFromDB($document_srl_list); |
249 | 249 | $extraVarsListByDocumentSrl = array(); |
250 | - if(is_array($extraVarsList->data)) |
|
250 | + if (is_array($extraVarsList->data)) |
|
251 | 251 | { |
252 | - foreach($extraVarsList->data as $value) |
|
252 | + foreach ($extraVarsList->data as $value) |
|
253 | 253 | { |
254 | - if(!isset($extraVarsListByDocumentSrl[$value->document_srl])) |
|
254 | + if (!isset($extraVarsListByDocumentSrl[$value->document_srl])) |
|
255 | 255 | { |
256 | 256 | $extraVarsListByDocumentSrl[$value->document_srl] = array(); |
257 | 257 | } |
@@ -260,22 +260,22 @@ discard block |
||
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - for($i=count($document_srl_list)-1;$i>=0;$i--) |
|
263 | + for ($i = count($document_srl_list) - 1; $i >= 0; $i--) |
|
264 | 264 | { |
265 | 265 | $document_srl = $document_srl_list[$i]; |
266 | 266 | $oDocument = $oDocumentModel->getDocument($document_srl); |
267 | - if(!$oDocument->isExists()) continue; |
|
267 | + if (!$oDocument->isExists()) continue; |
|
268 | 268 | |
269 | 269 | $obj = $oDocument->getObjectVars(); |
270 | 270 | |
271 | 271 | $extraVars = $extraVarsListByDocumentSrl[$document_srl]; |
272 | - if($module_srl == $obj->module_srl) |
|
272 | + if ($module_srl == $obj->module_srl) |
|
273 | 273 | { |
274 | - if(is_array($extraVars)) |
|
274 | + if (is_array($extraVars)) |
|
275 | 275 | { |
276 | - foreach($extraVars as $extraItem) |
|
276 | + foreach ($extraVars as $extraItem) |
|
277 | 277 | { |
278 | - if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
278 | + if ($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | $obj->trackback_count = 0; |
288 | 288 | |
289 | 289 | // Pre-register the attachment |
290 | - if($oDocument->hasUploadedFiles()) |
|
290 | + if ($oDocument->hasUploadedFiles()) |
|
291 | 291 | { |
292 | 292 | $files = $oDocument->getUploadedFiles(); |
293 | - foreach($files as $val) |
|
293 | + foreach ($files as $val) |
|
294 | 294 | { |
295 | 295 | $file_info = array(); |
296 | 296 | $file_info['tmp_name'] = $val->uploaded_filename; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | $oFileController = getController('file'); |
299 | 299 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true); |
300 | 300 | // if image/video files |
301 | - if($val->direct_download == 'Y') |
|
301 | + if ($val->direct_download == 'Y') |
|
302 | 302 | { |
303 | - $source_filename = substr($val->uploaded_filename,2); |
|
304 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
303 | + $source_filename = substr($val->uploaded_filename, 2); |
|
304 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
305 | 305 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
306 | 306 | // If binary file |
307 | 307 | } |
@@ -315,23 +315,23 @@ discard block |
||
315 | 315 | |
316 | 316 | // Write a post |
317 | 317 | $output = $oDocumentController->insertDocument($obj, true, true); |
318 | - if(!$output->toBool()) |
|
318 | + if (!$output->toBool()) |
|
319 | 319 | { |
320 | 320 | $oDB->rollback(); |
321 | 321 | return $output; |
322 | 322 | } |
323 | 323 | |
324 | 324 | // copy multi language contents |
325 | - if(is_array($extraVars)) |
|
325 | + if (is_array($extraVars)) |
|
326 | 326 | { |
327 | - foreach($extraVars as $value) |
|
327 | + foreach ($extraVars as $value) |
|
328 | 328 | { |
329 | - if($value->idx >= 0 && $value->lang_code == Context::getLangType()) |
|
329 | + if ($value->idx >= 0 && $value->lang_code == Context::getLangType()) |
|
330 | 330 | { |
331 | 331 | continue; |
332 | 332 | } |
333 | 333 | |
334 | - if( $value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0) ) |
|
334 | + if ($value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0)) |
|
335 | 335 | { |
336 | 336 | $oDocumentController->insertDocumentExtraVar($value->module_srl, $obj->document_srl, $value->var_idx, $value->value, $value->eid, $value->lang_code); |
337 | 337 | } |
@@ -339,26 +339,26 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | // Move the comments |
342 | - if($oDocument->getCommentCount()) |
|
342 | + if ($oDocument->getCommentCount()) |
|
343 | 343 | { |
344 | 344 | $oCommentModel = getModel('comment'); |
345 | 345 | $comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999); |
346 | 346 | $comments = $comment_output->data; |
347 | - if(count($comments) > 0) |
|
347 | + if (count($comments) > 0) |
|
348 | 348 | { |
349 | 349 | $oCommentController = getController('comment'); |
350 | 350 | $success_count = 0; |
351 | 351 | $p_comment_srl = array(); |
352 | - foreach($comments as $comment_obj) |
|
352 | + foreach ($comments as $comment_obj) |
|
353 | 353 | { |
354 | 354 | $comment_srl = getNextSequence(); |
355 | 355 | $p_comment_srl[$comment_obj->comment_srl] = $comment_srl; |
356 | 356 | |
357 | 357 | // Pre-register the attachment |
358 | - if($comment_obj->uploaded_count) |
|
358 | + if ($comment_obj->uploaded_count) |
|
359 | 359 | { |
360 | 360 | $files = $oFileModel->getFiles($comment_obj->comment_srl, true); |
361 | - foreach($files as $val) |
|
361 | + foreach ($files as $val) |
|
362 | 362 | { |
363 | 363 | $file_info = array(); |
364 | 364 | $file_info['tmp_name'] = $val->uploaded_filename; |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | $oFileController = getController('file'); |
367 | 367 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $comment_srl, 0, true); |
368 | 368 | // if image/video files |
369 | - if($val->direct_download == 'Y') |
|
369 | + if ($val->direct_download == 'Y') |
|
370 | 370 | { |
371 | - $source_filename = substr($val->uploaded_filename,2); |
|
372 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
371 | + $source_filename = substr($val->uploaded_filename, 2); |
|
372 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
373 | 373 | $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content); |
374 | 374 | // If binary file |
375 | 375 | } |
@@ -385,10 +385,10 @@ discard block |
||
385 | 385 | $comment_obj->document_srl = $obj->document_srl; |
386 | 386 | $comment_obj->comment_srl = $comment_srl; |
387 | 387 | |
388 | - if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
388 | + if ($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
389 | 389 | |
390 | 390 | $output = $oCommentController->insertComment($comment_obj, true); |
391 | - if($output->toBool()) $success_count ++; |
|
391 | + if ($output->toBool()) $success_count++; |
|
392 | 392 | } |
393 | 393 | $oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true); |
394 | 394 | } |
@@ -396,19 +396,19 @@ discard block |
||
396 | 396 | |
397 | 397 | // Move the trackbacks |
398 | 398 | $oTrackbackModel = getModel('trackback'); |
399 | - if($oTrackbackModel && $oDocument->getTrackbackCount()) |
|
399 | + if ($oTrackbackModel && $oDocument->getTrackbackCount()) |
|
400 | 400 | { |
401 | 401 | $trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl); |
402 | - if(count($trackbacks)) |
|
402 | + if (count($trackbacks)) |
|
403 | 403 | { |
404 | 404 | $success_count = 0; |
405 | - foreach($trackbacks as $trackback_obj) |
|
405 | + foreach ($trackbacks as $trackback_obj) |
|
406 | 406 | { |
407 | 407 | $trackback_obj->trackback_srl = getNextSequence(); |
408 | 408 | $trackback_obj->module_srl = $obj->module_srl; |
409 | 409 | $trackback_obj->document_srl = $obj->document_srl; |
410 | 410 | $output = executeQuery('trackback.insertTrackback', $trackback_obj); |
411 | - if($output->toBool()) $success_count++; |
|
411 | + if ($output->toBool()) $success_count++; |
|
412 | 412 | } |
413 | 413 | // Update the number of trackbacks |
414 | 414 | $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | // Call a trigger (before) |
422 | 422 | $triggerObj->copied_srls = $copied_srls; |
423 | 423 | $output = ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $triggerObj); |
424 | - if(!$output->toBool()) |
|
424 | + if (!$output->toBool()) |
|
425 | 425 | { |
426 | 426 | $oDB->rollback(); |
427 | 427 | return $output; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $document_list = $oDocumentModel->getDocumentList($args); |
449 | 449 | $documents = $document_list->data; |
450 | 450 | $output = executeQuery('document.deleteModuleDocument', $args); |
451 | - if(is_array($documents)) |
|
451 | + if (is_array($documents)) |
|
452 | 452 | { |
453 | 453 | foreach ($documents as $oDocument) |
454 | 454 | { |
@@ -457,13 +457,13 @@ discard block |
||
457 | 457 | } |
458 | 458 | //remove from cache |
459 | 459 | $oCacheHandler = CacheHandler::getInstance('object'); |
460 | - if($oCacheHandler->isSupport()) |
|
460 | + if ($oCacheHandler->isSupport()) |
|
461 | 461 | { |
462 | - if(is_array($document_srl_list)) |
|
462 | + if (is_array($document_srl_list)) |
|
463 | 463 | { |
464 | - foreach($document_srl_list as $document_srl) |
|
464 | + foreach ($document_srl_list as $document_srl) |
|
465 | 465 | { |
466 | - $cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
466 | + $cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
467 | 467 | $oCacheHandler->delete($cache_key_item); |
468 | 468 | } |
469 | 469 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $config = Context::gets('thumbnail_type'); |
482 | 482 | // Insert by creating the module Controller object |
483 | 483 | $oModuleController = getController('module'); |
484 | - $output = $oModuleController->insertModuleConfig('document',$config); |
|
484 | + $output = $oModuleController->insertModuleConfig('document', $config); |
|
485 | 485 | |
486 | 486 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminConfig'); |
487 | 487 | return $this->setRedirectUrl($returnUrl, $output); |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | { |
496 | 496 | $document_srl = trim(Context::get('document_srl')); |
497 | 497 | |
498 | - if($document_srl) |
|
498 | + if ($document_srl) |
|
499 | 499 | { |
500 | 500 | $args->document_srl = $document_srl; |
501 | 501 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
502 | - if(!$output->toBool()) return $output; |
|
502 | + if (!$output->toBool()) return $output; |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
@@ -524,12 +524,12 @@ discard block |
||
524 | 524 | function deleteThumbnailFile($path) |
525 | 525 | { |
526 | 526 | $directory = dir($path); |
527 | - while($entry = $directory->read()) { |
|
527 | + while ($entry = $directory->read()) { |
|
528 | 528 | if ($entry != "." && $entry != "..") { |
529 | 529 | if (is_dir($path."/".$entry)) { |
530 | 530 | $this->deleteThumbnailFile($path."/".$entry); |
531 | 531 | } else { |
532 | - if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; |
|
532 | + if (!preg_match('/^thumbnail_([^\.]*)\.jpg$/i', $entry)) continue; |
|
533 | 533 | FileHandler::removeFile($path.'/'.$entry); |
534 | 534 | } |
535 | 535 | } |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | $eid = Context::get('eid'); |
555 | 555 | $obj = new stdClass(); |
556 | 556 | |
557 | - if(!$module_srl || !$name || !$eid) return new Object(-1,'msg_invalid_request'); |
|
557 | + if (!$module_srl || !$name || !$eid) return new Object(-1, 'msg_invalid_request'); |
|
558 | 558 | // set the max value if idx is not specified |
559 | - if(!$var_idx) |
|
559 | + if (!$var_idx) |
|
560 | 560 | { |
561 | 561 | $obj->module_srl = $module_srl; |
562 | 562 | $output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj); |
563 | - $var_idx = $output->data->var_idx+1; |
|
563 | + $var_idx = $output->data->var_idx + 1; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | // Check if the module name already exists |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | $obj->var_idx = $var_idx; |
569 | 569 | $obj->eid = $eid; |
570 | 570 | $output = executeQuery('document.isExistsExtraKey', $obj); |
571 | - if(!$output->toBool() || $output->data->count) |
|
571 | + if (!$output->toBool() || $output->data->count) |
|
572 | 572 | { |
573 | 573 | return new Object(-1, 'msg_extra_name_exists'); |
574 | 574 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | // insert or update |
577 | 577 | $oDocumentController = getController('document'); |
578 | 578 | $output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid); |
579 | - if(!$output->toBool()) return $output; |
|
579 | + if (!$output->toBool()) return $output; |
|
580 | 580 | |
581 | 581 | $this->setMessage('success_registed'); |
582 | 582 | |
@@ -592,11 +592,11 @@ discard block |
||
592 | 592 | { |
593 | 593 | $module_srl = Context::get('module_srl'); |
594 | 594 | $var_idx = Context::get('var_idx'); |
595 | - if(!$module_srl || !$var_idx) return new Object(-1,'msg_invalid_request'); |
|
595 | + if (!$module_srl || !$var_idx) return new Object(-1, 'msg_invalid_request'); |
|
596 | 596 | |
597 | 597 | $oDocumentController = getController('document'); |
598 | 598 | $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); |
599 | - if(!$output->toBool()) return $output; |
|
599 | + if (!$output->toBool()) return $output; |
|
600 | 600 | |
601 | 601 | $this->setMessage('success_deleted'); |
602 | 602 | } |
@@ -611,19 +611,19 @@ discard block |
||
611 | 611 | $module_srl = Context::get('module_srl'); |
612 | 612 | $var_idx = Context::get('var_idx'); |
613 | 613 | |
614 | - if(!$type || !$module_srl || !$var_idx) return new Object(-1,'msg_invalid_request'); |
|
614 | + if (!$type || !$module_srl || !$var_idx) return new Object(-1, 'msg_invalid_request'); |
|
615 | 615 | |
616 | 616 | $oModuleModel = getModel('module'); |
617 | 617 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
618 | - if(!$module_info->module_srl) return new Object(-1,'msg_invalid_request'); |
|
618 | + if (!$module_info->module_srl) return new Object(-1, 'msg_invalid_request'); |
|
619 | 619 | |
620 | 620 | $oDocumentModel = getModel('document'); |
621 | 621 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
622 | - if(!$extra_keys[$var_idx]) return new Object(-1,'msg_invalid_request'); |
|
622 | + if (!$extra_keys[$var_idx]) return new Object(-1, 'msg_invalid_request'); |
|
623 | 623 | |
624 | - if($type == 'up') $new_idx = $var_idx-1; |
|
625 | - else $new_idx = $var_idx+1; |
|
626 | - if($new_idx<1) return new Object(-1,'msg_invalid_request'); |
|
624 | + if ($type == 'up') $new_idx = $var_idx - 1; |
|
625 | + else $new_idx = $var_idx + 1; |
|
626 | + if ($new_idx < 1) return new Object(-1, 'msg_invalid_request'); |
|
627 | 627 | |
628 | 628 | $args = new stdClass(); |
629 | 629 | $args->module_srl = $module_srl; |
@@ -634,16 +634,16 @@ discard block |
||
634 | 634 | unset($args); |
635 | 635 | |
636 | 636 | // update immediately if there is no idx to change |
637 | - if(!$extra_keys[$new_idx]) |
|
637 | + if (!$extra_keys[$new_idx]) |
|
638 | 638 | { |
639 | 639 | $args = new stdClass(); |
640 | 640 | $args->module_srl = $module_srl; |
641 | 641 | $args->var_idx = $var_idx; |
642 | 642 | $args->new_idx = $new_idx; |
643 | 643 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
644 | - if(!$output->toBool()) return $output; |
|
644 | + if (!$output->toBool()) return $output; |
|
645 | 645 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
646 | - if(!$output->toBool()) return $output; |
|
646 | + if (!$output->toBool()) return $output; |
|
647 | 647 | // replace if exists |
648 | 648 | } |
649 | 649 | else |
@@ -653,27 +653,27 @@ discard block |
||
653 | 653 | $args->var_idx = $new_idx; |
654 | 654 | $args->new_idx = -10000; |
655 | 655 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
656 | - if(!$output->toBool()) return $output; |
|
656 | + if (!$output->toBool()) return $output; |
|
657 | 657 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
658 | - if(!$output->toBool()) return $output; |
|
658 | + if (!$output->toBool()) return $output; |
|
659 | 659 | |
660 | 660 | $args->var_idx = $var_idx; |
661 | 661 | $args->new_idx = $new_idx; |
662 | 662 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
663 | - if(!$output->toBool()) return $output; |
|
663 | + if (!$output->toBool()) return $output; |
|
664 | 664 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
665 | - if(!$output->toBool()) return $output; |
|
665 | + if (!$output->toBool()) return $output; |
|
666 | 666 | |
667 | 667 | $args->var_idx = -10000; |
668 | 668 | $args->new_idx = $var_idx; |
669 | 669 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
670 | - if(!$output->toBool()) return $output; |
|
670 | + if (!$output->toBool()) return $output; |
|
671 | 671 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
672 | - if(!$output->toBool()) return $output; |
|
672 | + if (!$output->toBool()) return $output; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
676 | - if($oCacheHandler->isSupport()) |
|
676 | + if ($oCacheHandler->isSupport()) |
|
677 | 677 | { |
678 | 678 | $object_key = 'module_document_extra_keys:'.$module_srl; |
679 | 679 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -687,9 +687,9 @@ discard block |
||
687 | 687 | */ |
688 | 688 | function procDocumentAdminInsertAlias() |
689 | 689 | { |
690 | - $args = Context::gets('module_srl','document_srl', 'alias_title'); |
|
690 | + $args = Context::gets('module_srl', 'document_srl', 'alias_title'); |
|
691 | 691 | $alias_srl = Context::get('alias_srl'); |
692 | - if(!$alias_srl) |
|
692 | + if (!$alias_srl) |
|
693 | 693 | { |
694 | 694 | $args->alias_srl = getNextSequence(); |
695 | 695 | $query = "document.insertAlias"; |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | $oDocumentModel = getModel('document'); |
733 | 733 | $oDocumentController = getController('document'); |
734 | 734 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
735 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
735 | + if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
736 | 736 | |
737 | 737 | $oModuleModel = getModel('module'); |
738 | 738 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); |
@@ -744,31 +744,31 @@ discard block |
||
744 | 744 | $oDocumentController->moveDocumentToTrash($args); |
745 | 745 | |
746 | 746 | $returnUrl = Context::get('success_return_url'); |
747 | - if(!$returnUrl) |
|
747 | + if (!$returnUrl) |
|
748 | 748 | { |
749 | 749 | $arrUrl = parse_url(Context::get('cur_url')); |
750 | 750 | $query = ""; |
751 | 751 | |
752 | - if($arrUrl['query']) |
|
752 | + if ($arrUrl['query']) |
|
753 | 753 | { |
754 | 754 | parse_str($arrUrl['query'], $arrQuery); |
755 | 755 | |
756 | 756 | // set query |
757 | - if(isset($arrQuery['document_srl'])) |
|
757 | + if (isset($arrQuery['document_srl'])) |
|
758 | 758 | unset($arrQuery['document_srl']); |
759 | 759 | |
760 | 760 | $searchArgs = new stdClass; |
761 | - foreach($arrQuery as $key=>$val) |
|
761 | + foreach ($arrQuery as $key=>$val) |
|
762 | 762 | { |
763 | 763 | $searchArgs->{$key} = $val; |
764 | 764 | } |
765 | 765 | |
766 | - if(!isset($searchArgs->sort_index)) |
|
766 | + if (!isset($searchArgs->sort_index)) |
|
767 | 767 | $searchArgs->sort_index = $module_info->order_target; |
768 | 768 | |
769 | - foreach($module_info as $key=>$val) |
|
769 | + foreach ($module_info as $key=>$val) |
|
770 | 770 | { |
771 | - if(!isset($searchArgs->{$key})) |
|
771 | + if (!isset($searchArgs->{$key})) |
|
772 | 772 | $searchArgs->{$key} = $val; |
773 | 773 | } |
774 | 774 | |
@@ -776,20 +776,20 @@ discard block |
||
776 | 776 | $output = $oDocumentModel->getDocumentList($searchArgs, $module_info->except_notice, TRUE, array('document_srl')); |
777 | 777 | |
778 | 778 | $cur_page = 1; |
779 | - if(isset($arrQuery['page'])) { |
|
780 | - $cur_page = (int)$arrQuery['page']; |
|
779 | + if (isset($arrQuery['page'])) { |
|
780 | + $cur_page = (int) $arrQuery['page']; |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | |
784 | - if($cur_page>1 && count($output->data) == 0) |
|
784 | + if ($cur_page > 1 && count($output->data) == 0) |
|
785 | 785 | $arrQuery['page'] = $cur_page - 1; |
786 | 786 | |
787 | 787 | $query = "?"; |
788 | - foreach($arrQuery as $key=>$val) |
|
788 | + foreach ($arrQuery as $key=>$val) |
|
789 | 789 | $query .= sprintf("%s=%s&", $key, $val); |
790 | 790 | $query = substr($query, 0, -1); |
791 | 791 | } |
792 | - $returnUrl = $arrUrl['path'] . $query; |
|
792 | + $returnUrl = $arrUrl['path'].$query; |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | $this->add('redirect_url', $returnUrl); |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | */ |
867 | 867 | function restoreTrash($originObject) |
868 | 868 | { |
869 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
869 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
870 | 870 | |
871 | 871 | $oDocumentController = getController('document'); |
872 | 872 | $oDocumentModel = getModel('document'); |
@@ -876,12 +876,12 @@ discard block |
||
876 | 876 | |
877 | 877 | //DB restore |
878 | 878 | $output = $oDocumentController->insertDocument($originObject, false, true, false); |
879 | - if(!$output->toBool()) return new Object(-1, $output->getMessage()); |
|
879 | + if (!$output->toBool()) return new Object(-1, $output->getMessage()); |
|
880 | 880 | |
881 | 881 | //FILE restore |
882 | 882 | $oDocument = $oDocumentModel->getDocument($originObject->document_srl); |
883 | 883 | // If the post was not temorarily saved, set the attachment's status to be valid |
884 | - if($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) |
|
884 | + if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) |
|
885 | 885 | { |
886 | 886 | $args = new stdClass(); |
887 | 887 | $args->upload_target_srl = $oDocument->document_srl; |
@@ -890,10 +890,10 @@ discard block |
||
890 | 890 | } |
891 | 891 | |
892 | 892 | // call a trigger (after) |
893 | - if($output->toBool()) |
|
893 | + if ($output->toBool()) |
|
894 | 894 | { |
895 | 895 | $trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject); |
896 | - if(!$trigger_output->toBool()) |
|
896 | + if (!$trigger_output->toBool()) |
|
897 | 897 | { |
898 | 898 | $oDB->rollback(); |
899 | 899 | return $trigger_output; |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | function emptyTrash($originObject) |
915 | 915 | { |
916 | 916 | $originObject = unserialize($originObject); |
917 | - if(is_array($originObject)) $originObject = (object) $originObject; |
|
917 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
918 | 918 | |
919 | 919 | $oDocument = new documentItem(); |
920 | 920 | $oDocument->setAttribute($originObject); |
@@ -351,6 +351,7 @@ |
||
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Return status by key |
354 | + * @param string $key |
|
354 | 355 | * @return string |
355 | 356 | */ |
356 | 357 | function getConfigStatus($key) |
@@ -61,68 +61,126 @@ discard block |
||
61 | 61 | $oModuleModel = getModel('module'); |
62 | 62 | |
63 | 63 | // 2007. 7. 25: Add a column(notify_message) for notification |
64 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
64 | + if(!$oDB->isColumnExists("documents","notify_message")) { |
|
65 | + return true; |
|
66 | + } |
|
65 | 67 | |
66 | 68 | // 2007. 8. 23: create a clustered index in the document table |
67 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
68 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
69 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
70 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
69 | + if(!$oDB->isIndexExists("documents","idx_module_list_order")) { |
|
70 | + return true; |
|
71 | + } |
|
72 | + if(!$oDB->isIndexExists("documents","idx_module_update_order")) { |
|
73 | + return true; |
|
74 | + } |
|
75 | + if(!$oDB->isIndexExists("documents","idx_module_readed_count")) { |
|
76 | + return true; |
|
77 | + } |
|
78 | + if(!$oDB->isIndexExists("documents","idx_module_voted_count")) { |
|
79 | + return true; |
|
80 | + } |
|
71 | 81 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
72 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
82 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) { |
|
83 | + return true; |
|
84 | + } |
|
73 | 85 | // 2007. 10. 25 add parent_srl, expand to the document category |
74 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
75 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
76 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
86 | + if(!$oDB->isColumnExists("document_categories","parent_srl")) { |
|
87 | + return true; |
|
88 | + } |
|
89 | + if(!$oDB->isColumnExists("document_categories","expand")) { |
|
90 | + return true; |
|
91 | + } |
|
92 | + if(!$oDB->isColumnExists("document_categories","group_srls")) { |
|
93 | + return true; |
|
94 | + } |
|
77 | 95 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
78 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
96 | + if(!$oDB->isIndexExists("documents","idx_module_notice")) { |
|
97 | + return true; |
|
98 | + } |
|
79 | 99 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
80 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
100 | + if(!$oDB->isIndexExists("documents","idx_module_document_srl")) { |
|
101 | + return true; |
|
102 | + } |
|
81 | 103 | |
82 | 104 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
83 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
105 | + if(!$oDB->isColumnExists("documents","extra_vars")) { |
|
106 | + return true; |
|
107 | + } |
|
84 | 108 | // 2008. 04. 23 Add a column(blamed_count) |
85 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
86 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
87 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
109 | + if(!$oDB->isColumnExists("documents", "blamed_count")) { |
|
110 | + return true; |
|
111 | + } |
|
112 | + if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) { |
|
113 | + return true; |
|
114 | + } |
|
115 | + if(!$oDB->isColumnExists("document_voted_log", "point")) { |
|
116 | + return true; |
|
117 | + } |
|
88 | 118 | // 2008-12-15 Add a column(color) |
89 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
119 | + if(!$oDB->isColumnExists("document_categories", "color")) { |
|
120 | + return true; |
|
121 | + } |
|
90 | 122 | |
91 | 123 | /** |
92 | 124 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
93 | 125 | */ |
94 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
126 | + if(!$oDB->isColumnExists("document_extra_vars","lang_code")) { |
|
127 | + return true; |
|
128 | + } |
|
95 | 129 | |
96 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
130 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) { |
|
131 | + return true; |
|
132 | + } |
|
97 | 133 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
98 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
134 | + if(!$oDB->isColumnExists("documents","lang_code")) { |
|
135 | + return true; |
|
136 | + } |
|
99 | 137 | // 2009. 03. 11 check the index in the document_extra_vars table |
100 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
138 | + if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) { |
|
139 | + return true; |
|
140 | + } |
|
101 | 141 | |
102 | 142 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
103 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
104 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
143 | + if(!$oDB->isColumnExists("document_extra_keys","eid")) { |
|
144 | + return true; |
|
145 | + } |
|
146 | + if(!$oDB->isColumnExists("document_extra_vars","eid")) { |
|
147 | + return true; |
|
148 | + } |
|
105 | 149 | |
106 | 150 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
107 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
151 | + if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) { |
|
152 | + return true; |
|
153 | + } |
|
108 | 154 | |
109 | 155 | //2011. 04. 07 adding description column to document categories |
110 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
156 | + if(!$oDB->isColumnExists("document_categories","description")) { |
|
157 | + return true; |
|
158 | + } |
|
111 | 159 | |
112 | 160 | //2011. 05. 23 adding status column to document |
113 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
161 | + if(!$oDB->isColumnExists('documents', 'status')) { |
|
162 | + return true; |
|
163 | + } |
|
114 | 164 | |
115 | 165 | //2011. 06. 07 check comment status update |
116 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
166 | + if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) { |
|
167 | + return true; |
|
168 | + } |
|
117 | 169 | |
118 | 170 | // 2011. 10. 25 status index check |
119 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
171 | + if(!$oDB->isIndexExists("documents", "idx_module_status")) { |
|
172 | + return true; |
|
173 | + } |
|
120 | 174 | |
121 | 175 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
122 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
176 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) { |
|
177 | + return true; |
|
178 | + } |
|
123 | 179 | |
124 | 180 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
125 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
181 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) { |
|
182 | + return true; |
|
183 | + } |
|
126 | 184 | |
127 | 185 | return false; |
128 | 186 | } |
@@ -164,20 +222,33 @@ discard block |
||
164 | 222 | $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
165 | 223 | } |
166 | 224 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
167 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
168 | - $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
|
225 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) { |
|
226 | + $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
|
227 | + } |
|
169 | 228 | // 2007. 10. 25 add columns(parent_srl, expand) |
170 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
171 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
172 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
229 | + if(!$oDB->isColumnExists("document_categories","parent_srl")) { |
|
230 | + $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
231 | + } |
|
232 | + if(!$oDB->isColumnExists("document_categories","expand")) { |
|
233 | + $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
234 | + } |
|
235 | + if(!$oDB->isColumnExists("document_categories","group_srls")) { |
|
236 | + $oDB->addColumn('document_categories',"group_srls","text"); |
|
237 | + } |
|
173 | 238 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
174 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
239 | + if(!$oDB->isIndexExists("documents","idx_module_notice")) { |
|
240 | + $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
241 | + } |
|
175 | 242 | |
176 | 243 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
177 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
244 | + if(!$oDB->isColumnExists("documents","extra_vars")) { |
|
245 | + $oDB->addColumn('documents','extra_vars','text'); |
|
246 | + } |
|
178 | 247 | |
179 | 248 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
180 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
249 | + if(!$oDB->isIndexExists("documents","idx_module_document_srl")) { |
|
250 | + $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
251 | + } |
|
181 | 252 | // 2008. 04. 23 Add a column(blamed count) |
182 | 253 | if(!$oDB->isColumnExists("documents", "blamed_count")) |
183 | 254 | { |
@@ -190,18 +261,24 @@ discard block |
||
190 | 261 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
191 | 262 | } |
192 | 263 | |
193 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
194 | - $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
|
264 | + if(!$oDB->isColumnExists("document_voted_log", "point")) { |
|
265 | + $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
|
266 | + } |
|
195 | 267 | |
196 | 268 | |
197 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
269 | + if(!$oDB->isColumnExists("document_categories","color")) { |
|
270 | + $oDB->addColumn('document_categories',"color","char",7); |
|
271 | + } |
|
198 | 272 | |
199 | 273 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
200 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
274 | + if(!$oDB->isColumnExists("document_extra_vars","lang_code")) { |
|
275 | + $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
276 | + } |
|
201 | 277 | |
202 | 278 | // 2009. 01. 29 Added a trigger for additional setup |
203 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
204 | - $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
|
279 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) { |
|
280 | + $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
|
281 | + } |
|
205 | 282 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
206 | 283 | if(!$oDB->isColumnExists("documents","lang_code")) |
207 | 284 | { |
@@ -262,7 +339,9 @@ discard block |
||
262 | 339 | } |
263 | 340 | |
264 | 341 | //2011. 04. 07 adding description column to document categories |
265 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
342 | + if(!$oDB->isColumnExists("document_categories","description")) { |
|
343 | + $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
344 | + } |
|
266 | 345 | |
267 | 346 | //2011. 05. 23 adding status column to document |
268 | 347 | if(!$oDB->isColumnExists('documents', 'status')) |
@@ -273,8 +352,9 @@ discard block |
||
273 | 352 | } |
274 | 353 | |
275 | 354 | // 2011. 09. 08 drop column document is_secret |
276 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
277 | - $oDB->dropColumn('documents', 'is_secret'); |
|
355 | + if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) { |
|
356 | + $oDB->dropColumn('documents', 'is_secret'); |
|
357 | + } |
|
278 | 358 | |
279 | 359 | //2011. 06. 07 merge column, allow_comment and lock_comment |
280 | 360 | if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
@@ -299,14 +379,17 @@ discard block |
||
299 | 379 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
300 | 380 | } |
301 | 381 | |
302 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
303 | - $oDB->dropColumn('documents', 'allow_comment'); |
|
382 | + if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) { |
|
383 | + $oDB->dropColumn('documents', 'allow_comment'); |
|
384 | + } |
|
304 | 385 | |
305 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
306 | - $oDB->dropColumn('documents', 'lock_comment'); |
|
386 | + if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) { |
|
387 | + $oDB->dropColumn('documents', 'lock_comment'); |
|
388 | + } |
|
307 | 389 | |
308 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
309 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
390 | + if(!$oDB->isIndexExists("documents", "idx_module_status")) { |
|
391 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
392 | + } |
|
310 | 393 | |
311 | 394 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
312 | 395 | if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
@@ -355,8 +438,11 @@ discard block |
||
355 | 438 | */ |
356 | 439 | function getConfigStatus($key) |
357 | 440 | { |
358 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
359 | - else $this->getDefaultStatus(); |
|
441 | + if(array_key_exists(strtolower($key), $this->statusList)) { |
|
442 | + return $this->statusList[$key]; |
|
443 | + } else { |
|
444 | + $this->getDefaultStatus(); |
|
445 | + } |
|
360 | 446 | } |
361 | 447 | } |
362 | 448 | /* End of file document.class.php */ |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * Search option to use in admin page |
18 | 18 | * @var array |
19 | 19 | */ |
20 | - var $search_option = array('title','content','title_content','user_name',); // /< Search options |
|
20 | + var $search_option = array('title', 'content', 'title_content', 'user_name',); // /< Search options |
|
21 | 21 | /** |
22 | 22 | * Status list |
23 | 23 | * @var array |
@@ -34,22 +34,22 @@ discard block |
||
34 | 34 | $oModuleController = getController('module'); |
35 | 35 | |
36 | 36 | $oDB = &DB::getInstance(); |
37 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
38 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
39 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
40 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
41 | - $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
42 | - $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
43 | - $oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count")); |
|
44 | - $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true); |
|
45 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
37 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
38 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
39 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
40 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
41 | + $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
42 | + $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
43 | + $oDB->addIndex("documents", "idx_module_blamed_count", array("module_srl", "blamed_count")); |
|
44 | + $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl", "alias_title"), true); |
|
45 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
46 | 46 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
47 | 47 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
48 | 48 | |
49 | 49 | // 2009. 01. 29 Added a trigger for additional setup |
50 | 50 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
51 | 51 | |
52 | - if(!is_dir('./files/cache/tmp')) |
|
52 | + if (!is_dir('./files/cache/tmp')) |
|
53 | 53 | { |
54 | 54 | FileHandler::makeDir('./files/cache/tmp'); |
55 | 55 | } |
@@ -66,68 +66,68 @@ discard block |
||
66 | 66 | $oModuleModel = getModel('module'); |
67 | 67 | |
68 | 68 | // 2007. 7. 25: Add a column(notify_message) for notification |
69 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
69 | + if (!$oDB->isColumnExists("documents", "notify_message")) return true; |
|
70 | 70 | |
71 | 71 | // 2007. 8. 23: create a clustered index in the document table |
72 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
73 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
74 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
75 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
72 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true; |
|
73 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true; |
|
74 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true; |
|
75 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true; |
|
76 | 76 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
77 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
77 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
78 | 78 | // 2007. 10. 25 add parent_srl, expand to the document category |
79 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
80 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
81 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
79 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true; |
|
80 | + if (!$oDB->isColumnExists("document_categories", "expand")) return true; |
|
81 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) return true; |
|
82 | 82 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
83 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
83 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true; |
|
84 | 84 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
85 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
85 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true; |
|
86 | 86 | |
87 | 87 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
88 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
88 | + if (!$oDB->isColumnExists("documents", "extra_vars")) return true; |
|
89 | 89 | // 2008. 04. 23 Add a column(blamed_count) |
90 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
91 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
92 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
90 | + if (!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
91 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true; |
|
92 | + if (!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
93 | 93 | // 2008-12-15 Add a column(color) |
94 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
94 | + if (!$oDB->isColumnExists("document_categories", "color")) return true; |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
98 | 98 | */ |
99 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
99 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true; |
|
100 | 100 | |
101 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
101 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
102 | 102 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
103 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
103 | + if (!$oDB->isColumnExists("documents", "lang_code")) return true; |
|
104 | 104 | // 2009. 03. 11 check the index in the document_extra_vars table |
105 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
105 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
106 | 106 | |
107 | 107 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
108 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
109 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
108 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true; |
|
109 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true; |
|
110 | 110 | |
111 | 111 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
112 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
112 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
113 | 113 | |
114 | 114 | //2011. 04. 07 adding description column to document categories |
115 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
115 | + if (!$oDB->isColumnExists("document_categories", "description")) return true; |
|
116 | 116 | |
117 | 117 | //2011. 05. 23 adding status column to document |
118 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
118 | + if (!$oDB->isColumnExists('documents', 'status')) return true; |
|
119 | 119 | |
120 | 120 | //2011. 06. 07 check comment status update |
121 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
121 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
122 | 122 | |
123 | 123 | // 2011. 10. 25 status index check |
124 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
124 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
125 | 125 | |
126 | 126 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
127 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
127 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
128 | 128 | |
129 | 129 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
130 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
130 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
131 | 131 | |
132 | 132 | return false; |
133 | 133 | } |
@@ -143,98 +143,98 @@ discard block |
||
143 | 143 | $oModuleController = getController('module'); |
144 | 144 | |
145 | 145 | // 2007. 7. 25: Add a column(notify_message) for notification |
146 | - if(!$oDB->isColumnExists("documents","notify_message")) |
|
146 | + if (!$oDB->isColumnExists("documents", "notify_message")) |
|
147 | 147 | { |
148 | - $oDB->addColumn('documents',"notify_message","char",1); |
|
148 | + $oDB->addColumn('documents', "notify_message", "char", 1); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // 2007. 8. 23: create a clustered index in the document table |
152 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) |
|
152 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) |
|
153 | 153 | { |
154 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
154 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
155 | 155 | } |
156 | 156 | |
157 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) |
|
157 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) |
|
158 | 158 | { |
159 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
159 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
160 | 160 | } |
161 | 161 | |
162 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) |
|
162 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) |
|
163 | 163 | { |
164 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
164 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
165 | 165 | } |
166 | 166 | |
167 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) |
|
167 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) |
|
168 | 168 | { |
169 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
169 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
170 | 170 | } |
171 | 171 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
172 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
172 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
173 | 173 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
174 | 174 | // 2007. 10. 25 add columns(parent_srl, expand) |
175 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
176 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
177 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
175 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0); |
|
176 | + if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N"); |
|
177 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text"); |
|
178 | 178 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
179 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
179 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
180 | 180 | |
181 | 181 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
182 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
182 | + if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text'); |
|
183 | 183 | |
184 | 184 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
185 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
185 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
186 | 186 | // 2008. 04. 23 Add a column(blamed count) |
187 | - if(!$oDB->isColumnExists("documents", "blamed_count")) |
|
187 | + if (!$oDB->isColumnExists("documents", "blamed_count")) |
|
188 | 188 | { |
189 | 189 | $oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true); |
190 | 190 | $oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count')); |
191 | 191 | } |
192 | 192 | |
193 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) |
|
193 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) |
|
194 | 194 | { |
195 | 195 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
196 | 196 | } |
197 | 197 | |
198 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
198 | + if (!$oDB->isColumnExists("document_voted_log", "point")) |
|
199 | 199 | $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
200 | 200 | |
201 | 201 | |
202 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
202 | + if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7); |
|
203 | 203 | |
204 | 204 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
205 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
205 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10); |
|
206 | 206 | |
207 | 207 | // 2009. 01. 29 Added a trigger for additional setup |
208 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
208 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
209 | 209 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
210 | 210 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
211 | - if(!$oDB->isColumnExists("documents","lang_code")) |
|
211 | + if (!$oDB->isColumnExists("documents", "lang_code")) |
|
212 | 212 | { |
213 | 213 | $db_info = Context::getDBInfo(); |
214 | - $oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code); |
|
214 | + $oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code); |
|
215 | 215 | $obj->lang_code = $db_info->lang_type; |
216 | 216 | executeQuery('document.updateDocumentsLangCode', $obj); |
217 | 217 | } |
218 | 218 | // 2009. 03. 11 Check the index in the document_extra_vars table |
219 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
219 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
220 | 220 | { |
221 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
221 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
222 | 222 | } |
223 | 223 | |
224 | - if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
224 | + if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
225 | 225 | { |
226 | 226 | $oDB->dropIndex("document_extra_vars", "unique_module_vars", true); |
227 | 227 | } |
228 | 228 | |
229 | 229 | // 2009. 03. 19: Add a column(eid) |
230 | 230 | // 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column |
231 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) |
|
231 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) |
|
232 | 232 | { |
233 | - $oDB->addColumn("document_extra_keys","eid","varchar",40); |
|
233 | + $oDB->addColumn("document_extra_keys", "eid", "varchar", 40); |
|
234 | 234 | |
235 | 235 | $output = executeQuery('document.getGroupsExtraKeys', $obj); |
236 | - if($output->toBool() && $output->data && count($output->data)) { |
|
237 | - foreach($output->data as $extra_keys) { |
|
236 | + if ($output->toBool() && $output->data && count($output->data)) { |
|
237 | + foreach ($output->data as $extra_keys) { |
|
238 | 238 | $args->module_srl = $extra_keys->module_srl; |
239 | 239 | $args->var_idx = $extra_keys->idx; |
240 | 240 | $args->new_eid = "extra_vars".$extra_keys->idx; |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) |
|
246 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) |
|
247 | 247 | { |
248 | - $oDB->addColumn("document_extra_vars","eid","varchar",40); |
|
248 | + $oDB->addColumn("document_extra_vars", "eid", "varchar", 40); |
|
249 | 249 | $obj->var_idx = '-1,-2'; |
250 | 250 | $output = executeQuery('document.getGroupsExtraVars', $obj); |
251 | - if($output->toBool() && $output->data && count($output->data)) |
|
251 | + if ($output->toBool() && $output->data && count($output->data)) |
|
252 | 252 | { |
253 | - foreach($output->data as $extra_vars) |
|
253 | + foreach ($output->data as $extra_vars) |
|
254 | 254 | { |
255 | 255 | $args->module_srl = $extra_vars->module_srl; |
256 | 256 | $args->var_idx = $extra_vars->idx; |
@@ -261,16 +261,16 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
264 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
264 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
265 | 265 | { |
266 | - $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false); |
|
266 | + $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | //2011. 04. 07 adding description column to document categories |
270 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
270 | + if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0); |
|
271 | 271 | |
272 | 272 | //2011. 05. 23 adding status column to document |
273 | - if(!$oDB->isColumnExists('documents', 'status')) |
|
273 | + if (!$oDB->isColumnExists('documents', 'status')) |
|
274 | 274 | { |
275 | 275 | $oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC'); |
276 | 276 | $args->is_secret = 'Y'; |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | // 2011. 09. 08 drop column document is_secret |
281 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
281 | + if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
282 | 282 | $oDB->dropColumn('documents', 'is_secret'); |
283 | 283 | |
284 | 284 | //2011. 06. 07 merge column, allow_comment and lock_comment |
285 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
285 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
286 | 286 | { |
287 | 287 | $oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW'); |
288 | 288 | |
@@ -304,28 +304,28 @@ discard block |
||
304 | 304 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
305 | 305 | } |
306 | 306 | |
307 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
307 | + if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
308 | 308 | $oDB->dropColumn('documents', 'allow_comment'); |
309 | 309 | |
310 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
310 | + if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
311 | 311 | $oDB->dropColumn('documents', 'lock_comment'); |
312 | 312 | |
313 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
314 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
313 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) |
|
314 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl", "status")); |
|
315 | 315 | |
316 | 316 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
317 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
317 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
318 | 318 | { |
319 | 319 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'); |
320 | 320 | } |
321 | 321 | |
322 | 322 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
323 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
323 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
324 | 324 | { |
325 | 325 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'); |
326 | 326 | } |
327 | 327 | |
328 | - return new Object(0,'success_updated'); |
|
328 | + return new Object(0, 'success_updated'); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | function recompileCache() |
336 | 336 | { |
337 | - if(!is_dir('./files/cache/tmp')) |
|
337 | + if (!is_dir('./files/cache/tmp')) |
|
338 | 338 | { |
339 | 339 | FileHandler::makeDir('./files/cache/tmp'); |
340 | 340 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function getConfigStatus($key) |
366 | 366 | { |
367 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
367 | + if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
368 | 368 | else $this->getDefaultStatus(); |
369 | 369 | } |
370 | 370 | } |