@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | // Check the point name |
41 | 41 | $config->point_name = $args->point_name; |
42 | - if(!$config->point_name) $config->point_name = 'point'; |
|
42 | + if(!$config->point_name) { |
|
43 | + $config->point_name = 'point'; |
|
44 | + } |
|
43 | 45 | // Specify the default points |
44 | 46 | $config->signup_point = (int)$args->signup_point; |
45 | 47 | $config->login_point = (int)$args->login_point; |
@@ -52,16 +54,26 @@ discard block |
||
52 | 54 | $config->blamed = (int)$args->blamed; |
53 | 55 | // The highest level |
54 | 56 | $config->max_level = $args->max_level; |
55 | - if($config->max_level>1000) $config->max_level = 1000; |
|
56 | - if($config->max_level<1) $config->max_level = 1; |
|
57 | + if($config->max_level>1000) { |
|
58 | + $config->max_level = 1000; |
|
59 | + } |
|
60 | + if($config->max_level<1) { |
|
61 | + $config->max_level = 1; |
|
62 | + } |
|
57 | 63 | // Set the level icon |
58 | 64 | $config->level_icon = $args->level_icon; |
59 | 65 | // Check if downloads are not allowed |
60 | - if($args->disable_download == 'Y') $config->disable_download = 'Y'; |
|
61 | - else $config->disable_download = 'N'; |
|
66 | + if($args->disable_download == 'Y') { |
|
67 | + $config->disable_download = 'Y'; |
|
68 | + } else { |
|
69 | + $config->disable_download = 'N'; |
|
70 | + } |
|
62 | 71 | // Check if reading a document is not allowed |
63 | - if($args->disable_read_document == 'Y') $config->disable_read_document = 'Y'; |
|
64 | - else $config->disable_read_document = 'N'; |
|
72 | + if($args->disable_read_document == 'Y') { |
|
73 | + $config->disable_read_document = 'Y'; |
|
74 | + } else { |
|
75 | + $config->disable_read_document = 'N'; |
|
76 | + } |
|
65 | 77 | |
66 | 78 | $oMemberModel = getModel('member'); |
67 | 79 | $group_list = $oMemberModel->getGroups(); |
@@ -71,7 +83,9 @@ discard block |
||
71 | 83 | foreach($group_list as $group) |
72 | 84 | { |
73 | 85 | // Admin group should not be connected to point. |
74 | - if($group->is_admin == 'Y' || $group->is_default == 'Y') continue; |
|
86 | + if($group->is_admin == 'Y' || $group->is_default == 'Y') { |
|
87 | + continue; |
|
88 | + } |
|
75 | 89 | |
76 | 90 | $group_srl = $group->group_srl; |
77 | 91 | |
@@ -102,8 +116,7 @@ discard block |
||
102 | 116 | } |
103 | 117 | // A function to calculate per-level points |
104 | 118 | $config->expression = $args->expression; |
105 | - } |
|
106 | - else |
|
119 | + } else |
|
107 | 120 | { |
108 | 121 | //module IO config is OFF, Other settings will not be modified. |
109 | 122 | $config->able_module = 'N'; |
@@ -165,16 +178,23 @@ discard block |
||
165 | 178 | function procPointAdminInsertPointModuleConfig() |
166 | 179 | { |
167 | 180 | $module_srl = Context::get('target_module_srl'); |
168 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
181 | + if(!$module_srl) { |
|
182 | + return new Object(-1, 'msg_invalid_request'); |
|
183 | + } |
|
169 | 184 | // In case of batch configuration of several modules |
170 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
171 | - else $module_srl = array($module_srl); |
|
185 | + if(preg_match('/^([0-9,]+)$/',$module_srl)) { |
|
186 | + $module_srl = explode(',',$module_srl); |
|
187 | + } else { |
|
188 | + $module_srl = array($module_srl); |
|
189 | + } |
|
172 | 190 | // Save configurations |
173 | 191 | $oModuleController = getController('module'); |
174 | 192 | for($i=0;$i<count($module_srl);$i++) |
175 | 193 | { |
176 | 194 | $srl = trim($module_srl[$i]); |
177 | - if(!$srl) continue; |
|
195 | + if(!$srl) { |
|
196 | + continue; |
|
197 | + } |
|
178 | 198 | unset($config); |
179 | 199 | $config['insert_document'] = (int)Context::get('insert_document'); |
180 | 200 | $config['insert_comment'] = (int)Context::get('insert_comment'); |
@@ -244,29 +264,40 @@ discard block |
||
244 | 264 | |
245 | 265 | // Get member infomation |
246 | 266 | $output = executeQueryArray('point.getMemberCount'); |
247 | - if(!$output->toBool()) return $output; |
|
267 | + if(!$output->toBool()) { |
|
268 | + return $output; |
|
269 | + } |
|
248 | 270 | |
249 | 271 | if($output->data) |
250 | 272 | { |
251 | 273 | foreach($output->data as $key => $val) |
252 | 274 | { |
253 | - if(!$val->member_srl) continue; |
|
275 | + if(!$val->member_srl) { |
|
276 | + continue; |
|
277 | + } |
|
254 | 278 | $member[$val->member_srl] = 0; |
255 | 279 | } |
256 | 280 | } |
257 | 281 | |
258 | 282 | // Get post information |
259 | 283 | $output = executeQueryArray('point.getDocumentPoint'); |
260 | - if(!$output->toBool()) return $output; |
|
284 | + if(!$output->toBool()) { |
|
285 | + return $output; |
|
286 | + } |
|
261 | 287 | |
262 | 288 | if($output->data) |
263 | 289 | { |
264 | 290 | foreach($output->data as $key => $val) |
265 | 291 | { |
266 | - if($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
267 | - else $insert_point = $config->insert_document; |
|
292 | + if($module_config[$val->module_srl]['insert_document']) { |
|
293 | + $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
294 | + } else { |
|
295 | + $insert_point = $config->insert_document; |
|
296 | + } |
|
268 | 297 | |
269 | - if(!$val->member_srl) continue; |
|
298 | + if(!$val->member_srl) { |
|
299 | + continue; |
|
300 | + } |
|
270 | 301 | $point = $insert_point * $val->count; |
271 | 302 | $member[$val->member_srl] += $point; |
272 | 303 | } |
@@ -275,16 +306,23 @@ discard block |
||
275 | 306 | $output = null; |
276 | 307 | // Get comments information |
277 | 308 | $output = executeQueryArray('point.getCommentPoint'); |
278 | - if(!$output->toBool()) return $output; |
|
309 | + if(!$output->toBool()) { |
|
310 | + return $output; |
|
311 | + } |
|
279 | 312 | |
280 | 313 | if($output->data) |
281 | 314 | { |
282 | 315 | foreach($output->data as $key => $val) |
283 | 316 | { |
284 | - if($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
285 | - else $insert_point = $config->insert_comment; |
|
317 | + if($module_config[$val->module_srl]['insert_comment']) { |
|
318 | + $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
319 | + } else { |
|
320 | + $insert_point = $config->insert_comment; |
|
321 | + } |
|
286 | 322 | |
287 | - if(!$val->member_srl) continue; |
|
323 | + if(!$val->member_srl) { |
|
324 | + continue; |
|
325 | + } |
|
288 | 326 | $point = $insert_point * $val->count; |
289 | 327 | $member[$val->member_srl] += $point; |
290 | 328 | } |
@@ -292,16 +330,23 @@ discard block |
||
292 | 330 | $output = null; |
293 | 331 | // Get the attached files' information |
294 | 332 | $output = executeQueryArray('point.getFilePoint'); |
295 | - if(!$output->toBool()) return $output; |
|
333 | + if(!$output->toBool()) { |
|
334 | + return $output; |
|
335 | + } |
|
296 | 336 | |
297 | 337 | if($output->data) |
298 | 338 | { |
299 | 339 | foreach($output->data as $key => $val) |
300 | 340 | { |
301 | - if($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
302 | - else $insert_point = $config->upload_file; |
|
341 | + if($module_config[$val->module_srl]['upload_file']) { |
|
342 | + $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
343 | + } else { |
|
344 | + $insert_point = $config->upload_file; |
|
345 | + } |
|
303 | 346 | |
304 | - if(!$val->member_srl) continue; |
|
347 | + if(!$val->member_srl) { |
|
348 | + continue; |
|
349 | + } |
|
305 | 350 | $point = $insert_point * $val->count; |
306 | 351 | $member[$val->member_srl] += $point; |
307 | 352 | } |
@@ -309,7 +354,9 @@ discard block |
||
309 | 354 | $output = null; |
310 | 355 | // Set all members' points to 0 |
311 | 356 | $output = executeQuery("point.initMemberPoint"); |
312 | - if(!$output->toBool()) return $output; |
|
357 | + if(!$output->toBool()) { |
|
358 | + return $output; |
|
359 | + } |
|
313 | 360 | // Save the file temporarily |
314 | 361 | |
315 | 362 | $str = ''; |
@@ -334,7 +381,9 @@ discard block |
||
334 | 381 | $position = (int)Context::get('position'); |
335 | 382 | $total = (int)Context::get('total'); |
336 | 383 | |
337 | - if(!file_exists('./files/cache/pointRecal.txt')) return new Object(-1, 'msg_invalid_request'); |
|
384 | + if(!file_exists('./files/cache/pointRecal.txt')) { |
|
385 | + return new Object(-1, 'msg_invalid_request'); |
|
386 | + } |
|
338 | 387 | |
339 | 388 | $idx = 0; |
340 | 389 | $f = fopen("./files/cache/pointRecal.txt","r"); |
@@ -350,7 +399,9 @@ discard block |
||
350 | 399 | $args->member_srl = $member_srl; |
351 | 400 | $args->point = $point; |
352 | 401 | $output = executeQuery('point.insertPoint',$args); |
353 | - if($idx%5000==0) break; |
|
402 | + if($idx%5000==0) { |
|
403 | + break; |
|
404 | + } |
|
354 | 405 | } |
355 | 406 | } |
356 | 407 | |
@@ -377,16 +428,23 @@ discard block |
||
377 | 428 | function procPointAdminReset() |
378 | 429 | { |
379 | 430 | $module_srl = Context::get('module_srls'); |
380 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
431 | + if(!$module_srl) { |
|
432 | + return new Object(-1, 'msg_invalid_request'); |
|
433 | + } |
|
381 | 434 | // In case of batch configuration of several modules |
382 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
383 | - else $module_srl = array($module_srl); |
|
435 | + if(preg_match('/^([0-9,]+)$/',$module_srl)) { |
|
436 | + $module_srl = explode(',',$module_srl); |
|
437 | + } else { |
|
438 | + $module_srl = array($module_srl); |
|
439 | + } |
|
384 | 440 | // Save configurations |
385 | 441 | $oModuleController = getController('module'); |
386 | 442 | for($i=0;$i<count($module_srl);$i++) |
387 | 443 | { |
388 | 444 | $srl = trim($module_srl[$i]); |
389 | - if(!$srl) continue; |
|
445 | + if(!$srl) { |
|
446 | + continue; |
|
447 | + } |
|
390 | 448 | $args = new stdClass(); |
391 | 449 | $args->module = 'point'; |
392 | 450 | $args->module_srl = $srl; |