Passed
Push — trunk ( 80fb95...9d93ee )
by SuperNova.WS
03:54
created
admin/adm_planet_list.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-define('INSIDE'  , true);
4
-define('INSTALL' , false);
3
+define('INSIDE', true);
4
+define('INSTALL', false);
5 5
 define('IN_ADMIN', true);
6 6
 
7 7
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR);
12 12
 
13 13
 $planet_active = sys_get_param_int('planet_active');
14
-if(!$planet_active) {
14
+if (!$planet_active) {
15 15
   $planet_type = sys_get_param_int('planet_type', 1);
16 16
   $planet_type = $planet_type == 3 ? 3 : 1;
17 17
 } else {
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 $page_title = 
42 42
   $lang['adm_planet_list_title'] . ': ' . 
43
-  ($planet_active ? $lang['adm_planet_active'] :
44
-    ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '')
43
+  ($planet_active ? $lang['adm_planet_active'] : ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '')
45 44
   );
46 45
 $template->assign_vars(array(
47 46
   'PAGE_TITLE' => $page_title,
Please login to merge, or discard this patch.
admin/statbuilder.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@
 block discarded – undo
37 37
   </script>';
38 38
 
39 39
   messageBoxAdmin("{$script}<img src=\"design/images/progressbar.gif\"><br>{$lang['sys_wait']}", $lang['adm_stat_title'], '', 0);
40
-}
41
-else
40
+} else
42 41
 {
43 42
   messageBoxAdmin($lang['adm_stat_already_started'], $lang['adm_stat_title'], 'admin/overview.php');
44 43
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
  * @copyright 2008 by Chlorel for XNova
10 10
  */
11 11
 
12
-define('INSIDE'  , true);
13
-define('INSTALL' , false);
12
+define('INSIDE', true);
13
+define('INSTALL', false);
14 14
 define('IN_ADMIN', true);
15 15
 require_once('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR);
20 20
 
21
-if(SN_TIME_NOW >= SN::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= SN::$config->db_loadItem('var_stat_update_end'))
21
+if (SN_TIME_NOW >= SN::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= SN::$config->db_loadItem('var_stat_update_end'))
22 22
 {
23 23
   SN::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120);
24 24
 
Please login to merge, or discard this patch.
classes/OldDbChangeSet.php 2 patches
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@  discard block
 block discarded – undo
23 23
    * @return array
24 24
    * @deprecated
25 25
    */
26
-  public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null)
27
-  {
26
+  public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null) {
28 27
     if(!is_array($user))
29 28
     {
30 29
       // TODO - remove later
@@ -61,8 +60,7 @@  discard block
 block discarded – undo
61 60
           ),
62 61
         ),
63 62
       );
64
-    }
65
-    else
63
+    } else
66 64
     {
67 65
       $db_changeset = array(
68 66
         'action' => SQL_OP_INSERT,
@@ -176,14 +174,21 @@  discard block
 block discarded – undo
176 174
    */
177 175
   public static function db_changeset_apply($db_changeset) {
178 176
     $result = true;
179
-    if(!is_array($db_changeset) || empty($db_changeset)) return $result;
177
+    if(!is_array($db_changeset) || empty($db_changeset)) {
178
+      return $result;
179
+    }
180 180
 
181 181
     foreach($db_changeset as $table_name => &$table_data) {
182 182
       foreach($table_data as $record_id => &$conditions) {
183 183
         OldDbChangeSet::db_changeset_condition_compile($conditions, $table_name);
184 184
 
185
-        if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue;
186
-        if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице
185
+        if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) {
186
+          continue;
187
+        }
188
+        if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) {
189
+          continue;
190
+        }
191
+        // Защита от случайного удаления всех данных в таблице
187 192
 
188 193
         if($conditions[P_LOCATION] != LOC_NONE) {
189 194
           switch($conditions['action'])
Please login to merge, or discard this patch.
Spacing   +24 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
    */
26 26
   public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null)
27 27
   {
28
-    if(!is_array($user))
28
+    if (!is_array($user))
29 29
     {
30 30
       // TODO - remove later
31 31
       print('<h1>СООБЩИТЕ ЭТО АДМИНУ: OldDbChangeSet::db_changeset_prepare_unit() - USER is not ARRAY</h1>');
32 32
       pdump(debug_backtrace());
33 33
       die('USER is not ARRAY');
34 34
     }
35
-    if(!isset($user['id']) || !$user['id'])
35
+    if (!isset($user['id']) || !$user['id'])
36 36
     {
37 37
       // TODO - remove later
38 38
       print('<h1>СООБЩИТЕ ЭТО АДМИНУ: OldDbChangeSet::db_changeset_prepare_unit() - USER[id] пустой</h1>');
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     $location_id = $location_id ? $location_id : 'NULL';
48 48
 
49 49
     $temp = DBStaticUnit::db_unit_by_location($user['id'], $unit_location, $location_id, $unit_id);
50
-    if(!empty($temp['unit_id']))
50
+    if (!empty($temp['unit_id']))
51 51
     {
52 52
       $db_changeset = array(
53 53
         'action' => SQL_OP_UPDATE,
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
   }
94 94
 
95 95
   public static function db_changeset_condition_compile(&$conditions, &$table_name = '') {
96
-    if(!$conditions[P_LOCATION] || $conditions[P_LOCATION] == LOC_NONE) {
96
+    if (!$conditions[P_LOCATION] || $conditions[P_LOCATION] == LOC_NONE) {
97 97
       $conditions[P_LOCATION] = LOC_NONE;
98
-      switch($table_name) {
98
+      switch ($table_name) {
99 99
         case 'users':
100 100
         case LOC_USER:
101 101
           $conditions[P_TABLE_NAME] = $table_name = 'users';
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
     }
118 118
 
119 119
     $conditions[P_FIELDS_STR] = '';
120
-    if($conditions['fields']) {
120
+    if ($conditions['fields']) {
121 121
       $fields = array();
122
-      foreach($conditions['fields'] as $field_name => $field_data) {
122
+      foreach ($conditions['fields'] as $field_name => $field_data) {
123 123
         $condition = "`{$field_name}` = ";
124 124
         $value = '';
125
-        if($field_data['delta']) {
125
+        if ($field_data['delta']) {
126 126
           $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
127
-        } elseif($field_data['set']) {
128
-          $value = (is_string($field_data['set']) ? "'{$field_data['set']}'": $field_data['set']);
127
+        } elseif ($field_data['set']) {
128
+          $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
129 129
         }
130 130
 
131
-        if($value) {
131
+        if ($value) {
132 132
           $fields[] = $condition . $value;
133 133
         }
134 134
       }
@@ -136,16 +136,14 @@  discard block
 block discarded – undo
136 136
     }
137 137
 
138 138
     $conditions[P_WHERE_STR] = '';
139
-    if(!empty($conditions['where'])) {
140
-      if($conditions[P_VERSION] == 1) {
139
+    if (!empty($conditions['where'])) {
140
+      if ($conditions[P_VERSION] == 1) {
141 141
         $the_conditions = array();
142
-        foreach($conditions['where'] as $field_id => $field_value) {
142
+        foreach ($conditions['where'] as $field_id => $field_value) {
143 143
           // Простое условие - $field_id = $field_value
144
-          if(is_string($field_id)) {
144
+          if (is_string($field_id)) {
145 145
             $field_value =
146
-              $field_value === null ? 'NULL' :
147
-                (is_string($field_value) ? "'" . db_escape($field_value) . "'" :
148
-                  (is_bool($field_value) ? intval($field_value) : $field_value));
146
+              $field_value === null ? 'NULL' : (is_string($field_value) ? "'" . db_escape($field_value) . "'" : (is_bool($field_value) ? intval($field_value) : $field_value));
149 147
             $the_conditions[] = "`{$field_id}` = {$field_value}";
150 148
           } else {
151 149
             die('Неподдерживаемый тип условия');
@@ -157,7 +155,7 @@  discard block
 block discarded – undo
157 155
       $conditions[P_WHERE_STR] = implode(' AND ', $the_conditions);
158 156
     }
159 157
 
160
-    switch($conditions['action']) {
158
+    switch ($conditions['action']) {
161 159
       case SQL_OP_DELETE: $conditions[P_ACTION_STR] = ("DELETE FROM {{{$table_name}}}"); break;
162 160
       case SQL_OP_UPDATE: $conditions[P_ACTION_STR] = ("UPDATE {{{$table_name}}} SET"); break;
163 161
       case SQL_OP_INSERT: $conditions[P_ACTION_STR] = ("INSERT INTO {{{$table_name}}} SET"); break;
@@ -176,17 +174,17 @@  discard block
 block discarded – undo
176 174
    */
177 175
   public static function db_changeset_apply($db_changeset) {
178 176
     $result = true;
179
-    if(!is_array($db_changeset) || empty($db_changeset)) return $result;
177
+    if (!is_array($db_changeset) || empty($db_changeset)) return $result;
180 178
 
181
-    foreach($db_changeset as $table_name => &$table_data) {
182
-      foreach($table_data as $record_id => &$conditions) {
179
+    foreach ($db_changeset as $table_name => &$table_data) {
180
+      foreach ($table_data as $record_id => &$conditions) {
183 181
         OldDbChangeSet::db_changeset_condition_compile($conditions, $table_name);
184 182
 
185
-        if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue;
186
-        if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице
183
+        if ($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue;
184
+        if ($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице
187 185
 
188
-        if($conditions[P_LOCATION] != LOC_NONE) {
189
-          switch($conditions['action'])
186
+        if ($conditions[P_LOCATION] != LOC_NONE) {
187
+          switch ($conditions['action'])
190 188
           {
191 189
             case SQL_OP_DELETE: $result = SN::db_del_record_list($conditions[P_LOCATION], $conditions[P_WHERE_STR]) && $result; break;
192 190
             case SQL_OP_UPDATE: $result = SN::db_upd_record_list($conditions[P_LOCATION], $conditions[P_WHERE_STR], $conditions[P_FIELDS_STR]) && $result; break;
Please login to merge, or discard this patch.
classes/Core/Watchdog.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     $configValue = $forceLoad ? $this->config->db_loadItem($configName) : $this->config[$configName];
36 36
     $configType == WATCHDOG_TIME_SQL ? $configValue = strtotime($configValue, SN_TIME_NOW) : false;
37 37
 
38
-    if(SN_TIME_NOW - $configValue > $timeDiff) {
38
+    if (SN_TIME_NOW - $configValue > $timeDiff) {
39 39
       $callable();
40 40
     }
41 41
 
Please login to merge, or discard this patch.
classes/classPersistent.php 2 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     $this->db_saveItem(array_combine(array_keys($this->defaults), array_fill(0, count($this->defaults), null)));
92 92
   }
93 93
 
94
-  public function db_saveItem($item_list, $value = NULL) {
94
+  public function db_saveItem($item_list, $value = null) {
95 95
     if(empty($item_list)) {
96 96
       return;
97 97
     }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     $qry = array();
103 103
     foreach($item_list as $item_name => $item_value) {
104 104
       if($item_name) {
105
-        $item_value = db_escape($item_value === NULL ? $this->$item_name : $item_value);
105
+        $item_value = db_escape($item_value === null ? $this->$item_name : $item_value);
106 106
         $item_name = db_escape($item_name);
107 107
         $qry[] = "('{$item_name}', '{$item_value}')";
108 108
       }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     $this->sql_index_field = "{$table_name}_name";
34 34
     $this->sql_value_field = "{$table_name}_value";
35 35
 
36
-    if(!$this->_DB_LOADED) {
36
+    if (!$this->_DB_LOADED) {
37 37
       $this->db_loadAll();
38 38
     }
39 39
   }
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
    */
54 54
   public function db_loadItem($index) {
55 55
     $result = null;
56
-    if($index) {
56
+    if ($index) {
57 57
       $index_safe = db_escape($index);
58 58
       $queryResult = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true);
59
-      if(is_array($queryResult) && !empty($queryResult)) {
59
+      if (is_array($queryResult) && !empty($queryResult)) {
60 60
         $this->$index = $result = $queryResult[$this->sql_value_field];
61 61
       }
62 62
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     $this->loadDefaults();
69 69
 
70 70
     $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;");
71
-    while($row = db_fetch($query)) {
71
+    while ($row = db_fetch($query)) {
72 72
       $this->$row[$this->sql_index_field] = $row[$this->sql_value_field];
73 73
     }
74 74
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
   }
77 77
 
78 78
   public function loadDefaults() {
79
-    foreach($this->defaults as $defName => $defValue) {
79
+    foreach ($this->defaults as $defName => $defValue) {
80 80
       $this->$defName = $defValue;
81 81
     }
82 82
   }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
   }
93 93
 
94 94
   public function db_saveItem($item_list, $value = NULL) {
95
-    if(empty($item_list)) {
95
+    if (empty($item_list)) {
96 96
       return;
97 97
     }
98 98
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 
101 101
     // Сначала записываем данные в базу - что бы поймать все блокировки
102 102
     $qry = array();
103
-    foreach($item_list as $item_name => $item_value) {
104
-      if($item_name) {
103
+    foreach ($item_list as $item_name => $item_value) {
104
+      if ($item_name) {
105 105
         $item_value = db_escape($item_value === NULL ? $this->$item_name : $item_value);
106 106
         $item_name = db_escape($item_name);
107 107
         $qry[] = "('{$item_name}', '{$item_value}')";
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
     doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";");
111 111
 
112 112
     // И только после взятия блокировок - меняем значения в кэше
113
-    foreach($item_list as $item_name => $item_value) {
114
-      if($item_name && $item_value !== null) {
113
+    foreach ($item_list as $item_name => $item_value) {
114
+      if ($item_name && $item_value !== null) {
115 115
         $this->__set($item_name, $item_value);
116 116
       }
117 117
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
   }
127 127
 
128 128
   public function __get($name) {
129
-    if($this->force) {
129
+    if ($this->force) {
130 130
       $this->force = false;
131 131
       $this->db_loadItem($name);
132 132
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
   }
136 136
 
137 137
   public function __set($name, $value) {
138
-    if($this->force) {
138
+    if ($this->force) {
139 139
       $this->force = false;
140 140
       $this->db_saveItem($name, $value);
141 141
     }
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
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 global $lang, $debug;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
6 6
 {
7 7
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
8 8
 }
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 if ($new_rank_name = sys_get_param_str('newRankName'))
17 17
 {
18
-  foreach($ally_rights as $fieldName)
18
+  foreach ($ally_rights as $fieldName)
19 19
   {
20 20
     $newRank[$fieldName] = 0;
21 21
   }
@@ -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
     messageBox($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/functions/_deprecated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
  * @return mixed
14 14
  * @deprecated
15 15
  */
16
-function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false){return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result));}
16
+function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false) {return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result)); }
17 17
 /**
18 18
  * @param array $fleet_row
19 19
  * @param bool  $start
Please login to merge, or discard this patch.
includes/pages/chat.php 2 patches
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-function sn_chat_model()
8
-{
7
+function sn_chat_model() {
9 8
   global $config, $user, $template_result, $lang;
10 9
 
11 10
   $config->array_set('users', $user['id'], 'chat_last_activity', SN_TIME_MICRO);
@@ -44,15 +43,13 @@  discard block
 block discarded – undo
44 43
 
45 44
   $template_result['PAGE_HEADER'] = $page_title;
46 45
 }
47
-function sn_chat_view($template = null)
48
-{
46
+function sn_chat_view($template = null) {
49 47
   $template = gettemplate('chat_body', $template);
50 48
 
51 49
   return $template;
52 50
 }
53 51
 
54
-function sn_chat_add_model()
55
-{
52
+function sn_chat_add_model() {
56 53
   global $config, $user;
57 54
 
58 55
   define('IN_AJAX', true);
@@ -76,8 +73,7 @@  discard block
 block discarded – undo
76 73
 
77 74
   die();
78 75
 }
79
-function sn_chat_msg_view($template = null)
80
-{
76
+function sn_chat_msg_view($template = null) {
81 77
   global $config, $user, $lang;
82 78
 
83 79
   define('IN_AJAX', true);
@@ -99,8 +95,7 @@  discard block
 block discarded – undo
99 95
       'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')),
100 96
       'DISABLE' => true,
101 97
     );
102
-  }
103
-  else
98
+  } else
104 99
   {
105 100
     $alliance = sys_get_param_str('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
106 101
 
@@ -121,8 +116,7 @@  discard block
 block discarded – undo
121 116
       }
122 117
 
123 118
       $page = min($page_count, max(0, sys_get_param_int('sheet')));
124
-    }
125
-    else
119
+    } else
126 120
     {
127 121
       $last_message = sys_get_param_id('last_message');
128 122
       $where_add = $last_message ? "AND `messageid` > {$last_message}" : '';
@@ -171,8 +165,7 @@  discard block
 block discarded – undo
171 165
   {
172 166
     $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}";
173 167
     display($template, $pageTitle);
174
-  }
175
-  else
168
+  } else
176 169
   {
177 170
     $result['last_message'] = $last_message;
178 171
     $result['html'] = templateRenderToHtml($template);
Please login to merge, or discard this 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
   $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS;
15 15
 
16 16
   $mode = sys_get_param_int('mode');
17
-  switch($mode)
17
+  switch ($mode)
18 18
   {
19 19
     case CHAT_MODE_ALLY:
20 20
       $template_result['ALLY'] = intval($user['ally_id']);
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
   }
29 29
 
30 30
   $template_result['.']['smiles'] = array();
31
-  foreach(SN::$gc->design->getSmilesList() as $auth_level => $replaces) {
32
-    if($auth_level > $user_auth_level) {
31
+  foreach (SN::$gc->design->getSmilesList() as $auth_level => $replaces) {
32
+    if ($auth_level > $user_auth_level) {
33 33
       continue;
34 34
     }
35 35
 
36
-    foreach($replaces as $bbcode => $filename)
36
+    foreach ($replaces as $bbcode => $filename)
37 37
     {
38 38
       $template_result['.']['smiles'][] = array(
39 39
         'BBCODE' => $bbcode,
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 
58 58
   define('IN_AJAX', true);
59 59
 
60
-  if($config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
60
+  if ($config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
61 61
   {
62 62
     die();
63 63
   }
64 64
 
65
-  if(($message = sys_get_param_str('message')) && $user['username'])
65
+  if (($message = sys_get_param_str('message')) && $user['username'])
66 66
   {
67 67
     $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
68 68
     $nick = db_escape(player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id))));
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
   define('IN_AJAX', true);
88 88
 
89 89
   $history = sys_get_param_str('history');
90
-  if(!$history)
90
+  if (!$history)
91 91
   {
92 92
     $config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO);
93 93
   }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
   $last_message = '';
97 97
   $alliance = 0;
98 98
   $template_result['.']['chat'] = array();
99
-  if(!$history && $config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
99
+  if (!$history && $config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
100 100
   {
101 101
     $result['disable'] = true;
102 102
     $template_result['.']['chat'][] = array(
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 
113 113
     $where_add = '';
114 114
     $last_message = 0;
115
-    if($history)
115
+    if ($history)
116 116
     {
117 117
       $rows = doquery("SELECT count(1) AS CNT FROM {{chat}} WHERE ally_id = '{$alliance}';", true);
118 118
       $page_count = ceil($rows['CNT'] / $page_limit);
119 119
 
120
-      for($i = 0; $i < $page_count; $i++)
120
+      for ($i = 0; $i < $page_count; $i++)
121 121
       {
122 122
         $template_result['.']['page'][] = array(
123 123
           'NUMBER' => $i
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         {{chat}} AS c
140 140
         LEFT JOIN {{users}} AS u ON u.id = c.chat_message_sender_id
141 141
       WHERE c.chat_message_recipient_id IS NULL AND c.ally_id = '{$alliance}' {$where_add} ORDER BY messageid DESC LIMIT {$start_row}, {$page_limit};");
142
-    while($chat_row = db_fetch($query))
142
+    while ($chat_row = db_fetch($query))
143 143
     {
144 144
       // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick
145 145
       $chat_row['user'] = player_nick_render_to_html($chat_row['user']);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
   $template = gettemplate('chat_messages', $template);
169 169
   $template->assign_recursive($template_result);
170 170
 
171
-  if($history)
171
+  if ($history)
172 172
   {
173 173
     $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}";
174 174
     display($template, $pageTitle);
Please login to merge, or discard this patch.
classes/HelperArray.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
    * @return array
241 241
    */
242 242
   public static function parseParamStrings($array, $delimiter = '=') {
243
-    !is_array($array) ? $array = array((string)$array) : false;
243
+    !is_array($array) ? $array = array((string) $array) : false;
244 244
 
245 245
     $result = array();
246 246
     foreach ($array as $param) {
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
    * @return float|null
263 263
    */
264 264
   public static function maxValueByField(&$array, $fieldName) {
265
-    return array_reduce($array, function ($carry, $item) use ($fieldName) {
266
-      if(is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
265
+    return array_reduce($array, function($carry, $item) use ($fieldName) {
266
+      if (is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
267 267
         $carry = $item[$fieldName];
268 268
       }
269 269
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 
281 281
     return
282 282
       array_reduce($array,
283
-        function ($carry, $item) use (&$fieldName, $maxValue) {
284
-          if(is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
283
+        function($carry, $item) use (&$fieldName, $maxValue) {
284
+          if (is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
285 285
             $carry[] = $item;
286 286
           }
287 287
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
   }
293 293
 
294 294
   public static function intersectByKeys(array &$array1, array &$array2) {
295
-    return array_uintersect_assoc($array1, $array2, function ($a, $b) {return 0;});
295
+    return array_uintersect_assoc($array1, $array2, function($a, $b) {return 0; });
296 296
   }
297 297
 
298 298
 }
Please login to merge, or discard this patch.