Completed
Push — work-fleets ( ab257a...4117d7 )
by SuperNova.WS
05:11
created
includes/alliance/ali_internal_admin.inc 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7
-if(!$user_admin) {
7
+if (!$user_admin) {
8 8
   message($lang['Denied_access'], $lang['ally_admin']);
9 9
 }
10 10
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
23 23
 
24 24
 
25
-if(sys_get_param_str('isSaveOptions')) {
25
+if (sys_get_param_str('isSaveOptions')) {
26 26
   require_once('includes/includes/sys_avatar.php');
27 27
 
28 28
   $new_image = $ally['ally_image'];
@@ -34,46 +34,46 @@  discard block
 block discarded – undo
34 34
 //  $template->assign_block_vars('result', $avatar_upload_result);
35 35
 
36 36
   $ally_changeset = array();
37
-  if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
37
+  if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
38 38
     $new_tag = db_escape($new_tag);
39 39
     $ally_changeset[] = "`ally_tag`='{$new_tag}'";
40 40
     db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'");
41 41
   }
42
-  if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
42
+  if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
43 43
     $new_name = db_escape($new_name);
44 44
     $ally_changeset[] = "`ally_name`='{$new_name}'";
45 45
   }
46 46
 
47
-  if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
47
+  if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
48 48
     $new_owner_rank = db_escape($new_owner_rank);
49 49
     $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'";
50 50
   }
51
-  if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
51
+  if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
52 52
     $new_web = db_escape($new_web);
53 53
     $ally_changeset[] = "`ally_web` = '{$new_web}'";
54 54
   }
55 55
   $new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow']);
56 56
   $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'";
