Completed
Push — work-fleets ( abbbcf...8b8b7f )
by SuperNova.WS
05:13
created
includes/general/math.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function geometry_progression_sum($n, $b1, $q) {
4
-  return $q != 1 ? ($b1 * (pow($q, $n) - 1)/($q - 1)) : ($n * $b1);
4
+  return $q != 1 ? ($b1 * (pow($q, $n) - 1) / ($q - 1)) : ($n * $b1);
5 5
 }
6 6
 
7 7
 function sn_floor($value)
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return float|int
45 45
  */
46
-function sn_rand_gauss_range($range_start, $range_end, $round = true, $strict = 4, $cut_extreme = false)  {
47
-  if($cut_extreme) {
46
+function sn_rand_gauss_range($range_start, $range_end, $round = true, $strict = 4, $cut_extreme = false) {
47
+  if ($cut_extreme) {
48 48
     $range_start--;
49 49
     $range_end++;
50 50
   }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 {
61 61
   $args = func_get_args();
62 62
 
63
-  switch(func_num_args())
63
+  switch (func_num_args())
64 64
   {
65 65
     case 0:
66 66
       // trigger_error('median() requires at least one parameter',E_USER_WARNING);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     // fallthrough
73 73
 
74 74
     default:
75
-      if(!is_array($args))
75
+      if (!is_array($args))
76 76
       {
77 77
         // trigger_error('median() requires a list of numbers to operate on or an array of numbers', E_USER_NOTICE);
78 78
         return false;
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
       $n = count($args);
84 84
       $h = intval($n / 2);
85 85
 
86
-      if($n % 2 == 0)
86
+      if ($n % 2 == 0)
87 87
       {
88
-        $median = ($args[$h] + $args[$h-1]) / 2;
88
+        $median = ($args[$h] + $args[$h - 1]) / 2;
89 89
       }
90 90
       else
91 91
       {
@@ -103,47 +103,47 @@  discard block
 block discarded – undo
103 103
 }
104 104
 function linear_calc(&$linear, $from = 0, $debug = false)
105 105
 {
106
-  for($i = $from; $i < count($linear); $i++)
106
+  for ($i = $from; $i < count($linear); $i++)
107 107
   {
108 108
     $eq = &$linear[$i];
109
-    for($j = count($eq) - 1; $j >= $from; $j--)
109
+    for ($j = count($eq) - 1; $j >= $from; $j--)
110 110
     {
111 111
       $eq[$j] /= $eq[$from];
112 112
     }
113 113
   }
114
-  if($debug) pdump($linear, 'Нормализовано по х' . $from);
114
+  if ($debug) pdump($linear, 'Нормализовано по х' . $from);
115 115
 
116
-  for($i = $from + 1; $i < count($linear); $i++)
116
+  for ($i = $from + 1; $i < count($linear); $i++)
117 117
   {
118 118
     $eq = &$linear[$i];
119
-    for($j = count($eq) - 1; $j >= $from; $j--)
119
+    for ($j = count($eq) - 1; $j >= $from; $j--)
120 120
     {
121 121
       $eq[$j] -= $linear[$from][$j];
122 122
     }
123 123
   }
124
-  if($debug) pdump($linear, 'Подставили х' . $from);
124
+  if ($debug) pdump($linear, 'Подставили х' . $from);
125 125
 
126
-  if($from < count($linear) - 1)
126
+  if ($from < count($linear) - 1)
127 127
   {
128 128
     linear_calc($linear, $from + 1, $debug);
129 129
   }
130 130
 
131
-  if($from)
131
+  if ($from)
132 132
   {
133
-    for($i = 0; $i < $from; $i++)
133
+    for ($i = 0; $i < $from; $i++)
134 134
     {
135 135
       $eq = &$linear[$i];
136
-      for($j = count($eq) - 1; $j >= $from; $j--)
136
+      for ($j = count($eq) - 1; $j >= $from; $j--)
137 137
       {
138 138
         $eq[$j] = $eq[$j] - $eq[$from] * $linear[$from][$j];
139 139
       }
140 140
     }
141
-    if($debug) pdump($linear, 'Подставили обратно х' . $from);
141
+    if ($debug) pdump($linear, 'Подставили обратно х' . $from);
142 142
   }
143 143
   else
144 144
   {
145
-    if($debug) pdump($linear, 'Результат' . $from);
146
-    foreach($linear as $index => &$eq)
145
+    if ($debug) pdump($linear, 'Результат' . $from);
146
+    foreach ($linear as $index => &$eq)
147 147
     {
148 148
       pdump($eq[count($linear)], 'x' . $index);
149 149
     }
Please login to merge, or discard this patch.
includes/vars.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
   SNC_VER_ERROR_MISSMATCH_KEY_ID => 'error',
98 98
 );
99 99
 
100
-$tableList = array( 'aks', 'alliance', 'alliance_requests', 'announce', 'annonce', 'banned', 'buddy', 'chat', 'config', 'counter',
100
+$tableList = array('aks', 'alliance', 'alliance_requests', 'announce', 'annonce', 'banned', 'buddy', 'chat', 'config', 'counter',
101 101
   'errors', 'fleets', 'fleet_log', 'galaxy', 'iraks', 'logs', 'log_dark_matter', 'messages', 'notes', 'planets', 'quest',
102 102
   'quest_status', 'referrals', 'rw', 'statpoints', 'users'
103 103
 );
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
 $user_option_list = array();
189 189
 
190 190
 $user_option_list[OPT_MESSAGE] = array();
191
-foreach($sn_message_class_list as $message_class_id => $message_class_data)
191
+foreach ($sn_message_class_list as $message_class_id => $message_class_data)
192 192
 {
193
-  if($message_class_data['switchable'])
193
+  if ($message_class_data['switchable'])
194 194
   {
195 195
     $user_option_list[OPT_MESSAGE]["opt_{$message_class_data['name']}"] = 1;
196 196
   }
197 197
 
198
-  if($message_class_data['email'])
198
+  if ($message_class_data['email'])
199 199
   {
200 200
     $user_option_list[OPT_MESSAGE]["opt_email_{$message_class_data['name']}"] = 0;
201 201
   }
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_HYDROGEN,
779 779
         UNIT_PLANET_DENSITY_RARITY => 30, // 1, // 40.00, // * 1/121 0,82645
780 780
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT,
781
-        UNIT_RESOURCES => array(RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10, ),
781
+        UNIT_RESOURCES => array(RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10,),
782 782
         UNIT_PLANET_DENSITY_MAX_SECTORS => 150,
783 783
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
784 784
       ),
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_METHANE,
788 788
         UNIT_PLANET_DENSITY_RARITY =>  130, // 6, // 6.67, // * 6,0	4,95868
789 789
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD,
790
-        UNIT_RESOURCES => array(RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60, ),
790
+        UNIT_RESOURCES => array(RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60,),
791 791
         UNIT_PLANET_DENSITY_MAX_SECTORS => 200,
792 792
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
793 793
       ),
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_WATER,
797 797
         UNIT_PLANET_DENSITY_RARITY =>  450, //20, // 2.00, // * 20,0	16,52893
798 798
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE,
799
-        UNIT_RESOURCES => array(RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20, ),
799
+        UNIT_RESOURCES => array(RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20,),
800 800
         UNIT_PLANET_DENSITY_MAX_SECTORS => 999,
801 801
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
802 802
       ),
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_RAW,
807 807
         UNIT_PLANET_DENSITY_RARITY => 20, // 1, // 40.00, // *1,0	0,82645
808 808
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT,
809
-        UNIT_RESOURCES => array(RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50, ),
809
+        UNIT_RESOURCES => array(RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50,),
810 810
         UNIT_PLANET_DENSITY_MAX_SECTORS => 150,
811 811
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
812 812
       ),
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_SILICATE,
816 816
         UNIT_PLANET_DENSITY_RARITY => 140, // 5.71, // * 7,0	5,78512
817 817
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD,
818
-        UNIT_RESOURCES => array(RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85, ),
818
+        UNIT_RESOURCES => array(RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85,),
819 819
         UNIT_PLANET_DENSITY_MAX_SECTORS => 200,
820 820
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
821 821
       ),
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_STONE,
825 825
         UNIT_PLANET_DENSITY_RARITY => 500, // 1.90, // * 21,0	17,35537
826 826
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE,
827
-        UNIT_RESOURCES => array(RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95, ),
827
+        UNIT_RESOURCES => array(RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95,),
828 828
         UNIT_PLANET_DENSITY_MAX_SECTORS => 999,
829 829
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
830 830
       ),
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_STANDARD,
835 835
         UNIT_PLANET_DENSITY_RARITY => 1000, // 1.0, // * 40,0	33,05785
836 836
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_NORMAL,
837
-        UNIT_RESOURCES => array(RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00, ),
837
+        UNIT_RESOURCES => array(RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00,),
838 838
         UNIT_PLANET_DENSITY_MAX_SECTORS => 999,
839 839
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
840 840
       ),
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_ORE,
845 845
         UNIT_PLANET_DENSITY_RARITY => 550, // 2.11, // * 19,0	15,70248
846 846
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE,
847
-        UNIT_RESOURCES => array(RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80, ),
847
+        UNIT_RESOURCES => array(RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80,),
848 848
         UNIT_PLANET_DENSITY_MAX_SECTORS => 999,
849 849
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
850 850
       ),
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_PERIDOT,
854 854
         UNIT_PLANET_DENSITY_RARITY => 120, // 8.00, // * 5,0	4,13223
855 855
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD,
856
-        UNIT_RESOURCES => array(RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55, ),
856
+        UNIT_RESOURCES => array(RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55,),
857 857
         UNIT_PLANET_DENSITY_MAX_SECTORS => 200,
858 858
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
859 859
       ),
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
         UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_RAW,
