@@ -1,11 +1,11 @@ |
||
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 | } |
@@ -3,8 +3,8 @@ discard block |
||
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 |
||
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 |
@@ -27,19 +27,19 @@ |
||
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 | } |
@@ -85,7 +85,7 @@ discard block |
||
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 |
||
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 |
||
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 { |
@@ -188,6 +188,11 @@ discard block |
||
188 | 188 | */ |
189 | 189 | // OK v4 |
190 | 190 | // TODO - вынести в отдельный класс |
191 | +/** |
|
192 | + * @param string $db_id_field_name |
|
193 | + * @param string $db_table_name |
|
194 | + * @param string $db_value_field_name |
|
195 | + */ |
|
191 | 196 | function db_get_set_unique_id_value($current_value_unsafe, $db_id_field_name, $db_table_name, $db_value_field_name) { |
192 | 197 | $current_value_safe = db_escape($current_value_unsafe); |
193 | 198 | $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); |
@@ -220,7 +225,7 @@ discard block |
||
220 | 225 | |
221 | 226 | /** |
222 | 227 | * @param $user |
223 | - * @param $username_safe |
|
228 | + * @param string $username_safe |
|
224 | 229 | */ |
225 | 230 | function db_player_name_history_replace($user, $username_safe) { |
226 | 231 | doquery("REPLACE INTO {{player_name_history}} SET `player_id` = {$user['id']}, `player_name` = '{$username_safe}'"); |
@@ -228,7 +233,7 @@ discard block |
||
228 | 233 | |
229 | 234 | |
230 | 235 | /** |
231 | - * @param $username_safe |
|
236 | + * @param string $username_safe |
|
232 | 237 | * |
233 | 238 | * @return array|bool|mysqli_result|null |
234 | 239 | */ |
@@ -485,12 +490,12 @@ discard block |
||
485 | 490 | |
486 | 491 | |
487 | 492 | /** |
488 | - * @param $user_id |
|
489 | - * @param $change_type |
|
493 | + * @param integer $user_id |
|
494 | + * @param integer $change_type |
|
490 | 495 | * @param $dark_matter |
491 | - * @param $comment |
|
496 | + * @param string $comment |
|
492 | 497 | * @param $row |
493 | - * @param $page_url |
|
498 | + * @param string $page_url |
|
494 | 499 | */ |
495 | 500 | function db_log_dark_matter_insert($user_id, $change_type, $dark_matter, $comment, $row, $page_url) { |
496 | 501 | doquery( |
@@ -506,7 +511,7 @@ discard block |
||
506 | 511 | /** |
507 | 512 | * @param $user_id_safe |
508 | 513 | * |
509 | - * @return array|bool|mysqli_result|null |
|
514 | + * @return integer |
|
510 | 515 | */ |
511 | 516 | function db_referral_get_by_id($user_id_safe) { |
512 | 517 | $old_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id_safe} LIMIT 1 FOR UPDATE;", true); |
@@ -534,9 +539,9 @@ discard block |
||
534 | 539 | |
535 | 540 | // Quests *********************************************************************************************************** |
536 | 541 | /** |
537 | - * @param $query_add_select |
|
542 | + * @param string $query_add_select |
|
538 | 543 | * @param $query_add_from |
539 | - * @param $query_add_where |
|
544 | + * @param string $query_add_where |
|
540 | 545 | * |
541 | 546 | * @return array|bool|mysqli_result|null |
542 | 547 | */ |
@@ -580,11 +585,11 @@ discard block |
||
580 | 585 | } |
581 | 586 | |
582 | 587 | /** |
583 | - * @param $quest_name |
|
584 | - * @param $quest_type |
|
585 | - * @param $quest_description |
|
588 | + * @param string $quest_name |
|
589 | + * @param integer $quest_type |
|
590 | + * @param string $quest_description |
|
586 | 591 | * @param $quest_conditions |
587 | - * @param $quest_rewards |
|
592 | + * @param string $quest_rewards |
|
588 | 593 | * @param $quest_id |
589 | 594 | */ |
590 | 595 | function db_quest_update($quest_name, $quest_type, $quest_description, $quest_conditions, $quest_rewards, $quest_id) { |
@@ -607,7 +612,7 @@ discard block |
||
607 | 612 | /** |
608 | 613 | * @param $banner |
609 | 614 | * @param $banned |
610 | - * @param $reason |
|
615 | + * @param string $reason |
|
611 | 616 | * @param $ban_until |
612 | 617 | */ |
613 | 618 | function db_ban_insert($banner, $banned, $reason, $ban_until) { |
@@ -630,7 +635,7 @@ discard block |
||
630 | 635 | /** |
631 | 636 | * @param $banner |
632 | 637 | * @param $banned |
633 | - * @param $reason |
|
638 | + * @param string $reason |
|
634 | 639 | */ |
635 | 640 | function db_ban_insert_unset($banner, $banned, $reason) { |
636 | 641 | doquery( |
@@ -161,7 +161,7 @@ |
||
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 | } |
@@ -47,6 +47,9 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | +/** |
|
51 | + * @param boolean $player |
|
52 | + */ |
|
50 | 53 | function db_user_by_id($user_id_unsafe, $for_update = false, $fields = '*', $player = null) { |
51 | 54 | return classSupernova::db_get_user_by_id($user_id_unsafe, $for_update, $fields, $player); |
52 | 55 | } |
@@ -105,6 +108,9 @@ discard block |
||
105 | 108 | return isset($result['user_count']) ? $result['user_count'] : 0; |
106 | 109 | } |
107 | 110 | |
111 | +/** |
|
112 | + * @param integer $config_user_birthday_range |
|
113 | + */ |
|
108 | 114 | function db_user_list_to_celebrate($config_user_birthday_range) { |
109 | 115 | return doquery( |
110 | 116 | "SELECT |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DB ACS functions |
|
4 | - */ |
|
3 | + * DB ACS functions |
|
4 | + */ |
|
5 | 5 | |
6 | 6 | /* ACS ****************************************************************************************************************/ |
7 | 7 | /** |
@@ -22,6 +22,10 @@ discard block |
||
22 | 22 | doquery('DELETE FROM `{{aks}}` WHERE `id` NOT IN (SELECT DISTINCT `fleet_group` FROM `{{fleets}}`);'); |
23 | 23 | } |
24 | 24 | |
25 | +/** |
|
26 | + * @param double $arrival |
|
27 | + * @param integer $target_structure |
|
28 | + */ |
|
25 | 29 | function db_missile_insert($target_coord, $user, $planetrow, $arrival, $fleet_ship_count, $target_structure) { |
26 | 30 | doquery( |
27 | 31 | "INSERT INTO `{{iraks}}` SET |
@@ -52,7 +56,7 @@ discard block |
||
52 | 56 | /** |
53 | 57 | * @param $user |
54 | 58 | * @param $planet_dst |
55 | - * @param $time_limit |
|
59 | + * @param integer $time_limit |
|
56 | 60 | * |
57 | 61 | * @return array|bool|mysqli_result|null |
58 | 62 | */ |
@@ -113,14 +117,14 @@ discard block |
||
113 | 117 | |
114 | 118 | |
115 | 119 | /** |
116 | - * @param $fleet_group_id_list |
|
120 | + * @param string $fleet_group_id_list |
|
117 | 121 | */ |
118 | 122 | function db_acs_delete_by_list($fleet_group_id_list) { |
119 | 123 | doquery("DELETE FROM {{aks}} WHERE `id` IN ({$fleet_group_id_list})"); |
120 | 124 | } |
121 | 125 | |
122 | 126 | /** |
123 | - * @param $bashing_list |
|
127 | + * @param string $bashing_list |
|
124 | 128 | */ |
125 | 129 | function db_bashing_insert($bashing_list) { |
126 | 130 | doquery("INSERT INTO {{bashing}} (bashing_user_id, bashing_planet_id, bashing_time) VALUES {$bashing_list};"); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @copyright 2008 by Gorlum for Project "SuperNova.WS" |
11 | 11 | */ |
12 | 12 | function flt_mission_hold($mission_data) { |
13 | - if($mission_data->fleet->time_mission_job_complete < SN_TIME_NOW) { |
|
13 | + if ($mission_data->fleet->time_mission_job_complete < SN_TIME_NOW) { |
|
14 | 14 | $mission_data->fleet->mark_fleet_as_returned_and_save(); |
15 | 15 | |
16 | 16 | return CACHE_FLEET; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | $destination_planet = &$mission_data->dst_planet; |
18 | 18 | |
19 | - if(empty($destination_planet['id_owner']) || $objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
19 | + if (empty($destination_planet['id_owner']) || $objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
20 | 20 | $objFleet->mark_fleet_as_returned_and_save(); |
21 | 21 | |
22 | 22 | return CACHE_FLEET; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $fleet_resources[RES_DEUTERIUM], $lang['Deuterium'] |
32 | 32 | ) . '<br />' . $lang['sys_relocate_mess_user']; |
33 | 33 | $fleet_real_array = $objFleet->get_unit_list(); |
34 | - foreach($fleet_real_array as $ship_id => $ship_count) { |
|
34 | + foreach ($fleet_real_array as $ship_id => $ship_count) { |
|
35 | 35 | $Message .= $lang['tech'][$ship_id] . ' - ' . $ship_count . '<br />'; |
36 | 36 | } |
37 | 37 | msg_send_simple_message( |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $source_planet = &$mission_data->src_planet; |
17 | 17 | $destination_planet = &$mission_data->dst_planet; |
18 | 18 | |
19 | - if(!isset($destination_planet['id']) || !$destination_planet['id_owner']) { |
|
19 | + if (!isset($destination_planet['id']) || !$destination_planet['id_owner']) { |
|
20 | 20 | $objFleet->mark_fleet_as_returned_and_save(); |
21 | 21 | |
22 | 22 | return CACHE_FLEET; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $fleet_resources[RES_DEUTERIUM], $lang['Deuterium']); |
32 | 32 | msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
33 | 33 | |
34 | - if($objFleet->target_owner_id <> $objFleet->playerOwnerId) { |
|
34 | + if ($objFleet->target_owner_id <> $objFleet->playerOwnerId) { |
|
35 | 35 | msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
36 | 36 | } |
37 | 37 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | /** |
32 | 32 | * Fleet mission "Relocate" |
33 | 33 | * |
34 | - * @param $mission_data Mission |
|
34 | + * @param Mission $mission_data Mission |
|
35 | 35 | * |
36 | 36 | * @return int |
37 | 37 | * |