@@ -35,8 +35,7 @@ |
||
| 35 | 35 | if($planetrow['id_owner']) { |
| 36 | 36 | $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW); |
| 37 | 37 | $planetrow = $global_data['planet']; |
| 38 | - } |
|
| 39 | - else { |
|
| 38 | + } else { |
|
| 40 | 39 | // Locking user record |
| 41 | 40 | $user = db_user_by_id($user['id'], true); |
| 42 | 41 | } |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | $avatar_field = 0; |
| 19 | 19 | throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE); |
| 20 | - } |
|
| 21 | - elseif($_FILES['avatar']['size']) |
|
| 20 | + } elseif($_FILES['avatar']['size']) |
|
| 22 | 21 | { |
| 23 | 22 | if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) |
| 24 | 23 | { |
@@ -61,8 +60,7 @@ discard block |
||
| 61 | 60 | imagedestroy($avatar_image); |
| 62 | 61 | throw new Exception($lang['opt_msg_avatar_uploaded'], ERR_NONE); |
| 63 | 62 | } |
| 64 | - } |
|
| 65 | - catch (Exception $e) |
|
| 63 | + } catch (Exception $e) |
|
| 66 | 64 | { |
| 67 | 65 | return array( |
| 68 | 66 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -66,8 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | return; |
| 68 | 68 | trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR); |
| 69 | - } |
|
| 70 | - else |
|
| 69 | + } else |
|
| 71 | 70 | { |
| 72 | 71 | $this->template->files[$handle] = $this->template->files_inherit[$handle]; |
| 73 | 72 | } |
@@ -225,15 +224,13 @@ discard block |
||
| 225 | 224 | $var = substr($temp, 2, -1); |
| 226 | 225 | //$file = $this->template->_tpldata['DEFINE']['.'][$var]; |
| 227 | 226 | $temp = "\$this->_tpldata['DEFINE']['.']['$var']"; |
| 228 | - } |
|
| 229 | - else |
|
| 227 | + } else |
|
| 230 | 228 | { |
| 231 | 229 | $var = substr($temp, 1, -1); |
| 232 | 230 | //$file = $this->template->_rootref[$var]; |
| 233 | 231 | $temp = "\$this->_rootref['$var']"; |
| 234 | 232 | } |
| 235 | - } |
|
| 236 | - else |
|
| 233 | + } else |
|
| 237 | 234 | { |
| 238 | 235 | $file = $temp; |
| 239 | 236 | } |
@@ -381,8 +378,7 @@ discard block |
||
| 381 | 378 | if ($match[2] < 0) |
| 382 | 379 | { |
| 383 | 380 | $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')'; |
| 384 | - } |
|
| 385 | - else |
|
| 381 | + } else |
|
| 386 | 382 | { |
| 387 | 383 | $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')'; |
| 388 | 384 | } |
@@ -390,17 +386,14 @@ discard block |
||
| 390 | 386 | if (strlen($match[3]) < 1 || $match[3] == -1) |
| 391 | 387 | { |
| 392 | 388 | $loop_end = '$_' . $tag_args . '_count'; |
| 393 | - } |
|
| 394 | - else if ($match[3] >= 0) |
|
| 389 | + } else if ($match[3] >= 0) |
|
| 395 | 390 | { |
| 396 | 391 | $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')'; |
| 397 | - } |
|
| 398 | - else //if ($match[3] < -1) |
|
| 392 | + } else //if ($match[3] < -1) |
|
| 399 | 393 | { |
| 400 | 394 | $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1); |
| 401 | 395 | } |
| 402 | - } |
|
| 403 | - else |
|
| 396 | + } else |
|
| 404 | 397 | { |
| 405 | 398 | $loop_start = 0; |
| 406 | 399 | $loop_end = '$_' . $tag_args . '_count'; |
@@ -413,8 +406,7 @@ discard block |
||
| 413 | 406 | { |
| 414 | 407 | // We need to implode $no_nesting times from the end... |
| 415 | 408 | $block = array_slice($this->block_names, -$no_nesting); |
| 416 | - } |
|
| 417 | - else |
|
| 409 | + } else |
|
| 418 | 410 | { |
| 419 | 411 | $block = $this->block_names; |
| 420 | 412 | } |
@@ -424,8 +416,7 @@ discard block |
||
| 424 | 416 | // Block is not nested. |
| 425 | 417 | $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;"; |
| 426 | 418 | $varref = "\$this->_tpldata['$tag_args']"; |
| 427 | - } |
|
| 428 | - else |
|
| 419 | + } else |
|
| 429 | 420 | { |
| 430 | 421 | // This block is nested. |
| 431 | 422 | // Generate a namespace string for this block. |
@@ -573,8 +564,7 @@ discard block |
||
| 573 | 564 | if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs)) |
| 574 | 565 | { |
| 575 | 566 | $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']'); |
| 576 | - } |
|
| 577 | - else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
| 567 | + } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
| 578 | 568 | { |
| 579 | 569 | // Allow checking if loops are set with .loopname |
| 580 | 570 | // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example |
@@ -590,8 +580,7 @@ discard block |
||
| 590 | 580 | |
| 591 | 581 | // Add the block reference for the last child. |
| 592 | 582 | $varref .= "['" . $block . "']"; |
| 593 | - } |
|
| 594 | - else |
|
| 583 | + } else |
|
| 595 | 584 | { |
| 596 | 585 | $varref = '$this->_tpldata'; |
| 597 | 586 | |
@@ -599,8 +588,7 @@ discard block |
||
| 599 | 588 | $varref .= "['" . $blocks[0] . "']"; |
| 600 | 589 | } |
| 601 | 590 | $token = "sizeof($varref)"; |
| 602 | - } |
|
| 603 | - else if (!empty($token)) |
|
| 591 | + } else if (!empty($token)) |
|
| 604 | 592 | { |
| 605 | 593 | $token = '(' . $token . ')'; |
| 606 | 594 | } |
@@ -645,8 +633,7 @@ discard block |
||
| 645 | 633 | |
| 646 | 634 | // Now replace the php code |
| 647 | 635 | $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'"; |
| 648 | - } |
|
| 649 | - else |
|
| 636 | + } else |
|
| 650 | 637 | { |
| 651 | 638 | preg_match('#true|false|\.#i', $match[4], $type); |
| 652 | 639 | |
@@ -708,8 +695,7 @@ discard block |
||
| 708 | 695 | { |
| 709 | 696 | $negate_expr = true; |
| 710 | 697 | $expr_type = array_shift($tokens); |
| 711 | - } |
|
| 712 | - else |
|
| 698 | + } else |
|
| 713 | 699 | { |
| 714 | 700 | $expr_type = $first_token; |
| 715 | 701 | } |
@@ -722,8 +708,7 @@ discard block |
||
| 722 | 708 | $expr_end++; |
| 723 | 709 | $expr_arg = $tokens[$expr_end++]; |
| 724 | 710 | $expr = "!(($is_arg / $expr_arg) % $expr_arg)"; |
| 725 | - } |
|
| 726 | - else |
|
| 711 | + } else |
|
| 727 | 712 | { |
| 728 | 713 | $expr = "!($is_arg & 1)"; |
| 729 | 714 | } |
@@ -735,8 +720,7 @@ discard block |
||
| 735 | 720 | $expr_end++; |
| 736 | 721 | $expr_arg = $tokens[$expr_end++]; |
| 737 | 722 | $expr = "(($is_arg / $expr_arg) % $expr_arg)"; |
| 738 | - } |
|
| 739 | - else |
|
| 723 | + } else |
|
| 740 | 724 | { |
| 741 | 725 | $expr = "($is_arg & 1)"; |
| 742 | 726 | } |
@@ -818,12 +802,10 @@ discard block |
||
| 818 | 802 | $varref .= '[$_' . $blocks[$blockcount] . '_i]'; |
| 819 | 803 | } |
| 820 | 804 | return $varref; |
| 821 | - } |
|
| 822 | - else if ($include_last_iterator) |
|
| 805 | + } else if ($include_last_iterator) |
|
| 823 | 806 | { |
| 824 | 807 | return '$_'. $blocks[$blockcount] . '_val'; |
| 825 | - } |
|
| 826 | - else |
|
| 808 | + } else |
|
| 827 | 809 | { |
| 828 | 810 | return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
| 829 | 811 | } |
@@ -89,8 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template'; |
| 91 | 91 | } |
| 92 | - } |
|
| 93 | - else |
|
| 92 | + } else |
|
| 94 | 93 | { |
| 95 | 94 | trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR); |
| 96 | 95 | } |
@@ -126,8 +125,7 @@ discard block |
||
| 126 | 125 | |
| 127 | 126 | $this->inherit_root = $fallback_template_path; |
| 128 | 127 | $this->orig_tpl_inherits_id = true; |
| 129 | - } |
|
| 130 | - else |
|
| 128 | + } else |
|
| 131 | 129 | { |
| 132 | 130 | $this->orig_tpl_inherits_id = false; |
| 133 | 131 | } |
@@ -201,8 +199,7 @@ discard block |
||
| 201 | 199 | } |
| 202 | 200 | |
| 203 | 201 | unset($str[$blocks[$blockcount]]); |
| 204 | - } |
|
| 205 | - else |
|
| 202 | + } else |
|
| 206 | 203 | { |
| 207 | 204 | // Top-level block. |
| 208 | 205 | unset($this->_tpldata[$blockname]); |
@@ -238,8 +235,7 @@ discard block |
||
| 238 | 235 | if ($filename = $this->_tpl_load($handle)) |
| 239 | 236 | { |
| 240 | 237 | ($include_once) ? include_once($filename) : include($filename); |
| 241 | - } |
|
| 242 | - else |
|
| 238 | + } else |
|
| 243 | 239 | { |
| 244 | 240 | eval(' ?>' . $this->compiled_code[$handle] . '<?php '); |
| 245 | 241 | } |
@@ -293,8 +289,7 @@ discard block |
||
| 293 | 289 | if (!file_exists($filename) || @filesize($filename) === 0) |
| 294 | 290 | { |
| 295 | 291 | $recompile = true; |
| 296 | - } |
|
| 297 | - else if ($config->load_tplcompile) |
|
| 292 | + } else if ($config->load_tplcompile) |
|
| 298 | 293 | { |
| 299 | 294 | // No way around it: we need to check inheritance here |
| 300 | 295 | if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle])) |
@@ -382,15 +377,13 @@ discard block |
||
| 382 | 377 | $this->files[$row['template_filename']] = $file; |
| 383 | 378 | $this->files_inherit[$row['template_filename']] = $file; |
| 384 | 379 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
| 385 | - } |
|
| 386 | - else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
| 380 | + } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
| 387 | 381 | { |
| 388 | 382 | // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that. |
| 389 | 383 | $force_reload = true; |
| 390 | 384 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
| 391 | 385 | } |
| 392 | - } |
|
| 393 | - else |
|
| 386 | + } else |
|
| 394 | 387 | { |
| 395 | 388 | $this->files_template[$row['template_filename']] = $user->theme['template_id']; |
| 396 | 389 | } |
@@ -400,8 +393,7 @@ discard block |
||
| 400 | 393 | if ($row['template_filename'] == $this->filename[$handle]) |
| 401 | 394 | { |
| 402 | 395 | $compile->_tpl_load_file($handle, true); |
| 403 | - } |
|
| 404 | - else |
|
| 396 | + } else |
|
| 405 | 397 | { |
| 406 | 398 | $this->files[$row['template_filename']] = $file; |
| 407 | 399 | $this->filename[$row['template_filename']] = $row['template_filename']; |
@@ -416,8 +408,7 @@ discard block |
||
| 416 | 408 | { |
| 417 | 409 | $this->compiled_code[$handle] = $compile->compile(trim($row['template_data'])); |
| 418 | 410 | $compile->compile_write($handle, $this->compiled_code[$handle]); |
| 419 | - } |
|
| 420 | - else |
|
| 411 | + } else |
|
| 421 | 412 | { |
| 422 | 413 | // Only bother compiling if it doesn't already exist |
| 423 | 414 | if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX)) |
@@ -428,8 +419,7 @@ discard block |
||
| 428 | 419 | } |
| 429 | 420 | } |
| 430 | 421 | } |
| 431 | - } |
|
| 432 | - else |
|
| 422 | + } else |
|
| 433 | 423 | { |
| 434 | 424 | $file = $this->root . '/' . $row['template_filename']; |
| 435 | 425 | |
@@ -517,8 +507,7 @@ discard block |
||
| 517 | 507 | // We're adding a new iteration to this block with the given |
| 518 | 508 | // variable assignments. |
| 519 | 509 | $str[$blocks[$blockcount]][] = $vararray; |
| 520 | - } |
|
| 521 | - else |
|
| 510 | + } else |
|
| 522 | 511 | { |
| 523 | 512 | // Top-level block. |
| 524 | 513 | $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; |
@@ -618,8 +607,7 @@ discard block |
||
| 618 | 607 | $key = sizeof($this->_tpldata[$blockname]); |
| 619 | 608 | unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); |
| 620 | 609 | $vararray['S_LAST_ROW'] = true; |
| 621 | - } |
|
| 622 | - else if ($key === 0) |
|
| 610 | + } else if ($key === 0) |
|
| 623 | 611 | { |
| 624 | 612 | unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); |
| 625 | 613 | $vararray['S_FIRST_ROW'] = true; |
@@ -719,8 +707,7 @@ discard block |
||
| 719 | 707 | if(!$name) |
| 720 | 708 | { |
| 721 | 709 | $this->assign_vars($values); |
| 722 | - } |
|
| 723 | - else |
|
| 710 | + } else |
|
| 724 | 711 | { |
| 725 | 712 | $this->assign_block_vars($name, $values); |
| 726 | 713 | } |
@@ -197,8 +197,7 @@ discard block |
||
| 197 | 197 | if($old_que_item[4] == 'build') |
| 198 | 198 | { |
| 199 | 199 | $old_que_item[4] = BUILD_CREATE; |
| 200 | - } |
|
| 201 | - else |
|
| 200 | + } else |
|
| 202 | 201 | { |
| 203 | 202 | $old_que_item[4] = BUILD_DESTROY; |
| 204 | 203 | } |
@@ -667,18 +666,15 @@ discard block |
||
| 667 | 666 | if(preg_match('/^Using Black Market page (\d+)$/', $comment, $matches2)) |
| 668 | 667 | { |
| 669 | 668 | $reason = RPG_MARKET; |
| 670 | - } |
|
| 671 | - elseif(preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2)) |
|
| 669 | + } elseif(preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2)) |
|
| 672 | 670 | { |
| 673 | 671 | $reason = RPG_MERCENARY; |
| 674 | 672 | $comment = "Spent for mercenary {$matches2[1]} GUID {$matches2[2]}"; |
| 675 | - } |
|
| 676 | - elseif(preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2)) |
|
| 673 | + } elseif(preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2)) |
|
| 677 | 674 | { |
| 678 | 675 | $reason = RPG_REFERRAL; |
| 679 | 676 | $comment = "Incoming from referral ID {$matches[1]}"; |
| 680 | - } |
|
| 681 | - elseif(preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2)) |
|
| 677 | + } elseif(preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2)) |
|
| 682 | 678 | { |
| 683 | 679 | $reason = RPG_ADMIN; |
| 684 | 680 | $comment = $matches2[1]; |
@@ -1716,8 +1712,7 @@ discard block |
||
| 1716 | 1712 | if(!isset($found[$index])) |
| 1717 | 1713 | { |
| 1718 | 1714 | $found[$index] = $row['BUDDY_ID']; |
| 1719 | - } |
|
| 1720 | - else |
|
| 1715 | + } else |
|
| 1721 | 1716 | { |
| 1722 | 1717 | $lost[] = $row['BUDDY_ID']; |
| 1723 | 1718 | } |
@@ -2169,8 +2164,7 @@ discard block |
||
| 2169 | 2164 | $que_data[QI_PLANET_ID] = 'NULL'; |
| 2170 | 2165 | } |
| 2171 | 2166 | } |
| 2172 | - } |
|
| 2173 | - else |
|
| 2167 | + } else |
|
| 2174 | 2168 | { |
| 2175 | 2169 | $que_data[QI_PLANET_ID] = 'NULL'; |
| 2176 | 2170 | } |
@@ -140,11 +140,13 @@ |
||
| 140 | 140 | $error_backtrace['locks'] = classSupernova::$locks; |
| 141 | 141 | $error_backtrace['cSN_data'] = classSupernova::$data; |
| 142 | 142 | foreach($error_backtrace['cSN_data'] as &$location) { |
| 143 | - foreach($location as $location_id => &$location_data) // $location_data = $location_id; |
|
| 143 | + foreach($location as $location_id => &$location_data) { |
|
| 144 | + // $location_data = $location_id; |
|
| 144 | 145 | { |
| 145 | 146 | $location_data = isset($location_data['username']) ? $location_data['username'] : |
| 146 | 147 | (isset($location_data['name']) ? $location_data['name'] : $location_id); |
| 147 | 148 | } |
| 149 | + } |
|
| 148 | 150 | } |
| 149 | 151 | $error_backtrace['cSN_queries'] = classSupernova::$queries; |
| 150 | 152 | } |
@@ -399,7 +399,9 @@ discard block |
||
| 399 | 399 | $units_levels = array(); |
| 400 | 400 | foreach($planet_unit_list as $unit_id) { |
| 401 | 401 | $unit_name = &$units_info[$unit_id][P_NAME]; |
| 402 | - if(!isset($row[$unit_name]) || !$row[$unit_name]) continue; |
|
| 402 | + if(!isset($row[$unit_name]) || !$row[$unit_name]) { |
|
| 403 | + continue; |
|
| 404 | + } |
|
| 403 | 405 | $units_levels[$unit_id] = $row[$unit_name]; |
| 404 | 406 | $unit_data[] = "({$user_id}," . LOC_PLANET . ",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
| 405 | 407 | if(count($unit_data) > 30) { |
@@ -413,7 +415,9 @@ discard block |
||
| 413 | 415 | if($row['que']) { |
| 414 | 416 | $que = explode(';', $row['que']); |
| 415 | 417 | foreach($que as $que_item) { |
| 416 | - if(!$que_item) continue; |
|
| 418 | + if(!$que_item) { |
|
| 419 | + continue; |
|
| 420 | + } |
|
| 417 | 421 | |
| 418 | 422 | $que_item = explode(',', $que_item); |
| 419 | 423 | |
@@ -445,9 +449,13 @@ discard block |
||
| 445 | 449 | $return_resources = array(RES_METAL => 0, RES_CRYSTAL => 0, RES_DEUTERIUM => 0, ); |
| 446 | 450 | $hangar_units = sys_unit_str2arr($row['b_hangar_id']); |
| 447 | 451 | foreach($hangar_units as $unit_id => $unit_count) { |
| 448 | - if($unit_count <= 0) continue; |
|
| 452 | + if($unit_count <= 0) { |
|
| 453 | + continue; |
|
| 454 | + } |
|
| 449 | 455 | foreach($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
| 450 | - if(!in_array($resource_id, $group_resource_loot)) continue; |
|
| 456 | + if(!in_array($resource_id, $group_resource_loot)) { |
|
| 457 | + continue; |
|
| 458 | + } |
|
| 451 | 459 | $return_resources[$resource_id] += $unit_count * $resource_amount; |
| 452 | 460 | } |
| 453 | 461 | } |
@@ -464,11 +472,13 @@ discard block |
||
| 464 | 472 | } |
| 465 | 473 | } |
| 466 | 474 | |
| 467 | - if(!empty($unit_data)) |
|
| 468 | - upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';'); |
|
| 475 | + if(!empty($unit_data)) { |
|
| 476 | + upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';'); |
|
| 477 | + } |
|
| 469 | 478 | |
| 470 | - if(!empty($que_data)) |
|
| 471 | - upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';'); |
|
| 479 | + if(!empty($que_data)) { |
|
| 480 | + upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';'); |
|
| 481 | + } |
|
| 472 | 482 | |
| 473 | 483 | upd_alter_table('planets', $drop, true); |
| 474 | 484 | } |
@@ -761,9 +771,11 @@ discard block |
||
| 761 | 771 | !empty($strings) ? doquery($query_string . implode(',', $strings)) : false; |
| 762 | 772 | } |
| 763 | 773 | |
| 764 | - if(isset($update_tables['counter']['page'])) // TODO REMOVE |
|
| 774 | + if(isset($update_tables['counter']['page'])) { |
|
| 775 | + // TODO REMOVE |
|
| 765 | 776 | { |
| 766 | 777 | update_security_url("SELECT DISTINCT `page` as url FROM {{counter}}"); |
| 778 | + } |
|
| 767 | 779 | update_security_url("SELECT DISTINCT `url` as url FROM {{counter}}"); |
| 768 | 780 | } |
| 769 | 781 | } |
@@ -458,8 +458,7 @@ |
||
| 458 | 458 | |
| 459 | 459 | if(is_numeric($planet['id'])) { |
| 460 | 460 | db_planet_set_by_id($planet['id'], "`que_processed` = UNIX_TIMESTAMP(NOW())"); |
| 461 | - } |
|
| 462 | - elseif(is_numeric($user['id'])) { |
|
| 461 | + } elseif(is_numeric($user['id'])) { |
|
| 463 | 462 | db_user_set_by_id($user['id'], '`que_processed` = UNIX_TIMESTAMP(NOW())'); |
| 464 | 463 | } |
| 465 | 464 | |
@@ -33,8 +33,7 @@ discard block |
||
| 33 | 33 | if($quest_rewards_amount < 0) |
| 34 | 34 | { |
| 35 | 35 | throw new Exception($lang['qst_adm_err_reward_amount']); |
| 36 | - } |
|
| 37 | - elseif($quest_rewards_amount > 0) |
|
| 36 | + } elseif($quest_rewards_amount > 0) |
|
| 38 | 37 | { |
| 39 | 38 | $quest_rewards[] = "{$quest_rewards_id},{$quest_rewards_amount}"; |
| 40 | 39 | } |
@@ -75,8 +74,7 @@ discard block |
||
| 75 | 74 | `quest_rewards` = '{$quest_rewards}' |
| 76 | 75 | WHERE `quest_id` = {$quest_id} LIMIT 1;" |
| 77 | 76 | ); |
| 78 | - } |
|
| 79 | - else |
|
| 77 | + } else |
|
| 80 | 78 | { |
| 81 | 79 | sn_db_perform('{{quest}}', array( |
| 82 | 80 | 'quest_name' => $quest_name, |
@@ -94,8 +92,7 @@ discard block |
||
| 94 | 92 | msg_send_simple_message('*', 0, 0, MSG_TYPE_PLAYER, $lang['sys_administration'], $lang['news_title'], $text); |
| 95 | 93 | } |
| 96 | 94 | */ |
| 97 | - } |
|
| 98 | - catch (Exception $e) |
|
| 95 | + } catch (Exception $e) |
|
| 99 | 96 | { |
| 100 | 97 | message($e->getMessage(), $lang['sys_error']); |
| 101 | 98 | } |
@@ -119,8 +116,7 @@ discard block |
||
| 119 | 116 | } |
| 120 | 117 | $query = doquery("SELECT count(*) AS count FROM {{quest}};", '', true); |
| 121 | 118 | $config->db_saveItem('quest_total', $query['count']); |
| 122 | - } |
|
| 123 | - elseif(!$user_id) |
|
| 119 | + } elseif(!$user_id) |
|
| 124 | 120 | { |
| 125 | 121 | $user_id = $user['id']; |
| 126 | 122 | } |
@@ -137,8 +133,7 @@ discard block |
||
| 137 | 133 | if($quest) |
| 138 | 134 | { |
| 139 | 135 | $quest_templatized = qst_templatize(qst_quest_parse($quest, false)); |
| 140 | - } |
|
| 141 | - else |
|
| 136 | + } else |
|
| 142 | 137 | { |
| 143 | 138 | $quest_templatized['quest_rewards_list'] = array(); |
| 144 | 139 | } |
@@ -193,8 +188,7 @@ discard block |
||
| 193 | 188 | if($status == null) |
| 194 | 189 | { |
| 195 | 190 | $query_add_where .= "IS NULL"; |
| 196 | - } |
|
| 197 | - else |
|
| 191 | + } else |
|
| 198 | 192 | { |
| 199 | 193 | $query_add_where .= "= {$status}"; |
| 200 | 194 | } |
@@ -223,8 +217,7 @@ discard block |
||
| 223 | 217 | if($block_name) |
| 224 | 218 | { |
| 225 | 219 | $template->assign_block_vars($block_name, $quest_templatized); |
| 226 | - } |
|
| 227 | - else |
|
| 220 | + } else |
|
| 228 | 221 | { |
| 229 | 222 | $template->assign_vars($quest_templatized); |
| 230 | 223 | if(!empty($quest_templatized['quest_rewards_list'])) |
@@ -292,7 +285,9 @@ discard block |
||
| 292 | 285 | |
| 293 | 286 | function qst_reward(&$user, &$rewards, &$quest_list) |
| 294 | 287 | { |
| 295 | - if(empty($rewards)) return; |
|
| 288 | + if(empty($rewards)) { |
|
| 289 | + return; |
|
| 290 | + } |
|
| 296 | 291 | |
| 297 | 292 | global $lang; |
| 298 | 293 | |
@@ -300,11 +295,12 @@ discard block |
||
| 300 | 295 | $total_rewards = array(); |
| 301 | 296 | $comment_dm = ''; |
| 302 | 297 | |
| 303 | - foreach($rewards as $quest_id => $user_data) |
|
| 304 | - foreach($user_data as $user_id => $planet_data) |
|
| 298 | + foreach($rewards as $quest_id => $user_data) { |
|
| 299 | + foreach($user_data as $user_id => $planet_data) |
|
| 305 | 300 | foreach($planet_data as $planet_id => $reward_list) |
| 306 | 301 | { |
| 307 | 302 | $comment = sprintf($lang['qst_msg_complete_body'], $quest_list[$quest_id]['quest_name']); |
| 303 | + } |
|
| 308 | 304 | $comment_dm .= isset($reward_list[RES_DARK_MATTER]) ? $comment : ''; |
| 309 | 305 | |
| 310 | 306 | $comment_reward = array(); |
@@ -336,17 +332,17 @@ discard block |
||
| 336 | 332 | $local_changeset = array(); |
| 337 | 333 | foreach($unit_data as $unit_id => $unit_amount) |
| 338 | 334 | { |
| 339 | - if(!isset($quest_rewards_allowed[$unit_id])) continue; |
|
| 335 | + if(!isset($quest_rewards_allowed[$unit_id])) { |
|
| 336 | + continue; |
|
| 337 | + } |
|
| 340 | 338 | |
| 341 | 339 | if($unit_id == RES_DARK_MATTER) |
| 342 | 340 | { |
| 343 | 341 | rpg_points_change($user['id'], RPG_QUEST, $unit_amount, $comment_dm); |
| 344 | - } |
|
| 345 | - elseif(isset($group_resources[$unit_id])) |
|
| 342 | + } elseif(isset($group_resources[$unit_id])) |
|
| 346 | 343 | { |
| 347 | 344 | $local_changeset[pname_resource_name($unit_id)] = array('delta' => $unit_amount); |
| 348 | - } |
|
| 349 | - else // Проверим на юниты |
|
| 345 | + } else // Проверим на юниты |
|
| 350 | 346 | { |
| 351 | 347 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_amount, $user_row, $planet_id); |
| 352 | 348 | } |