863 863
         UNIT_PLANET_DENSITY_RARITY => 25, // 40.00, // * 1,0	0,82645
864 864
         UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT,
865
-        UNIT_RESOURCES => array(RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25, ),
865
+        UNIT_RESOURCES => array(RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25,),
866 866
         UNIT_PLANET_DENSITY_MAX_SECTORS => 150,
867 867
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
868 868
       ),
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
     ),
993 993
 
994 994
     // Tech list
995
-    'tech'      => array (
995
+    'tech'      => array(
996 996
       TECH_ARMOR => TECH_ARMOR, TECH_WEAPON => TECH_WEAPON, TECH_SHIELD => TECH_SHIELD,
997 997
       TECH_SPY => TECH_SPY, TECH_COMPUTER => TECH_COMPUTER,
998 998
       TECH_ENERGY => TECH_ENERGY, TECH_LASER => TECH_LASER, TECH_ION => TECH_ION, TECH_PLASMA => TECH_PLASMA, TECH_HYPERSPACE => TECH_HYPERSPACE,
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
     ),
1004 1004
 
1005 1005
     // Mercenaries
1006
-    'mercenaries' => array (
1006
+    'mercenaries' => array(
1007 1007
       MRC_STOCKMAN => MRC_STOCKMAN, MRC_SPY => MRC_SPY, MRC_ACADEMIC => MRC_ACADEMIC,
1008 1008
       MRC_ADMIRAL => MRC_ADMIRAL, MRC_COORDINATOR => MRC_COORDINATOR, MRC_NAVIGATOR => MRC_NAVIGATOR,
1009 1009
     ),
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
       SHIP_RECYCLER => SHIP_RECYCLER, SHIP_COLONIZER => SHIP_COLONIZER, SHIP_SPY => SHIP_SPY, SHIP_SATTELITE_SOLAR => SHIP_SATTELITE_SOLAR
1030 1030
      ),
1031 1031
     // Defensive building list
1032
-    'defense'   => array (UNIT_DEF_TURRET_MISSILE => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL,
1032
+    'defense'   => array(UNIT_DEF_TURRET_MISSILE => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL,
1033 1033
                           UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS,
1034 1034
                           UNIT_DEF_TURRET_ION => UNIT_DEF_TURRET_ION, UNIT_DEF_TURRET_PLASMA => UNIT_DEF_TURRET_PLASMA,
1035 1035
 
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
     ),
1040 1040
 
1041 1041
     // Missiles list
1042
-    'missile'   => array (UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET, ),
1042
+    'missile'   => array(UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,),
1043 1043
 
1044 1044
     // Combat units list
1045 1045
     'combat'    => array(
@@ -1079,9 +1079,9 @@  discard block
 block discarded – undo
1079 1079
     ),
1080 1080
 
1081 1081
     // Resource list
1082
-    'resources' => array ( 0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'),
1082
+    'resources' => array(0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'),
1083 1083
     // Resources all
1084
-    'resources_all' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER, ),
1084
+    'resources_all' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER,),
1085 1085
     // Resources can be produced on planet
1086 1086
     'resources_planet' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY),
1087 1087
     // Resources can be looted from planet
@@ -1100,13 +1100,13 @@  discard block
 block discarded – undo
1100 1100
     ),
