Completed
Push — work-fleets ( 7f5906...04acf9 )
by SuperNova.WS
06:14
created
notes.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 use Vector\Vector;
12 12
 
13
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
13
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
14 14
 lng_include('notes');
15 15
 
16 16
 global $user;
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
 $template = gettemplate('notes', true);
19 19
 
20 20
 $result = array();
21
-if(($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) {
21
+if (($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) {
22 22
   $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => classLocale::$lang[$result_message]);
23 23
 }
24 24
 
25 25
 $note_id_edit = sys_get_param_id('note_id_edit');
26
-if(sys_get_param('note_delete')) {
26
+if (sys_get_param('note_delete')) {
27 27
   try {
28 28
     DBStaticNote::processDelete($user, $note_id_edit);
29
-  } catch(Exception $e) {
29
+  } catch (Exception $e) {
30 30
     $note_id_edit = 0;
31 31
     sn_db_transaction_rollback();
32 32
     $result[] = array(
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
       'MESSAGE' => classLocale::$lang[$e->getMessage()],
35 35
     );
36 36
   }
37
-} elseif(($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) {
37
+} elseif (($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) {
38 38
   $note_title == db_escape(classLocale::$lang['note_new_title']) ? $note_title = '' : false;
39 39
   ($note_text = sys_get_param_str('note_text')) == db_escape(classLocale::$lang['note_new_text']) ? $note_text = '' : false;
40 40
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     $note_system = max(0, min(sys_get_param_id('note_system'), Vector::$knownSystems));
44 44
     $note_planet = max(0, min(sys_get_param_id('note_planet'), Vector::$knownPlanets + 1));
45 45
 
46
-    if(!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) {
46
+    if (!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) {
47 47
       throw new exception('note_err_note_empty', ERR_WARNING);
48 48
     }
49 49
 
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
     $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0;
53 53
 
54 54
     sn_db_transaction_start();
55
-    if($note_id_edit) {
55
+    if ($note_id_edit) {
56 56
       $check_note_id = DBStaticNote::db_note_get_id_and_owner($note_id_edit);
57
-      if(!$check_note_id) {
57
+      if (!$check_note_id) {
58 58
         throw new Exception('note_err_note_not_found', ERR_ERROR);
59 59
       }
60 60
     }
61 61
 
62
-    if($note_id_edit) {
63
-      if($check_note_id['owner'] != $user['id']) {
62
+    if ($note_id_edit) {
63
+      if ($check_note_id['owner'] != $user['id']) {
64 64
         throw new Exception('note_err_owner_wrong', ERR_ERROR);
65 65
       }
66 66
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
     }
71 71
 
72 72
     sn_db_transaction_commit();
73
-    sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added'));
73
+    sys_redirect('notes.php?STATUS='.ERR_NONE.'&MESSAGE='.($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added'));
74 74
 //    throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE);
75
-  } catch(Exception $e) {
75
+  } catch (Exception $e) {
76 76
     $note_id_edit = 0;
77 77
     sn_db_transaction_rollback();
78 78
     $result[] = array(
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
   }
83 83
 }
84 84
 
85
-if(!$note_id_edit) {
85
+if (!$note_id_edit) {
86 86
   note_assign($template, array(
87 87
     'id'          => 0,
88 88
     'time'        => SN_TIME_NOW,
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 
96 96
 $note_exist = false;
97 97
 $notes_query = DBStaticNote::db_note_list_by_owner($user['id']);
98
-while($note_row = db_fetch($notes_query)) {
98
+while ($note_row = db_fetch($notes_query)) {
99 99
   note_assign($template, $note_row);
100 100
   $note_exist = $note_exist || $note_row['id'] == $note_id_edit;
101 101
 }
102 102
 $note_id_edit = $note_exist ? $note_id_edit : 0;
103 103
 
104
-foreach($note_priority_classes as $note_priority_id => $note_priority_class) {
104
+foreach ($note_priority_classes as $note_priority_id => $note_priority_class) {
105 105
   $template->assign_block_vars('note_priority', array(
106 106
     'ID'    => $note_priority_id,
107 107
     'CLASS' => $note_priority_classes[$note_priority_id],
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
   ));
110 110
 }
111 111
 
112
-foreach(classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) {
112
+foreach (classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) {
113 113
   $template->assign_block_vars('planet_type', array(
114 114
     'ID'   => $planet_type_id,
115 115
     'TEXT' => $planet_type_string,
116 116
   ));
117 117
 }
118 118
 
119
-foreach($result as $result_data) {
119
+foreach ($result as $result_data) {
120 120
   $template->assign_block_vars('result', $result_data);
121 121
 }
122 122
 
Please login to merge, or discard this patch.
includes/classes/DBRow.php 1 patch
Spacing   +11 added lines, -11 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->doSelectFetch("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;");
164
+    $db_row = classSupernova::$db->doSelectFetch("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,12 +230,12 @@  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
     $this->_dbId = $this->db_field_set_create($this->dbMakeFieldSet());
236 236
 
237 237
     if (empty($this->_dbId)) {
238
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert');
238
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - error saving record '.get_called_class().'::dbInsert');
239 239
     }
240 240
 
241 241
     return $this->_dbId;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
   public function dbUpdate() {
249 249
     // TODO - Update
250 250
     if ($this->isNew()) {
251
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate');
251
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbUpdate');
252 252
     }
253 253
     $this->db_field_update($this->dbMakeFieldSet(true));
254 254
   }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
   // TODO - protected
260 260
   public function dbDelete() {
261 261
     if ($this->isNew()) {
262
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete');
262
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbDelete');
263 263
     }
264 264
     classSupernova::$gc->db->doDeleteRowWhere(static::$_table, array(static::$_dbIdFieldName => $this->_dbId));
265 265
     $this->_dbId = 0;
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
     $fields = implode(',', array_keys($field_set));
415 415
 
416 416
     $result = 0;
417
-    if (classSupernova::$db->doInsert("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) {
417
+    if (classSupernova::$db->doInsert("INSERT INTO `{{".static::$_table."}}` ({$fields}) VALUES ({$values});")) {
418 418
       $result = classSupernova::$db->db_insert_id();
419 419
     }
420 420
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
     return empty($set_string)
452 452
       ? true
453
-      : classSupernova::$db->doUpdate("UPDATE `{{" . static::$_table . "}}` SET {$set_string} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId);
453
+      : classSupernova::$db->doUpdate("UPDATE `{{".static::$_table."}}` SET {$set_string} WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId);
454 454
   }
455 455
 
456 456
 }
Please login to merge, or discard this patch.
includes/classes/DbRowDirectOperator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
       ->setIdField($entity->getIdFieldName())
19 19
       ->field('*')
20 20
       ->from($entity->getTableName())
21
-      ->where($entity->getIdFieldName() . ' = "' . $entity->dbId . '"');
21
+      ->where($entity->getIdFieldName().' = "'.$entity->dbId.'"');
22 22
 
23 23
     return $stmt->selectRow();
24 24
   }
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
     $query = array();
44 44
     foreach ($entity->exportRowWithoutId() as $fieldName => $fieldValue) {
45 45
       // TODO: MORE type detection
46
-      if(!is_numeric($fieldValue)) {
47
-        $fieldValue = "'" . $db->db_escape($fieldValue) . "'";
46
+      if (!is_numeric($fieldValue)) {
47
+        $fieldValue = "'".$db->db_escape($fieldValue)."'";
48 48
       }
49 49
       $query[] = "`{$fieldName}` = {$fieldValue}";
50 50
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
       return 0;
56 56
     }
57 57
 
58
-    $db->doInsert("INSERT INTO `{{" . $entity->getTableName() . "}}` SET " . $query);
58
+    $db->doInsert("INSERT INTO `{{".$entity->getTableName()."}}` SET ".$query);
59 59
 
60 60
     // TODO Exceptiion if db_insert_id() is empty
61 61
     return $entity->dbId = $db->db_insert_id();
Please login to merge, or discard this patch.
admin/adm_message_list.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 define('INSTALL', false);
13 13
 define('IN_ADMIN', true);
14 14
 
15
-require('../common.' . substr(strrchr(__FILE__, '.'), 1));
15
+require('../common.'.substr(strrchr(__FILE__, '.'), 1));
16 16
 
17
-if($user['authlevel'] < 3) {
17
+if ($user['authlevel'] < 3) {
18 18
   AdminMessage(classLocale::$lang['adm_err_denied']);
19 19
 }
20 20
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
   ),
29 29
 );
30 30
 $template->assign_block_vars('int_type_selected', $allowed_types[-1]);
31
-foreach(DBStaticMessages::$snMessageClassList as $key => $value) {
32
-  if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) {
31
+foreach (DBStaticMessages::$snMessageClassList as $key => $value) {
32
+  if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) {
33 33
     continue;
34 34
   }
35 35
 
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 $deletedMessages = '';
44
-if($idMessageDelete = sys_get_param_id('msg_del')) {
44
+if ($idMessageDelete = sys_get_param_id('msg_del')) {
45 45
   DBStaticMessages::db_message_delete_by_id($idMessageDelete);
46 46
   $deletedMessages = $idMessageDelete;
47
-} elseif(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
47
+} elseif (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
48 48
   $message_delete = implode(', ', $message_delete);
49 49
   DBStaticMessages::db_message_list_delete_set($message_delete);
50 50
   $deletedMessages = $message_delete;
51 51
 }
52 52
 
53
-if($deletedMessages) {
53
+if ($deletedMessages) {
54 54
   $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['mlst_messages_deleted'], $deletedMessages)));
55 55
 }
56 56
 
57 57
 
58
-if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) {
58
+if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) {
59 59
   $delete_date = "{$year}-{$month}-{$day}";
60 60
   DBStaticMessages::db_message_list_delete_by_date($delete_date, $int_type_selected);
61 61
   $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['mlst_messages_deleted_date'], $allowed_types[$int_type_selected]['TEXT'], $delete_date)));
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 
68 68
 $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max);
69 69
 
70
-if(sys_get_param('page_prev') && $int_page_current > 1) {
70
+if (sys_get_param('page_prev') && $int_page_current > 1) {
71 71
   $int_page_current--;
72
-} elseif(sys_get_param('page_next') && $int_page_current < $page_max) {
72
+} elseif (sys_get_param('page_next') && $int_page_current < $page_max) {
73 73
   $int_page_current++;
74 74
 }
75 75
 
76
-for($i = 1; $i <= $page_max; $i++) {
76
+for ($i = 1; $i <= $page_max; $i++) {
77 77
   $template->assign_block_vars('page', array('NUMBER' => $i));
78 78
 }
79 79
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 $StartRec = ($int_page_current - 1) * 25;
82 82
 
83 83
 $Messages = DBStaticMessages::db_message_list_admin_by_type($int_type_selected, $StartRec);
84
-while($row = db_fetch($Messages)) {
84
+while ($row = db_fetch($Messages)) {
85 85
   $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8');
86 86
   $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8');
87 87
   $row['TEXT'] = nl2br($row['TEXT']);
Please login to merge, or discard this patch.