Completed
Push — work-fleets ( a5ca82...ab0738 )
by SuperNova.WS
05:46
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 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
   // TODO - fields should be escaped !!
175 175
   // TODO - $where should be validated and checked!
176 176
   public function where($where = array()) {
177
-    if(!is_array($where)) {
177
+    if (!is_array($where)) {
178 178
       throw new ExceptionDbSqlWhereNotAnArray();
179 179
     }
180 180
     $this->where = $where;
@@ -209,24 +209,24 @@  discard block
 block discarded – undo
209 209
     $result = '';
210 210
     $result .= $this->stringEscape($this->operation);
211 211
 
212
-    $result .= ' ' . $this->selectFieldsToString($this->fields);
212
+    $result .= ' '.$this->selectFieldsToString($this->fields);
213 213
 
214 214
     $result .= ' FROM';
215
-    $result .= ' `{{' . $this->stringEscape($this->table) . '}}`';
216
-    $result .= !empty($this->alias) ? ' AS `' . $this->stringEscape($this->alias) . '`' : '';
215
+    $result .= ' `{{'.$this->stringEscape($this->table).'}}`';
216
+    $result .= !empty($this->alias) ? ' AS `'.$this->stringEscape($this->alias).'`' : '';
217 217
 
218 218
     // TODO - fields should be escaped !!
219
-    $result .= !empty($this->where) ? ' WHERE ' . implode(' AND ', $this->where) : '';
219
+    $result .= !empty($this->where) ? ' WHERE '.implode(' AND ', $this->where) : '';
220 220
 
221 221
     // TODO - fields should be escaped !!
222
-    $result .= !empty($this->group) ? ' GROUP BY ' . implode(',', $this->group) : '';
222
+    $result .= !empty($this->group) ? ' GROUP BY '.implode(',', $this->group) : '';
223 223
 
224 224
     // TODO - fields should be escaped !!
225
-    $result .= !empty($this->order) ? ' ORDER BY ' . implode(',', $this->order) : '';
225
+    $result .= !empty($this->order) ? ' ORDER BY '.implode(',', $this->order) : '';
226 226
 
227 227
     // TODO - fields should be escaped !!
228 228
     // TODO - separate offset and row_count
229
-    $result .= !empty($this->limit) ? ' LIMIT ' . implode(' OFFSET ', $this->limit) : '';
229
+    $result .= !empty($this->limit) ? ' LIMIT '.implode(' OFFSET ', $this->limit) : '';
230 230
 
231 231
     // TODO - protect from double escape!
232 232
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
    */
265 265
   protected function processField($fieldName) {
266 266
     if (is_bool($fieldName)) {
267
-      $result = (string)intval($fieldName);
267
+      $result = (string) intval($fieldName);
268 268
     } elseif (is_null($fieldName)) {
269 269
       $result = 'NULL';
270 270
     } elseif ($fieldName === '*') {
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
    * @return string
283 283
    */
284 284
   protected function processFieldDefault($fieldName) {
285
-    $result = (string)$fieldName;
285
+    $result = (string) $fieldName;
286 286
     if (
287 287
       $result != ''
288 288
       &&
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
       !is_numeric($fieldName)
297 297
     ) {
298 298
       // Other should be formatted
299
-      $result = '`' . $this->stringEscape($result) . '`';
299
+      $result = '`'.$this->stringEscape($result).'`';
300 300
     }
301 301
 
302 302
     return $result;
Please login to merge, or discard this patch.