1101 1101
 
1102 1102
     // Resources that can be tradeable in market trader AND be a quest_rewards
1103
-    'quest_rewards' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER, ),
1103
+    'quest_rewards' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER,),
1104 1104
 
1105 1105
 //      // Ques list
1106 1106
 //      'ques' => array(QUE_STRUCTURES, QUE_HANGAR, QUE_RESEARCH),
1107 1107
 
1108
-    'STAT_COMMON' => array(STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE, ),
1109
-    'STAT_PLAYER' => array(STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID, ),
1108
+    'STAT_COMMON' => array(STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE,),
1109
+    'STAT_PLAYER' => array(STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID,),
1110 1110
   ),
1111 1111
 
1112 1112
   'pages' => array(
Please login to merge, or discard this patch.
includes/vars_menu.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('INSIDE')) {
3
+if (!defined('INSIDE')) {
4 4
   die('Hack attempt!');
5 5
 }
6 6
 
Please login to merge, or discard this patch.
includes/db/db_queries_planets.php 1 patch
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@  discard block
 block discarded – undo
23 23
   $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0;
24 24
   $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0;
25 25
   $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0;
26
-  $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) :
27
-    (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0);
26
+  $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0);
28 27
   $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type;
29 28
 
30 29
   return db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields);
