@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | // Compare function to sort fleet in time order |
| 4 | 4 | function tpl_assign_fleet_compare($a, $b) |
| 5 | 5 | { |
| 6 | - if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) |
|
| 6 | + if ($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) |
|
| 7 | 7 | { |
| 8 | - if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) |
|
| 8 | + if ($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) |
|
| 9 | 9 | { |
| 10 | 10 | return 0; |
| 11 | 11 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return mixed |
| 108 | 108 | */ |
| 109 | -function tpl_parse_fleet_db($fleet, $index, $user_data = false){$result = null;return sn_function_call('tpl_parse_fleet_db', [$fleet, $index, $user_data, &$result]);} |
|
| 109 | +function tpl_parse_fleet_db($fleet, $index, $user_data = false) {$result = null; return sn_function_call('tpl_parse_fleet_db', [$fleet, $index, $user_data, &$result]); } |
|
| 110 | 110 | /** |
| 111 | 111 | * @param array $fleet |
| 112 | 112 | * @param int $index |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | function sn_tpl_parse_fleet_db($fleet, $index, $user_data = false, &$result) { |
| 119 | 119 | global $lang, $user; |
| 120 | 120 | |
| 121 | - if(!$user_data) { |
|
| 121 | + if (!$user_data) { |
|
| 122 | 122 | $user_data = $user; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if($fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] == MT_AKS) { |
|
| 125 | + if ($fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] == MT_AKS) { |
|
| 126 | 126 | $aks = doquery("SELECT * FROM {{aks}} WHERE id={$fleet['fleet_group']} LIMIT 1;", true); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -173,11 +173,11 @@ discard block |
||
| 173 | 173 | $ship_list = explode(';', $fleet['fleet_array']); |
| 174 | 174 | |
| 175 | 175 | $ship_id = 0; |
| 176 | - if($spy_level >= 6) { |
|
| 177 | - foreach($ship_list as $ship_record) { |
|
| 178 | - if($ship_record) { |
|
| 176 | + if ($spy_level >= 6) { |
|
| 177 | + foreach ($ship_list as $ship_record) { |
|
| 178 | + if ($ship_record) { |
|
| 179 | 179 | $ship_data = explode(',', $ship_record); |
| 180 | - if($spy_level >= 10) { |
|
| 180 | + if ($spy_level >= 10) { |
|
| 181 | 181 | $single_ship_data = get_ship_data($ship_data[0], $user_data); |
| 182 | 182 | $result['ships'][$ship_data[0]] = array( |
| 183 | 183 | 'ID' => $ship_data[0], |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | $hangar_que = array(); |
| 213 | 213 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; |
| 214 | - if(!empty($que_hangar)) |
|
| 214 | + if (!empty($que_hangar)) |
|
| 215 | 215 | { |
| 216 | - foreach($que_hangar as $que_item) |
|
| 216 | + foreach ($que_hangar as $que_item) |
|
| 217 | 217 | { |
| 218 | 218 | $hangar_que['que'][] = array('id' => $que_item['que_unit_id'], 'count' => $que_item['que_unit_amount']); |
| 219 | 219 | $hangar_que[$que_item['que_unit_id']] += $que_item['que_unit_amount']; |
@@ -317,11 +317,11 @@ discard block |
||
| 317 | 317 | 'PLANET_GOVERNOR_LEVEL_MAX' => get_unit_param($planet['PLANET_GOVERNOR_ID'], P_MAX_STACK), |
| 318 | 318 | ]; |
| 319 | 319 | |
| 320 | - if(!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) |
|
| 320 | + if (!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) |
|
| 321 | 321 | { |
| 322 | 322 | $result['building_que'] = []; |
| 323 | 323 | $building_que = &$que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']]; |
| 324 | - foreach($building_que as $que_element) |
|
| 324 | + foreach ($building_que as $que_element) |
|
| 325 | 325 | { |
| 326 | 326 | $result['building_que'][] = que_tpl_parse_element($que_element); |
| 327 | 327 | } |
@@ -332,23 +332,23 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | function flt_get_fleets_to_planet($planet, $fleet_db_list = 0) |
| 334 | 334 | { |
| 335 | - if(!($planet && $planet['id']) && !$fleet_db_list) |
|
| 335 | + if (!($planet && $planet['id']) && !$fleet_db_list) |
|
| 336 | 336 | { |
| 337 | 337 | return $planet; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | global $user; |
| 341 | 341 | |
| 342 | - if($fleet_db_list === 0) |
|
| 342 | + if ($fleet_db_list === 0) |
|
| 343 | 343 | { |
| 344 | 344 | $fleet_db_list = fleet_and_missiles_list_by_coordinates($planet); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - foreach($fleet_db_list as $fleet) |
|
| 347 | + foreach ($fleet_db_list as $fleet) |
|
| 348 | 348 | { |
| 349 | - if($fleet['fleet_owner'] == $user['id']) |
|
| 349 | + if ($fleet['fleet_owner'] == $user['id']) |
|
| 350 | 350 | { |
| 351 | - if($fleet['fleet_mission'] == MT_MISSILE) |
|
| 351 | + if ($fleet['fleet_mission'] == MT_MISSILE) |
|
| 352 | 352 | { |
| 353 | 353 | continue; |
| 354 | 354 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | else |
| 358 | 358 | { |
| 359 | - switch($fleet['fleet_mission']) |
|
| 359 | + switch ($fleet['fleet_mission']) |
|
| 360 | 360 | { |
| 361 | 361 | case MT_ATTACK: |
| 362 | 362 | case MT_AKS: |
@@ -374,13 +374,13 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | $fleet_list[$fleet_ownage]['fleets'][$fleet['fleet_id']] = $fleet; |
| 376 | 376 | |
| 377 | - if($fleet['fleet_mess'] == 1 || ($fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] == MT_RELOCATE) || ($fleet['fleet_target_owner'] != $user['id'])) |
|
| 377 | + if ($fleet['fleet_mess'] == 1 || ($fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] == MT_RELOCATE) || ($fleet['fleet_target_owner'] != $user['id'])) |
|
| 378 | 378 | { |
| 379 | 379 | // $fleet_sn = flt_expand($fleet); |
| 380 | 380 | $fleet_sn = sys_unit_str2arr($fleet['fleet_array']); |
| 381 | - foreach($fleet_sn as $ship_id => $ship_amount) |
|
| 381 | + foreach ($fleet_sn as $ship_id => $ship_amount) |
|
| 382 | 382 | { |
| 383 | - if(in_array($ship_id, sn_get_groups('fleet'))) |
|
| 383 | + if (in_array($ship_id, sn_get_groups('fleet'))) |
|
| 384 | 384 | { |
| 385 | 385 | $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship_amount; |
| 386 | 386 | } |
@@ -414,14 +414,14 @@ discard block |
||
| 414 | 414 | 'ENERGY_MAX_NUMBER_TEXT_NO_COLOR' => HelperString::numberFloorAndFormat($planetrow['energy_max']), |
| 415 | 415 | 'ENERGY_MAX_NUMBER_TEXT' => Tools::numberPercentSpan($planetrow['energy_max'], $planetrow['energy_used']), |
| 416 | 416 | 'ENERGY_MAX' => prettyNumberStyledCompare($planetrow['energy_max'], -$planetrow['energy_used']), |
| 417 | - 'ENERGY_FILL' => round(($planetrow["energy_used"]/($planetrow["energy_max"]+1))*100,0), |
|
| 417 | + 'ENERGY_FILL' => round(($planetrow["energy_used"] / ($planetrow["energy_max"] + 1)) * 100, 0), |
|
| 418 | 418 | |
| 419 | 419 | 'PLANET_METAL' => floor($planetrow["metal"]), |
| 420 | 420 | 'PLANET_METAL_TEXT' => prettyNumberStyledCompare($planetrow["metal"], $planetrow["metal_max"]), |
| 421 | 421 | 'PLANET_METAL_MAX' => floor($planetrow["metal_max"]), |
| 422 | 422 | 'PLANET_METAL_MAX_TEXT' => Tools::numberPercentSpan($planetrow["metal_max"], $planetrow["metal"]), |
| 423 | 423 | 'PLANET_METAL_MAX_NO_COLOR' => HelperString::numberFloorAndFormat($planetrow["metal_max"]), |
| 424 | - 'PLANET_METAL_FILL' => round(($planetrow["metal"]/($planetrow["metal_max"]+1))*100,0), |
|
| 424 | + 'PLANET_METAL_FILL' => round(($planetrow["metal"] / ($planetrow["metal_max"] + 1)) * 100, 0), |
|
| 425 | 425 | 'PLANET_METAL_PERHOUR' => round($planetrow["metal_perhour"], 5), |
| 426 | 426 | 'PLANET_METAL_FLEET_TEXT' => prettyNumberStyledDefault($fleets_to_planet[$planetrow['id']]['fleet']['METAL']), |
| 427 | 427 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | 'PLANET_CRYSTAL_MAX' => floor($planetrow["crystal_max"]), |
| 431 | 431 | 'PLANET_CRYSTAL_MAX_TEXT' => Tools::numberPercentSpan($planetrow["crystal_max"], $planetrow["crystal"]), |
| 432 | 432 | 'PLANET_CRYSTAL_MAX_NO_COLOR' => HelperString::numberFloorAndFormat($planetrow["crystal_max"]), |
| 433 | - 'PLANET_CRYSTAL_FILL' => round(($planetrow["crystal"]/($planetrow["crystal_max"]+1))*100,0), |
|
| 433 | + 'PLANET_CRYSTAL_FILL' => round(($planetrow["crystal"] / ($planetrow["crystal_max"] + 1)) * 100, 0), |
|
| 434 | 434 | 'PLANET_CRYSTAL_PERHOUR' => round($planetrow["crystal_perhour"], 5), |
| 435 | 435 | 'PLANET_CRYSTAL_FLEET_TEXT' => prettyNumberStyledDefault($fleets_to_planet[$planetrow['id']]['fleet']['CRYSTAL']), |
| 436 | 436 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | 'PLANET_DEUTERIUM_MAX' => floor($planetrow["deuterium_max"]), |
| 440 | 440 | 'PLANET_DEUTERIUM_MAX_TEXT' => Tools::numberPercentSpan($planetrow["deuterium_max"], $planetrow["deuterium"]), |
| 441 | 441 | 'PLANET_DEUTERIUM_MAX_NO_COLOR' => HelperString::numberFloorAndFormat($planetrow["deuterium_max"]), |
| 442 | - 'PLANET_DEUTERIUM_FILL' => round(($planetrow["deuterium"]/($planetrow["deuterium_max"]+1))*100,0), |
|
| 442 | + 'PLANET_DEUTERIUM_FILL' => round(($planetrow["deuterium"] / ($planetrow["deuterium_max"] + 1)) * 100, 0), |
|
| 443 | 443 | 'PLANET_DEUTERIUM_PERHOUR' => round($planetrow["deuterium_perhour"], 5), |
| 444 | 444 | 'PLANET_DEUTERIUM_FLEET_TEXT' => prettyNumberStyledDefault($fleets_to_planet[$planetrow['id']]['fleet']['DEUTERIUM']), |
| 445 | 445 | )); |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Load template source from file |
|
| 59 | - * @access private |
|
| 60 | - */ |
|
| 58 | + * Load template source from file |
|
| 59 | + * @access private |
|
| 60 | + */ |
|
| 61 | 61 | function _tpl_load_file($handle, $store_in_db = false) |
| 62 | 62 | { |
| 63 | 63 | // Try and open template for read |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | - * Remove any PHP tags that do not belong, these regular expressions are derived from |
|
| 104 | - * the ones that exist in zend_language_scanner.l |
|
| 105 | - * @access private |
|
| 106 | - */ |
|
| 103 | + * Remove any PHP tags that do not belong, these regular expressions are derived from |
|
| 104 | + * the ones that exist in zend_language_scanner.l |
|
| 105 | + * @access private |
|
| 106 | + */ |
|
| 107 | 107 | function remove_php_tags(&$code) |
| 108 | 108 | { |
| 109 | 109 | // This matches the information gathered from the internal PHP lexer |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
|
| 121 | - * @access private |
|
| 122 | - */ |
|
| 120 | + * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
|
| 121 | + * @access private |
|
| 122 | + */ |
|
| 123 | 123 | function compile($code, $no_echo = false, $echo_var = '') |
| 124 | 124 | { |
| 125 | 125 | global $config; |
@@ -290,9 +290,9 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
| 293 | - * Compile variables |
|
| 294 | - * @access private |
|
| 295 | - */ |
|
| 293 | + * Compile variables |
|
| 294 | + * @access private |
|
| 295 | + */ |
|
| 296 | 296 | function compile_var_tags(&$text_blocks) |
| 297 | 297 | { |
| 298 | 298 | // including $lang variable |
@@ -365,9 +365,9 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | - * Compile blocks |
|
| 369 | - * @access private |
|
| 370 | - */ |
|
| 368 | + * Compile blocks |
|
| 369 | + * @access private |
|
| 370 | + */ |
|
| 371 | 371 | function compile_tag_block($tag_args) |
| 372 | 372 | { |
| 373 | 373 | $no_nesting = false; |
@@ -453,14 +453,14 @@ discard block |
||
| 453 | 453 | $tag_template_php .= 'if ($_' . $tag_args . '_count) {'; |
| 454 | 454 | |
| 455 | 455 | /** |
| 456 | - * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory |
|
| 457 | - * <code> |
|
| 458 | - * if (!$offset) |
|
| 459 | - * { |
|
| 460 | - * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; |
|
| 461 | - * } |
|
| 462 | - * </code> |
|
| 463 | - */ |
|
| 456 | + * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory |
|
| 457 | + * <code> |
|
| 458 | + * if (!$offset) |
|
| 459 | + * { |
|
| 460 | + * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; |
|
| 461 | + * } |
|
| 462 | + * </code> |
|
| 463 | + */ |
|
| 464 | 464 | |
| 465 | 465 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
| 466 | 466 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
@@ -471,10 +471,10 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
| 474 | - * Compile IF tags - much of this is from Smarty with |
|
| 475 | - * some adaptions for our block level methods |
|
| 476 | - * @access private |
|
| 477 | - */ |
|
| 474 | + * Compile IF tags - much of this is from Smarty with |
|
| 475 | + * some adaptions for our block level methods |
|
| 476 | + * @access private |
|
| 477 | + */ |
|
| 478 | 478 | function compile_tag_if($tag_args, $elseif) |
| 479 | 479 | { |
| 480 | 480 | // Tokenize args for 'if' tag. |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
| 632 | - * Compile DEFINE tags |
|
| 633 | - * @access private |
|
| 634 | - */ |
|
| 632 | + * Compile DEFINE tags |
|
| 633 | + * @access private |
|
| 634 | + */ |
|
| 635 | 635 | function compile_tag_define($tag_args, $op) |
| 636 | 636 | { |
| 637 | 637 | preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); |
@@ -682,9 +682,9 @@ discard block |
||
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | /** |
| 685 | - * Compile INCLUDE tag |
|
| 686 | - * @access private |
|
| 687 | - */ |
|
| 685 | + * Compile INCLUDE tag |
|
| 686 | + * @access private |
|
| 687 | + */ |
|
| 688 | 688 | function compile_tag_include($tag_args) |
| 689 | 689 | { |
| 690 | 690 | // Process dynamic includes |
@@ -697,19 +697,19 @@ discard block |
||
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | /** |
| 700 | - * Compile INCLUDE_PHP tag |
|
| 701 | - * @access private |
|
| 702 | - */ |
|
| 700 | + * Compile INCLUDE_PHP tag |
|
| 701 | + * @access private |
|
| 702 | + */ |
|
| 703 | 703 | function compile_tag_include_php($tag_args) |
| 704 | 704 | { |
| 705 | 705 | return "\$this->_php_include('$tag_args');"; |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
| 709 | - * parse expression |
|
| 710 | - * This is from Smarty |
|
| 711 | - * @access private |
|
| 712 | - */ |
|
| 709 | + * parse expression |
|
| 710 | + * This is from Smarty |
|
| 711 | + * @access private |
|
| 712 | + */ |
|
| 713 | 713 | function _parse_is_expr($is_arg, $tokens) |
| 714 | 714 | { |
| 715 | 715 | $expr_end = 0; |
@@ -802,14 +802,14 @@ discard block |
||
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | /** |
| 805 | - * Generates a reference to the array of data values for the given |
|
| 806 | - * (possibly nested) block namespace. This is a string of the form: |
|
| 807 | - * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] |
|
| 808 | - * |
|
| 809 | - * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. |
|
| 810 | - * NOTE: does not expect a trailing "." on the blockname. |
|
| 811 | - * @access private |
|
| 812 | - */ |
|
| 805 | + * Generates a reference to the array of data values for the given |
|
| 806 | + * (possibly nested) block namespace. This is a string of the form: |
|
| 807 | + * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] |
|
| 808 | + * |
|
| 809 | + * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. |
|
| 810 | + * NOTE: does not expect a trailing "." on the blockname. |
|
| 811 | + * @access private |
|
| 812 | + */ |
|
| 813 | 813 | function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) |
| 814 | 814 | { |
| 815 | 815 | // Get an array of the blocks involved. |
@@ -845,9 +845,9 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | /** |
| 848 | - * Write compiled file to cache directory |
|
| 849 | - * @access private |
|
| 850 | - */ |
|
| 848 | + * Write compiled file to cache directory |
|
| 849 | + * @access private |
|
| 850 | + */ |
|
| 851 | 851 | function compile_write($handle, $data) |
| 852 | 852 | { |
| 853 | 853 | $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX; |
@@ -870,9 +870,9 @@ discard block |
||
| 870 | 870 | |
| 871 | 871 | // Gorlum's minifier BOF |
| 872 | 872 | /** |
| 873 | - * Minifies template w/i PHP code by removing extra spaces |
|
| 874 | - * @access private |
|
| 875 | - */ |
|
| 873 | + * Minifies template w/i PHP code by removing extra spaces |
|
| 874 | + * @access private |
|
| 875 | + */ |
|
| 876 | 876 | function minify($html) |
| 877 | 877 | { |
| 878 | 878 | global $config; |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches); |
| 145 | 145 | $include_blocks = $matches[1]; |
| 146 | - if($include_blocks) |
|
| 146 | + if ($include_blocks) |
|
| 147 | 147 | { |
| 148 | - foreach($include_blocks as &$included_file) |
|
| 148 | + foreach ($include_blocks as &$included_file) |
|
| 149 | 149 | { |
| 150 | 150 | $included_file .= '.tpl.html'; |
| 151 | 151 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $varname = $var_val[3]; |
| 311 | 311 | $new = $this->generate_block_varref($namespace, $varname, $var_val[2]); |
| 312 | 312 | |
| 313 | - if(!empty($var_val[4])) { |
|
| 313 | + if (!empty($var_val[4])) { |
|
| 314 | 314 | $new = \Ptl\PtlVariableDecorator::decorate($var_val[0], $new, $this->template); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -464,8 +464,8 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
| 466 | 466 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
| 467 | - $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
| 468 | - $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
| 467 | + $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
| 468 | + $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
| 469 | 469 | |
| 470 | 470 | return $tag_template_php; |
| 471 | 471 | } |
@@ -569,10 +569,10 @@ discard block |
||
| 569 | 569 | break; |
| 570 | 570 | |
| 571 | 571 | case 'is': |
| 572 | - $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1; |
|
| 572 | + $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1; |
|
| 573 | 573 | $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); |
| 574 | 574 | |
| 575 | - $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); |
|
| 575 | + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1)); |
|
| 576 | 576 | |
| 577 | 577 | array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens); |
| 578 | 578 | |
@@ -836,11 +836,11 @@ discard block |
||
| 836 | 836 | } |
| 837 | 837 | else if ($include_last_iterator) |
| 838 | 838 | { |
| 839 | - return '$_'. $blocks[$blockcount] . '_val'; |
|
| 839 | + return '$_' . $blocks[$blockcount] . '_val'; |
|
| 840 | 840 | } |
| 841 | 841 | else |
| 842 | 842 | { |
| 843 | - return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
|
| 843 | + return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']'; |
|
| 844 | 844 | } |
| 845 | 845 | } |
| 846 | 846 | |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | if ($fp = @fopen($filename, 'wb')) |
| 858 | 858 | { |
| 859 | 859 | @flock($fp, LOCK_EX); |
| 860 | - @fwrite ($fp, $data); |
|
| 860 | + @fwrite($fp, $data); |
|
| 861 | 861 | @flock($fp, LOCK_UN); |
| 862 | 862 | @fclose($fp); |
| 863 | 863 | |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | { |
| 878 | 878 | global $config; |
| 879 | 879 | |
| 880 | - if(!$config->tpl_minifier) |
|
| 880 | + if (!$config->tpl_minifier) |
|
| 881 | 881 | { |
| 882 | 882 | return $html; |
| 883 | 883 | } |
@@ -889,14 +889,14 @@ discard block |
||
| 889 | 889 | //$html = preg_replace('/[\r\n\t]+/', ' ', $html); |
| 890 | 890 | $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags |
| 891 | 891 | $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space |
| 892 | - if(!empty($pre[0])) |
|
| 892 | + if (!empty($pre[0])) |
|
| 893 | 893 | { |
| 894 | - foreach($pre[0] as $tag) |
|
| 894 | + foreach ($pre[0] as $tag) |
|
| 895 | 895 | { |
| 896 | 896 | $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside |
| 897 | 897 | $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one |
| 898 | 898 | $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one |
| 899 | - $html = preg_replace('/#pre#/', $tag, $html,1); |
|
| 899 | + $html = preg_replace('/#pre#/', $tag, $html, 1); |
|
| 900 | 900 | } |
| 901 | 901 | } |
| 902 | 902 | |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | |
| 75 | 75 | if (array_key_exists(self::PARAM_NUMERIC, $ptlTag->params)) { |
| 76 | 76 | // Just dump other params |
| 77 | - foreach(static::$allowedParams as $paramName => $limitTag) { |
|
| 77 | + foreach (static::$allowedParams as $paramName => $limitTag) { |
|
| 78 | 78 | if ($limitTag != self::PARAM_NUMERIC || !array_key_exists($paramName, $ptlTag->params)) { |
| 79 | 79 | continue; |
| 80 | 80 | } |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | ]); |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
| 53 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
| 54 | 54 | $template = gettemplate('resources', true); |
| 55 | 55 | |
| 56 | 56 | $planet = new \Planet\Planet($planetrow['id']); |
| 57 | -if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
| 57 | +if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
| 58 | 58 | $template->assign_block_vars('result', $transmutation_result); |
| 59 | 59 | $planet = new \Planet\Planet($planetrow['id']); |
| 60 | 60 | } |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | $production = $_POST['production']; |
| 64 | 64 | //$SubQry = ''; |
| 65 | 65 | $SubQry = array(); |
| 66 | -if(is_array($production)) { |
|
| 67 | - foreach($production as $prod_id => $percent) { |
|
| 68 | - if($percent > 100 || $percent < 0) { |
|
| 66 | +if (is_array($production)) { |
|
| 67 | + foreach ($production as $prod_id => $percent) { |
|
| 68 | + if ($percent > 100 || $percent < 0) { |
|
| 69 | 69 | $debug->warning('Supplying wrong production percent (less then 0 or greater then 100)', 'Hack attempt', 302, array('base_dump' => true)); |
| 70 | 70 | die(); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $prod_id = intval($prod_id); |
| 74 | - if(in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
| 74 | + if (in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
| 75 | 75 | $field_name = pname_factory_production_field_name($prod_id); |
| 76 | 76 | $percent = floor($percent / 10); |
| 77 | 77 | $planetrow[$field_name] = $percent; |
| 78 | 78 | //$SubQry .= "`{$field_name}` = '{$percent}',"; |
| 79 | - $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
| 79 | + $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
| 80 | 80 | } else { |
| 81 | 81 | $debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
| 82 | 82 | continue; |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | 'ENERGY_TYPE' => $capsObj->productionCurrentMatrix[RES_ENERGY][0], |
| 114 | 114 | )); |
| 115 | 115 | |
| 116 | -foreach($sn_group_factories as $unit_id) |
|
| 116 | +foreach ($sn_group_factories as $unit_id) |
|
| 117 | 117 | { |
| 118 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
| 118 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
| 119 | 119 | { |
| 120 | 120 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
| 121 | 121 | $template->assign_block_vars('production', array( |