@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Get the board module admin simple setting page |
24 | - * @return void |
|
24 | + * @return null|string |
|
25 | 25 | */ |
26 | 26 | public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl) |
27 | 27 | { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl) |
27 | 27 | { |
28 | - if(!$moduleSrl) |
|
28 | + if (!$moduleSrl) |
|
29 | 29 | { |
30 | 30 | return; |
31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $oModuleModel = getModel('module'); |
36 | 36 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
37 | 37 | $moduleInfo->use_status = explode('|@|', $moduleInfo->use_status); |
38 | - if($moduleInfo) |
|
38 | + if ($moduleInfo) |
|
39 | 39 | { |
40 | 40 | Context::set('module_info', $moduleInfo); |
41 | 41 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | Context::set('document_status_list', $documentStatusList); |
47 | 47 | |
48 | 48 | // set order target list |
49 | - foreach($this->order_target AS $key) |
|
49 | + foreach ($this->order_target AS $key) |
|
50 | 50 | { |
51 | 51 | $order_target[$key] = Context::getLang($key); |
52 | 52 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | Context::set('admin_member', $admin_member); |
64 | 64 | |
65 | 65 | $oTemplate = &TemplateHandler::getInstance(); |
66 | - $html = $oTemplate->compile($this->module_path.'tpl/', 'board_setup_basic'); |
|
66 | + $html = $oTemplate->compile($this->module_path . 'tpl/', 'board_setup_basic'); |
|
67 | 67 | |
68 | 68 | return $html; |
69 | 69 | } |
@@ -87,6 +87,9 @@ discard block |
||
87 | 87 | $oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list'))); |
88 | 88 | } |
89 | 89 | |
90 | + /** |
|
91 | + * @param string $content_list |
|
92 | + */ |
|
90 | 93 | function arrangeContentList($content_list) { |
91 | 94 | $output = array(); |
92 | 95 | if(count($content_list)) { |
@@ -120,6 +123,9 @@ discard block |
||
120 | 123 | return $output; |
121 | 124 | } |
122 | 125 | |
126 | + /** |
|
127 | + * @param string $comment_list |
|
128 | + */ |
|
123 | 129 | function arrangeComment($comment_list) { |
124 | 130 | $output = array(); |
125 | 131 | if(count($comment_list) > 0 ) { |
@@ -133,6 +139,9 @@ discard block |
||
133 | 139 | } |
134 | 140 | |
135 | 141 | |
142 | + /** |
|
143 | + * @param string $file_list |
|
144 | + */ |
|
136 | 145 | function arrangeFile($file_list) { |
137 | 146 | $output = array(); |
138 | 147 | if(count($file_list) > 0) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @brief notice list |
19 | 19 | **/ |
20 | 20 | function dispBoardNoticeList(&$oModule) { |
21 | - $oModule->add('notice_list',$this->arrangeContentList(Context::get('notice_list'))); |
|
21 | + $oModule->add('notice_list', $this->arrangeContentList(Context::get('notice_list'))); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | $api_type = Context::get('api_type'); |
30 | 30 | $document_list = $this->arrangeContentList(Context::get('document_list')); |
31 | 31 | |
32 | - if($api_type =='summary') |
|
32 | + if ($api_type == 'summary') |
|
33 | 33 | { |
34 | 34 | $content_cut_size = Context::get('content_cut_size'); |
35 | - $content_cut_size = $content_cut_size?$content_cut_size:50; |
|
36 | - foreach($document_list as $k=>$v) |
|
35 | + $content_cut_size = $content_cut_size ? $content_cut_size : 50; |
|
36 | + foreach ($document_list as $k=>$v) |
|
37 | 37 | { |
38 | 38 | $oDocument = new documentItem(); |
39 | 39 | $oDocument->setAttribute($v, false); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | - $oModule->add('document_list',$document_list); |
|
46 | - $oModule->add('page_navigation',Context::get('page_navigation')); |
|
45 | + $oModule->add('document_list', $document_list); |
|
46 | + $oModule->add('page_navigation', Context::get('page_navigation')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @brief category list |
52 | 52 | **/ |
53 | 53 | function dispBoardCategoryList(&$oModule) { |
54 | - $oModule->add('category_list',Context::get('category_list')); |
|
54 | + $oModule->add('category_list', Context::get('category_list')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | function dispBoardContentView(&$oModule) { |
61 | 61 | $oDocument = Context::get('oDocument'); |
62 | 62 | $extra_vars = $oDocument->getExtraVars(); |
63 | - $oDocument->add('extra_vars',$this->arrangeExtraVars($extra_vars)); |
|
64 | - $oModule->add('oDocument',$this->arrangeContent($oDocument)); |
|
63 | + $oDocument->add('extra_vars', $this->arrangeExtraVars($extra_vars)); |
|
64 | + $oModule->add('oDocument', $this->arrangeContent($oDocument)); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @brief contents file list |
70 | 70 | **/ |
71 | 71 | function dispBoardContentFileList(&$oModule) { |
72 | - $oModule->add('file_list',$this->arrangeFile(Context::get('file_list'))); |
|
72 | + $oModule->add('file_list', $this->arrangeFile(Context::get('file_list'))); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -77,20 +77,20 @@ discard block |
||
77 | 77 | * @brief tag list |
78 | 78 | **/ |
79 | 79 | function dispBoardTagList(&$oModule) { |
80 | - $oModule->add('tag_list',Context::get('tag_list')); |
|
80 | + $oModule->add('tag_list', Context::get('tag_list')); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | 84 | * @brief comments list |
85 | 85 | **/ |
86 | 86 | function dispBoardContentCommentList(&$oModule) { |
87 | - $oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list'))); |
|
87 | + $oModule->add('comment_list', $this->arrangeComment(Context::get('comment_list'))); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | function arrangeContentList($content_list) { |
91 | 91 | $output = array(); |
92 | - if(count($content_list)) { |
|
93 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
92 | + if (count($content_list)) { |
|
93 | + foreach ($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
94 | 94 | } |
95 | 95 | return $output; |
96 | 96 | } |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | function arrangeContent($content) { |
100 | 100 | $oBoardView = getView('board'); |
101 | 101 | $output = new stdClass; |
102 | - if($content){ |
|
103 | - $output = $content->gets('document_srl','category_srl','member_srl','nick_name','user_id','user_name','title','content','tags','readed_count','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status'); |
|
102 | + if ($content) { |
|
103 | + $output = $content->gets('document_srl', 'category_srl', 'member_srl', 'nick_name', 'user_id', 'user_name', 'title', 'content', 'tags', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'regdate', 'last_update', 'extra_vars', 'status'); |
|
104 | 104 | |
105 | - if(!$oBoardView->grant->view) |
|
105 | + if (!$oBoardView->grant->view) |
|
106 | 106 | { |
107 | 107 | unset($output->content); |
108 | 108 | unset($output->tags); |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | |
123 | 123 | function arrangeComment($comment_list) { |
124 | 124 | $output = array(); |
125 | - if(count($comment_list) > 0 ) { |
|
126 | - foreach($comment_list as $key => $val){ |
|
125 | + if (count($comment_list) > 0) { |
|
126 | + foreach ($comment_list as $key => $val) { |
|
127 | 127 | $item = null; |
128 | - $item = $val->gets('comment_srl','parent_srl','depth','is_secret','content','voted_count','blamed_count','user_id','user_name','nick_name','email_address','homepage','regdate','last_update'); |
|
128 | + $item = $val->gets('comment_srl', 'parent_srl', 'depth', 'is_secret', 'content', 'voted_count', 'blamed_count', 'user_id', 'user_name', 'nick_name', 'email_address', 'homepage', 'regdate', 'last_update'); |
|
129 | 129 | $output[] = $item; |
130 | 130 | } |
131 | 131 | } |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | |
136 | 136 | function arrangeFile($file_list) { |
137 | 137 | $output = array(); |
138 | - if(count($file_list) > 0) { |
|
139 | - foreach($file_list as $key => $val){ |
|
138 | + if (count($file_list) > 0) { |
|
139 | + foreach ($file_list as $key => $val) { |
|
140 | 140 | $item = new stdClass; |
141 | 141 | $item->sid = $val->sid; |
142 | 142 | $item->download_count = $val->download_count; |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | |
154 | 154 | function arrangeExtraVars($list) { |
155 | 155 | $output = array(); |
156 | - if(count($list)) { |
|
157 | - foreach($list as $key => $val){ |
|
156 | + if (count($list)) { |
|
157 | + foreach ($list as $key => $val) { |
|
158 | 158 | $item = new stdClass; |
159 | 159 | $item->name = $val->name; |
160 | 160 | $item->type = $val->type; |
@@ -90,7 +90,9 @@ |
||
90 | 90 | function arrangeContentList($content_list) { |
91 | 91 | $output = array(); |
92 | 92 | if(count($content_list)) { |
93 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
93 | + foreach($content_list as $key => $val) { |
|
94 | + $output[] = $this->arrangeContent($val); |
|
95 | + } |
|
94 | 96 | } |
95 | 97 | return $output; |
96 | 98 | } |
@@ -747,6 +747,9 @@ |
||
747 | 747 | $this->setTemplateFile('write_form'); |
748 | 748 | } |
749 | 749 | |
750 | + /** |
|
751 | + * @param ModuleObject $oDocumentModel |
|
752 | + */ |
|
750 | 753 | function _getStatusNameList(&$oDocumentModel) |
751 | 754 | { |
752 | 755 | $resultList = array(); |
@@ -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) |
|
77 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager) |
|
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 | } |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | /** |
123 | 123 | * load javascript, JS filters |
124 | 124 | **/ |
125 | - Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); |
|
126 | - Context::addJsFile($this->module_path.'tpl/js/board.js'); |
|
125 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'input_password.xml'); |
|
126 | + Context::addJsFile($this->module_path . 'tpl/js/board.js'); |
|
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); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | function dispBoardEidList() |
144 | 144 | { |
145 | 145 | // check if there is not grant fot view list, then alert an warning message |
146 | - if(!$this->grant->list) |
|
146 | + if (!$this->grant->list) |
|
147 | 147 | { |
148 | 148 | return $this->dispBoardMessage('msg_not_permitted'); |
149 | 149 | } |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | $oModuleModel = getModel('module'); |
154 | 154 | |
155 | 155 | $args = new StdClass(); |
156 | - if($eid_number>0) |
|
156 | + if ($eid_number > 0) |
|
157 | 157 | $args->idx = $eid_number; |
158 | 158 | $args->module_srl = $oModuleModel->getModuleSrlByMid($mid); |
159 | 159 | $output = executeQueryArray('document.inEV2', $args); |
160 | - Context::set('eid_list',$output->data); |
|
160 | + Context::set('eid_list', $output->data); |
|
161 | 161 | $oSecurity = new Security(); |
162 | 162 | $oSecurity->encodeHTML('eid_list.'); |
163 | 163 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * check the access grant (all the grant has been set by the module object) |
174 | 174 | **/ |
175 | - if(!$this->grant->access || !$this->grant->list) |
|
175 | + if (!$this->grant->access || !$this->grant->list) |
|
176 | 176 | { |
177 | 177 | return $this->dispBoardMessage('msg_not_permitted'); |
178 | 178 | } |
@@ -187,22 +187,22 @@ discard block |
||
187 | 187 | * add extra vaiables to the search options |
188 | 188 | **/ |
189 | 189 | // use search options on the template (the search options key has been declared, based on the language selected) |
190 | - foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
190 | + foreach ($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
191 | 191 | $extra_keys = Context::get('extra_keys'); |
192 | - if($extra_keys) |
|
192 | + if ($extra_keys) |
|
193 | 193 | { |
194 | - foreach($extra_keys as $key => $val) |
|
194 | + foreach ($extra_keys as $key => $val) |
|
195 | 195 | { |
196 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
196 | + if ($val->search == 'Y') $search_option['extra_vars' . $val->idx] = $val->name; |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | // remove a search option that is not public in member config |
200 | 200 | $memberConfig = getModel('module')->getModuleConfig('member'); |
201 | - foreach($memberConfig->signupForm as $signupFormElement) |
|
201 | + foreach ($memberConfig->signupForm as $signupFormElement) |
|
202 | 202 | { |
203 | - if(in_array($signupFormElement->title, $search_option)) |
|
203 | + if (in_array($signupFormElement->title, $search_option)) |
|
204 | 204 | { |
205 | - if($signupFormElement->isPublic == 'N') |
|
205 | + if ($signupFormElement->isPublic == 'N') |
|
206 | 206 | unset($search_option[$signupFormElement->name]); |
207 | 207 | } |
208 | 208 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $oDocumentModel = getModel('document'); |
212 | 212 | $statusNameList = $this->_getStatusNameList($oDocumentModel); |
213 | - if(count($statusNameList) > 0) |
|
213 | + if (count($statusNameList) > 0) |
|
214 | 214 | { |
215 | 215 | Context::set('status_list', $statusNameList); |
216 | 216 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | // list config, columnList setting |
222 | 222 | $oBoardModel = getModel('board'); |
223 | 223 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
224 | - if(!$this->listConfig) $this->listConfig = array(); |
|
224 | + if (!$this->listConfig) $this->listConfig = array(); |
|
225 | 225 | $this->_makeListColumnList(); |
226 | 226 | |
227 | 227 | // display the notice list |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * add javascript filters |
235 | 235 | **/ |
236 | - Context::addJsFilter($this->module_path.'tpl/filter', 'search.xml'); |
|
236 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'search.xml'); |
|
237 | 237 | |
238 | 238 | $oSecurity = new Security(); |
239 | 239 | $oSecurity->encodeHTML('search_option.'); |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | /** |
246 | 246 | * @brief display the category list |
247 | 247 | **/ |
248 | - function dispBoardCategoryList(){ |
|
248 | + function dispBoardCategoryList() { |
|
249 | 249 | // check if the use_category option is enabled |
250 | - if($this->module_info->use_category=='Y') |
|
250 | + if ($this->module_info->use_category == 'Y') |
|
251 | 251 | { |
252 | 252 | // check the grant |
253 | - if(!$this->grant->list) |
|
253 | + if (!$this->grant->list) |
|
254 | 254 | { |
255 | 255 | Context::set('category_list', array()); |
256 | 256 | return; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | /** |
268 | 268 | * @brief display the board conent view |
269 | 269 | **/ |
270 | - function dispBoardContentView(){ |
|
270 | + function dispBoardContentView() { |
|
271 | 271 | // get the variable value |
272 | 272 | $document_srl = Context::get('document_srl'); |
273 | 273 | $page = Context::get('page'); |
@@ -278,36 +278,36 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * if the document exists, then get the document information |
280 | 280 | **/ |
281 | - if($document_srl) |
|
281 | + if ($document_srl) |
|
282 | 282 | { |
283 | 283 | $oDocument = $oDocumentModel->getDocument($document_srl, false, true); |
284 | 284 | |
285 | 285 | // if the document is existed |
286 | - if($oDocument->isExists()) |
|
286 | + if ($oDocument->isExists()) |
|
287 | 287 | { |
288 | 288 | // if the module srl is not consistent |
289 | - if($oDocument->get('module_srl')!=$this->module_info->module_srl ) |
|
289 | + if ($oDocument->get('module_srl') != $this->module_info->module_srl) |
|
290 | 290 | { |
291 | 291 | return $this->stop('msg_invalid_request'); |
292 | 292 | } |
293 | 293 | |
294 | 294 | // check the manage grant |
295 | - if($this->grant->manager) $oDocument->setGrant(); |
|
295 | + if ($this->grant->manager) $oDocument->setGrant(); |
|
296 | 296 | |
297 | 297 | // if the consultation function is enabled, and the document is not a notice |
298 | - if($this->consultation && !$oDocument->isNotice()) |
|
298 | + if ($this->consultation && !$oDocument->isNotice()) |
|
299 | 299 | { |
300 | 300 | $logged_info = Context::get('logged_info'); |
301 | - if($oDocument->get('member_srl')!=$logged_info->member_srl) |
|
301 | + if ($oDocument->get('member_srl') != $logged_info->member_srl) |
|
302 | 302 | { |
303 | 303 | $oDocument = $oDocumentModel->getDocument(0); |
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | 307 | // if the document is TEMP saved, check Grant |
308 | - if($oDocument->getStatus() == 'TEMP') |
|
308 | + if ($oDocument->getStatus() == 'TEMP') |
|
309 | 309 | { |
310 | - if(!$oDocument->isGranted()) |
|
310 | + if (!$oDocument->isGranted()) |
|
311 | 311 | { |
312 | 312 | $oDocument = $oDocumentModel->getDocument(0); |
313 | 313 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | else |
318 | 318 | { |
319 | 319 | // if the document is not existed, then alert a warning message |
320 | - Context::set('document_srl','',true); |
|
320 | + Context::set('document_srl', '', true); |
|
321 | 321 | $this->alertMessage('msg_not_founded'); |
322 | 322 | } |
323 | 323 | |
@@ -333,12 +333,12 @@ discard block |
||
333 | 333 | /** |
334 | 334 | *check the document view grant |
335 | 335 | **/ |
336 | - if($oDocument->isExists()) |
|
336 | + if ($oDocument->isExists()) |
|
337 | 337 | { |
338 | - if(!$this->grant->view && !$oDocument->isGranted()) |
|
338 | + if (!$this->grant->view && !$oDocument->isGranted()) |
|
339 | 339 | { |
340 | 340 | $oDocument = $oDocumentModel->getDocument(0); |
341 | - Context::set('document_srl','',true); |
|
341 | + Context::set('document_srl', '', true); |
|
342 | 342 | $this->alertMessage('msg_not_permitted'); |
343 | 343 | } |
344 | 344 | else |
@@ -347,15 +347,15 @@ discard block |
||
347 | 347 | Context::addBrowserTitle($oDocument->getTitleText()); |
348 | 348 | |
349 | 349 | // update the document view count (if the document is not secret) |
350 | - if(!$oDocument->isSecret() || $oDocument->isGranted()) |
|
350 | + if (!$oDocument->isSecret() || $oDocument->isGranted()) |
|
351 | 351 | { |
352 | 352 | $oDocument->updateReadedCount(); |
353 | 353 | } |
354 | 354 | |
355 | 355 | // disappear the document if it is secret |
356 | - if($oDocument->isSecret() && !$oDocument->isGranted()) |
|
356 | + if ($oDocument->isSecret() && !$oDocument->isGranted()) |
|
357 | 357 | { |
358 | - $oDocument->add('content',Context::getLang('thisissecret')); |
|
358 | + $oDocument->add('content', Context::getLang('thisissecret')); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | /** |
368 | 368 | * add javascript filters |
369 | 369 | **/ |
370 | - Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); |
|
370 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_comment.xml'); |
|
371 | 371 | |
372 | 372 | // return new Object(); |
373 | 373 | } |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | /** |
376 | 376 | * @brief display the document file list (can be used by API) |
377 | 377 | **/ |
378 | - function dispBoardContentFileList(){ |
|
378 | + function dispBoardContentFileList() { |
|
379 | 379 | /** |
380 | 380 | * check the access grant (all the grant has been set by the module object) |
381 | 381 | **/ |
382 | - if(!$this->grant->access) |
|
382 | + if (!$this->grant->access) |
|
383 | 383 | { |
384 | 384 | return $this->dispBoardMessage('msg_not_permitted'); |
385 | 385 | } |
@@ -390,41 +390,41 @@ discard block |
||
390 | 390 | // Check if a permission for file download is granted |
391 | 391 | // Get configurations (using module model object) |
392 | 392 | $oModuleModel = getModel('module'); |
393 | - $file_module_config = $oModuleModel->getModulePartConfig('file',$this->module_srl); |
|
393 | + $file_module_config = $oModuleModel->getModulePartConfig('file', $this->module_srl); |
|
394 | 394 | |
395 | 395 | $downloadGrantCount = 0; |
396 | - if(is_array($file_module_config->download_grant)) |
|
396 | + if (is_array($file_module_config->download_grant)) |
|
397 | 397 | { |
398 | - foreach($file_module_config->download_grant AS $value) |
|
399 | - if($value) $downloadGrantCount++; |
|
398 | + foreach ($file_module_config->download_grant AS $value) |
|
399 | + if ($value) $downloadGrantCount++; |
|
400 | 400 | } |
401 | 401 | |
402 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
402 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
403 | 403 | { |
404 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
404 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
405 | 405 | $logged_info = Context::get('logged_info'); |
406 | - if($logged_info->is_admin != 'Y') |
|
406 | + if ($logged_info->is_admin != 'Y') |
|
407 | 407 | { |
408 | - $oModuleModel =& getModel('module'); |
|
408 | + $oModuleModel = & getModel('module'); |
|
409 | 409 | $columnList = array('module_srl', 'site_srl'); |
410 | 410 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl, $columnList); |
411 | 411 | |
412 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
412 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
413 | 413 | { |
414 | - $oMemberModel =& getModel('member'); |
|
414 | + $oMemberModel = & getModel('member'); |
|
415 | 415 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
416 | 416 | |
417 | 417 | $is_permitted = false; |
418 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
418 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
419 | 419 | { |
420 | 420 | $group_srl = $file_module_config->download_grant[$i]; |
421 | - if($member_groups[$group_srl]) |
|
421 | + if ($member_groups[$group_srl]) |
|
422 | 422 | { |
423 | 423 | $is_permitted = true; |
424 | 424 | break; |
425 | 425 | } |
426 | 426 | } |
427 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
427 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $oDocumentModel = getModel('document'); |
433 | 433 | $document_srl = Context::get('document_srl'); |
434 | 434 | $oDocument = $oDocumentModel->getDocument($document_srl); |
435 | - Context::set('file_list',$oDocument->getUploadedFiles()); |
|
435 | + Context::set('file_list', $oDocument->getUploadedFiles()); |
|
436 | 436 | |
437 | 437 | $oSecurity = new Security(); |
438 | 438 | $oSecurity->encodeHTML('file_list..source_filename'); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | /** |
442 | 442 | * @brief display the document comment list (can be used by API) |
443 | 443 | **/ |
444 | - function dispBoardContentCommentList(){ |
|
444 | + function dispBoardContentCommentList() { |
|
445 | 445 | // check document view grant |
446 | 446 | $this->dispBoardContentView(); |
447 | 447 | |
@@ -451,26 +451,26 @@ discard block |
||
451 | 451 | $comment_list = $oDocument->getComments(); |
452 | 452 | |
453 | 453 | // setup the comment list |
454 | - if(is_array($comment_list)) |
|
454 | + if (is_array($comment_list)) |
|
455 | 455 | { |
456 | - foreach($comment_list as $key => $val) |
|
456 | + foreach ($comment_list as $key => $val) |
|
457 | 457 | { |
458 | - if(!$val->isAccessible()) |
|
458 | + if (!$val->isAccessible()) |
|
459 | 459 | { |
460 | - $val->add('content',Context::getLang('thisissecret')); |
|
460 | + $val->add('content', Context::getLang('thisissecret')); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | } |
464 | - Context::set('comment_list',$comment_list); |
|
464 | + Context::set('comment_list', $comment_list); |
|
465 | 465 | |
466 | 466 | } |
467 | 467 | |
468 | 468 | /** |
469 | 469 | * @brief display notice list (can be used by API) |
470 | 470 | **/ |
471 | - function dispBoardNoticeList(){ |
|
471 | + function dispBoardNoticeList() { |
|
472 | 472 | // check the grant |
473 | - if(!$this->grant->list) |
|
473 | + if (!$this->grant->list) |
|
474 | 474 | { |
475 | 475 | Context::set('notice_list', array()); |
476 | 476 | return; |
@@ -486,15 +486,15 @@ discard block |
||
486 | 486 | /** |
487 | 487 | * @brief display board content list |
488 | 488 | **/ |
489 | - function dispBoardContentList(){ |
|
489 | + function dispBoardContentList() { |
|
490 | 490 | // check the grant |
491 | - if(!$this->grant->list) |
|
491 | + if (!$this->grant->list) |
|
492 | 492 | { |
493 | 493 | Context::set('document_list', array()); |
494 | 494 | Context::set('total_count', 0); |
495 | 495 | Context::set('total_page', 1); |
496 | 496 | Context::set('page', 1); |
497 | - Context::set('page_navigation', new PageHandler(0,0,1,10)); |
|
497 | + Context::set('page_navigation', new PageHandler(0, 0, 1, 10)); |
|
498 | 498 | return; |
499 | 499 | } |
500 | 500 | |
@@ -512,17 +512,17 @@ discard block |
||
512 | 512 | $args->search_keyword = Context::get('search_keyword'); |
513 | 513 | |
514 | 514 | $search_option = Context::get('search_option'); |
515 | - if($search_option==FALSE) |
|
515 | + if ($search_option == FALSE) |
|
516 | 516 | { |
517 | 517 | $search_option = $this->search_option; |
518 | 518 | } |
519 | - if(isset($search_option[$args->search_target])==FALSE) |
|
519 | + if (isset($search_option[$args->search_target]) == FALSE) |
|
520 | 520 | { |
521 | 521 | $args->search_target = ''; |
522 | 522 | } |
523 | 523 | |
524 | 524 | // if the category is enabled, then get the category |
525 | - if($this->module_info->use_category=='Y') |
|
525 | + if ($this->module_info->use_category == 'Y') |
|
526 | 526 | { |
527 | 527 | $args->category_srl = Context::get('category'); |
528 | 528 | } |
@@ -530,21 +530,21 @@ discard block |
||
530 | 530 | // setup the sort index and order index |
531 | 531 | $args->sort_index = Context::get('sort_index'); |
532 | 532 | $args->order_type = Context::get('order_type'); |
533 | - if(!in_array($args->sort_index, $this->order_target)) |
|
533 | + if (!in_array($args->sort_index, $this->order_target)) |
|
534 | 534 | { |
535 | - $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; |
|
535 | + $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; |
|
536 | 536 | } |
537 | - if(!in_array($args->order_type, array('asc','desc'))) |
|
537 | + if (!in_array($args->order_type, array('asc', 'desc'))) |
|
538 | 538 | { |
539 | - $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc'; |
|
539 | + $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | // set the current page of documents |
543 | 543 | $document_srl = Context::get('document_srl'); |
544 | - if(!$args->page && $document_srl) |
|
544 | + if (!$args->page && $document_srl) |
|
545 | 545 | { |
546 | 546 | $oDocument = $oDocumentModel->getDocument($document_srl); |
547 | - if($oDocument->isExists() && !$oDocument->isNotice()) |
|
547 | + if ($oDocument->isExists() && !$oDocument->isNotice()) |
|
548 | 548 | { |
549 | 549 | $page = $oDocumentModel->getDocumentPage($oDocument, $args); |
550 | 550 | Context::set('page', $page); |
@@ -553,13 +553,13 @@ discard block |
||
553 | 553 | } |
554 | 554 | |
555 | 555 | // setup the list count to be serach list count, if the category or search keyword has been set |
556 | - if($args->category_srl || $args->search_keyword) |
|
556 | + if ($args->category_srl || $args->search_keyword) |
|
557 | 557 | { |
558 | 558 | $args->list_count = $this->search_list_count; |
559 | 559 | } |
560 | 560 | |
561 | 561 | // if the consultation function is enabled, the get the logged user information |
562 | - if($this->consultation) |
|
562 | + if ($this->consultation) |
|
563 | 563 | { |
564 | 564 | $logged_info = Context::get('logged_info'); |
565 | 565 | $args->member_srl = $logged_info->member_srl; |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
588 | 588 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
589 | 589 | |
590 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
590 | + if (in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
591 | 591 | |
592 | 592 | // default column list add |
593 | 593 | $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'); |
594 | 594 | |
595 | 595 | //TODO guestbook, blog style supports legacy codes. |
596 | - if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
596 | + if ($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
597 | 597 | { |
598 | 598 | $defaultColumn = $tableColumnList; |
599 | 599 | } |
600 | 600 | |
601 | - if (in_array('last_post', $configColumList)){ |
|
601 | + if (in_array('last_post', $configColumList)) { |
|
602 | 602 | array_push($this->columnList, 'last_updater'); |
603 | 603 | } |
604 | 604 | |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | $this->columnList = array_unique(array_merge($this->columnList, $defaultColumn)); |
611 | 611 | |
612 | 612 | // add table name |
613 | - foreach($this->columnList as $no => $value) |
|
613 | + foreach ($this->columnList as $no => $value) |
|
614 | 614 | { |
615 | 615 | $this->columnList[$no] = 'documents.' . $value; |
616 | 616 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | function dispBoardTagList() |
623 | 623 | { |
624 | 624 | // check if there is not grant fot view list, then alert an warning message |
625 | - if(!$this->grant->list) |
|
625 | + if (!$this->grant->list) |
|
626 | 626 | { |
627 | 627 | return $this->dispBoardMessage('msg_not_permitted'); |
628 | 628 | } |
@@ -636,14 +636,14 @@ discard block |
||
636 | 636 | $output = $oTagModel->getTagList($obj); |
637 | 637 | |
638 | 638 | // automatically order |
639 | - if(count($output->data)) |
|
639 | + if (count($output->data)) |
|
640 | 640 | { |
641 | 641 | $numbers = array_keys($output->data); |
642 | 642 | shuffle($numbers); |
643 | 643 | |
644 | - if(count($output->data)) |
|
644 | + if (count($output->data)) |
|
645 | 645 | { |
646 | - foreach($numbers as $k => $v) |
|
646 | + foreach ($numbers as $k => $v) |
|
647 | 647 | { |
648 | 648 | $tag_list[] = $output->data[$v]; |
649 | 649 | } |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | function dispBoardWrite() |
665 | 665 | { |
666 | 666 | // check grant |
667 | - if(!$this->grant->write_document) |
|
667 | + if (!$this->grant->write_document) |
|
668 | 668 | { |
669 | 669 | return $this->dispBoardMessage('msg_not_permitted'); |
670 | 670 | } |
@@ -674,10 +674,10 @@ discard block |
||
674 | 674 | /** |
675 | 675 | * check if the category option is enabled not not |
676 | 676 | **/ |
677 | - if($this->module_info->use_category=='Y') |
|
677 | + if ($this->module_info->use_category == 'Y') |
|
678 | 678 | { |
679 | 679 | // get the user group information |
680 | - if(Context::get('is_logged')) |
|
680 | + if (Context::get('is_logged')) |
|
681 | 681 | { |
682 | 682 | $logged_info = Context::get('logged_info'); |
683 | 683 | $group_srls = array_keys($logged_info->group_list); |
@@ -690,19 +690,19 @@ discard block |
||
690 | 690 | |
691 | 691 | // check the grant after obtained the category list |
692 | 692 | $normal_category_list = $oDocumentModel->getCategoryList($this->module_srl); |
693 | - if(count($normal_category_list)) |
|
693 | + if (count($normal_category_list)) |
|
694 | 694 | { |
695 | - foreach($normal_category_list as $category_srl => $category) |
|
695 | + foreach ($normal_category_list as $category_srl => $category) |
|
696 | 696 | { |
697 | 697 | $is_granted = TRUE; |
698 | - if($category->group_srls) |
|
698 | + if ($category->group_srls) |
|
699 | 699 | { |
700 | - $category_group_srls = explode(',',$category->group_srls); |
|
700 | + $category_group_srls = explode(',', $category->group_srls); |
|
701 | 701 | $is_granted = FALSE; |
702 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
702 | + if (count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
703 | 703 | |
704 | 704 | } |
705 | - if($is_granted) $category_list[$category_srl] = $category; |
|
705 | + if ($is_granted) $category_list[$category_srl] = $category; |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | Context::set('category_list', $category_list); |
@@ -713,46 +713,46 @@ discard block |
||
713 | 713 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
714 | 714 | $oDocument->setDocument($document_srl); |
715 | 715 | |
716 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
716 | + if ($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
717 | 717 | $oDocument->add('module_srl', $this->module_srl); |
718 | 718 | |
719 | - if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
719 | + if ($oDocument->isExists() && $this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
720 | 720 | { |
721 | 721 | return new Object(-1, 'msg_protect_content'); |
722 | 722 | } |
723 | 723 | |
724 | 724 | // if the document is not granted, then back to the password input form |
725 | 725 | $oModuleModel = getModel('module'); |
726 | - if($oDocument->isExists()&&!$oDocument->isGranted()) |
|
726 | + if ($oDocument->isExists() && !$oDocument->isGranted()) |
|
727 | 727 | { |
728 | 728 | return $this->setTemplateFile('input_password_form'); |
729 | 729 | } |
730 | 730 | |
731 | - if(!$oDocument->isExists()) |
|
731 | + if (!$oDocument->isExists()) |
|
732 | 732 | { |
733 | - $point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl); |
|
733 | + $point_config = $oModuleModel->getModulePartConfig('point', $this->module_srl); |
|
734 | 734 | $logged_info = Context::get('logged_info'); |
735 | 735 | $oPointModel = getModel('point'); |
736 | 736 | $pointForInsert = $point_config["insert_document"]; |
737 | - if($pointForInsert < 0) |
|
737 | + if ($pointForInsert < 0) |
|
738 | 738 | { |
739 | - if( !$logged_info ) |
|
739 | + if (!$logged_info) |
|
740 | 740 | { |
741 | 741 | return $this->dispBoardMessage('msg_not_permitted'); |
742 | 742 | } |
743 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
743 | + else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert) < 0) |
|
744 | 744 | { |
745 | 745 | return $this->dispBoardMessage('msg_not_enough_point'); |
746 | 746 | } |
747 | 747 | } |
748 | 748 | } |
749 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
749 | + if (!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
750 | 750 | |
751 | 751 | $statusList = $this->_getStatusNameList($oDocumentModel); |
752 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
752 | + if (count($statusList) > 0) Context::set('status_list', $statusList); |
|
753 | 753 | |
754 | 754 | // get Document status config value |
755 | - Context::set('document_srl',$document_srl); |
|
755 | + Context::set('document_srl', $document_srl); |
|
756 | 756 | Context::set('oDocument', $oDocument); |
757 | 757 | |
758 | 758 | // apply xml_js_filter on header |
@@ -760,13 +760,13 @@ discard block |
||
760 | 760 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
761 | 761 | |
762 | 762 | // if the document exists, then setup extra variabels on context |
763 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
763 | + if ($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
764 | 764 | |
765 | 765 | /** |
766 | 766 | * add JS filters |
767 | 767 | **/ |
768 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
769 | - else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
768 | + if (Context::get('logged_info')->is_admin == 'Y') Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_admin.xml'); |
|
769 | + else Context::addJsFilter($this->module_path . 'tpl/filter', 'insert.xml'); |
|
770 | 770 | |
771 | 771 | $oSecurity = new Security(); |
772 | 772 | $oSecurity->encodeHTML('category_list.text', 'category_list.title'); |
@@ -777,14 +777,14 @@ discard block |
||
777 | 777 | function _getStatusNameList(&$oDocumentModel) |
778 | 778 | { |
779 | 779 | $resultList = array(); |
780 | - if(!empty($this->module_info->use_status)) |
|
780 | + if (!empty($this->module_info->use_status)) |
|
781 | 781 | { |
782 | 782 | $statusNameList = $oDocumentModel->getStatusNameList(); |
783 | 783 | $statusList = explode('|@|', $this->module_info->use_status); |
784 | 784 | |
785 | - if(is_array($statusList)) |
|
785 | + if (is_array($statusList)) |
|
786 | 786 | { |
787 | - foreach($statusList as $key => $value) |
|
787 | + foreach ($statusList as $key => $value) |
|
788 | 788 | { |
789 | 789 | $resultList[$value] = $statusNameList[$value]; |
790 | 790 | } |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | function dispBoardDelete() |
800 | 800 | { |
801 | 801 | // check grant |
802 | - if(!$this->grant->write_document) |
|
802 | + if (!$this->grant->write_document) |
|
803 | 803 | { |
804 | 804 | return $this->dispBoardMessage('msg_not_permitted'); |
805 | 805 | } |
@@ -808,35 +808,35 @@ discard block |
||
808 | 808 | $document_srl = Context::get('document_srl'); |
809 | 809 | |
810 | 810 | // if document exists, get the document information |
811 | - if($document_srl) |
|
811 | + if ($document_srl) |
|
812 | 812 | { |
813 | 813 | $oDocumentModel = getModel('document'); |
814 | 814 | $oDocument = $oDocumentModel->getDocument($document_srl); |
815 | 815 | } |
816 | 816 | |
817 | 817 | // if the document is not existed, then back to the board content page |
818 | - if(!$oDocument->isExists()) |
|
818 | + if (!$oDocument->isExists()) |
|
819 | 819 | { |
820 | 820 | return $this->dispBoardContent(); |
821 | 821 | } |
822 | 822 | |
823 | 823 | // if the document is not granted, then back to the password input form |
824 | - if(!$oDocument->isGranted()) |
|
824 | + if (!$oDocument->isGranted()) |
|
825 | 825 | { |
826 | 826 | return $this->setTemplateFile('input_password_form'); |
827 | 827 | } |
828 | 828 | |
829 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
829 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
830 | 830 | { |
831 | 831 | return $this->dispBoardMessage('msg_protect_content'); |
832 | 832 | } |
833 | 833 | |
834 | - Context::set('oDocument',$oDocument); |
|
834 | + Context::set('oDocument', $oDocument); |
|
835 | 835 | |
836 | 836 | /** |
837 | 837 | * add JS filters |
838 | 838 | **/ |
839 | - Context::addJsFilter($this->module_path.'tpl/filter', 'delete_document.xml'); |
|
839 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'delete_document.xml'); |
|
840 | 840 | |
841 | 841 | $this->setTemplateFile('delete_form'); |
842 | 842 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $document_srl = Context::get('document_srl'); |
850 | 850 | |
851 | 851 | // check grant |
852 | - if(!$this->grant->write_comment) |
|
852 | + if (!$this->grant->write_comment) |
|
853 | 853 | { |
854 | 854 | return $this->dispBoardMessage('msg_not_permitted'); |
855 | 855 | } |
@@ -857,13 +857,13 @@ discard block |
||
857 | 857 | // get the document information |
858 | 858 | $oDocumentModel = getModel('document'); |
859 | 859 | $oDocument = $oDocumentModel->getDocument($document_srl); |
860 | - if(!$oDocument->isExists()) |
|
860 | + if (!$oDocument->isExists()) |
|
861 | 861 | { |
862 | 862 | return $this->dispBoardMessage('msg_invalid_request'); |
863 | 863 | } |
864 | 864 | |
865 | 865 | // Check allow comment |
866 | - if(!$oDocument->allowComment()) |
|
866 | + if (!$oDocument->allowComment()) |
|
867 | 867 | { |
868 | 868 | return $this->dispBoardMessage('msg_not_allow_comment'); |
869 | 869 | } |
@@ -875,14 +875,14 @@ discard block |
||
875 | 875 | $oComment->add('module_srl', $this->module_srl); |
876 | 876 | |
877 | 877 | // setup document variables on context |
878 | - Context::set('oDocument',$oDocument); |
|
879 | - Context::set('oSourceComment',$oSourceComment); |
|
880 | - Context::set('oComment',$oComment); |
|
878 | + Context::set('oDocument', $oDocument); |
|
879 | + Context::set('oSourceComment', $oSourceComment); |
|
880 | + Context::set('oComment', $oComment); |
|
881 | 881 | |
882 | 882 | /** |
883 | 883 | * add JS filter |
884 | 884 | **/ |
885 | - Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); |
|
885 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_comment.xml'); |
|
886 | 886 | |
887 | 887 | $this->setTemplateFile('comment_form'); |
888 | 888 | } |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | function dispBoardReplyComment() |
894 | 894 | { |
895 | 895 | // check grant |
896 | - if(!$this->grant->write_comment) |
|
896 | + if (!$this->grant->write_comment) |
|
897 | 897 | { |
898 | 898 | return $this->dispBoardMessage('msg_not_permitted'); |
899 | 899 | } |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | $parent_srl = Context::get('comment_srl'); |
903 | 903 | |
904 | 904 | // if the parent comment is not existed |
905 | - if(!$parent_srl) |
|
905 | + if (!$parent_srl) |
|
906 | 906 | { |
907 | 907 | return new Object(-1, 'msg_invalid_request'); |
908 | 908 | } |
@@ -912,11 +912,11 @@ discard block |
||
912 | 912 | $oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager); |
913 | 913 | |
914 | 914 | // if the comment is not existed, opoup an error message |
915 | - if(!$oSourceComment->isExists()) |
|
915 | + if (!$oSourceComment->isExists()) |
|
916 | 916 | { |
917 | 917 | return $this->dispBoardMessage('msg_invalid_request'); |
918 | 918 | } |
919 | - if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
919 | + if (Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
920 | 920 | { |
921 | 921 | return $this->dispBoardMessage('msg_invalid_request'); |
922 | 922 | } |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | // Check allow comment |
925 | 925 | $oDocumentModel = getModel('document'); |
926 | 926 | $oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl')); |
927 | - if(!$oDocument->allowComment()) |
|
927 | + if (!$oDocument->allowComment()) |
|
928 | 928 | { |
929 | 929 | return $this->dispBoardMessage('msg_not_allow_comment'); |
930 | 930 | } |
@@ -935,14 +935,14 @@ discard block |
||
935 | 935 | $oComment->add('document_srl', $oSourceComment->get('document_srl')); |
936 | 936 | |
937 | 937 | // setup comment variables |
938 | - Context::set('oSourceComment',$oSourceComment); |
|
939 | - Context::set('oComment',$oComment); |
|
940 | - Context::set('module_srl',$this->module_info->module_srl); |
|
938 | + Context::set('oSourceComment', $oSourceComment); |
|
939 | + Context::set('oComment', $oComment); |
|
940 | + Context::set('module_srl', $this->module_info->module_srl); |
|
941 | 941 | |
942 | 942 | /** |
943 | 943 | * add JS filters |
944 | 944 | **/ |
945 | - Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); |
|
945 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_comment.xml'); |
|
946 | 946 | |
947 | 947 | $this->setTemplateFile('comment_form'); |
948 | 948 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | function dispBoardModifyComment() |
954 | 954 | { |
955 | 955 | // check grant |
956 | - if(!$this->grant->write_comment) |
|
956 | + if (!$this->grant->write_comment) |
|
957 | 957 | { |
958 | 958 | return $this->dispBoardMessage('msg_not_permitted'); |
959 | 959 | } |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | $comment_srl = Context::get('comment_srl'); |
964 | 964 | |
965 | 965 | // if the comment is not existed |
966 | - if(!$comment_srl) |
|
966 | + if (!$comment_srl) |
|
967 | 967 | { |
968 | 968 | return new Object(-1, 'msg_invalid_request'); |
969 | 969 | } |
@@ -973,13 +973,13 @@ discard block |
||
973 | 973 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
974 | 974 | |
975 | 975 | // if the comment is not exited, alert an error message |
976 | - if(!$oComment->isExists()) |
|
976 | + if (!$oComment->isExists()) |
|
977 | 977 | { |
978 | 978 | return $this->dispBoardMessage('msg_invalid_request'); |
979 | 979 | } |
980 | 980 | |
981 | 981 | // if the comment is not granted, then back to the password input form |
982 | - if(!$oComment->isGranted()) |
|
982 | + if (!$oComment->isGranted()) |
|
983 | 983 | { |
984 | 984 | return $this->setTemplateFile('input_password_form'); |
985 | 985 | } |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | /** |
992 | 992 | * add JS fitlers |
993 | 993 | **/ |
994 | - Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); |
|
994 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'insert_comment.xml'); |
|
995 | 995 | |
996 | 996 | $this->setTemplateFile('comment_form'); |
997 | 997 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | function dispBoardDeleteComment() |
1003 | 1003 | { |
1004 | 1004 | // check grant |
1005 | - if(!$this->grant->write_comment) |
|
1005 | + if (!$this->grant->write_comment) |
|
1006 | 1006 | { |
1007 | 1007 | return $this->dispBoardMessage('msg_not_permitted'); |
1008 | 1008 | } |
@@ -1011,30 +1011,30 @@ discard block |
||
1011 | 1011 | $comment_srl = Context::get('comment_srl'); |
1012 | 1012 | |
1013 | 1013 | // if the comment exists, then get the comment information |
1014 | - if($comment_srl) |
|
1014 | + if ($comment_srl) |
|
1015 | 1015 | { |
1016 | 1016 | $oCommentModel = getModel('comment'); |
1017 | 1017 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | // if the comment is not existed, then back to the board content page |
1021 | - if(!$oComment->isExists() ) |
|
1021 | + if (!$oComment->isExists()) |
|
1022 | 1022 | { |
1023 | 1023 | return $this->dispBoardContent(); |
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | // if the comment is not granted, then back to the password input form |
1027 | - if(!$oComment->isGranted()) |
|
1027 | + if (!$oComment->isGranted()) |
|
1028 | 1028 | { |
1029 | 1029 | return $this->setTemplateFile('input_password_form'); |
1030 | 1030 | } |
1031 | 1031 | |
1032 | - Context::set('oComment',$oComment); |
|
1032 | + Context::set('oComment', $oComment); |
|
1033 | 1033 | |
1034 | 1034 | /** |
1035 | 1035 | * add JS filters |
1036 | 1036 | **/ |
1037 | - Context::addJsFilter($this->module_path.'tpl/filter', 'delete_comment.xml'); |
|
1037 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'delete_comment.xml'); |
|
1038 | 1038 | |
1039 | 1039 | $this->setTemplateFile('delete_comment_form'); |
1040 | 1040 | } |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | { |
1047 | 1047 | $oTrackbackModel = getModel('trackback'); |
1048 | 1048 | |
1049 | - if(!$oTrackbackModel) |
|
1049 | + if (!$oTrackbackModel) |
|
1050 | 1050 | { |
1051 | 1051 | return; |
1052 | 1052 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | $trackback = $output->data; |
1061 | 1061 | |
1062 | 1062 | // if no trackback, then display the board content |
1063 | - if(!$trackback) |
|
1063 | + if (!$trackback) |
|
1064 | 1064 | { |
1065 | 1065 | return $this->dispBoardContent(); |
1066 | 1066 | } |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | /** |
1071 | 1071 | * add JS filters |
1072 | 1072 | **/ |
1073 | - Context::addJsFilter($this->module_path.'tpl/filter', 'delete_trackback.xml'); |
|
1073 | + Context::addJsFilter($this->module_path . 'tpl/filter', 'delete_trackback.xml'); |
|
1074 | 1074 | |
1075 | 1075 | $this->setTemplateFile('delete_trackback_form'); |
1076 | 1076 | } |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | function dispBoardMessage($msg_code) |
1082 | 1082 | { |
1083 | 1083 | $msg = Context::getLang($msg_code); |
1084 | - if(!$msg) $msg = $msg_code; |
|
1084 | + if (!$msg) $msg = $msg_code; |
|
1085 | 1085 | Context::set('message', $msg); |
1086 | 1086 | $this->setTemplateFile('message'); |
1087 | 1087 | } |
@@ -1092,8 +1092,8 @@ discard block |
||
1092 | 1092 | **/ |
1093 | 1093 | function alertMessage($message) |
1094 | 1094 | { |
1095 | - $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
1096 | - Context::addHtmlFooter( $script ); |
|
1095 | + $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
1096 | + Context::addHtmlFooter($script); |
|
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | } |
@@ -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 | } |
@@ -153,8 +149,9 @@ discard block |
||
153 | 149 | $oModuleModel = getModel('module'); |
154 | 150 | |
155 | 151 | $args = new StdClass(); |
156 | - if($eid_number>0) |
|
157 | - $args->idx = $eid_number; |
|
152 | + if($eid_number>0) { |
|
153 | + $args->idx = $eid_number; |
|
154 | + } |
|
158 | 155 | $args->module_srl = $oModuleModel->getModuleSrlByMid($mid); |
159 | 156 | $output = executeQueryArray('document.inEV2', $args); |
160 | 157 | Context::set('eid_list',$output->data); |
@@ -187,13 +184,17 @@ discard block |
||
187 | 184 | * add extra vaiables to the search options |
188 | 185 | **/ |
189 | 186 | // use search options on the template (the search options key has been declared, based on the language selected) |
190 | - foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
187 | + foreach($this->search_option as $opt) { |
|
188 | + $search_option[$opt] = Context::getLang($opt); |
|
189 | + } |
|
191 | 190 | $extra_keys = Context::get('extra_keys'); |
192 | 191 | if($extra_keys) |
193 | 192 | { |
194 | 193 | foreach($extra_keys as $key => $val) |
195 | 194 | { |
196 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
195 | + if($val->search == 'Y') { |
|
196 | + $search_option['extra_vars'.$val->idx] = $val->name; |
|
197 | + } |
|
197 | 198 | } |
198 | 199 | } |
199 | 200 | // remove a search option that is not public in member config |
@@ -202,8 +203,9 @@ discard block |
||
202 | 203 | { |
203 | 204 | if(in_array($signupFormElement->title, $search_option)) |
204 | 205 | { |
205 | - if($signupFormElement->isPublic == 'N') |
|
206 | - unset($search_option[$signupFormElement->name]); |
|
206 | + if($signupFormElement->isPublic == 'N') { |
|
207 | + unset($search_option[$signupFormElement->name]); |
|
208 | + } |
|
207 | 209 | } |
208 | 210 | } |
209 | 211 | Context::set('search_option', $search_option); |
@@ -221,7 +223,9 @@ discard block |
||
221 | 223 | // list config, columnList setting |
222 | 224 | $oBoardModel = getModel('board'); |
223 | 225 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
224 | - if(!$this->listConfig) $this->listConfig = array(); |
|
226 | + if(!$this->listConfig) { |
|
227 | + $this->listConfig = array(); |
|
228 | + } |
|
225 | 229 | $this->_makeListColumnList(); |
226 | 230 | |
227 | 231 | // display the notice list |
@@ -292,7 +296,9 @@ discard block |
||
292 | 296 | } |
293 | 297 | |
294 | 298 | // check the manage grant |
295 | - if($this->grant->manager) $oDocument->setGrant(); |
|
299 | + if($this->grant->manager) { |
|
300 | + $oDocument->setGrant(); |
|
301 | + } |
|
296 | 302 | |
297 | 303 | // if the consultation function is enabled, and the document is not a notice |
298 | 304 | if($this->consultation && !$oDocument->isNotice()) |
@@ -313,8 +319,7 @@ discard block |
||
313 | 319 | } |
314 | 320 | } |
315 | 321 | |
316 | - } |
|
317 | - else |
|
322 | + } else |
|
318 | 323 | { |
319 | 324 | // if the document is not existed, then alert a warning message |
320 | 325 | Context::set('document_srl','',true); |
@@ -324,8 +329,7 @@ discard block |
||
324 | 329 | /** |
325 | 330 | * if the document is not existed, get an empty document |
326 | 331 | **/ |
327 | - } |
|
328 | - else |
|
332 | + } else |
|
329 | 333 | { |
330 | 334 | $oDocument = $oDocumentModel->getDocument(0); |
331 | 335 | } |
@@ -340,8 +344,7 @@ discard block |
||
340 | 344 | $oDocument = $oDocumentModel->getDocument(0); |
341 | 345 | Context::set('document_srl','',true); |
342 | 346 | $this->alertMessage('msg_not_permitted'); |
343 | - } |
|
344 | - else |
|
347 | + } else |
|
345 | 348 | { |
346 | 349 | // add the document title to the browser |
347 | 350 | Context::addBrowserTitle($oDocument->getTitleText()); |
@@ -395,13 +398,16 @@ discard block |
||
395 | 398 | $downloadGrantCount = 0; |
396 | 399 | if(is_array($file_module_config->download_grant)) |
397 | 400 | { |
398 | - foreach($file_module_config->download_grant AS $value) |
|
399 | - if($value) $downloadGrantCount++; |
|
401 | + foreach($file_module_config->download_grant AS $value) { |
|
402 | + if($value) $downloadGrantCount++; |
|
403 | + } |
|
400 | 404 | } |
401 | 405 | |
402 | 406 | if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
403 | 407 | { |
404 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
408 | + if(!Context::get('is_logged')) { |
|
409 | + return $this->stop('msg_not_permitted_download'); |
|
410 | + } |
|
405 | 411 | $logged_info = Context::get('logged_info'); |
406 | 412 | if($logged_info->is_admin != 'Y') |
407 | 413 | { |
@@ -424,7 +430,9 @@ discard block |
||
424 | 430 | break; |
425 | 431 | } |
426 | 432 | } |
427 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
433 | + if(!$is_permitted) { |
|
434 | + return $this->stop('msg_not_permitted_download'); |
|
435 | + } |
|
428 | 436 | } |
429 | 437 | } |
430 | 438 | } |
@@ -587,7 +595,9 @@ discard block |
||
587 | 595 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
588 | 596 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
589 | 597 | |
590 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
598 | + if(in_array('summary', $configColumList)) { |
|
599 | + array_push($this->columnList, 'content'); |
|
600 | + } |
|
591 | 601 | |
592 | 602 | // default column list add |
593 | 603 | $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'); |
@@ -681,8 +691,7 @@ discard block |
||
681 | 691 | { |
682 | 692 | $logged_info = Context::get('logged_info'); |
683 | 693 | $group_srls = array_keys($logged_info->group_list); |
684 | - } |
|
685 | - else |
|
694 | + } else |
|
686 | 695 | { |
687 | 696 | $group_srls = array(); |
688 | 697 | } |
@@ -699,10 +708,14 @@ discard block |
||
699 | 708 | { |
700 | 709 | $category_group_srls = explode(',',$category->group_srls); |
701 | 710 | $is_granted = FALSE; |
702 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
711 | + if(count(array_intersect($group_srls, $category_group_srls))) { |
|
712 | + $is_granted = TRUE; |
|
713 | + } |
|
703 | 714 | |
704 | 715 | } |
705 | - if($is_granted) $category_list[$category_srl] = $category; |
|
716 | + if($is_granted) { |
|
717 | + $category_list[$category_srl] = $category; |
|
718 | + } |
|
706 | 719 | } |
707 | 720 | } |
708 | 721 | Context::set('category_list', $category_list); |
@@ -713,7 +726,9 @@ discard block |
||
713 | 726 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
714 | 727 | $oDocument->setDocument($document_srl); |
715 | 728 | |
716 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
729 | + if($oDocument->get('module_srl') == $oDocument->get('member_srl')) { |
|
730 | + $savedDoc = TRUE; |
|
731 | + } |
|
717 | 732 | $oDocument->add('module_srl', $this->module_srl); |
718 | 733 | |
719 | 734 | if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
@@ -739,17 +754,20 @@ discard block |
||
739 | 754 | if( !$logged_info ) |
740 | 755 | { |
741 | 756 | return $this->dispBoardMessage('msg_not_permitted'); |
742 | - } |
|
743 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
757 | + } else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
744 | 758 | { |
745 | 759 | return $this->dispBoardMessage('msg_not_enough_point'); |
746 | 760 | } |
747 | 761 | } |
748 | 762 | } |
749 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
763 | + if(!$oDocument->get('status')) { |
|
764 | + $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
765 | + } |
|
750 | 766 | |
751 | 767 | $statusList = $this->_getStatusNameList($oDocumentModel); |
752 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
768 | + if(count($statusList) > 0) { |
|
769 | + Context::set('status_list', $statusList); |
|
770 | + } |
|
753 | 771 | |
754 | 772 | // get Document status config value |
755 | 773 | Context::set('document_srl',$document_srl); |
@@ -760,13 +778,18 @@ discard block |
||
760 | 778 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
761 | 779 | |
762 | 780 | // if the document exists, then setup extra variabels on context |
763 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
781 | + if($oDocument->isExists() && !$savedDoc) { |
|
782 | + Context::set('extra_keys', $oDocument->getExtraVars()); |
|
783 | + } |
|
764 | 784 | |
765 | 785 | /** |
766 | 786 | * add JS filters |
767 | 787 | **/ |
768 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
769 | - else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
788 | + if(Context::get('logged_info')->is_admin=='Y') { |
|
789 | + Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
790 | + } else { |
|
791 | + Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
792 | + } |
|
770 | 793 | |
771 | 794 | $oSecurity = new Security(); |
772 | 795 | $oSecurity->encodeHTML('category_list.text', 'category_list.title'); |
@@ -1081,7 +1104,9 @@ discard block |
||
1081 | 1104 | function dispBoardMessage($msg_code) |
1082 | 1105 | { |
1083 | 1106 | $msg = Context::getLang($msg_code); |
1084 | - if(!$msg) $msg = $msg_code; |
|
1107 | + if(!$msg) { |
|
1108 | + $msg = $msg_code; |
|
1109 | + } |
|
1085 | 1110 | Context::set('message', $msg); |
1086 | 1111 | $this->setTemplateFile('message'); |
1087 | 1112 | } |
@@ -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(); |
@@ -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 |
@@ -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 | } |
@@ -314,14 +314,14 @@ discard block |
||
314 | 314 | { |
315 | 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 | } |
@@ -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 | } |
@@ -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 | { |
@@ -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 | - $obj->homepage = 'http://'.$obj->homepage; |
|
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,14 +528,14 @@ 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 | 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'); |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | <br />Comment: |
550 | 550 | <br />\"" . $obj->content . "\" |
551 | 551 | <br />Document: |
552 | - <br />\"" . $oDocument->getContentText(). "\" |
|
552 | + <br />\"" . $oDocument->getContentText() . "\" |
|
553 | 553 | <br /> |
554 | 554 | <br /> |
555 | 555 | Approve it: <a href=\"" . $url_approve . "\">" . $url_approve . "</a> |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | <br />Comment: |
569 | 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 | - $obj->homepage = 'http://'.$obj->homepage; |
|
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 == $oComment->get('member_srl')) |
|
1069 | + if ($member_srl && $member_srl == $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 == $oComment->get('member_srl')) |
|
1205 | + if ($member_srl && $member_srl == $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 | } |
@@ -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(); |
@@ -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 @@ |
||
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 | } |
@@ -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 | { |
@@ -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,23 +148,23 @@ 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 | 169 | $source_message->title = "[re] " . $source_message->title; |
170 | 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>"; |
@@ -173,7 +173,7 @@ discard block |
||
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 | } |
@@ -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 | } |
@@ -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,11 +180,11 @@ 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 != 'regdate') |
|
187 | + if ($key != 'regdate') |
|
188 | 188 | { |
189 | 189 | $message->{$key} = $val; |
190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | // change the status if is a received and not yet read message |
195 | - if($message->message_type == 'R' && $message->readed != 'Y') |
|
195 | + if ($message->message_type == 'R' && $message->readed != 'Y') |
|
196 | 196 | { |
197 | 197 | $oCommunicationController = getController('communication'); |
198 | 198 | $oCommunicationController->setMessageReaded($message_srl); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $args->readed = 'N'; |
216 | 216 | |
217 | 217 | $output = executeQuery('communication.getNewMessage', $args, $columnList); |
218 | - if(!count($output->data)) |
|
218 | + if (!count($output->data)) |
|
219 | 219 | { |
220 | 220 | return; |
221 | 221 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $logged_info = Context::get('logged_info'); |
240 | 240 | $args = new stdClass(); |
241 | 241 | |
242 | - switch($message_type) |
|
242 | + switch ($message_type) |
|
243 | 243 | { |
244 | 244 | case 'R' : |
245 | 245 | $args->member_srl = $logged_info->member_srl; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $output = executeQueryArray('communication.getFriendGroups', $args); |
345 | 345 | |
346 | 346 | $group_list = $output->data; |
347 | - if(!$group_list) |
|
347 | + if (!$group_list) |
|
348 | 348 | { |
349 | 349 | return; |
350 | 350 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | |
368 | 368 | $output = executeQuery('communication.isAddedFriend', $args); |
369 | 369 | |
370 | - if($output->data->count) |
|
370 | + if ($output->data->count) |
|
371 | 371 | { |
372 | 372 | return TRUE; |
373 | 373 | } |
@@ -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 | } |
@@ -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 | { |
@@ -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,7 +151,7 @@ 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); |
@@ -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,23 +188,23 @@ 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 | 209 | $source_message->title = "[re] " . $source_message->title; |
210 | 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>"; |
@@ -213,7 +213,7 @@ discard block |
||
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,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 | } |