@@ -32,14 +31,14 @@  discard block
 block discarded – undo
32 31
 function db_planet_by_parent($parent_id, $for_update = false, $fields = '*')
33 32
 {
34 33
   //if(!($parent_id = intval($parent_id))) return false;
35
-  if(!($parent_id = idval($parent_id))) return false;
34
+  if (!($parent_id = idval($parent_id))) return false;
36 35
   return classSupernova::db_get_record_list(LOC_PLANET,
37 36
     "`parent_planet` = {$parent_id} AND `planet_type` = " . PT_MOON, true);
38 37
 }
39 38
 function db_planet_by_id_and_owner($planet_id, $owner_id, $for_update = false, $fields = '*')
40 39
 {
41 40
   //if(!($planet_id = intval($planet_id)) || !($owner_id = intval($owner_id))) return false;
42
-  if(!($planet_id = idval($planet_id)) || !($owner_id = idval($owner_id))) return false;
41
+  if (!($planet_id = idval($planet_id)) || !($owner_id = idval($owner_id))) return false;
43 42
   return classSupernova::db_get_record_list(LOC_PLANET,
44 43
     "`id` = {$planet_id} AND `id_owner` = {$owner_id}", true);
45 44
 }
@@ -48,7 +47,7 @@  discard block
 block discarded – undo
48 47
 function db_planet_list_moon_other($user_id, $this_moon_id)
