Completed
Push — work-fleets ( 7aaf68...e155c0 )
by SuperNova.WS
06:30
created
includes/classes/UBE/UBEReport.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
    */
14 14
   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(doquery("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE", true));
23
+    } while (doquery("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE", true));
24 24
 
25 25
     // Инициализация таблицы для пакетной вставки информации
26 26
     $sql_perform = array(
@@ -108,24 +108,24 @@  discard block
 block discarded – undo
108 108
     $sql_str = "INSERT INTO `{{ube_report}}`
109 109
     SET
110 110
       `ube_report_cypher` = '{$ube->report_cypher}',
111
-      `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $ube->combat_timestamp) . "',
111
+      `ube_report_time_combat` = '".date(FMT_DATE_TIME_SQL, $ube->combat_timestamp)."',
112 112
       `ube_report_time_spent` = {$ube->time_spent},
113 113
 
114
-      `ube_report_combat_admin` = " . (int)$ube->is_admin_in_combat . ",
114
+      `ube_report_combat_admin` = ".(int) $ube->is_admin_in_combat.",
115 115
       `ube_report_mission_type` = {$ube->mission_type_id},
116 116
 
117 117
       `ube_report_combat_result` = {$ube->combat_result},
118
-      `ube_report_combat_sfr` = " . (int)$ube->is_small_fleet_recce . ",
118
+      `ube_report_combat_sfr` = ".(int) $ube->is_small_fleet_recce.",
119 119
 
120
-      `ube_report_planet_id`          = " . (int)$ube->ube_planet_info[PLANET_ID] . ",
121
-      `ube_report_planet_name`        = '" . db_escape($ube->ube_planet_info[PLANET_NAME]) . "',
122
-      `ube_report_planet_size`        = " . (int)$ube->ube_planet_info[PLANET_SIZE] . ",
123
-      `ube_report_planet_galaxy`      = " . (int)$ube->ube_planet_info[PLANET_GALAXY] . ",
124
-      `ube_report_planet_system`      = " . (int)$ube->ube_planet_info[PLANET_SYSTEM] . ",
125
-      `ube_report_planet_planet`      = " . (int)$ube->ube_planet_info[PLANET_PLANET] . ",
126
-      `ube_report_planet_planet_type` = " . (int)$ube->ube_planet_info[PLANET_TYPE] . ",
120
+      `ube_report_planet_id`          = " . (int) $ube->ube_planet_info[PLANET_ID].",
121
+      `ube_report_planet_name`        = '" . db_escape($ube->ube_planet_info[PLANET_NAME])."',
122
+      `ube_report_planet_size`        = " . (int) $ube->ube_planet_info[PLANET_SIZE].",
123
+      `ube_report_planet_galaxy`      = " . (int) $ube->ube_planet_info[PLANET_GALAXY].",
124
+      `ube_report_planet_system`      = " . (int) $ube->ube_planet_info[PLANET_SYSTEM].",
125
+      `ube_report_planet_planet`      = " . (int) $ube->ube_planet_info[PLANET_PLANET].",
126
+      `ube_report_planet_planet_type` = " . (int) $ube->ube_planet_info[PLANET_TYPE].",
127 127
 
128
-      `ube_report_capture_result` = " . (int)$ube->capture_result . ", "
128
+      `ube_report_capture_result` = " . (int) $ube->capture_result.", "
129 129
       . $ube->debris->report_generate_sql()
130 130
       . $ube->moon_calculator->report_generate_sql();
131 131
 
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 
135 135
     // Сохраняем общую информацию по игрокам
136 136
     $player_sides = $ube->players->get_player_sides();
137
-    foreach($player_sides as $player_id => $player_side) {
137
+    foreach ($player_sides as $player_id => $player_side) {
138 138
       $sql_perform['ube_report_player'][] = array(
139 139
         $ube_report_id,
140 140
         $player_id,
141 141
 
142
-        "'" . db_escape($ube->players[$player_id]->name) . "'",
142
+        "'".db_escape($ube->players[$player_id]->name)."'",
143 143
         $ube->players[$player_id]->getSide() == UBE_PLAYER_IS_ATTACKER ? 1 : 0,
144 144
 
145
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK),
146
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD),
147
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR),
145
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK),
146
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD),
147
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR),
148 148
       );
149 149
     }
150 150
 
151 151
     // Всякая информация по флотам
152
-    foreach($ube->fleet_list->_container as $fleet_id => $UBEFleet) {
152
+    foreach ($ube->fleet_list->_container as $fleet_id => $UBEFleet) {
153 153
       // Сохраняем общую информацию по флотам
154 154
       $sql_perform['ube_report_fleet'][] = $UBEFleet->sql_generate_array($ube_report_id);
155 155
 
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
     $ube->rounds->sql_generate_unit_array($sql_perform['ube_report_unit'], $ube_report_id, $ube->fleet_list);
166 166
 
167 167
     // Пакетная вставка данных
168
-    foreach($sql_perform as $table_name => $table_data) {
169
-      if(count($table_data) < 2) {
168
+    foreach ($sql_perform as $table_name => $table_data) {
169
+      if (count($table_data) < 2) {
170 170
         continue;
171 171
       }
172
-      foreach($table_data as &$record_data) {
173
-        $record_data = '(' . implode(',', $record_data) . ')';
172
+      foreach ($table_data as &$record_data) {
173
+        $record_data = '('.implode(',', $record_data).')';
174 174
       }
175 175
       $fields = $table_data[0];
176 176
       unset($table_data[0]);
177
-      doquery("INSERT INTO {{{$table_name}}} {$fields} VALUES " . implode(',', $table_data));
177
+      doquery("INSERT INTO {{{$table_name}}} {$fields} VALUES ".implode(',', $table_data));
178 178
     }
179 179
 
180 180
     return $ube->report_cypher;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     $report_cypher = db_escape($report_cypher);
193 193
 
194 194
     $report_row = doquery("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1", true);
195
-    if(!$report_row) {
195
+    if (!$report_row) {
196 196
       return UBE_REPORT_NOT_FOUND;
197 197
     }
198 198
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
    * @param     $template_result
209 209
    */
210 210
   function sn_ube_report_generate(UBE $ube, &$template_result) {
211
-    if(!is_object($ube)) {
211
+    if (!is_object($ube)) {
212 212
       return;
213 213
     }
214 214
 
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 
224 224
     // Координаты, тип и название планеты - если есть
225 225
 //R  $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER];
226
-    if(isset($ube->ube_planet_info)) {
226
+    if (isset($ube->ube_planet_info)) {
227 227
       $template_result += $ube->ube_planet_info;
228 228
       $template_result[PLANET_NAME] = str_replace(' ', '&nbsp;', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8'));
229 229
     }
230 230
 
231 231
     // Обломки
232 232
     $debris = array();
233
-    foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) {
234
-      if($resource_amount = $ube->debris->debris_get_resource($resource_id)) {
233
+    foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id) {
234
+      if ($resource_amount = $ube->debris->debris_get_resource($resource_id)) {
235 235
         $debris[] = array(
236 236
           'NAME'   => classLocale::$lang['tech'][$resource_id],
237 237
           'AMOUNT' => pretty_number($resource_amount),
Please login to merge, or discard this patch.
includes/classes/UBE/UBE.php 1 patch
Spacing   +48 added lines, -49 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     $this->players->db_load_player_by_id($player_id, UBE_PLAYER_IS_DEFENDER);
148 148
 
149 149
     $player_db_row = $this->players[$player_id]->getDbRow();
150
-    if($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) {
150
+    if ($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) {
151 151
       $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $fortifier_level);
152 152
     }
153 153
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     $this->rounds[0] = new UBERound(0);
180 180
     $this->rounds[0]->make_snapshot($this->fleet_list);
181 181
 
182
-    for($round = 1; $round <= 10; $round++) {
182
+    for ($round = 1; $round <= 10; $round++) {
183 183
       // Проводим раунд
184 184
       defined('DEBUG_UBE') ? print("Round {$round}<br>") : false;
185 185
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
       // Анализируем итоги текущего раунда и готовим данные для следующего
194 194
       $this->combat_result = $this->fleet_list->ubeAnalyzeFleetOutcome($round);
195
-      if($this->combat_result != UBE_COMBAT_RESULT_DRAW) {
195
+      if ($this->combat_result != UBE_COMBAT_RESULT_DRAW) {
196 196
         break;
197 197
       }
198 198
 
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
     // Генерируем результат боя
222 222
     $this->fleet_list->ube_analyze_fleets($this->is_simulator, $this->debris, $this->resource_exchange_rates);
223 223
 
224
-    if(!$this->is_ube_loaded) {
224
+    if (!$this->is_ube_loaded) {
225 225
       $this->moon_calculator->calculate_moon($this);
226 226
 
227 227
       // Лутаем ресурсы - если аттакер выиграл
228
-      if($this->combat_result == UBE_COMBAT_RESULT_WIN) {
228
+      if ($this->combat_result == UBE_COMBAT_RESULT_WIN) {
229 229
         $this->sn_ube_combat_analyze_loot();
230 230
       }
231 231
     }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
       RES_DEUTERIUM => 0,
246 246
     );
247 247
 
248
-    if(
248
+    if (
249 249
       (($planet_resource_total = $this->fleet_list[0]->get_resources_amount()) > 0)
250 250
       &&
251 251
       (($total_capacity = $this->fleet_list->ube_get_capacity_attackers()) > 0)
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
       $planet_lootable_percent = $planet_lootable / $planet_resource_total;
258 258
 
259 259
       // Вычисляем сколько ресурсов вывезено
260
-      foreach($this->fleet_list->_container as $fleet_id => $fleet) {
260
+      foreach ($this->fleet_list->_container as $fleet_id => $fleet) {
261 261
         $looted_in_metal = 0;
262
-        foreach($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) {
262
+        foreach ($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) {
263 263
           // Вычисляем какой процент общей емкости трюмов атакующих будет задействован
264 264
           $fleet_lootable_percent = $fleet->fleet_capacity / $total_capacity;
265 265
           $looted = floor($resource_amount * $planet_lootable_percent * $fleet_lootable_percent);
@@ -325,16 +325,16 @@  discard block
 block discarded – undo
325 325
     $destination_user_id = $this->fleet_list[0]->owner_id;
326 326
 
327 327
     // Обновляем поле обломков на планете
328
-    if(!$this->is_admin_in_combat && $this->debris->debris_total() > 0) {
328
+    if (!$this->is_admin_in_combat && $this->debris->debris_total() > 0) {
329 329
       db_planet_set_by_gspt($this->ube_planet_info[PLANET_GALAXY], $this->ube_planet_info[PLANET_SYSTEM], $this->ube_planet_info[PLANET_PLANET], PT_PLANET,
330
-        "`debris_metal` = `debris_metal` + " . $this->debris->debris_get_resource(RES_METAL) . ", `debris_crystal` = `debris_crystal` + " . $this->debris->debris_get_resource(RES_CRYSTAL)
330
+        "`debris_metal` = `debris_metal` + ".$this->debris->debris_get_resource(RES_METAL).", `debris_crystal` = `debris_crystal` + ".$this->debris->debris_get_resource(RES_CRYSTAL)
331 331
       );
332 332
     }
333 333
 
334
-    foreach($this->fleet_list->_container as $fleet_id => $UBEFleet) {
334
+    foreach ($this->fleet_list->_container as $fleet_id => $UBEFleet) {
335 335
       $ship_count_lost = $UBEFleet->unit_list->unitCountLost();
336 336
 
337
-      if($fleet_id) {
337
+      if ($fleet_id) {
338 338
         // Флот
339 339
         $UBEFleet->db_save_combat_result_fleet($this->is_small_fleet_recce, $this->moon_calculator->get_reapers_status());
340 340
       } else {
@@ -342,19 +342,19 @@  discard block
 block discarded – undo
342 342
 
343 343
         // Сохраняем изменения ресурсов - если они есть
344 344
         $resource_delta = $UBEFleet->ube_combat_result_calculate_resources();
345
-        if(!empty($resource_delta)) {
345
+        if (!empty($resource_delta)) {
346 346
           $temp = array();
347
-          foreach($resource_delta as $resource_id => $resource_amount) {
347
+          foreach ($resource_delta as $resource_id => $resource_amount) {
348 348
             $resource_db_name = pname_resource_name($resource_id);
349 349
             $temp[] = "`{$resource_db_name}` = `{$resource_db_name}` + ({$resource_amount})";
350 350
           }
351 351
           db_planet_set_by_id($this->ube_planet_info[PLANET_ID], implode(',', $temp));
352 352
         }
353 353
 
354
-        if($ship_count_lost) {
354
+        if ($ship_count_lost) {
355 355
           $db_changeset = array();
356 356
           $planet_row_cache = $this->players[$destination_user_id]->getDbRow();
357
-          foreach($UBEFleet->unit_list->_container as $UBEUnit) {
357
+          foreach ($UBEFleet->unit_list->_container as $UBEUnit) {
358 358
             $db_changeset['unit'][] = sn_db_unit_changeset_prepare($UBEUnit->unitId, -$UBEUnit->units_lost, $planet_row_cache, $this->ube_planet_info[PLANET_ID]);
359 359
           }
360 360
           db_changeset_apply($db_changeset);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     // TODO: Связать сабы с флотами констраинтами ON DELETE SET NULL
366 366
     // Для САБов
367 367
     $fleet_group_id_list = $this->fleet_list->ube_get_groups();
368
-    if(!empty($fleet_group_id_list)) {
368
+    if (!empty($fleet_group_id_list)) {
369 369
       $fleet_group_id_list = implode(',', $fleet_group_id_list);
370 370
       db_acs_delete_by_list($fleet_group_id_list);
371 371
     }
@@ -374,19 +374,19 @@  discard block
 block discarded – undo
374 374
 
375 375
     $bashing_list = array();
376 376
     $players_sides = $this->players->get_player_sides();
377
-    foreach($players_sides as $player_id => $player_side) {
378
-      if($player_side != UBE_PLAYER_IS_ATTACKER) {
377
+    foreach ($players_sides as $player_id => $player_side) {
378
+      if ($player_side != UBE_PLAYER_IS_ATTACKER) {
379 379
         continue;
380 380
       }
381
-      if($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) {
381
+      if ($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) {
382 382
         $bashing_list[] = "({$player_id}, {$this->ube_planet_info[PLANET_ID]}, {$this->combat_timestamp})";
383 383
       }
384
-      if($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) {
384
+      if ($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) {
385 385
         $str_loose_or_win = $this->combat_result == UBE_COMBAT_RESULT_WIN ? 'raidswin' : 'raidsloose';
386 386
         db_user_set_by_id($player_id, "`xpraid` = `xpraid` + 1, `raids` = `raids` + 1, `{$str_loose_or_win}` = `{$str_loose_or_win}` + 1");
387 387
       }
388 388
     }
389
-    if(!empty($bashing_list)) {
389
+    if (!empty($bashing_list)) {
390 390
       $bashing_list = implode(',', $bashing_list);
391 391
       db_bashing_insert($bashing_list);
392 392
     }
@@ -413,20 +413,19 @@  discard block
 block discarded – undo
413 413
       $planet_info[PLANET_SYSTEM],
414 414
       $planet_info[PLANET_PLANET],
415 415
       htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'),
416
-      classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' :
417
-        ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
416
+      classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
418 417
     );
419 418
 
420 419
     $text_defender = '';
421 420
     $debris = $this->debris->get_debris();
422
-    foreach($debris as $resource_id => $resource_amount) {
423
-      if($resource_id == RES_DEUTERIUM) {
421
+    foreach ($debris as $resource_id => $resource_amount) {
422
+      if ($resource_id == RES_DEUTERIUM) {
424 423
         continue;
425 424
       }
426 425
 
427
-      $text_defender .= "{$classLocale['tech'][$resource_id]}: " . pretty_number($resource_amount) . '<br />';
426
+      $text_defender .= "{$classLocale['tech'][$resource_id]}: ".pretty_number($resource_amount).'<br />';
428 427
     }
429
-    if($text_defender) {
428
+    if ($text_defender) {
430 429
       $text_defender = "{$classLocale['ube_report_msg_body_debris']}{$text_defender}<br />";
431 430
     }
432 431
 
@@ -436,8 +435,8 @@  discard block
 block discarded – undo
436 435
 
437 436
     // TODO: Оптимизировать отсылку сообщений - отсылать пакетами
438 437
     $player_sides = $this->players->get_player_sides();
439
-    foreach($player_sides as $player_id => $player_side) {
440
-      $message = $text_common . ($this->is_small_fleet_recce && ($player_side == UBE_PLAYER_IS_ATTACKER) ? classLocale::$lang['ube_report_msg_body_sfr'] : $text_defender);
438
+    foreach ($player_sides as $player_id => $player_side) {
439
+      $message = $text_common.($this->is_small_fleet_recce && ($player_side == UBE_PLAYER_IS_ATTACKER) ? classLocale::$lang['ube_report_msg_body_sfr'] : $text_defender);
441 440
       msg_send_simple_message($player_id, '', $this->combat_timestamp, MSG_TYPE_COMBAT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_attack_report'], $message);
442 441
     }
443 442
 
@@ -473,11 +472,11 @@  discard block
 block discarded – undo
473 472
     $player_id = $player_id == -1 ? $this->players->count() : $player_id;
474 473
     $fleet_id = $player_id; // FOR SIMULATOR!
475 474
 
476
-    if(empty($this->players[$player_id])) {
475
+    if (empty($this->players[$player_id])) {
477 476
       $this->players[$player_id] = new UBEPlayer();
478 477
     }
479 478
 
480
-    foreach($side_info as $fleet_data) {
479
+    foreach ($side_info as $fleet_data) {
481 480
       $this->players[$player_id]->name = $player_id;
482 481
       $this->players[$player_id]->setSide($attacker);
483 482
 
@@ -485,32 +484,32 @@  discard block
 block discarded – undo
485 484
       $this->fleet_list[$fleet_id] = $objFleet;
486 485
 
487 486
       $this->fleet_list[$fleet_id]->owner_id = $player_id;
488
-      foreach($fleet_data as $unit_id => $unit_count) {
489
-        if(!$unit_count) {
487
+      foreach ($fleet_data as $unit_id => $unit_count) {
488
+        if (!$unit_count) {
490 489
           continue;
491 490
         }
492 491
 
493 492
         $unit_type = get_unit_param($unit_id, P_UNIT_TYPE);
494 493
 
495
-        if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
494
+        if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
496 495
           $this->fleet_list[$fleet_id]->unit_list->unitAdjustCount($unit_id, $unit_count);
497
-        } elseif($unit_type == UNIT_RESOURCES) {
496
+        } elseif ($unit_type == UNIT_RESOURCES) {
498 497
           $this->fleet_list[$fleet_id]->resource_list[$unit_id] = $unit_count;
499
-        } elseif($unit_type == UNIT_TECHNOLOGIES) {
500
-          if($unit_id == TECH_WEAPON) {
498
+        } elseif ($unit_type == UNIT_TECHNOLOGIES) {
499
+          if ($unit_id == TECH_WEAPON) {
501 500
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_WEAPON, $unit_count);
502
-          } elseif($unit_id == TECH_SHIELD) {
501
+          } elseif ($unit_id == TECH_SHIELD) {
503 502
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_SHIELD, $unit_count);
504
-          } elseif($unit_id == TECH_ARMOR) {
503
+          } elseif ($unit_id == TECH_ARMOR) {
505 504
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_ARMOR, $unit_count);
506 505
           }
507
-        } elseif($unit_type == UNIT_GOVERNORS) {
508
-          if($unit_id == MRC_FORTIFIER) {
506
+        } elseif ($unit_type == UNIT_GOVERNORS) {
507
+          if ($unit_id == MRC_FORTIFIER) {
509 508
             // Фортифаер даёт бонус ко всему
510 509
             $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $unit_count);
511 510
           }
512
-        } elseif($unit_type == UNIT_MERCENARIES) {
513
-          if($unit_id == MRC_ADMIRAL) {
511
+        } elseif ($unit_type == UNIT_MERCENARIES) {
512
+          if ($unit_id == MRC_ADMIRAL) {
514 513
             $this->players[$player_id]->player_bonus->add_unit_by_snid(MRC_ADMIRAL, $unit_count);
515 514
           }
516 515
         }
@@ -565,7 +564,7 @@  discard block
 block discarded – undo
565 564
 
566 565
     $ube->sn_ube_message_send();
567 566
 
568
-    defined('DEBUG_UBE') ? die('DIE at ' . __FILE__ . ' ' . __LINE__) : false;
567
+    defined('DEBUG_UBE') ? die('DIE at '.__FILE__.' '.__LINE__) : false;
569 568
 
570 569
     return false;
571 570
   }
@@ -580,7 +579,7 @@  discard block
 block discarded – undo
580 579
 
581 580
     $ube_report = new UBEReport();
582 581
     $ube = $ube_report->sn_ube_report_load(sys_get_param_str('cypher'));
583
-    if($ube != UBE_REPORT_NOT_FOUND) {
582
+    if ($ube != UBE_REPORT_NOT_FOUND) {
584 583
       $ube_report->sn_ube_report_generate($ube, $template_result);
585 584
 
586 585
       $template = gettemplate('ube_combat_report', $template);
@@ -608,9 +607,9 @@  discard block
 block discarded – undo
608 607
     $ube->sn_ube_combat();
609 608
     $ube_report = new UBEReport();
610 609
 
611
-    if(sys_get_param_str('reload')) {
610
+    if (sys_get_param_str('reload')) {
612 611
       $ube_new = $ube_report->sn_ube_report_load($ube->get_cypher()); // $combat_data = sn_ube_report_load($combat_data[UBE_REPORT_CYPHER]);
613
-      if($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) {
612
+      if ($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) {
614 613
         $ube = $ube_new;
615 614
       }
616 615
     }
@@ -658,7 +657,7 @@  discard block
 block discarded – undo
658 657
     $this->debris->load_from_report_row($report_row);
659 658
 
660 659
     $query = doquery("SELECT * FROM {{ube_report_player}} WHERE `ube_report_id` = {$report_row['ube_report_id']}");
661
-    while($player_row = db_fetch($query)) {
660
+    while ($player_row = db_fetch($query)) {
662 661
       $this->players->init_player_from_report_info($player_row);
663 662
     }
664 663
 
Please login to merge, or discard this patch.
includes/classes/UBE/UBEDebris.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
    */
31 31
   public function debris_add_resource($resource_id, $resource_amount) {
32 32
     // В обломках может быть только металл или кристалл
33
-    if($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) {
33
+    if ($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) {
34 34
       return;
35 35
     }
36 36
     $this->debris[$resource_id] += $resource_amount;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
    * @param bool  $is_simulator
42 42
    */
43 43
   public function add_wrecks(array $wreckage, $is_simulator) {
44
-    foreach($wreckage as $resource_id => $resource_amount) {
44
+    foreach ($wreckage as $resource_id => $resource_amount) {
45 45
       $this->debris_add_resource($resource_id, floor($resource_amount *
46 46
         ($is_simulator
47 47
           ? UBE_SHIP_WRECKS_TO_DEBRIS_AVG
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
    * @param bool  $is_simulator
58 58
    */
59 59
   public function add_cargo_drop(array $dropped_resources, $is_simulator) {
60
-    foreach($dropped_resources as $resource_id => $resource_amount) {
60
+    foreach ($dropped_resources as $resource_id => $resource_amount) {
61 61
       $this->debris_add_resource($resource_id, floor($resource_amount *
62 62
         ($is_simulator
63 63
           ? UBE_CARGO_DROPPED_TO_DEBRIS_AVG
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
    * @param $moon_debris_left_part
97 97
    */
98 98
   public function debris_adjust_proportional($moon_debris_left_part) {
99
-    foreach($this->debris as $resource_id => &$resource_amount) {
99
+    foreach ($this->debris as $resource_id => &$resource_amount) {
100 100
       $resource_amount = floor($resource_amount * $moon_debris_left_part);
101 101
     }
102 102
   }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
    */
118 118
   public function report_generate_sql() {
119 119
     return "
120
-      `ube_report_debris_metal` = " . (float)$this->debris_get_resource(RES_METAL) . ",
121
-      `ube_report_debris_crystal` = " . (float)$this->debris_get_resource(RES_CRYSTAL) . ",
122
-      `ube_report_debris_total_in_metal` = " . (float)$this->debris_in_metal() . ", ";
120
+      `ube_report_debris_metal` = " . (float) $this->debris_get_resource(RES_METAL).",
121
+      `ube_report_debris_crystal` = " . (float) $this->debris_get_resource(RES_CRYSTAL).",
122
+      `ube_report_debris_total_in_metal` = " . (float) $this->debris_in_metal().", ";
123 123
   }
124 124
 
125 125
   /**
Please login to merge, or discard this patch.
includes/classes/UBE/UBEDebug.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
    * @version 41a6.49
12 12
    */
13 13
   public static function unit_dump_header() {
14
-    if(!defined('DEBUG_UBE')) {
14
+    if (!defined('DEBUG_UBE')) {
15 15
       return;
16 16
     }
17 17
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
    * @version 41a6.49
49 49
    */
50 50
   public static function unit_dump(UBEUnit $unit, $desc = '', UBEUnit $before = null) {
51
-    if(!defined('DEBUG_UBE')) {
51
+    if (!defined('DEBUG_UBE')) {
52 52
       return;
53 53
     }
54 54
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 //  print("<td>" . $this->units_lost . "</td>");
76 76
 //  print("<td>" . $this->units_restored . "</td>");
77 77
 //  print("<td>" . $this->capacity . "</td>");
78
-    print("<td>" . round($unit->share_of_side_armor, 4) . "</td>");
78
+    print("<td>".round($unit->share_of_side_armor, 4)."</td>");
79 79
     print('</tr>');
80 80
   }
81 81
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
    * @version 41a6.49
87 87
    */
88 88
   public static function unit_dump_footer() {
89
-    if(!defined('DEBUG_UBE')) {
89
+    if (!defined('DEBUG_UBE')) {
90 90
       return;
91 91
     }
92 92
 
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
    * @return UBEUnit
102 102
    */
103 103
   public static function unit_dump_defender(UBEUnit $attacking_unit_pool, UBEUnit $defending_unit_pool, $defending_fleet_id) {
104
-    if(!defined('DEBUG_UBE')) {
104
+    if (!defined('DEBUG_UBE')) {
105 105
       return null;
106 106
     }
107 107
 
108 108
     $classLocale = classLocale::$lang;
109 109
 
110
-    print("[{$attacking_unit_pool->unitId}]{$classLocale['tech'][$attacking_unit_pool->unitId]}" .
111
-      ' attacks ' .
112
-      $defending_fleet_id . '@' . "[{$defending_unit_pool->unitId}]{$classLocale['tech'][$defending_unit_pool->unitId]}" .
113
-      ' with ' . pretty_number($defending_unit_pool->attack_income) .
110
+    print("[{$attacking_unit_pool->unitId}]{$classLocale['tech'][$attacking_unit_pool->unitId]}".
111
+      ' attacks '.
112
+      $defending_fleet_id.'@'."[{$defending_unit_pool->unitId}]{$classLocale['tech'][$defending_unit_pool->unitId]}".
113
+      ' with '.pretty_number($defending_unit_pool->attack_income).
114 114
       '<br>'
115 115
     );
116 116
     $before = clone $defending_unit_pool;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
    * @version 41a6.49
128 128
    */
129 129
   public static function unit_dump_delta(UBEUnit $unit, $field, UBEUnit $before = null) {
130
-    if(!defined('DEBUG_UBE')) {
130
+    if (!defined('DEBUG_UBE')) {
131 131
       return;
132 132
     }
133 133
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
     print(pretty_number($unit->$field));
137 137
     print("</td>");
138 138
     print("<td>");
139
-    if(!empty($before)) {
140
-      print('' . pretty_number($unit->$field - $before->$field) . '');
139
+    if (!empty($before)) {
140
+      print(''.pretty_number($unit->$field - $before->$field).'');
141 141
     }
142 142
     print("</td>");
143 143
   }
Please login to merge, or discard this patch.
includes/classes/RequestInfo.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
     // Инфа об устройстве и браузере - общая для всех
90 90
     sn_db_transaction_start();
91 91
     $this->device_cypher = $_COOKIE[SN_COOKIE_D];
92
-    if($this->device_cypher) {
92
+    if ($this->device_cypher) {
93 93
       $cypher_safe = db_escape($this->device_cypher);
94 94
       $device_id = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true);
95
-      if(!empty($device_id['device_id'])) {
95
+      if (!empty($device_id['device_id'])) {
96 96
         $this->device_id = $device_id['device_id'];
97 97
       }
98 98
     }
99 99
 
100
-    if($this->device_id <= 0) {
100
+    if ($this->device_id <= 0) {
101 101
       do {
102 102
         $cypher_safe = db_escape($this->device_cypher = sys_random_string());
103 103
         $row = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true);
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
     $this->page_address_id = db_get_set_unique_id_value($this->page_address, 'url_id', 'security_url', 'url_string');
119 119
     sn_db_transaction_commit();
120 120
 
121
-    if($this->write_full_url) {
121
+    if ($this->write_full_url) {
122 122
       sn_db_transaction_start();
123 123
       $this->page_url = substr($_SERVER['REQUEST_URI'], strlen(SN_ROOT_RELATIVE));
124
-      if(strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) {
124
+      if (strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) {
125 125
         $this->page_url = '/simulator.php';
126 126
       }
127 127
       $this->page_url_id = db_get_set_unique_id_value($this->page_url, 'url_id', 'security_url', 'url_string');
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
    */
145 145
   public function db_security_entry_insert($user_id_unsafe) {
146 146
     // TODO $user_id = !empty(self::$user['id']) ? self::$user['id'] : 'NULL';
147
-    if(empty($user_id_unsafe)) {
147
+    if (empty($user_id_unsafe)) {
148 148
       // self::flog('Нет ИД пользователя');
149 149
       return true;
150 150
     }
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
     // self::flog('Вставляем запись системы безопасности');
155 155
     return doquery(
156 156
       "INSERT IGNORE INTO {{security_player_entry}} (`player_id`, `device_id`, `browser_id`, `user_ip`, `user_proxy`)
157
-        VALUES ({$user_id_safe}," . $this->device_id . "," . $this->browser_id . "," .
158
-      $this->ip_v4_int . ", '" . db_escape($this->ip_v4_proxy_chain) . "');"
157
+        VALUES ({$user_id_safe},".$this->device_id.",".$this->browser_id.",".
158
+      $this->ip_v4_int.", '".db_escape($this->ip_v4_proxy_chain)."');"
159 159
     );
160 160
   }
161 161
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
   public function db_counter_insert($user_id_unsafe) {
168 168
     global $sys_stop_log_hit;
169 169
 
170
-    if($sys_stop_log_hit || !classSupernova::$config->game_counter) {
170
+    if ($sys_stop_log_hit || !classSupernova::$config->game_counter) {
171 171
       return;
172 172
     }
173 173
 
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
     classSupernova::$db->isWatching = true;
178 178
     doquery(
179 179
       "INSERT INTO {{counter}} SET
180
-        `visit_time` = '" . SN_TIME_SQL. "',
180
+        `visit_time` = '" . SN_TIME_SQL."',
181 181
         `user_id` = {$user_id_safe},
182 182
         `device_id` = {$this->device_id},
183 183
         `browser_id` = {$this->browser_id},
184 184
         `user_ip` = {$this->ip_v4_int},
185 185
         `user_proxy` = '{$proxy_safe}',
186
-        `page_url_id` = {$this->page_address_id}" .
187
-        ($this->write_full_url ? ", `plain_url_id` = {$this->page_url_id}" : '' ).
186
+        `page_url_id` = {$this->page_address_id}".
187
+        ($this->write_full_url ? ", `plain_url_id` = {$this->page_url_id}" : '').
188 188
       ";");
189 189
 
190 190
     classSupernova::$db->isWatching = false;
Please login to merge, or discard this patch.
includes/classes/template.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
   {
62 62
     global $phpbb_root_path, $user;
63 63
 
64
-    if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'))
64
+    if (file_exists($phpbb_root_path.'styles/'.$user->theme['template_path'].'/template'))
65 65
     {
66
-      $this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template';
67
-      $this->cachepath = $phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_';
66
+      $this->root = $phpbb_root_path.'styles/'.$user->theme['template_path'].'/template';
67
+      $this->cachepath = $phpbb_root_path.'cache/tpl_'.str_replace('_', '-', $user->theme['template_path']).'_';
68 68
 
69 69
       if ($this->orig_tpl_storedb === null)
70 70
       {
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 
82 82
       if ($user->theme['template_inherits_id'])
83 83
       {
84
-        $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template';
84
+        $this->inherit_root = $phpbb_root_path.'styles/'.$user->theme['template_inherit_path'].'/template';
85 85
       }
86 86
     }
87 87
     else
88 88
     {
89
-      trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
89
+      trigger_error('Template path could not be found: styles/'.$user->theme['template_path'].'/template', E_USER_ERROR);
90 90
     }
91 91
 
92 92
     $this->_rootref = &$this->_tpldata['.'][0];
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     }
110 110
 
111 111
     $this->root = $template_path;
112
-    $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
112
+    $this->cachepath = $phpbb_root_path.'cache/ctpl_'.str_replace('_', '-', $template_name).'_';
113 113
 
114 114
     if ($fallback_template_path !== false)
115 115
     {
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
       }
155 155
 
156 156
       $this->filename[$handle] = $filename;
157
-      $this->files[$handle] = $this->root . '/' . $filename;
157
+      $this->files[$handle] = $this->root.'/'.$filename;
158 158
 
159 159
       if ($this->inherit_root)
160 160
       {
161
-        $this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
161
+        $this->files_inherit[$handle] = $this->inherit_root.'/'.$filename;
162 162
       }
163 163
     }
164 164
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     }
236 236
     else
237 237
     {
238
-      eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
238
+      eval(' ?>'.$this->compiled_code[$handle].'<?php ');
239 239
     }
240 240
 
241 241
     return true;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     //$user->theme['template_storedb'] = $this->orig_tpl_storedb;
281 281
     //$user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id;
282 282
 
283
-    $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . DOT_PHP_EX;
283
+    $filename = $this->cachepath.str_replace('/', '.', $this->filename[$handle]).DOT_PHP_EX;
284 284
     //$this->files_template[$handle] = (isset($user->theme['template_id'])) ? $user->theme['template_id'] : 0;
285 285
 
286 286
     $recompile = false;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
     if (!class_exists('template_compile'))
311 311
     {
312
-      include($phpbb_root_path . 'includes/functions_template' . DOT_PHP_EX);
312
+      include($phpbb_root_path.'includes/functions_template'.DOT_PHP_EX);
313 313
     }
314 314
 
315 315
     // Inheritance - we point to another template file for this one. Equality is also used for store_db
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
       foreach ($ids as $id)
349 349
       {
350 350
         $sql = 'SELECT *
351
-        FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
352
-        WHERE template_id = ' . $id . "
353
-          AND (template_filename = '" . $db->sql_escape($this->filename[$handle]) . "'
354
-            OR template_included " . $db->sql_like_expression($db->any_char . $this->filename[$handle] . ':' . $db->any_char) . ')';
351
+        FROM ' . STYLES_TEMPLATE_DATA_TABLE.'
352
+        WHERE template_id = ' . $id."
353
+          AND (template_filename = '" . $db->sql_escape($this->filename[$handle])."'
354
+            OR template_included " . $db->sql_like_expression($db->any_char.$this->filename[$handle].':'.$db->any_char).')';
355 355
 
356 356
         $result = $db->sql_query($sql);
357 357
         while ($row = $db->sql_fetchrow($result))
@@ -365,14 +365,14 @@  discard block
 block discarded – undo
365 365
       {
366 366
         foreach ($rows as $row)
367 367
         {
368
-          $file = $this->root . '/' . $row['template_filename'];
368
+          $file = $this->root.'/'.$row['template_filename'];
369 369
           $force_reload = false;
370 370
           if ($row['template_id'] != $user->theme['template_id'])
371 371
           {
372 372
             // make sure that we are not overlooking a file not in the db yet
373 373
             if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($file))
374 374
             {
375
-              $file = $this->inherit_root . '/' . $row['template_filename'];
375
+              $file = $this->inherit_root.'/'.$row['template_filename'];
376 376
               $this->files[$row['template_filename']] = $file;
377 377
               $this->files_inherit[$row['template_filename']] = $file;
378 378
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
           else
415 415
           {
416 416
             // Only bother compiling if it doesn't already exist
417
-            if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX))
417
+            if (!file_exists($this->cachepath.str_replace('/', '.', $row['template_filename']).DOT_PHP_EX))
418 418
             {
419 419
               $this->filename[$row['template_filename']] = $row['template_filename'];
420 420
               $compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data'])));
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
       }
426 426
       else
427 427
       {
428
-        $file = $this->root . '/' . $row['template_filename'];
428
+        $file = $this->root.'/'.$row['template_filename'];
429 429
 
430 430
         if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($file))
431 431
         {
432
-          $file = $this->inherit_root . '/' . $row['template_filename'];
432
+          $file = $this->inherit_root.'/'.$row['template_filename'];
433 433
           $this->files[$row['template_filename']] = $file;
434 434
           $this->files_inherit[$row['template_filename']] = $file;
435 435
           $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
       // Re-position template blocks
623 623
       for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--)
624 624
       {
625
-        $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1];
625
+        $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1];
626 626
         $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i;
627 627
       }
628 628
 
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
   {
657 657
     $handle = $filename;
658 658
     $this->filename[$handle] = $filename;
659
-    $this->files[$handle] = $this->root . '/' . $filename;
659
+    $this->files[$handle] = $this->root.'/'.$filename;
660 660
     if ($this->inherit_root)
661 661
     {
662
-      $this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
662
+      $this->files_inherit[$handle] = $this->inherit_root.'/'.$filename;
663 663
     }
664 664
 
665 665
     $filename = $this->_tpl_load($handle);
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
         include($filename);
674 674
         return;
675 675
       }
676
-      eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
676
+      eval(' ?>'.$this->compiled_code[$handle].'<?php ');
677 677
     }
678 678
   }
679 679
 
@@ -685,12 +685,12 @@  discard block
 block discarded – undo
685 685
   {
686 686
     global $phpbb_root_path;
687 687
 
688
-    $file = $phpbb_root_path . $filename;
688
+    $file = $phpbb_root_path.$filename;
689 689
 
690 690
     if (!file_exists($file))
691 691
     {
692 692
       // trigger_error cannot be used here, as the output already started
693
-      echo 'template->_php_include(): File ' . htmlspecialchars($file) . ' does not exist or is empty';
693
+      echo 'template->_php_include(): File '.htmlspecialchars($file).' does not exist or is empty';
694 694
       return;
695 695
     }
696 696
     include($file);
@@ -702,13 +702,13 @@  discard block
 block discarded – undo
702 702
   */
703 703
   function assign_recursive($values, $name = '')
704 704
   {
705
-    if(isset($values['.']))
705
+    if (isset($values['.']))
706 706
     {
707 707
       $values_extra = $values['.'];
708 708
       unset($values['.']);
709 709
     }
710 710
 
711
-    if(!$name)
711
+    if (!$name)
712 712
     {
713 713
       $this->assign_vars($values);
714 714
     }
@@ -717,12 +717,12 @@  discard block
 block discarded – undo
717 717
       $this->assign_block_vars($name, $values);
718 718
     }
719 719
 
720
-    if(isset($values_extra))
720
+    if (isset($values_extra))
721 721
     {
722
-      foreach($values_extra as $sub_array_name => $sub_array)
722
+      foreach ($values_extra as $sub_array_name => $sub_array)
723 723
       {
724
-        $new_name = $name . ($name ? '.' : '') . $sub_array_name;
725
-        foreach($sub_array as $sub_element)
724
+        $new_name = $name.($name ? '.' : '').$sub_array_name;
725
+        foreach ($sub_array as $sub_element)
726 726
         {
727 727
           $this->assign_recursive($sub_element, $new_name);
728 728
         }
Please login to merge, or discard this patch.
includes/classes/sn_module_payment.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
   public function compile_request($request) {
451 451
     global $user;
452 452
 
453
-    if(!(classSupernova::$auth->account instanceof Account)) {
453
+    if (!(classSupernova::$auth->account instanceof Account)) {
454 454
       // TODO - throw new Exception(lang['pay_msg_mm_request_amount_invalid'], SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT);
455 455
     }
456 456
     $this->account = classSupernova::$auth->account;
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
     $this->payment_currency = classSupernova::$config->payment_currency_default;
472 472
     $this->payment_amount = self::currency_convert($this->payment_dark_matter_paid, 'MM_', $this->payment_currency);
473 473
 
474
-    if(empty($this->payment_external_currency) && !empty($this->config['currency'])) {
474
+    if (empty($this->payment_external_currency) && !empty($this->config['currency'])) {
475 475
       $this->payment_external_currency = $this->config['currency'];
476 476
     }
477
-    if(empty($this->payment_external_currency)) {
477
+    if (empty($this->payment_external_currency)) {
478 478
       throw new Exception(classLocale::$lang['pay_error_internal_no_external_currency_set'], SN_PAYMENT_ERROR_INTERNAL_NO_EXTERNAL_CURRENCY_SET);
479 479
     }
480 480
 
481 481
     $this->payment_external_amount = self::currency_convert($this->payment_dark_matter_paid, 'MM_', $this->payment_external_currency);
482
-    if($this->payment_external_amount < 0.01) {
482
+    if ($this->payment_external_amount < 0.01) {
483 483
       throw new Exception(classLocale::$lang['pay_msg_mm_request_amount_invalid'], SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT);
484 484
     }
485 485
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
     $this->generate_description();
489 489
 
490 490
     $this->db_insert();
491
-    if(!$this->is_exists) {
491
+    if (!$this->is_exists) {
492 492
       throw new Exception(classLocale::$lang['pay_msg_request_error_db_payment_create'], SN_PAYMENT_REQUEST_DB_ERROR_PAYMENT_CREATE);
493 493
     }
494 494
   }
@@ -500,26 +500,26 @@  discard block
 block discarded – undo
500 500
    * @throws Exception
501 501
    */
502 502
   protected function payment_request_process($options = array()) {
503
-    if(!$this->manifest['active']) {
503
+    if (!$this->manifest['active']) {
504 504
       throw new Exception(classLocale::$lang['pay_msg_module_disabled'], SN_MODULE_DISABLED);
505 505
     }
506 506
 
507 507
     // Если есть payment_id - загружаем под него данные
508
-    if(!empty($this->payment_params['payment_id'])) {
508
+    if (!empty($this->payment_params['payment_id'])) {
509 509
       $this->request_payment_id = sys_get_param_id($this->payment_params['payment_id']);
510
-      if(!$this->request_payment_id) {
510
+      if (!$this->request_payment_id) {
511 511
         throw new Exception(classLocale::$lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_INTERNAL_ID_WRONG);
512 512
       }
513 513
 
514
-      if(!$this->db_get_by_id($this->request_payment_id)) {
514
+      if (!$this->db_get_by_id($this->request_payment_id)) {
515 515
         throw new Exception(classLocale::$lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_INTERNAL_ID_WRONG);
516 516
       }
517 517
 
518 518
       // Проверяем - был ли этот платеж обработан?
519 519
       // TODO - Статусы бывают разные. Нужен спецфлаг payment_processed
520
-      if($this->payment_status != PAYMENT_STATUS_NONE) {
520
+      if ($this->payment_status != PAYMENT_STATUS_NONE) {
521 521
         sn_db_transaction_rollback();
522
-        sys_redirect(SN_ROOT_VIRTUAL . 'metamatter.php?payment_id=' . $this->payment_id);
522
+        sys_redirect(SN_ROOT_VIRTUAL.'metamatter.php?payment_id='.$this->payment_id);
523 523
         die();
524 524
       }
525 525
     }
@@ -527,89 +527,89 @@  discard block
 block discarded – undo
527 527
     // Пытаемся получить из запроса ИД аккаунта
528 528
     $request_account_id = !empty($this->payment_params['account_id']) ? sys_get_param_id($this->payment_params['account_id']) : 0;
529 529
     // Если в запросе нет ИД аккаунта - пытаемся использовать payment_account_id
530
-    if(empty($request_account_id) && !empty($this->payment_account_id)) {
530
+    if (empty($request_account_id) && !empty($this->payment_account_id)) {
531 531
       $request_account_id = $this->payment_account_id;
532 532
     }
533 533
     // Если теперь у нас нету ИД аккаунта ни в запросе, ни в записи таблицы - можно паниковать
534
-    if(empty($request_account_id)) {
534
+    if (empty($request_account_id)) {
535 535
       // TODO - аккаунт
536 536
       throw new Exception(classLocale::$lang['pay_msg_request_user_invalid'], $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
537 537
     }
538 538
     // Если нет записи в таблице - тогда берем payment_account_id из запроса
539
-    if(empty($this->payment_account_id)) {
539
+    if (empty($this->payment_account_id)) {
540 540
       $this->payment_account_id = $request_account_id;
541 541
     }
542 542
     // Если у нас отличаются ИД аккаунта в запросе и ИД аккаунта в записи - тоже можно паниковать
543
-    if($this->payment_account_id != $request_account_id) {
543
+    if ($this->payment_account_id != $request_account_id) {
544 544
       // TODO - Поменять сообщение об ошибке
545 545
       throw new Exception(classLocale::$lang['pay_msg_request_user_invalid'], $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
546 546
     }
547 547
     // Проверяем существование аккаунта с данным ИД
548
-    if(!$this->account->db_get_by_id($this->payment_account_id)) {
549
-      throw new Exception(classLocale::$lang['pay_msg_request_user_invalid'] . ' ID ' . $this->payment_account_id, $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
548
+    if (!$this->account->db_get_by_id($this->payment_account_id)) {
549
+      throw new Exception(classLocale::$lang['pay_msg_request_user_invalid'].' ID '.$this->payment_account_id, $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
550 550
     }
551 551
 
552 552
     // TODO Проверка на сервер_ид - как бы и не нужна, наверное?
553
-    if(!empty($this->payment_params['server_id'])) {
553
+    if (!empty($this->payment_params['server_id'])) {
554 554
       $this->request_server_id = sys_get_param_str($this->payment_params['server_id']);
555
-      if(SN_ROOT_VIRTUAL != $this->request_server_id) {
556
-        throw new Exception(classLocale::$lang['pay_msg_request_server_wrong'] . " {$this->request_server_id} вместо " . SN_ROOT_VIRTUAL, SN_PAYMENT_REQUEST_SERVER_WRONG);
555
+      if (SN_ROOT_VIRTUAL != $this->request_server_id) {
556
+        throw new Exception(classLocale::$lang['pay_msg_request_server_wrong']." {$this->request_server_id} вместо ".SN_ROOT_VIRTUAL, SN_PAYMENT_REQUEST_SERVER_WRONG);
557 557
       }
558 558
     }
559 559
 
560 560
     // Сверка количества оплаченной ММ с учётом бонусов
561
-    if(!empty($this->payment_params['payment_dark_matter_gained'])) {
561
+    if (!empty($this->payment_params['payment_dark_matter_gained'])) {
562 562
       $request_mm_amount = sys_get_param_id($this->payment_params['payment_dark_matter_gained']);
563
-      if($request_mm_amount != $this->payment_dark_matter_gained && $this->is_loaded) {
564
-        throw new Exception(classLocale::$lang['pay_msg_mm_request_amount_invalid'] . " пришло {$request_mm_amount} ММ вместо {$this->payment_dark_matter_gained} ММ", SN_PAYMENT_REQUEST_MM_AMOUNT_INVALID);
563
+      if ($request_mm_amount != $this->payment_dark_matter_gained && $this->is_loaded) {
564
+        throw new Exception(classLocale::$lang['pay_msg_mm_request_amount_invalid']." пришло {$request_mm_amount} ММ вместо {$this->payment_dark_matter_gained} ММ", SN_PAYMENT_REQUEST_MM_AMOUNT_INVALID);
565 565
       }
566 566
       empty($this->payment_dark_matter_gained) ? $this->payment_dark_matter_gained = $request_mm_amount : false;
567 567
     }
568
-    if(empty($this->payment_dark_matter_paid)) {
568
+    if (empty($this->payment_dark_matter_paid)) {
569 569
       // TODO - обратный расчёт из gained
570 570
     }
571 571
 
572 572
     // Проверка наличия внешнего ИД платежа
573
-    if(!empty($this->payment_params['payment_external_id'])) {
573
+    if (!empty($this->payment_params['payment_external_id'])) {
574 574
       $request_payment_external_id = sys_get_param_id($this->payment_params['payment_external_id']);
575
-      if(empty($request_payment_external_id)) {
575
+      if (empty($request_payment_external_id)) {
576 576
         throw new exception(classLocale::$lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_EXTERNAL_ID_WRONG);
577
-      } elseif(!empty($this->payment_external_id) && $this->payment_external_id != $request_payment_external_id) {
577
+      } elseif (!empty($this->payment_external_id) && $this->payment_external_id != $request_payment_external_id) {
578 578
         // TODO - Может быть поменять сообщение
579 579
         throw new exception(classLocale::$lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_EXTERNAL_ID_WRONG);
580 580
       }
581 581
       $this->payment_external_id = $request_payment_external_id;
582 582
     }
583 583
     // Сверка суммы, запрошенной СН к оплате
584
-    if(!empty($this->payment_params['payment_external_money'])) {
584
+    if (!empty($this->payment_params['payment_external_money'])) {
585 585
       $request_money_out = sys_get_param_float($this->payment_params['payment_external_money']);
586
-      if($request_money_out != $this->payment_external_amount && $this->is_loaded) {
587
-        throw new Exception(classLocale::$lang['pay_msg_request_payment_amount_invalid'] . " пришло {$request_money_out} денег вместо {$this->payment_external_amount} денег", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID);
586
+      if ($request_money_out != $this->payment_external_amount && $this->is_loaded) {
587
+        throw new Exception(classLocale::$lang['pay_msg_request_payment_amount_invalid']." пришло {$request_money_out} денег вместо {$this->payment_external_amount} денег", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID);
588 588
       }
589 589
       empty($this->payment_external_amount) ? $this->payment_external_amount = $request_money_out : false;
590 590
     }
591 591
     // Заполняем поле валюты платёжной системы
592
-    if(!empty($this->payment_params['payment_external_currency'])) {
592
+    if (!empty($this->payment_params['payment_external_currency'])) {
593 593
       $this->payment_external_currency = sys_get_param_str($this->payment_params['payment_external_currency']);
594
-      if(empty($this->payment_external_currency)) {
594
+      if (empty($this->payment_external_currency)) {
595 595
         // TODO - поменять сообщение
596
-        throw new Exception(classLocale::$lang['pay_msg_request_payment_amount_invalid'] . " {$this->payment_external_currency}", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID);
596
+        throw new Exception(classLocale::$lang['pay_msg_request_payment_amount_invalid']." {$this->payment_external_currency}", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID);
597 597
       }
598 598
     }
599
-    if(empty($this->payment_external_currency)) {
599
+    if (empty($this->payment_external_currency)) {
600 600
       $this->payment_external_currency = $this->config['currency'];
601 601
     }
602 602
 
603 603
     // Заполнение внутренней суммы и валюты из внешних данных
604
-    if(empty($this->payment_currency)) {
604
+    if (empty($this->payment_currency)) {
605 605
       $this->payment_currency = classSupernova::$config->payment_currency_default;
606 606
     }
607
-    if(empty($this->payment_amount) && !empty($this->payment_external_currency)) {
607
+    if (empty($this->payment_amount) && !empty($this->payment_external_currency)) {
608 608
       $this->payment_amount = self::currency_convert($this->payment_external_amount, $this->payment_external_currency, $this->payment_currency);
609 609
     }
610 610
 
611 611
     // TODO - Тестовый режим
612
-    if(!empty($this->payment_params['test'])) {
612
+    if (!empty($this->payment_params['test'])) {
613 613
       $this->payment_test = $this->config['test'] || sys_get_param_int($this->payment_params['test']);
614 614
     }
615 615
 
@@ -636,21 +636,21 @@  discard block
 block discarded – undo
636 636
     sn_db_transaction_start();
637 637
     try {
638 638
       $response = $this->payment_request_process();
639
-    } catch(Exception $e) {
639
+    } catch (Exception $e) {
640 640
       $response['result'] = $e->getCode();
641 641
       $response['message'] = $e->getMessage();
642 642
     }
643 643
 
644
-    if($response['result'] == SN_PAYMENT_REQUEST_OK) {
644
+    if ($response['result'] == SN_PAYMENT_REQUEST_OK) {
645 645
       sn_db_transaction_commit();
646
-      classSupernova::$debug->warning('Результат операции: код ' . $response['result'] . ' сообщение "' . $response['message'] . '"', 'Успешный платёж', LOG_INFO_PAYMENT);
646
+      classSupernova::$debug->warning('Результат операции: код '.$response['result'].' сообщение "'.$response['message'].'"', 'Успешный платёж', LOG_INFO_PAYMENT);
647 647
     } else {
648 648
       sn_db_transaction_rollback();
649
-      classSupernova::$debug->warning('Результат операции: код ' . $response['result'] . ' сообщение "' . $response['message'] . '"', 'Ошибка платежа', LOG_INFO_PAYMENT, true);
649
+      classSupernova::$debug->warning('Результат операции: код '.$response['result'].' сообщение "'.$response['message'].'"', 'Ошибка платежа', LOG_INFO_PAYMENT, true);
650 650
     }
651 651
 
652 652
     // Переводим код результата из СН в код платежной системы
653
-    if(is_array($this->result_translations) && !empty($this->result_translations)) {
653
+    if (is_array($this->result_translations) && !empty($this->result_translations)) {
654 654
       $response['result'] = isset($this->result_translations[$response['result']]) ? $this->result_translations[$response['result']] : $this->result_translations[SN_PAYMENT_REQUEST_UNDEFINED_ERROR];
655 655
     }
656 656
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
     $currency_from = strtolower($currency_from);
674 674
     $currency_to = strtolower($currency_to);
675 675
 
676
-    if($currency_from != $currency_to) {
676
+    if ($currency_from != $currency_to) {
677 677
       $exchange_from = get_exchange_rate($currency_from);
678 678
       $exchange_to = get_exchange_rate($currency_to);
679 679
 
@@ -697,10 +697,10 @@  discard block
 block discarded – undo
697 697
   public static function bonus_calculate($dark_matter, $direct = true, $return_bonus = false) {
698 698
     $bonus = 0;
699 699
     $dark_matter_new = $dark_matter;
700
-    if(!empty(self::$bonus_table) && $dark_matter >= self::$bonus_table[0]) {
701
-      if($direct) {
702
-        foreach(self::$bonus_table as $dm_for_bonus => $multiplier) {
703
-          if($dm_for_bonus <= $dark_matter) {
700
+    if (!empty(self::$bonus_table) && $dark_matter >= self::$bonus_table[0]) {
701
+      if ($direct) {
702
+        foreach (self::$bonus_table as $dm_for_bonus => $multiplier) {
703
+          if ($dm_for_bonus <= $dark_matter) {
704 704
             $dark_matter_new = $dark_matter * (1 + $multiplier);
705 705
             $bonus = $multiplier;
706 706
           } else {
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
           }
709 709
         }
710 710
       } else {
711
-        foreach(self::$bonus_table as $dm_for_bonus => $multiplier) {
711
+        foreach (self::$bonus_table as $dm_for_bonus => $multiplier) {
712 712
           $temp = $dm_for_bonus * (1 + $multiplier);
713
-          if($dark_matter >= $temp) {
713
+          if ($dark_matter >= $temp) {
714 714
             $dark_matter_new = round($dark_matter / (1 + $multiplier));
715 715
             $bonus = $multiplier;
716 716
           } else {
@@ -764,30 +764,30 @@  discard block
 block discarded – undo
764 764
     );
765 765
 
766 766
     $replace = false;
767
-    if($this->payment_id) {
767
+    if ($this->payment_id) {
768 768
       $payment['payment_id'] = $this->payment_id;
769 769
       $replace = true;
770 770
     }
771 771
 
772 772
     $query = array();
773
-    foreach($payment as $key => $value) {
774
-      $value = is_string($value) ? '"' . db_escape($value) . '"' : $value;
773
+    foreach ($payment as $key => $value) {
774
+      $value = is_string($value) ? '"'.db_escape($value).'"' : $value;
775 775
       $query[] = "`{$key}` = {$value}";
776 776
     }
777 777
 
778
-    $this->db->doquery(($replace ? 'REPLACE' : 'INSERT') . ' INTO `{{payment}}` SET ' . implode(',', $query) . ';');
778
+    $this->db->doquery(($replace ? 'REPLACE' : 'INSERT').' INTO `{{payment}}` SET '.implode(',', $query).';');
779 779
 
780 780
     return $this->db_get_by_id($this->db->db_insert_id());
781 781
   }
782 782
 
783 783
 
784 784
   function payment_adjust_mm_new() {
785
-    if(!$this->payment_test) {
785
+    if (!$this->payment_test) {
786 786
       // Not a test payment. Adding DM to account
787 787
       $this->account = new Account($this->db);
788 788
       $this->account->db_get_by_id($this->payment_account_id);
789 789
       $result = $this->account->metamatter_change(RPG_PURCHASE, $this->payment_dark_matter_gained, $this->payment_comment);
790
-      if(!$result) {
790
+      if (!$result) {
791 791
         throw new Exception('Ошибка начисления ММ', SN_METAMATTER_ERROR_ADJUST);
792 792
       }
793 793
     }
@@ -796,25 +796,25 @@  discard block
 block discarded – undo
796 796
   function payment_cancel(&$payment) {
797 797
     die('{НЕ РАБОТАЕТ! СООБЩИТЕ АДМИНИСТРАЦИИ!}');
798 798
 
799
-    if(!isset($payment['payment_status'])) {
799
+    if (!isset($payment['payment_status'])) {
800 800
       throw new exception(classLocale::$lang['pay_msg_request_payment_not_found'], SN_PAYMENT_REQUEST_ORDER_NOT_FOUND);
801 801
     }
802 802
 
803
-    if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) {
804
-      $safe_comment = db_escape($payment['payment_comment'] = classLocale::$lang['pay_msg_request_payment_cancelled'] .' ' . $payment['payment_comment']);
803
+    if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) {
804
+      $safe_comment = db_escape($payment['payment_comment'] = classLocale::$lang['pay_msg_request_payment_cancelled'].' '.$payment['payment_comment']);
805 805
 
806
-      if(!$payment['payment_test']) {
806
+      if (!$payment['payment_test']) {
807 807
         $result = $this->account->metamatter_change(RPG_PURCHASE_CANCEL, -$payment['payment_dark_matter_gained'], $payment['payment_comment']);
808
-        if(!$result) {
808
+        if (!$result) {
809 809
           throw new exception('Ошибка начисления ММ', SN_METAMATTER_ERROR_ADJUST);
810 810
         }
811 811
       }
812 812
       $payment['payment_status'] = PAYMENT_STATUS_CANCELED;
813 813
       db_payment_update($payment, $safe_comment);
814 814
       throw new exception(classLocale::$lang['pay_msg_request_payment_cancel_complete'], SN_PAYMENT_REQUEST_OK);
815
-    } elseif($payment['payment_status'] == PAYMENT_STATUS_CANCELED) {
815
+    } elseif ($payment['payment_status'] == PAYMENT_STATUS_CANCELED) {
816 816
       throw new exception(classLocale::$lang['pay_msg_request_payment_cancelled_already'], SN_PAYMENT_REQUEST_OK);
817
-    } elseif($payment['payment_status'] == PAYMENT_STATUS_NONE) {
817
+    } elseif ($payment['payment_status'] == PAYMENT_STATUS_NONE) {
818 818
       throw new exception(classLocale::$lang['pay_msg_request_payment_cancel_not_complete'], SN_PAYMENT_REQUEST_PAYMENT_NOT_COMPLETE);
819 819
     }
820 820
   }
@@ -828,8 +828,8 @@  discard block
 block discarded – undo
828 828
 
829 829
   protected function db_complete_payment() {
830 830
     // TODO - поле payment_processed
831
-    if($this->payment_status == PAYMENT_STATUS_NONE) {
832
-      if(!defined('PAYMENT_EXPIRE_TIME') || PAYMENT_EXPIRE_TIME == 0 || empty($this->payment_date) || strtotime($this->payment_date) + PAYMENT_EXPIRE_TIME <= SN_TIME_NOW) {
831
+    if ($this->payment_status == PAYMENT_STATUS_NONE) {
832
+      if (!defined('PAYMENT_EXPIRE_TIME') || PAYMENT_EXPIRE_TIME == 0 || empty($this->payment_date) || strtotime($this->payment_date) + PAYMENT_EXPIRE_TIME <= SN_TIME_NOW) {
833 833
         $this->payment_adjust_mm_new();
834 834
         $this->payment_status = PAYMENT_STATUS_COMPLETE;
835 835
       } else {
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
   protected function db_assign_payment($payment = null) {
877 877
     $this->payment_reset();
878 878
 
879
-    if(is_array($payment) && isset($payment['payment_id'])) {
879
+    if (is_array($payment) && isset($payment['payment_id'])) {
880 880
       $this->payment_id = $payment['payment_id'];
881 881
       $this->payment_status = $payment['payment_status'];
882 882
       $this->payment_date = $payment['payment_date'];
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
   protected function generate_description() {
919 919
     // TODO - системная локализация
920 920
     $this->description_generated = array(
921
-      PAYMENT_DESCRIPTION_100 => substr("{$this->payment_dark_matter_gained} ММ аккаунт [{$this->account->account_name}] ID {$this->account->account_id} на " . SN_ROOT_VIRTUAL, 0, 100),
922
-      PAYMENT_DESCRIPTION_250 => substr("Оплата {$this->payment_dark_matter_gained} ММ для аккаунта [{$this->payment_user_name}] ID {$this->payment_user_id} на сервере " . SN_ROOT_VIRTUAL, 0, 250),
923
-      PAYMENT_DESCRIPTION_MAX => ($this->payment_test ? "ТЕСТОВЫЙ ПЛАТЕЖ! " : '') .
924
-        "Платеж от аккаунта '{$this->payment_account_name}' ID {$this->payment_account_id} игрока '{$this->payment_user_name}' ID {$this->payment_user_id} на сервере " . SN_ROOT_VIRTUAL .
925
-        " сумма {$this->payment_amount} {$this->payment_currency} за {$this->payment_dark_matter_paid} ММ (начислено {$this->payment_dark_matter_gained} ММ)" .
921
+      PAYMENT_DESCRIPTION_100 => substr("{$this->payment_dark_matter_gained} ММ аккаунт [{$this->account->account_name}] ID {$this->account->account_id} на ".SN_ROOT_VIRTUAL, 0, 100),
922
+      PAYMENT_DESCRIPTION_250 => substr("Оплата {$this->payment_dark_matter_gained} ММ для аккаунта [{$this->payment_user_name}] ID {$this->payment_user_id} на сервере ".SN_ROOT_VIRTUAL, 0, 250),
923
+      PAYMENT_DESCRIPTION_MAX => ($this->payment_test ? "ТЕСТОВЫЙ ПЛАТЕЖ! " : '').
924
+        "Платеж от аккаунта '{$this->payment_account_name}' ID {$this->payment_account_id} игрока '{$this->payment_user_name}' ID {$this->payment_user_id} на сервере ".SN_ROOT_VIRTUAL.
925
+        " сумма {$this->payment_amount} {$this->payment_currency} за {$this->payment_dark_matter_paid} ММ (начислено {$this->payment_dark_matter_gained} ММ)".
926 926
         " через '{$this->manifest['name']}' сумма {$this->payment_external_amount} {$this->payment_external_currency}",
927 927
     );
928 928
   }
Please login to merge, or discard this patch.
includes/classes/db_mysql_v4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     !mysql_select_db($settings['name'])
53 53
       ? classSupernova::$debug->error_fatal('DB error - cannot find DB on server', $this->mysql_error())
54 54
       : false;
55
-    !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL ' . self::DB_MYSQL_TRANSACTION_REPEATABLE_READ . ';')
55
+    !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL '.self::DB_MYSQL_TRANSACTION_REPEATABLE_READ.';')
56 56
       ? classSupernova::$debug->error_fatal('DB error - cannot set desired isolation level', $this->mysql_error())
57 57
       : false;
58 58
 
Please login to merge, or discard this patch.
includes/classes/UnitResourceLoot.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
   public static function _init($group_name = '') {
27 27
     parent::_init($group_name);
28 28
 
29
-    foreach(static::$_group_unit_id_list as $resource_id) {
29
+    foreach (static::$_group_unit_id_list as $resource_id) {
30 30
       static::$_group_pnames[$resource_id] = pname_resource_name($resource_id);
31 31
     }
32 32
 
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 
49 49
     !is_array($resource_array) ? $resource_array = array() : false;
50 50
 
51
-    foreach($resource_array as $resource_id => $resource_actual_delta) {
52
-      if(!$resource_actual_delta) {
51
+    foreach ($resource_array as $resource_id => $resource_actual_delta) {
52
+      if (!$resource_actual_delta) {
53 53
         // No delta - no changes
54 54
         continue;
55 55
       }
56 56
 
57
-      $result[$prefix . static::$_group_pnames[$resource_id]] = $resource_actual_delta;
57
+      $result[$prefix.static::$_group_pnames[$resource_id]] = $resource_actual_delta;
58 58
     }
59 59
 
60 60
     return $result;
Please login to merge, or discard this patch.