Completed
Push — work-fleets ( 961997...006942 )
by SuperNova.WS
06:22
created
classes/V2Fleet/V2FleetModel.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 
8 8
 use Common\V2Location;
9 9
 use DBStatic\DBStaticFleetACS;
10
-use V2Unit\V2UnitList;
11 10
 use Vector\Vector;
12 11
 use Entity\KeyedModel;
13 12
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -213,7 +213,7 @@
 block discarded – undo
213 213
   /**
214 214
    * @param int|string $dbId
215 215
    *
216
-   * @return V2FleetContainer|false
216
+   * @return V2FleetContainer
217 217
    */
218 218
   public function loadById($dbId) {
219 219
     /**
Please login to merge, or discard this patch.
classes/Account.php 1 patch
Doc Comments   +21 added lines patch added patch discarded remove patch
@@ -171,6 +171,10 @@  discard block
 block discarded – undo
171 171
    * @return bool
172 172
    */
173 173
   // OK v4.5
174
+
175
+  /**
176
+   * @param string $account_name_unsafe
177
+   */
174 178
   public function db_get_by_name($account_name_unsafe) {
175 179
     $this->reset();
176 180
 
@@ -207,6 +211,11 @@  discard block
 block discarded – undo
207 211
    *
208 212
    */
209 213
   // OK v4.5
214
+
215
+  /**
216
+   * @param string $account_name_unsafe
217
+   * @param string $email_unsafe
218
+   */
210 219
   public function db_get_by_name_or_email($account_name_unsafe, $email_unsafe) {
211 220
     $this->reset();
212 221
 
@@ -223,6 +232,13 @@  discard block
 block discarded – undo
223 232
    * @throws Exception
224 233
    */
225 234
   // OK v4.5
235
+
236
+  /**
237
+   * @param string $account_name_unsafe
238
+   * @param string $password_raw
239
+   * @param string $email_unsafe
240
+   * @param string $language_unsafe
241
+   */
226 242
   public function db_create($account_name_unsafe, $password_raw, $email_unsafe, $language_unsafe = null, $salt_unsafe = null) {
227 243
     $this->reset();
228 244
 
@@ -317,6 +333,11 @@  discard block
 block discarded – undo
317 333
    * @return int|string
318 334
    */
319 335
   // OK 4.8
336
+
337
+  /**
338
+   * @param integer $change_type
339
+   * @param double $metamatter
340
+   */
320 341
   protected function db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe) {
321 342
     $provider_id_safe = intval(core_auth::$main_provider->provider_id);
322 343
     //$account_id_safe = $this->db->db_escape($this->account_id);
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Vector\Vector;
10 10
 
11 11
 function sys_user_vacation($user) {
12
-  if(sys_get_param_str('vacation') == 'leave') {
12
+  if (sys_get_param_str('vacation') == 'leave') {
13 13
     if ($user['vacation'] < SN_TIME_NOW) {
14 14
       $user['vacation'] = 0;
15 15
       $user['vacation_next'] = SN_TIME_NOW + classSupernova::$config->player_vacation_timeout;
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     }
24 24
   }
25 25
 
26
-  if($user['vacation']) {
26
+  if ($user['vacation']) {
27 27
     // sn_sys_logout(false, true);
28 28
     // core_auth::logout(false, true);
29 29
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
   // TODO: Full rewrite
54 54
   sn_db_transaction_start();
55 55
   $TheUser = DBStaticUser::db_user_by_id($UserID);
56
-  if ( $TheUser['ally_id'] != 0 ) {
57
-    $TheAlly = classSupernova::$db->doSelectFetchArray("SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';");
56
+  if ($TheUser['ally_id'] != 0) {
57
+    $TheAlly = classSupernova::$db->doSelectFetchArray("SELECT * FROM `{{alliance}}` WHERE `id` = '".$TheUser['ally_id']."';");
58 58
     $TheAlly['ally_members'] -= 1;
59
-    if ( $TheAlly['ally_members'] > 0 ) {
59
+    if ($TheAlly['ally_members'] > 0) {
60 60
       classSupernova::$db->doUpdateRowSet(
61 61
         TABLE_ALLIANCE,
62 62
         array(
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 
78 78
   classSupernova::$gc->db->doDeleteWhere(TABLE_MESSAGES, array('message_owner' => $UserID,));
79 79
   classSupernova::$gc->db->doDeleteWhere(TABLE_MESSAGES, array('message_sender' => $UserID,));
80
-  classSupernova::$gc->db->doDeleteWhere(TABLE_NOTES, array('owner' => $UserID ,));
80
+  classSupernova::$gc->db->doDeleteWhere(TABLE_NOTES, array('owner' => $UserID,));
81 81
   FleetList::db_fleet_list_delete_by_owner($UserID);
82
-  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_SENDER_ID' => $UserID ,));
83
-  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_OWNER_ID' => $UserID ,));
82
+  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_SENDER_ID' => $UserID,));
83
+  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_OWNER_ID' => $UserID,));
84 84
 
85 85
 
86 86
   classSupernova::$gc->cacheOperator->db_del_record_by_id(LOC_USER, $UserID);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
     'total_points' => $options['total_points'] = empty($options['total_points']) ? 0 : $options['total_points'],
182 182
 
183
-    'options' => (empty($options['options']) ? $player_options_string : $options['options']) . (empty($options['options_extra']) ? '' : $options['options_extra']),
183
+    'options' => (empty($options['options']) ? $player_options_string : $options['options']).(empty($options['options_extra']) ? '' : $options['options_extra']),
184 184
 
185 185
     'galaxy' => $options['galaxy'] = intval($options['galaxy'] ? $options['galaxy'] : 0),
186 186
     'system' => $options['system'] = intval($options['system'] ? $options['system'] : 0),
@@ -191,28 +191,28 @@  discard block
 block discarded – undo
191 191
   !empty($options['password_encoded_unsafe']) ? $field_set['password'] = $options['password_encoded_unsafe'] : false;
192 192
 
193 193
   $user_new = classSupernova::$gc->cacheOperator->db_ins_field_set(LOC_USER, $field_set);
194
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
194
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
195 195
     $options['galaxy'] = classSupernova::$config->LastSettedGalaxyPos;
196 196
     $options['system'] = classSupernova::$config->LastSettedSystemPos;
197
-    $segment_size = floor(Vector::$knownPlanets/ 3);
197
+    $segment_size = floor(Vector::$knownPlanets / 3);
198 198
     $segment = floor(classSupernova::$config->LastSettedPlanetPos / $segment_size);
199 199
     $segment++;
200 200
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
201 201
 
202 202
     // $new_planet_id = 0;
203
-    while(true) {
204
-      if($options['planet'] > Vector::$knownPlanets) {
203
+    while (true) {
204
+      if ($options['planet'] > Vector::$knownPlanets) {
205 205
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
206 206
         $options['system']++;
207 207
       }
208
-      if($options['system'] > Vector::$knownSystems) {
208
+      if ($options['system'] > Vector::$knownSystems) {
209 209
         $options['system'] = 1;
210 210
         $options['galaxy']++;
211 211
       }
212
-      $options['galaxy'] > Vector::$knownGalaxies? $options['galaxy'] = 1 : false;
212
+      $options['galaxy'] > Vector::$knownGalaxies ? $options['galaxy'] = 1 : false;
213 213
 
214 214
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
215
-      if(!$galaxy_row['id']) {
215
+      if (!$galaxy_row['id']) {
216 216
         classSupernova::$config->db_saveItem(array(
217 217
           'LastSettedGalaxyPos' => $options['galaxy'],
218 218
           'LastSettedSystemPos' => $options['system'],
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
   db_player_name_history_replace($user_new['id'], $username_unsafe);
242 242
 
243
-  if(!empty($options['partner_id']) && ($referral_row = DBStaticUser::db_user_by_id($options['partner_id'], true))) {
243
+  if (!empty($options['partner_id']) && ($referral_row = DBStaticUser::db_user_by_id($options['partner_id'], true))) {
244 244
     db_referral_insert($options['partner_id'], $user_new['id']);
245 245
   }
246 246
 
Please login to merge, or discard this patch.
classes/UBE/UBEReport.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
    */
14 14
   public function sn_ube_report_save($ube) {
15 15
     // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем
16
-    if($ube->get_cypher()) {
16
+    if ($ube->get_cypher()) {
17 17
       return false;
18 18
     }
19 19
 
20 20
     // Генерируем уникальный секретный ключ и проверяем наличие в базе
21 21
     do {
22 22
       $ube->report_cypher = sys_random_string(32);
23
-    } while(classSupernova::$db->doSelectFetchArray("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE"));
23
+    } while (classSupernova::$db->doSelectFetchArray("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE"));
24 24
 
25 25
     // Инициализация таблицы для пакетной вставки информации
26 26
     $sql_perform = array(
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 
107 107
     // Сохраняем общую информацию о бое
108 108
     classSupernova::$db->doInsertSet(TABLE_UBE_REPORT, array(
109
-        'ube_report_cypher'             => (string)$ube->report_cypher,
110
-        'ube_report_time_combat'        => (string)date(FMT_DATE_TIME_SQL, $ube->combat_timestamp),
111
-        'ube_report_time_spent'         => (float)$ube->time_spent,
112
-        'ube_report_combat_admin'       => (int)$ube->is_admin_in_combat,
113
-        'ube_report_mission_type'       => (int)$ube->mission_type_id,
114
-        'ube_report_combat_result'      => (int)$ube->combat_result,
115
-        'ube_report_combat_sfr'         => (int)$ube->is_small_fleet_recce,
116
-        'ube_report_planet_id'          => (int)$ube->ube_planet_info[PLANET_ID],
117
-        'ube_report_planet_name'        => (string)$ube->ube_planet_info[PLANET_NAME],
118
-        'ube_report_planet_size'        => (int)$ube->ube_planet_info[PLANET_SIZE],
119
-        'ube_report_planet_galaxy'      => (int)$ube->ube_planet_info[PLANET_GALAXY],
120
-        'ube_report_planet_system'      => (int)$ube->ube_planet_info[PLANET_SYSTEM],
121
-        'ube_report_planet_planet'      => (int)$ube->ube_planet_info[PLANET_PLANET],
122
-        'ube_report_planet_planet_type' => (int)$ube->ube_planet_info[PLANET_TYPE],
123
-        'ube_report_capture_result'     => (int)$ube->capture_result,
109
+        'ube_report_cypher'             => (string) $ube->report_cypher,
110
+        'ube_report_time_combat'        => (string) date(FMT_DATE_TIME_SQL, $ube->combat_timestamp),
111
+        'ube_report_time_spent'         => (float) $ube->time_spent,
112
+        'ube_report_combat_admin'       => (int) $ube->is_admin_in_combat,
113
+        'ube_report_mission_type'       => (int) $ube->mission_type_id,
114
+        'ube_report_combat_result'      => (int) $ube->combat_result,
115
+        'ube_report_combat_sfr'         => (int) $ube->is_small_fleet_recce,
116
+        'ube_report_planet_id'          => (int) $ube->ube_planet_info[PLANET_ID],
117
+        'ube_report_planet_name'        => (string) $ube->ube_planet_info[PLANET_NAME],
118
+        'ube_report_planet_size'        => (int) $ube->ube_planet_info[PLANET_SIZE],
119
+        'ube_report_planet_galaxy'      => (int) $ube->ube_planet_info[PLANET_GALAXY],
120
+        'ube_report_planet_system'      => (int) $ube->ube_planet_info[PLANET_SYSTEM],
121
+        'ube_report_planet_planet'      => (int) $ube->ube_planet_info[PLANET_PLANET],
122
+        'ube_report_planet_planet_type' => (int) $ube->ube_planet_info[PLANET_TYPE],
123
+        'ube_report_capture_result'     => (int) $ube->capture_result,
124 124
       )
125 125
       + $ube->debris->report_generate_array()
126 126
       + $ube->moon_calculator->report_generate_array()
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
 
130 130
     // Сохраняем общую информацию по игрокам
131 131
     $player_sides = $ube->players->get_player_sides();
132
-    foreach($player_sides as $player_id => $player_side) {
132
+    foreach ($player_sides as $player_id => $player_side) {
133 133
       $sql_perform['ube_report_player'][] = array(
134 134
         $ube_report_id,
135 135
         $player_id,
136 136
 
137
-        "'" . db_escape($ube->players[$player_id]->name) . "'",
137
+        "'".db_escape($ube->players[$player_id]->name)."'",
138 138
         $ube->players[$player_id]->getSide() == UBE_PLAYER_IS_ATTACKER ? 1 : 0,
139 139
 
140
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK),
141
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD),
142
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR),
140
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK),
141
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD),
142
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR),
143 143
       );
144 144
     }
145 145
 
146 146
     // Всякая информация по флотам
147
-    foreach($ube->fleet_list->_container as $fleet_id => $UBEFleet) {
147
+    foreach ($ube->fleet_list->_container as $fleet_id => $UBEFleet) {
148 148
       // Сохраняем общую информацию по флотам
149 149
       $sql_perform['ube_report_fleet'][] = $UBEFleet->sql_generate_array($ube_report_id);
150 150
 
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
     $ube->rounds->sql_generate_unit_array($sql_perform['ube_report_unit'], $ube_report_id, $ube->fleet_list);
160 160
 
161 161
     // Пакетная вставка данных
162
-    foreach($sql_perform as $table_name => $table_data) {
163
-      if(count($table_data) < 2) {
162
+    foreach ($sql_perform as $table_name => $table_data) {
163
+      if (count($table_data) < 2) {
164 164
         continue;
165 165
       }
166
-      foreach($table_data as &$record_data) {
167
-        $record_data = '(' . implode(',', $record_data) . ')';
166
+      foreach ($table_data as &$record_data) {
167
+        $record_data = '('.implode(',', $record_data).')';
168 168
       }
169 169
       $fields = $table_data[0];
170 170
       unset($table_data[0]);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     $report_cypher = db_escape($report_cypher);
187 187
 
188 188
     $report_row = classSupernova::$db->doSelectFetchArray("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1");
189
-    if(!$report_row) {
189
+    if (!$report_row) {
190 190
       return UBE_REPORT_NOT_FOUND;
191 191
     }
192 192
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
    * @param     $template_result
203 203
    */
204 204
   public function sn_ube_report_generate(UBE $ube, &$template_result) {
205
-    if(!is_object($ube)) {
205
+    if (!is_object($ube)) {
206 206
       return;
207 207
     }
208 208
 
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 
218 218
     // Координаты, тип и название планеты - если есть
219 219
 //R  $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER];
220
-    if(isset($ube->ube_planet_info)) {
220
+    if (isset($ube->ube_planet_info)) {
221 221
       $template_result += $ube->ube_planet_info;
222 222
       $template_result[PLANET_NAME] = str_replace(' ', '&nbsp;', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8'));
223 223
     }
224 224
 
225 225
     // Обломки
226 226
     $debris = array();
227
-    foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) {
228
-      if($resource_amount = $ube->debris->debris_get_resource($resource_id)) {
227
+    foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id) {
228
+      if ($resource_amount = $ube->debris->debris_get_resource($resource_id)) {
229 229
         $debris[] = array(
230 230
           'NAME'   => classLocale::$lang['tech'][$resource_id],
231 231
           'AMOUNT' => pretty_number($resource_amount),
Please login to merge, or discard this patch.
classes/DBRow.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
    * @param db_mysql|null $db
87 87
    */
88 88
   public static function setDb($db = null) {
89
-    if(empty($db) || !($db instanceof db_mysql)) {
89
+    if (empty($db) || !($db instanceof db_mysql)) {
90 90
       $db = null;
91 91
     }
92 92
     static::$db = !empty($db) || !class_exists('classSupernova', false) ? $db : classSupernova::$db;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
   public function dbLoad($dbId, $lockSkip = false) {
150 150
     $dbId = idval($dbId);
151 151
     if ($dbId <= 0) {
152
-      classSupernova::$debug->error(get_called_class() . '::' . __METHOD__ . ' $dbId not positive = ' . $dbId);
152
+      classSupernova::$debug->error(get_called_class().'::'.__METHOD__.' $dbId not positive = '.$dbId);
153 153
 
154 154
       return;
155 155
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
       $this->dbGetLockById($this->_dbId);
162 162
     }
163 163
 
164
-    $db_row = classSupernova::$db->doSelectFetchArray("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;");
164
+    $db_row = classSupernova::$db->doSelectFetchArray("SELECT * FROM `{{".static::$_table."}}` WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId." LIMIT 1 FOR UPDATE;");
165 165
     if (empty($db_row)) {
166 166
       return;
167 167
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     if ($this->isNew()) {
194 194
       // No DB_ID - new unit
195 195
       if ($this->isEmpty()) {
196
-        classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave');
196
+        classSupernova::$debug->error(__FILE__.':'.__LINE__.' - object is empty on '.get_called_class().'::dbSave');
197 197
       }
198 198
       $this->dbInsert();
199 199
     } else {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $this->dbDelete();
203 203
       } else {
204 204
         if (!sn_db_transaction_check(false)) {
205
-          classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate');
205
+          classSupernova::$debug->error(__FILE__.':'.__LINE__.' - transaction should always be started on '.get_called_class().'::dbUpdate');
206 206
         }
207 207
         $this->dbUpdate();
208 208
       }
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
   // TODO - protected
231 231
   public function dbInsert() {
232 232
     if (!$this->isNew()) {
233
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert');
233
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - record db_id is not empty on '.get_called_class().'::dbInsert');
234 234
     }
235 235
 
236 236
     $fieldSet = $this->dbMakeFieldSet(false);
237 237
 
238 238
     if (!static::$db->doInsertSet(static::$_table, $fieldSet)) {
239
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert');
239
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - error saving record '.get_called_class().'::dbInsert');
240 240
     }
241 241
     $this->_dbId = static::$db->db_insert_id();
242 242
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
   public function dbUpdate() {
251 251
     // TODO - Update
252 252
     if ($this->isNew()) {
253
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate');
253
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbUpdate');
254 254
     }
255 255
     $this->db_field_update($this->dbMakeFieldUpdate());
256 256
   }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
   // TODO - protected
262 262
   public function dbDelete() {
263 263
     if ($this->isNew()) {
264
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete');
264
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbDelete');
265 265
     }
266 266
     classSupernova::$gc->db->doDeleteRow(
267 267
       static::$_table,
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
       }
453 453
     }
454 454
 
455
-    if(empty($set)) {
455
+    if (empty($set)) {
456 456
       $theResult = true;
457 457
     } else {
458 458
       $theResult = classSupernova::$db->doUpdateRowAdjust(
Please login to merge, or discard this patch.
classes/Entity/KeyedModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
   /**
91 91
    * @param KeyedContainer $cEntity
92 92
    */
93
-  protected function onSaveUnchanged($cEntity){
93
+  protected function onSaveUnchanged($cEntity) {
94 94
     // TODO - or just save nothing ?????
95 95
     // throw new \Exception('EntityModel isNotEmpty, have dbId and not CHANGED! It can\'t be!');
96 96
     // Do nothing
Please login to merge, or discard this patch.
classes/Entity/EntityModel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     // Generate changeset row
200 200
     // Foreach all rows. If there is change and no delta - then put delta. Otherwise put change
201 201
     // If row not empty - update
202
-    throw new \Exception(__CLASS__ . '::update() in ' . get_called_class() . 'is not yet implemented');
202
+    throw new \Exception(__CLASS__.'::update() in '.get_called_class().'is not yet implemented');
203 203
   }
204 204
 
205 205
   /**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
    * @throws \Exception
209 209
    */
210 210
   protected function delete($cEntity) {
211
-    throw new \Exception(__CLASS__ . '::delete() in ' . get_called_class() . 'is not yet implemented');
211
+    throw new \Exception(__CLASS__.'::delete() in '.get_called_class().'is not yet implemented');
212 212
   }
213 213
 
214 214
   /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
   protected function onSaveUnchanged($cEntity) {
225 225
     // TODO - or just save nothing ?????
226 226
 //    throw new \Exception('EntityModel isNotEmpty, have dbId and not CHANGED! It can\'t be!');
227
-    throw new \Exception(__CLASS__ . '::unchanged() in ' . get_called_class() . 'is not yet implemented');
227
+    throw new \Exception(__CLASS__.'::unchanged() in '.get_called_class().'is not yet implemented');
228 228
   }
229 229
 
230 230
   /**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
   protected function onSaveNew($cEntity) {
240 240
     // Just created container and doesn't use it
241 241
 //    throw new \Exception('EntityModel isEmpty but not loaded! It can\'t be!');
242
-    throw new \Exception(__CLASS__ . '::emptyAction() in ' . get_called_class() . 'is not yet implemented');
242
+    throw new \Exception(__CLASS__.'::emptyAction() in '.get_called_class().'is not yet implemented');
243 243
   }
244 244
 
245 245
   /**
Please login to merge, or discard this patch.
classes/db_mysql.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
   public function load_db_settings($configFile = '') {
99 99
     $dbsettings = array();
100 100
 
101
-    empty($configFile) ? $configFile = SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX : false;
101
+    empty($configFile) ? $configFile = SN_ROOT_PHYSICAL."config".DOT_PHP_EX : false;
102 102
 
103 103
     require $configFile;
104 104
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     }
119 119
 
120 120
     if (empty($this->dbsettings)) {
121
-      $this->load_db_settings(SN_ROOT_PHYSICAL . "config.php");
121
+      $this->load_db_settings(SN_ROOT_PHYSICAL."config.php");
122 122
     }
123 123
 
124 124
     // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     $sql = $query;
171 171
     if (strpos($sql, '{{') !== false) {
172 172
       foreach ($this->table_list as $tableName) {
173
-        $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql);
173
+        $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql);
174 174
       }
175 175
     }
176 176
 
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
 
242 242
     $queryResult = null;
243 243
     try {
244
-      $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace));
244
+      $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace));
245 245
       if (!$queryResult) {
246 246
         throw new Exception();
247 247
       }
248 248
     } catch (Exception $e) {
249
-      classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error');
249
+      classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error');
250 250
     }
251 251
 
252 252
     return $queryResult;
@@ -300,16 +300,16 @@  discard block
 block discarded – undo
300 300
     if (!empty($where)) {
301 301
       foreach ($where as $key => &$value) {
302 302
         if (!is_int($key)) {
303
-          $value = "`$key` = '" . $this->db_escape($value) . "'";
303
+          $value = "`$key` = '".$this->db_escape($value)."'";
304 304
         }
305 305
       }
306 306
     }
307 307
 
308 308
     $query =
309
-      "SELECT " . implode(',', $fields) .
310
-      " FROM `{{{$table}}}`" .
311
-      (!empty($where) ? ' WHERE ' . implode(' AND ', $where) : '') .
312
-      ($isOneRecord == DB_RECORD_ONE ? ' LIMIT 1' : '') .
309
+      "SELECT ".implode(',', $fields).
310
+      " FROM `{{{$table}}}`".
311
+      (!empty($where) ? ' WHERE '.implode(' AND ', $where) : '').
312
+      ($isOneRecord == DB_RECORD_ONE ? ' LIMIT 1' : '').
313 313
       ($forUpdate == DB_SELECT_FOR_UPDATE ? ' FOR UPDATE' : '');
314 314
 
315 315
     return $this->doSql($query);
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
       $this->isWatching = true;
604 604
       $msg = "\$query = \"{$query}\"\n\r";
605 605
       if (!empty($_POST)) {
606
-        $msg .= "\n\r" . dump($_POST, '$_POST');
606
+        $msg .= "\n\r".dump($_POST, '$_POST');
607 607
       }
608 608
       if (!empty($_GET)) {
609
-        $msg .= "\n\r" . dump($_GET, '$_GET');
609
+        $msg .= "\n\r".dump($_GET, '$_GET');
610 610
       }
611 611
       classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true));
612 612
       $this->isWatching = false;
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 
622 622
     global $user, $dm_change_legit, $mm_change_legit;
623 623
 
624
-    switch(true) {
624
+    switch (true) {
625 625
       case stripos($query, 'RUNCATE TABL') != false:
626 626
       case stripos($query, 'ROP TABL') != false:
627 627
       case stripos($query, 'ENAME TABL') != false:
@@ -632,37 +632,37 @@  discard block
 block discarded – undo
632 632
       case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit:
633 633
       case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit:
634 634
       case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0:
635
-        $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n";
635
+        $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n";
636 636
         $report .= ">Database Inforamation\n";
637
-        $report .= "\tID - " . $user['id'] . "\n";
638
-        $report .= "\tUser - " . $user['username'] . "\n";
639
-        $report .= "\tAuth level - " . $user['authlevel'] . "\n";
640
-        $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n";
641
-        $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n";
642
-        $report .= "\tUser IP - " . $user['user_lastip'] . "\n";
643
-        $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n";
644
-        $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n";
645
-        $report .= "\tCurrent Page - " . $user['current_page'] . "\n";
646
-        $report .= "\tRegister Time - " . $user['register_time'] . "\n";
637
+        $report .= "\tID - ".$user['id']."\n";
638
+        $report .= "\tUser - ".$user['username']."\n";
639
+        $report .= "\tAuth level - ".$user['authlevel']."\n";
640
+        $report .= "\tAdmin Notes - ".$user['adminNotes']."\n";
641
+        $report .= "\tCurrent Planet - ".$user['current_planet']."\n";
642
+        $report .= "\tUser IP - ".$user['user_lastip']."\n";
643
+        $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n";
644
+        $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n";
645
+        $report .= "\tCurrent Page - ".$user['current_page']."\n";
646
+        $report .= "\tRegister Time - ".$user['register_time']."\n";
647 647
         $report .= "\n";
648 648
 
649 649
         $report .= ">Query Information\n";
650
-        $report .= "\tQuery - " . $query . "\n";
650
+        $report .= "\tQuery - ".$query."\n";
651 651
         $report .= "\n";
652 652
 
653 653
         $report .= ">\$_SERVER Information\n";
654
-        $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n";
655
-        $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n";
656
-        $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n";
657
-        $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n";
658
-        $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n";
659
-        $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n";
660
-        $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n";
661
-        $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n";
654
+        $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n";
655
+        $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n";
656
+        $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n";
657
+        $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n";
658
+        $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n";
659
+        $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n";
660
+        $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n";
661
+        $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n";
662 662
 
663 663
         $report .= "\n--------------------------------------------------------------------------------------------------\n";
664 664
 
665
-        $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a');
665
+        $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a');
666 666
         fwrite($fp, $report);
667 667
         fclose($fp);
668 668
 
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
     $prefix_length = strlen($this->db_prefix);
684 684
 
685 685
     $tl = array();
686
-    while($row = $this->db_fetch($query)) {
686
+    while ($row = $this->db_fetch($query)) {
687 687
       foreach ($row as $table_name) {
688 688
         if (strpos($table_name, $this->db_prefix) === 0) {
689 689
           $table_name = substr($table_name, $prefix_length);
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
     if (is_bool($query)) {
818 818
       throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?');
819 819
     }
820
-    while($row = db_fetch($query)) {
820
+    while ($row = db_fetch($query)) {
821 821
       $result[$row['Variable_name']] = $row['Value'];
822 822
     }
823 823
 
Please login to merge, or discard this patch.
classes/DBAL/DbQuery.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     $this->buildCommand(static::SELECT);
108 108
     $this->build[] = ' *';
109
-    $this->build[] = " FROM " . $this->quoteTable($this->table);
109
+    $this->build[] = " FROM ".$this->quoteTable($this->table);
110 110
     $this->buildWhere();
111 111
     $this->buildLimit();
112 112
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
    * @return string
141 141
    */
142 142
   protected function setInsertCommand($replace) {
143
-    switch($replace) {
143
+    switch ($replace) {
144 144
       case DB_INSERT_IGNORE:
145 145
         $result = static::INSERT_IGNORE;
146 146
       break;
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
    * @return string
311 311
    */
312 312
   protected function stringValue($value) {
313
-    return "'" . $this->escape((string)$value) . "'";
313
+    return "'".$this->escape((string) $value)."'";
314 314
   }
315 315
 
316 316
   /**
@@ -321,20 +321,20 @@  discard block
 block discarded – undo
321 321
    * @return string
322 322
    */
323 323
   public function quote($fieldName) {
324
-    return "`" . $this->escape((string)$fieldName) . "`";
324
+    return "`".$this->escape((string) $fieldName)."`";
325 325
   }
326 326
 
327 327
   public function makeAdjustString($fieldValue, $fieldName) {
328 328
     return is_int($fieldName)
329 329
       ? $fieldValue
330
-      : (($fieldNameQuoted = $this->quote($fieldName)) . " = " .
331
-        $fieldNameQuoted . " + (" . $this->castAsDbValue($fieldValue) . ")");
330
+      : (($fieldNameQuoted = $this->quote($fieldName))." = ".
331
+        $fieldNameQuoted." + (".$this->castAsDbValue($fieldValue).")");
332 332
   }
333 333
 
334 334
   public function makeFieldEqualValue($fieldValue, $fieldName) {
335 335
     return is_int($fieldName)
336 336
       ? $fieldValue
337
-      : ($this->quote($fieldName) . " = " . $this->castAsDbValue($fieldValue));
337
+      : ($this->quote($fieldName)." = ".$this->castAsDbValue($fieldValue));
338 338
   }
339 339
 
340 340
   /**
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
    * @return string
346 346
    */
347 347
   protected function quoteTable($tableName) {
348
-    return "`{{" . $this->escape((string)$tableName) . "}}`";
348
+    return "`{{".$this->escape((string) $tableName)."}}`";
349 349
   }
350 350
 
351 351
   public function castAsDbValue($value) {
352
-    switch(gettype($value)) {
352
+    switch (gettype($value)) {
353 353
       case TYPE_INTEGER:
354 354
       case TYPE_DOUBLE:
355 355
         // do nothing
@@ -380,19 +380,19 @@  discard block
 block discarded – undo
380 380
 
381 381
 
382 382
   protected function buildCommand($command) {
383
-    switch($this->command = $command) {
383
+    switch ($this->command = $command) {
384 384
       case static::UPDATE:
385
-        $this->build[] = $this->command . " " . $this->quoteTable($this->table);
385
+        $this->build[] = $this->command." ".$this->quoteTable($this->table);
386 386
       break;
387 387
 
388 388
       case static::DELETE:
389
-        $this->build[] = $this->command . " FROM " . $this->quoteTable($this->table);
389
+        $this->build[] = $this->command." FROM ".$this->quoteTable($this->table);
390 390
       break;
391 391
 
392 392
       case static::REPLACE:
393 393
       case static::INSERT_IGNORE:
394 394
       case static::INSERT:
395
-        $this->build[] = $this->command . " INTO " . $this->quoteTable($this->table);
395
+        $this->build[] = $this->command." INTO ".$this->quoteTable($this->table);
396 396
       break;
397 397
 
398 398
       case static::SELECT:
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
     }
443 443
 
444 444
     foreach ($this->values as $valuesVector) {
445
-      $compiled[] = '(' . implode(',', HelperArray::map($valuesVector, array($this, 'castAsDbValue'))) . ')';
445
+      $compiled[] = '('.implode(',', HelperArray::map($valuesVector, array($this, 'castAsDbValue'))).')';
446 446
     }
447 447
 
448 448
     $this->build[] = implode(',', $compiled);
Please login to merge, or discard this patch.