49 48
 {
50 49
   // if(!($user_id = intval($user_id)) || !($this_moon_id = intval($this_moon_id))) return false;
51
-  if(!($user_id = idval($user_id)) || !($this_moon_id = idval($this_moon_id))) return false;
50
+  if (!($user_id = idval($user_id)) || !($this_moon_id = idval($this_moon_id))) return false;
52 51
   return classSupernova::db_get_record_list(LOC_PLANET,
53 52
     "`planet_type` = " . PT_MOON . " AND `id_owner` = {$user_id} AND `id` != {$this_moon_id}");
54 53
 }
@@ -61,7 +60,7 @@  discard block
 block discarded – undo
61 60
 }
62 61
 
63 62
 function db_planet_list_sorted($user_row, $skip_planet_id = false, $field_list = '', $conditions = '') {
64
-  if(!is_array($user_row)) return false;
63
+  if (!is_array($user_row)) return false;
65 64
   // $field_list = $field_list != '*' ? "{{planets}}.`id`, `name`, `image`, {{planets}}.`galaxy`, {{planets}}.`system`, {{planets}}.`planet`, `planet_type`{$field_list}" : $field_list;
66 65
   $conditions .= $skip_planet_id ? " AND `id` <> {$skip_planet_id} " : '';
67 66
 
@@ -80,7 +79,7 @@  discard block
 block discarded – undo
80 79
     "`id_owner` = '{$user_row['id']}' {$conditions} ORDER BY {$order_by}");
81 80
 }
