Completed
Push — work-fleets ( b8fd67...a5a64a )
by SuperNova.WS
05:59
created
announce.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 $allow_anonymous = true;
12
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
12
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 global $config;
15 15
 
@@ -23,40 +23,40 @@  discard block
 block discarded – undo
23 23
 $mode = sys_get_param_str('mode');
24 24
 
25 25
 $announce = array();
26
-if($user['authlevel'] >= 3) {
27
-  if(!empty($text)) {
26
+if ($user['authlevel'] >= 3) {
27
+  if (!empty($text)) {
28 28
     $announce_time = strtotime($announce_time, SN_TIME_NOW);
29 29
     $announce_time = $announce_time ? $announce_time : SN_TIME_NOW;
30 30
 
31
-    if($mode == 'edit') {
31
+    if ($mode == 'edit') {
32 32
       DBStaticNews::db_news_update_set($announce_time, $text, $detail_url, $announce_id);
33 33
       DBStaticSurvey::db_survey_delete_by_id($announce_id);
34 34
     } else {
35 35
       DBStaticNews::db_news_insert_set($announce_time, $text, $detail_url, $user);
36 36
       $announce_id = db_insert_id();
37 37
     }
38
-    if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) {
38
+    if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) {
39 39
       $survey_answers = explode("\r\n", $survey_answers);
40 40
       $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW);
41 41
       $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1);
42 42
       DBStaticSurvey::db_survey_insert($announce_id, $survey_question, $survey_until);
43 43
       $survey_id = db_insert_id();
44
-      foreach($survey_answers as $survey_answer) {
44
+      foreach ($survey_answers as $survey_answer) {
45 45
         $survey_answer = db_escape(trim($survey_answer));
46
-        if(empty($survey_answer)) {
46
+        if (empty($survey_answer)) {
47 47
           continue;
48 48
         }
49 49
         DBStaticSurveyAnswer::db_survey_answer_insert($survey_id, $survey_answer);
50 50
       }
51 51
     }
52 52
 
53
-    if($announce_time <= SN_TIME_NOW) {
54
-      if($announce_time > $config->var_news_last && $announce_time == SN_TIME_NOW) {
53
+    if ($announce_time <= SN_TIME_NOW) {
54
+      if ($announce_time > $config->var_news_last && $announce_time == SN_TIME_NOW) {
55 55
         $config->db_saveItem('var_news_last', $announce_time);
56 56
       }
57 57
 
58
-      if(sys_get_param_int('news_mass_mail')) {
59
-        $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang['news_more']}</span></a>" : '');
58
+      if (sys_get_param_int('news_mass_mail')) {
59
+        $text = sys_get_param('text').($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang['news_more']}</span></a>" : '');
60 60
         msg_send_simple_message('*', 0, 0, MSG_TYPE_ADMIN, $lang['sys_administration'], $lang['news_title'], $text);
61 61
       }
62 62
     }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
   }
67 67
 
68 68
   $survey_answers = '';
69
-  switch($mode) {
69
+  switch ($mode) {
70 70
     case 'del':
71 71
       DBStaticNews::db_news_delete_by_id($announce_id);
72 72
       $mode = '';
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
       $template->assign_var('ID', $announce_id);
77 77
     case 'copy':
78 78
       $announce = DBStaticNews::db_news_with_survey_select_by_id($announce_id);
79
-      if($announce['survey_id']) {
79
+      if ($announce['survey_id']) {
80 80
         $query = DBStaticSurveyAnswer::db_survey_answer_text_select_by_news($announce);
81
-        while($row = db_fetch($query)) {
81
+        while ($row = db_fetch($query)) {
82 82
           $survey_answers[] = $row['survey_answer_text'];
83 83
         }
84 84
         $survey_answers = implode("\r\n", $survey_answers);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     break;
87 87
   }
88 88
 } else {
89
-  $annQuery = 'WHERE UNIX_TIMESTAMP(`tsTimeStamp`) <= ' . SN_TIME_NOW;
89
+  $annQuery = 'WHERE UNIX_TIMESTAMP(`tsTimeStamp`) <= '.SN_TIME_NOW;
90 90
 }
91 91
 
92 92
 nws_render($template, $annQuery, 20);
Please login to merge, or discard this patch.
includes/classes/DBStaticRecord.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
   }
92 92
 
93 93
   /**
94
-   * @param array       $where
94
+   * @param string[]       $where
95 95
    * @param mixed|array $fieldList
96 96
    *     Field list can be scalar - it would be converted to array and used as field name
97 97
    * @param bool        $for_update
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
   }
130 130
 
131 131
   /**
132
-   * @param int|string  $recordId
133
-   * @param mixed|array $fieldList
132
+   * @param integer  $recordId
133
+   * @param string[] $fieldList
134 134
    * @param bool        $forUpdate
135 135
    *
136 136
    * @return array|null
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
             $result[] = 'NULL';
46 46
           break;
47 47
           default:
48
-            $string = (string)$fieldName;
48
+            $string = (string) $fieldName;
49 49
             if ($string == '') {
50 50
               throw new ExceptionDBFieldEmpty();
51 51
             }
52
-            $result[] = '`' . $string . '`';
52
+            $result[] = '`'.$string.'`';
53 53
         }
54 54
       }
55 55
     } else {
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
     if (!empty($fieldList)) {
78 78
       $user_record = self::$dbStatic->doquery(
79 79
         (
80
-          "SELECT {$fieldList}" .
81
-          " FROM {{" . self::$_table . "}}" .
82
-          (!empty($where) ? " WHERE {$where}" : '') .
83
-          (!empty($for_update) ? " FOR UPDATE" : '') .
80
+          "SELECT {$fieldList}".
81
+          " FROM {{".self::$_table."}}".
82
+          (!empty($where) ? " WHERE {$where}" : '').
83
+          (!empty($for_update) ? " FOR UPDATE" : '').
84 84
           ($returnFirst ? ' LIMIT 1' : '')
85 85
         ),
86 86
         $returnFirst
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
    */
138 138
   public static function getRecordById($recordId, $fieldList = '*', $forUpdate = false) {
139 139
 //    return static::getRecord(array(static::$_idField => $recordId), $fieldList, $forUpdate);
140
-    return static::getRecord(array(static::$_idField . '=' . $recordId), $fieldList, $forUpdate);
140
+    return static::getRecord(array(static::$_idField.'='.$recordId), $fieldList, $forUpdate);
141 141
   }
142 142
 
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
   public static function queryExistsIdInList($idList) {
150 150
     $query = null;
151 151
     if (!empty($idList)) {
152
-      $query = self::$dbStatic->doquery("SELECT `" . static::$_idField . "` FROM `{{" . static::$_table . "}}` WHERE `" . static::$_idField . "` IN (" . implode(',', $idList) . ")");
152
+      $query = self::$dbStatic->doquery("SELECT `".static::$_idField."` FROM `{{".static::$_table."}}` WHERE `".static::$_idField."` IN (".implode(',', $idList).")");
153 153
     }
154 154
 
155 155
     return !empty($query) ? $query : null;
Please login to merge, or discard this patch.
includes/classes/DBStaticNote.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
    * @param $note_id_edit
37 37
    */
38 38
   public static function db_note_update_by_id($note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky, $note_id_edit) {
39
-    doquery("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}',
39
+    doquery("UPDATE {{notes}} SET `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}',
40 40
         `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky}
41 41
         WHERE `id` = {$note_id_edit} LIMIT 1;");
42 42
   }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
    * @param $note_sticky
54 54
    */
55 55
   public static function db_note_insert($user, $note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky) {
56
-    doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}',
56
+    doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}',
57 57
         `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky};");
58 58
   }
59 59
 
Please login to merge, or discard this patch.
includes/classes/DbSqlStatement.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -187,23 +187,23 @@  discard block
 block discarded – undo
187 187
     $result = '';
188 188
     $result .= $this->stringEscape($this->operation);
189 189
 
190
-    $result .= ' ' . $this->selectFieldsToString($this->fields);
190
+    $result .= ' '.$this->selectFieldsToString($this->fields);
191 191
 
192 192
     $result .= ' FROM';
193
-    $result .= ' `{{' . $this->stringEscape($this->table) . '}}`';
194
-    $result .= !empty($this->alias) ? ' AS `' . $this->stringEscape($this->alias) . '`' : '';
193
+    $result .= ' `{{'.$this->stringEscape($this->table).'}}`';
194
+    $result .= !empty($this->alias) ? ' AS `'.$this->stringEscape($this->alias).'`' : '';
195 195
 
196 196
     // TODO - fields should be escaped !!
197
-    $result .= !empty($this->where) ? ' WHERE ' . implode(' AND ', $this->where) : '';
197
+    $result .= !empty($this->where) ? ' WHERE '.implode(' AND ', $this->where) : '';
198 198
 
199 199
     // TODO - fields should be escaped !!
200
-    $result .= !empty($this->group) ? ' GROUP BY ' . implode(',', $this->group) : '';
200
+    $result .= !empty($this->group) ? ' GROUP BY '.implode(',', $this->group) : '';
201 201
 
202 202
     // TODO - fields should be escaped !!
203
-    $result .= !empty($this->order) ? ' ORDER BY ' . implode(',', $this->order) : '';
203
+    $result .= !empty($this->order) ? ' ORDER BY '.implode(',', $this->order) : '';
204 204
 
205 205
     // TODO - fields should be escaped !!
206
-    $result .= !empty($this->limit) ? ' LIMIT ' . implode(',', $this->limit) : '';
206
+    $result .= !empty($this->limit) ? ' LIMIT '.implode(',', $this->limit) : '';
207 207
 
208 208
     // TODO - protect from double escape!
209 209
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
     $result = array();
225 225
     foreach ($fields as $fieldName) {
226
-      switch(true) {
226
+      switch (true) {
227 227
 //        case $fieldName === '*':
228 228
 //          $result[] = '*';
229 229
 //        break;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
   }
257 257
 
258 258
   protected function processFieldDefault($fieldName) {
259
-    $result = (string)$fieldName;
259
+    $result = (string) $fieldName;
260 260
     if (
261 261
       $result != ''
262 262
       &&
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
       !is_numeric($fieldName)
271 271
     ) {
272 272
       // Other should be formatted
273
-      $result = '`' . $this->stringEscape($result) . '`';
273
+      $result = '`'.$this->stringEscape($result).'`';
274 274
     }
275 275
 
276 276
     return $result;
Please login to merge, or discard this patch.