@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | function getPollList($args) |
21 | 21 | { |
22 | 22 | $output = executeQueryArray('poll.getPollList', $args); |
23 | - if(!$output->toBool()) return $output; |
|
23 | + if(!$output->toBool()) { |
|
24 | + return $output; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | //if($output->data && !is_array($output->data)) $output->data = array($output->data); |
26 | 28 | return $output; |
@@ -32,7 +34,9 @@ discard block |
||
32 | 34 | function getPollListWithMember($args) |
33 | 35 | { |
34 | 36 | $output = executeQueryArray('poll.getPollListWithMember', $args); |
35 | - if(!$output->toBool()) return $output; |
|
37 | + if(!$output->toBool()) { |
|
38 | + return $output; |
|
39 | + } |
|
36 | 40 | |
37 | 41 | return $output; |
38 | 42 | } |
@@ -50,18 +54,20 @@ discard block |
||
50 | 54 | |
51 | 55 | $oDocument = $oDocumentModel->getDocument($upload_target_srl); |
52 | 56 | |
53 | - if(!$oDocument->isExists()) $oComment = $oCommentModel->getComment($upload_target_srl); |
|
57 | + if(!$oDocument->isExists()) { |
|
58 | + $oComment = $oCommentModel->getComment($upload_target_srl); |
|
59 | + } |
|
54 | 60 | |
55 | 61 | if($oComment && $oComment->isExists()) |
56 | 62 | { |
57 | 63 | $this->add('document_srl', $oComment->get('document_srl')); |
58 | 64 | $this->add('comment_srl', $oComment->get('comment_srl')); |
59 | - } |
|
60 | - elseif($oDocument->isExists()) |
|
65 | + } elseif($oDocument->isExists()) |
|
61 | 66 | { |
62 | 67 | $this->add('document_srl', $oDocument->get('document_srl')); |
68 | + } else { |
|
69 | + return new BaseObject(-1, 'msg_not_founded'); |
|
63 | 70 | } |
64 | - else return new BaseObject(-1, 'msg_not_founded'); |
|
65 | 71 | } |
66 | 72 | } |
67 | 73 | /* End of file poll.admin.model.php */ |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | function procPollInsert() |
21 | 21 | { |
22 | 22 | $stop_date = Context::get('stop_date'); |
23 | - if($stop_date < date('Ymd')) |
|
23 | + if ($stop_date < date('Ymd')) |
|
24 | 24 | { |
25 | - $stop_date = date('YmdHis', $_SERVER['REQUEST_TIME']+60*60*24*365); |
|
25 | + $stop_date = date('YmdHis', $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $logged_info = Context::get('logged_info'); |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | unset($vars->error_return_url); |
35 | 35 | unset($vars->stop_date); |
36 | 36 | |
37 | - foreach($vars as $key => $val) |
|
37 | + foreach ($vars as $key => $val) |
|
38 | 38 | { |
39 | - if(stripos($key, 'tidx')) |
|
39 | + if (stripos($key, 'tidx')) |
|
40 | 40 | { |
41 | 41 | continue; |
42 | 42 | } |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | $tmp_arr = explode('_', $key); |
45 | 45 | |
46 | 46 | $poll_index = $tmp_arr[1]; |
47 | - if(!$poll_index) |
|
47 | + if (!$poll_index) |
|
48 | 48 | { |
49 | 49 | continue; |
50 | 50 | } |
51 | 51 | |
52 | - if(!trim($val)) |
|
52 | + if (!trim($val)) |
|
53 | 53 | { |
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | |
57 | - if($tmp_args[$poll_index] == NULL) |
|
57 | + if ($tmp_args[$poll_index] == NULL) |
|
58 | 58 | { |
59 | 59 | $tmp_args[$poll_index] = new stdClass; |
60 | 60 | } |
61 | 61 | |
62 | - if(!is_array($tmp_args[$poll_index]->item)) |
|
62 | + if (!is_array($tmp_args[$poll_index]->item)) |
|
63 | 63 | { |
64 | 64 | $tmp_args[$poll_index]->item = array(); |
65 | 65 | } |
66 | 66 | |
67 | - if($logged_info->is_admin != 'Y') |
|
67 | + if ($logged_info->is_admin != 'Y') |
|
68 | 68 | { |
69 | 69 | $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
70 | 70 | } |
71 | 71 | |
72 | - switch($tmp_arr[0]) |
|
72 | + switch ($tmp_arr[0]) |
|
73 | 73 | { |
74 | 74 | case 'title': |
75 | 75 | $tmp_args[$poll_index]->title = $val; |
@@ -83,26 +83,26 @@ discard block |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - foreach($tmp_args as $key => $val) |
|
86 | + foreach ($tmp_args as $key => $val) |
|
87 | 87 | { |
88 | - if(!$val->checkcount) |
|
88 | + if (!$val->checkcount) |
|
89 | 89 | { |
90 | 90 | $val->checkcount = 1; |
91 | 91 | } |
92 | 92 | |
93 | - if($val->title && count($val->item)) |
|
93 | + if ($val->title && count($val->item)) |
|
94 | 94 | { |
95 | 95 | $args->poll[] = $val; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - if(!count($args->poll)) return new BaseObject(-1, 'cmd_null_item'); |
|
99 | + if (!count($args->poll)) return new BaseObject(-1, 'cmd_null_item'); |
|
100 | 100 | |
101 | 101 | $args->stop_date = $stop_date; |
102 | 102 | |
103 | 103 | // Configure the variables |
104 | 104 | $poll_srl = getNextSequence(); |
105 | - $member_srl = $logged_info->member_srl?$logged_info->member_srl:0; |
|
105 | + $member_srl = $logged_info->member_srl ? $logged_info->member_srl : 0; |
|
106 | 106 | |
107 | 107 | $oDB = &DB::getInstance(); |
108 | 108 | $oDB->begin(); |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | $poll_args = new stdClass; |
112 | 112 | $poll_args->poll_srl = $poll_srl; |
113 | 113 | $poll_args->member_srl = $member_srl; |
114 | - $poll_args->list_order = $poll_srl*-1; |
|
114 | + $poll_args->list_order = $poll_srl * -1; |
|
115 | 115 | $poll_args->stop_date = $args->stop_date; |
116 | 116 | $poll_args->poll_count = 0; |
117 | 117 | $output = executeQuery('poll.insertPoll', $poll_args); |
118 | - if(!$output->toBool()) |
|
118 | + if (!$output->toBool()) |
|
119 | 119 | { |
120 | 120 | $oDB->rollback(); |
121 | 121 | return $output; |
122 | 122 | } |
123 | 123 | |
124 | 124 | // Individual poll registration |
125 | - foreach($args->poll as $key => $val) |
|
125 | + foreach ($args->poll as $key => $val) |
|
126 | 126 | { |
127 | 127 | $title_args = new stdClass; |
128 | 128 | $title_args->poll_srl = $poll_srl; |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | $title_args->member_srl = $member_srl; |
135 | 135 | $title_args->upload_target_srl = $upload_target_srl; |
136 | 136 | $output = executeQuery('poll.insertPollTitle', $title_args); |
137 | - if(!$output->toBool()) |
|
137 | + if (!$output->toBool()) |
|
138 | 138 | { |
139 | 139 | $oDB->rollback(); |
140 | 140 | return $output; |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Add the individual survey items |
144 | - foreach($val->item as $k => $v) |
|
144 | + foreach ($val->item as $k => $v) |
|
145 | 145 | { |
146 | 146 | $item_args = new stdClass; |
147 | 147 | $item_args->poll_srl = $poll_srl; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $item_args->poll_count = 0; |
151 | 151 | $item_args->upload_target_srl = $upload_target_srl; |
152 | 152 | $output = executeQuery('poll.insertPollItem', $item_args); |
153 | - if(!$output->toBool()) |
|
153 | + if (!$output->toBool()) |
|
154 | 154 | { |
155 | 155 | $oDB->rollback(); |
156 | 156 | return $output; |
@@ -171,19 +171,19 @@ discard block |
||
171 | 171 | { |
172 | 172 | $poll_srl = Context::get('poll_srl'); |
173 | 173 | $poll_srl_indexes = Context::get('poll_srl_indexes'); |
174 | - $tmp_item_srls = explode(',',$poll_srl_indexes); |
|
175 | - for($i=0;$i<count($tmp_item_srls);$i++) |
|
174 | + $tmp_item_srls = explode(',', $poll_srl_indexes); |
|
175 | + for ($i = 0; $i < count($tmp_item_srls); $i++) |
|
176 | 176 | { |
177 | - $srl = (int)trim($tmp_item_srls[$i]); |
|
178 | - if(!$srl) continue; |
|
177 | + $srl = (int) trim($tmp_item_srls[$i]); |
|
178 | + if (!$srl) continue; |
|
179 | 179 | $item_srls[] = $srl; |
180 | 180 | } |
181 | 181 | |
182 | 182 | // If there is no response item, display an error |
183 | - if(!count($item_srls)) return new BaseObject(-1, 'msg_check_poll_item'); |
|
183 | + if (!count($item_srls)) return new BaseObject(-1, 'msg_check_poll_item'); |
|
184 | 184 | // Make sure is the poll has already been taken |
185 | 185 | $oPollModel = getModel('poll'); |
186 | - if($oPollModel->isPolled($poll_srl)) return new BaseObject(-1, 'msg_already_poll'); |
|
186 | + if ($oPollModel->isPolled($poll_srl)) return new BaseObject(-1, 'msg_already_poll'); |
|
187 | 187 | |
188 | 188 | $oDB = &DB::getInstance(); |
189 | 189 | $oDB->begin(); |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | // Update all poll responses related to the post |
194 | 194 | $output = executeQuery('poll.updatePoll', $args); |
195 | 195 | $output = executeQuery('poll.updatePollTitle', $args); |
196 | - if(!$output->toBool()) |
|
196 | + if (!$output->toBool()) |
|
197 | 197 | { |
198 | 198 | $oDB->rollback(); |
199 | 199 | return $output; |
200 | 200 | } |
201 | 201 | // Record each polls selected items |
202 | - $args->poll_item_srl = implode(',',$item_srls); |
|
202 | + $args->poll_item_srl = implode(',', $item_srls); |
|
203 | 203 | $output = executeQuery('poll.updatePollItems', $args); |
204 | - if(!$output->toBool()) |
|
204 | + if (!$output->toBool()) |
|
205 | 205 | { |
206 | 206 | $oDB->rollback(); |
207 | 207 | return $output; |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | $log_args->poll_srl = $poll_srl; |
212 | 212 | |
213 | 213 | $logged_info = Context::get('logged_info'); |
214 | - $member_srl = $logged_info->member_srl?$logged_info->member_srl:0; |
|
214 | + $member_srl = $logged_info->member_srl ? $logged_info->member_srl : 0; |
|
215 | 215 | |
216 | 216 | $log_args->member_srl = $member_srl; |
217 | 217 | $log_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
218 | 218 | $output = executeQuery('poll.insertPollLog', $log_args); |
219 | - if(!$output->toBool()) |
|
219 | + if (!$output->toBool()) |
|
220 | 220 | { |
221 | 221 | $oDB->rollback(); |
222 | 222 | return $output; |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | $oDB->commit(); |
226 | 226 | |
227 | 227 | $skin = Context::get('skin'); |
228 | - if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
228 | + if (!$skin || !is_dir(_XE_PATH_.'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
229 | 229 | // Get tpl |
230 | 230 | $tpl = $oPollModel->getPollHtml($poll_srl, '', $skin); |
231 | 231 | |
232 | 232 | $this->add('poll_srl', $poll_srl); |
233 | - $this->add('tpl',$tpl); |
|
233 | + $this->add('tpl', $tpl); |
|
234 | 234 | $this->setMessage('success_poll'); |
235 | 235 | |
236 | 236 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminConfig'); |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | $poll_srl = Context::get('poll_srl'); |
246 | 246 | |
247 | 247 | $skin = Context::get('skin'); |
248 | - if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
248 | + if (!$skin || !is_dir(_XE_PATH_.'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
249 | 249 | |
250 | 250 | $oPollModel = getModel('poll'); |
251 | 251 | $tpl = $oPollModel->getPollResultHtml($poll_srl, $skin); |
252 | 252 | |
253 | 253 | $this->add('poll_srl', $poll_srl); |
254 | - $this->add('tpl',$tpl); |
|
254 | + $this->add('tpl', $tpl); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | */ |
260 | 260 | function procPollGetList() |
261 | 261 | { |
262 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
262 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
263 | 263 | $pollSrls = Context::get('poll_srls'); |
264 | - if($pollSrls) $pollSrlList = explode(',', $pollSrls); |
|
264 | + if ($pollSrls) $pollSrlList = explode(',', $pollSrls); |
|
265 | 265 | |
266 | 266 | global $lang; |
267 | - if(count($pollSrlList) > 0) |
|
267 | + if (count($pollSrlList) > 0) |
|
268 | 268 | { |
269 | 269 | $oPollAdminModel = getAdminModel('poll'); |
270 | 270 | $args = new stdClass; |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | $output = $oPollAdminModel->getPollListWithMember($args); |
273 | 273 | $pollList = $output->data; |
274 | 274 | |
275 | - if(is_array($pollList)) |
|
275 | + if (is_array($pollList)) |
|
276 | 276 | { |
277 | - foreach($pollList AS $key=>$value) |
|
277 | + foreach ($pollList AS $key=>$value) |
|
278 | 278 | { |
279 | - if($value->checkcount == 1) $value->checkName = $lang->single_check; |
|
279 | + if ($value->checkcount == 1) $value->checkName = $lang->single_check; |
|
280 | 280 | else $value->checkName = $lang->multi_check; |
281 | 281 | } |
282 | 282 | } |
@@ -332,29 +332,29 @@ discard block |
||
332 | 332 | function triggerDeleteDocumentPoll(&$obj) |
333 | 333 | { |
334 | 334 | $document_srl = $obj->document_srl; |
335 | - if(!$document_srl) return new BaseObject(); |
|
335 | + if (!$document_srl) return new BaseObject(); |
|
336 | 336 | // Get the poll |
337 | 337 | $args = new stdClass(); |
338 | 338 | $args->upload_target_srl = $document_srl; |
339 | 339 | $output = executeQuery('poll.getPollByTargetSrl', $args); |
340 | - if(!$output->data) return new BaseObject(); |
|
340 | + if (!$output->data) return new BaseObject(); |
|
341 | 341 | |
342 | 342 | $poll_srl = $output->data->poll_srl; |
343 | - if(!$poll_srl) return new BaseObject(); |
|
343 | + if (!$poll_srl) return new BaseObject(); |
|
344 | 344 | |
345 | 345 | $args->poll_srl = $poll_srl; |
346 | 346 | |
347 | 347 | $output = executeQuery('poll.deletePoll', $args); |
348 | - if(!$output->toBool()) return $output; |
|
348 | + if (!$output->toBool()) return $output; |
|
349 | 349 | |
350 | 350 | $output = executeQuery('poll.deletePollItem', $args); |
351 | - if(!$output->toBool()) return $output; |
|
351 | + if (!$output->toBool()) return $output; |
|
352 | 352 | |
353 | 353 | $output = executeQuery('poll.deletePollTitle', $args); |
354 | - if(!$output->toBool()) return $output; |
|
354 | + if (!$output->toBool()) return $output; |
|
355 | 355 | |
356 | 356 | $output = executeQuery('poll.deletePollLog', $args); |
357 | - if(!$output->toBool()) return $output; |
|
357 | + if (!$output->toBool()) return $output; |
|
358 | 358 | |
359 | 359 | return new BaseObject(); |
360 | 360 | } |
@@ -365,29 +365,29 @@ discard block |
||
365 | 365 | function triggerDeleteCommentPoll(&$obj) |
366 | 366 | { |
367 | 367 | $comment_srl = $obj->comment_srl; |
368 | - if(!$comment_srl) return new BaseObject(); |
|
368 | + if (!$comment_srl) return new BaseObject(); |
|
369 | 369 | // Get the poll |
370 | 370 | $args = new stdClass(); |
371 | 371 | $args->upload_target_srl = $comment_srl; |
372 | 372 | $output = executeQuery('poll.getPollByTargetSrl', $args); |
373 | - if(!$output->data) return new BaseObject(); |
|
373 | + if (!$output->data) return new BaseObject(); |
|
374 | 374 | |
375 | 375 | $poll_srl = $output->data->poll_srl; |
376 | - if(!$poll_srl) return new BaseObject(); |
|
376 | + if (!$poll_srl) return new BaseObject(); |
|
377 | 377 | |
378 | 378 | $args->poll_srl = $poll_srl; |
379 | 379 | |
380 | 380 | $output = executeQuery('poll.deletePoll', $args); |
381 | - if(!$output->toBool()) return $output; |
|
381 | + if (!$output->toBool()) return $output; |
|
382 | 382 | |
383 | 383 | $output = executeQuery('poll.deletePollItem', $args); |
384 | - if(!$output->toBool()) return $output; |
|
384 | + if (!$output->toBool()) return $output; |
|
385 | 385 | |
386 | 386 | $output = executeQuery('poll.deletePollTitle', $args); |
387 | - if(!$output->toBool()) return $output; |
|
387 | + if (!$output->toBool()) return $output; |
|
388 | 388 | |
389 | 389 | $output = executeQuery('poll.deletePollLog', $args); |
390 | - if(!$output->toBool()) return $output; |
|
390 | + if (!$output->toBool()) return $output; |
|
391 | 391 | |
392 | 392 | return new BaseObject(); |
393 | 393 | } |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | */ |
398 | 398 | function syncPoll($upload_target_srl, $content) |
399 | 399 | { |
400 | - $match_cnt = preg_match_all('!<img([^\>]*)poll_srl=(["\']?)([0-9]*)(["\']?)([^\>]*?)\>!is',$content, $matches); |
|
401 | - for($i=0;$i<$match_cnt;$i++) |
|
400 | + $match_cnt = preg_match_all('!<img([^\>]*)poll_srl=(["\']?)([0-9]*)(["\']?)([^\>]*?)\>!is', $content, $matches); |
|
401 | + for ($i = 0; $i < $match_cnt; $i++) |
|
402 | 402 | { |
403 | 403 | $poll_srl = $matches[3][$i]; |
404 | 404 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $output = executeQuery('poll.getPoll', $args); |
408 | 408 | $poll = $output->data; |
409 | 409 | |
410 | - if($poll->upload_target_srl) continue; |
|
410 | + if ($poll->upload_target_srl) continue; |
|
411 | 411 | |
412 | 412 | $args->upload_target_srl = $upload_target_srl; |
413 | 413 | $output = executeQuery('poll.updatePollTarget', $args); |
@@ -96,7 +96,9 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - if(!count($args->poll)) return new BaseObject(-1, 'cmd_null_item'); |
|
99 | + if(!count($args->poll)) { |
|
100 | + return new BaseObject(-1, 'cmd_null_item'); |
|
101 | + } |
|
100 | 102 | |
101 | 103 | $args->stop_date = $stop_date; |
102 | 104 | |
@@ -175,15 +177,21 @@ discard block |
||
175 | 177 | for($i=0;$i<count($tmp_item_srls);$i++) |
176 | 178 | { |
177 | 179 | $srl = (int)trim($tmp_item_srls[$i]); |
178 | - if(!$srl) continue; |
|
180 | + if(!$srl) { |
|
181 | + continue; |
|
182 | + } |
|
179 | 183 | $item_srls[] = $srl; |
180 | 184 | } |
181 | 185 | |
182 | 186 | // If there is no response item, display an error |
183 | - if(!count($item_srls)) return new BaseObject(-1, 'msg_check_poll_item'); |
|
187 | + if(!count($item_srls)) { |
|
188 | + return new BaseObject(-1, 'msg_check_poll_item'); |
|
189 | + } |
|
184 | 190 | // Make sure is the poll has already been taken |
185 | 191 | $oPollModel = getModel('poll'); |
186 | - if($oPollModel->isPolled($poll_srl)) return new BaseObject(-1, 'msg_already_poll'); |
|
192 | + if($oPollModel->isPolled($poll_srl)) { |
|
193 | + return new BaseObject(-1, 'msg_already_poll'); |
|
194 | + } |
|
187 | 195 | |
188 | 196 | $oDB = &DB::getInstance(); |
189 | 197 | $oDB->begin(); |
@@ -225,7 +233,9 @@ discard block |
||
225 | 233 | $oDB->commit(); |
226 | 234 | |
227 | 235 | $skin = Context::get('skin'); |
228 | - if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
236 | + if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) { |
|
237 | + $skin = 'default'; |
|
238 | + } |
|
229 | 239 | // Get tpl |
230 | 240 | $tpl = $oPollModel->getPollHtml($poll_srl, '', $skin); |
231 | 241 | |
@@ -245,7 +255,9 @@ discard block |
||
245 | 255 | $poll_srl = Context::get('poll_srl'); |
246 | 256 | |
247 | 257 | $skin = Context::get('skin'); |
248 | - if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
258 | + if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) { |
|
259 | + $skin = 'default'; |
|
260 | + } |
|
249 | 261 | |
250 | 262 | $oPollModel = getModel('poll'); |
251 | 263 | $tpl = $oPollModel->getPollResultHtml($poll_srl, $skin); |
@@ -259,9 +271,13 @@ discard block |
||
259 | 271 | */ |
260 | 272 | function procPollGetList() |
261 | 273 | { |
262 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
274 | + if(!Context::get('is_logged')) { |
|
275 | + return new BaseObject(-1,'msg_not_permitted'); |
|
276 | + } |
|
263 | 277 | $pollSrls = Context::get('poll_srls'); |
264 | - if($pollSrls) $pollSrlList = explode(',', $pollSrls); |
|
278 | + if($pollSrls) { |
|
279 | + $pollSrlList = explode(',', $pollSrls); |
|
280 | + } |
|
265 | 281 | |
266 | 282 | global $lang; |
267 | 283 | if(count($pollSrlList) > 0) |
@@ -276,12 +292,14 @@ discard block |
||
276 | 292 | { |
277 | 293 | foreach($pollList AS $key=>$value) |
278 | 294 | { |
279 | - if($value->checkcount == 1) $value->checkName = $lang->single_check; |
|
280 | - else $value->checkName = $lang->multi_check; |
|
295 | + if($value->checkcount == 1) { |
|
296 | + $value->checkName = $lang->single_check; |
|
297 | + } else { |
|
298 | + $value->checkName = $lang->multi_check; |
|
299 | + } |
|
281 | 300 | } |
282 | 301 | } |
283 | - } |
|
284 | - else |
|
302 | + } else |
|
285 | 303 | { |
286 | 304 | $pollList = array(); |
287 | 305 | $this->setMessage($lang->no_documents); |
@@ -332,29 +350,43 @@ discard block |
||
332 | 350 | function triggerDeleteDocumentPoll(&$obj) |
333 | 351 | { |
334 | 352 | $document_srl = $obj->document_srl; |
335 | - if(!$document_srl) return new BaseObject(); |
|
353 | + if(!$document_srl) { |
|
354 | + return new BaseObject(); |
|
355 | + } |
|
336 | 356 | // Get the poll |
337 | 357 | $args = new stdClass(); |
338 | 358 | $args->upload_target_srl = $document_srl; |
339 | 359 | $output = executeQuery('poll.getPollByTargetSrl', $args); |
340 | - if(!$output->data) return new BaseObject(); |
|
360 | + if(!$output->data) { |
|
361 | + return new BaseObject(); |
|
362 | + } |
|
341 | 363 | |
342 | 364 | $poll_srl = $output->data->poll_srl; |
343 | - if(!$poll_srl) return new BaseObject(); |
|
365 | + if(!$poll_srl) { |
|
366 | + return new BaseObject(); |
|
367 | + } |
|
344 | 368 | |
345 | 369 | $args->poll_srl = $poll_srl; |
346 | 370 | |
347 | 371 | $output = executeQuery('poll.deletePoll', $args); |
348 | - if(!$output->toBool()) return $output; |
|
372 | + if(!$output->toBool()) { |
|
373 | + return $output; |
|
374 | + } |
|
349 | 375 | |
350 | 376 | $output = executeQuery('poll.deletePollItem', $args); |
351 | - if(!$output->toBool()) return $output; |
|
377 | + if(!$output->toBool()) { |
|
378 | + return $output; |
|
379 | + } |
|
352 | 380 | |
353 | 381 | $output = executeQuery('poll.deletePollTitle', $args); |
354 | - if(!$output->toBool()) return $output; |
|
382 | + if(!$output->toBool()) { |
|
383 | + return $output; |
|
384 | + } |
|
355 | 385 | |
356 | 386 | $output = executeQuery('poll.deletePollLog', $args); |
357 | - if(!$output->toBool()) return $output; |
|
387 | + if(!$output->toBool()) { |
|
388 | + return $output; |
|
389 | + } |
|
358 | 390 | |
359 | 391 | return new BaseObject(); |
360 | 392 | } |
@@ -365,29 +397,43 @@ discard block |
||
365 | 397 | function triggerDeleteCommentPoll(&$obj) |
366 | 398 | { |
367 | 399 | $comment_srl = $obj->comment_srl; |
368 | - if(!$comment_srl) return new BaseObject(); |
|
400 | + if(!$comment_srl) { |
|
401 | + return new BaseObject(); |
|
402 | + } |
|
369 | 403 | // Get the poll |
370 | 404 | $args = new stdClass(); |
371 | 405 | $args->upload_target_srl = $comment_srl; |
372 | 406 | $output = executeQuery('poll.getPollByTargetSrl', $args); |
373 | - if(!$output->data) return new BaseObject(); |
|
407 | + if(!$output->data) { |
|
408 | + return new BaseObject(); |
|
409 | + } |
|
374 | 410 | |
375 | 411 | $poll_srl = $output->data->poll_srl; |
376 | - if(!$poll_srl) return new BaseObject(); |
|
412 | + if(!$poll_srl) { |
|
413 | + return new BaseObject(); |
|
414 | + } |
|
377 | 415 | |
378 | 416 | $args->poll_srl = $poll_srl; |
379 | 417 | |
380 | 418 | $output = executeQuery('poll.deletePoll', $args); |
381 | - if(!$output->toBool()) return $output; |
|
419 | + if(!$output->toBool()) { |
|
420 | + return $output; |
|
421 | + } |
|
382 | 422 | |
383 | 423 | $output = executeQuery('poll.deletePollItem', $args); |
384 | - if(!$output->toBool()) return $output; |
|
424 | + if(!$output->toBool()) { |
|
425 | + return $output; |
|
426 | + } |
|
385 | 427 | |
386 | 428 | $output = executeQuery('poll.deletePollTitle', $args); |
387 | - if(!$output->toBool()) return $output; |
|
429 | + if(!$output->toBool()) { |
|
430 | + return $output; |
|
431 | + } |
|
388 | 432 | |
389 | 433 | $output = executeQuery('poll.deletePollLog', $args); |
390 | - if(!$output->toBool()) return $output; |
|
434 | + if(!$output->toBool()) { |
|
435 | + return $output; |
|
436 | + } |
|
391 | 437 | |
392 | 438 | return new BaseObject(); |
393 | 439 | } |
@@ -407,7 +453,9 @@ discard block |
||
407 | 453 | $output = executeQuery('poll.getPoll', $args); |
408 | 454 | $poll = $output->data; |
409 | 455 | |
410 | - if($poll->upload_target_srl) continue; |
|
456 | + if($poll->upload_target_srl) { |
|
457 | + continue; |
|
458 | + } |
|
411 | 459 | |
412 | 460 | $args->upload_target_srl = $upload_target_srl; |
413 | 461 | $output = executeQuery('poll.updatePollTarget', $args); |
@@ -26,20 +26,20 @@ |
||
26 | 26 | $current_module_srl = Context::get('module_srl'); |
27 | 27 | $current_module_srls = Context::get('module_srls'); |
28 | 28 | |
29 | - if(!$current_module_srl && !$current_module_srls) |
|
29 | + if (!$current_module_srl && !$current_module_srls) |
|
30 | 30 | { |
31 | 31 | $current_module_info = Context::get('current_module_info'); |
32 | 32 | $current_module_srl = $current_module_info->module_srl; |
33 | - if(!$current_module_srl) return new BaseObject(); |
|
33 | + if (!$current_module_srl) return new BaseObject(); |
|
34 | 34 | } |
35 | 35 | // Get the configuration information |
36 | 36 | $oModuleModel = getModel('module'); |
37 | 37 | $config = $oModuleModel->getModuleConfig('point'); |
38 | 38 | |
39 | - if($current_module_srl) |
|
39 | + if ($current_module_srl) |
|
40 | 40 | { |
41 | 41 | $module_config = $oModuleModel->getModulePartConfig('point', $current_module_srl); |
42 | - if(!$module_config) |
|
42 | + if (!$module_config) |
|
43 | 43 | { |
44 | 44 | $module_config['insert_document'] = $config->insert_document; |
45 | 45 | $module_config['insert_comment'] = $config->insert_comment; |
@@ -30,7 +30,9 @@ |
||
30 | 30 | { |
31 | 31 | $current_module_info = Context::get('current_module_info'); |
32 | 32 | $current_module_srl = $current_module_info->module_srl; |
33 | - if(!$current_module_srl) return new BaseObject(); |
|
33 | + if(!$current_module_srl) { |
|
34 | + return new BaseObject(); |
|
35 | + } |
|
34 | 36 | } |
35 | 37 | // Get the configuration information |
36 | 38 | $oModuleModel = getModel('module'); |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | $args = Context::getRequestVars(); |
27 | 27 | |
28 | 28 | //if module IO config is off |
29 | - if($args->able_module == 'Y') |
|
29 | + if ($args->able_module == 'Y') |
|
30 | 30 | { |
31 | 31 | // Re-install triggers, if it was disabled. |
32 | - if($config->able_module == 'N') |
|
32 | + if ($config->able_module == 'N') |
|
33 | 33 | { |
34 | 34 | $this->moduleUpdate(); |
35 | 35 | } |
@@ -39,28 +39,28 @@ discard block |
||
39 | 39 | |
40 | 40 | // Check the point name |
41 | 41 | $config->point_name = $args->point_name; |
42 | - if(!$config->point_name) $config->point_name = 'point'; |
|
42 | + if (!$config->point_name) $config->point_name = 'point'; |
|
43 | 43 | // Specify the default points |
44 | - $config->signup_point = (int)$args->signup_point; |
|
45 | - $config->login_point = (int)$args->login_point; |
|
46 | - $config->insert_document = (int)$args->insert_document; |
|
47 | - $config->read_document = (int)$args->read_document; |
|
48 | - $config->insert_comment = (int)$args->insert_comment; |
|
49 | - $config->upload_file = (int)$args->upload_file; |
|
50 | - $config->download_file = (int)$args->download_file; |
|
51 | - $config->voted = (int)$args->voted; |
|
52 | - $config->blamed = (int)$args->blamed; |
|
44 | + $config->signup_point = (int) $args->signup_point; |
|
45 | + $config->login_point = (int) $args->login_point; |
|
46 | + $config->insert_document = (int) $args->insert_document; |
|
47 | + $config->read_document = (int) $args->read_document; |
|
48 | + $config->insert_comment = (int) $args->insert_comment; |
|
49 | + $config->upload_file = (int) $args->upload_file; |
|
50 | + $config->download_file = (int) $args->download_file; |
|
51 | + $config->voted = (int) $args->voted; |
|
52 | + $config->blamed = (int) $args->blamed; |
|
53 | 53 | // The highest level |
54 | 54 | $config->max_level = $args->max_level; |
55 | - if($config->max_level>1000) $config->max_level = 1000; |
|
56 | - if($config->max_level<1) $config->max_level = 1; |
|
55 | + if ($config->max_level > 1000) $config->max_level = 1000; |
|
56 | + if ($config->max_level < 1) $config->max_level = 1; |
|
57 | 57 | // Set the level icon |
58 | 58 | $config->level_icon = $args->level_icon; |
59 | 59 | // Check if downloads are not allowed |
60 | - if($args->disable_download == 'Y') $config->disable_download = 'Y'; |
|
60 | + if ($args->disable_download == 'Y') $config->disable_download = 'Y'; |
|
61 | 61 | else $config->disable_download = 'N'; |
62 | 62 | // Check if reading a document is not allowed |
63 | - if($args->disable_read_document == 'Y') $config->disable_read_document = 'Y'; |
|
63 | + if ($args->disable_read_document == 'Y') $config->disable_read_document = 'Y'; |
|
64 | 64 | else $config->disable_read_document = 'N'; |
65 | 65 | |
66 | 66 | $oMemberModel = getModel('member'); |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | $config->point_group = array(); |
69 | 69 | |
70 | 70 | // Per-level group configurations |
71 | - foreach($group_list as $group) |
|
71 | + foreach ($group_list as $group) |
|
72 | 72 | { |
73 | 73 | // Admin group should not be connected to point. |
74 | - if($group->is_admin == 'Y' || $group->is_default == 'Y') continue; |
|
74 | + if ($group->is_admin == 'Y' || $group->is_default == 'Y') continue; |
|
75 | 75 | |
76 | 76 | $group_srl = $group->group_srl; |
77 | 77 | |
78 | - if(isset($args->{'point_group_'.$group_srl})) |
|
78 | + if (isset($args->{'point_group_'.$group_srl})) |
|
79 | 79 | { |
80 | 80 | //if group level is higher than max level, change to max level |
81 | - if($args->{'point_group_'.$group_srl} > $args->max_level) |
|
81 | + if ($args->{'point_group_'.$group_srl} > $args->max_level) |
|
82 | 82 | { |
83 | 83 | $args->{'point_group_'.$group_srl} = $args->max_level; |
84 | 84 | } |
85 | 85 | |
86 | 86 | //if group level is lower than 1, change to 1 |
87 | - if($args->{'point_group_'.$group_srl} < 1) |
|
87 | + if ($args->{'point_group_'.$group_srl} < 1) |
|
88 | 88 | { |
89 | 89 | $args->{'point_group_'.$group_srl} = 1; |
90 | 90 | } |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | $config->group_reset = $args->group_reset; |
96 | 96 | // Per-level point configurations |
97 | 97 | unset($config->level_step); |
98 | - for($i=1;$i<=$config->max_level;$i++) |
|
98 | + for ($i = 1; $i <= $config->max_level; $i++) |
|
99 | 99 | { |
100 | 100 | $key = "level_step_".$i; |
101 | - $config->level_step[$i] = (int)$args->{$key}; |
|
101 | + $config->level_step[$i] = (int) $args->{$key}; |
|
102 | 102 | } |
103 | 103 | // A function to calculate per-level points |
104 | 104 | $config->expression = $args->expression; |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | $args = Context::getRequestVars(); |
131 | 131 | |
132 | 132 | $configTypeList = array('insert_document', 'insert_comment', 'upload_file', 'download_file', 'read_document', 'voted', 'blamed'); |
133 | - foreach($configTypeList AS $config) |
|
133 | + foreach ($configTypeList AS $config) |
|
134 | 134 | { |
135 | - if(is_array($args->{$config})) |
|
135 | + if (is_array($args->{$config})) |
|
136 | 136 | { |
137 | - foreach($args->{$config} AS $key=>$value) |
|
137 | + foreach ($args->{$config} AS $key=>$value) |
|
138 | 138 | { |
139 | 139 | $module_config[$key][$config] = $value; |
140 | 140 | } |
@@ -142,16 +142,16 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | $oModuleController = getController('module'); |
145 | - if(count($module_config)) |
|
145 | + if (count($module_config)) |
|
146 | 146 | { |
147 | - foreach($module_config as $module_srl => $config) |
|
147 | + foreach ($module_config as $module_srl => $config) |
|
148 | 148 | { |
149 | - $oModuleController->insertModulePartConfig('point',$module_srl,$config); |
|
149 | + $oModuleController->insertModulePartConfig('point', $module_srl, $config); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | $this->setMessage('success_updated'); |
154 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
154 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
155 | 155 | { |
156 | 156 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPointAdminModuleConfig'); |
157 | 157 | header('location:'.$returnUrl); |
@@ -165,24 +165,24 @@ discard block |
||
165 | 165 | function procPointAdminInsertPointModuleConfig() |
166 | 166 | { |
167 | 167 | $module_srl = Context::get('target_module_srl'); |
168 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
168 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
169 | 169 | // In case of batch configuration of several modules |
170 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
170 | + if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl); |
|
171 | 171 | else $module_srl = array($module_srl); |
172 | 172 | // Save configurations |
173 | 173 | $oModuleController = getController('module'); |
174 | - for($i=0;$i<count($module_srl);$i++) |
|
174 | + for ($i = 0; $i < count($module_srl); $i++) |
|
175 | 175 | { |
176 | 176 | $srl = trim($module_srl[$i]); |
177 | - if(!$srl) continue; |
|
177 | + if (!$srl) continue; |
|
178 | 178 | unset($config); |
179 | - $config['insert_document'] = (int)Context::get('insert_document'); |
|
180 | - $config['insert_comment'] = (int)Context::get('insert_comment'); |
|
181 | - $config['upload_file'] = (int)Context::get('upload_file'); |
|
182 | - $config['download_file'] = (int)Context::get('download_file'); |
|
183 | - $config['read_document'] = (int)Context::get('read_document'); |
|
184 | - $config['voted'] = (int)Context::get('voted'); |
|
185 | - $config['blamed'] = (int)Context::get('blamed'); |
|
179 | + $config['insert_document'] = (int) Context::get('insert_document'); |
|
180 | + $config['insert_comment'] = (int) Context::get('insert_comment'); |
|
181 | + $config['upload_file'] = (int) Context::get('upload_file'); |
|
182 | + $config['download_file'] = (int) Context::get('download_file'); |
|
183 | + $config['read_document'] = (int) Context::get('read_document'); |
|
184 | + $config['voted'] = (int) Context::get('voted'); |
|
185 | + $config['blamed'] = (int) Context::get('blamed'); |
|
186 | 186 | $oModuleController->insertModulePartConfig('point', $srl, $config); |
187 | 187 | } |
188 | 188 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | preg_match('/^(\+|-)?([1-9][0-9]*)$/', $point, $m); |
205 | 205 | |
206 | 206 | $action = ''; |
207 | - switch($m[1]) |
|
207 | + switch ($m[1]) |
|
208 | 208 | { |
209 | 209 | case '+': |
210 | 210 | $action = 'add'; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $point = $m[2]; |
220 | 220 | |
221 | 221 | $oPointController = getController('point'); |
222 | - $output = $oPointController->setPoint($member_srl, (int)$point, $action); |
|
222 | + $output = $oPointController->setPoint($member_srl, (int) $point, $action); |
|
223 | 223 | |
224 | 224 | $this->setError(-1); |
225 | 225 | $this->setMessage('success_updated', 'info'); |
@@ -244,29 +244,29 @@ discard block |
||
244 | 244 | |
245 | 245 | // Get member infomation |
246 | 246 | $output = executeQueryArray('point.getMemberCount'); |
247 | - if(!$output->toBool()) return $output; |
|
247 | + if (!$output->toBool()) return $output; |
|
248 | 248 | |
249 | - if($output->data) |
|
249 | + if ($output->data) |
|
250 | 250 | { |
251 | - foreach($output->data as $key => $val) |
|
251 | + foreach ($output->data as $key => $val) |
|
252 | 252 | { |
253 | - if(!$val->member_srl) continue; |
|
253 | + if (!$val->member_srl) continue; |
|
254 | 254 | $member[$val->member_srl] = 0; |
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | 258 | // Get post information |
259 | 259 | $output = executeQueryArray('point.getDocumentPoint'); |
260 | - if(!$output->toBool()) return $output; |
|
260 | + if (!$output->toBool()) return $output; |
|
261 | 261 | |
262 | - if($output->data) |
|
262 | + if ($output->data) |
|
263 | 263 | { |
264 | - foreach($output->data as $key => $val) |
|
264 | + foreach ($output->data as $key => $val) |
|
265 | 265 | { |
266 | - if($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
266 | + if ($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
267 | 267 | else $insert_point = $config->insert_document; |
268 | 268 | |
269 | - if(!$val->member_srl) continue; |
|
269 | + if (!$val->member_srl) continue; |
|
270 | 270 | $point = $insert_point * $val->count; |
271 | 271 | $member[$val->member_srl] += $point; |
272 | 272 | } |
@@ -275,16 +275,16 @@ discard block |
||
275 | 275 | $output = null; |
276 | 276 | // Get comments information |
277 | 277 | $output = executeQueryArray('point.getCommentPoint'); |
278 | - if(!$output->toBool()) return $output; |
|
278 | + if (!$output->toBool()) return $output; |
|
279 | 279 | |
280 | - if($output->data) |
|
280 | + if ($output->data) |
|
281 | 281 | { |
282 | - foreach($output->data as $key => $val) |
|
282 | + foreach ($output->data as $key => $val) |
|
283 | 283 | { |
284 | - if($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
284 | + if ($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
285 | 285 | else $insert_point = $config->insert_comment; |
286 | 286 | |
287 | - if(!$val->member_srl) continue; |
|
287 | + if (!$val->member_srl) continue; |
|
288 | 288 | $point = $insert_point * $val->count; |
289 | 289 | $member[$val->member_srl] += $point; |
290 | 290 | } |
@@ -292,16 +292,16 @@ discard block |
||
292 | 292 | $output = null; |
293 | 293 | // Get the attached files' information |
294 | 294 | $output = executeQueryArray('point.getFilePoint'); |
295 | - if(!$output->toBool()) return $output; |
|
295 | + if (!$output->toBool()) return $output; |
|
296 | 296 | |
297 | - if($output->data) |
|
297 | + if ($output->data) |
|
298 | 298 | { |
299 | - foreach($output->data as $key => $val) |
|
299 | + foreach ($output->data as $key => $val) |
|
300 | 300 | { |
301 | - if($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
301 | + if ($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
302 | 302 | else $insert_point = $config->upload_file; |
303 | 303 | |
304 | - if(!$val->member_srl) continue; |
|
304 | + if (!$val->member_srl) continue; |
|
305 | 305 | $point = $insert_point * $val->count; |
306 | 306 | $member[$val->member_srl] += $point; |
307 | 307 | } |
@@ -309,13 +309,13 @@ discard block |
||
309 | 309 | $output = null; |
310 | 310 | // Set all members' points to 0 |
311 | 311 | $output = executeQuery("point.initMemberPoint"); |
312 | - if(!$output->toBool()) return $output; |
|
312 | + if (!$output->toBool()) return $output; |
|
313 | 313 | // Save the file temporarily |
314 | 314 | |
315 | 315 | $str = ''; |
316 | - foreach($member as $key => $val) |
|
316 | + foreach ($member as $key => $val) |
|
317 | 317 | { |
318 | - $val += (int)$config->signup_point; |
|
318 | + $val += (int) $config->signup_point; |
|
319 | 319 | $str .= $key.','.$val."\r\n"; |
320 | 320 | } |
321 | 321 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | $this->add('total', count($member)); |
325 | 325 | $this->add('position', 0); |
326 | - $this->setMessage( sprintf(Context::getLang('point_recal_message'), 0, $this->get('total')) ); |
|
326 | + $this->setMessage(sprintf(Context::getLang('point_recal_message'), 0, $this->get('total'))); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -331,35 +331,35 @@ discard block |
||
331 | 331 | */ |
332 | 332 | function procPointAdminApplyPoint() |
333 | 333 | { |
334 | - $position = (int)Context::get('position'); |
|
335 | - $total = (int)Context::get('total'); |
|
334 | + $position = (int) Context::get('position'); |
|
335 | + $total = (int) Context::get('total'); |
|
336 | 336 | |
337 | - if(!file_exists('./files/cache/pointRecal.txt')) return new BaseObject(-1, 'msg_invalid_request'); |
|
337 | + if (!file_exists('./files/cache/pointRecal.txt')) return new BaseObject(-1, 'msg_invalid_request'); |
|
338 | 338 | |
339 | 339 | $idx = 0; |
340 | - $f = fopen("./files/cache/pointRecal.txt","r"); |
|
341 | - while(!feof($f)) |
|
340 | + $f = fopen("./files/cache/pointRecal.txt", "r"); |
|
341 | + while (!feof($f)) |
|
342 | 342 | { |
343 | 343 | $str = trim(fgets($f, 1024)); |
344 | - $idx ++; |
|
345 | - if($idx > $position) |
|
344 | + $idx++; |
|
345 | + if ($idx > $position) |
|
346 | 346 | { |
347 | - list($member_srl, $point) = explode(',',$str); |
|
347 | + list($member_srl, $point) = explode(',', $str); |
|
348 | 348 | |
349 | 349 | $args = new stdClass(); |
350 | 350 | $args->member_srl = $member_srl; |
351 | 351 | $args->point = $point; |
352 | - $output = executeQuery('point.insertPoint',$args); |
|
353 | - if($idx%5000==0) break; |
|
352 | + $output = executeQuery('point.insertPoint', $args); |
|
353 | + if ($idx % 5000 == 0) break; |
|
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
357 | - if(feof($f)) |
|
357 | + if (feof($f)) |
|
358 | 358 | { |
359 | 359 | FileHandler::removeFile('./files/cache/pointRecal.txt'); |
360 | 360 | $idx = $total; |
361 | 361 | |
362 | - FileHandler::rename('./files/member_extra_info/point','./files/member_extra_info/point.old'); |
|
362 | + FileHandler::rename('./files/member_extra_info/point', './files/member_extra_info/point.old'); |
|
363 | 363 | |
364 | 364 | FileHandler::removeDir('./files/member_extra_info/point.old'); |
365 | 365 | } |
@@ -377,16 +377,16 @@ discard block |
||
377 | 377 | function procPointAdminReset() |
378 | 378 | { |
379 | 379 | $module_srl = Context::get('module_srls'); |
380 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
380 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
381 | 381 | // In case of batch configuration of several modules |
382 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
382 | + if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl); |
|
383 | 383 | else $module_srl = array($module_srl); |
384 | 384 | // Save configurations |
385 | 385 | $oModuleController = getController('module'); |
386 | - for($i=0;$i<count($module_srl);$i++) |
|
386 | + for ($i = 0; $i < count($module_srl); $i++) |
|
387 | 387 | { |
388 | 388 | $srl = trim($module_srl[$i]); |
389 | - if(!$srl) continue; |
|
389 | + if (!$srl) continue; |
|
390 | 390 | $args = new stdClass(); |
391 | 391 | $args->module = 'point'; |
392 | 392 | $args->module_srl = $srl; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
397 | - if($oCacheHandler->isSupport()) |
|
397 | + if ($oCacheHandler->isSupport()) |
|
398 | 398 | { |
399 | 399 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
400 | 400 | } |
@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | // Check the point name |
41 | 41 | $config->point_name = $args->point_name; |
42 | - if(!$config->point_name) $config->point_name = 'point'; |
|
42 | + if(!$config->point_name) { |
|
43 | + $config->point_name = 'point'; |
|
44 | + } |
|
43 | 45 | // Specify the default points |
44 | 46 | $config->signup_point = (int)$args->signup_point; |
45 | 47 | $config->login_point = (int)$args->login_point; |
@@ -52,16 +54,26 @@ discard block |
||
52 | 54 | $config->blamed = (int)$args->blamed; |
53 | 55 | // The highest level |
54 | 56 | $config->max_level = $args->max_level; |
55 | - if($config->max_level>1000) $config->max_level = 1000; |
|
56 | - if($config->max_level<1) $config->max_level = 1; |
|
57 | + if($config->max_level>1000) { |
|
58 | + $config->max_level = 1000; |
|
59 | + } |
|
60 | + if($config->max_level<1) { |
|
61 | + $config->max_level = 1; |
|
62 | + } |
|
57 | 63 | // Set the level icon |
58 | 64 | $config->level_icon = $args->level_icon; |
59 | 65 | // Check if downloads are not allowed |
60 | - if($args->disable_download == 'Y') $config->disable_download = 'Y'; |
|
61 | - else $config->disable_download = 'N'; |
|
66 | + if($args->disable_download == 'Y') { |
|
67 | + $config->disable_download = 'Y'; |
|
68 | + } else { |
|
69 | + $config->disable_download = 'N'; |
|
70 | + } |
|
62 | 71 | // Check if reading a document is not allowed |
63 | - if($args->disable_read_document == 'Y') $config->disable_read_document = 'Y'; |
|
64 | - else $config->disable_read_document = 'N'; |
|
72 | + if($args->disable_read_document == 'Y') { |
|
73 | + $config->disable_read_document = 'Y'; |
|
74 | + } else { |
|
75 | + $config->disable_read_document = 'N'; |
|
76 | + } |
|
65 | 77 | |
66 | 78 | $oMemberModel = getModel('member'); |
67 | 79 | $group_list = $oMemberModel->getGroups(); |
@@ -71,7 +83,9 @@ discard block |
||
71 | 83 | foreach($group_list as $group) |
72 | 84 | { |
73 | 85 | // Admin group should not be connected to point. |
74 | - if($group->is_admin == 'Y' || $group->is_default == 'Y') continue; |
|
86 | + if($group->is_admin == 'Y' || $group->is_default == 'Y') { |
|
87 | + continue; |
|
88 | + } |
|
75 | 89 | |
76 | 90 | $group_srl = $group->group_srl; |
77 | 91 | |
@@ -102,8 +116,7 @@ discard block |
||
102 | 116 | } |
103 | 117 | // A function to calculate per-level points |
104 | 118 | $config->expression = $args->expression; |
105 | - } |
|
106 | - else |
|
119 | + } else |
|
107 | 120 | { |
108 | 121 | //module IO config is OFF, Other settings will not be modified. |
109 | 122 | $config->able_module = 'N'; |
@@ -165,16 +178,23 @@ discard block |
||
165 | 178 | function procPointAdminInsertPointModuleConfig() |
166 | 179 | { |
167 | 180 | $module_srl = Context::get('target_module_srl'); |
168 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
181 | + if(!$module_srl) { |
|
182 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
183 | + } |
|
169 | 184 | // In case of batch configuration of several modules |
170 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
171 | - else $module_srl = array($module_srl); |
|
185 | + if(preg_match('/^([0-9,]+)$/',$module_srl)) { |
|
186 | + $module_srl = explode(',',$module_srl); |
|
187 | + } else { |
|
188 | + $module_srl = array($module_srl); |
|
189 | + } |
|
172 | 190 | // Save configurations |
173 | 191 | $oModuleController = getController('module'); |
174 | 192 | for($i=0;$i<count($module_srl);$i++) |
175 | 193 | { |
176 | 194 | $srl = trim($module_srl[$i]); |
177 | - if(!$srl) continue; |
|
195 | + if(!$srl) { |
|
196 | + continue; |
|
197 | + } |
|
178 | 198 | unset($config); |
179 | 199 | $config['insert_document'] = (int)Context::get('insert_document'); |
180 | 200 | $config['insert_comment'] = (int)Context::get('insert_comment'); |
@@ -244,29 +264,40 @@ discard block |
||
244 | 264 | |
245 | 265 | // Get member infomation |
246 | 266 | $output = executeQueryArray('point.getMemberCount'); |
247 | - if(!$output->toBool()) return $output; |
|
267 | + if(!$output->toBool()) { |
|
268 | + return $output; |
|
269 | + } |
|
248 | 270 | |
249 | 271 | if($output->data) |
250 | 272 | { |
251 | 273 | foreach($output->data as $key => $val) |
252 | 274 | { |
253 | - if(!$val->member_srl) continue; |
|
275 | + if(!$val->member_srl) { |
|
276 | + continue; |
|
277 | + } |
|
254 | 278 | $member[$val->member_srl] = 0; |
255 | 279 | } |
256 | 280 | } |
257 | 281 | |
258 | 282 | // Get post information |
259 | 283 | $output = executeQueryArray('point.getDocumentPoint'); |
260 | - if(!$output->toBool()) return $output; |
|
284 | + if(!$output->toBool()) { |
|
285 | + return $output; |
|
286 | + } |
|
261 | 287 | |
262 | 288 | if($output->data) |
263 | 289 | { |
264 | 290 | foreach($output->data as $key => $val) |
265 | 291 | { |
266 | - if($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
267 | - else $insert_point = $config->insert_document; |
|
292 | + if($module_config[$val->module_srl]['insert_document']) { |
|
293 | + $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
294 | + } else { |
|
295 | + $insert_point = $config->insert_document; |
|
296 | + } |
|
268 | 297 | |
269 | - if(!$val->member_srl) continue; |
|
298 | + if(!$val->member_srl) { |
|
299 | + continue; |
|
300 | + } |
|
270 | 301 | $point = $insert_point * $val->count; |
271 | 302 | $member[$val->member_srl] += $point; |
272 | 303 | } |
@@ -275,16 +306,23 @@ discard block |
||
275 | 306 | $output = null; |
276 | 307 | // Get comments information |
277 | 308 | $output = executeQueryArray('point.getCommentPoint'); |
278 | - if(!$output->toBool()) return $output; |
|
309 | + if(!$output->toBool()) { |
|
310 | + return $output; |
|
311 | + } |
|
279 | 312 | |
280 | 313 | if($output->data) |
281 | 314 | { |
282 | 315 | foreach($output->data as $key => $val) |
283 | 316 | { |
284 | - if($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
285 | - else $insert_point = $config->insert_comment; |
|
317 | + if($module_config[$val->module_srl]['insert_comment']) { |
|
318 | + $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
319 | + } else { |
|
320 | + $insert_point = $config->insert_comment; |
|
321 | + } |
|
286 | 322 | |
287 | - if(!$val->member_srl) continue; |
|
323 | + if(!$val->member_srl) { |
|
324 | + continue; |
|
325 | + } |
|
288 | 326 | $point = $insert_point * $val->count; |
289 | 327 | $member[$val->member_srl] += $point; |
290 | 328 | } |
@@ -292,16 +330,23 @@ discard block |
||
292 | 330 | $output = null; |
293 | 331 | // Get the attached files' information |
294 | 332 | $output = executeQueryArray('point.getFilePoint'); |
295 | - if(!$output->toBool()) return $output; |
|
333 | + if(!$output->toBool()) { |
|
334 | + return $output; |
|
335 | + } |
|
296 | 336 | |
297 | 337 | if($output->data) |
298 | 338 | { |
299 | 339 | foreach($output->data as $key => $val) |
300 | 340 | { |
301 | - if($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
302 | - else $insert_point = $config->upload_file; |
|
341 | + if($module_config[$val->module_srl]['upload_file']) { |
|
342 | + $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
343 | + } else { |
|
344 | + $insert_point = $config->upload_file; |
|
345 | + } |
|
303 | 346 | |
304 | - if(!$val->member_srl) continue; |
|
347 | + if(!$val->member_srl) { |
|
348 | + continue; |
|
349 | + } |
|
305 | 350 | $point = $insert_point * $val->count; |
306 | 351 | $member[$val->member_srl] += $point; |
307 | 352 | } |
@@ -309,7 +354,9 @@ discard block |
||
309 | 354 | $output = null; |
310 | 355 | // Set all members' points to 0 |
311 | 356 | $output = executeQuery("point.initMemberPoint"); |
312 | - if(!$output->toBool()) return $output; |
|
357 | + if(!$output->toBool()) { |
|
358 | + return $output; |
|
359 | + } |
|
313 | 360 | // Save the file temporarily |
314 | 361 | |
315 | 362 | $str = ''; |
@@ -334,7 +381,9 @@ discard block |
||
334 | 381 | $position = (int)Context::get('position'); |
335 | 382 | $total = (int)Context::get('total'); |
336 | 383 | |
337 | - if(!file_exists('./files/cache/pointRecal.txt')) return new BaseObject(-1, 'msg_invalid_request'); |
|
384 | + if(!file_exists('./files/cache/pointRecal.txt')) { |
|
385 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
386 | + } |
|
338 | 387 | |
339 | 388 | $idx = 0; |
340 | 389 | $f = fopen("./files/cache/pointRecal.txt","r"); |
@@ -350,7 +399,9 @@ discard block |
||
350 | 399 | $args->member_srl = $member_srl; |
351 | 400 | $args->point = $point; |
352 | 401 | $output = executeQuery('point.insertPoint',$args); |
353 | - if($idx%5000==0) break; |
|
402 | + if($idx%5000==0) { |
|
403 | + break; |
|
404 | + } |
|
354 | 405 | } |
355 | 406 | } |
356 | 407 | |
@@ -377,16 +428,23 @@ discard block |
||
377 | 428 | function procPointAdminReset() |
378 | 429 | { |
379 | 430 | $module_srl = Context::get('module_srls'); |
380 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
431 | + if(!$module_srl) { |
|
432 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
433 | + } |
|
381 | 434 | // In case of batch configuration of several modules |
382 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
383 | - else $module_srl = array($module_srl); |
|
435 | + if(preg_match('/^([0-9,]+)$/',$module_srl)) { |
|
436 | + $module_srl = explode(',',$module_srl); |
|
437 | + } else { |
|
438 | + $module_srl = array($module_srl); |
|
439 | + } |
|
384 | 440 | // Save configurations |
385 | 441 | $oModuleController = getController('module'); |
386 | 442 | for($i=0;$i<count($module_srl);$i++) |
387 | 443 | { |
388 | 444 | $srl = trim($module_srl[$i]); |
389 | - if(!$srl) continue; |
|
445 | + if(!$srl) { |
|
446 | + continue; |
|
447 | + } |
|
390 | 448 | $args = new stdClass(); |
391 | 449 | $args->module = 'point'; |
392 | 450 | $args->module_srl = $srl; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $point = $config->signup_point; |
32 | 32 | // Increase the point |
33 | 33 | $cur_point += $point; |
34 | - $this->setPoint($member_srl,$cur_point, 'signup'); |
|
34 | + $this->setPoint($member_srl, $cur_point, 'signup'); |
|
35 | 35 | |
36 | 36 | return new BaseObject(); |
37 | 37 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new BaseObject(); |
|
45 | + if (!$member_srl) return new BaseObject(); |
|
46 | 46 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new BaseObject(); |
|
48 | 48 | // Get the point module information |
49 | 49 | $oModuleModel = getModel('module'); |
50 | 50 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $point = $config->login_point; |
56 | 56 | // Increase the point |
57 | 57 | $cur_point += $point; |
58 | - $this->setPoint($member_srl,$cur_point); |
|
58 | + $this->setPoint($member_srl, $cur_point); |
|
59 | 59 | |
60 | 60 | return new BaseObject(); |
61 | 61 | } |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | function triggerInsertDocument(&$obj) |
67 | 67 | { |
68 | 68 | $oDocumentModel = getModel('document'); |
69 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
69 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
70 | 70 | { |
71 | 71 | $module_srl = $obj->module_srl; |
72 | 72 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
73 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
74 | 74 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
75 | + if ($module_srl == $member_srl) return new BaseObject(); |
|
76 | 76 | // Get the point module information |
77 | 77 | $oModuleModel = getModel('module'); |
78 | 78 | $config = $oModuleModel->getModuleConfig('point'); |
79 | - $module_config = $oModuleModel->getModulePartConfig('point',$module_srl); |
|
79 | + $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
|
80 | 80 | // Get the points of the member |
81 | 81 | $oPointModel = getModel('point'); |
82 | 82 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 83 | |
84 | 84 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
85 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
86 | 86 | $cur_point += $point; |
87 | 87 | // Add points for attaching a file |
88 | 88 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
89 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
91 | 91 | // Increase the point |
92 | - $this->setPoint($member_srl,$cur_point); |
|
92 | + $this->setPoint($member_srl, $cur_point); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return new BaseObject(); |
@@ -106,24 +106,24 @@ discard block |
||
106 | 106 | $oDocument = $oDocumentModel->getDocument($document_srl); |
107 | 107 | |
108 | 108 | // if status is TEMP or PUBLIC... give not point, only status is empty |
109 | - if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
109 | + if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
110 | 110 | { |
111 | 111 | $oModuleModel = getModel('module'); |
112 | 112 | |
113 | 113 | // Get the point module information |
114 | 114 | $config = $oModuleModel->getModuleConfig('point'); |
115 | - $module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl); |
|
115 | + $module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl); |
|
116 | 116 | // Get the points of the member |
117 | 117 | $oPointModel = getModel('point'); |
118 | 118 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 119 | |
120 | 120 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
121 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
122 | 122 | $cur_point += $point; |
123 | 123 | // Add points for attaching a file |
124 | 124 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
125 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
127 | 127 | // Increase the point |
128 | 128 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 129 | } |
@@ -141,42 +141,42 @@ discard block |
||
141 | 141 | |
142 | 142 | $oDocumentModel = getModel('document'); |
143 | 143 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
144 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
145 | 145 | // Get the point module information |
146 | 146 | $oModuleModel = getModel('module'); |
147 | 147 | $config = $oModuleModel->getModuleConfig('point'); |
148 | - $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
|
148 | + $module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl')); |
|
149 | 149 | // The process related to clearing the post comments |
150 | 150 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
151 | + if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
152 | 152 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new BaseObject(); |
|
153 | + if ($comment_point > 0) return new BaseObject(); |
|
154 | 154 | // Get all the comments related to this post |
155 | 155 | $cp_args = new stdClass(); |
156 | 156 | $cp_args->document_srl = $document_srl; |
157 | 157 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 158 | // Return if there is no object |
159 | - if(!$output->data) return new BaseObject(); |
|
159 | + if (!$output->data) return new BaseObject(); |
|
160 | 160 | // Organize the member number |
161 | 161 | $member_srls = array(); |
162 | 162 | $cnt = count($output->data); |
163 | - for($i=0;$i<$cnt;$i++) |
|
163 | + for ($i = 0; $i < $cnt; $i++) |
|
164 | 164 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
165 | + if ($output->data[$i]->member_srl < 1) continue; |
|
166 | 166 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 167 | } |
168 | 168 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new BaseObject(); |
|
169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | + if (!count($member_srls)) return new BaseObject(); |
|
171 | 171 | // Remove all the points for each member |
172 | 172 | $oPointModel = getModel('point'); |
173 | 173 | // Get the points |
174 | 174 | $point = $module_config['download_file']; |
175 | - foreach($member_srls as $member_srl => $cnt) |
|
175 | + foreach ($member_srls as $member_srl => $cnt) |
|
176 | 176 | { |
177 | 177 | $cur_point = $oPointModel->getPoint($member_srl, true); |
178 | 178 | $cur_point -= $cnt * $comment_point; |
179 | - $this->setPoint($member_srl,$cur_point); |
|
179 | + $this->setPoint($member_srl, $cur_point); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | return new BaseObject(); |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | { |
190 | 190 | $oDocumentModel = getModel('document'); |
191 | 191 | |
192 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
192 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
193 | 193 | { |
194 | 194 | $module_srl = $obj->module_srl; |
195 | 195 | $member_srl = $obj->member_srl; |
196 | 196 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
197 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
198 | 198 | // Run only when logged in |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
200 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
201 | 201 | // Get the points of the member |
202 | 202 | $oPointModel = getModel('point'); |
203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 208 | |
209 | 209 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
210 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
211 | 211 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new BaseObject(); |
|
212 | + if ($point < 0) return new BaseObject(); |
|
213 | 213 | $cur_point -= $point; |
214 | 214 | // Add points related to deleting an attachment |
215 | 215 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
216 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | + if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
218 | 218 | // Increase the point |
219 | - $this->setPoint($member_srl,$cur_point); |
|
219 | + $this->setPoint($member_srl, $cur_point); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return new BaseObject(); |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | { |
230 | 230 | $module_srl = $obj->module_srl; |
231 | 231 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
232 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
233 | 233 | // Do not increase the points if the member is the author of the post |
234 | 234 | $document_srl = $obj->document_srl; |
235 | 235 | $oDocumentModel = getModel('document'); |
236 | 236 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
237 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new BaseObject(); |
|
238 | 238 | // Get the point module information |
239 | 239 | $oModuleModel = getModel('module'); |
240 | 240 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 245 | |
246 | 246 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
247 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
248 | 248 | // Increase the point |
249 | 249 | $cur_point += $point; |
250 | - $this->setPoint($member_srl,$cur_point); |
|
250 | + $this->setPoint($member_srl, $cur_point); |
|
251 | 251 | |
252 | 252 | return new BaseObject(); |
253 | 253 | } |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $module_srl = $obj->module_srl; |
265 | 265 | $member_srl = abs($obj->member_srl); |
266 | 266 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
267 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
268 | 268 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
270 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
271 | + if ($oDocument->get('member_srl') == $member_srl) return new BaseObject(); |
|
272 | 272 | // Get the point module information |
273 | 273 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 274 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 277 | |
278 | 278 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
279 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
280 | 280 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new BaseObject(); |
|
281 | + if ($point < 0) return new BaseObject(); |
|
282 | 282 | // Increase the point |
283 | 283 | $cur_point -= $point; |
284 | - $this->setPoint($member_srl,$cur_point); |
|
284 | + $this->setPoint($member_srl, $cur_point); |
|
285 | 285 | |
286 | 286 | return new BaseObject(); |
287 | 287 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function triggerDeleteFile(&$obj) |
303 | 303 | { |
304 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
304 | + if ($obj->isvalid != 'Y') return new BaseObject(); |
|
305 | 305 | |
306 | 306 | $module_srl = $obj->module_srl; |
307 | 307 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
308 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
309 | 309 | // Get the point module information |
310 | 310 | $oModuleModel = getModel('module'); |
311 | 311 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 316 | |
317 | 317 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
318 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
319 | 319 | // Increase the point |
320 | 320 | $cur_point -= $point; |
321 | - $this->setPoint($member_srl,$cur_point); |
|
321 | + $this->setPoint($member_srl, $cur_point); |
|
322 | 322 | |
323 | 323 | return new BaseObject(); |
324 | 324 | } |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | $logged_info = Context::get('logged_info'); |
332 | 332 | $member_srl = $logged_info->member_srl; |
333 | 333 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new BaseObject(); |
|
334 | + if (!$module_srl) return new BaseObject(); |
|
335 | 335 | |
336 | 336 | // Pass if it is your file |
337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
337 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
338 | 338 | $oModuleModel = getModel('module'); |
339 | 339 | $config = $oModuleModel->getModuleConfig('point'); |
340 | 340 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | // If the user is not logged in and download requires points, deny access. |
351 | - if(!Context::get('is_logged')) |
|
351 | + if (!Context::get('is_logged')) |
|
352 | 352 | { |
353 | - if($config->disable_download == 'Y' && $point) |
|
353 | + if ($config->disable_download == 'Y' && $point) |
|
354 | 354 | { |
355 | - return new BaseObject(-1,'msg_not_permitted_download'); |
|
355 | + return new BaseObject(-1, 'msg_not_permitted_download'); |
|
356 | 356 | } |
357 | 357 | else |
358 | 358 | { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | // If the member does not have enough points, deny access. |
368 | 368 | if ($config->disable_download == 'Y' && $cur_point + $point < 0) |
369 | 369 | { |
370 | - return new BaseObject(-1,'msg_cannot_download'); |
|
370 | + return new BaseObject(-1, 'msg_cannot_download'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | // Otherwise, points will be adjusted after downloading (triggerDownloadFile). |
@@ -381,13 +381,13 @@ discard block |
||
381 | 381 | { |
382 | 382 | // Run only when logged in |
383 | 383 | $logged_info = Context::get('logged_info'); |
384 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
384 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
385 | 385 | $module_srl = $obj->module_srl; |
386 | 386 | $member_srl = $logged_info->member_srl; |
387 | - if(!$module_srl) return new BaseObject(); |
|
387 | + if (!$module_srl) return new BaseObject(); |
|
388 | 388 | |
389 | 389 | // Pass if it is your file |
390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
390 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
391 | 391 | |
392 | 392 | // Get the point module information |
393 | 393 | $oModuleModel = getModel('module'); |
@@ -428,22 +428,22 @@ discard block |
||
428 | 428 | // Get the original author number |
429 | 429 | $target_member_srl = abs($obj->get('member_srl')); |
430 | 430 | // Pass without increasing the hits if the viewer is the same as the author |
431 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
431 | + if ($target_member_srl == $member_srl) return new BaseObject(); |
|
432 | 432 | // Get the point information for each module |
433 | 433 | $config = $oModuleModel->getModuleConfig('point'); |
434 | 434 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
435 | 435 | // Get hits points |
436 | 436 | $point = $module_config['read_document']; |
437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
437 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
438 | 438 | // Pass if there are no requested points |
439 | - if(!$point) return new BaseObject(); |
|
439 | + if (!$point) return new BaseObject(); |
|
440 | 440 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
441 | - if($member_srl) |
|
441 | + if ($member_srl) |
|
442 | 442 | { |
443 | 443 | $args->member_srl = $member_srl; |
444 | 444 | $args->document_srl = $obj->document_srl; |
445 | 445 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
446 | - if($output->data->count) return new BaseObject(); |
|
446 | + if ($output->data->count) return new BaseObject(); |
|
447 | 447 | $cur_point = $oPointModel->getPoint($member_srl, true); |
448 | 448 | } |
449 | 449 | else |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $config = $oModuleModel->getModuleConfig('point'); |
455 | 455 | // When the requested points are negative, compared it with the current point |
456 | 456 | $_SESSION['banned_document'][$obj->document_srl] = false; |
457 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
457 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
458 | 458 | { |
459 | 459 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
460 | 460 | $obj->add('content', $message); |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | return new BaseObject(-1, $message); |
463 | 463 | } |
464 | 464 | // If not logged in, pass |
465 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
465 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
466 | 466 | // Pass, if there are no requested points |
467 | - if(!$point) return new BaseObject(); |
|
467 | + if (!$point) return new BaseObject(); |
|
468 | 468 | // If the read record is missing, leave it |
469 | 469 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
470 | 470 | // Increase the point |
471 | 471 | $cur_point += $point; |
472 | - $this->setPoint($member_srl,$cur_point); |
|
472 | + $this->setPoint($member_srl, $cur_point); |
|
473 | 473 | |
474 | 474 | return new BaseObject(); |
475 | 475 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | { |
482 | 482 | $module_srl = $obj->module_srl; |
483 | 483 | $member_srl = $obj->member_srl; |
484 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
484 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
485 | 485 | |
486 | 486 | $oModuleModel = getModel('module'); |
487 | 487 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -490,21 +490,21 @@ discard block |
||
490 | 490 | $oPointModel = getModel('point'); |
491 | 491 | $cur_point = $oPointModel->getPoint($member_srl, true); |
492 | 492 | |
493 | - if( $obj->point > 0 ) |
|
493 | + if ($obj->point > 0) |
|
494 | 494 | { |
495 | 495 | $point = $module_config['voted']; |
496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
496 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
497 | 497 | } |
498 | 498 | else |
499 | 499 | { |
500 | 500 | $point = $module_config['blamed']; |
501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
501 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
502 | 502 | } |
503 | 503 | |
504 | - if(!$point) return new BaseObject(); |
|
504 | + if (!$point) return new BaseObject(); |
|
505 | 505 | // Increase the point |
506 | 506 | $cur_point += $point; |
507 | - $this->setPoint($member_srl,$cur_point); |
|
507 | + $this->setPoint($member_srl, $cur_point); |
|
508 | 508 | |
509 | 509 | return new BaseObject(); |
510 | 510 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | { |
517 | 517 | $member_srl = abs($member_srl); |
518 | 518 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
519 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
520 | 520 | |
521 | 521 | // Get configuration information |
522 | 522 | $oMemberModel = getModel('member'); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $args->member_srl = $member_srl; |
534 | 534 | $args->point = $current_point; |
535 | 535 | |
536 | - switch($mode) |
|
536 | + switch ($mode) |
|
537 | 537 | { |
538 | 538 | case 'add' : |
539 | 539 | $args->point += $point; |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $args->point = $point; |
547 | 547 | break; |
548 | 548 | } |
549 | - if($args->point < 0) $args->point = 0; |
|
549 | + if ($args->point < 0) $args->point = 0; |
|
550 | 550 | $point = $args->point; |
551 | 551 | |
552 | 552 | // Call a trigger (before) |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $trigger_obj->current_level = $current_level; |
558 | 558 | $trigger_obj->set_point = $point; |
559 | 559 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
560 | - if(!$trigger_output->toBool()) |
|
560 | + if (!$trigger_output->toBool()) |
|
561 | 561 | { |
562 | 562 | return $trigger_output; |
563 | 563 | } |
@@ -568,19 +568,19 @@ discard block |
||
568 | 568 | |
569 | 569 | // If there are points, update, if no, insert |
570 | 570 | $oPointModel = getModel('point'); |
571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
571 | + if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
572 | 572 | else executeQuery("point.insertPoint", $args); |
573 | 573 | |
574 | 574 | // Get a new level |
575 | 575 | $level = $oPointModel->getLevel($point, $config->level_step); |
576 | 576 | |
577 | 577 | // If existing level and a new one are different attempt to set a point group |
578 | - if($level != $current_level) |
|
578 | + if ($level != $current_level) |
|
579 | 579 | { |
580 | 580 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
581 | 581 | $point_group = $config->point_group; |
582 | 582 | // If the point group exists |
583 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
583 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
584 | 584 | { |
585 | 585 | // Get the default group |
586 | 586 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -590,29 +590,29 @@ discard block |
||
590 | 590 | |
591 | 591 | asort($point_group); |
592 | 592 | // Reset group after initialization |
593 | - if($config->group_reset != 'N') |
|
593 | + if ($config->group_reset != 'N') |
|
594 | 594 | { |
595 | 595 | // If the new level is in the right group |
596 | - if(in_array($level, $point_group)) |
|
596 | + if (in_array($level, $point_group)) |
|
597 | 597 | { |
598 | 598 | // Delete all groups except the one which the current level belongs to |
599 | - foreach($point_group as $group_srl => $target_level) |
|
599 | + foreach ($point_group as $group_srl => $target_level) |
|
600 | 600 | { |
601 | 601 | $del_group_list[] = $group_srl; |
602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
602 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | // Otherwise, in case the level is reduced, add the recent group |
606 | 606 | else |
607 | 607 | { |
608 | 608 | $i = $level; |
609 | - while($i > 0) |
|
609 | + while ($i > 0) |
|
610 | 610 | { |
611 | - if(in_array($i, $point_group)) |
|
611 | + if (in_array($i, $point_group)) |
|
612 | 612 | { |
613 | - foreach($point_group as $group_srl => $target_level) |
|
613 | + foreach ($point_group as $group_srl => $target_level) |
|
614 | 614 | { |
615 | - if($target_level == $i) |
|
615 | + if ($target_level == $i) |
|
616 | 616 | { |
617 | 617 | $new_group_list[] = $group_srl; |
618 | 618 | } |
@@ -623,9 +623,9 @@ discard block |
||
623 | 623 | } |
624 | 624 | } |
625 | 625 | // Delete the group of a level which is higher than the current level |
626 | - foreach($point_group as $group_srl => $target_level) |
|
626 | + foreach ($point_group as $group_srl => $target_level) |
|
627 | 627 | { |
628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
628 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
629 | 629 | } |
630 | 630 | $del_group_list[] = $default_group->group_srl; |
631 | 631 | } |
@@ -633,16 +633,16 @@ discard block |
||
633 | 633 | else |
634 | 634 | { |
635 | 635 | // Check until the current level by rotating setting the configurations of the point groups |
636 | - foreach($point_group as $group_srl => $target_level) |
|
636 | + foreach ($point_group as $group_srl => $target_level) |
|
637 | 637 | { |
638 | 638 | $del_group_list[] = $group_srl; |
639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
639 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
640 | 640 | } |
641 | 641 | } |
642 | 642 | // If there is no a new group, granted the default group |
643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
643 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
644 | 644 | // Remove linkage group |
645 | - if($del_group_list && count($del_group_list)) |
|
645 | + if ($del_group_list && count($del_group_list)) |
|
646 | 646 | { |
647 | 647 | $del_group_args = new stdClass; |
648 | 648 | $del_group_args->member_srl = $member_srl; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
651 | 651 | } |
652 | 652 | // Grant a new group |
653 | - foreach($new_group_list as $group_srl) |
|
653 | + foreach ($new_group_list as $group_srl) |
|
654 | 654 | { |
655 | 655 | $new_group_args = new stdClass; |
656 | 656 | $new_group_args->member_srl = $member_srl; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $trigger_obj->del_group_list = $del_group_list; |
666 | 666 | $trigger_obj->new_level = $level; |
667 | 667 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
668 | - if(!$trigger_output->toBool()) |
|
668 | + if (!$trigger_output->toBool()) |
|
669 | 669 | { |
670 | 670 | $oDB->rollback(); |
671 | 671 | return $trigger_output; |
@@ -681,17 +681,17 @@ discard block |
||
681 | 681 | FileHandler::writeFile($cache_filename, $point); |
682 | 682 | |
683 | 683 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
684 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
684 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
685 | 685 | { |
686 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
686 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
687 | 687 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
688 | 688 | $oCacheHandler->delete($cache_key); |
689 | 689 | } |
690 | 690 | |
691 | 691 | $oCacheHandler = CacheHandler::getInstance('object'); |
692 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
692 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
693 | 693 | { |
694 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
694 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
695 | 695 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
696 | 696 | $oCacheHandler->delete($cache_key); |
697 | 697 | } |
@@ -705,9 +705,9 @@ discard block |
||
705 | 705 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
706 | 706 | |
707 | 707 | $oModuleController = getController('module'); |
708 | - if(is_array($obj->moduleSrlList)) |
|
708 | + if (is_array($obj->moduleSrlList)) |
|
709 | 709 | { |
710 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
710 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
711 | 711 | { |
712 | 712 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
713 | 713 | } |
@@ -42,9 +42,13 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new BaseObject(); |
|
45 | + if(!$member_srl) { |
|
46 | + return new BaseObject(); |
|
47 | + } |
|
46 | 48 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
50 | + return new BaseObject(); |
|
51 | + } |
|
48 | 52 | // Get the point module information |
49 | 53 | $oModuleModel = getModel('module'); |
50 | 54 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -70,9 +74,13 @@ discard block |
||
70 | 74 | { |
71 | 75 | $module_srl = $obj->module_srl; |
72 | 76 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
77 | + if(!$module_srl || !$member_srl) { |
|
78 | + return new BaseObject(); |
|
79 | + } |
|
74 | 80 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
81 | + if($module_srl == $member_srl) { |
|
82 | + return new BaseObject(); |
|
83 | + } |
|
76 | 84 | // Get the point module information |
77 | 85 | $oModuleModel = getModel('module'); |
78 | 86 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -82,12 +90,18 @@ discard block |
||
82 | 90 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 91 | |
84 | 92 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
93 | + if(strlen($point) == 0 && !is_int($point)) { |
|
94 | + $point = $config->insert_document; |
|
95 | + } |
|
86 | 96 | $cur_point += $point; |
87 | 97 | // Add points for attaching a file |
88 | 98 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
99 | + if(strlen($point) == 0 && !is_int($point)) { |
|
100 | + $point = $config->upload_file; |
|
101 | + } |
|
102 | + if($obj->uploaded_count) { |
|
103 | + $cur_point += $point * $obj->uploaded_count; |
|
104 | + } |
|
91 | 105 | // Increase the point |
92 | 106 | $this->setPoint($member_srl,$cur_point); |
93 | 107 | } |
@@ -118,12 +132,18 @@ discard block |
||
118 | 132 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 133 | |
120 | 134 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
135 | + if(strlen($point) == 0 && !is_int($point)) { |
|
136 | + $point = $config->insert_document; |
|
137 | + } |
|
122 | 138 | $cur_point += $point; |
123 | 139 | // Add points for attaching a file |
124 | 140 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
141 | + if(strlen($point) == 0 && !is_int($point)) { |
|
142 | + $point = $config->upload_file; |
|
143 | + } |
|
144 | + if($obj->uploaded_count) { |
|
145 | + $cur_point += $point * $obj->uploaded_count; |
|
146 | + } |
|
127 | 147 | // Increase the point |
128 | 148 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 149 | } |
@@ -141,33 +161,47 @@ discard block |
||
141 | 161 | |
142 | 162 | $oDocumentModel = getModel('document'); |
143 | 163 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
164 | + if(!$oDocument->isExists()) { |
|
165 | + return new BaseObject(); |
|
166 | + } |
|
145 | 167 | // Get the point module information |
146 | 168 | $oModuleModel = getModel('module'); |
147 | 169 | $config = $oModuleModel->getModuleConfig('point'); |
148 | 170 | $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
149 | 171 | // The process related to clearing the post comments |
150 | 172 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
173 | + if(strlen($comment_point) == 0 && !is_int($comment_point)) { |
|
174 | + $comment_point = $config->insert_comment; |
|
175 | + } |
|
152 | 176 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new BaseObject(); |
|
177 | + if($comment_point>0) { |
|
178 | + return new BaseObject(); |
|
179 | + } |
|
154 | 180 | // Get all the comments related to this post |
155 | 181 | $cp_args = new stdClass(); |
156 | 182 | $cp_args->document_srl = $document_srl; |
157 | 183 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 184 | // Return if there is no object |
159 | - if(!$output->data) return new BaseObject(); |
|
185 | + if(!$output->data) { |
|
186 | + return new BaseObject(); |
|
187 | + } |
|
160 | 188 | // Organize the member number |
161 | 189 | $member_srls = array(); |
162 | 190 | $cnt = count($output->data); |
163 | 191 | for($i=0;$i<$cnt;$i++) |
164 | 192 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
193 | + if($output->data[$i]->member_srl<1) { |
|
194 | + continue; |
|
195 | + } |
|
166 | 196 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 197 | } |
168 | 198 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new BaseObject(); |
|
199 | + if($member_srl) { |
|
200 | + unset($member_srls[abs($member_srl)]); |
|
201 | + } |
|
202 | + if(!count($member_srls)) { |
|
203 | + return new BaseObject(); |
|
204 | + } |
|
171 | 205 | // Remove all the points for each member |
172 | 206 | $oPointModel = getModel('point'); |
173 | 207 | // Get the points |
@@ -194,10 +228,14 @@ discard block |
||
194 | 228 | $module_srl = $obj->module_srl; |
195 | 229 | $member_srl = $obj->member_srl; |
196 | 230 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
231 | + if(!$module_srl || !$member_srl) { |
|
232 | + return new BaseObject(); |
|
233 | + } |
|
198 | 234 | // Run only when logged in |
199 | 235 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
236 | + if(!$logged_info->member_srl) { |
|
237 | + return new BaseObject(); |
|
238 | + } |
|
201 | 239 | // Get the points of the member |
202 | 240 | $oPointModel = getModel('point'); |
203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,14 +245,22 @@ discard block |
||
207 | 245 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 246 | |
209 | 247 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
248 | + if(strlen($point) == 0 && !is_int($point)) { |
|
249 | + $point = $config->insert_document; |
|
250 | + } |
|
211 | 251 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new BaseObject(); |
|
252 | + if($point < 0) { |
|
253 | + return new BaseObject(); |
|
254 | + } |
|
213 | 255 | $cur_point -= $point; |
214 | 256 | // Add points related to deleting an attachment |
215 | 257 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
258 | + if(strlen($point) == 0 && !is_int($point)) { |
|
259 | + $point = $config->upload_file; |
|
260 | + } |
|
261 | + if($obj->uploaded_count) { |
|
262 | + $cur_point -= $point * $obj->uploaded_count; |
|
263 | + } |
|
218 | 264 | // Increase the point |
219 | 265 | $this->setPoint($member_srl,$cur_point); |
220 | 266 | } |
@@ -229,12 +275,16 @@ discard block |
||
229 | 275 | { |
230 | 276 | $module_srl = $obj->module_srl; |
231 | 277 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
278 | + if(!$module_srl || !$member_srl) { |
|
279 | + return new BaseObject(); |
|
280 | + } |
|
233 | 281 | // Do not increase the points if the member is the author of the post |
234 | 282 | $document_srl = $obj->document_srl; |
235 | 283 | $oDocumentModel = getModel('document'); |
236 | 284 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
285 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
286 | + return new BaseObject(); |
|
287 | + } |
|
238 | 288 | // Get the point module information |
239 | 289 | $oModuleModel = getModel('module'); |
240 | 290 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,7 +294,9 @@ discard block |
||
244 | 294 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 295 | |
246 | 296 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
297 | + if(strlen($point) == 0 && !is_int($point)) { |
|
298 | + $point = $config->insert_comment; |
|
299 | + } |
|
248 | 300 | // Increase the point |
249 | 301 | $cur_point += $point; |
250 | 302 | $this->setPoint($member_srl,$cur_point); |
@@ -264,11 +316,17 @@ discard block |
||
264 | 316 | $module_srl = $obj->module_srl; |
265 | 317 | $member_srl = abs($obj->member_srl); |
266 | 318 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
319 | + if(!$module_srl || !$member_srl) { |
|
320 | + return new BaseObject(); |
|
321 | + } |
|
268 | 322 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 323 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
324 | + if(!$oDocument->isExists()) { |
|
325 | + return new BaseObject(); |
|
326 | + } |
|
327 | + if($oDocument->get('member_srl')==$member_srl) { |
|
328 | + return new BaseObject(); |
|
329 | + } |
|
272 | 330 | // Get the point module information |
273 | 331 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 332 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,9 +334,13 @@ discard block |
||
276 | 334 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 335 | |
278 | 336 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
337 | + if(strlen($point) == 0 && !is_int($point)) { |
|
338 | + $point = $config->insert_comment; |
|
339 | + } |
|
280 | 340 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new BaseObject(); |
|
341 | + if($point < 0) { |
|
342 | + return new BaseObject(); |
|
343 | + } |
|
282 | 344 | // Increase the point |
283 | 345 | $cur_point -= $point; |
284 | 346 | $this->setPoint($member_srl,$cur_point); |
@@ -301,11 +363,15 @@ discard block |
||
301 | 363 | */ |
302 | 364 | function triggerDeleteFile(&$obj) |
303 | 365 | { |
304 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
366 | + if($obj->isvalid != 'Y') { |
|
367 | + return new BaseObject(); |
|
368 | + } |
|
305 | 369 | |
306 | 370 | $module_srl = $obj->module_srl; |
307 | 371 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
372 | + if(!$module_srl || !$member_srl) { |
|
373 | + return new BaseObject(); |
|
374 | + } |
|
309 | 375 | // Get the point module information |
310 | 376 | $oModuleModel = getModel('module'); |
311 | 377 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,7 +381,9 @@ discard block |
||
315 | 381 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 382 | |
317 | 383 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
384 | + if(strlen($point) == 0 && !is_int($point)) { |
|
385 | + $point = $config->upload_file; |
|
386 | + } |
|
319 | 387 | // Increase the point |
320 | 388 | $cur_point -= $point; |
321 | 389 | $this->setPoint($member_srl,$cur_point); |
@@ -331,18 +399,21 @@ discard block |
||
331 | 399 | $logged_info = Context::get('logged_info'); |
332 | 400 | $member_srl = $logged_info->member_srl; |
333 | 401 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new BaseObject(); |
|
402 | + if(!$module_srl) { |
|
403 | + return new BaseObject(); |
|
404 | + } |
|
335 | 405 | |
336 | 406 | // Pass if it is your file |
337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
407 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
408 | + return new BaseObject(); |
|
409 | + } |
|
338 | 410 | $oModuleModel = getModel('module'); |
339 | 411 | $config = $oModuleModel->getModuleConfig('point'); |
340 | 412 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
341 | 413 | if (isset($module_config['download_file'])) |
342 | 414 | { |
343 | 415 | $point = intval($module_config['download_file']); |
344 | - } |
|
345 | - else |
|
416 | + } else |
|
346 | 417 | { |
347 | 418 | $point = intval($config->download_file); |
348 | 419 | } |
@@ -353,8 +424,7 @@ discard block |
||
353 | 424 | if($config->disable_download == 'Y' && $point) |
354 | 425 | { |
355 | 426 | return new BaseObject(-1,'msg_not_permitted_download'); |
356 | - } |
|
357 | - else |
|
427 | + } else |
|
358 | 428 | { |
359 | 429 | return new BaseObject(); |
360 | 430 | } |
@@ -381,13 +451,19 @@ discard block |
||
381 | 451 | { |
382 | 452 | // Run only when logged in |
383 | 453 | $logged_info = Context::get('logged_info'); |
384 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
454 | + if(!$logged_info->member_srl) { |
|
455 | + return new BaseObject(); |
|
456 | + } |
|
385 | 457 | $module_srl = $obj->module_srl; |
386 | 458 | $member_srl = $logged_info->member_srl; |
387 | - if(!$module_srl) return new BaseObject(); |
|
459 | + if(!$module_srl) { |
|
460 | + return new BaseObject(); |
|
461 | + } |
|
388 | 462 | |
389 | 463 | // Pass if it is your file |
390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
464 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
465 | + return new BaseObject(); |
|
466 | + } |
|
391 | 467 | |
392 | 468 | // Get the point module information |
393 | 469 | $oModuleModel = getModel('module'); |
@@ -396,8 +472,7 @@ discard block |
||
396 | 472 | if (isset($module_config['download_file'])) |
397 | 473 | { |
398 | 474 | $point = intval($module_config['download_file']); |
399 | - } |
|
400 | - else |
|
475 | + } else |
|
401 | 476 | { |
402 | 477 | $point = intval($config->download_file); |
403 | 478 | } |
@@ -428,25 +503,32 @@ discard block |
||
428 | 503 | // Get the original author number |
429 | 504 | $target_member_srl = abs($obj->get('member_srl')); |
430 | 505 | // Pass without increasing the hits if the viewer is the same as the author |
431 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
506 | + if($target_member_srl == $member_srl) { |
|
507 | + return new BaseObject(); |
|
508 | + } |
|
432 | 509 | // Get the point information for each module |
433 | 510 | $config = $oModuleModel->getModuleConfig('point'); |
434 | 511 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
435 | 512 | // Get hits points |
436 | 513 | $point = $module_config['read_document']; |
437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
514 | + if(strlen($point) == 0 && !is_int($point)) { |
|
515 | + $point = $config->read_document; |
|
516 | + } |
|
438 | 517 | // Pass if there are no requested points |
439 | - if(!$point) return new BaseObject(); |
|
518 | + if(!$point) { |
|
519 | + return new BaseObject(); |
|
520 | + } |
|
440 | 521 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
441 | 522 | if($member_srl) |
442 | 523 | { |
443 | 524 | $args->member_srl = $member_srl; |
444 | 525 | $args->document_srl = $obj->document_srl; |
445 | 526 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
446 | - if($output->data->count) return new BaseObject(); |
|
527 | + if($output->data->count) { |
|
528 | + return new BaseObject(); |
|
529 | + } |
|
447 | 530 | $cur_point = $oPointModel->getPoint($member_srl, true); |
448 | - } |
|
449 | - else |
|
531 | + } else |
|
450 | 532 | { |
451 | 533 | $cur_point = 0; |
452 | 534 | } |
@@ -462,9 +544,13 @@ discard block |
||
462 | 544 | return new BaseObject(-1, $message); |
463 | 545 | } |
464 | 546 | // If not logged in, pass |
465 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
547 | + if(!$logged_info->member_srl) { |
|
548 | + return new BaseObject(); |
|
549 | + } |
|
466 | 550 | // Pass, if there are no requested points |
467 | - if(!$point) return new BaseObject(); |
|
551 | + if(!$point) { |
|
552 | + return new BaseObject(); |
|
553 | + } |
|
468 | 554 | // If the read record is missing, leave it |
469 | 555 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
470 | 556 | // Increase the point |
@@ -481,7 +567,9 @@ discard block |
||
481 | 567 | { |
482 | 568 | $module_srl = $obj->module_srl; |
483 | 569 | $member_srl = $obj->member_srl; |
484 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
570 | + if(!$module_srl || !$member_srl) { |
|
571 | + return new BaseObject(); |
|
572 | + } |
|
485 | 573 | |
486 | 574 | $oModuleModel = getModel('module'); |
487 | 575 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -493,15 +581,20 @@ discard block |
||
493 | 581 | if( $obj->point > 0 ) |
494 | 582 | { |
495 | 583 | $point = $module_config['voted']; |
496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
497 | - } |
|
498 | - else |
|
584 | + if(strlen($point) == 0 && !is_int($point)) { |
|
585 | + $point = $config->voted; |
|
586 | + } |
|
587 | + } else |
|
499 | 588 | { |
500 | 589 | $point = $module_config['blamed']; |
501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
590 | + if(strlen($point) == 0 && !is_int($point)) { |
|
591 | + $point = $config->blamed; |
|
592 | + } |
|
502 | 593 | } |
503 | 594 | |
504 | - if(!$point) return new BaseObject(); |
|
595 | + if(!$point) { |
|
596 | + return new BaseObject(); |
|
597 | + } |
|
505 | 598 | // Increase the point |
506 | 599 | $cur_point += $point; |
507 | 600 | $this->setPoint($member_srl,$cur_point); |
@@ -516,7 +609,9 @@ discard block |
||
516 | 609 | { |
517 | 610 | $member_srl = abs($member_srl); |
518 | 611 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
612 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
613 | + $mode = 'update'; |
|
614 | + } |
|
520 | 615 | |
521 | 616 | // Get configuration information |
522 | 617 | $oMemberModel = getModel('member'); |
@@ -546,7 +641,9 @@ discard block |
||
546 | 641 | $args->point = $point; |
547 | 642 | break; |
548 | 643 | } |
549 | - if($args->point < 0) $args->point = 0; |
|
644 | + if($args->point < 0) { |
|
645 | + $args->point = 0; |
|
646 | + } |
|
550 | 647 | $point = $args->point; |
551 | 648 | |
552 | 649 | // Call a trigger (before) |
@@ -568,8 +665,11 @@ discard block |
||
568 | 665 | |
569 | 666 | // If there are points, update, if no, insert |
570 | 667 | $oPointModel = getModel('point'); |
571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
572 | - else executeQuery("point.insertPoint", $args); |
|
668 | + if($oPointModel->isExistsPoint($member_srl)) { |
|
669 | + executeQuery("point.updatePoint", $args); |
|
670 | + } else { |
|
671 | + executeQuery("point.insertPoint", $args); |
|
672 | + } |
|
573 | 673 | |
574 | 674 | // Get a new level |
575 | 675 | $level = $oPointModel->getLevel($point, $config->level_step); |
@@ -599,7 +699,9 @@ discard block |
||
599 | 699 | foreach($point_group as $group_srl => $target_level) |
600 | 700 | { |
601 | 701 | $del_group_list[] = $group_srl; |
602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
702 | + if($target_level == $level) { |
|
703 | + $new_group_list[] = $group_srl; |
|
704 | + } |
|
603 | 705 | } |
604 | 706 | } |
605 | 707 | // Otherwise, in case the level is reduced, add the recent group |
@@ -625,7 +727,9 @@ discard block |
||
625 | 727 | // Delete the group of a level which is higher than the current level |
626 | 728 | foreach($point_group as $group_srl => $target_level) |
627 | 729 | { |
628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
730 | + if($target_level > $level) { |
|
731 | + $del_group_list[] = $group_srl; |
|
732 | + } |
|
629 | 733 | } |
630 | 734 | $del_group_list[] = $default_group->group_srl; |
631 | 735 | } |
@@ -636,11 +740,15 @@ discard block |
||
636 | 740 | foreach($point_group as $group_srl => $target_level) |
637 | 741 | { |
638 | 742 | $del_group_list[] = $group_srl; |
639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
743 | + if($target_level <= $level) { |
|
744 | + $new_group_list[] = $group_srl; |
|
745 | + } |
|
640 | 746 | } |
641 | 747 | } |
642 | 748 | // If there is no a new group, granted the default group |
643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
749 | + if(!$new_group_list[0]) { |
|
750 | + $new_group_list[0] = $default_group->group_srl; |
|
751 | + } |
|
644 | 752 | // Remove linkage group |
645 | 753 | if($del_group_list && count($del_group_list)) |
646 | 754 | { |
@@ -10,32 +10,32 @@ discard block |
||
10 | 10 | $oSecurity = new Security(); |
11 | 11 | $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); |
12 | 12 | |
13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
13 | + if ($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
14 | + if ($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
15 | + if ($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
16 | + if ($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
17 | + if ($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
18 | + if ($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
19 | 19 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; |
20 | 20 | |
21 | 21 | // $this->_getStatusNameListecret option backward compatibility |
22 | 22 | $oDocumentModel = getModel('document'); |
23 | 23 | |
24 | 24 | $statusList = $this->_getStatusNameList($oDocumentModel); |
25 | - if(isset($statusList['SECRET'])) |
|
25 | + if (isset($statusList['SECRET'])) |
|
26 | 26 | { |
27 | 27 | $this->module_info->secret = 'Y'; |
28 | 28 | } |
29 | 29 | |
30 | 30 | // use_category <=1.5.x, hide_category >=1.7.x |
31 | 31 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
32 | - if($count_category) |
|
32 | + if ($count_category) |
|
33 | 33 | { |
34 | - if($this->module_info->hide_category) |
|
34 | + if ($this->module_info->hide_category) |
|
35 | 35 | { |
36 | 36 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
37 | 37 | } |
38 | - else if($this->module_info->use_category) |
|
38 | + else if ($this->module_info->use_category) |
|
39 | 39 | { |
40 | 40 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
41 | 41 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * check the consultation function, if the user is admin then swich off consultation function |
56 | 56 | * if the user is not logged, then disppear write document/write comment./ view document |
57 | 57 | **/ |
58 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
58 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
59 | 59 | { |
60 | 60 | $this->consultation = true; |
61 | - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
61 | + if (!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
62 | 62 | } else { |
63 | 63 | $this->consultation = false; |
64 | 64 | } |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | $extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl); |
68 | 68 | Context::set('extra_keys', $extra_keys); |
69 | 69 | |
70 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin); |
|
71 | - if(!is_dir($template_path)||!$this->module_info->mskin) |
|
70 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin); |
|
71 | + if (!is_dir($template_path) || !$this->module_info->mskin) |
|
72 | 72 | { |
73 | 73 | $this->module_info->mskin = 'default'; |
74 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin); |
|
74 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin); |
|
75 | 75 | } |
76 | 76 | $this->setTemplatePath($template_path); |
77 | 77 | Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | function getBoardCommentPage() |
88 | 88 | { |
89 | 89 | $document_srl = Context::get('document_srl'); |
90 | - $oDocumentModel =& getModel('document'); |
|
91 | - if(!$document_srl) |
|
90 | + $oDocumentModel = & getModel('document'); |
|
91 | + if (!$document_srl) |
|
92 | 92 | { |
93 | 93 | return new BaseObject(-1, "msg_invalid_request"); |
94 | 94 | } |
95 | 95 | |
96 | - if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)) |
|
96 | + if ($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)) |
|
97 | 97 | { |
98 | 98 | return new BaseObject(-1, "msg_not_permitted"); |
99 | 99 | } |
100 | 100 | |
101 | 101 | $oDocument = $oDocumentModel->getDocument($document_srl); |
102 | - if(!$oDocument->isExists()) |
|
102 | + if (!$oDocument->isExists()) |
|
103 | 103 | { |
104 | 104 | return new BaseObject(-1, "msg_invalid_request"); |
105 | 105 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | function dispBoardMessage($msg_code) |
113 | 113 | { |
114 | 114 | $msg = Context::getLang($msg_code); |
115 | - $oMessageObject = &ModuleHandler::getModuleInstance('message','mobile'); |
|
115 | + $oMessageObject = &ModuleHandler::getModuleInstance('message', 'mobile'); |
|
116 | 116 | $oMessageObject->setError(-1); |
117 | 117 | $oMessageObject->setMessage($msg); |
118 | 118 | $oMessageObject->dispMessage(); |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | function procBoardInsertDocument() |
24 | 24 | { |
25 | 25 | // check grant |
26 | - if($this->module_info->module != "board") |
|
26 | + if ($this->module_info->module != "board") |
|
27 | 27 | { |
28 | 28 | return new BaseObject(-1, "msg_invalid_request"); |
29 | 29 | } |
30 | - if(!$this->grant->write_document) |
|
30 | + if (!$this->grant->write_document) |
|
31 | 31 | { |
32 | 32 | return new BaseObject(-1, 'msg_not_permitted'); |
33 | 33 | } |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | // setup variables |
37 | 37 | $obj = Context::getRequestVars(); |
38 | 38 | $obj->module_srl = $this->module_srl; |
39 | - if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N'; |
|
39 | + if ($obj->is_notice != 'Y' || !$this->grant->manager) $obj->is_notice = 'N'; |
|
40 | 40 | $obj->commentStatus = $obj->comment_status; |
41 | 41 | |
42 | 42 | $oModuleModel = getModel('module'); |
43 | 43 | $module_config = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl); |
44 | - if($module_config->mobile_use_editor === 'Y') |
|
44 | + if ($module_config->mobile_use_editor === 'Y') |
|
45 | 45 | { |
46 | - if(!isset($obj->use_editor)) $obj->use_editor = 'Y'; |
|
47 | - if(!isset($obj->use_html)) $obj->use_html = 'Y'; |
|
46 | + if (!isset($obj->use_editor)) $obj->use_editor = 'Y'; |
|
47 | + if (!isset($obj->use_html)) $obj->use_html = 'Y'; |
|
48 | 48 | } |
49 | 49 | else |
50 | 50 | { |
51 | - if(!isset($obj->use_editor)) $obj->use_editor = 'N'; |
|
52 | - if(!isset($obj->use_html)) $obj->use_html = 'N'; |
|
51 | + if (!isset($obj->use_editor)) $obj->use_editor = 'N'; |
|
52 | + if (!isset($obj->use_html)) $obj->use_html = 'N'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | settype($obj->title, "string"); |
56 | - if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); |
|
56 | + if ($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...'); |
|
57 | 57 | //setup dpcument title tp 'Untitled' |
58 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
58 | + if ($obj->title == '') $obj->title = 'Untitled'; |
|
59 | 59 | |
60 | 60 | // unset document style if the user is not the document manager |
61 | - if(!$this->grant->manager) |
|
61 | + if (!$this->grant->manager) |
|
62 | 62 | { |
63 | 63 | unset($obj->title_color); |
64 | 64 | unset($obj->title_bold); |
@@ -75,24 +75,24 @@ discard block |
||
75 | 75 | |
76 | 76 | // update the document if it is existed |
77 | 77 | $is_update = false; |
78 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
78 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
79 | 79 | { |
80 | 80 | $is_update = true; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // if use anonymous is true |
84 | - if($this->module_info->use_anonymous == 'Y') |
|
84 | + if ($this->module_info->use_anonymous == 'Y') |
|
85 | 85 | { |
86 | 86 | $this->module_info->admin_mail = ''; |
87 | 87 | $obj->notify_message = 'N'; |
88 | - if($is_update===false) |
|
88 | + if ($is_update === false) |
|
89 | 89 | { |
90 | - $obj->member_srl = -1*$logged_info->member_srl; |
|
90 | + $obj->member_srl = -1 * $logged_info->member_srl; |
|
91 | 91 | } |
92 | 92 | $obj->email_address = $obj->homepage = $obj->user_id = ''; |
93 | 93 | $obj->user_name = $obj->nick_name = 'anonymous'; |
94 | 94 | $bAnonymous = true; |
95 | - if($is_update===false) |
|
95 | + if ($is_update === false) |
|
96 | 96 | { |
97 | 97 | $oDocument->add('member_srl', $obj->member_srl); |
98 | 98 | } |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | $bAnonymous = false; |
103 | 103 | } |
104 | 104 | |
105 | - if($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) |
|
105 | + if ($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) |
|
106 | 106 | { |
107 | 107 | $use_status = explode('|@|', $this->module_info->use_status); |
108 | - if(!is_array($use_status) || !in_array('SECRET', $use_status)) |
|
108 | + if (!is_array($use_status) || !in_array('SECRET', $use_status)) |
|
109 | 109 | { |
110 | 110 | unset($obj->is_secret); |
111 | 111 | $obj->status = 'PUBLIC'; |
@@ -113,24 +113,24 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | // update the document if it is existed |
116 | - if($is_update) |
|
116 | + if ($is_update) |
|
117 | 117 | { |
118 | - if(!$oDocument->isGranted()) |
|
118 | + if (!$oDocument->isGranted()) |
|
119 | 119 | { |
120 | - return new BaseObject(-1,'msg_not_permitted'); |
|
120 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
121 | 121 | } |
122 | 122 | |
123 | - if($this->module_info->use_anonymous == 'Y') { |
|
123 | + if ($this->module_info->use_anonymous == 'Y') { |
|
124 | 124 | $obj->member_srl = abs($oDocument->get('member_srl')) * -1; |
125 | 125 | $oDocument->add('member_srl', $obj->member_srl); |
126 | 126 | } |
127 | 127 | |
128 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
128 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
129 | 129 | { |
130 | - return new BaseObject(-1,'msg_protect_content'); |
|
130 | + return new BaseObject(-1, 'msg_protect_content'); |
|
131 | 131 | } |
132 | 132 | |
133 | - if(!$this->grant->manager) |
|
133 | + if (!$this->grant->manager) |
|
134 | 134 | { |
135 | 135 | // notice & document style same as before if not manager |
136 | 136 | $obj->is_notice = $oDocument->get('is_notice'); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | // modify list_order if document status is temp |
142 | - if($oDocument->get('status') == 'TEMP') |
|
142 | + if ($oDocument->get('status') == 'TEMP') |
|
143 | 143 | { |
144 | 144 | $obj->last_update = $obj->regdate = date('YmdHis'); |
145 | 145 | $obj->update_order = $obj->list_order = (getNextSequence() * -1); |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | $obj->document_srl = $output->get('document_srl'); |
156 | 156 | |
157 | 157 | // send an email to admin user |
158 | - if($output->toBool() && $this->module_info->admin_mail) |
|
158 | + if ($output->toBool() && $this->module_info->admin_mail) |
|
159 | 159 | { |
160 | 160 | $oModuleModel = getModel('module'); |
161 | 161 | $member_config = $oModuleModel->getModuleConfig('member'); |
162 | 162 | |
163 | 163 | $oMail = new Mail(); |
164 | 164 | $oMail->setTitle($obj->title); |
165 | - $oMail->setContent( sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('','document_srl',$obj->document_srl), getFullUrl('','document_srl',$obj->document_srl), $obj->content)); |
|
165 | + $oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $obj->document_srl), getFullUrl('', 'document_srl', $obj->document_srl), $obj->content)); |
|
166 | 166 | $oMail->setSender($obj->user_name ? $obj->user_name : 'anonymous', $obj->email_address ? $obj->email_address : $member_config->webmaster_email); |
167 | 167 | |
168 | - $target_mail = explode(',',$this->module_info->admin_mail); |
|
169 | - for($i=0;$i<count($target_mail);$i++) |
|
168 | + $target_mail = explode(',', $this->module_info->admin_mail); |
|
169 | + for ($i = 0; $i < count($target_mail); $i++) |
|
170 | 170 | { |
171 | 171 | $email_address = trim($target_mail[$i]); |
172 | - if(!$email_address) continue; |
|
172 | + if (!$email_address) continue; |
|
173 | 173 | $oMail->setReceiptor($email_address, $email_address); |
174 | 174 | $oMail->send(); |
175 | 175 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | // if there is an error |
180 | - if(!$output->toBool()) |
|
180 | + if (!$output->toBool()) |
|
181 | 181 | { |
182 | 182 | return $output; |
183 | 183 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $this->add('document_srl', $output->get('document_srl')); |
188 | 188 | |
189 | 189 | // alert a message |
190 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
190 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
191 | 191 | { |
192 | 192 | $this->setMessage($msg_code); |
193 | 193 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $document_srl = Context::get('document_srl'); |
203 | 203 | |
204 | 204 | // if the document is not existed |
205 | - if(!$document_srl) |
|
205 | + if (!$document_srl) |
|
206 | 206 | { |
207 | 207 | return $this->doError('msg_invalid_document'); |
208 | 208 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $oDocumentModel = &getModel('document'); |
211 | 211 | $oDocument = $oDocumentModel->getDocument($document_srl); |
212 | 212 | // check protect content |
213 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
213 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
214 | 214 | { |
215 | 215 | return new BaseObject(-1, 'msg_protect_content'); |
216 | 216 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | // delete the document |
222 | 222 | $output = $oDocumentController->deleteDocument($document_srl, $this->grant->manager); |
223 | - if(!$output->toBool()) |
|
223 | + if (!$output->toBool()) |
|
224 | 224 | { |
225 | 225 | return $output; |
226 | 226 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '', 'page', Context::get('page'), 'document_srl', '')); |
230 | 230 | $this->add('mid', Context::get('mid')); |
231 | 231 | $this->add('page', Context::get('page')); |
232 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
232 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
233 | 233 | { |
234 | 234 | $this->setMessage('success_deleted'); |
235 | 235 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | function procBoardInsertComment() |
254 | 254 | { |
255 | 255 | // check grant |
256 | - if(!$this->grant->write_comment) |
|
256 | + if (!$this->grant->write_comment) |
|
257 | 257 | { |
258 | 258 | return new BaseObject(-1, 'msg_not_permitted'); |
259 | 259 | } |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | $obj = Context::getRequestVars(); |
264 | 264 | $obj->module_srl = $this->module_srl; |
265 | 265 | |
266 | - if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; |
|
267 | - if(!is_array($this->module_info->use_status)) |
|
266 | + if (!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; |
|
267 | + if (!is_array($this->module_info->use_status)) |
|
268 | 268 | { |
269 | 269 | $this->module_info->use_status = explode('|@|', $this->module_info->use_status); |
270 | 270 | } |
271 | 271 | |
272 | - if(in_array('SECRET', $this->module_info->use_status)) |
|
272 | + if (in_array('SECRET', $this->module_info->use_status)) |
|
273 | 273 | { |
274 | 274 | $this->module_info->secret = 'Y'; |
275 | 275 | } |
@@ -281,31 +281,31 @@ discard block |
||
281 | 281 | |
282 | 282 | $oModuleModel = getModel('module'); |
283 | 283 | $module_config = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl); |
284 | - if($module_config->mobile_use_editor === 'Y') |
|
284 | + if ($module_config->mobile_use_editor === 'Y') |
|
285 | 285 | { |
286 | - if(!isset($obj->use_editor)) $obj->use_editor = 'Y'; |
|
287 | - if(!isset($obj->use_html)) $obj->use_html = 'Y'; |
|
286 | + if (!isset($obj->use_editor)) $obj->use_editor = 'Y'; |
|
287 | + if (!isset($obj->use_html)) $obj->use_html = 'Y'; |
|
288 | 288 | } |
289 | 289 | else |
290 | 290 | { |
291 | - if(!isset($obj->use_editor)) $obj->use_editor = 'N'; |
|
292 | - if(!isset($obj->use_html)) $obj->use_html = 'N'; |
|
291 | + if (!isset($obj->use_editor)) $obj->use_editor = 'N'; |
|
292 | + if (!isset($obj->use_html)) $obj->use_html = 'N'; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // check if the doument is existed |
296 | 296 | $oDocumentModel = getModel('document'); |
297 | 297 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
298 | - if(!$oDocument->isExists()) |
|
298 | + if (!$oDocument->isExists()) |
|
299 | 299 | { |
300 | - return new BaseObject(-1,'msg_not_founded'); |
|
300 | + return new BaseObject(-1, 'msg_not_founded'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | // For anonymous use, remove writer's information and notifying information |
304 | - if($this->module_info->use_anonymous == 'Y') |
|
304 | + if ($this->module_info->use_anonymous == 'Y') |
|
305 | 305 | { |
306 | 306 | $this->module_info->admin_mail = ''; |
307 | 307 | $obj->notify_message = 'N'; |
308 | - $obj->member_srl = -1*$logged_info->member_srl; |
|
308 | + $obj->member_srl = -1 * $logged_info->member_srl; |
|
309 | 309 | $obj->email_address = $obj->homepage = $obj->user_id = ''; |
310 | 310 | $obj->user_name = $obj->nick_name = 'anonymous'; |
311 | 311 | $bAnonymous = true; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | // check the comment is existed |
325 | 325 | // if the comment is not existed, then generate a new sequence |
326 | - if(!$obj->comment_srl) |
|
326 | + if (!$obj->comment_srl) |
|
327 | 327 | { |
328 | 328 | $obj->comment_srl = getNextSequence(); |
329 | 329 | } else { |
@@ -331,14 +331,14 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | // if comment_srl is not existed, then insert the comment |
334 | - if($comment->comment_srl != $obj->comment_srl) |
|
334 | + if ($comment->comment_srl != $obj->comment_srl) |
|
335 | 335 | { |
336 | 336 | |
337 | 337 | // parent_srl is existed |
338 | - if($obj->parent_srl) |
|
338 | + if ($obj->parent_srl) |
|
339 | 339 | { |
340 | 340 | $parent_comment = $oCommentModel->getComment($obj->parent_srl); |
341 | - if(!$parent_comment->comment_srl) |
|
341 | + if (!$parent_comment->comment_srl) |
|
342 | 342 | { |
343 | 343 | return new BaseObject(-1, 'msg_invalid_request'); |
344 | 344 | } |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | // update the comment if it is not existed |
353 | 353 | } else { |
354 | 354 | // check the grant |
355 | - if(!$comment->isGranted()) |
|
355 | + if (!$comment->isGranted()) |
|
356 | 356 | { |
357 | - return new BaseObject(-1,'msg_not_permitted'); |
|
357 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | $obj->parent_srl = $comment->parent_srl; |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | $comment_srl = $obj->comment_srl; |
363 | 363 | } |
364 | 364 | |
365 | - if(!$output->toBool()) |
|
365 | + if (!$output->toBool()) |
|
366 | 366 | { |
367 | 367 | return $output; |
368 | 368 | } |
369 | 369 | |
370 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
370 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
371 | 371 | { |
372 | 372 | $this->setMessage('success_registed'); |
373 | 373 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | { |
384 | 384 | // get the comment_srl |
385 | 385 | $comment_srl = Context::get('comment_srl'); |
386 | - if(!$comment_srl) |
|
386 | + if (!$comment_srl) |
|
387 | 387 | { |
388 | 388 | return $this->doError('msg_invalid_request'); |
389 | 389 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $oCommentController = getController('comment'); |
393 | 393 | |
394 | 394 | $output = $oCommentController->deleteComment($comment_srl, $this->grant->manager); |
395 | - if(!$output->toBool()) |
|
395 | + if (!$output->toBool()) |
|
396 | 396 | { |
397 | 397 | return $output; |
398 | 398 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $this->add('mid', Context::get('mid')); |
401 | 401 | $this->add('page', Context::get('page')); |
402 | 402 | $this->add('document_srl', $output->get('document_srl')); |
403 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
403 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
404 | 404 | { |
405 | 405 | $this->setMessage('success_deleted'); |
406 | 406 | } |
@@ -416,10 +416,10 @@ discard block |
||
416 | 416 | // generate trackback module controller object |
417 | 417 | $oTrackbackController = getController('trackback'); |
418 | 418 | |
419 | - if(!$oTrackbackController) return; |
|
419 | + if (!$oTrackbackController) return; |
|
420 | 420 | |
421 | 421 | $output = $oTrackbackController->deleteTrackback($trackback_srl, $this->grant->manager); |
422 | - if(!$output->toBool()) |
|
422 | + if (!$output->toBool()) |
|
423 | 423 | { |
424 | 424 | return $output; |
425 | 425 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $this->add('mid', Context::get('mid')); |
428 | 428 | $this->add('page', Context::get('page')); |
429 | 429 | $this->add('document_srl', $output->get('document_srl')); |
430 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
430 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
431 | 431 | { |
432 | 432 | $this->setMessage('success_deleted'); |
433 | 433 | } |
@@ -446,18 +446,18 @@ discard block |
||
446 | 446 | $oMemberModel = getModel('member'); |
447 | 447 | |
448 | 448 | // if the comment exists |
449 | - if($comment_srl) |
|
449 | + if ($comment_srl) |
|
450 | 450 | { |
451 | 451 | // get the comment information |
452 | 452 | $oCommentModel = getModel('comment'); |
453 | 453 | $oComment = $oCommentModel->getComment($comment_srl); |
454 | - if(!$oComment->isExists()) |
|
454 | + if (!$oComment->isExists()) |
|
455 | 455 | { |
456 | 456 | return new BaseObject(-1, 'msg_invalid_request'); |
457 | 457 | } |
458 | 458 | |
459 | 459 | // compare the comment password and the user input password |
460 | - if(!$oMemberModel->isValidPassword($oComment->get('password'),$password)) |
|
460 | + if (!$oMemberModel->isValidPassword($oComment->get('password'), $password)) |
|
461 | 461 | { |
462 | 462 | return new BaseObject(-1, 'msg_invalid_password'); |
463 | 463 | } |
@@ -467,13 +467,13 @@ discard block |
||
467 | 467 | // get the document information |
468 | 468 | $oDocumentModel = getModel('document'); |
469 | 469 | $oDocument = $oDocumentModel->getDocument($document_srl); |
470 | - if(!$oDocument->isExists()) |
|
470 | + if (!$oDocument->isExists()) |
|
471 | 471 | { |
472 | 472 | return new BaseObject(-1, 'msg_invalid_request'); |
473 | 473 | } |
474 | 474 | |
475 | 475 | // compare the document password and the user input password |
476 | - if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password)) |
|
476 | + if (!$oMemberModel->isValidPassword($oDocument->get('password'), $password)) |
|
477 | 477 | { |
478 | 478 | return new BaseObject(-1, 'msg_invalid_password'); |
479 | 479 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | $member_srl = Context::get('target_srl'); |
491 | 491 | $mid = Context::get('cur_mid'); |
492 | 492 | |
493 | - if(!$member_srl || !$mid) |
|
493 | + if (!$member_srl || !$mid) |
|
494 | 494 | { |
495 | 495 | return new BaseObject(); |
496 | 496 | } |
@@ -502,13 +502,13 @@ discard block |
||
502 | 502 | $columnList = array('module'); |
503 | 503 | $cur_module_info = $oModuleModel->getModuleInfoByMid($mid, 0, $columnList); |
504 | 504 | |
505 | - if($cur_module_info->module != 'board') |
|
505 | + if ($cur_module_info->module != 'board') |
|
506 | 506 | { |
507 | 507 | return new BaseObject(); |
508 | 508 | } |
509 | 509 | |
510 | 510 | // get the member information |
511 | - if($member_srl == $logged_info->member_srl) |
|
511 | + if ($member_srl == $logged_info->member_srl) |
|
512 | 512 | { |
513 | 513 | $member_info = $logged_info; |
514 | 514 | } else { |
@@ -516,13 +516,13 @@ discard block |
||
516 | 516 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
517 | 517 | } |
518 | 518 | |
519 | - if(!$member_info->user_id) |
|
519 | + if (!$member_info->user_id) |
|
520 | 520 | { |
521 | 521 | return new BaseObject(); |
522 | 522 | } |
523 | 523 | |
524 | 524 | //search |
525 | - $url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name); |
|
525 | + $url = getUrl('', 'mid', $mid, 'search_target', 'nick_name', 'search_keyword', $member_info->nick_name); |
|
526 | 526 | $oMemberController = getController('member'); |
527 | 527 | $oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', ''); |
528 | 528 |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * setup the module general information |
25 | 25 | **/ |
26 | - if($this->module_info->list_count) |
|
26 | + if ($this->module_info->list_count) |
|
27 | 27 | { |
28 | 28 | $this->list_count = $this->module_info->list_count; |
29 | 29 | } |
30 | - if($this->module_info->search_list_count) |
|
30 | + if ($this->module_info->search_list_count) |
|
31 | 31 | { |
32 | 32 | $this->search_list_count = $this->module_info->search_list_count; |
33 | 33 | } |
34 | - if($this->module_info->page_count) |
|
34 | + if ($this->module_info->page_count) |
|
35 | 35 | { |
36 | 36 | $this->page_count = $this->module_info->page_count; |
37 | 37 | } |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | $oDocumentModel = getModel('document'); |
42 | 42 | |
43 | 43 | $statusList = $this->_getStatusNameList($oDocumentModel); |
44 | - if(isset($statusList['SECRET'])) |
|
44 | + if (isset($statusList['SECRET'])) |
|
45 | 45 | { |
46 | 46 | $this->module_info->secret = 'Y'; |
47 | 47 | } |
48 | 48 | |
49 | 49 | // use_category <=1.5.x, hide_category >=1.7.x |
50 | 50 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
51 | - if($count_category) |
|
51 | + if ($count_category) |
|
52 | 52 | { |
53 | - if($this->module_info->hide_category) |
|
53 | + if ($this->module_info->hide_category) |
|
54 | 54 | { |
55 | 55 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
56 | 56 | } |
57 | - else if($this->module_info->use_category) |
|
57 | + else if ($this->module_info->use_category) |
|
58 | 58 | { |
59 | 59 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
60 | 60 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * check the consultation function, if the user is admin then swich off consultation function |
75 | 75 | * if the user is not logged, then disppear write document/write comment./ view document |
76 | 76 | **/ |
77 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
77 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
78 | 78 | { |
79 | 79 | $this->consultation = TRUE; |
80 | - if(!Context::get('is_logged')) |
|
80 | + if (!Context::get('is_logged')) |
|
81 | 81 | { |
82 | 82 | $this->grant->list = FALSE; |
83 | 83 | $this->grant->write_document = FALSE; |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * setup the template path based on the skin |
95 | 95 | * the default skin is default |
96 | 96 | **/ |
97 | - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
|
98 | - if(!is_dir($template_path)||!$this->module_info->skin) |
|
97 | + $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); |
|
98 | + if (!is_dir($template_path) || !$this->module_info->skin) |
|
99 | 99 | { |
100 | 100 | $this->module_info->skin = 'default'; |
101 | - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
|
101 | + $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); |
|
102 | 102 | } |
103 | 103 | $this->setTemplatePath($template_path); |
104 | 104 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | **/ |
115 | 115 | if (is_array($extra_keys)) |
116 | 116 | { |
117 | - foreach($extra_keys as $val) |
|
117 | + foreach ($extra_keys as $val) |
|
118 | 118 | { |
119 | 119 | $this->order_target[] = $val->eid; |
120 | 120 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | |
128 | 128 | // remove [document_srl]_cpage from get_vars |
129 | 129 | $args = Context::getRequestVars(); |
130 | - foreach($args as $name => $value) |
|
130 | + foreach ($args as $name => $value) |
|
131 | 131 | { |
132 | - if(preg_match('/[0-9]+_cpage/', $name)) |
|
132 | + if (preg_match('/[0-9]+_cpage/', $name)) |
|
133 | 133 | { |
134 | 134 | Context::set($name, '', TRUE); |
135 | 135 | Context::set($name, $value); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | /** |
146 | 146 | * check the access grant (all the grant has been set by the module object) |
147 | 147 | **/ |
148 | - if(!$this->grant->access || !$this->grant->list) |
|
148 | + if (!$this->grant->access || !$this->grant->list) |
|
149 | 149 | { |
150 | 150 | return $this->dispBoardMessage('msg_not_permitted'); |
151 | 151 | } |
@@ -160,22 +160,22 @@ discard block |
||
160 | 160 | * add extra vaiables to the search options |
161 | 161 | **/ |
162 | 162 | // use search options on the template (the search options key has been declared, based on the language selected) |
163 | - foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
163 | + foreach ($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
164 | 164 | $extra_keys = Context::get('extra_keys'); |
165 | - if($extra_keys) |
|
165 | + if ($extra_keys) |
|
166 | 166 | { |
167 | - foreach($extra_keys as $key => $val) |
|
167 | + foreach ($extra_keys as $key => $val) |
|
168 | 168 | { |
169 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
169 | + if ($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | // remove a search option that is not public in member config |
173 | 173 | $memberConfig = getModel('module')->getModuleConfig('member'); |
174 | - foreach($memberConfig->signupForm as $signupFormElement) |
|
174 | + foreach ($memberConfig->signupForm as $signupFormElement) |
|
175 | 175 | { |
176 | - if(in_array($signupFormElement->title, $search_option)) |
|
176 | + if (in_array($signupFormElement->title, $search_option)) |
|
177 | 177 | { |
178 | - if($signupFormElement->isPublic == 'N') |
|
178 | + if ($signupFormElement->isPublic == 'N') |
|
179 | 179 | unset($search_option[$signupFormElement->name]); |
180 | 180 | } |
181 | 181 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $oDocumentModel = getModel('document'); |
185 | 185 | $statusNameList = $this->_getStatusNameList($oDocumentModel); |
186 | - if(count($statusNameList) > 0) |
|
186 | + if (count($statusNameList) > 0) |
|
187 | 187 | { |
188 | 188 | Context::set('status_list', $statusNameList); |
189 | 189 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | // list config, columnList setting |
195 | 195 | $oBoardModel = getModel('board'); |
196 | 196 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
197 | - if(!$this->listConfig) $this->listConfig = array(); |
|
197 | + if (!$this->listConfig) $this->listConfig = array(); |
|
198 | 198 | $this->_makeListColumnList(); |
199 | 199 | |
200 | 200 | // display the notice list |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * @brief display the category list |
220 | 220 | **/ |
221 | - function dispBoardCategoryList(){ |
|
221 | + function dispBoardCategoryList() { |
|
222 | 222 | // check if the use_category option is enabled |
223 | - if($this->module_info->use_category=='Y') |
|
223 | + if ($this->module_info->use_category == 'Y') |
|
224 | 224 | { |
225 | 225 | // check the grant |
226 | - if(!$this->grant->list) |
|
226 | + if (!$this->grant->list) |
|
227 | 227 | { |
228 | 228 | Context::set('category_list', array()); |
229 | 229 | return; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | /** |
241 | 241 | * @brief display the board conent view |
242 | 242 | **/ |
243 | - function dispBoardContentView(){ |
|
243 | + function dispBoardContentView() { |
|
244 | 244 | // get the variable value |
245 | 245 | $document_srl = Context::get('document_srl'); |
246 | 246 | $page = Context::get('page'); |
@@ -251,36 +251,36 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * if the document exists, then get the document information |
253 | 253 | **/ |
254 | - if($document_srl) |
|
254 | + if ($document_srl) |
|
255 | 255 | { |
256 | 256 | $oDocument = $oDocumentModel->getDocument($document_srl, false, true); |
257 | 257 | |
258 | 258 | // if the document is existed |
259 | - if($oDocument->isExists()) |
|
259 | + if ($oDocument->isExists()) |
|
260 | 260 | { |
261 | 261 | // if the module srl is not consistent |
262 | - if($oDocument->get('module_srl')!=$this->module_info->module_srl ) |
|
262 | + if ($oDocument->get('module_srl') != $this->module_info->module_srl) |
|
263 | 263 | { |
264 | 264 | return $this->stop('msg_invalid_request'); |
265 | 265 | } |
266 | 266 | |
267 | 267 | // check the manage grant |
268 | - if($this->grant->manager) $oDocument->setGrant(); |
|
268 | + if ($this->grant->manager) $oDocument->setGrant(); |
|
269 | 269 | |
270 | 270 | // if the consultation function is enabled, and the document is not a notice |
271 | - if($this->consultation && !$oDocument->isNotice()) |
|
271 | + if ($this->consultation && !$oDocument->isNotice()) |
|
272 | 272 | { |
273 | 273 | $logged_info = Context::get('logged_info'); |
274 | - if($oDocument->get('member_srl')!=$logged_info->member_srl) |
|
274 | + if ($oDocument->get('member_srl') != $logged_info->member_srl) |
|
275 | 275 | { |
276 | 276 | $oDocument = $oDocumentModel->getDocument(0); |
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | 280 | // if the document is TEMP saved, check Grant |
281 | - if($oDocument->getStatus() == 'TEMP') |
|
281 | + if ($oDocument->getStatus() == 'TEMP') |
|
282 | 282 | { |
283 | - if(!$oDocument->isGranted()) |
|
283 | + if (!$oDocument->isGranted()) |
|
284 | 284 | { |
285 | 285 | $oDocument = $oDocumentModel->getDocument(0); |
286 | 286 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | else |
291 | 291 | { |
292 | 292 | // if the document is not existed, then alert a warning message |
293 | - Context::set('document_srl','',true); |
|
293 | + Context::set('document_srl', '', true); |
|
294 | 294 | $this->alertMessage('msg_not_founded'); |
295 | 295 | } |
296 | 296 | |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | /** |
307 | 307 | *check the document view grant |
308 | 308 | **/ |
309 | - if($oDocument->isExists()) |
|
309 | + if ($oDocument->isExists()) |
|
310 | 310 | { |
311 | - if(!$this->grant->view && !$oDocument->isGranted()) |
|
311 | + if (!$this->grant->view && !$oDocument->isGranted()) |
|
312 | 312 | { |
313 | 313 | $oDocument = $oDocumentModel->getDocument(0); |
314 | - Context::set('document_srl','',true); |
|
314 | + Context::set('document_srl', '', true); |
|
315 | 315 | $this->alertMessage('msg_not_permitted'); |
316 | 316 | } |
317 | 317 | else |
@@ -320,15 +320,15 @@ discard block |
||
320 | 320 | Context::addBrowserTitle($oDocument->getTitleText()); |
321 | 321 | |
322 | 322 | // update the document view count (if the document is not secret) |
323 | - if(!$oDocument->isSecret() || $oDocument->isGranted()) |
|
323 | + if (!$oDocument->isSecret() || $oDocument->isGranted()) |
|
324 | 324 | { |
325 | 325 | $oDocument->updateReadedCount(); |
326 | 326 | } |
327 | 327 | |
328 | 328 | // disappear the document if it is secret |
329 | - if($oDocument->isSecret() && !$oDocument->isGranted()) |
|
329 | + if ($oDocument->isSecret() && !$oDocument->isGranted()) |
|
330 | 330 | { |
331 | - $oDocument->add('content',Context::getLang('thisissecret')); |
|
331 | + $oDocument->add('content', Context::getLang('thisissecret')); |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | } |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | /** |
349 | 349 | * @brief display the document file list (can be used by API) |
350 | 350 | **/ |
351 | - function dispBoardContentFileList(){ |
|
351 | + function dispBoardContentFileList() { |
|
352 | 352 | /** |
353 | 353 | * check the access grant (all the grant has been set by the module object) |
354 | 354 | **/ |
355 | - if(!$this->grant->access) |
|
355 | + if (!$this->grant->access) |
|
356 | 356 | { |
357 | 357 | return $this->dispBoardMessage('msg_not_permitted'); |
358 | 358 | } |
@@ -363,41 +363,41 @@ discard block |
||
363 | 363 | // Check if a permission for file download is granted |
364 | 364 | // Get configurations (using module model object) |
365 | 365 | $oModuleModel = getModel('module'); |
366 | - $file_module_config = $oModuleModel->getModulePartConfig('file',$this->module_srl); |
|
366 | + $file_module_config = $oModuleModel->getModulePartConfig('file', $this->module_srl); |
|
367 | 367 | |
368 | 368 | $downloadGrantCount = 0; |
369 | - if(is_array($file_module_config->download_grant)) |
|
369 | + if (is_array($file_module_config->download_grant)) |
|
370 | 370 | { |
371 | - foreach($file_module_config->download_grant AS $value) |
|
372 | - if($value) $downloadGrantCount++; |
|
371 | + foreach ($file_module_config->download_grant AS $value) |
|
372 | + if ($value) $downloadGrantCount++; |
|
373 | 373 | } |
374 | 374 | |
375 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
375 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
376 | 376 | { |
377 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
377 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
378 | 378 | $logged_info = Context::get('logged_info'); |
379 | - if($logged_info->is_admin != 'Y') |
|
379 | + if ($logged_info->is_admin != 'Y') |
|
380 | 380 | { |
381 | - $oModuleModel =& getModel('module'); |
|
381 | + $oModuleModel = & getModel('module'); |
|
382 | 382 | $columnList = array('module_srl', 'site_srl'); |
383 | 383 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl, $columnList); |
384 | 384 | |
385 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
385 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
386 | 386 | { |
387 | - $oMemberModel =& getModel('member'); |
|
387 | + $oMemberModel = & getModel('member'); |
|
388 | 388 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
389 | 389 | |
390 | 390 | $is_permitted = false; |
391 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
391 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
392 | 392 | { |
393 | 393 | $group_srl = $file_module_config->download_grant[$i]; |
394 | - if($member_groups[$group_srl]) |
|
394 | + if ($member_groups[$group_srl]) |
|
395 | 395 | { |
396 | 396 | $is_permitted = true; |
397 | 397 | break; |
398 | 398 | } |
399 | 399 | } |
400 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
400 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $document_srl = Context::get('document_srl'); |
407 | 407 | $oDocument = $oDocumentModel->getDocument($document_srl); |
408 | 408 | Context::set('oDocument', $oDocument); |
409 | - Context::set('file_list',$oDocument->getUploadedFiles()); |
|
409 | + Context::set('file_list', $oDocument->getUploadedFiles()); |
|
410 | 410 | |
411 | 411 | $oSecurity = new Security(); |
412 | 412 | $oSecurity->encodeHTML('file_list..source_filename'); |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | /** |
416 | 416 | * @brief display the document comment list (can be used by API) |
417 | 417 | **/ |
418 | - function dispBoardContentCommentList(){ |
|
418 | + function dispBoardContentCommentList() { |
|
419 | 419 | // check document view grant |
420 | 420 | $this->dispBoardContentView(); |
421 | 421 | |
@@ -425,26 +425,26 @@ discard block |
||
425 | 425 | $comment_list = $oDocument->getComments(); |
426 | 426 | |
427 | 427 | // setup the comment list |
428 | - if(is_array($comment_list)) |
|
428 | + if (is_array($comment_list)) |
|
429 | 429 | { |
430 | - foreach($comment_list as $key => $val) |
|
430 | + foreach ($comment_list as $key => $val) |
|
431 | 431 | { |
432 | - if(!$val->isAccessible()) |
|
432 | + if (!$val->isAccessible()) |
|
433 | 433 | { |
434 | - $val->add('content',Context::getLang('thisissecret')); |
|
434 | + $val->add('content', Context::getLang('thisissecret')); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | } |
438 | - Context::set('comment_list',$comment_list); |
|
438 | + Context::set('comment_list', $comment_list); |
|
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
443 | 443 | * @brief display notice list (can be used by API) |
444 | 444 | **/ |
445 | - function dispBoardNoticeList(){ |
|
445 | + function dispBoardNoticeList() { |
|
446 | 446 | // check the grant |
447 | - if(!$this->grant->list) |
|
447 | + if (!$this->grant->list) |
|
448 | 448 | { |
449 | 449 | Context::set('notice_list', array()); |
450 | 450 | return; |
@@ -460,15 +460,15 @@ discard block |
||
460 | 460 | /** |
461 | 461 | * @brief display board content list |
462 | 462 | **/ |
463 | - function dispBoardContentList(){ |
|
463 | + function dispBoardContentList() { |
|
464 | 464 | // check the grant |
465 | - if(!$this->grant->list) |
|
465 | + if (!$this->grant->list) |
|
466 | 466 | { |
467 | 467 | Context::set('document_list', array()); |
468 | 468 | Context::set('total_count', 0); |
469 | 469 | Context::set('total_page', 1); |
470 | 470 | Context::set('page', 1); |
471 | - Context::set('page_navigation', new PageHandler(0,0,1,10)); |
|
471 | + Context::set('page_navigation', new PageHandler(0, 0, 1, 10)); |
|
472 | 472 | return; |
473 | 473 | } |
474 | 474 | |
@@ -486,17 +486,17 @@ discard block |
||
486 | 486 | $args->search_keyword = Context::get('search_keyword'); |
487 | 487 | |
488 | 488 | $search_option = Context::get('search_option'); |
489 | - if($search_option==FALSE) |
|
489 | + if ($search_option == FALSE) |
|
490 | 490 | { |
491 | 491 | $search_option = $this->search_option; |
492 | 492 | } |
493 | - if(isset($search_option[$args->search_target])==FALSE) |
|
493 | + if (isset($search_option[$args->search_target]) == FALSE) |
|
494 | 494 | { |
495 | 495 | $args->search_target = ''; |
496 | 496 | } |
497 | 497 | |
498 | 498 | // if the category is enabled, then get the category |
499 | - if($this->module_info->use_category=='Y') |
|
499 | + if ($this->module_info->use_category == 'Y') |
|
500 | 500 | { |
501 | 501 | $args->category_srl = Context::get('category'); |
502 | 502 | } |
@@ -504,21 +504,21 @@ discard block |
||
504 | 504 | // setup the sort index and order index |
505 | 505 | $args->sort_index = Context::get('sort_index'); |
506 | 506 | $args->order_type = Context::get('order_type'); |
507 | - if(!in_array($args->sort_index, $this->order_target)) |
|
507 | + if (!in_array($args->sort_index, $this->order_target)) |
|
508 | 508 | { |
509 | - $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; |
|
509 | + $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; |
|
510 | 510 | } |
511 | - if(!in_array($args->order_type, array('asc','desc'))) |
|
511 | + if (!in_array($args->order_type, array('asc', 'desc'))) |
|
512 | 512 | { |
513 | - $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc'; |
|
513 | + $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | // set the current page of documents |
517 | 517 | $document_srl = Context::get('document_srl'); |
518 | - if(!$args->page && $document_srl) |
|
518 | + if (!$args->page && $document_srl) |
|
519 | 519 | { |
520 | 520 | $oDocument = $oDocumentModel->getDocument($document_srl); |
521 | - if($oDocument->isExists() && !$oDocument->isNotice()) |
|
521 | + if ($oDocument->isExists() && !$oDocument->isNotice()) |
|
522 | 522 | { |
523 | 523 | $page = $oDocumentModel->getDocumentPage($oDocument, $args); |
524 | 524 | Context::set('page', $page); |
@@ -527,13 +527,13 @@ discard block |
||
527 | 527 | } |
528 | 528 | |
529 | 529 | // setup the list count to be serach list count, if the category or search keyword has been set |
530 | - if($args->category_srl || $args->search_keyword) |
|
530 | + if ($args->category_srl || $args->search_keyword) |
|
531 | 531 | { |
532 | 532 | $args->list_count = $this->search_list_count; |
533 | 533 | } |
534 | 534 | |
535 | 535 | // if the consultation function is enabled, the get the logged user information |
536 | - if($this->consultation) |
|
536 | + if ($this->consultation) |
|
537 | 537 | { |
538 | 538 | $logged_info = Context::get('logged_info'); |
539 | 539 | $args->member_srl = $logged_info->member_srl; |
@@ -561,18 +561,18 @@ discard block |
||
561 | 561 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
562 | 562 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
563 | 563 | |
564 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
564 | + if (in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
565 | 565 | |
566 | 566 | // default column list add |
567 | 567 | $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'); |
568 | 568 | |
569 | 569 | //TODO guestbook, blog style supports legacy codes. |
570 | - if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
570 | + if ($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
571 | 571 | { |
572 | 572 | $defaultColumn = $tableColumnList; |
573 | 573 | } |
574 | 574 | |
575 | - if (in_array('last_post', $configColumList)){ |
|
575 | + if (in_array('last_post', $configColumList)) { |
|
576 | 576 | array_push($this->columnList, 'last_updater'); |
577 | 577 | } |
578 | 578 | |
@@ -584,9 +584,9 @@ discard block |
||
584 | 584 | $this->columnList = array_unique(array_merge($this->columnList, $defaultColumn)); |
585 | 585 | |
586 | 586 | // add table name |
587 | - foreach($this->columnList as $no => $value) |
|
587 | + foreach ($this->columnList as $no => $value) |
|
588 | 588 | { |
589 | - $this->columnList[$no] = 'documents.' . $value; |
|
589 | + $this->columnList[$no] = 'documents.'.$value; |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | function dispBoardTagList() |
597 | 597 | { |
598 | 598 | // check if there is not grant fot view list, then alert an warning message |
599 | - if(!$this->grant->list) |
|
599 | + if (!$this->grant->list) |
|
600 | 600 | { |
601 | 601 | return $this->dispBoardMessage('msg_not_permitted'); |
602 | 602 | } |
@@ -610,14 +610,14 @@ discard block |
||
610 | 610 | $output = $oTagModel->getTagList($obj); |
611 | 611 | |
612 | 612 | // automatically order |
613 | - if(count($output->data)) |
|
613 | + if (count($output->data)) |
|
614 | 614 | { |
615 | 615 | $numbers = array_keys($output->data); |
616 | 616 | shuffle($numbers); |
617 | 617 | |
618 | - if(count($output->data)) |
|
618 | + if (count($output->data)) |
|
619 | 619 | { |
620 | - foreach($numbers as $k => $v) |
|
620 | + foreach ($numbers as $k => $v) |
|
621 | 621 | { |
622 | 622 | $tag_list[] = $output->data[$v]; |
623 | 623 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | function dispBoardWrite() |
639 | 639 | { |
640 | 640 | // check grant |
641 | - if(!$this->grant->write_document) |
|
641 | + if (!$this->grant->write_document) |
|
642 | 642 | { |
643 | 643 | return $this->dispBoardMessage('msg_not_permitted'); |
644 | 644 | } |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | /** |
649 | 649 | * check if the category option is enabled not not |
650 | 650 | **/ |
651 | - if($this->module_info->use_category=='Y') |
|
651 | + if ($this->module_info->use_category == 'Y') |
|
652 | 652 | { |
653 | 653 | // get the user group information |
654 | - if(Context::get('is_logged')) |
|
654 | + if (Context::get('is_logged')) |
|
655 | 655 | { |
656 | 656 | $logged_info = Context::get('logged_info'); |
657 | 657 | $group_srls = array_keys($logged_info->group_list); |
@@ -664,19 +664,19 @@ discard block |
||
664 | 664 | |
665 | 665 | // check the grant after obtained the category list |
666 | 666 | $normal_category_list = $oDocumentModel->getCategoryList($this->module_srl); |
667 | - if(count($normal_category_list)) |
|
667 | + if (count($normal_category_list)) |
|
668 | 668 | { |
669 | - foreach($normal_category_list as $category_srl => $category) |
|
669 | + foreach ($normal_category_list as $category_srl => $category) |
|
670 | 670 | { |
671 | 671 | $is_granted = TRUE; |
672 | - if($category->group_srls) |
|
672 | + if ($category->group_srls) |
|
673 | 673 | { |
674 | - $category_group_srls = explode(',',$category->group_srls); |
|
674 | + $category_group_srls = explode(',', $category->group_srls); |
|
675 | 675 | $is_granted = FALSE; |
676 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
676 | + if (count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
677 | 677 | |
678 | 678 | } |
679 | - if($is_granted) $category_list[$category_srl] = $category; |
|
679 | + if ($is_granted) $category_list[$category_srl] = $category; |
|
680 | 680 | } |
681 | 681 | } |
682 | 682 | Context::set('category_list', $category_list); |
@@ -687,46 +687,46 @@ discard block |
||
687 | 687 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
688 | 688 | $oDocument->setDocument($document_srl); |
689 | 689 | |
690 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
690 | + if ($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
691 | 691 | $oDocument->add('module_srl', $this->module_srl); |
692 | 692 | |
693 | - if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
693 | + if ($oDocument->isExists() && $this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
694 | 694 | { |
695 | 695 | return new BaseObject(-1, 'msg_protect_content'); |
696 | 696 | } |
697 | 697 | |
698 | 698 | // if the document is not granted, then back to the password input form |
699 | 699 | $oModuleModel = getModel('module'); |
700 | - if($oDocument->isExists()&&!$oDocument->isGranted()) |
|
700 | + if ($oDocument->isExists() && !$oDocument->isGranted()) |
|
701 | 701 | { |
702 | 702 | return $this->setTemplateFile('input_password_form'); |
703 | 703 | } |
704 | 704 | |
705 | - if(!$oDocument->isExists()) |
|
705 | + if (!$oDocument->isExists()) |
|
706 | 706 | { |
707 | - $point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl); |
|
707 | + $point_config = $oModuleModel->getModulePartConfig('point', $this->module_srl); |
|
708 | 708 | $logged_info = Context::get('logged_info'); |
709 | 709 | $oPointModel = getModel('point'); |
710 | 710 | $pointForInsert = $point_config["insert_document"]; |
711 | - if($pointForInsert < 0) |
|
711 | + if ($pointForInsert < 0) |
|
712 | 712 | { |
713 | - if( !$logged_info ) |
|
713 | + if (!$logged_info) |
|
714 | 714 | { |
715 | 715 | return $this->dispBoardMessage('msg_not_permitted'); |
716 | 716 | } |
717 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
717 | + else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert) < 0) |
|
718 | 718 | { |
719 | 719 | return $this->dispBoardMessage('msg_not_enough_point'); |
720 | 720 | } |
721 | 721 | } |
722 | 722 | } |
723 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
723 | + if (!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
724 | 724 | |
725 | 725 | $statusList = $this->_getStatusNameList($oDocumentModel); |
726 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
726 | + if (count($statusList) > 0) Context::set('status_list', $statusList); |
|
727 | 727 | |
728 | 728 | // get Document status config value |
729 | - Context::set('document_srl',$document_srl); |
|
729 | + Context::set('document_srl', $document_srl); |
|
730 | 730 | Context::set('oDocument', $oDocument); |
731 | 731 | |
732 | 732 | // apply xml_js_filter on header |
@@ -734,12 +734,12 @@ discard block |
||
734 | 734 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
735 | 735 | |
736 | 736 | // if the document exists, then setup extra variabels on context |
737 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
737 | + if ($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
738 | 738 | |
739 | 739 | /** |
740 | 740 | * add JS filters |
741 | 741 | **/ |
742 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
742 | + if (Context::get('logged_info')->is_admin == 'Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
743 | 743 | else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
744 | 744 | |
745 | 745 | $oSecurity = new Security(); |
@@ -751,14 +751,14 @@ discard block |
||
751 | 751 | function _getStatusNameList(&$oDocumentModel) |
752 | 752 | { |
753 | 753 | $resultList = array(); |
754 | - if(!empty($this->module_info->use_status)) |
|
754 | + if (!empty($this->module_info->use_status)) |
|
755 | 755 | { |
756 | 756 | $statusNameList = $oDocumentModel->getStatusNameList(); |
757 | 757 | $statusList = explode('|@|', $this->module_info->use_status); |
758 | 758 | |
759 | - if(is_array($statusList)) |
|
759 | + if (is_array($statusList)) |
|
760 | 760 | { |
761 | - foreach($statusList as $key => $value) |
|
761 | + foreach ($statusList as $key => $value) |
|
762 | 762 | { |
763 | 763 | $resultList[$value] = $statusNameList[$value]; |
764 | 764 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | function dispBoardDelete() |
774 | 774 | { |
775 | 775 | // check grant |
776 | - if(!$this->grant->write_document) |
|
776 | + if (!$this->grant->write_document) |
|
777 | 777 | { |
778 | 778 | return $this->dispBoardMessage('msg_not_permitted'); |
779 | 779 | } |
@@ -782,30 +782,30 @@ discard block |
||
782 | 782 | $document_srl = Context::get('document_srl'); |
783 | 783 | |
784 | 784 | // if document exists, get the document information |
785 | - if($document_srl) |
|
785 | + if ($document_srl) |
|
786 | 786 | { |
787 | 787 | $oDocumentModel = getModel('document'); |
788 | 788 | $oDocument = $oDocumentModel->getDocument($document_srl); |
789 | 789 | } |
790 | 790 | |
791 | 791 | // if the document is not existed, then back to the board content page |
792 | - if(!$oDocument || !$oDocument->isExists()) |
|
792 | + if (!$oDocument || !$oDocument->isExists()) |
|
793 | 793 | { |
794 | 794 | return $this->dispBoardContent(); |
795 | 795 | } |
796 | 796 | |
797 | 797 | // if the document is not granted, then back to the password input form |
798 | - if(!$oDocument->isGranted()) |
|
798 | + if (!$oDocument->isGranted()) |
|
799 | 799 | { |
800 | 800 | return $this->setTemplateFile('input_password_form'); |
801 | 801 | } |
802 | 802 | |
803 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
803 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
804 | 804 | { |
805 | 805 | return $this->dispBoardMessage('msg_protect_content'); |
806 | 806 | } |
807 | 807 | |
808 | - Context::set('oDocument',$oDocument); |
|
808 | + Context::set('oDocument', $oDocument); |
|
809 | 809 | |
810 | 810 | /** |
811 | 811 | * add JS filters |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | $document_srl = Context::get('document_srl'); |
824 | 824 | |
825 | 825 | // check grant |
826 | - if(!$this->grant->write_comment) |
|
826 | + if (!$this->grant->write_comment) |
|
827 | 827 | { |
828 | 828 | return $this->dispBoardMessage('msg_not_permitted'); |
829 | 829 | } |
@@ -831,13 +831,13 @@ discard block |
||
831 | 831 | // get the document information |
832 | 832 | $oDocumentModel = getModel('document'); |
833 | 833 | $oDocument = $oDocumentModel->getDocument($document_srl); |
834 | - if(!$oDocument->isExists()) |
|
834 | + if (!$oDocument->isExists()) |
|
835 | 835 | { |
836 | 836 | return $this->dispBoardMessage('msg_invalid_request'); |
837 | 837 | } |
838 | 838 | |
839 | 839 | // Check allow comment |
840 | - if(!$oDocument->allowComment()) |
|
840 | + if (!$oDocument->allowComment()) |
|
841 | 841 | { |
842 | 842 | return $this->dispBoardMessage('msg_not_allow_comment'); |
843 | 843 | } |
@@ -849,9 +849,9 @@ discard block |
||
849 | 849 | $oComment->add('module_srl', $this->module_srl); |
850 | 850 | |
851 | 851 | // setup document variables on context |
852 | - Context::set('oDocument',$oDocument); |
|
853 | - Context::set('oSourceComment',$oSourceComment); |
|
854 | - Context::set('oComment',$oComment); |
|
852 | + Context::set('oDocument', $oDocument); |
|
853 | + Context::set('oSourceComment', $oSourceComment); |
|
854 | + Context::set('oComment', $oComment); |
|
855 | 855 | |
856 | 856 | /** |
857 | 857 | * add JS filter |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | function dispBoardReplyComment() |
868 | 868 | { |
869 | 869 | // check grant |
870 | - if(!$this->grant->write_comment) |
|
870 | + if (!$this->grant->write_comment) |
|
871 | 871 | { |
872 | 872 | return $this->dispBoardMessage('msg_not_permitted'); |
873 | 873 | } |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | $parent_srl = Context::get('comment_srl'); |
877 | 877 | |
878 | 878 | // if the parent comment is not existed |
879 | - if(!$parent_srl) |
|
879 | + if (!$parent_srl) |
|
880 | 880 | { |
881 | 881 | return new BaseObject(-1, 'msg_invalid_request'); |
882 | 882 | } |
@@ -886,11 +886,11 @@ discard block |
||
886 | 886 | $oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager); |
887 | 887 | |
888 | 888 | // if the comment is not existed, opoup an error message |
889 | - if(!$oSourceComment->isExists()) |
|
889 | + if (!$oSourceComment->isExists()) |
|
890 | 890 | { |
891 | 891 | return $this->dispBoardMessage('msg_invalid_request'); |
892 | 892 | } |
893 | - if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
893 | + if (Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
894 | 894 | { |
895 | 895 | return $this->dispBoardMessage('msg_invalid_request'); |
896 | 896 | } |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | // Check allow comment |
899 | 899 | $oDocumentModel = getModel('document'); |
900 | 900 | $oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl')); |
901 | - if(!$oDocument->allowComment()) |
|
901 | + if (!$oDocument->allowComment()) |
|
902 | 902 | { |
903 | 903 | return $this->dispBoardMessage('msg_not_allow_comment'); |
904 | 904 | } |
@@ -909,9 +909,9 @@ discard block |
||
909 | 909 | $oComment->add('document_srl', $oSourceComment->get('document_srl')); |
910 | 910 | |
911 | 911 | // setup comment variables |
912 | - Context::set('oSourceComment',$oSourceComment); |
|
913 | - Context::set('oComment',$oComment); |
|
914 | - Context::set('module_srl',$this->module_info->module_srl); |
|
912 | + Context::set('oSourceComment', $oSourceComment); |
|
913 | + Context::set('oComment', $oComment); |
|
914 | + Context::set('module_srl', $this->module_info->module_srl); |
|
915 | 915 | |
916 | 916 | /** |
917 | 917 | * add JS filters |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | function dispBoardModifyComment() |
928 | 928 | { |
929 | 929 | // check grant |
930 | - if(!$this->grant->write_comment) |
|
930 | + if (!$this->grant->write_comment) |
|
931 | 931 | { |
932 | 932 | return $this->dispBoardMessage('msg_not_permitted'); |
933 | 933 | } |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | $comment_srl = Context::get('comment_srl'); |
938 | 938 | |
939 | 939 | // if the comment is not existed |
940 | - if(!$comment_srl) |
|
940 | + if (!$comment_srl) |
|
941 | 941 | { |
942 | 942 | return new BaseObject(-1, 'msg_invalid_request'); |
943 | 943 | } |
@@ -947,13 +947,13 @@ discard block |
||
947 | 947 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
948 | 948 | |
949 | 949 | // if the comment is not exited, alert an error message |
950 | - if(!$oComment->isExists()) |
|
950 | + if (!$oComment->isExists()) |
|
951 | 951 | { |
952 | 952 | return $this->dispBoardMessage('msg_invalid_request'); |
953 | 953 | } |
954 | 954 | |
955 | 955 | // if the comment is not granted, then back to the password input form |
956 | - if(!$oComment->isGranted()) |
|
956 | + if (!$oComment->isGranted()) |
|
957 | 957 | { |
958 | 958 | return $this->setTemplateFile('input_password_form'); |
959 | 959 | } |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | function dispBoardDeleteComment() |
977 | 977 | { |
978 | 978 | // check grant |
979 | - if(!$this->grant->write_comment) |
|
979 | + if (!$this->grant->write_comment) |
|
980 | 980 | { |
981 | 981 | return $this->dispBoardMessage('msg_not_permitted'); |
982 | 982 | } |
@@ -985,25 +985,25 @@ discard block |
||
985 | 985 | $comment_srl = Context::get('comment_srl'); |
986 | 986 | |
987 | 987 | // if the comment exists, then get the comment information |
988 | - if($comment_srl) |
|
988 | + if ($comment_srl) |
|
989 | 989 | { |
990 | 990 | $oCommentModel = getModel('comment'); |
991 | 991 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
992 | 992 | } |
993 | 993 | |
994 | 994 | // if the comment is not existed, then back to the board content page |
995 | - if(!$oComment->isExists() ) |
|
995 | + if (!$oComment->isExists()) |
|
996 | 996 | { |
997 | 997 | return $this->dispBoardContent(); |
998 | 998 | } |
999 | 999 | |
1000 | 1000 | // if the comment is not granted, then back to the password input form |
1001 | - if(!$oComment->isGranted()) |
|
1001 | + if (!$oComment->isGranted()) |
|
1002 | 1002 | { |
1003 | 1003 | return $this->setTemplateFile('input_password_form'); |
1004 | 1004 | } |
1005 | 1005 | |
1006 | - Context::set('oComment',$oComment); |
|
1006 | + Context::set('oComment', $oComment); |
|
1007 | 1007 | |
1008 | 1008 | /** |
1009 | 1009 | * add JS filters |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | { |
1021 | 1021 | $oTrackbackModel = getModel('trackback'); |
1022 | 1022 | |
1023 | - if(!$oTrackbackModel) |
|
1023 | + if (!$oTrackbackModel) |
|
1024 | 1024 | { |
1025 | 1025 | return; |
1026 | 1026 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | $trackback = $output->data; |
1035 | 1035 | |
1036 | 1036 | // if no trackback, then display the board content |
1037 | - if(!$trackback) |
|
1037 | + if (!$trackback) |
|
1038 | 1038 | { |
1039 | 1039 | return $this->dispBoardContent(); |
1040 | 1040 | } |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | function dispBoardMessage($msg_code) |
1056 | 1056 | { |
1057 | 1057 | $msg = Context::getLang($msg_code); |
1058 | - if(!$msg) $msg = $msg_code; |
|
1058 | + if (!$msg) $msg = $msg_code; |
|
1059 | 1059 | Context::set('message', $msg); |
1060 | 1060 | $this->setTemplateFile('message'); |
1061 | 1061 | } |
@@ -1066,8 +1066,8 @@ discard block |
||
1066 | 1066 | **/ |
1067 | 1067 | function alertMessage($message) |
1068 | 1068 | { |
1069 | - $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
1070 | - Context::addHtmlFooter( $script ); |
|
1069 | + $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
1070 | + Context::addHtmlFooter($script); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | } |
@@ -27,37 +27,37 @@ discard block |
||
27 | 27 | $args = Context::getRequestVars(); |
28 | 28 | $args->module = 'board'; |
29 | 29 | $args->mid = $args->board_name; |
30 | - if(is_array($args->use_status)) $args->use_status = implode('|@|', $args->use_status); |
|
30 | + if (is_array($args->use_status)) $args->use_status = implode('|@|', $args->use_status); |
|
31 | 31 | unset($args->board_name); |
32 | 32 | |
33 | 33 | // setup extra_order_target |
34 | 34 | $extra_order_target = array(); |
35 | - if($args->module_srl) |
|
35 | + if ($args->module_srl) |
|
36 | 36 | { |
37 | 37 | $oDocumentModel = getModel('document'); |
38 | 38 | $module_extra_vars = $oDocumentModel->getExtraKeys($args->module_srl); |
39 | - foreach($module_extra_vars as $oExtraItem) |
|
39 | + foreach ($module_extra_vars as $oExtraItem) |
|
40 | 40 | { |
41 | 41 | $extra_order_target[$oExtraItem->eid] = $oExtraItem->name; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // setup other variables |
46 | - if($args->except_notice != 'Y') $args->except_notice = 'N'; |
|
47 | - if($args->use_anonymous != 'Y') $args->use_anonymous = 'N'; |
|
48 | - if($args->consultation != 'Y') $args->consultation = 'N'; |
|
49 | - if($args->protect_content!= 'Y') $args->protect_content = 'N'; |
|
50 | - if(!in_array($args->order_target,$this->order_target) && !array_key_exists($args->order_target, $extra_order_target)) $args->order_target = 'list_order'; |
|
51 | - if(!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc'; |
|
46 | + if ($args->except_notice != 'Y') $args->except_notice = 'N'; |
|
47 | + if ($args->use_anonymous != 'Y') $args->use_anonymous = 'N'; |
|
48 | + if ($args->consultation != 'Y') $args->consultation = 'N'; |
|
49 | + if ($args->protect_content != 'Y') $args->protect_content = 'N'; |
|
50 | + if (!in_array($args->order_target, $this->order_target) && !array_key_exists($args->order_target, $extra_order_target)) $args->order_target = 'list_order'; |
|
51 | + if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc'; |
|
52 | 52 | |
53 | 53 | // if there is an existed module |
54 | - if($args->module_srl) { |
|
54 | + if ($args->module_srl) { |
|
55 | 55 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); |
56 | - if($module_info->module_srl != $args->module_srl) unset($args->module_srl); |
|
56 | + if ($module_info->module_srl != $args->module_srl) unset($args->module_srl); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // insert/update the board module based on module_srl |
60 | - if(!$args->module_srl) { |
|
60 | + if (!$args->module_srl) { |
|
61 | 61 | $args->hide_category = 'N'; |
62 | 62 | $output = $oModuleController->insertModule($args); |
63 | 63 | $msg_code = 'success_registed'; |
@@ -67,18 +67,18 @@ discard block |
||
67 | 67 | $msg_code = 'success_updated'; |
68 | 68 | } |
69 | 69 | |
70 | - if(!$output->toBool()) return $output; |
|
70 | + if (!$output->toBool()) return $output; |
|
71 | 71 | |
72 | 72 | // setup list config |
73 | - $list = explode(',',Context::get('list')); |
|
74 | - if(count($list)) |
|
73 | + $list = explode(',', Context::get('list')); |
|
74 | + if (count($list)) |
|
75 | 75 | { |
76 | 76 | $list_arr = array(); |
77 | - foreach($list as $val) |
|
77 | + foreach ($list as $val) |
|
78 | 78 | { |
79 | 79 | $val = trim($val); |
80 | - if(!$val) continue; |
|
81 | - if(substr($val,0,10)=='extra_vars') $val = substr($val,10); |
|
80 | + if (!$val) continue; |
|
81 | + if (substr($val, 0, 10) == 'extra_vars') $val = substr($val, 10); |
|
82 | 82 | $list_arr[] = $val; |
83 | 83 | } |
84 | 84 | $oModuleController = getController('module'); |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $this->setMessage($msg_code); |
89 | - if (Context::get('success_return_url')){ |
|
89 | + if (Context::get('success_return_url')) { |
|
90 | 90 | changeValueInUrl('mid', $args->mid, $module_info->mid); |
91 | 91 | $this->setRedirectUrl(Context::get('success_return_url')); |
92 | - }else{ |
|
92 | + } else { |
|
93 | 93 | $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminBoardInfo', 'module_srl', $output->get('module_srl'))); |
94 | 94 | } |
95 | 95 | } |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | // for board info |
106 | 106 | $args->module = 'board'; |
107 | 107 | $args->mid = $args->board_name; |
108 | - if(is_array($args->use_status)) |
|
108 | + if (is_array($args->use_status)) |
|
109 | 109 | { |
110 | 110 | $args->use_status = implode('|@|', $args->use_status); |
111 | 111 | } |
112 | 112 | unset($args->board_name); |
113 | 113 | |
114 | - if(!in_array($args->order_target, $this->order_target)) |
|
114 | + if (!in_array($args->order_target, $this->order_target)) |
|
115 | 115 | { |
116 | 116 | $args->order_target = 'list_order'; |
117 | 117 | } |
118 | - if(!in_array($args->order_type, array('asc', 'desc'))) |
|
118 | + if (!in_array($args->order_type, array('asc', 'desc'))) |
|
119 | 119 | { |
120 | 120 | $args->order_type = 'asc'; |
121 | 121 | } |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | |
126 | 126 | // for grant info, Register Admin ID |
127 | 127 | $oModuleController->deleteAdminId($args->module_srl); |
128 | - if($args->admin_member) |
|
128 | + if ($args->admin_member) |
|
129 | 129 | { |
130 | - $admin_members = explode(',',$args->admin_member); |
|
131 | - for($i=0;$i<count($admin_members);$i++) |
|
130 | + $admin_members = explode(',', $args->admin_member); |
|
131 | + for ($i = 0; $i < count($admin_members); $i++) |
|
132 | 132 | { |
133 | 133 | $admin_id = trim($admin_members[$i]); |
134 | - if(!$admin_id) continue; |
|
134 | + if (!$admin_id) continue; |
|
135 | 135 | $oModuleController->insertAdminId($args->module_srl, $admin_id); |
136 | 136 | } |
137 | 137 | } |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | // get the current module |
147 | 147 | $oModuleController = getController('module'); |
148 | 148 | $output = $oModuleController->deleteModule($module_srl); |
149 | - if(!$output->toBool()) return $output; |
|
149 | + if (!$output->toBool()) return $output; |
|
150 | 150 | |
151 | - $this->add('module','board'); |
|
152 | - $this->add('page',Context::get('page')); |
|
151 | + $this->add('module', 'board'); |
|
152 | + $this->add('page', Context::get('page')); |
|
153 | 153 | $this->setMessage('success_deleted'); |
154 | 154 | } |
155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | $oModuleModel = getModel('module'); |
162 | 162 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
163 | - if($module_info->mid != $mid) |
|
163 | + if ($module_info->mid != $mid) |
|
164 | 164 | { |
165 | 165 | return new BaseObject(-1, 'msg_invalid_request'); |
166 | 166 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $module_info->hide_category = Context::get('hide_category') == 'Y' ? 'Y' : 'N'; |
169 | 169 | $oModuleController = getController('module'); /* @var $oModuleController moduleController */ |
170 | 170 | $output = $oModuleController->updateModule($module_info); |
171 | - if(!$output->toBool()) |
|
171 | + if (!$output->toBool()) |
|
172 | 172 | { |
173 | 173 | return $output; |
174 | 174 | } |