@@ -239,6 +239,9 @@ |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | + /** |
|
243 | + * @param string $arrayName |
|
244 | + */ |
|
242 | 245 | protected function mergeArraySpecial($arrayName) { |
243 | 246 | global $sn_mvc; |
244 | 247 |
@@ -286,7 +286,6 @@ discard block |
||
286 | 286 | /** |
287 | 287 | * Функция пытается залогиниться по всем известным провайдерам |
288 | 288 | * |
289 | - * @param null $result |
|
290 | 289 | */ |
291 | 290 | public function login() { |
292 | 291 | if(empty(sn_module::$sn_module_list['auth'])) { |
@@ -823,10 +822,17 @@ discard block |
||
823 | 822 | |
824 | 823 | // OK v4.5 |
825 | 824 | // TODO - REMEMBER_ME |
825 | + |
|
826 | + /** |
|
827 | + * @param integer $period |
|
828 | + */ |
|
826 | 829 | protected static function cookie_set($value, $impersonate = false, $period = null) { |
827 | 830 | sn_setcookie($impersonate ? SN_COOKIE_U_I : SN_COOKIE_U, $value, $period === null ? SN_TIME_NOW + PERIOD_YEAR : $period, SN_ROOT_RELATIVE); |
828 | 831 | } |
829 | 832 | |
833 | + /** |
|
834 | + * @param string $message |
|
835 | + */ |
|
830 | 836 | protected static function flog($message, $die = false) { |
831 | 837 | if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
832 | 838 | return; |
@@ -171,6 +171,10 @@ discard block |
||
171 | 171 | * @return bool |
172 | 172 | */ |
173 | 173 | // OK v4.5 |
174 | + |
|
175 | + /** |
|
176 | + * @param string $account_name_unsafe |
|
177 | + */ |
|
174 | 178 | public function db_get_by_name($account_name_unsafe) { |
175 | 179 | $this->reset(); |
176 | 180 | |
@@ -207,6 +211,11 @@ discard block |
||
207 | 211 | * |
208 | 212 | */ |
209 | 213 | // OK v4.5 |
214 | + |
|
215 | + /** |
|
216 | + * @param string $account_name_unsafe |
|
217 | + * @param string $email_unsafe |
|
218 | + */ |
|
210 | 219 | public function db_get_by_name_or_email($account_name_unsafe, $email_unsafe) { |
211 | 220 | $this->reset(); |
212 | 221 | |
@@ -223,6 +232,13 @@ discard block |
||
223 | 232 | * @throws Exception |
224 | 233 | */ |
225 | 234 | // OK v4.5 |
235 | + |
|
236 | + /** |
|
237 | + * @param string $account_name_unsafe |
|
238 | + * @param string $password_raw |
|
239 | + * @param string $email_unsafe |
|
240 | + * @param string $language_unsafe |
|
241 | + */ |
|
226 | 242 | public function db_create($account_name_unsafe, $password_raw, $email_unsafe, $language_unsafe = null, $salt_unsafe = null) { |
227 | 243 | $this->reset(); |
228 | 244 | |
@@ -317,6 +333,11 @@ discard block |
||
317 | 333 | * @return int|string |
318 | 334 | */ |
319 | 335 | // OK 4.8 |
336 | + |
|
337 | + /** |
|
338 | + * @param integer $change_type |
|
339 | + * @param double $metamatter |
|
340 | + */ |
|
320 | 341 | protected function db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe) { |
321 | 342 | $provider_id_safe = intval(core_auth::$main_provider->provider_id); |
322 | 343 | //$account_id_safe = $this->db->db_escape($this->account_id); |
@@ -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( |
@@ -81,6 +81,10 @@ discard block |
||
81 | 81 | // ------------------------------------------------------------------------- |
82 | 82 | // Here comes low-level functions - those that directly works with cacher engines |
83 | 83 | // ------------------------------------------------------------------------- |
84 | + |
|
85 | + /** |
|
86 | + * @param string $name |
|
87 | + */ |
|
84 | 88 | public function __set($name, $value) { |
85 | 89 | switch ($name) { |
86 | 90 | case '_MODE': |
@@ -132,6 +136,9 @@ discard block |
||
132 | 136 | return null; |
133 | 137 | } |
134 | 138 | |
139 | + /** |
|
140 | + * @param string $name |
|
141 | + */ |
|
135 | 142 | public function __isset($name) { |
136 | 143 | switch (self::$mode) { |
137 | 144 | case CACHER_NO_CACHE: |
@@ -591,6 +591,9 @@ discard block |
||
591 | 591 | return max(0, $this->shipsGetCapacity() - $this->resourcesGetTotal()); |
592 | 592 | } |
593 | 593 | |
594 | + /** |
|
595 | + * @param integer $ship_id |
|
596 | + */ |
|
594 | 597 | public function shipsGetTotalById($ship_id) { |
595 | 598 | return $this->unitList->unitsCountById($ship_id); |
596 | 599 | } |
@@ -705,7 +708,7 @@ discard block |
||
705 | 708 | /** |
706 | 709 | * Set current resource list from array of units |
707 | 710 | * |
708 | - * @param array $resource_list |
|
711 | + * @param integer[] $resource_list |
|
709 | 712 | */ |
710 | 713 | public function resourcesSet($resource_list) { |
711 | 714 | if(!empty($this->propertiesAdjusted['resource_list'])) { |
@@ -750,7 +753,7 @@ discard block |
||
750 | 753 | } |
751 | 754 | |
752 | 755 | /** |
753 | - * @param array $rate |
|
756 | + * @param integer[] $rate |
|
754 | 757 | * |
755 | 758 | * @return float |
756 | 759 | */ |
@@ -781,7 +784,6 @@ discard block |
||
781 | 784 | * Restores fleet or resources to planet |
782 | 785 | * |
783 | 786 | * @param bool $start |
784 | - * @param bool $only_resources |
|
785 | 787 | * @param int $result |
786 | 788 | * |
787 | 789 | * @return int |
@@ -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};"); |
@@ -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 |
@@ -11,6 +11,9 @@ discard block |
||
11 | 11 | require_once('general/math.php'); |
12 | 12 | require_once('general_pname.php'); |
13 | 13 | |
14 | +/** |
|
15 | + * @param string $func_name |
|
16 | + */ |
|
14 | 17 | function sn_function_call($func_name, $func_arg = array()) { |
15 | 18 | // All data in classSupernova::$functions should be normalized to valid 'callable' state: '<function_name>'|array('<object_name>', '<method_name>') |
16 | 19 | |
@@ -57,6 +60,9 @@ discard block |
||
57 | 60 | |
58 | 61 | // ---------------------------------------------------------------------------------------------------------------- |
59 | 62 | // Fonction de lecture / ecriture / exploitation de templates |
63 | +/** |
|
64 | + * @param string $filename |
|
65 | + */ |
|
60 | 66 | function sys_file_read($filename) { |
61 | 67 | return @file_get_contents($filename); |
62 | 68 | } |
@@ -99,7 +105,7 @@ discard block |
||
99 | 105 | /** |
100 | 106 | * Получение курса обмены валюты в серверную валюту |
101 | 107 | * |
102 | - * @param $currency_symbol |
|
108 | + * @param string $currency_symbol |
|
103 | 109 | * |
104 | 110 | * @return float |
105 | 111 | */ |
@@ -140,7 +146,7 @@ discard block |
||
140 | 146 | * @param float $n |
141 | 147 | * @param int|bool $floor |
142 | 148 | * @param int|bool $color |
143 | - * @param int|bool $limit |
|
149 | + * @param boolean $limit |
|
144 | 150 | * @param bool|null $style |
145 | 151 | * |
146 | 152 | * @return array|float|string |
@@ -241,6 +247,9 @@ discard block |
||
241 | 247 | return preg_replace($ListCensure, '*', $String); |
242 | 248 | } |
243 | 249 | |
250 | +/** |
|
251 | + * @param string $email |
|
252 | + */ |
|
244 | 253 | function is_email($email) { |
245 | 254 | return (preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email)); |
246 | 255 | } |
@@ -273,6 +282,9 @@ discard block |
||
273 | 282 | return floatval(sys_get_param($param_name, $default)); |
274 | 283 | } |
275 | 284 | |
285 | +/** |
|
286 | + * @param string $param_name |
|
287 | + */ |
|
276 | 288 | function sys_get_param_escaped($param_name, $default = '') { |
277 | 289 | return db_escape(sys_get_param($param_name, $default)); |
278 | 290 | } |
@@ -505,6 +517,9 @@ discard block |
||
505 | 517 | } |
506 | 518 | |
507 | 519 | // Generates random string of $length symbols from $allowed_chars charset |
520 | +/** |
|
521 | + * @param string $allowed_chars |
|
522 | + */ |
|
508 | 523 | function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) { |
509 | 524 | $allowed_length = strlen($allowed_chars); |
510 | 525 | |
@@ -609,6 +624,9 @@ discard block |
||
609 | 624 | return implode(';', $fleet_string); |
610 | 625 | } |
611 | 626 | |
627 | +/** |
|
628 | + * @param string $body |
|
629 | + */ |
|
612 | 630 | function mymail($email_unsafe, $title, $body, $from = '', $html = false) { |
613 | 631 | $from = trim($from ? $from : classSupernova::$config->game_adminEmail); |
614 | 632 | |
@@ -863,6 +881,9 @@ discard block |
||
863 | 881 | return serialize($nick_array); |
864 | 882 | } |
865 | 883 | |
884 | +/** |
|
885 | + * @param string $nick_string |
|
886 | + */ |
|
866 | 887 | function player_nick_uncompact($nick_string) { |
867 | 888 | try { |
868 | 889 | $result = unserialize($nick_string); |
@@ -1110,6 +1131,9 @@ discard block |
||
1110 | 1131 | return $ranks; |
1111 | 1132 | } |
1112 | 1133 | |
1134 | +/** |
|
1135 | + * @param boolean $planet_id |
|
1136 | + */ |
|
1113 | 1137 | function sys_player_new_adjust($user_id, $planet_id) { return sn_function_call(__FUNCTION__, array($user_id, $planet_id, &$result)); } |
1114 | 1138 | |
1115 | 1139 | function sn_sys_player_new_adjust($user_id, $planet_id, &$result) { |
@@ -1420,6 +1444,9 @@ discard block |
||
1420 | 1444 | return version_compare(sn_version_compare_extra($ver1), sn_version_compare_extra($ver2)); |
1421 | 1445 | } |
1422 | 1446 | |
1447 | +/** |
|
1448 | + * @param string $name |
|
1449 | + */ |
|
1423 | 1450 | function sn_setcookie($name, $value = null, $expire = null, $path = SN_ROOT_RELATIVE, $domain = null, $secure = null, $httponly = null) { |
1424 | 1451 | $_COOKIE[$name] = $value; |
1425 | 1452 |