82 81
 function db_planet_list_by_user_or_planet($user_id, $planet_id) {
83
-  if(!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) return false;
82
+  if (!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) return false;
84 83
 
85 84
   return classSupernova::db_get_record_list(LOC_PLANET,
86 85
     $planet_id = idval($planet_id) ? "{{planets}}.`id` = {$planet_id}" : "`id_owner` = {$user_id}", $planet_id);
@@ -89,12 +88,12 @@  discard block
 block discarded – undo
89 88
 function db_planet_set_by_id($planet_id, $set)
90 89
 {
91 90
   // if(!($planet_id = intval($planet_id))) return false;
92
-  if(!($planet_id = idval($planet_id))) return false;
91
+  if (!($planet_id = idval($planet_id))) return false;
93 92
   return classSupernova::db_upd_record_by_id(LOC_PLANET, $planet_id, $set);
94 93
 }
95 94
 function db_planet_set_by_gspt($ui_galaxy, $ui_system, $ui_planet, $ui_planet_type = PT_ALL, $set)
96 95
 {
97
-  if(!($set = trim($set))) return false;
96
+  if (!($set = trim($set))) return false;
98 97
 
99 98
   $si_galaxy = intval($ui_galaxy);
100 99
   $si_system = intval($ui_system);
@@ -106,13 +105,13 @@  discard block
 block discarded – undo
106 105
 function db_planet_set_by_parent($ui_parent_id, $ss_set)
107 106
 {
108 107
   //if(!($si_parent_id = intval($ui_parent_id)) || !($ss_set = trim($ss_set))) return false;
109
-  if(!($si_parent_id = idval($ui_parent_id)) || !($ss_set = trim($ss_set))) return false;
108
+  if (!($si_parent_id = idval($ui_parent_id)) || !($ss_set = trim($ss_set))) return false;
110 109
   return classSupernova::db_upd_record_list(LOC_PLANET, "`parent_planet` = {$si_parent_id}", $ss_set);
111 110
 }
112 111
 function db_planet_set_by_owner($ui_owner_id, $ss_set)
113 112
 {
114 113
   //if(!($si_owner_id = intval($ui_owner_id)) || !($ss_set = trim($ss_set))) return false;
115
-  if(!($si_owner_id = idval($ui_owner_id)) || !($ss_set = trim($ss_set))) return false;
114
+  if (!($si_owner_id = idval($ui_owner_id)) || !($ss_set = trim($ss_set))) return false;
116 115
   return classSupernova::db_upd_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}", $ss_set);
117 116
 }
118 117
 
@@ -120,7 +119,7 @@  discard block
 block discarded – undo
120 119
 function db_planet_delete_by_id($planet_id)
121 120
 {
122 121
   // if(!($planet_id = intval($planet_id))) return false;
123
-  if(!($planet_id = idval($planet_id))) return false;
122
+  if (!($planet_id = idval($planet_id))) return false;
124 123
   classSupernova::db_del_record_by_id(LOC_PLANET, $planet_id);
125 124
   classSupernova::db_del_record_list(LOC_UNIT, "`unit_location_type` = " . LOC_PLANET . " AND `unit_location_id` = " . $planet_id);
126 125
   // Очереди очистятся автоматически по FOREIGN KEY
@@ -129,7 +128,7 @@  discard block
 block discarded – undo
129 128
 function db_planet_list_delete_by_owner($ui_owner_id)
130 129
 {
131 130
   // if(!($si_owner_id = intval($ui_owner_id))) return false;
132
-  if(!($si_owner_id = idval($ui_owner_id))) return false;
131
+  if (!($si_owner_id = idval($ui_owner_id))) return false;
133 132
   classSupernova::db_del_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}");
134 133
   classSupernova::db_del_record_list(LOC_UNIT, "`unit_location_type` = " . LOC_PLANET . " AND `unit_player_id` = " . $si_owner_id);
135 134
   // Очереди очистятся автоматически по FOREIGN KEY
Please login to merge, or discard this patch.
includes/db/db_queries_unit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     'GROUP BY `unit_snid`'
27 27
   );
28 28
   $result = array();
29
-  while($row = db_fetch($query)) {
29
+  while ($row = db_fetch($query)) {
30 30
     $result[$row['unit_snid']] = $row;
31 31
   }
32 32
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_mail.inc 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 
18 18
 $lang['r_list'] = "<option value=\"-1\">{$lang['All_players']}</option>";
19 19
 if ($ranks) {
20
-  foreach($ranks as $id => $array) {
21
-    $lang['r_list'] .= "<option value=\"" . $id  . "\">" . $array['name'] . "</option>";
20
+  foreach ($ranks as $id => $array) {
21
+    $lang['r_list'] .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>";
22 22
   }
23 23
 }
24 24
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_rights.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $new_rank_name = sys_get_param_str('newRankName');
15 15
 if ($new_rank_name)
16 16
 {
17
-  foreach($ally_rights as $fieldName)
17
+  foreach ($ally_rights as $fieldName)
18 18
   {
19 19
     $newRank[$fieldName] = 0;
20 20
   }
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 {
29 29
   unset($ranks);
30 30
 
31
-  foreach($rankListInput as $rankID => $rank)
31
+  foreach ($rankListInput as $rankID => $rank)
32 32
   {
33
-    foreach($ally_rights as $rightName)
33
+    foreach ($ally_rights as $rightName)
34 34
     {
35 35
       $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0;
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $d = sys_get_param_int('d');
42 42
 if ($d && isset($ranks[$d]))
43 43
 {
44
-  if(count($ranks) == 1)
44
+  if (count($ranks) == 1)
45 45
   {
46 46
     message($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']);
47 47
   }
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 
54 54
 if (count($ranks))
55 55
 {
56
-  foreach($ranks as $rankID => $rank)
56
+  foreach ($ranks as $rankID => $rank)
57 57
   {
58 58
     $rank_data = array(
59 59
       'ID'   => $rankID,
60 60
       'NAME' => $rank['name'],
61 61
     );
62 62
 
63
-    for($i = 1; $i < count($rank); $i++)
63
+    for ($i = 1; $i < count($rank); $i++)
64 64
     {
65
-      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ;
65
+      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '');
66 66
       $rank_data['N' . $i] = $ally_rights[$i];
67 67
     }
68 68
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_members.inc 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 */
11 11
 // Changing rank for single user
12 12
 $id_user = sys_get_param_id('id_user');
13
-if(isset($_GET['id_rank']))
13
+if (isset($_GET['id_rank']))
14 14
 {
15 15
   $id_rank = sys_get_param_int('id_rank');
16 16
 }
17
-if($id_user && isset($id_rank) && $user_admin){
17
+if ($id_user && isset($id_rank) && $user_admin) {
18 18
   db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}");
19 19
 }
20 20
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 $sort1 = sys_get_param_int('sort1');
45
-if($sort1>5 || $sort1<0) $sort1 = 0;
45
+if ($sort1 > 5 || $sort1 < 0) $sort1 = 0;
46 46
 $sort1s = array(
47 47
   0 => '`ally_rank_id` %1$s;',
48 48
   1 => '`username` %1$s;',
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
   'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points');
59 59
 
60 60
 // while ($userRow = db_fetch($userList))
61
-foreach($userList as $userRow)
61
+foreach ($userList as $userRow)
62 62
 {
63 63
   $i++;
64 64
   if (!isset($ranks[$userRow['ally_rank_id']]))
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 
69 69
   if ($ally['ally_owner'] == $userRow['id'])
70 70
   {
71
-    $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:$lang['Founder'];
71
+    $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : $lang['Founder'];
72 72
   }
73 73
   else
74 74
   {
75
-    if($user_admin)
75
+    if ($user_admin)
76 76
     {
77 77
       $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">';
78 78
 
79
-      foreach($ranks as $rankID => $rankArray){
79
+      foreach ($ranks as $rankID => $rankArray) {
80 80
         $ally_range .= '<option value="' . $rankID . '"';
81
-        if($rankID == $userRow['ally_rank_id'])
81
+        if ($rankID == $userRow['ally_rank_id'])
82 82
           $ally_range .= " selected";
83 83
         $ally_range .= '>' . $rankArray['name'];
84 84
         $ally_range .= '</option>';
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
   }
93 93
 
94 94
   $last_active = time() - $userRow["onlinetime"];
95
-  if($user_admin)
95
+  if ($user_admin)
96 96
   {
97
-    if ( $last_active < 60 )
97
+    if ($last_active < 60)
98 98
     {
99 99
       $tmp = "lime>{$lang['On']}";
100 100
     }
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
     }
106 106
     elseif ($last_active < 60 * 60 * 24)
107 107
     {
108
-      $last_active = round( $last_active / (60 * 60));
108
+      $last_active = round($last_active / (60 * 60));
109 109
       $tmp = "green>{$last_active} {$lang['sys_hrs_short']}";
110 110
     }
111 111
     else
112 112
     {
113
-      $last_active = round( $last_active / (60 * 60 * 24));
113
+      $last_active = round($last_active / (60 * 60 * 24));
114 114
       if ($last_active < 7)
115 115
       {
116 116
         $tmp = "yellow";
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
   }
129 129
   else
130 130
   {
131
-    if($user_onlinestatus)
131
+    if ($user_onlinestatus)
132 132
     {
133
-      if ( $last_active < 60 * 5 )
133
+      if ($last_active < 60 * 5)
134 134
       {
135 135
         $tmp = "lime>{$lang['On']}";
136 136
       }
Please login to merge, or discard this patch.
includes/alliance/ali_external_request.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     header('Location: alliance.php');
21 21
   }
22 22
 
23
-  if($user_request['request_denied'])
23
+  if ($user_request['request_denied'])
24 24
   {
25 25
     $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']);
26 26
   }
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true);
44 44
 
45
-if(!$ally)
45
+if (!$ally)
46 46
 {
47 47
   message($lang['ali_sys_notFound'], $lang['ali_req_title']);
48 48
 }
49 49
 
50
-if($ally['ally_request_notallow'])
50
+if ($ally['ally_request_notallow'])
51 51
 {
52 52
   message($lang['ali_req_not_allowed'], $lang['ali_req_title']);
53 53
 }
Please login to merge, or discard this patch.