@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | for ($Option = 10; $Option >= 0; $Option--) |
| 94 | 94 | { |
| 95 | - $template->assign_block_vars('option', array( |
|
| 96 | - 'VALUE' => $Option * 10, |
|
| 97 | - )); |
|
| 95 | + $template->assign_block_vars('option', array( |
|
| 96 | + 'VALUE' => $Option * 10, |
|
| 97 | + )); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $caps_real = eco_get_planet_caps($user, $planetrow, 3600); |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | int_calc_storage_bar(RES_DEUTERIUM); |
| 164 | 164 | |
| 165 | 165 | $template->assign_vars(array( |
| 166 | - 'PLANET_NAME' => $planetrow['name'], |
|
| 167 | - 'PLANET_TYPE' => $planetrow['planet_type'], |
|
| 168 | - 'PLANET_DENSITY_INDEX' => $planet_density_index, |
|
| 169 | - 'PLANET_CORE_TEXT' => $lang['uni_planet_density_types'][$planet_density_index], |
|
| 166 | + 'PLANET_NAME' => $planetrow['name'], |
|
| 167 | + 'PLANET_TYPE' => $planetrow['planet_type'], |
|
| 168 | + 'PLANET_DENSITY_INDEX' => $planet_density_index, |
|
| 169 | + 'PLANET_CORE_TEXT' => $lang['uni_planet_density_types'][$planet_density_index], |
|
| 170 | 170 | |
| 171 | - 'PRODUCTION_LEVEL' => floor($caps_real['efficiency'] * 100), |
|
| 171 | + 'PRODUCTION_LEVEL' => floor($caps_real['efficiency'] * 100), |
|
| 172 | 172 | |
| 173 | - 'PAGE_HINT' => $lang['res_hint'], |
|
| 173 | + 'PAGE_HINT' => $lang['res_hint'], |
|
| 174 | 174 | )); |
| 175 | 175 | |
| 176 | 176 | display($template, $lang['res_planet_production']); |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | )); |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
| 49 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
| 50 | 50 | $template = gettemplate('resources', true); |
| 51 | 51 | |
| 52 | 52 | $transmutation_result = sn_sys_planet_core_transmute($user, $planetrow); |
| 53 | -if(!empty($transmutation_result)) |
|
| 53 | +if (!empty($transmutation_result)) |
|
| 54 | 54 | { |
| 55 | 55 | $template->assign_block_vars('result', $transmutation_result); // array('STATUS' => $transmutation_result['STATUS'], 'MESSAGE' => $transmutation_result['MESSAGE'])); |
| 56 | 56 | } |
@@ -59,20 +59,20 @@ discard block |
||
| 59 | 59 | $production = $_POST['production']; |
| 60 | 60 | //$SubQry = ''; |
| 61 | 61 | $SubQry = array(); |
| 62 | -if(is_array($production)) { |
|
| 63 | - foreach($production as $prod_id => $percent) { |
|
| 64 | - if($percent > 100 || $percent < 0) { |
|
| 62 | +if (is_array($production)) { |
|
| 63 | + foreach ($production as $prod_id => $percent) { |
|
| 64 | + if ($percent > 100 || $percent < 0) { |
|
| 65 | 65 | $debug->warning('Supplying wrong production percent (less then 0 or greater then 100)', 'Hack attempt', 302, array('base_dump' => true)); |
| 66 | 66 | die(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $prod_id = intval($prod_id); |
| 70 | - if(in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
| 70 | + if (in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
| 71 | 71 | $field_name = pname_factory_production_field_name($prod_id); |
| 72 | 72 | $percent = floor($percent / 10); |
| 73 | 73 | $planetrow[$field_name] = $percent; |
| 74 | 74 | //$SubQry .= "`{$field_name}` = '{$percent}',"; |
| 75 | - $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
| 75 | + $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
| 76 | 76 | } else { |
| 77 | 77 | $debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
| 78 | 78 | continue; |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | 'ENERGY_TYPE' => pretty_number($caps_real['production'][RES_ENERGY][0], true, true), |
| 109 | 109 | )); |
| 110 | 110 | |
| 111 | -foreach($sn_group_factories as $unit_id) |
|
| 111 | +foreach ($sn_group_factories as $unit_id) |
|
| 112 | 112 | { |
| 113 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
| 113 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
| 114 | 114 | { |
| 115 | 115 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
| 116 | 116 | $template->assign_block_vars('production', array( |
@@ -39,8 +39,8 @@ |
||
| 39 | 39 | 0 => $row['visit_time'], // start |
| 40 | 40 | 1 => $row['visit_time'], // end |
| 41 | 41 | ) |
| 42 | - //: false |
|
| 43 | - ; |
|
| 42 | + //: false |
|
| 43 | + ; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $session_list = array(); |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | // define('SESSION_INTERRUPT', 15*60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
| 20 | 20 | // define('SUSPICIOUS_LONG', 2 * 60*60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
| 21 | 21 | |
| 22 | -define('SESSION_INTERRUPT', 1 * 60*60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
|
| 23 | -define('SUSPICIOUS_LONG', 16 * 60*60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
|
| 22 | +define('SESSION_INTERRUPT', 1 * 60 * 60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
|
| 23 | +define('SUSPICIOUS_LONG', 16 * 60 * 60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | function check_suspicious(&$session, &$session_list_last_id, &$row) { |
| 27 | 27 | $session[2] = $session[1] - $session[0]; |
| 28 | - if($session[2] > SUSPICIOUS_LONG) |
|
| 28 | + if ($session[2] > SUSPICIOUS_LONG) |
|
| 29 | 29 | { |
| 30 | 30 | $session[2] = pretty_time($session[2]); |
| 31 | 31 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -46,24 +46,24 @@ discard block |
||
| 46 | 46 | $session_list = array(); |
| 47 | 47 | $query = doquery("SELECT `visit_time`, user_id FROM {{counter}} where user_id <> 0 and visit_time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY)) order by user_id, visit_time;"); |
| 48 | 48 | $session = array(); |
| 49 | -if($row = db_fetch($query)) { |
|
| 49 | +if ($row = db_fetch($query)) { |
|
| 50 | 50 | $session = array( |
| 51 | 51 | 0 => strtotime($row['visit_time']), // start |
| 52 | 52 | 1 => strtotime($row['visit_time']), // end |
| 53 | 53 | ); |
| 54 | 54 | $last_id = $row['user_id']; |
| 55 | 55 | } |
| 56 | -while($row = db_fetch($query)) { |
|
| 56 | +while ($row = db_fetch($query)) { |
|
| 57 | 57 | $row['visit_time'] = strtotime($row['visit_time']); |
| 58 | - if($last_id == $row['user_id']) { |
|
| 58 | + if ($last_id == $row['user_id']) { |
|
| 59 | 59 | // Тот же юзер |
| 60 | - if($row['visit_time'] - $session[1] <= SESSION_INTERRUPT) { // Та же сессия |
|
| 60 | + if ($row['visit_time'] - $session[1] <= SESSION_INTERRUPT) { // Та же сессия |
|
| 61 | 61 | $session[1] = $row['visit_time']; |
| 62 | 62 | } else { |
| 63 | 63 | // Новая сессия |
| 64 | 64 | // check_suspicious($session, $session_list[$last_id], $row); |
| 65 | 65 | $session[2] = $session[1] - $session[0]; |
| 66 | - if($session[2] > SUSPICIOUS_LONG) |
|
| 66 | + if ($session[2] > SUSPICIOUS_LONG) |
|
| 67 | 67 | { |
| 68 | 68 | $session[2] = pretty_time($session[2]); |
| 69 | 69 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } else { |
| 79 | 79 | // check_suspicious($session, $session_list[$last_id], $row); |
| 80 | 80 | $session[2] = $session[1] - $session[0]; |
| 81 | - if($session[2] > SUSPICIOUS_LONG) |
|
| 81 | + if ($session[2] > SUSPICIOUS_LONG) |
|
| 82 | 82 | { |
| 83 | 83 | $session[2] = pretty_time($session[2]); |
| 84 | 84 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | -if($last_id) { |
|
| 96 | +if ($last_id) { |
|
| 97 | 97 | // check_suspicious($session, $session_list[$last_id], $row = array('time' => 0)); |
| 98 | 98 | $session[2] = $session[1] - $session[0]; |
| 99 | 99 | |
| 100 | - if($session[2] > SUSPICIOUS_LONG) |
|
| 100 | + if ($session[2] > SUSPICIOUS_LONG) |
|
| 101 | 101 | { |
| 102 | 102 | $session[2] = pretty_time($session[2]); |
| 103 | 103 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | print("<td>ID</td><td>Username</td><td>Start</td><td>End</td><td>Length</td>"); |
| 112 | 112 | print("<td>Last online</td>"); |
| 113 | 113 | print("</tr>"); |
| 114 | -foreach($session_list as $user_id => $value) { |
|
| 114 | +foreach ($session_list as $user_id => $value) { |
|
| 115 | 115 | $user_record = doquery("SELECT `username`, onlinetime FROM {{users}} WHERE id = {$user_id};", true); |
| 116 | - foreach($value as $interval_data) { |
|
| 116 | + foreach ($value as $interval_data) { |
|
| 117 | 117 | print("<tr>"); |
| 118 | 118 | print("<td>{$user_id}</td><td>{$user_record['username']}</td><td>{$interval_data[0]}</td><td>{$interval_data[1]}</td><td>{$interval_data[2]}</td>"); |
| 119 | 119 | print("<td>" . date(FMT_DATE_TIME_SQL, $user_record['onlinetime']) . "</td>"); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
|
| 3 | +function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list)); } |
|
| 4 | 4 | function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
| 5 | 5 | { |
| 6 | 6 | global $lang; |
@@ -19,19 +19,19 @@ discard block |
||
| 19 | 19 | return $mode; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));} |
|
| 22 | +function admin_planet_edit_template(&$template, $edit_planet_row, $mode) {return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode)); } |
|
| 23 | 23 | function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) |
| 24 | 24 | { |
| 25 | 25 | global $lang; |
| 26 | 26 | |
| 27 | 27 | $unit_list = sn_get_groups($mode); |
| 28 | - if(empty($unit_list)) |
|
| 28 | + if (empty($unit_list)) |
|
| 29 | 29 | { |
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | $name_list = $lang['tech']; |
| 33 | 33 | |
| 34 | - foreach($unit_list as $unit_id) |
|
| 34 | + foreach ($unit_list as $unit_id) |
|
| 35 | 35 | { |
| 36 | 36 | $template->assign_block_vars('unit', array( |
| 37 | 37 | 'ID' => $unit_id, |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
|
| 45 | +function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode)); } |
|
| 46 | 46 | function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
| 47 | 47 | { |
| 48 | - if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
| 48 | + if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
| 49 | 49 | { |
| 50 | 50 | $unit_amount = round($unit_amount); |
| 51 | 51 | $unit_name = get_unit_param($unit_id, P_NAME); |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | $template = gettemplate('banned_body', true); |
| 20 | 20 | |
| 21 | 21 | $query = doquery("SELECT * FROM {{banned}} ORDER BY `ban_id` DESC;"); |
| 22 | -$i=0; |
|
| 23 | -while($ban_row = db_fetch($query)) |
|
| 22 | +$i = 0; |
|
| 23 | +while ($ban_row = db_fetch($query)) |
|
| 24 | 24 | { |
| 25 | 25 | $template->assign_block_vars('banlist', array( |
| 26 | 26 | 'USER_NAME' => $ban_row['ban_user_name'], |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | $mode = sys_get_param_escaped('mode'); |
| 22 | 22 | $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode))); |
| 23 | 23 | |
| 24 | -if($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | - if(!empty($lang['player_option_building_sort'][$building_sort])) { |
|
| 24 | +if ($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | + if (!empty($lang['player_option_building_sort'][$building_sort])) { |
|
| 26 | 26 | classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort; |
| 27 | 27 | classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0); |
| 28 | 28 | } |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | $time_server = $time_local - $time_diff |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if($font_size = sys_get_param_str('font_size')) { |
|
| 17 | - if(strpos($font_size, '%') !== false) { |
|
| 16 | +if ($font_size = sys_get_param_str('font_size')) { |
|
| 17 | + if (strpos($font_size, '%') !== false) { |
|
| 18 | 18 | // Размер шрифта в процентах |
| 19 | 19 | $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
| 20 | - } elseif(strpos($font_size, 'px') !== false) { |
|
| 20 | + } elseif (strpos($font_size, 'px') !== false) { |
|
| 21 | 21 | // Размер шрифта в пикселях |
| 22 | 22 | $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
| 23 | 23 | } else { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE] = $font_size; |
| 30 | 30 | } else { |
| 31 | 31 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
| 32 | - if($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 32 | + if ($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 33 | 33 | $time_diff = intval($user_time_diff[PLAYER_OPTION_TIME_DIFF]); |
| 34 | 34 | } else { |
| 35 | 35 | $user_time_diff = playerTimeDiff::user_time_diff_probe(); |
@@ -1,52 +1,52 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function dump($value,$varname = "",$level=0,$dumper = "") |
|
| 3 | +function dump($value, $varname = "", $level = 0, $dumper = "") |
|
| 4 | 4 | { |
| 5 | 5 | if ($varname) $varname .= " = "; |
| 6 | 6 | |
| 7 | - if ($level==-1) |
|
| 7 | + if ($level == -1) |
|
| 8 | 8 | { |
| 9 | - $trans[' ']='∴'; |
|
| 10 | - $trans["\t"]='⇒'; |
|
| 11 | - $trans["\n"]='¶;'; |
|
| 12 | - $trans["\r"]='⇐'; |
|
| 13 | - $trans["\0"]='⊕'; |
|
| 14 | - return strtr(htmlspecialchars($value),$trans); |
|
| 9 | + $trans[' '] = '∴'; |
|
| 10 | + $trans["\t"] = '⇒'; |
|
| 11 | + $trans["\n"] = '¶;'; |
|
| 12 | + $trans["\r"] = '⇐'; |
|
| 13 | + $trans["\0"] = '⊕'; |
|
| 14 | + return strtr(htmlspecialchars($value), $trans); |
|
| 15 | 15 | } |
| 16 | - if ($level==0) $dumper = '<pre>' . $varname; |
|
| 16 | + if ($level == 0) $dumper = '<pre>' . $varname; |
|
| 17 | 17 | |
| 18 | 18 | $type = gettype($value); |
| 19 | 19 | $dumper .= $type; |
| 20 | 20 | |
| 21 | - if ($type=='string') |
|
| 21 | + if ($type == 'string') |
|
| 22 | 22 | { |
| 23 | - $dumper .= '('.strlen($value).')'; |
|
| 24 | - $value = dump($value,"",-1); |
|
| 23 | + $dumper .= '(' . strlen($value) . ')'; |
|
| 24 | + $value = dump($value, "", -1); |
|
| 25 | 25 | } |
| 26 | - elseif ($type=='boolean') $value= ($value?'true':'false'); |
|
| 27 | - elseif ($type=='object') |
|
| 26 | + elseif ($type == 'boolean') $value = ($value ? 'true' : 'false'); |
|
| 27 | + elseif ($type == 'object') |
|
| 28 | 28 | { |
| 29 | - $props= get_class_vars(get_class($value)); |
|
| 30 | - $dumper .= '('.count($props).') <u>'.get_class($value).'</u>'; |
|
| 31 | - foreach($props as $key=>$val) |
|
| 29 | + $props = get_class_vars(get_class($value)); |
|
| 30 | + $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>'; |
|
| 31 | + foreach ($props as $key=>$val) |
|
| 32 | 32 | { |
| 33 | - $dumper .= "\n".str_repeat("\t",$level+1).$key.' => '; |
|
| 34 | - $dumper .= dump($value->$key,"",$level+1); |
|
| 33 | + $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => '; |
|
| 34 | + $dumper .= dump($value->$key, "", $level + 1); |
|
| 35 | 35 | } |
| 36 | - $value= ''; |
|
| 36 | + $value = ''; |
|
| 37 | 37 | } |
| 38 | - elseif ($type=='array') |
|
| 38 | + elseif ($type == 'array') |
|
| 39 | 39 | { |
| 40 | - $dumper .= '('.count($value).')'; |
|
| 41 | - foreach($value as $key=>$val) |
|
| 40 | + $dumper .= '(' . count($value) . ')'; |
|
| 41 | + foreach ($value as $key=>$val) |
|
| 42 | 42 | { |
| 43 | - $dumper .= "\n".str_repeat("\t",$level+1).dump($key,"",-1).' => '; |
|
| 44 | - $dumper .= dump($val,"",$level+1); |
|
| 43 | + $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, "", -1) . ' => '; |
|
| 44 | + $dumper .= dump($val, "", $level + 1); |
|
| 45 | 45 | } |
| 46 | - $value= ''; |
|
| 46 | + $value = ''; |
|
| 47 | 47 | } |
| 48 | 48 | $dumper .= " <b>$value</b>"; |
| 49 | - if ($level==0) $dumper .= '</pre>'; |
|
| 49 | + if ($level == 0) $dumper .= '</pre>'; |
|
| 50 | 50 | return $dumper; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $output_buffer .= $string; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | -if(substr(getcwd(), -4) != 'docs') |
|
| 70 | +if (substr(getcwd(), -4) != 'docs') |
|
| 71 | 71 | { |
| 72 | 72 | $path_prefix = 'docs/'; |
| 73 | 73 | } |
@@ -80,22 +80,22 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $filename = 'changelog'; |
| 82 | 82 | |
| 83 | -$input = file_get_contents($path_prefix . $filename . '.txt'); |
|
| 83 | +$input = file_get_contents($path_prefix . $filename . '.txt'); |
|
| 84 | 84 | //$input = iconv('CP1251', 'UTF-8', $input); |
| 85 | 85 | |
| 86 | 86 | $input = preg_replace("/\r\n\d\d\d\d\-\d\d\-\d\d\ \d\d\:\d\d/", "[D] $0", $input); |
| 87 | 87 | |
| 88 | -while(strpos($input, "\r\n\r\n") !== false) |
|
| 88 | +while (strpos($input, "\r\n\r\n") !== false) |
|
| 89 | 89 | { |
| 90 | 90 | $input = str_replace("\r\n\r\n", "\r\n", $input); |
| 91 | 91 | } |
| 92 | -while(strpos($input, "~~~") !== false) |
|
| 92 | +while (strpos($input, "~~~") !== false) |
|
| 93 | 93 | { |
| 94 | 94 | $input = str_replace("~~~", "~~", $input); |
| 95 | 95 | } |
| 96 | 96 | $input = str_replace("\r\n~~", "~~", $input); |
| 97 | 97 | |
| 98 | -while(strpos($input, "===") !== false) |
|
| 98 | +while (strpos($input, "===") !== false) |
|
| 99 | 99 | { |
| 100 | 100 | $input = str_replace("===", "==", $input); |
| 101 | 101 | } |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | $prev_chapter_is_header = false; |
| 107 | 107 | $output = array(); |
| 108 | 108 | $buffer = array(); |
| 109 | -foreach($input as &$chapter) |
|
| 109 | +foreach ($input as &$chapter) |
|
| 110 | 110 | { |
| 111 | 111 | $chapter = preg_split("/(\r\n[\[])/", $chapter, -1, PREG_SPLIT_NO_EMPTY); // , PREG_SPLIT_DELIM_CAPTURE |
| 112 | 112 | |
| 113 | - if(count($chapter) == 1 && !$prev_chapter_is_header) |
|
| 113 | + if (count($chapter) == 1 && !$prev_chapter_is_header) |
|
| 114 | 114 | { |
| 115 | - if(!empty($chapter)) |
|
| 115 | + if (!empty($chapter)) |
|
| 116 | 116 | { |
| 117 | 117 | $output[] = $buffer; |
| 118 | 118 | $buffer = array(); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | else |
| 124 | 124 | { |
| 125 | 125 | $prev_chapter_is_header = false; |
| 126 | - foreach($chapter as &$note) |
|
| 126 | + foreach ($chapter as &$note) |
|
| 127 | 127 | { |
| 128 | 128 | $note = explode("\r\n", $note); |
| 129 | 129 | $new_note = true; |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $note_out = array(); |
| 133 | 133 | |
| 134 | - foreach($note as &$line) |
|
| 134 | + foreach ($note as &$line) |
|
| 135 | 135 | { |
| 136 | - if(!$line) |
|
| 136 | + if (!$line) |
|
| 137 | 137 | { |
| 138 | 138 | continue; |
| 139 | 139 | } |
| 140 | - if($new_note) |
|
| 140 | + if ($new_note) |
|
| 141 | 141 | { |
| 142 | 142 | // 78 - 3 = 75 |
| 143 | 143 | $note_out['style'] = $line[0]; |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | $buf_str .= $line; |
| 148 | - if(mb_strlen($line, 'utf-8') < ($new_note ? 75 : 79)) |
|
| 148 | + if (mb_strlen($line, 'utf-8') < ($new_note ? 75 : 79)) |
|
| 149 | 149 | { |
| 150 | - if(!isset($note_out['name'])) |
|
| 150 | + if (!isset($note_out['name'])) |
|
| 151 | 151 | { |
| 152 | 152 | $note_out['name'] = $buf_str; |
| 153 | 153 | } |
@@ -201,31 +201,31 @@ discard block |
||
| 201 | 201 | 'D' => 'date', |
| 202 | 202 | ); |
| 203 | 203 | |
| 204 | -foreach($output as $chapter) |
|
| 204 | +foreach ($output as $chapter) |
|
| 205 | 205 | { |
| 206 | - if(!$chapter) |
|
| 206 | + if (!$chapter) |
|
| 207 | 207 | { |
| 208 | 208 | continue; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | buf_print("<h1>{$chapter['name']}</h1>\r\n"); |
| 212 | - foreach($chapter['content'] as $block) |
|
| 212 | + foreach ($chapter['content'] as $block) |
|
| 213 | 213 | { |
| 214 | 214 | buf_print("<div class=\"{$styles[$block['style']]}\">" . ($block['style'] != 'D' ? "[{$block['style']}] " : '')); |
| 215 | 215 | buf_print(preg_replace("/\s{2,10}/", " ", $block['name']) . '<br />'); |
| 216 | - if(isset($block['lines'])) |
|
| 216 | + if (isset($block['lines'])) |
|
| 217 | 217 | { |
| 218 | 218 | $last_spaces = ''; |
| 219 | 219 | $depth = array(); |
| 220 | - foreach($block['lines'] as $line) |
|
| 220 | + foreach ($block['lines'] as $line) |
|
| 221 | 221 | { |
| 222 | - if(preg_match("/^(\s+)(\d*|\s)\.*\s*(.*)/", $line, $matches)) |
|
| 222 | + if (preg_match("/^(\s+)(\d*|\s)\.*\s*(.*)/", $line, $matches)) |
|
| 223 | 223 | { |
| 224 | 224 | //$line = strlen($matches[1]) . '/' . $matches[2] . '/' . $matches[3]; |
| 225 | 225 | $line = $matches[3]; |
| 226 | - if(strlen($matches[1]) > strlen($last_spaces)) |
|
| 226 | + if (strlen($matches[1]) > strlen($last_spaces)) |
|
| 227 | 227 | { |
| 228 | - if($matches[2]) |
|
| 228 | + if ($matches[2]) |
|
| 229 | 229 | { |
| 230 | 230 | buf_print("<ol>\r\n"); |
| 231 | 231 | } |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | $last_spaces = $matches[1]; |
| 238 | 238 | $depth[] = $matches[2]; |
| 239 | 239 | } |
| 240 | - elseif(strlen($matches[1]) < strlen($last_spaces) && count($depth)) |
|
| 240 | + elseif (strlen($matches[1]) < strlen($last_spaces) && count($depth)) |
|
| 241 | 241 | { |
| 242 | - if(array_pop($depth)) |
|
| 242 | + if (array_pop($depth)) |
|
| 243 | 243 | { |
| 244 | 244 | buf_print("</ol>\r\n"); |
| 245 | 245 | } |
@@ -250,14 +250,14 @@ discard block |
||
| 250 | 250 | $last_spaces = $matches[1]; |
| 251 | 251 | buf_print('<li>'); |
| 252 | 252 | } |
| 253 | - elseif(strlen($last_spaces) == strlen($matches[1])) |
|
| 253 | + elseif (strlen($last_spaces) == strlen($matches[1])) |
|
| 254 | 254 | { |
| 255 | - if($matches[2] == '' && $depth[count($depth) - 1] != '') |
|
| 255 | + if ($matches[2] == '' && $depth[count($depth) - 1] != '') |
|
| 256 | 256 | { |
| 257 | 257 | buf_print("</ol>\r\n"); |
| 258 | 258 | buf_print("<ul>\r\n"); |
| 259 | 259 | } |
| 260 | - elseif($matches[2] != '' && $depth[count($depth) - 1] == '') |
|
| 260 | + elseif ($matches[2] != '' && $depth[count($depth) - 1] == '') |
|
| 261 | 261 | { |
| 262 | 262 | buf_print("</ul>\r\n"); |
| 263 | 263 | buf_print("<ol>\r\n"); |
@@ -269,9 +269,9 @@ discard block |
||
| 269 | 269 | $line = preg_replace("/\s{2,10}/", " ", $line); |
| 270 | 270 | buf_print($line . "<br />\r\n"); |
| 271 | 271 | } |
| 272 | - while(count($depth)) |
|
| 272 | + while (count($depth)) |
|
| 273 | 273 | { |
| 274 | - if(array_pop($depth)) |
|
| 274 | + if (array_pop($depth)) |
|
| 275 | 275 | { |
| 276 | 276 | buf_print("</ol>\r\n"); |
| 277 | 277 | } |
@@ -287,10 +287,10 @@ discard block |
||
| 287 | 287 | buf_print("</body>\r\n</html>\r\n"); |
| 288 | 288 | |
| 289 | 289 | $html = file_get_contents($path_prefix . 'html/' . $filename . '.html'); |
| 290 | -if($html != $output_buffer) |
|
| 290 | +if ($html != $output_buffer) |
|
| 291 | 291 | { |
| 292 | 292 | file_put_contents($path_prefix . 'html/' . $filename . '.html', $output_buffer); |
| 293 | - if(!$path_prefix) |
|
| 293 | + if (!$path_prefix) |
|
| 294 | 294 | { |
| 295 | 295 | print($output_buffer); |
| 296 | 296 | } |
@@ -50,52 +50,52 @@ |
||
| 50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); |
| 51 | 51 | |
| 52 | 52 | $stat_types = array( |
| 53 | - STAT_TOTAL => array( |
|
| 54 | - 'type' => 'total', |
|
| 55 | - ), |
|
| 53 | + STAT_TOTAL => array( |
|
| 54 | + 'type' => 'total', |
|
| 55 | + ), |
|
| 56 | 56 | |
| 57 | - STAT_FLEET => array( |
|
| 58 | - 'type' => 'fleet', |
|
| 59 | - ), |
|
| 57 | + STAT_FLEET => array( |
|
| 58 | + 'type' => 'fleet', |
|
| 59 | + ), |
|
| 60 | 60 | |
| 61 | - STAT_TECH => array( |
|
| 62 | - 'type' => 'tech', |
|
| 63 | - ), |
|
| 61 | + STAT_TECH => array( |
|
| 62 | + 'type' => 'tech', |
|
| 63 | + ), |
|
| 64 | 64 | |
| 65 | - STAT_BUILDING => array( |
|
| 66 | - 'type' => 'build', |
|
| 67 | - ), |
|
| 65 | + STAT_BUILDING => array( |
|
| 66 | + 'type' => 'build', |
|
| 67 | + ), |
|
| 68 | 68 | |
| 69 | - STAT_DEFENSE => array( |
|
| 70 | - 'type' => 'defs', |
|
| 71 | - ), |
|
| 69 | + STAT_DEFENSE => array( |
|
| 70 | + 'type' => 'defs', |
|
| 71 | + ), |
|
| 72 | 72 | |
| 73 | - STAT_RESOURCE => array( |
|
| 74 | - 'type' => 'res', |
|
| 75 | - ), |
|
| 73 | + STAT_RESOURCE => array( |
|
| 74 | + 'type' => 'res', |
|
| 75 | + ), |
|
| 76 | 76 | |
| 77 | - STAT_RAID_TOTAL => array( |
|
| 78 | - 'type' => 'raids', |
|
| 79 | - ), |
|
| 77 | + STAT_RAID_TOTAL => array( |
|
| 78 | + 'type' => 'raids', |
|
| 79 | + ), |
|
| 80 | 80 | |
| 81 | - STAT_RAID_WON => array( |
|
| 82 | - 'type' => 'raidswin', |
|
| 83 | - ), |
|
| 81 | + STAT_RAID_WON => array( |
|
| 82 | + 'type' => 'raidswin', |
|
| 83 | + ), |
|
| 84 | 84 | |
| 85 | - STAT_RAID_LOST => array( |
|
| 86 | - 'type' => 'raidsloose', |
|
| 87 | - ), |
|
| 85 | + STAT_RAID_LOST => array( |
|
| 86 | + 'type' => 'raidsloose', |
|
| 87 | + ), |
|
| 88 | 88 | |
| 89 | 89 | STAT_LVL_BUILDING => array( |
| 90 | - 'type' => 'lvl_minier', |
|
| 90 | + 'type' => 'lvl_minier', |
|
| 91 | 91 | ), |
| 92 | 92 | |
| 93 | 93 | STAT_LVL_TECH => array( |
| 94 | - 'type' => 'player_rpg_tech_level', |
|
| 94 | + 'type' => 'player_rpg_tech_level', |
|
| 95 | 95 | ), |
| 96 | 96 | |
| 97 | 97 | STAT_LVL_RAID => array( |
| 98 | - 'type' => 'lvl_raid', |
|
| 98 | + 'type' => 'lvl_raid', |
|
| 99 | 99 | ), |
| 100 | 100 | ); |
| 101 | 101 | stat_tpl_assign($template, $type, 'type', $stat_types, $sn_group_stat_common); |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | global $who, $lang; |
| 12 | 12 | |
| 13 | 13 | // $sn_group_stat_common = sn_get_groups('STAT_COMMON'); |
| 14 | - foreach($array as $key => $value) { |
|
| 15 | - if($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { |
|
| 14 | + foreach ($array as $key => $value) { |
|
| 15 | + if ($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { |
|
| 16 | 16 | continue; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $subject_list = array( |
| 45 | 45 | 1 => array('header' => $lang['stat_player']), |
| 46 | 46 | ); |
| 47 | -if(!$source) { |
|
| 47 | +if (!$source) { |
|
| 48 | 48 | $subject_list[2] = array('header' => $lang['stat_allys']); |
| 49 | 49 | } |
| 50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $page_count = floor($record_count / 100); |
| 113 | 113 | $pages = array(); |
| 114 | -for($i = 0; $i <= $page_count; $i++) { |
|
| 114 | +for ($i = 0; $i <= $page_count; $i++) { |
|
| 115 | 115 | $first_element = $i * 100 + 1; |
| 116 | 116 | $last_element = $first_element + 99; |
| 117 | 117 | $pages[$first_element] = array( |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | 'POINTS' => pretty_number($row['points']), |
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | - if($who == 1) { |
|
| 133 | + if ($who == 1) { |
|
| 134 | 134 | $row_stat['ALLY_NAME'] = $row['ally_name']; |
| 135 | 135 | $row_stat['ALLY_ID'] = $row['ally_id']; |
| 136 | 136 | empty($row['username']) ? $row['username'] = $row['name'] : false; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 13 | 13 | |
| 14 | -if(HIDE_BUILDING_RECORDS) |
|
| 14 | +if (HIDE_BUILDING_RECORDS) |
|
| 15 | 15 | { |
| 16 | 16 | return; |
| 17 | 17 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $user_name_cache = array(); |
| 36 | 36 | |
| 37 | -foreach($show_groups as $unit_group_id => $mode) |
|
| 37 | +foreach ($show_groups as $unit_group_id => $mode) |
|
| 38 | 38 | { |
| 39 | 39 | $template->assign_block_vars('records', array( |
| 40 | 40 | 'UNIT' => $lang['tech'][$unit_group_id], |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | )); |
| 44 | 44 | $unit_group = get_unit_param('techtree', $unit_group_id); // TODO - REWRITE!!!! |
| 45 | 45 | |
| 46 | - foreach($unit_group as $unit_id) |
|
| 46 | + foreach ($unit_group as $unit_id) |
|
| 47 | 47 | { |
| 48 | 48 | $unit_name = &$lang['tech'][$unit_id]; |
| 49 | - if($unit_name) |
|
| 49 | + if ($unit_name) |
|
| 50 | 50 | { |
| 51 | 51 | // TODO - ISUNITSTACKABLE! |
| 52 | 52 | $data_row = $unit_group_id == UNIT_SHIPS || $unit_group_id == UNIT_DEFENCE ? db_unit_records_sum($unit_id, $user_skip_list_unit) : db_unit_records_plain($unit_id, $user_skip_list_unit); |
| 53 | 53 | |
| 54 | - if($data_row) |
|
| 54 | + if ($data_row) |
|
| 55 | 55 | { |
| 56 | 56 | $template->assign_block_vars('records', array( |
| 57 | 57 | 'UNIT' => $unit_name, |