@@ -36,7 +36,7 @@ |
||
36 | 36 | * @param $note_id_edit |
37 | 37 | */ |
38 | 38 | public static function db_note_update_by_id($note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky, $note_id_edit) { |
39 | - classSupernova::$db->doUpdate("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
39 | + classSupernova::$db->doUpdate("UPDATE {{notes}} SET `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
40 | 40 | `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky} |
41 | 41 | WHERE `id` = {$note_id_edit} LIMIT 1;"); |
42 | 42 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function debris_add_resource($resource_id, $resource_amount) { |
29 | 29 | // В обломках может быть только металл или кристалл |
30 | - if($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) { |
|
30 | + if ($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 | $this->debris[$resource_id] += $resource_amount; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param bool $is_simulator |
39 | 39 | */ |
40 | 40 | public function add_wrecks(array $wreckage, $is_simulator) { |
41 | - foreach($wreckage as $resource_id => $resource_amount) { |
|
41 | + foreach ($wreckage as $resource_id => $resource_amount) { |
|
42 | 42 | $this->debris_add_resource($resource_id, floor($resource_amount * |
43 | 43 | ($is_simulator |
44 | 44 | ? UBE_SHIP_WRECKS_TO_DEBRIS_AVG |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param bool $is_simulator |
55 | 55 | */ |
56 | 56 | public function add_cargo_drop(array $dropped_resources, $is_simulator) { |
57 | - foreach($dropped_resources as $resource_id => $resource_amount) { |
|
57 | + foreach ($dropped_resources as $resource_id => $resource_amount) { |
|
58 | 58 | $this->debris_add_resource($resource_id, floor($resource_amount * |
59 | 59 | ($is_simulator |
60 | 60 | ? UBE_CARGO_DROPPED_TO_DEBRIS_AVG |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param $moon_debris_left_part |
94 | 94 | */ |
95 | 95 | public function debris_adjust_proportional($moon_debris_left_part) { |
96 | - foreach($this->debris as $resource_id => &$resource_amount) { |
|
96 | + foreach ($this->debris as $resource_id => &$resource_amount) { |
|
97 | 97 | $resource_amount = floor($resource_amount * $moon_debris_left_part); |
98 | 98 | } |
99 | 99 | } |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function report_generate_array() { |
116 | 116 | return array( |
117 | - 'ube_report_debris_metal' => (float)$this->debris_get_resource(RES_METAL), |
|
118 | - 'ube_report_debris_crystal' => (float)$this->debris_get_resource(RES_CRYSTAL), |
|
119 | - 'ube_report_debris_total_in_metal' => (float)$this->debris_in_metal(), |
|
117 | + 'ube_report_debris_metal' => (float) $this->debris_get_resource(RES_METAL), |
|
118 | + 'ube_report_debris_crystal' => (float) $this->debris_get_resource(RES_CRYSTAL), |
|
119 | + 'ube_report_debris_total_in_metal' => (float) $this->debris_in_metal(), |
|
120 | 120 | ); |
121 | 121 | } |
122 | 122 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $debris_for_moon = $debris->debris_total(); |
72 | 72 | |
73 | - if(!$debris_for_moon) { |
|
73 | + if (!$debris_for_moon) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $moon_chance = min($debris_for_moon / UBE_MOON_DEBRIS_PER_PERCENT, UBE_MOON_PERCENT_MAX); // TODO Configure |
79 | 79 | $moon_chance = $moon_chance >= UBE_MOON_PERCENT_MIN ? $moon_chance : 0; |
80 | 80 | $this->create_chance = $moon_chance; |
81 | - if($moon_chance) { |
|
82 | - if($is_simulator || mt_rand(1, 100) <= $moon_chance) { |
|
81 | + if ($moon_chance) { |
|
82 | + if ($is_simulator || mt_rand(1, 100) <= $moon_chance) { |
|
83 | 83 | $this->status = UBE_MOON_CREATE_SUCCESS; |
84 | 84 | $this->moon_diameter = round($is_simulator ? $moon_chance * 150 + 1999 : mt_rand($moon_chance * 100 + 1000, $moon_chance * 200 + 2999)); |
85 | 85 | |
86 | - if($debris_for_moon <= UBE_MOON_DEBRIS_MAX_SPENT) { |
|
86 | + if ($debris_for_moon <= UBE_MOON_DEBRIS_MAX_SPENT) { |
|
87 | 87 | $debris->_reset(); |
88 | 88 | } else { |
89 | 89 | $moon_debris_left_percent = ($debris_for_moon - UBE_MOON_DEBRIS_MAX_SPENT) / $debris_for_moon; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function moon_destroy_try($reapers) { |
104 | 104 | // TODO: $is_simulator |
105 | - if($reapers <= 0) { |
|
105 | + if ($reapers <= 0) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * @version 2016-02-25 23:42:45 41a4.68 |
121 | 121 | */ |
122 | 122 | public function calculate_moon(UBE $ube) { |
123 | - if(UBE_MOON_EXISTS == $this->status) { |
|
124 | - if($ube->mission_type_id == MT_DESTROY && $ube->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
123 | + if (UBE_MOON_EXISTS == $this->status) { |
|
124 | + if ($ube->mission_type_id == MT_DESTROY && $ube->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
125 | 125 | $reapers = $ube->fleet_list->ube_calculate_attack_reapers(); |
126 | 126 | $this->moon_destroy_try($reapers); |
127 | 127 | } |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function report_generate_array() { |
137 | 137 | return array( |
138 | - 'ube_report_moon' => (int)$this->status, |
|
139 | - 'ube_report_moon_chance' => (int)$this->create_chance, |
|
140 | - 'ube_report_moon_size' => (float)$this->moon_diameter, |
|
141 | - 'ube_report_moon_reapers' => (int)$this->reapers_status, |
|
142 | - 'ube_report_moon_destroy_chance' => (int)$this->destroy_chance, |
|
143 | - 'ube_report_moon_reapers_die_chance' => (int)$this->reaper_die_chance, |
|
138 | + 'ube_report_moon' => (int) $this->status, |
|
139 | + 'ube_report_moon_chance' => (int) $this->create_chance, |
|
140 | + 'ube_report_moon_size' => (float) $this->moon_diameter, |
|
141 | + 'ube_report_moon_reapers' => (int) $this->reapers_status, |
|
142 | + 'ube_report_moon_destroy_chance' => (int) $this->destroy_chance, |
|
143 | + 'ube_report_moon_reapers_die_chance' => (int) $this->reaper_die_chance, |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | * @param $planet_id |
172 | 172 | */ |
173 | 173 | public function db_apply_result($planet_info, $destination_user_id) { |
174 | - if($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
174 | + if ($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
175 | 175 | $moon_row = uni_create_moon($planet_info[PLANET_GALAXY], $planet_info[PLANET_SYSTEM], $planet_info[PLANET_PLANET], $destination_user_id, $this->moon_diameter, '', false); |
176 | 176 | $this->moon_name = $moon_row['name']; |
177 | 177 | unset($moon_row); |
178 | - } elseif($this->status == UBE_MOON_DESTROY_SUCCESS) { |
|
178 | + } elseif ($this->status == UBE_MOON_DESTROY_SUCCESS) { |
|
179 | 179 | DBStaticPlanet::db_planet_delete_by_id($planet_info[PLANET_ID]); |
180 | 180 | } |
181 | 181 | } |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | $classLocale = classLocale::$lang; |
185 | 185 | |
186 | 186 | $text_defender = ''; |
187 | - if($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
187 | + if ($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
188 | 188 | $text_defender .= "{$classLocale['ube_report_moon_created']} {$this->moon_diameter} {$classLocale['sys_kilometers_short']}<br /><br />"; |
189 | - } elseif($this->status == UBE_MOON_CREATE_FAILED) { |
|
189 | + } elseif ($this->status == UBE_MOON_CREATE_FAILED) { |
|
190 | 190 | $text_defender .= "{$classLocale['ube_report_moon_chance']} {$this->create_chance}%<br /><br />"; |
191 | 191 | } |
192 | 192 | |
193 | - if($ube->mission_type_id == MT_DESTROY) { |
|
194 | - if($this->reapers_status == UBE_MOON_REAPERS_NONE) { |
|
193 | + if ($ube->mission_type_id == MT_DESTROY) { |
|
194 | + if ($this->reapers_status == UBE_MOON_REAPERS_NONE) { |
|
195 | 195 | $text_defender .= classLocale::$lang['ube_report_moon_reapers_none']; |
196 | 196 | } else { |
197 | 197 | $text_defender .= "{$classLocale['ube_report_moon_reapers_wave']}. {$classLocale['ube_report_moon_reapers_chance']} {$this->destroy_chance}%. "; |
198 | - $text_defender .= classLocale::$lang[$this->status == UBE_MOON_DESTROY_SUCCESS ? 'ube_report_moon_reapers_success' : 'ube_report_moon_reapers_failure'] . "<br />"; |
|
198 | + $text_defender .= classLocale::$lang[$this->status == UBE_MOON_DESTROY_SUCCESS ? 'ube_report_moon_reapers_success' : 'ube_report_moon_reapers_failure']."<br />"; |
|
199 | 199 | |
200 | 200 | $text_defender .= "{$classLocale['ube_report_moon_reapers_outcome']} {$this->reaper_die_chance}%. "; |
201 | 201 | $text_defender .= classLocale::$lang[$this->reapers_status == UBE_MOON_REAPERS_RETURNED ? 'ube_report_moon_reapers_survive' : 'ube_report_moon_reapers_died']; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @version 2016-02-25 23:42:45 41a4.68 |
221 | 221 | */ |
222 | 222 | public function ubeInitLoadStatis($destination_planet) { |
223 | - if($destination_planet['planet_type'] == PT_MOON || is_array($moon = DBStaticPlanet::db_planet_by_parent($destination_planet['id'], true, '`id`'))) { |
|
223 | + if ($destination_planet['planet_type'] == PT_MOON || is_array($moon = DBStaticPlanet::db_planet_by_parent($destination_planet['id'], true, '`id`'))) { |
|
224 | 224 | $this->status = UBE_MOON_EXISTS; |
225 | 225 | $this->moon_diameter = !empty($moon['planet_type']) && $moon['planet_type'] == PT_MOON ? $moon['diameter'] : $destination_planet['diameter']; |
226 | 226 | $this->reapers_status = UBE_MOON_REAPERS_NONE; |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function sn_ube_report_save($ube) { |
15 | 15 | // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем |
16 | - if($ube->get_cypher()) { |
|
16 | + if ($ube->get_cypher()) { |
|
17 | 17 | return false; |
18 | 18 | } |
19 | 19 | |
20 | 20 | // Генерируем уникальный секретный ключ и проверяем наличие в базе |
21 | 21 | do { |
22 | 22 | $ube->report_cypher = sys_random_string(32); |
23 | - } while(classSupernova::$db->doSelectFetch("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE")); |
|
23 | + } while (classSupernova::$db->doSelectFetch("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE")); |
|
24 | 24 | |
25 | 25 | // Инициализация таблицы для пакетной вставки информации |
26 | 26 | $sql_perform = array( |
@@ -106,21 +106,21 @@ discard block |
||
106 | 106 | |
107 | 107 | // Сохраняем общую информацию о бое |
108 | 108 | classSupernova::$db->doInsertSet(TABLE_UBE_REPORT, array( |
109 | - 'ube_report_cypher' => (string)$ube->report_cypher, |
|
110 | - 'ube_report_time_combat' => (string)date(FMT_DATE_TIME_SQL, $ube->combat_timestamp), |
|
111 | - 'ube_report_time_spent' => (float)$ube->time_spent, |
|
112 | - 'ube_report_combat_admin' => (int)$ube->is_admin_in_combat, |
|
113 | - 'ube_report_mission_type' => (int)$ube->mission_type_id, |
|
114 | - 'ube_report_combat_result' => (int)$ube->combat_result, |
|
115 | - 'ube_report_combat_sfr' => (int)$ube->is_small_fleet_recce, |
|
116 | - 'ube_report_planet_id' => (int)$ube->ube_planet_info[PLANET_ID], |
|
117 | - 'ube_report_planet_name' => (string)$ube->ube_planet_info[PLANET_NAME], |
|
118 | - 'ube_report_planet_size' => (int)$ube->ube_planet_info[PLANET_SIZE], |
|
119 | - 'ube_report_planet_galaxy' => (int)$ube->ube_planet_info[PLANET_GALAXY], |
|
120 | - 'ube_report_planet_system' => (int)$ube->ube_planet_info[PLANET_SYSTEM], |
|
121 | - 'ube_report_planet_planet' => (int)$ube->ube_planet_info[PLANET_PLANET], |
|
122 | - 'ube_report_planet_planet_type' => (int)$ube->ube_planet_info[PLANET_TYPE], |
|
123 | - 'ube_report_capture_result' => (int)$ube->capture_result, |
|
109 | + 'ube_report_cypher' => (string) $ube->report_cypher, |
|
110 | + 'ube_report_time_combat' => (string) date(FMT_DATE_TIME_SQL, $ube->combat_timestamp), |
|
111 | + 'ube_report_time_spent' => (float) $ube->time_spent, |
|
112 | + 'ube_report_combat_admin' => (int) $ube->is_admin_in_combat, |
|
113 | + 'ube_report_mission_type' => (int) $ube->mission_type_id, |
|
114 | + 'ube_report_combat_result' => (int) $ube->combat_result, |
|
115 | + 'ube_report_combat_sfr' => (int) $ube->is_small_fleet_recce, |
|
116 | + 'ube_report_planet_id' => (int) $ube->ube_planet_info[PLANET_ID], |
|
117 | + 'ube_report_planet_name' => (string) $ube->ube_planet_info[PLANET_NAME], |
|
118 | + 'ube_report_planet_size' => (int) $ube->ube_planet_info[PLANET_SIZE], |
|
119 | + 'ube_report_planet_galaxy' => (int) $ube->ube_planet_info[PLANET_GALAXY], |
|
120 | + 'ube_report_planet_system' => (int) $ube->ube_planet_info[PLANET_SYSTEM], |
|
121 | + 'ube_report_planet_planet' => (int) $ube->ube_planet_info[PLANET_PLANET], |
|
122 | + 'ube_report_planet_planet_type' => (int) $ube->ube_planet_info[PLANET_TYPE], |
|
123 | + 'ube_report_capture_result' => (int) $ube->capture_result, |
|
124 | 124 | ) |
125 | 125 | + $ube->debris->report_generate_array() |
126 | 126 | + $ube->moon_calculator->report_generate_array() |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | |
130 | 130 | // Сохраняем общую информацию по игрокам |
131 | 131 | $player_sides = $ube->players->get_player_sides(); |
132 | - foreach($player_sides as $player_id => $player_side) { |
|
132 | + foreach ($player_sides as $player_id => $player_side) { |
|
133 | 133 | $sql_perform['ube_report_player'][] = array( |
134 | 134 | $ube_report_id, |
135 | 135 | $player_id, |
136 | 136 | |
137 | - "'" . db_escape($ube->players[$player_id]->name) . "'", |
|
137 | + "'".db_escape($ube->players[$player_id]->name)."'", |
|
138 | 138 | $ube->players[$player_id]->getSide() == UBE_PLAYER_IS_ATTACKER ? 1 : 0, |
139 | 139 | |
140 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK), |
|
141 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD), |
|
142 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR), |
|
140 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK), |
|
141 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD), |
|
142 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR), |
|
143 | 143 | ); |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Всякая информация по флотам |
147 | - foreach($ube->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
147 | + foreach ($ube->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
148 | 148 | // Сохраняем общую информацию по флотам |
149 | 149 | $sql_perform['ube_report_fleet'][] = $UBEFleet->sql_generate_array($ube_report_id); |
150 | 150 | |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | $ube->rounds->sql_generate_unit_array($sql_perform['ube_report_unit'], $ube_report_id, $ube->fleet_list); |
160 | 160 | |
161 | 161 | // Пакетная вставка данных |
162 | - foreach($sql_perform as $table_name => $table_data) { |
|
163 | - if(count($table_data) < 2) { |
|
162 | + foreach ($sql_perform as $table_name => $table_data) { |
|
163 | + if (count($table_data) < 2) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | - foreach($table_data as &$record_data) { |
|
167 | - $record_data = '(' . implode(',', $record_data) . ')'; |
|
166 | + foreach ($table_data as &$record_data) { |
|
167 | + $record_data = '('.implode(',', $record_data).')'; |
|
168 | 168 | } |
169 | 169 | $fields = $table_data[0]; |
170 | 170 | unset($table_data[0]); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $report_cypher = db_escape($report_cypher); |
187 | 187 | |
188 | 188 | $report_row = classSupernova::$db->doSelectFetch("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1"); |
189 | - if(!$report_row) { |
|
189 | + if (!$report_row) { |
|
190 | 190 | return UBE_REPORT_NOT_FOUND; |
191 | 191 | } |
192 | 192 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @param $template_result |
203 | 203 | */ |
204 | 204 | public function sn_ube_report_generate(UBE $ube, &$template_result) { |
205 | - if(!is_object($ube)) { |
|
205 | + if (!is_object($ube)) { |
|
206 | 206 | return; |
207 | 207 | } |
208 | 208 | |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | |
218 | 218 | // Координаты, тип и название планеты - если есть |
219 | 219 | //R $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER]; |
220 | - if(isset($ube->ube_planet_info)) { |
|
220 | + if (isset($ube->ube_planet_info)) { |
|
221 | 221 | $template_result += $ube->ube_planet_info; |
222 | 222 | $template_result[PLANET_NAME] = str_replace(' ', ' ', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8')); |
223 | 223 | } |
224 | 224 | |
225 | 225 | // Обломки |
226 | 226 | $debris = array(); |
227 | - foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) { |
|
228 | - if($resource_amount = $ube->debris->debris_get_resource($resource_id)) { |
|
227 | + foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id) { |
|
228 | + if ($resource_amount = $ube->debris->debris_get_resource($resource_id)) { |
|
229 | 229 | $debris[] = array( |
230 | 230 | 'NAME' => classLocale::$lang['tech'][$resource_id], |
231 | 231 | 'AMOUNT' => pretty_number($resource_amount), |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public static function db_acs_insert($fleetid, $userId, $objFleet) { |
53 | 53 | classSupernova::$db->doInsertSet(TABLE_AKS, array( |
54 | - 'name' => classLocale::$lang['flt_acs_prefix'] . $fleetid, |
|
54 | + 'name' => classLocale::$lang['flt_acs_prefix'].$fleetid, |
|
55 | 55 | 'teilnehmer' => $userId, |
56 | 56 | 'flotten' => $fleetid, |
57 | 57 | 'ankunft' => $objFleet->time_arrive_to_target, |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public static function db_ally_insert($ally_name_unsafe, $ally_tag_unsafe, $userId) { |
65 | 65 | $ally = classSupernova::$db->doInsertSet(TABLE_ALLIANCE, array( |
66 | - 'ally_name' => (string)$ally_name_unsafe, |
|
67 | - 'ally_tag' => (string)$ally_tag_unsafe, |
|
66 | + 'ally_name' => (string) $ally_name_unsafe, |
|
67 | + 'ally_tag' => (string) $ally_tag_unsafe, |
|
68 | 68 | 'ally_owner' => $userId, |
69 | - 'ally_owner_range' => (string)classLocale::$lang['ali_leaderRank'], |
|
70 | - 'ally_members' => (int)1, |
|
71 | - 'ranklist' => (string)(classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0"), |
|
69 | + 'ally_owner_range' => (string) classLocale::$lang['ali_leaderRank'], |
|
70 | + 'ally_members' => (int) 1, |
|
71 | + 'ranklist' => (string) (classLocale::$lang['ali_defaultRankName'].",0,0,0,0,0"), |
|
72 | 72 | 'ally_register_time' => SN_TIME_NOW, |
73 | 73 | )); |
74 | 74 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param $ally |
145 | 145 | */ |
146 | 146 | public static function db_ally_update_by_changeset($ally_changeset, $ally) { |
147 | - classSupernova::$db->doUpdate("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
|
147 | + classSupernova::$db->doUpdate("UPDATE {{alliance}} SET ".implode(',', $ally_changeset)." WHERE `id`='{$ally['id']}' LIMIT 1;"); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @param $d |
260 | 260 | */ |
261 | 261 | public static function db_ally_request_deny($d) { |
262 | - classSupernova::$db->doUpdate("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '" . classLocale::$lang['ali_req_deny_reason'] . "' WHERE `id_user`= {$d} LIMIT 1;"); |
|
262 | + classSupernova::$db->doUpdate("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '".classLocale::$lang['ali_req_deny_reason']."' WHERE `id_user`= {$d} LIMIT 1;"); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $owners = array(); |
115 | 115 | } else { |
116 | 116 | $insert_values = array(); |
117 | - $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
|
117 | + $insert_template = "('%u',".str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
|
118 | 118 | |
119 | 119 | foreach ($owners as $owner) { |
120 | 120 | if ($user['id'] != $owner) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $sendList = array(); |
156 | 156 | $list = ''; |
157 | 157 | $query = DBStaticUser::db_user_list( |
158 | - "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
158 | + "ally_id = '{$ally_id}'".($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
159 | 159 | false, 'id, username'); |
160 | 160 | foreach ($query as $u) { |
161 | 161 | $sendList[] = $u['id']; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $subject_unsafe = substr($subject_unsafe, strlen(classLocale::$lang['msg_answer_prefix'])); |
254 | 254 | $re++; |
255 | 255 | } |
256 | - $re ? $subject_unsafe = classLocale::$lang['msg_answer_prefix'] . $subject_unsafe : false; |
|
256 | + $re ? $subject_unsafe = classLocale::$lang['msg_answer_prefix'].$subject_unsafe : false; |
|
257 | 257 | |
258 | 258 | $subject_unsafe = $subject_unsafe ? $subject_unsafe : classLocale::$lang['msg_subject_default']; |
259 | 259 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | return classSupernova::$db->doSelect( |
422 | 422 | "SELECT * FROM {{messages}} |
423 | 423 | WHERE |
424 | - `message_type` = '" . MSG_TYPE_PLAYER . "' AND |
|
424 | + `message_type` = '" . MSG_TYPE_PLAYER."' AND |
|
425 | 425 | ((`message_owner` = '{$user['id']}' AND `message_sender` = '{$recipient_id}') |
426 | 426 | OR |
427 | 427 | (`message_sender` = '{$user['id']}' AND `message_owner` = '{$recipient_id}')) ORDER BY `message_time` DESC LIMIT 20;"); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | FROM |
466 | 466 | {{messages}} AS m |
467 | 467 | LEFT JOIN {{users}} AS u ON u.id = m.message_owner " . |
468 | - ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '') . |
|
468 | + ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : ''). |
|
469 | 469 | "ORDER BY |
470 | 470 | `message_id` DESC |
471 | 471 | LIMIT |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | } |
474 | 474 | |
475 | 475 | public static function db_message_insert_all($message_type, $from, $subject, $text) { |
476 | - return classSupernova::$db->doInsertComplex('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
|
476 | + return classSupernova::$db->doInsertComplex('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '. |
|
477 | 477 | "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}"); |
478 | 478 | } |
479 | 479 | |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * @return array|bool|mysqli_result|null |
484 | 484 | */ |
485 | 485 | public static function db_message_count_by_type($int_type_selected) { |
486 | - $page_max = classSupernova::$db->doSelectFetch('SELECT COUNT(*) AS `max` FROM `{{messages}}`' . ($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : '')); |
|
486 | + $page_max = classSupernova::$db->doSelectFetch('SELECT COUNT(*) AS `max` FROM `{{messages}}`'.($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : '')); |
|
487 | 487 | |
488 | 488 | return $page_max; |
489 | 489 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | public static function db_message_list_delete_by_date($delete_date, $int_type_selected) { |
509 | 509 | $where[] = "message_time <= UNIX_TIMESTAMP('{$delete_date}')"; |
510 | - if($int_type_selected >= 0) { |
|
510 | + if ($int_type_selected >= 0) { |
|
511 | 511 | $where['message_type'] = $int_type_selected; |
512 | 512 | } |
513 | 513 | classSupernova::$db->doDeleteDeprecated(TABLE_MESSAGES, $where); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | JOIN {{users}} AS u ON u.id = cp.chat_player_player_id |
13 | 13 | WHERE |
14 | 14 | `chat_player_refresh_last` >= '{$sql_date}' |
15 | - AND (`banaday` IS NULL OR `banaday` <= " . SN_TIME_NOW . ") |
|
15 | + AND (`banaday` IS NULL OR `banaday` <= ".SN_TIME_NOW.") |
|
16 | 16 | {$ally_add} |
17 | 17 | ORDER BY authlevel DESC, `username`"); |
18 | 18 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param $user |
141 | 141 | */ |
142 | 142 | public static function db_chat_player_update($user) { |
143 | - classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_refresh_last` = " . SN_TIME_NOW . " WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;"); |
|
143 | + classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_refresh_last` = ".SN_TIME_NOW." WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;"); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @param $user |
212 | 212 | */ |
213 | 213 | public static function db_chat_player_update_activity($user) { |
214 | - classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_activity` = '" . classSupernova::$db->db_escape(SN_TIME_SQL) . "' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1"); |
|
214 | + classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_activity` = '".classSupernova::$db->db_escape(SN_TIME_SQL)."' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1"); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | } |
218 | 218 | \ No newline at end of file |
@@ -4,11 +4,11 @@ discard block |
||
4 | 4 | |
5 | 5 | function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) { |
6 | 6 | return classSupernova::$db->doSelect( |
7 | - "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') . |
|
7 | + "SELECT p.*, u.username".($table_parent_columns ? ', p1.name AS parent_name' : ''). |
|
8 | 8 | " FROM {{planets}} AS p |
9 | 9 | LEFT JOIN {{users}} AS u ON u.id = p.id_owner" . |
10 | - ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : '') . |
|
11 | - " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}")); |
|
10 | + ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : ''). |
|
11 | + " WHERE ".($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}")); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | function db_planet_list_search($searchtext) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ORDER BY |
107 | 107 | sp.`{$Rank}_rank`, subject.{$source['id']} |
108 | 108 | LIMIT |
109 | - " . $start . ",100;"; |
|
109 | + ".$start.",100;"; |
|
110 | 110 | } else { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday` |
111 | 111 | $query_str = |
112 | 112 | "SELECT |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ORDER BY |
120 | 120 | subject.{$Rank} DESC, subject.{$source['id']} |
121 | 121 | LIMIT |
122 | - " . $start . ",100;"; |
|
122 | + ".$start.",100;"; |
|
123 | 123 | } |
124 | 124 | } else { |
125 | 125 | // TODO |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ORDER BY |
137 | 137 | sp.`{$Rank}_rank`, subject.id |
138 | 138 | LIMIT |
139 | - " . $start . ",100;"; |
|
139 | + ".$start.",100;"; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return classSupernova::$db->doSelect($query_str); |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function db_payment_list_get($flt_payer, $flt_status, $flt_test, $flt_module) { |
366 | 366 | $extra_conditions = |
367 | - ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : '') . |
|
368 | - ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : '') . |
|
369 | - ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : '') . |
|
367 | + ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : ''). |
|
368 | + ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : ''). |
|
369 | + ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : ''). |
|
370 | 370 | ($flt_module ? "AND payment_module_name = '{$flt_module}' " : ''); |
371 | 371 | $query = classSupernova::$db->doSelect("SELECT * FROM `{{payment}}` WHERE 1 {$extra_conditions} ORDER BY payment_id DESC;"); |
372 | 372 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | // Log Online ************************************************************************************************************* |
396 | 396 | function db_log_online_insert() { |
397 | 397 | classSupernova::$db->doInsertSet(LOG_USERS_ONLINE, array( |
398 | - 'online_count' => (int)classSupernova::$config->var_online_user_count, |
|
398 | + 'online_count' => (int) classSupernova::$config->var_online_user_count, |
|
399 | 399 | ), DB_INSERT_IGNORE); |
400 | 400 | } |
401 | 401 | |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | function db_log_dark_matter_insert($user_id, $change_type, $dark_matter, $comment_unsafe, $rowUserNameUnsafe, $page_url_unsafe) { |
486 | 486 | return classSupernova::$db->doInsertSet(TABLE_LOG_DARK_MATTER, array( |
487 | 487 | 'log_dark_matter_username' => $rowUserNameUnsafe, |
488 | - 'log_dark_matter_reason' => (int)$change_type, |
|
489 | - 'log_dark_matter_amount' => (float)$dark_matter, |
|
490 | - 'log_dark_matter_comment' => (string)$comment_unsafe, |
|
491 | - 'log_dark_matter_page' => (string)$page_url_unsafe, |
|
488 | + 'log_dark_matter_reason' => (int) $change_type, |
|
489 | + 'log_dark_matter_amount' => (float) $dark_matter, |
|
490 | + 'log_dark_matter_comment' => (string) $comment_unsafe, |
|
491 | + 'log_dark_matter_page' => (string) $page_url_unsafe, |
|
492 | 492 | 'log_dark_matter_sender' => $user_id, |
493 | 493 | )); |
494 | 494 | } |
@@ -644,9 +644,9 @@ discard block |
||
644 | 644 | function db_ube_report_get_best_battles() { |
645 | 645 | $query = classSupernova::$db->doSelect("SELECT * |
646 | 646 | FROM `{{ube_report}}` |
647 | - WHERE `ube_report_time_process` < DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS . " DAY)) |
|
647 | + WHERE `ube_report_time_process` < DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS." DAY)) |
|
648 | 648 | ORDER BY `ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC |
649 | - LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW . ";"); |
|
649 | + LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW.";"); |
|
650 | 650 | |
651 | 651 | return $query; |
652 | 652 | } |