57
-  if($new_image != $ally['ally_image']) {
57
+  if ($new_image != $ally['ally_image']) {
58 58
     $new_image = intval($new_image);
59 59
     $ally_changeset[] = "`ally_image` = '{$new_image}'";
60 60
   }
61 61
 
62
-  if(!empty($ally_changeset)) {
62
+  if (!empty($ally_changeset)) {
63 63
     db_ally_update_by_changeset($ally_changeset, $ally);
64 64
     sys_redirect('alliance.php?mode=admin&edit=ally');
65 65
   }
66
-} elseif(sys_get_param_str('isSaveText')) {
66
+} elseif (sys_get_param_str('isSaveText')) {
67 67
   $text = sys_get_param_str_both('text');
68 68
   db_ally_update_texts($text_list, $allyTextID, $text, $ally);
69 69
   $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe'];
70
-} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
71
-  if(!$isAllyOwner) {
70
+} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
71
+  if (!$isAllyOwner) {
72 72
     message($lang['Denied_access'], $lang['ally_admin']);
73 73
   }
74 74
 
75 75
   $newLeader = db_user_by_id($idNewLeader, false, `ally_id`);
76
-  if($newLeader['ally_id'] == $user['ally_id']) {
76
+  if ($newLeader['ally_id'] == $user['ally_id']) {
77 77
     sn_db_transaction_start();
78 78
     db_user_set_by_id($user['id'], "`ally_rank_id`='0'");
79 79
     db_ally_update_owner($idNewLeader, $user);
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     sn_db_transaction_commit();
82 82
     sys_redirect('alliance.php');
83 83
   }
84
-} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
85
-  if(!$isAllyOwner) {
84
+} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
85
+  if (!$isAllyOwner) {
86 86
     message($lang['Denied_access'], $lang['ally_admin']);
87 87
   }
88 88
   sn_db_transaction_start();
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
   $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`');
129 129
   unset($tmp);
130 130
   // while ($userAllyAdmin = db_fetch($userAllyAdmins))
131
-  foreach($userAllyAdmins as $userAllyAdmin) {
131
+  foreach ($userAllyAdmins as $userAllyAdmin) {
132 132
 // pdump($userAllyAdmin);
133 133
     $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>";
134 134
   }
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
   $template->assign_var('adminMembers', $tmp);
137 137
 }
138 138
 
139
-foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
140
-  if(!$sn_ali_admin_action_locale['title']) {
139
+foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
140
+  if (!$sn_ali_admin_action_locale['title']) {
141 141
     continue;
142 142
   }
143 143
   $template->assign_block_vars('admin_actions', array(
Please login to merge, or discard this patch.
includes/alliance/ali_external_search.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7 7
 $template = gettemplate('ali_search', true);
8 8
 
9 9
 $ali_search_text = sys_get_param_str('searchtext');
10
-if($ali_search_text) {
10
+if ($ali_search_text) {
11 11
   $template->assign_var('SEARCH_TEXT', $ali_search_text);
12 12
 
13 13
   $search = db_ally_search_by_name_or_tag($ali_search_text);
14
-  if(db_num_rows($search)) {
15
-    while($ally_row = db_fetch($search)) {
14
+  if (db_num_rows($search)) {
15
+    while ($ally_row = db_fetch($search)) {
16 16
       $template->assign_block_vars('alliances', array(
17 17
         'ID'          => $ally_row['id'],
18 18
         'TAG'         => $ally_row['ally_tag'],
Please login to merge, or discard this patch.
includes/functions/_news.php 1 patch
Spacing   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
   $announce_list = db_news_list_get_by_query($template, $query_where, $query_limit);
12 12
 
13 13
   $users = array();
14
-  while($announce = db_fetch($announce_list)) {
15
-    if($announce['user_id'] && !isset($users[$announce['user_id']])) {
14
+  while ($announce = db_fetch($announce_list)) {
15
+    if ($announce['user_id'] && !isset($users[$announce['user_id']])) {
16 16
       $users[$announce['user_id']] = db_user_by_id($announce['user_id']);
17 17
     }
18 18
 
19 19
     $survey_vote = array('survey_vote_id' => 1);
20 20
     $survey_complete = strtotime($announce['survey_until']) < SN_TIME_NOW;
21 21
 
22
-    if($announce['survey_id'] && !empty($user['id'])) {
22
+    if ($announce['survey_id'] && !empty($user['id'])) {
23 23
       $survey_vote = !$survey_complete ? db_survey_get_vote($announce, $user) : array();
24 24
     }
25 25
 
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
       'ANNOUNCE'        => cht_message_parse($announce['strAnnounce'], false, intval($announce['authlevel'])),
32 32
       'DETAIL_URL'      => $announce['detail_url'],
33 33
       'USER_NAME'       =>
34
-        isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) :
35
-          js_safe_string($announce['user_name']),
34
+        isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) : js_safe_string($announce['user_name']),
36 35
       'NEW'             => $announce['unix_time'] + $config->game_news_actual >= SN_TIME_NOW,
37 36
       'FUTURE'          => $announce['unix_time'] > SN_TIME_NOW,
38 37
       'SURVEY_ID'       => $announce['survey_id'],
@@ -42,25 +41,25 @@  discard block
 block discarded – undo
42 41
       'SURVEY_UNTIL'    => $announce['survey_until'],
43 42
     ));
44 43
 
45
-    foreach($announce_exploded as $announce_paragraph) {
44
+    foreach ($announce_exploded as $announce_paragraph) {
46 45
       $template->assign_block_vars('announces.paragraph', array(
47 46
         'TEXT' => $announce_paragraph,
48 47
       ));
49 48
     }
50 49
 
51
-    if($announce['survey_id']) {
50
+    if ($announce['survey_id']) {
52 51
       $survey_query = db_survey_get_answer_texts($announce);
53 52
       $survey_vote_result = array();
54 53
       $total_votes = 0;
55
-      while($row = db_fetch($survey_query)) {
54
+      while ($row = db_fetch($survey_query)) {
56 55
         $survey_vote_result[] = $row;
57 56
         $total_votes += $row['VOTES'];
58 57
       }
59 58
 
60
-      if(empty($survey_vote) && !$survey_complete) {
59
+      if (empty($survey_vote) && !$survey_complete) {
61 60
         // Can vote
62 61
         $survey_query = db_survey_answers_get_list_by_parent($announce);
63
-        while($row = db_fetch($survey_query)) {
62
+        while ($row = db_fetch($survey_query)) {
64 63
           $template->assign_block_vars('announces.survey_answers', array(
65 64
             'ID'   => $row['survey_answer_id'],
66 65
             'TEXT' => $row['survey_answer_text'],
@@ -68,7 +67,7 @@  discard block
 block discarded – undo
68 67
         }
69 68
       } else {
70 69
         // Show result
71
-        foreach($survey_vote_result as &$vote_result) {
70
+        foreach ($survey_vote_result as &$vote_result) {
72 71
           $vote_percent = $total_votes ? $vote_result['VOTES'] / $total_votes * 100 : 0;
73 72
           $vote_result['PERCENT'] = $vote_percent;
74 73
           $vote_result['PERCENT_TEXT'] = round($vote_percent, 1);
@@ -85,7 +84,7 @@  discard block
 block discarded – undo
85 84
 }
86 85
 
87 86
 function nws_mark_read(&$user) {
88
-  if(isset($user['id'])) {
87
+  if (isset($user['id'])) {
89 88
     db_user_set_by_id($user['id'], '`news_lastread` = ' . SN_TIME_NOW);
90 89
     $user['news_lastread'] = SN_TIME_NOW;
91 90
   }
@@ -94,17 +93,17 @@  discard block
 block discarded – undo
94 93
 }
95 94
 
96 95
 function survey_vote(&$user) {
97
-  if(empty($user['id'])) {
96
+  if (empty($user['id'])) {
98 97
     return true;
99 98
   }
100 99
 
101 100
   sn_db_transaction_start();
102 101
   $survey_id = sys_get_param_id('survey_id');
103 102
   $is_voted = db_survey_vote_get($user, $survey_id);
104
-  if(empty($is_voted)) {
103
+  if (empty($is_voted)) {
105 104
     $survey_vote_id = sys_get_param_id('survey_vote');
106 105
     $is_answer_exists = db_survey_answer_get($survey_id, $survey_vote_id);
107
-    if(!empty($is_answer_exists)) {
106
+    if (!empty($is_answer_exists)) {
108 107
       $user_name_safe = db_escape($user['username']);
109 108
       db_survey_vote_insert($user, $survey_id, $survey_vote_id, $user_name_safe);
110 109
     }
Please login to merge, or discard this patch.
includes/functions/sys_maintenance.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
     ),
25 25
   );
26 26
 
27
-  foreach($queries as &$query) {
28
-    if(!empty($query['query'])) {
27
+  foreach ($queries as &$query) {
28
+    if (!empty($query['query'])) {
29 29
       $query['result'] = doquery($query['query']);
30
-    } elseif(!empty($query['callable']) && is_callable($query['callable'])) {
30
+    } elseif (!empty($query['callable']) && is_callable($query['callable'])) {
31 31
       call_user_func($query['callable']);
32 32
     }
33 33
     $query['error'] = classSupernova::$db->db_error();
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
   $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']);
72 72
 //  pdump($prev_run_array);
73 73
   $scheduleList = explode(',', $scheduleList);
74
-  array_walk($scheduleList, function (&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) {
74
+  array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) {
75 75
     // pdump($schedule);
76 76
     $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule))));
77 77
 
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
     */
84 84
     // pdump($schedule);
85 85
 
86
-    foreach($prev_run_array as $index => $date_part) {
86
+    foreach ($prev_run_array as $index => $date_part) {
87 87
       $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part;
88 88
       $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index];
89 89
     }
90
-    if($schedule['array']['recorded'] == $schedule['array']['now']) {
90
+    if ($schedule['array']['recorded'] == $schedule['array']['now']) {
91 91
       unset($schedule['array']['now']);
92 92
     }
93 93
 
94
-    foreach($schedule['array'] as $name => $array) {
94
+    foreach ($schedule['array'] as $name => $array) {
95 95
       $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}";
96 96
       $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval;
97 97
       $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval;
98 98
     }
99 99
 
100
-    foreach($schedule['string'] as $string) {
100
+    foreach ($schedule['string'] as $string) {
101 101
       $timestamp = strtotime($string);
102 102
       $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string));
103 103
     }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
   $prev_run = 0;
131 131
   $next_run = 0;
132
-  foreach($possible_schedules as $timestamp => $string_date) {
132
+  foreach ($possible_schedules as $timestamp => $string_date) {
133 133
     $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run;
134 134
     $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run;
135 135
 //    pdump($schedule, '$schedule ' . date(FMT_DATE_TIME_SQL, $schedule));
Please login to merge, or discard this patch.
includes/functions/geoip.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-function geoip_status(){return sn_function_call(__FUNCTION__, array(&$result));}
3
+function geoip_status() {return sn_function_call(__FUNCTION__, array(&$result)); }
4 4
 function sn_geoip_status(&$result) {
5 5
   return $result = false;
6 6
 }
7 7
 
8
-function geoip_ip_info($ip){return sn_function_call(__FUNCTION__, array($ip, &$result));}
8
+function geoip_ip_info($ip) {return sn_function_call(__FUNCTION__, array($ip, &$result)); }
9 9
 function sn_geoip_ip_info($ip, &$result) {
10 10
   return $result = false;
11 11
 }
Please login to merge, or discard this patch.
includes/functions/ali_alliances.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 function ali_rank_list_save($ranks) {
4 4
   global $user;
5 5
 
6
-  if(!empty($ranks)) {
7
-    foreach($ranks as $rank => $rights) {
6
+  if (!empty($ranks)) {
7
+    foreach ($ranks as $rank => $rights) {
8 8
       $rights = implode(',', $rights);
9 9
       $ranklist .= $rights . ';';
10 10
     }
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
   $temp_array = array();
23 23
   $query = db_ally_diplomacy_get_relations($ally_from, $ally_to);
24 24
 
25
-  while($record = db_fetch($query)) {
25
+  while ($record = db_fetch($query)) {
26 26
     $temp_array[$record['alliance_diplomacy_contr_ally_id']] = $record;
27 27
   }
28 28
 
Please login to merge, or discard this patch.
includes/db/db_helpers.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@
 block discarded – undo
27 27
  */
28 28
 function db_set_make_safe_string($set, $delta = false) {
29 29
   $set_safe = array();
30
-  foreach($set as $field => $value) {
31
-    if(empty($field)) {
30
+  foreach ($set as $field => $value) {
31
+    if (empty($field)) {
32 32
       continue;
33 33
     }
34 34
 
35 35
     $field = '`' . db_escape($field) . '`';
36 36
     $new_value = $value;
37
-    if($value === null) {
37
+    if ($value === null) {
38 38
       $new_value = 'NULL';
39
-    } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) {
39
+    } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) {
40 40
       // non-float
41 41
       $new_value = '"' . db_escape($value) . '"';
42
-    } elseif($delta) {
42
+    } elseif ($delta) {
43 43
       // float and DELTA-set
44 44
       $new_value = "{$field} + ({$new_value})";
45 45
     }
Please login to merge, or discard this patch.
includes/db/db_queries.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 function db_stat_list_statistic($who, $is_common_stat, $Rank, $start, $source = false) {
87 87
 // pdump($source);
88
-  if(!$source) {
88
+  if (!$source) {
89 89
     $source = array(
90 90
       'statpoints' => 'statpoints',
91 91
       'users'      => 'users',
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
     );
107 107
   }
108 108
 // pdump($source);
109
-  if($who == 1) {
110
-    if($is_common_stat) { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday`
109
+  if ($who == 1) {
110
+    if ($is_common_stat) { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday`
111 111
       $query_str =
112 112
         "SELECT
113 113
       @rownum:=@rownum+1 rownum, subject.{$source['id']} as `id`, sp.{$Rank}_rank as rank, sp.{$Rank}_old_rank as rank_old, sp.{$Rank}_points as points, subject.{$source['username']} as `name`, subject.*
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 function db_get_set_unique_id_value($current_value_unsafe, $db_id_field_name, $db_table_name, $db_value_field_name) {
192 192
   $current_value_safe = db_escape($current_value_unsafe);
193 193
   $value_id = doquery("SELECT `{$db_id_field_name}` AS id_field FROM {{{$db_table_name}}} WHERE `{$db_value_field_name}` = '{$current_value_safe}' LIMIT 1 FOR UPDATE", true);
194
-  if(!isset($value_id['id_field']) || !$value_id['id_field']) {
194
+  if (!isset($value_id['id_field']) || !$value_id['id_field']) {
195 195
     doquery("INSERT INTO {{{$db_table_name}}} (`{$db_value_field_name}`) VALUES ('{$current_value_safe}');");
196 196
     $variable_id = db_insert_id();
197 197
   } else {
Please login to merge, or discard this patch.
includes/db/db_queries_users.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
   !is_array($user_id_list) ? $user_id_list = array($user_id_list) : false;
162 162
 
163 163
   $user_list = array();
164
-  foreach($user_id_list as $user_id_unsafe) {
164
+  foreach ($user_id_list as $user_id_unsafe) {
165 165
     $user = db_user_by_id($user_id_unsafe);
166 166
     !empty($user) ? $user_list[$user_id_unsafe] = $user : false;
167 167
   }
Please login to merge, or discard this patch.