@@ -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,12 +207,12 @@ 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 | // Increase the point |
215 | - $this->setPoint($member_srl,$cur_point); |
|
215 | + $this->setPoint($member_srl, $cur_point); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | return new BaseObject(); |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | { |
226 | 226 | $module_srl = $obj->module_srl; |
227 | 227 | $member_srl = $obj->member_srl; |
228 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
228 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
229 | 229 | // Do not increase the points if the member is the author of the post |
230 | 230 | $document_srl = $obj->document_srl; |
231 | 231 | $oDocumentModel = getModel('document'); |
232 | 232 | $oDocument = $oDocumentModel->getDocument($document_srl); |
233 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
233 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new BaseObject(); |
|
234 | 234 | // Get the point module information |
235 | 235 | $oModuleModel = getModel('module'); |
236 | 236 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | $cur_point = $oPointModel->getPoint($member_srl, true); |
241 | 241 | |
242 | 242 | $point = $module_config['insert_comment']; |
243 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
243 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
244 | 244 | // Increase the point |
245 | 245 | $cur_point += $point; |
246 | - $this->setPoint($member_srl,$cur_point); |
|
246 | + $this->setPoint($member_srl, $cur_point); |
|
247 | 247 | |
248 | 248 | return new BaseObject(); |
249 | 249 | } |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | $module_srl = $obj->module_srl; |
261 | 261 | $member_srl = abs($obj->member_srl); |
262 | 262 | $document_srl = $obj->document_srl; |
263 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
263 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
264 | 264 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
265 | 265 | $oDocument = $oDocumentModel->getDocument($document_srl); |
266 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
267 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
266 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
267 | + if ($oDocument->get('member_srl') == $member_srl) return new BaseObject(); |
|
268 | 268 | // Get the point module information |
269 | 269 | $config = $oModuleModel->getModuleConfig('point'); |
270 | 270 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | $cur_point = $oPointModel->getPoint($member_srl, true); |
273 | 273 | |
274 | 274 | $point = $module_config['insert_comment']; |
275 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
275 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
276 | 276 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
277 | - if($point < 0) return new BaseObject(); |
|
277 | + if ($point < 0) return new BaseObject(); |
|
278 | 278 | // Increase the point |
279 | 279 | $cur_point -= $point; |
280 | - $this->setPoint($member_srl,$cur_point); |
|
280 | + $this->setPoint($member_srl, $cur_point); |
|
281 | 281 | |
282 | 282 | return new BaseObject(); |
283 | 283 | } |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | */ |
298 | 298 | function triggerDeleteFile(&$obj) |
299 | 299 | { |
300 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
300 | + if ($obj->isvalid != 'Y') return new BaseObject(); |
|
301 | 301 | |
302 | 302 | $module_srl = $obj->module_srl; |
303 | 303 | $member_srl = $obj->member_srl; |
304 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
304 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
305 | 305 | // Get the point module information |
306 | 306 | $oModuleModel = getModel('module'); |
307 | 307 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | $cur_point = $oPointModel->getPoint($member_srl, true); |
312 | 312 | |
313 | 313 | $point = $module_config['upload_file']; |
314 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
314 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
315 | 315 | // Increase the point |
316 | 316 | $cur_point -= $point; |
317 | - $this->setPoint($member_srl,$cur_point); |
|
317 | + $this->setPoint($member_srl, $cur_point); |
|
318 | 318 | |
319 | 319 | return new BaseObject(); |
320 | 320 | } |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | $logged_info = Context::get('logged_info'); |
328 | 328 | $member_srl = $logged_info->member_srl; |
329 | 329 | $module_srl = $obj->module_srl; |
330 | - if(!$module_srl) return new BaseObject(); |
|
330 | + if (!$module_srl) return new BaseObject(); |
|
331 | 331 | |
332 | 332 | // Pass if it is your file |
333 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
333 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
334 | 334 | $oModuleModel = getModel('module'); |
335 | 335 | $config = $oModuleModel->getModuleConfig('point'); |
336 | 336 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | // If the user is not logged in and download requires points, deny access. |
347 | - if(!Context::get('is_logged')) |
|
347 | + if (!Context::get('is_logged')) |
|
348 | 348 | { |
349 | - if($config->disable_download == 'Y' && $point) |
|
349 | + if ($config->disable_download == 'Y' && $point) |
|
350 | 350 | { |
351 | - return new BaseObject(-1,'msg_not_permitted_download'); |
|
351 | + return new BaseObject(-1, 'msg_not_permitted_download'); |
|
352 | 352 | } |
353 | 353 | else |
354 | 354 | { |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | // If the member does not have enough points, deny access. |
364 | 364 | if ($config->disable_download == 'Y' && $cur_point + $point < 0) |
365 | 365 | { |
366 | - return new BaseObject(-1,'msg_cannot_download'); |
|
366 | + return new BaseObject(-1, 'msg_cannot_download'); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | // Otherwise, points will be adjusted after downloading (triggerDownloadFile). |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | { |
378 | 378 | // Run only when logged in |
379 | 379 | $logged_info = Context::get('logged_info'); |
380 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
380 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
381 | 381 | $module_srl = $obj->module_srl; |
382 | 382 | $member_srl = $logged_info->member_srl; |
383 | - if(!$module_srl) return new BaseObject(); |
|
383 | + if (!$module_srl) return new BaseObject(); |
|
384 | 384 | |
385 | 385 | // Pass if it is your file |
386 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
386 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
387 | 387 | |
388 | 388 | // Get the point module information |
389 | 389 | $oModuleModel = getModel('module'); |
@@ -424,22 +424,22 @@ discard block |
||
424 | 424 | // Get the original author number |
425 | 425 | $target_member_srl = abs($obj->get('member_srl')); |
426 | 426 | // Pass without increasing the hits if the viewer is the same as the author |
427 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
427 | + if ($target_member_srl == $member_srl) return new BaseObject(); |
|
428 | 428 | // Get the point information for each module |
429 | 429 | $config = $oModuleModel->getModuleConfig('point'); |
430 | 430 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
431 | 431 | // Get hits points |
432 | 432 | $point = $module_config['read_document']; |
433 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
433 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
434 | 434 | // Pass if there are no requested points |
435 | - if(!$point) return new BaseObject(); |
|
435 | + if (!$point) return new BaseObject(); |
|
436 | 436 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
437 | - if($member_srl) |
|
437 | + if ($member_srl) |
|
438 | 438 | { |
439 | 439 | $args->member_srl = $member_srl; |
440 | 440 | $args->document_srl = $obj->document_srl; |
441 | 441 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
442 | - if($output->data->count) return new BaseObject(); |
|
442 | + if ($output->data->count) return new BaseObject(); |
|
443 | 443 | $cur_point = $oPointModel->getPoint($member_srl, true); |
444 | 444 | } |
445 | 445 | else |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $config = $oModuleModel->getModuleConfig('point'); |
451 | 451 | // When the requested points are negative, compared it with the current point |
452 | 452 | $_SESSION['banned_document'][$obj->document_srl] = false; |
453 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
453 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
454 | 454 | { |
455 | 455 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
456 | 456 | $obj->add('content', $message); |
@@ -458,14 +458,14 @@ discard block |
||
458 | 458 | return new BaseObject(-1, $message); |
459 | 459 | } |
460 | 460 | // If not logged in, pass |
461 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
461 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
462 | 462 | // Pass, if there are no requested points |
463 | - if(!$point) return new BaseObject(); |
|
463 | + if (!$point) return new BaseObject(); |
|
464 | 464 | // If the read record is missing, leave it |
465 | 465 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
466 | 466 | // Increase the point |
467 | 467 | $cur_point += $point; |
468 | - $this->setPoint($member_srl,$cur_point); |
|
468 | + $this->setPoint($member_srl, $cur_point); |
|
469 | 469 | |
470 | 470 | return new BaseObject(); |
471 | 471 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | { |
478 | 478 | $module_srl = $obj->module_srl; |
479 | 479 | $member_srl = $obj->member_srl; |
480 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
480 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
481 | 481 | |
482 | 482 | $oModuleModel = getModel('module'); |
483 | 483 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -486,21 +486,21 @@ discard block |
||
486 | 486 | $oPointModel = getModel('point'); |
487 | 487 | $cur_point = $oPointModel->getPoint($member_srl, true); |
488 | 488 | |
489 | - if( $obj->point > 0 ) |
|
489 | + if ($obj->point > 0) |
|
490 | 490 | { |
491 | 491 | $point = $module_config['voted']; |
492 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
492 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
493 | 493 | } |
494 | 494 | else |
495 | 495 | { |
496 | 496 | $point = $module_config['blamed']; |
497 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
497 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
498 | 498 | } |
499 | 499 | |
500 | - if(!$point) return new BaseObject(); |
|
500 | + if (!$point) return new BaseObject(); |
|
501 | 501 | // Increase the point |
502 | 502 | $cur_point += $point; |
503 | - $this->setPoint($member_srl,$cur_point); |
|
503 | + $this->setPoint($member_srl, $cur_point); |
|
504 | 504 | |
505 | 505 | return new BaseObject(); |
506 | 506 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | { |
513 | 513 | $member_srl = abs($member_srl); |
514 | 514 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
515 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
515 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
516 | 516 | |
517 | 517 | // Get configuration information |
518 | 518 | $oMemberModel = getModel('member'); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $args->member_srl = $member_srl; |
530 | 530 | $args->point = $current_point; |
531 | 531 | |
532 | - switch($mode) |
|
532 | + switch ($mode) |
|
533 | 533 | { |
534 | 534 | case 'add' : |
535 | 535 | $args->point += $point; |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $args->point = $point; |
543 | 543 | break; |
544 | 544 | } |
545 | - if($args->point < 0) $args->point = 0; |
|
545 | + if ($args->point < 0) $args->point = 0; |
|
546 | 546 | $point = $args->point; |
547 | 547 | |
548 | 548 | // Call a trigger (before) |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $trigger_obj->current_level = $current_level; |
554 | 554 | $trigger_obj->set_point = $point; |
555 | 555 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
556 | - if(!$trigger_output->toBool()) |
|
556 | + if (!$trigger_output->toBool()) |
|
557 | 557 | { |
558 | 558 | return $trigger_output; |
559 | 559 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $oDB->begin(); |
564 | 564 | |
565 | 565 | // If there are points, update, if no, insert |
566 | - if($current_point > 0) |
|
566 | + if ($current_point > 0) |
|
567 | 567 | { |
568 | 568 | $output = executeQuery("point.updatePoint", $args); |
569 | 569 | } |
@@ -571,13 +571,13 @@ discard block |
||
571 | 571 | { |
572 | 572 | // 많은 동접시 넣는 과정에서 insert가 미리 이루어졌지만 이 공간으로 넘어올 경우 다시 한번 더 업데이트를 처리. |
573 | 573 | $output = executeQuery("point.insertPoint", $args); |
574 | - if(!$output->toBool()) |
|
574 | + if (!$output->toBool()) |
|
575 | 575 | { |
576 | 576 | $output = executeQuery("point.updatePoint", $args); |
577 | 577 | } |
578 | 578 | } |
579 | 579 | |
580 | - if(!$output->toBool()) |
|
580 | + if (!$output->toBool()) |
|
581 | 581 | { |
582 | 582 | $oDB->rollback(); |
583 | 583 | return $output; |
@@ -587,12 +587,12 @@ discard block |
||
587 | 587 | $level = $oPointModel->getLevel($point, $config->level_step); |
588 | 588 | |
589 | 589 | // If existing level and a new one are different attempt to set a point group |
590 | - if($level != $current_level) |
|
590 | + if ($level != $current_level) |
|
591 | 591 | { |
592 | 592 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
593 | 593 | $point_group = $config->point_group; |
594 | 594 | // If the point group exists |
595 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
595 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
596 | 596 | { |
597 | 597 | // Get the default group |
598 | 598 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -602,29 +602,29 @@ discard block |
||
602 | 602 | |
603 | 603 | asort($point_group); |
604 | 604 | // Reset group after initialization |
605 | - if($config->group_reset != 'N') |
|
605 | + if ($config->group_reset != 'N') |
|
606 | 606 | { |
607 | 607 | // If the new level is in the right group |
608 | - if(in_array($level, $point_group)) |
|
608 | + if (in_array($level, $point_group)) |
|
609 | 609 | { |
610 | 610 | // Delete all groups except the one which the current level belongs to |
611 | - foreach($point_group as $group_srl => $target_level) |
|
611 | + foreach ($point_group as $group_srl => $target_level) |
|
612 | 612 | { |
613 | 613 | $del_group_list[] = $group_srl; |
614 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
614 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
615 | 615 | } |
616 | 616 | } |
617 | 617 | // Otherwise, in case the level is reduced, add the recent group |
618 | 618 | else |
619 | 619 | { |
620 | 620 | $i = $level; |
621 | - while($i > 0) |
|
621 | + while ($i > 0) |
|
622 | 622 | { |
623 | - if(in_array($i, $point_group)) |
|
623 | + if (in_array($i, $point_group)) |
|
624 | 624 | { |
625 | - foreach($point_group as $group_srl => $target_level) |
|
625 | + foreach ($point_group as $group_srl => $target_level) |
|
626 | 626 | { |
627 | - if($target_level == $i) |
|
627 | + if ($target_level == $i) |
|
628 | 628 | { |
629 | 629 | $new_group_list[] = $group_srl; |
630 | 630 | } |
@@ -635,9 +635,9 @@ discard block |
||
635 | 635 | } |
636 | 636 | } |
637 | 637 | // Delete the group of a level which is higher than the current level |
638 | - foreach($point_group as $group_srl => $target_level) |
|
638 | + foreach ($point_group as $group_srl => $target_level) |
|
639 | 639 | { |
640 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
640 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
641 | 641 | } |
642 | 642 | $del_group_list[] = $default_group->group_srl; |
643 | 643 | } |
@@ -645,16 +645,16 @@ discard block |
||
645 | 645 | else |
646 | 646 | { |
647 | 647 | // Check until the current level by rotating setting the configurations of the point groups |
648 | - foreach($point_group as $group_srl => $target_level) |
|
648 | + foreach ($point_group as $group_srl => $target_level) |
|
649 | 649 | { |
650 | 650 | $del_group_list[] = $group_srl; |
651 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
651 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
652 | 652 | } |
653 | 653 | } |
654 | 654 | // If there is no a new group, granted the default group |
655 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
655 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
656 | 656 | // Remove linkage group |
657 | - if($del_group_list && count($del_group_list)) |
|
657 | + if ($del_group_list && count($del_group_list)) |
|
658 | 658 | { |
659 | 659 | $del_group_args = new stdClass; |
660 | 660 | $del_group_args->member_srl = $member_srl; |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
663 | 663 | } |
664 | 664 | // Grant a new group |
665 | - foreach($new_group_list as $group_srl) |
|
665 | + foreach ($new_group_list as $group_srl) |
|
666 | 666 | { |
667 | 667 | $new_group_args = new stdClass; |
668 | 668 | $new_group_args->member_srl = $member_srl; |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $trigger_obj->del_group_list = $del_group_list; |
678 | 678 | $trigger_obj->new_level = $level; |
679 | 679 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
680 | - if(!$trigger_output->toBool()) |
|
680 | + if (!$trigger_output->toBool()) |
|
681 | 681 | { |
682 | 682 | $oDB->rollback(); |
683 | 683 | return $trigger_output; |
@@ -693,17 +693,17 @@ discard block |
||
693 | 693 | FileHandler::writeFile($cache_filename, $point); |
694 | 694 | |
695 | 695 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
696 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
696 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
697 | 697 | { |
698 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
698 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
699 | 699 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
700 | 700 | $oCacheHandler->delete($cache_key); |
701 | 701 | } |
702 | 702 | |
703 | 703 | $oCacheHandler = CacheHandler::getInstance('object'); |
704 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
704 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
705 | 705 | { |
706 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
706 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
707 | 707 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
708 | 708 | $oCacheHandler->delete($cache_key); |
709 | 709 | } |
@@ -717,9 +717,9 @@ discard block |
||
717 | 717 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
718 | 718 | |
719 | 719 | $oModuleController = getController('module'); |
720 | - if(is_array($obj->moduleSrlList)) |
|
720 | + if (is_array($obj->moduleSrlList)) |
|
721 | 721 | { |
722 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
722 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
723 | 723 | { |
724 | 724 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
725 | 725 | } |
@@ -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,9 +245,13 @@ 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 | // Increase the point |
215 | 257 | $this->setPoint($member_srl,$cur_point); |
@@ -225,12 +267,16 @@ discard block |
||
225 | 267 | { |
226 | 268 | $module_srl = $obj->module_srl; |
227 | 269 | $member_srl = $obj->member_srl; |
228 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
270 | + if(!$module_srl || !$member_srl) { |
|
271 | + return new BaseObject(); |
|
272 | + } |
|
229 | 273 | // Do not increase the points if the member is the author of the post |
230 | 274 | $document_srl = $obj->document_srl; |
231 | 275 | $oDocumentModel = getModel('document'); |
232 | 276 | $oDocument = $oDocumentModel->getDocument($document_srl); |
233 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
277 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
278 | + return new BaseObject(); |
|
279 | + } |
|
234 | 280 | // Get the point module information |
235 | 281 | $oModuleModel = getModel('module'); |
236 | 282 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -240,7 +286,9 @@ discard block |
||
240 | 286 | $cur_point = $oPointModel->getPoint($member_srl, true); |
241 | 287 | |
242 | 288 | $point = $module_config['insert_comment']; |
243 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
289 | + if(strlen($point) == 0 && !is_int($point)) { |
|
290 | + $point = $config->insert_comment; |
|
291 | + } |
|
244 | 292 | // Increase the point |
245 | 293 | $cur_point += $point; |
246 | 294 | $this->setPoint($member_srl,$cur_point); |
@@ -260,11 +308,17 @@ discard block |
||
260 | 308 | $module_srl = $obj->module_srl; |
261 | 309 | $member_srl = abs($obj->member_srl); |
262 | 310 | $document_srl = $obj->document_srl; |
263 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
311 | + if(!$module_srl || !$member_srl) { |
|
312 | + return new BaseObject(); |
|
313 | + } |
|
264 | 314 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
265 | 315 | $oDocument = $oDocumentModel->getDocument($document_srl); |
266 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
267 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
316 | + if(!$oDocument->isExists()) { |
|
317 | + return new BaseObject(); |
|
318 | + } |
|
319 | + if($oDocument->get('member_srl')==$member_srl) { |
|
320 | + return new BaseObject(); |
|
321 | + } |
|
268 | 322 | // Get the point module information |
269 | 323 | $config = $oModuleModel->getModuleConfig('point'); |
270 | 324 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -272,9 +326,13 @@ discard block |
||
272 | 326 | $cur_point = $oPointModel->getPoint($member_srl, true); |
273 | 327 | |
274 | 328 | $point = $module_config['insert_comment']; |
275 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
329 | + if(strlen($point) == 0 && !is_int($point)) { |
|
330 | + $point = $config->insert_comment; |
|
331 | + } |
|
276 | 332 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
277 | - if($point < 0) return new BaseObject(); |
|
333 | + if($point < 0) { |
|
334 | + return new BaseObject(); |
|
335 | + } |
|
278 | 336 | // Increase the point |
279 | 337 | $cur_point -= $point; |
280 | 338 | $this->setPoint($member_srl,$cur_point); |
@@ -297,11 +355,15 @@ discard block |
||
297 | 355 | */ |
298 | 356 | function triggerDeleteFile(&$obj) |
299 | 357 | { |
300 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
358 | + if($obj->isvalid != 'Y') { |
|
359 | + return new BaseObject(); |
|
360 | + } |
|
301 | 361 | |
302 | 362 | $module_srl = $obj->module_srl; |
303 | 363 | $member_srl = $obj->member_srl; |
304 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
364 | + if(!$module_srl || !$member_srl) { |
|
365 | + return new BaseObject(); |
|
366 | + } |
|
305 | 367 | // Get the point module information |
306 | 368 | $oModuleModel = getModel('module'); |
307 | 369 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -311,7 +373,9 @@ discard block |
||
311 | 373 | $cur_point = $oPointModel->getPoint($member_srl, true); |
312 | 374 | |
313 | 375 | $point = $module_config['upload_file']; |
314 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
376 | + if(strlen($point) == 0 && !is_int($point)) { |
|
377 | + $point = $config->upload_file; |
|
378 | + } |
|
315 | 379 | // Increase the point |
316 | 380 | $cur_point -= $point; |
317 | 381 | $this->setPoint($member_srl,$cur_point); |
@@ -327,18 +391,21 @@ discard block |
||
327 | 391 | $logged_info = Context::get('logged_info'); |
328 | 392 | $member_srl = $logged_info->member_srl; |
329 | 393 | $module_srl = $obj->module_srl; |
330 | - if(!$module_srl) return new BaseObject(); |
|
394 | + if(!$module_srl) { |
|
395 | + return new BaseObject(); |
|
396 | + } |
|
331 | 397 | |
332 | 398 | // Pass if it is your file |
333 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
399 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
400 | + return new BaseObject(); |
|
401 | + } |
|
334 | 402 | $oModuleModel = getModel('module'); |
335 | 403 | $config = $oModuleModel->getModuleConfig('point'); |
336 | 404 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
337 | 405 | if (isset($module_config['download_file'])) |
338 | 406 | { |
339 | 407 | $point = intval($module_config['download_file']); |
340 | - } |
|
341 | - else |
|
408 | + } else |
|
342 | 409 | { |
343 | 410 | $point = intval($config->download_file); |
344 | 411 | } |
@@ -349,8 +416,7 @@ discard block |
||
349 | 416 | if($config->disable_download == 'Y' && $point) |
350 | 417 | { |
351 | 418 | return new BaseObject(-1,'msg_not_permitted_download'); |
352 | - } |
|
353 | - else |
|
419 | + } else |
|
354 | 420 | { |
355 | 421 | return new BaseObject(); |
356 | 422 | } |
@@ -377,13 +443,19 @@ discard block |
||
377 | 443 | { |
378 | 444 | // Run only when logged in |
379 | 445 | $logged_info = Context::get('logged_info'); |
380 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
446 | + if(!$logged_info->member_srl) { |
|
447 | + return new BaseObject(); |
|
448 | + } |
|
381 | 449 | $module_srl = $obj->module_srl; |
382 | 450 | $member_srl = $logged_info->member_srl; |
383 | - if(!$module_srl) return new BaseObject(); |
|
451 | + if(!$module_srl) { |
|
452 | + return new BaseObject(); |
|
453 | + } |
|
384 | 454 | |
385 | 455 | // Pass if it is your file |
386 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
456 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
457 | + return new BaseObject(); |
|
458 | + } |
|
387 | 459 | |
388 | 460 | // Get the point module information |
389 | 461 | $oModuleModel = getModel('module'); |
@@ -392,8 +464,7 @@ discard block |
||
392 | 464 | if (isset($module_config['download_file'])) |
393 | 465 | { |
394 | 466 | $point = intval($module_config['download_file']); |
395 | - } |
|
396 | - else |
|
467 | + } else |
|
397 | 468 | { |
398 | 469 | $point = intval($config->download_file); |
399 | 470 | } |
@@ -424,25 +495,32 @@ discard block |
||
424 | 495 | // Get the original author number |
425 | 496 | $target_member_srl = abs($obj->get('member_srl')); |
426 | 497 | // Pass without increasing the hits if the viewer is the same as the author |
427 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
498 | + if($target_member_srl == $member_srl) { |
|
499 | + return new BaseObject(); |
|
500 | + } |
|
428 | 501 | // Get the point information for each module |
429 | 502 | $config = $oModuleModel->getModuleConfig('point'); |
430 | 503 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
431 | 504 | // Get hits points |
432 | 505 | $point = $module_config['read_document']; |
433 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
506 | + if(strlen($point) == 0 && !is_int($point)) { |
|
507 | + $point = $config->read_document; |
|
508 | + } |
|
434 | 509 | // Pass if there are no requested points |
435 | - if(!$point) return new BaseObject(); |
|
510 | + if(!$point) { |
|
511 | + return new BaseObject(); |
|
512 | + } |
|
436 | 513 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
437 | 514 | if($member_srl) |
438 | 515 | { |
439 | 516 | $args->member_srl = $member_srl; |
440 | 517 | $args->document_srl = $obj->document_srl; |
441 | 518 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
442 | - if($output->data->count) return new BaseObject(); |
|
519 | + if($output->data->count) { |
|
520 | + return new BaseObject(); |
|
521 | + } |
|
443 | 522 | $cur_point = $oPointModel->getPoint($member_srl, true); |
444 | - } |
|
445 | - else |
|
523 | + } else |
|
446 | 524 | { |
447 | 525 | $cur_point = 0; |
448 | 526 | } |
@@ -458,9 +536,13 @@ discard block |
||
458 | 536 | return new BaseObject(-1, $message); |
459 | 537 | } |
460 | 538 | // If not logged in, pass |
461 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
539 | + if(!$logged_info->member_srl) { |
|
540 | + return new BaseObject(); |
|
541 | + } |
|
462 | 542 | // Pass, if there are no requested points |
463 | - if(!$point) return new BaseObject(); |
|
543 | + if(!$point) { |
|
544 | + return new BaseObject(); |
|
545 | + } |
|
464 | 546 | // If the read record is missing, leave it |
465 | 547 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
466 | 548 | // Increase the point |
@@ -477,7 +559,9 @@ discard block |
||
477 | 559 | { |
478 | 560 | $module_srl = $obj->module_srl; |
479 | 561 | $member_srl = $obj->member_srl; |
480 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
562 | + if(!$module_srl || !$member_srl) { |
|
563 | + return new BaseObject(); |
|
564 | + } |
|
481 | 565 | |
482 | 566 | $oModuleModel = getModel('module'); |
483 | 567 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -489,15 +573,20 @@ discard block |
||
489 | 573 | if( $obj->point > 0 ) |
490 | 574 | { |
491 | 575 | $point = $module_config['voted']; |
492 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
493 | - } |
|
494 | - else |
|
576 | + if(strlen($point) == 0 && !is_int($point)) { |
|
577 | + $point = $config->voted; |
|
578 | + } |
|
579 | + } else |
|
495 | 580 | { |
496 | 581 | $point = $module_config['blamed']; |
497 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
582 | + if(strlen($point) == 0 && !is_int($point)) { |
|
583 | + $point = $config->blamed; |
|
584 | + } |
|
498 | 585 | } |
499 | 586 | |
500 | - if(!$point) return new BaseObject(); |
|
587 | + if(!$point) { |
|
588 | + return new BaseObject(); |
|
589 | + } |
|
501 | 590 | // Increase the point |
502 | 591 | $cur_point += $point; |
503 | 592 | $this->setPoint($member_srl,$cur_point); |
@@ -512,7 +601,9 @@ discard block |
||
512 | 601 | { |
513 | 602 | $member_srl = abs($member_srl); |
514 | 603 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
515 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
604 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
605 | + $mode = 'update'; |
|
606 | + } |
|
516 | 607 | |
517 | 608 | // Get configuration information |
518 | 609 | $oMemberModel = getModel('member'); |
@@ -542,7 +633,9 @@ discard block |
||
542 | 633 | $args->point = $point; |
543 | 634 | break; |
544 | 635 | } |
545 | - if($args->point < 0) $args->point = 0; |
|
636 | + if($args->point < 0) { |
|
637 | + $args->point = 0; |
|
638 | + } |
|
546 | 639 | $point = $args->point; |
547 | 640 | |
548 | 641 | // Call a trigger (before) |
@@ -566,8 +659,7 @@ discard block |
||
566 | 659 | if($current_point > 0) |
567 | 660 | { |
568 | 661 | $output = executeQuery("point.updatePoint", $args); |
569 | - } |
|
570 | - else |
|
662 | + } else |
|
571 | 663 | { |
572 | 664 | // 많은 동접시 넣는 과정에서 insert가 미리 이루어졌지만 이 공간으로 넘어올 경우 다시 한번 더 업데이트를 처리. |
573 | 665 | $output = executeQuery("point.insertPoint", $args); |
@@ -611,7 +703,9 @@ discard block |
||
611 | 703 | foreach($point_group as $group_srl => $target_level) |
612 | 704 | { |
613 | 705 | $del_group_list[] = $group_srl; |
614 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
706 | + if($target_level == $level) { |
|
707 | + $new_group_list[] = $group_srl; |
|
708 | + } |
|
615 | 709 | } |
616 | 710 | } |
617 | 711 | // Otherwise, in case the level is reduced, add the recent group |
@@ -637,7 +731,9 @@ discard block |
||
637 | 731 | // Delete the group of a level which is higher than the current level |
638 | 732 | foreach($point_group as $group_srl => $target_level) |
639 | 733 | { |
640 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
734 | + if($target_level > $level) { |
|
735 | + $del_group_list[] = $group_srl; |
|
736 | + } |
|
641 | 737 | } |
642 | 738 | $del_group_list[] = $default_group->group_srl; |
643 | 739 | } |
@@ -648,11 +744,15 @@ discard block |
||
648 | 744 | foreach($point_group as $group_srl => $target_level) |
649 | 745 | { |
650 | 746 | $del_group_list[] = $group_srl; |
651 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
747 | + if($target_level <= $level) { |
|
748 | + $new_group_list[] = $group_srl; |
|
749 | + } |
|
652 | 750 | } |
653 | 751 | } |
654 | 752 | // If there is no a new group, granted the default group |
655 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
753 | + if(!$new_group_list[0]) { |
|
754 | + $new_group_list[0] = $default_group->group_srl; |
|
755 | + } |
|
656 | 756 | // Remove linkage group |
657 | 757 | if($del_group_list && count($del_group_list)) |
658 | 758 | { |