Completed
Push — work-fleets ( 1c4183...d64c53 )
by SuperNova.WS
05:36
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/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/ExceptionDbSqlWhereNotAnArray.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-class ExceptionDbSqlWhereNotAnArray extends Exception{
3
+class ExceptionDbSqlWhereNotAnArray extends Exception {
4 4
 
5 5
 }
Please login to merge, or discard this patch.
includes/classes/DBStaticRecord.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@
 block discarded – undo
55 55
   }
56 56
 
57 57
   /**
58
-   * @param int|string  $recordId
59
-   * @param mixed|array $fieldList
58
+   * @param integer  $recordId
59
+   * @param string[] $fieldList
60 60
    * @param bool        $forUpdate
61 61
    *
62 62
    * @return array|null
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
    */
64 64
   public static function getRecordById($recordId, $fieldList = '*', $forUpdate = false) {
65 65
 //    return static::getRecord(array(static::$_idField => $recordId), $fieldList, $forUpdate);
66
-    return static::getRecord(array(static::$_idField . '=' . $recordId), $fieldList, $forUpdate);
66
+    return static::getRecord(array(static::$_idField.'='.$recordId), $fieldList, $forUpdate);
67 67
   }
68 68
 
69 69
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         DbSqlStatement::build(null, get_called_class())
85 85
           ->select()
86 86
           ->fields(static::$_idField)
87
-          ->where(array("`" . static::$_idField . "` IN (" . implode(',', $idList) . ")"))
87
+          ->where(array("`".static::$_idField."` IN (".implode(',', $idList).")"))
88 88
       );
89 89
     }
90 90
 
Please login to merge, or discard this patch.
includes/classes/DbSqlStatement.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -234,24 +234,24 @@  discard block
 block discarded – undo
234 234
     $result = '';
235 235
     $result .= $this->stringEscape($this->operation);
236 236
 
237
-    $result .= ' ' . $this->selectFieldsToString($this->fields);
237
+    $result .= ' '.$this->selectFieldsToString($this->fields);
238 238
 
239 239
     $result .= ' FROM';
240
-    $result .= ' `{{' . $this->stringEscape($this->table) . '}}`';
241
-    $result .= !empty($this->alias) ? ' AS `' . $this->stringEscape($this->alias) . '`' : '';
240
+    $result .= ' `{{'.$this->stringEscape($this->table).'}}`';
241
+    $result .= !empty($this->alias) ? ' AS `'.$this->stringEscape($this->alias).'`' : '';
242 242
 
243 243
     // TODO - fields should be escaped !!
244
-    $result .= !empty($this->where) ? ' WHERE ' . implode(' AND ', $this->where) : '';
244
+    $result .= !empty($this->where) ? ' WHERE '.implode(' AND ', $this->where) : '';
245 245
 
246 246
     // TODO - fields should be escaped !!
247
-    $result .= !empty($this->group) ? ' GROUP BY ' . implode(',', $this->group) : '';
247
+    $result .= !empty($this->group) ? ' GROUP BY '.implode(',', $this->group) : '';
248 248
 
249 249
     // TODO - fields should be escaped !!
250
-    $result .= !empty($this->order) ? ' ORDER BY ' . implode(',', $this->order) : '';
250
+    $result .= !empty($this->order) ? ' ORDER BY '.implode(',', $this->order) : '';
251 251
 
252 252
     // TODO - fields should be escaped !!
253 253
     // TODO - separate offset and row_count
254
-    $result .= !empty($this->limit) ? ' LIMIT ' . implode(' OFFSET ', $this->limit) : '';
254
+    $result .= !empty($this->limit) ? ' LIMIT '.implode(' OFFSET ', $this->limit) : '';
255 255
 
256 256
     // TODO - protect from double escape!
257 257
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
    */
290 290
   protected function processField($fieldName) {
291 291
     if (is_bool($fieldName)) {
292
-      $result = (string)intval($fieldName);
292
+      $result = (string) intval($fieldName);
293 293
     } elseif (is_null($fieldName)) {
294 294
       $result = 'NULL';
295 295
     } elseif ($fieldName === '*') {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
    * @return string
308 308
    */
309 309
   protected function processFieldDefault($fieldName) {
310
-    $result = (string)$fieldName;
310
+    $result = (string) $fieldName;
311 311
     if (
312 312
       $result != ''
313 313
       &&
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
       !is_numeric($fieldName)
319 319
     ) {
320 320
       // Other should be formatted
321
-      $result = '`' . $this->stringEscape($result) . '`';
321
+      $result = '`'.$this->stringEscape($result).'`';
322 322
     }
323 323
 
324 324
     return $result;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -337,9 +337,9 @@
 block discarded – undo
337 337
   }
338 338
 
339 339
   /**
340
-   * @param $string
340
+   * @param string $string
341 341
    *
342
-   * @return mixed|string
342
+   * @return string
343 343
    */
344 344
   protected function stringEscape($string) {
345 345
     return
Please login to merge, or discard this patch.