Completed
Push — work-fleets ( 4d76fa...c97fe0 )
by SuperNova.WS
05:17
created
notes.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,41 +8,41 @@  discard block
 block discarded – undo
8 8
  *     [!] Wrote from scratch
9 9
  */
10 10
 
11
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
11
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
12 12
 
13 13
 lng_include('notes');
14 14
 
15 15
 $template = gettemplate('notes', true);
16 16
 
17 17
 $result = array();
18
-if(($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) {
18
+if (($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) {
19 19
   $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => classLocale::$lang[$result_message]);
20 20
 }
21 21
 
22 22
 $note_id_edit = sys_get_param_id('note_id_edit');
23
-if(sys_get_param('note_delete')) {
23
+if (sys_get_param('note_delete')) {
24 24
   try {
25 25
     $not = '';
26 26
     $query_where = '';
27
-    switch(sys_get_param_str('note_delete_range')) {
27
+    switch (sys_get_param_str('note_delete_range')) {
28 28
       case 'all':
29 29
       break;
30 30
 
31 31
       case 'marked_not':
32 32
         $not = 'NOT';
33 33
       case 'marked':
34
-        if(!is_array($notes_marked = sys_get_param('note'))) {
34
+        if (!is_array($notes_marked = sys_get_param('note'))) {
35 35
           throw new Exception('note_err_none_selected', ERR_WARNING);
36 36
         }
37 37
 
38 38
         $notes_marked_filtered = array();
39
-        foreach($notes_marked as $note_id => $note_select) {
40
-          if($note_select == 'on' && $note_id = idval($note_id)) {
39
+        foreach ($notes_marked as $note_id => $note_select) {
40
+          if ($note_select == 'on' && $note_id = idval($note_id)) {
41 41
             $notes_marked_filtered[] = $note_id;
42 42
           }
43 43
         }
44 44
 
45
-        if(empty($notes_marked_filtered)) {
45
+        if (empty($notes_marked_filtered)) {
46 46
           throw new Exception('note_err_none_selected', ERR_WARNING);
47 47
         }
48 48
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     db_note_list_delete($user, $query_where);
60 60
     sn_db_transaction_commit();
61 61
     throw new Exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE);
62
-  } catch(Exception $e) {
62
+  } catch (Exception $e) {
63 63
     $note_id_edit = 0;
64 64
     sn_db_transaction_rollback();
65 65
     $result[] = array(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
       'MESSAGE' => classLocale::$lang[$e->getMessage()],
68 68
     );
69 69
   }
70
-} elseif(($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) {
70
+} elseif (($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) {
71 71
   $note_title == db_escape(classLocale::$lang['note_new_title']) ? $note_title = '' : false;
72 72
   ($note_text = sys_get_param_str('note_text')) == db_escape(classLocale::$lang['note_new_text']) ? $note_text = '' : false;
73 73
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     $note_system = max(0, min(sys_get_param_id('note_system'), Vector::$knownSystems));
77 77
     $note_planet = max(0, min(sys_get_param_id('note_planet'), Vector::$knownPlanets + 1));
78 78
 
79
-    if(!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) {
79
+    if (!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) {
80 80
       throw new exception('note_err_note_empty', ERR_WARNING);
81 81
     }
82 82
 
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
     $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0;
86 86
 
87 87
     sn_db_transaction_start();
88
-    if($note_id_edit) {
88
+    if ($note_id_edit) {
89 89
       $check_note_id = db_note_get_id_and_owner($note_id_edit);
90
-      if(!$check_note_id) {
90
+      if (!$check_note_id) {
91 91
         throw new Exception('note_err_note_not_found', ERR_ERROR);
92 92
       }
93 93
     }
94 94
 
95
-    if($note_id_edit) {
96
-      if($check_note_id['owner'] != $user['id']) {
95
+    if ($note_id_edit) {
96
+      if ($check_note_id['owner'] != $user['id']) {
97 97
         throw new Exception('note_err_owner_wrong', ERR_ERROR);
98 98
       }
99 99
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
     }
104 104
 
105 105
     sn_db_transaction_commit();
106
-    sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added'));
106
+    sys_redirect('notes.php?STATUS='.ERR_NONE.'&MESSAGE='.($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added'));
107 107
 //    throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE);
108
-  } catch(Exception $e) {
108
+  } catch (Exception $e) {
109 109
     $note_id_edit = 0;
110 110
     sn_db_transaction_rollback();
111 111
     $result[] = array(
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
   }
116 116
 }
117 117
 
118
-if(!$note_id_edit) {
118
+if (!$note_id_edit) {
119 119
   note_assign($template, array(
120 120
     'id'          => 0,
121 121
     'time'        => SN_TIME_NOW,
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 
129 129
 $note_exist = false;
130 130
 $notes_query = db_note_list_by_owner($user['id']);
131
-while($note_row = db_fetch($notes_query)) {
131
+while ($note_row = db_fetch($notes_query)) {
132 132
   note_assign($template, $note_row);
133 133
   $note_exist = $note_exist || $note_row['id'] == $note_id_edit;
134 134
 }
135 135
 $note_id_edit = $note_exist ? $note_id_edit : 0;
136 136
 
137
-foreach($note_priority_classes as $note_priority_id => $note_priority_class) {
137
+foreach ($note_priority_classes as $note_priority_id => $note_priority_class) {
138 138
   $template->assign_block_vars('note_priority', array(
139 139
     'ID'    => $note_priority_id,
140 140
     'CLASS' => $note_priority_classes[$note_priority_id],
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
   ));
143 143
 }
144 144
 
145
-foreach(classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) {
145
+foreach (classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) {
146 146
   $template->assign_block_vars('planet_type', array(
147 147
     'ID'   => $planet_type_id,
148 148
     'TEXT' => $planet_type_string,
149 149
   ));
150 150
 }
151 151
 
152
-foreach($result as $result_data) {
152
+foreach ($result as $result_data) {
153 153
   $template->assign_block_vars('result', $result_data);
154 154
 }
155 155
 
Please login to merge, or discard this patch.
logout.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 define('LOGIN_LOGOUT', true);
10 10
 
11
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
11
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
12 12
 
13 13
 // sn_sys_logout(true);
14 14
 // core_auth::logout(true);
Please login to merge, or discard this patch.
common.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 global $template_result, $user;
13 13
 
14 14
 // Напоминание для Администрации, что игра отключена
15
-if($template_result[F_GAME_DISABLE]) {
15
+if ($template_result[F_GAME_DISABLE]) {
16 16
   echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
17 17
 }
18 18
 unset($disable_reason);
19 19
 
20 20
 
21
-if(defined('IN_ADMIN') && IN_ADMIN === true) {
21
+if (defined('IN_ADMIN') && IN_ADMIN === true) {
22 22
   lng_include('admin');
23
-} elseif($sys_user_logged_in) {
23
+} elseif ($sys_user_logged_in) {
24 24
   sys_user_vacation($user);
25 25
 
26 26
   $planet_id = SetSelectedPlanet($user);
27 27
 
28 28
   // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
29
-  if($user['ally_id']) {
29
+  if ($user['ally_id']) {
30 30
     sn_db_transaction_start();
31 31
     sn_ali_fill_user_ally($user);
32
-    if(!$user['ally']['player']['id']) {
32
+    if (!$user['ally']['player']['id']) {
33 33
       // sn_sys_logout(false, true);
34 34
       // core_auth::logout(false);
35 35
       classSupernova::$auth->logout(false);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     }
38 38
     // TODO UNCOMMENT
39 39
     que_process($user['ally']['player']);
40
-    db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW);
40
+    db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = '.SN_TIME_NOW);
41 41
     sn_db_transaction_commit();
42 42
   }
43 43
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
   sn_db_transaction_commit();
49 49
 
50 50
   $planetrow = $global_data['planet'];
51
-  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
51
+  if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
52 52
     // sn_sys_logout(false, true);
53 53
     // core_auth::logout(false);
54 54
     classSupernova::$auth->logout(false);
Please login to merge, or discard this patch.
affilates.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * v1 (c) copyright 2010 by Gorlum for http://supernova.ws
9 9
  */
10 10
 
11
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
11
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
12 12
 
13 13
 lng_include('affilates');
14 14
 
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
   $gained += $affilate_gain;
33 33
 }
34 34
 
35
-$bannerURL  = SN_ROOT_VIRTUAL_PARENT . classSupernova::$config->int_banner_URL;
35
+$bannerURL  = SN_ROOT_VIRTUAL_PARENT.classSupernova::$config->int_banner_URL;
36 36
 $bannerURL .= strpos($bannerURL, '?') ? '&' : '?';
37 37
 $bannerURL .= "id={$user['id']}";
38 38
 
39
-$userbarURL  = SN_ROOT_VIRTUAL_PARENT . classSupernova::$config->int_userbar_URL;
39
+$userbarURL  = SN_ROOT_VIRTUAL_PARENT.classSupernova::$config->int_userbar_URL;
40 40
 $userbarURL .= strpos($userbarURL, '?') ? '&' : '?';
41 41
 $userbarURL .= "id={$user['id']}";
42 42
 
Please login to merge, or discard this patch.
search.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
  * @copyright 2008 by ??????? for XNova
11 11
  */
12 12
 
13
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
13
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
14 14
 
15
-if(classSupernova::$config->game_mode == GAME_BLITZ) {
15
+if (classSupernova::$config->game_mode == GAME_BLITZ) {
16 16
   message(classLocale::$lang['sys_blitz_page_disabled'], classLocale::$lang['sys_error'], 'overview.php', 10);
17 17
   die();
18 18
 }
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 
26 26
 $template = gettemplate('search', true);
27 27
 
28
-if($searchtext && $type) {
29
-  switch($type) {
28
+if ($searchtext && $type) {
29
+  switch ($type) {
30 30
     case "planetname":
31 31
       // $search = db_planet_list_search($searchtext);
32 32
     break;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     break;
42 42
   }
43 43
 
44
-  while($row = db_fetch($search)) {
45
-    if($type == 'playername' || $type == 'planetname') {
44
+  while ($row = db_fetch($search)) {
45
+    if ($type == 'playername' || $type == 'planetname') {
46 46
       $template->assign_block_vars('search_result', array(
47 47
         'PLAYER_ID'       => $row['uid'],
48 48
         'PLAYER_NAME'     => htmlentities($row['username'], ENT_COMPAT, 'UTF-8'),
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         'ALLY_NAME'       => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
58 58
         'ALLY_TAG'        => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
59 59
       ));
60
-    } elseif($type == 'ally') {
60
+    } elseif ($type == 'ally') {
61 61
       $template->assign_block_vars('search_result', array(
62 62
         'ALLY_NAME'     => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
63 63
         'ALLY_TAG'      => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
   'ally'       => 'sys_alliance',
76 76
 );
77 77
 
78
-foreach($search_type as $type_id => $type_lang) {
78
+foreach ($search_type as $type_id => $type_lang) {
79 79
   $template->assign_block_vars('type', array(
80 80
     'ID'       => $type_id,
81 81
     'TEXT'     => classLocale::$lang[$type_lang],
Please login to merge, or discard this patch.
officer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  *
12 12
  */
13 13
 
14
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
14
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
15 15
 
16 16
 include("includes/includes/mrc_mercenary.php");
17 17
 
Please login to merge, or discard this patch.
flotenajax.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @copyright 2008 By Chlorel for XNova
15 15
  **/
16 16
 
17
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
17
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
18 18
 
19 19
 define('IN_AJAX', true);
20 20
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
   $target_mission = sys_get_param_int('mission');
40 40
   $sn_group_missions = sn_get_groups('missions');
41
-  if(empty($sn_group_missions[$target_mission]['AJAX'])) {
41
+  if (empty($sn_group_missions[$target_mission]['AJAX'])) {
42 42
     die(classLocale::$lang['gs_c00']);
43 43
   }
44 44
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
   );
54 54
   // fleet_ajax now can send fleets only to existing planets/moons
55 55
   // TODO - sending colonization and expeditions in 1 click
56
-  if(!uni_coordinates_valid($target_coord)) {
56
+  if (!uni_coordinates_valid($target_coord)) {
57 57
     die(classLocale::$lang['gs_c02']);
58 58
   }
59 59
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
   // TODO - DEADLOCK CAN BE HERE!!!! We should lock SOURCE and TARGET owners in one query
66 66
   $target_row = db_planet_by_vector($target_coord);
67
-  if(empty($target_row)) {
67
+  if (empty($target_row)) {
68 68
     $target_row = $target_coord;
69 69
     $target_row['id_owner'] = 0;
70 70
     // If fleet destination is PT_DEBRIS - then it's actually destination is PT_PLANET // TODO - REMOVE! Debris should be valid DESTINATION planet_type!
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
   }
76 76
 
77 77
   $fleet_array = array();
78
-  switch($target_mission) {
78
+  switch ($target_mission) {
79 79
     case MT_SPY:
80 80
       $fleet_array[SHIP_SPY] = min(mrc_get_level($user, $planetrow, SHIP_SPY), abs(classSupernova::$user_options[PLAYER_OPTION_FLEET_SPY_DEFAULT]));
81 81
       $unit_group = 'flt_spies';
82 82
     break;
83 83
 
84 84
     case MT_RECYCLE:
85
-      foreach(sn_get_groups('flt_recyclers') as $unit_id) {
86
-        if($unit_count = mrc_get_level($user, $planetrow, $unit_id)) {
85
+      foreach (sn_get_groups('flt_recyclers') as $unit_id) {
86
+        if ($unit_count = mrc_get_level($user, $planetrow, $unit_id)) {
87 87
           $fleet_array[$unit_id] = $unit_count;
88 88
         }
89 89
       }
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
       'target_structure' => $target_structure = sys_get_param_int('structures'),
109 109
     )
110 110
   );
111
-  if($isAttackAllowed != FLIGHT_ALLOWED) {
111
+  if ($isAttackAllowed != FLIGHT_ALLOWED) {
112 112
     die(classLocale::$lang['fl_attack_error'][$isAttackAllowed]);
113 113
   }
114 114
 
115 115
   $db_changeset = array();
116
-  foreach($fleet_array as $unit_id => $unit_count) {
116
+  foreach ($fleet_array as $unit_id => $unit_count) {
117 117
     $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, -$unit_count, $user, $planetrow);
118 118
   }
119 119
 
120
-  if($target_mission == MT_MISSILE) {
120
+  if ($target_mission == MT_MISSILE) {
121 121
     $distance = abs($target_coord['system'] - $planetrow['system']);
122 122
     $duration = round((30 + (60 * $distance)) / flt_server_flight_speed_multiplier());
123 123
     $arrival = SN_TIME_NOW + $duration;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
   } else {
128 128
     $travel_data = flt_travel_data($user, $planetrow, $target_coord, $fleet_array, 10);
129 129
 
130
-    if($planetrow['deuterium'] < $travel_data['consumption']) {
130
+    if ($planetrow['deuterium'] < $travel_data['consumption']) {
131 131
       die(classLocale::$lang['gs_c13']);
132 132
     }
133 133
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
   $ships_sent = array();
150 150
   $ships_sent_js = 0;
151
-  foreach($fleet_array as $unit_id => $unit_count) {
151
+  foreach ($fleet_array as $unit_id => $unit_count) {
152 152
     $ships_sent[] = "{$unit_count} {$classLocale['tech'][$unit_id]}";
153 153
     $ships_sent_js += mrc_get_level($user, $planetrow, $unit_id, false, true);
154 154
   }
Please login to merge, or discard this patch.
dark_matter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include_once('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(sn_module_get_active_count('payment') && !defined('SN_GOOGLE')) {
5
+if (sn_module_get_active_count('payment') && !defined('SN_GOOGLE')) {
6 6
   sys_redirect('metamatter.php');
7 7
 }
8 8
 
Please login to merge, or discard this patch.
quest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-define('INSIDE'  , true);
11
-define('INSTALL' , false);
10
+define('INSIDE', true);
11
+define('INSTALL', false);
12 12
 
13
-require('common.' . substr(strrchr(__FILE__, '.'), 1));
13
+require('common.'.substr(strrchr(__FILE__, '.'), 1));
14 14
 
15 15
 lng_include('quest');
16 16
 $template = gettemplate('quest', true);
Please login to merge, or discard this patch.