@@ -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 Object(); |
| 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 Object(); |
|
| 45 | + if (!$member_srl) return new Object(); |
|
| 46 | 46 | // If the last login is not today, give the points |
| 47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
| 47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new Object(); |
|
| 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 Object(); |
| 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 Object(); |
|
| 73 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 74 | 74 | // The fix to disable giving points for saving the document temporarily |
| 75 | - if($module_srl == $member_srl) return new Object(); |
|
| 75 | + if ($module_srl == $member_srl) return new Object(); |
|
| 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 Object(); |
@@ -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 Object(); |
|
| 144 | + if (!$oDocument->isExists()) return new Object(); |
|
| 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 Object(); |
|
| 153 | + if ($comment_point > 0) return new Object(); |
|
| 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 Object(); |
|
| 159 | + if (!$output->data) return new Object(); |
|
| 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 Object(); |
|
| 169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | + if (!count($member_srls)) return new Object(); |
|
| 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 Object(); |
@@ -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 Object(); |
|
| 197 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 198 | 198 | // Run only when logged in |
| 199 | 199 | $logged_info = Context::get('logged_info'); |
| 200 | - if(!$logged_info->member_srl) return new Object(); |
|
| 200 | + if (!$logged_info->member_srl) return new Object(); |
|
| 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 Object(); |
|
| 212 | + if ($point < 0) return new Object(); |
|
| 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 Object(); |
@@ -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 Object(); |
|
| 232 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 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 Object(); |
|
| 237 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new Object(); |
|
| 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 Object(); |
| 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 Object(); |
|
| 267 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 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 Object(); |
|
| 271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
| 270 | + if (!$oDocument->isExists()) return new Object(); |
|
| 271 | + if ($oDocument->get('member_srl') == $member_srl) return new Object(); |
|
| 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 Object(); |
|
| 281 | + if ($point < 0) return new Object(); |
|
| 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 Object(); |
| 287 | 287 | } |
@@ -301,11 +301,11 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | function triggerDeleteFile(&$obj) |
| 303 | 303 | { |
| 304 | - if($obj->isvalid != 'Y') return new Object(); |
|
| 304 | + if ($obj->isvalid != 'Y') return new Object(); |
|
| 305 | 305 | |
| 306 | 306 | $module_srl = $obj->module_srl; |
| 307 | 307 | $member_srl = $obj->member_srl; |
| 308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 308 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 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 Object(); |
| 324 | 324 | } |
@@ -331,17 +331,17 @@ 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 Object(); |
|
| 334 | + if (!$module_srl) return new Object(); |
|
| 335 | 335 | // Pass if it is your file |
| 336 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
| 336 | + if (abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
| 337 | 337 | |
| 338 | 338 | $oModuleModel = getModel('module'); |
| 339 | 339 | $config = $oModuleModel->getModuleConfig('point'); |
| 340 | 340 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 341 | 341 | // If it is set not to allow downloading for non-logged in users, do not permit |
| 342 | - if(!Context::get('is_logged')) |
|
| 342 | + if (!Context::get('is_logged')) |
|
| 343 | 343 | { |
| 344 | - if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download'); |
|
| 344 | + if ($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1, 'msg_not_permitted_download'); |
|
| 345 | 345 | else return new Object(); |
| 346 | 346 | } |
| 347 | 347 | // Get the points of the member |
@@ -349,9 +349,9 @@ discard block |
||
| 349 | 349 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 350 | 350 | // Get the points |
| 351 | 351 | $point = $module_config['download_file']; |
| 352 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
| 352 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
| 353 | 353 | // If points are less than 0, and if downloading a file is not allowed in this case, give an errors |
| 354 | - if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download'); |
|
| 354 | + if ($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1, 'msg_cannot_download'); |
|
| 355 | 355 | |
| 356 | 356 | return new Object(); |
| 357 | 357 | } |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | { |
| 364 | 364 | // Run only when logged in |
| 365 | 365 | $logged_info = Context::get('logged_info'); |
| 366 | - if(!$logged_info->member_srl) return new Object(); |
|
| 366 | + if (!$logged_info->member_srl) return new Object(); |
|
| 367 | 367 | $module_srl = $obj->module_srl; |
| 368 | 368 | $member_srl = $logged_info->member_srl; |
| 369 | - if(!$module_srl) return new Object(); |
|
| 369 | + if (!$module_srl) return new Object(); |
|
| 370 | 370 | // Pass if it is your file |
| 371 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
| 371 | + if (abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
| 372 | 372 | // Get the point module information |
| 373 | 373 | $oModuleModel = getModel('module'); |
| 374 | 374 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -378,10 +378,10 @@ discard block |
||
| 378 | 378 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 379 | 379 | // Get the points |
| 380 | 380 | $point = $module_config['download_file']; |
| 381 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
| 381 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
| 382 | 382 | // Increase the point |
| 383 | 383 | $cur_point += $point; |
| 384 | - $this->setPoint($member_srl,$cur_point); |
|
| 384 | + $this->setPoint($member_srl, $cur_point); |
|
| 385 | 385 | |
| 386 | 386 | return new Object(); |
| 387 | 387 | } |
@@ -400,22 +400,22 @@ discard block |
||
| 400 | 400 | // Get the original author number |
| 401 | 401 | $target_member_srl = abs($obj->get('member_srl')); |
| 402 | 402 | // Pass without increasing the hits if the viewer is the same as the author |
| 403 | - if($target_member_srl == $member_srl) return new Object(); |
|
| 403 | + if ($target_member_srl == $member_srl) return new Object(); |
|
| 404 | 404 | // Get the point information for each module |
| 405 | 405 | $config = $oModuleModel->getModuleConfig('point'); |
| 406 | 406 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
| 407 | 407 | // Get hits points |
| 408 | 408 | $point = $module_config['read_document']; |
| 409 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 409 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 410 | 410 | // Pass if there are no requested points |
| 411 | - if(!$point) return new Object(); |
|
| 411 | + if (!$point) return new Object(); |
|
| 412 | 412 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
| 413 | - if($member_srl) |
|
| 413 | + if ($member_srl) |
|
| 414 | 414 | { |
| 415 | 415 | $args->member_srl = $member_srl; |
| 416 | 416 | $args->document_srl = $obj->document_srl; |
| 417 | 417 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
| 418 | - if($output->data->count) return new Object(); |
|
| 418 | + if ($output->data->count) return new Object(); |
|
| 419 | 419 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 420 | 420 | } |
| 421 | 421 | else |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $config = $oModuleModel->getModuleConfig('point'); |
| 427 | 427 | // When the requested points are negative, compared it with the current point |
| 428 | 428 | $_SESSION['banned_document'][$obj->document_srl] = false; |
| 429 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
| 429 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
| 430 | 430 | { |
| 431 | 431 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
| 432 | 432 | $obj->add('content', $message); |
@@ -434,14 +434,14 @@ discard block |
||
| 434 | 434 | return new Object(-1, $message); |
| 435 | 435 | } |
| 436 | 436 | // If not logged in, pass |
| 437 | - if(!$logged_info->member_srl) return new Object(); |
|
| 437 | + if (!$logged_info->member_srl) return new Object(); |
|
| 438 | 438 | // Pass, if there are no requested points |
| 439 | - if(!$point) return new Object(); |
|
| 439 | + if (!$point) return new Object(); |
|
| 440 | 440 | // If the read record is missing, leave it |
| 441 | 441 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
| 442 | 442 | // Increase the point |
| 443 | 443 | $cur_point += $point; |
| 444 | - $this->setPoint($member_srl,$cur_point); |
|
| 444 | + $this->setPoint($member_srl, $cur_point); |
|
| 445 | 445 | |
| 446 | 446 | return new Object(); |
| 447 | 447 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | { |
| 454 | 454 | $module_srl = $obj->module_srl; |
| 455 | 455 | $member_srl = $obj->member_srl; |
| 456 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 456 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 457 | 457 | |
| 458 | 458 | $oModuleModel = getModel('module'); |
| 459 | 459 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -462,21 +462,21 @@ discard block |
||
| 462 | 462 | $oPointModel = getModel('point'); |
| 463 | 463 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 464 | 464 | |
| 465 | - if( $obj->point > 0 ) |
|
| 465 | + if ($obj->point > 0) |
|
| 466 | 466 | { |
| 467 | 467 | $point = $module_config['voted']; |
| 468 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 468 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 469 | 469 | } |
| 470 | 470 | else |
| 471 | 471 | { |
| 472 | 472 | $point = $module_config['blamed']; |
| 473 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 473 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - if(!$point) return new Object(); |
|
| 476 | + if (!$point) return new Object(); |
|
| 477 | 477 | // Increase the point |
| 478 | 478 | $cur_point += $point; |
| 479 | - $this->setPoint($member_srl,$cur_point); |
|
| 479 | + $this->setPoint($member_srl, $cur_point); |
|
| 480 | 480 | |
| 481 | 481 | return new Object(); |
| 482 | 482 | } |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | { |
| 489 | 489 | $member_srl = abs($member_srl); |
| 490 | 490 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
| 491 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
| 491 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
| 492 | 492 | |
| 493 | 493 | // Get configuration information |
| 494 | 494 | $oMemberModel = getModel('member'); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | $args->member_srl = $member_srl; |
| 506 | 506 | $args->point = $current_point; |
| 507 | 507 | |
| 508 | - switch($mode) |
|
| 508 | + switch ($mode) |
|
| 509 | 509 | { |
| 510 | 510 | case 'add' : |
| 511 | 511 | $args->point += $point; |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | $args->point = $point; |
| 519 | 519 | break; |
| 520 | 520 | } |
| 521 | - if($args->point < 0) $args->point = 0; |
|
| 521 | + if ($args->point < 0) $args->point = 0; |
|
| 522 | 522 | $point = $args->point; |
| 523 | 523 | |
| 524 | 524 | // Call a trigger (before) |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $trigger_obj->current_level = $current_level; |
| 530 | 530 | $trigger_obj->set_point = $point; |
| 531 | 531 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
| 532 | - if(!$trigger_output->toBool()) |
|
| 532 | + if (!$trigger_output->toBool()) |
|
| 533 | 533 | { |
| 534 | 534 | return $trigger_output; |
| 535 | 535 | } |
@@ -540,19 +540,19 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | // If there are points, update, if no, insert |
| 542 | 542 | $oPointModel = getModel('point'); |
| 543 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 543 | + if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 544 | 544 | else executeQuery("point.insertPoint", $args); |
| 545 | 545 | |
| 546 | 546 | // Get a new level |
| 547 | 547 | $level = $oPointModel->getLevel($point, $config->level_step); |
| 548 | 548 | |
| 549 | 549 | // If existing level and a new one are different attempt to set a point group |
| 550 | - if($level != $current_level) |
|
| 550 | + if ($level != $current_level) |
|
| 551 | 551 | { |
| 552 | 552 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
| 553 | 553 | $point_group = $config->point_group; |
| 554 | 554 | // If the point group exists |
| 555 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
| 555 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
| 556 | 556 | { |
| 557 | 557 | // Get the default group |
| 558 | 558 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -562,29 +562,29 @@ discard block |
||
| 562 | 562 | |
| 563 | 563 | asort($point_group); |
| 564 | 564 | // Reset group after initialization |
| 565 | - if($config->group_reset != 'N') |
|
| 565 | + if ($config->group_reset != 'N') |
|
| 566 | 566 | { |
| 567 | 567 | // If the new level is in the right group |
| 568 | - if(in_array($level, $point_group)) |
|
| 568 | + if (in_array($level, $point_group)) |
|
| 569 | 569 | { |
| 570 | 570 | // Delete all groups except the one which the current level belongs to |
| 571 | - foreach($point_group as $group_srl => $target_level) |
|
| 571 | + foreach ($point_group as $group_srl => $target_level) |
|
| 572 | 572 | { |
| 573 | 573 | $del_group_list[] = $group_srl; |
| 574 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
| 574 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
| 575 | 575 | } |
| 576 | 576 | } |
| 577 | 577 | // Otherwise, in case the level is reduced, add the recent group |
| 578 | 578 | else |
| 579 | 579 | { |
| 580 | 580 | $i = $level; |
| 581 | - while($i > 0) |
|
| 581 | + while ($i > 0) |
|
| 582 | 582 | { |
| 583 | - if(in_array($i, $point_group)) |
|
| 583 | + if (in_array($i, $point_group)) |
|
| 584 | 584 | { |
| 585 | - foreach($point_group as $group_srl => $target_level) |
|
| 585 | + foreach ($point_group as $group_srl => $target_level) |
|
| 586 | 586 | { |
| 587 | - if($target_level == $i) |
|
| 587 | + if ($target_level == $i) |
|
| 588 | 588 | { |
| 589 | 589 | $new_group_list[] = $group_srl; |
| 590 | 590 | } |
@@ -595,9 +595,9 @@ discard block |
||
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | // Delete the group of a level which is higher than the current level |
| 598 | - foreach($point_group as $group_srl => $target_level) |
|
| 598 | + foreach ($point_group as $group_srl => $target_level) |
|
| 599 | 599 | { |
| 600 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
| 600 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
| 601 | 601 | } |
| 602 | 602 | $del_group_list[] = $default_group->group_srl; |
| 603 | 603 | } |
@@ -605,16 +605,16 @@ discard block |
||
| 605 | 605 | else |
| 606 | 606 | { |
| 607 | 607 | // Check until the current level by rotating setting the configurations of the point groups |
| 608 | - foreach($point_group as $group_srl => $target_level) |
|
| 608 | + foreach ($point_group as $group_srl => $target_level) |
|
| 609 | 609 | { |
| 610 | 610 | $del_group_list[] = $group_srl; |
| 611 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 611 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | // If there is no a new group, granted the default group |
| 615 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 615 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 616 | 616 | // Remove linkage group |
| 617 | - if($del_group_list && count($del_group_list)) |
|
| 617 | + if ($del_group_list && count($del_group_list)) |
|
| 618 | 618 | { |
| 619 | 619 | $del_group_args = new stdClass; |
| 620 | 620 | $del_group_args->member_srl = $member_srl; |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
| 623 | 623 | } |
| 624 | 624 | // Grant a new group |
| 625 | - foreach($new_group_list as $group_srl) |
|
| 625 | + foreach ($new_group_list as $group_srl) |
|
| 626 | 626 | { |
| 627 | 627 | $new_group_args = new stdClass; |
| 628 | 628 | $new_group_args->member_srl = $member_srl; |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | $trigger_obj->del_group_list = $del_group_list; |
| 638 | 638 | $trigger_obj->new_level = $level; |
| 639 | 639 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
| 640 | - if(!$trigger_output->toBool()) |
|
| 640 | + if (!$trigger_output->toBool()) |
|
| 641 | 641 | { |
| 642 | 642 | $oDB->rollback(); |
| 643 | 643 | return $trigger_output; |
@@ -653,17 +653,17 @@ discard block |
||
| 653 | 653 | FileHandler::writeFile($cache_filename, $point); |
| 654 | 654 | |
| 655 | 655 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 656 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 656 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 657 | 657 | { |
| 658 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 658 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 659 | 659 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 660 | 660 | $oCacheHandler->delete($cache_key); |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 664 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 664 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 665 | 665 | { |
| 666 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 666 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 667 | 667 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 668 | 668 | $oCacheHandler->delete($cache_key); |
| 669 | 669 | } |
@@ -677,9 +677,9 @@ discard block |
||
| 677 | 677 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
| 678 | 678 | |
| 679 | 679 | $oModuleController = getController('module'); |
| 680 | - if(is_array($obj->moduleSrlList)) |
|
| 680 | + if (is_array($obj->moduleSrlList)) |
|
| 681 | 681 | { |
| 682 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 682 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 683 | 683 | { |
| 684 | 684 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
| 685 | 685 | } |
@@ -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 Object(); |
|
| 45 | + if(!$member_srl) { |
|
| 46 | + return new Object(); |
|
| 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 Object(); |
|
| 49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
| 50 | + return new Object(); |
|
| 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 Object(); |
|
| 77 | + if(!$module_srl || !$member_srl) { |
|
| 78 | + return new Object(); |
|
| 79 | + } |
|
| 74 | 80 | // The fix to disable giving points for saving the document temporarily |
| 75 | - if($module_srl == $member_srl) return new Object(); |
|
| 81 | + if($module_srl == $member_srl) { |
|
| 82 | + return new Object(); |
|
| 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 Object(); |
|
| 164 | + if(!$oDocument->isExists()) { |
|
| 165 | + return new Object(); |
|
| 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 Object(); |
|
| 177 | + if($comment_point>0) { |
|
| 178 | + return new Object(); |
|
| 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 Object(); |
|
| 185 | + if(!$output->data) { |
|
| 186 | + return new Object(); |
|
| 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 Object(); |
|
| 199 | + if($member_srl) { |
|
| 200 | + unset($member_srls[abs($member_srl)]); |
|
| 201 | + } |
|
| 202 | + if(!count($member_srls)) { |
|
| 203 | + return new Object(); |
|
| 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 Object(); |
|
| 231 | + if(!$module_srl || !$member_srl) { |
|
| 232 | + return new Object(); |
|
| 233 | + } |
|
| 198 | 234 | // Run only when logged in |
| 199 | 235 | $logged_info = Context::get('logged_info'); |
| 200 | - if(!$logged_info->member_srl) return new Object(); |
|
| 236 | + if(!$logged_info->member_srl) { |
|
| 237 | + return new Object(); |
|
| 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 Object(); |
|
| 252 | + if($point < 0) { |
|
| 253 | + return new Object(); |
|
| 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 Object(); |
|
| 278 | + if(!$module_srl || !$member_srl) { |
|
| 279 | + return new Object(); |
|
| 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 Object(); |
|
| 285 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
| 286 | + return new Object(); |
|
| 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 Object(); |
|
| 319 | + if(!$module_srl || !$member_srl) { |
|
| 320 | + return new Object(); |
|
| 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 Object(); |
|
| 271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
| 324 | + if(!$oDocument->isExists()) { |
|
| 325 | + return new Object(); |
|
| 326 | + } |
|
| 327 | + if($oDocument->get('member_srl')==$member_srl) { |
|
| 328 | + return new Object(); |
|
| 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 Object(); |
|
| 341 | + if($point < 0) { |
|
| 342 | + return new Object(); |
|
| 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 Object(); |
|
| 366 | + if($obj->isvalid != 'Y') { |
|
| 367 | + return new Object(); |
|
| 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 Object(); |
|
| 372 | + if(!$module_srl || !$member_srl) { |
|
| 373 | + return new Object(); |
|
| 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,9 +399,13 @@ 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 Object(); |
|
| 402 | + if(!$module_srl) { |
|
| 403 | + return new Object(); |
|
| 404 | + } |
|
| 335 | 405 | // Pass if it is your file |
| 336 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
| 406 | + if(abs($obj->member_srl) == abs($member_srl)) { |
|
| 407 | + return new Object(); |
|
| 408 | + } |
|
| 337 | 409 | |
| 338 | 410 | $oModuleModel = getModel('module'); |
| 339 | 411 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -341,17 +413,24 @@ discard block |
||
| 341 | 413 | // If it is set not to allow downloading for non-logged in users, do not permit |
| 342 | 414 | if(!Context::get('is_logged')) |
| 343 | 415 | { |
| 344 | - if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download'); |
|
| 345 | - else return new Object(); |
|
| 416 | + if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) { |
|
| 417 | + return new Object(-1,'msg_not_permitted_download'); |
|
| 418 | + } else { |
|
| 419 | + return new Object(); |
|
| 420 | + } |
|
| 346 | 421 | } |
| 347 | 422 | // Get the points of the member |
| 348 | 423 | $oPointModel = getModel('point'); |
| 349 | 424 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 350 | 425 | // Get the points |
| 351 | 426 | $point = $module_config['download_file']; |
| 352 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
| 427 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 428 | + $point = $config->download_file; |
|
| 429 | + } |
|
| 353 | 430 | // If points are less than 0, and if downloading a file is not allowed in this case, give an errors |
| 354 | - if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download'); |
|
| 431 | + if($cur_point + $point < 0 && $config->disable_download == 'Y') { |
|
| 432 | + return new Object(-1,'msg_cannot_download'); |
|
| 433 | + } |
|
| 355 | 434 | |
| 356 | 435 | return new Object(); |
| 357 | 436 | } |
@@ -363,12 +442,18 @@ discard block |
||
| 363 | 442 | { |
| 364 | 443 | // Run only when logged in |
| 365 | 444 | $logged_info = Context::get('logged_info'); |
| 366 | - if(!$logged_info->member_srl) return new Object(); |
|
| 445 | + if(!$logged_info->member_srl) { |
|
| 446 | + return new Object(); |
|
| 447 | + } |
|
| 367 | 448 | $module_srl = $obj->module_srl; |
| 368 | 449 | $member_srl = $logged_info->member_srl; |
| 369 | - if(!$module_srl) return new Object(); |
|
| 450 | + if(!$module_srl) { |
|
| 451 | + return new Object(); |
|
| 452 | + } |
|
| 370 | 453 | // Pass if it is your file |
| 371 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
| 454 | + if(abs($obj->member_srl) == abs($member_srl)) { |
|
| 455 | + return new Object(); |
|
| 456 | + } |
|
| 372 | 457 | // Get the point module information |
| 373 | 458 | $oModuleModel = getModel('module'); |
| 374 | 459 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -378,7 +463,9 @@ discard block |
||
| 378 | 463 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 379 | 464 | // Get the points |
| 380 | 465 | $point = $module_config['download_file']; |
| 381 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
| 466 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 467 | + $point = $config->download_file; |
|
| 468 | + } |
|
| 382 | 469 | // Increase the point |
| 383 | 470 | $cur_point += $point; |
| 384 | 471 | $this->setPoint($member_srl,$cur_point); |
@@ -400,25 +487,32 @@ discard block |
||
| 400 | 487 | // Get the original author number |
| 401 | 488 | $target_member_srl = abs($obj->get('member_srl')); |
| 402 | 489 | // Pass without increasing the hits if the viewer is the same as the author |
| 403 | - if($target_member_srl == $member_srl) return new Object(); |
|
| 490 | + if($target_member_srl == $member_srl) { |
|
| 491 | + return new Object(); |
|
| 492 | + } |
|
| 404 | 493 | // Get the point information for each module |
| 405 | 494 | $config = $oModuleModel->getModuleConfig('point'); |
| 406 | 495 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
| 407 | 496 | // Get hits points |
| 408 | 497 | $point = $module_config['read_document']; |
| 409 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 498 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 499 | + $point = $config->read_document; |
|
| 500 | + } |
|
| 410 | 501 | // Pass if there are no requested points |
| 411 | - if(!$point) return new Object(); |
|
| 502 | + if(!$point) { |
|
| 503 | + return new Object(); |
|
| 504 | + } |
|
| 412 | 505 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
| 413 | 506 | if($member_srl) |
| 414 | 507 | { |
| 415 | 508 | $args->member_srl = $member_srl; |
| 416 | 509 | $args->document_srl = $obj->document_srl; |
| 417 | 510 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
| 418 | - if($output->data->count) return new Object(); |
|
| 511 | + if($output->data->count) { |
|
| 512 | + return new Object(); |
|
| 513 | + } |
|
| 419 | 514 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 420 | - } |
|
| 421 | - else |
|
| 515 | + } else |
|
| 422 | 516 | { |
| 423 | 517 | $cur_point = 0; |
| 424 | 518 | } |
@@ -434,9 +528,13 @@ discard block |
||
| 434 | 528 | return new Object(-1, $message); |
| 435 | 529 | } |
| 436 | 530 | // If not logged in, pass |
| 437 | - if(!$logged_info->member_srl) return new Object(); |
|
| 531 | + if(!$logged_info->member_srl) { |
|
| 532 | + return new Object(); |
|
| 533 | + } |
|
| 438 | 534 | // Pass, if there are no requested points |
| 439 | - if(!$point) return new Object(); |
|
| 535 | + if(!$point) { |
|
| 536 | + return new Object(); |
|
| 537 | + } |
|
| 440 | 538 | // If the read record is missing, leave it |
| 441 | 539 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
| 442 | 540 | // Increase the point |
@@ -453,7 +551,9 @@ discard block |
||
| 453 | 551 | { |
| 454 | 552 | $module_srl = $obj->module_srl; |
| 455 | 553 | $member_srl = $obj->member_srl; |
| 456 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 554 | + if(!$module_srl || !$member_srl) { |
|
| 555 | + return new Object(); |
|
| 556 | + } |
|
| 457 | 557 | |
| 458 | 558 | $oModuleModel = getModel('module'); |
| 459 | 559 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -465,15 +565,20 @@ discard block |
||
| 465 | 565 | if( $obj->point > 0 ) |
| 466 | 566 | { |
| 467 | 567 | $point = $module_config['voted']; |
| 468 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 469 | - } |
|
| 470 | - else |
|
| 568 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 569 | + $point = $config->voted; |
|
| 570 | + } |
|
| 571 | + } else |
|
| 471 | 572 | { |
| 472 | 573 | $point = $module_config['blamed']; |
| 473 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 574 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 575 | + $point = $config->blamed; |
|
| 576 | + } |
|
| 474 | 577 | } |
| 475 | 578 | |
| 476 | - if(!$point) return new Object(); |
|
| 579 | + if(!$point) { |
|
| 580 | + return new Object(); |
|
| 581 | + } |
|
| 477 | 582 | // Increase the point |
| 478 | 583 | $cur_point += $point; |
| 479 | 584 | $this->setPoint($member_srl,$cur_point); |
@@ -488,7 +593,9 @@ discard block |
||
| 488 | 593 | { |
| 489 | 594 | $member_srl = abs($member_srl); |
| 490 | 595 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
| 491 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
| 596 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
| 597 | + $mode = 'update'; |
|
| 598 | + } |
|
| 492 | 599 | |
| 493 | 600 | // Get configuration information |
| 494 | 601 | $oMemberModel = getModel('member'); |
@@ -518,7 +625,9 @@ discard block |
||
| 518 | 625 | $args->point = $point; |
| 519 | 626 | break; |
| 520 | 627 | } |
| 521 | - if($args->point < 0) $args->point = 0; |
|
| 628 | + if($args->point < 0) { |
|
| 629 | + $args->point = 0; |
|
| 630 | + } |
|
| 522 | 631 | $point = $args->point; |
| 523 | 632 | |
| 524 | 633 | // Call a trigger (before) |
@@ -540,8 +649,11 @@ discard block |
||
| 540 | 649 | |
| 541 | 650 | // If there are points, update, if no, insert |
| 542 | 651 | $oPointModel = getModel('point'); |
| 543 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 544 | - else executeQuery("point.insertPoint", $args); |
|
| 652 | + if($oPointModel->isExistsPoint($member_srl)) { |
|
| 653 | + executeQuery("point.updatePoint", $args); |
|
| 654 | + } else { |
|
| 655 | + executeQuery("point.insertPoint", $args); |
|
| 656 | + } |
|
| 545 | 657 | |
| 546 | 658 | // Get a new level |
| 547 | 659 | $level = $oPointModel->getLevel($point, $config->level_step); |
@@ -571,7 +683,9 @@ discard block |
||
| 571 | 683 | foreach($point_group as $group_srl => $target_level) |
| 572 | 684 | { |
| 573 | 685 | $del_group_list[] = $group_srl; |
| 574 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
| 686 | + if($target_level == $level) { |
|
| 687 | + $new_group_list[] = $group_srl; |
|
| 688 | + } |
|
| 575 | 689 | } |
| 576 | 690 | } |
| 577 | 691 | // Otherwise, in case the level is reduced, add the recent group |
@@ -597,7 +711,9 @@ discard block |
||
| 597 | 711 | // Delete the group of a level which is higher than the current level |
| 598 | 712 | foreach($point_group as $group_srl => $target_level) |
| 599 | 713 | { |
| 600 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
| 714 | + if($target_level > $level) { |
|
| 715 | + $del_group_list[] = $group_srl; |
|
| 716 | + } |
|
| 601 | 717 | } |
| 602 | 718 | $del_group_list[] = $default_group->group_srl; |
| 603 | 719 | } |
@@ -608,11 +724,15 @@ discard block |
||
| 608 | 724 | foreach($point_group as $group_srl => $target_level) |
| 609 | 725 | { |
| 610 | 726 | $del_group_list[] = $group_srl; |
| 611 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 727 | + if($target_level <= $level) { |
|
| 728 | + $new_group_list[] = $group_srl; |
|
| 729 | + } |
|
| 612 | 730 | } |
| 613 | 731 | } |
| 614 | 732 | // If there is no a new group, granted the default group |
| 615 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 733 | + if(!$new_group_list[0]) { |
|
| 734 | + $new_group_list[0] = $default_group->group_srl; |
|
| 735 | + } |
|
| 616 | 736 | // Remove linkage group |
| 617 | 737 | if($del_group_list && count($del_group_list)) |
| 618 | 738 | { |