@@ -829,10 +829,17 @@ |
||
| 829 | 829 | |
| 830 | 830 | // OK v4.5 |
| 831 | 831 | // TODO - REMEMBER_ME |
| 832 | + |
|
| 833 | + /** |
|
| 834 | + * @param integer $period |
|
| 835 | + */ |
|
| 832 | 836 | protected static function cookie_set($value, $impersonate = false, $period = null) { |
| 833 | 837 | sn_setcookie($impersonate ? SN_COOKIE_U_I : SN_COOKIE_U, $value, $period === null ? SN_TIME_NOW + PERIOD_YEAR : $period, SN_ROOT_RELATIVE); |
| 834 | 838 | } |
| 835 | 839 | |
| 840 | + /** |
|
| 841 | + * @param string $message |
|
| 842 | + */ |
|
| 836 | 843 | protected static function flog($message, $die = false) { |
| 837 | 844 | if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
| 838 | 845 | return; |
@@ -180,6 +180,9 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
| 183 | + /** |
|
| 184 | + * @param string $query |
|
| 185 | + */ |
|
| 183 | 186 | function security_watch_user_queries($query) { |
| 184 | 187 | // TODO Заменить это на новый логгер |
| 185 | 188 | global $config, $is_watching, $user, $debug; |
@@ -202,6 +205,9 @@ discard block |
||
| 202 | 205 | } |
| 203 | 206 | |
| 204 | 207 | |
| 208 | + /** |
|
| 209 | + * @param string $query |
|
| 210 | + */ |
|
| 205 | 211 | function security_query_check_bad_words($query) { |
| 206 | 212 | global $user, $dm_change_legit, $mm_change_legit; |
| 207 | 213 | |
@@ -55,6 +55,9 @@ |
||
| 55 | 55 | return true; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + /** |
|
| 59 | + * @param string $query_string |
|
| 60 | + */ |
|
| 58 | 61 | function mysql_query($query_string) { |
| 59 | 62 | return mysql_query($query_string, $this->link); |
| 60 | 63 | } |
@@ -21,11 +21,19 @@ discard block |
||
| 21 | 21 | return empty($result) ? null : $result; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | + /** |
|
| 25 | + * @param integer $galaxy |
|
| 26 | + * @param integer $system |
|
| 27 | + * @param integer $planet |
|
| 28 | + */ |
|
| 24 | 29 | public static function db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update = false, $fields = '*') { |
| 25 | 30 | return classSupernova::db_get_record_list(LOC_PLANET, |
| 26 | 31 | "{{planets}}.`galaxy` = {$galaxy} AND {{planets}}.`system` = {$system} AND {{planets}}.`planet` = {$planet} AND {{planets}}.`planet_type` = {$planet_type}", true); |
| 27 | 32 | } |
| 28 | 33 | |
| 34 | + /** |
|
| 35 | + * @param integer $planet_type |
|
| 36 | + */ |
|
| 29 | 37 | public static function db_planet_by_gspt($galaxy, $system, $planet, $planet_type, $for_update = false, $fields = '*') { |
| 30 | 38 | $galaxy = intval($galaxy); |
| 31 | 39 | $system = intval($system); |
@@ -120,6 +128,9 @@ discard block |
||
| 120 | 128 | "`id_owner` = '{$user_row['id']}' {$conditions} ORDER BY {$order_by}"); |
| 121 | 129 | } |
| 122 | 130 | |
| 131 | + /** |
|
| 132 | + * @param integer $planet_id |
|
| 133 | + */ |
|
| 123 | 134 | public static function db_planet_list_by_user_or_planet($user_id, $planet_id) { |
| 124 | 135 | if(!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) { |
| 125 | 136 | return false; |
@@ -138,6 +149,9 @@ discard block |
||
| 138 | 149 | return classSupernova::db_upd_record_by_id(LOC_PLANET, $planet_id, $set); |
| 139 | 150 | } |
| 140 | 151 | |
| 152 | + /** |
|
| 153 | + * @param integer $ui_planet_type |
|
| 154 | + */ |
|
| 141 | 155 | public static function db_planet_set_by_gspt($ui_galaxy, $ui_system, $ui_planet, $ui_planet_type = PT_ALL, $set) { |
| 142 | 156 | if(!($set = trim($set))) { |
| 143 | 157 | return false; |
@@ -56,6 +56,9 @@ discard block |
||
| 56 | 56 | WHERE unit_player_id = {$user_id} AND unit_location_type = " . LOC_PLANET . " AND unit_level > 0 AND unit_snid IN (" . STRUC_LABORATORY . ", " . STRUC_LABORATORY_NANO . ");"); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | + /** |
|
| 60 | + * @param string $set |
|
| 61 | + */ |
|
| 59 | 62 | public static function db_unit_set_by_id($unit_id, $set) { |
| 60 | 63 | return classSupernova::db_upd_record_by_id(LOC_UNIT, $unit_id, $set); |
| 61 | 64 | } |
@@ -69,6 +72,9 @@ discard block |
||
| 69 | 72 | return classSupernova::db_ins_record(LOC_UNIT, $set); |
| 70 | 73 | } |
| 71 | 74 | |
| 75 | + /** |
|
| 76 | + * @param integer $unit_location_type |
|
| 77 | + */ |
|
| 72 | 78 | public static function db_unit_list_delete($user_id = 0, $unit_location_type, $unit_location_id = 0, $unit_snid = 0) { |
| 73 | 79 | return classSupernova::db_del_record_list(LOC_UNIT, |
| 74 | 80 | "`unit_location_type` = {$unit_location_type}" . |
@@ -10,8 +10,8 @@ |
||
| 10 | 10 | /** |
| 11 | 11 | * UniverseVector constructor. |
| 12 | 12 | * |
| 13 | - * @param int|string $galaxy |
|
| 14 | - * @param int|Vector|array $system |
|
| 13 | + * @param integer $galaxy |
|
| 14 | + * @param integer $system |
|
| 15 | 15 | * @param int $planet |
| 16 | 16 | * @param int $type |
| 17 | 17 | */ |
@@ -70,8 +70,8 @@ |
||
| 70 | 70 | /** |
| 71 | 71 | * Vector constructor. |
| 72 | 72 | * |
| 73 | - * @param int|string $galaxy |
|
| 74 | - * @param int|Vector|array $system |
|
| 73 | + * @param integer $galaxy |
|
| 74 | + * @param integer $system |
|
| 75 | 75 | * @param int $planet |
| 76 | 76 | * @param int $type |
| 77 | 77 | */ |
@@ -141,6 +141,7 @@ discard block |
||
| 141 | 141 | * LIST - Get fleet list by condition |
| 142 | 142 | * |
| 143 | 143 | * @param string $where_safe |
| 144 | + * @param boolean $for_update |
|
| 144 | 145 | * |
| 145 | 146 | * @return array |
| 146 | 147 | */ |
@@ -432,6 +433,7 @@ discard block |
||
| 432 | 433 | * LIST - Get missile attack list by condition |
| 433 | 434 | * |
| 434 | 435 | * @param string $where |
| 436 | + * @param boolean $for_update |
|
| 435 | 437 | * |
| 436 | 438 | * @return array |
| 437 | 439 | */ |
@@ -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 | { |
| 16 | 19 | global $functions; // All data in $functions should be normalized to valid 'callable' state: '<function_name>'|array('<object_name>', '<method_name>') |
@@ -64,6 +67,9 @@ discard block |
||
| 64 | 67 | |
| 65 | 68 | // ---------------------------------------------------------------------------------------------------------------- |
| 66 | 69 | // Fonction de lecture / ecriture / exploitation de templates |
| 70 | +/** |
|
| 71 | + * @param string $filename |
|
| 72 | + */ |
|
| 67 | 73 | function sys_file_read($filename) |
| 68 | 74 | { |
| 69 | 75 | return @file_get_contents($filename); |
@@ -110,7 +116,7 @@ discard block |
||
| 110 | 116 | /** |
| 111 | 117 | * Получение курса обмены валюты в серверную валюту |
| 112 | 118 | * |
| 113 | - * @param $currency_symbol |
|
| 119 | + * @param string $currency_symbol |
|
| 114 | 120 | * |
| 115 | 121 | * @return float |
| 116 | 122 | */ |
@@ -147,6 +153,7 @@ discard block |
||
| 147 | 153 | null - standard result |
| 148 | 154 | true - return only style class for current params |
| 149 | 155 | false - return array('text' => $ret, 'class' => $class), where $ret - unstyled |
| 156 | + * @param boolean $style |
|
| 150 | 157 | */ |
| 151 | 158 | |
| 152 | 159 | function pretty_number($n, $floor = true, $color = false, $limit = false, $style = null) |
@@ -266,6 +273,9 @@ discard block |
||
| 266 | 273 | return preg_replace($ListCensure, '*', $String); |
| 267 | 274 | } |
| 268 | 275 | |
| 276 | +/** |
|
| 277 | + * @param string $email |
|
| 278 | + */ |
|
| 269 | 279 | function is_email($email) { |
| 270 | 280 | 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)); |
| 271 | 281 | } |
@@ -302,6 +312,9 @@ discard block |
||
| 302 | 312 | return floatval(sys_get_param($param_name, $default)); |
| 303 | 313 | } |
| 304 | 314 | |
| 315 | +/** |
|
| 316 | + * @param string $param_name |
|
| 317 | + */ |
|
| 305 | 318 | function sys_get_param_escaped($param_name, $default = '') |
| 306 | 319 | { |
| 307 | 320 | return db_escape(sys_get_param($param_name, $default)); |
@@ -546,6 +559,9 @@ discard block |
||
| 546 | 559 | } |
| 547 | 560 | |
| 548 | 561 | // Generates random string of $length symbols from $allowed_chars charset |
| 562 | +/** |
|
| 563 | + * @param string $allowed_chars |
|
| 564 | + */ |
|
| 549 | 565 | function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) { |
| 550 | 566 | $allowed_length = strlen($allowed_chars); |
| 551 | 567 | |
@@ -671,6 +687,9 @@ discard block |
||
| 671 | 687 | return implode(';', $fleet_string); |
| 672 | 688 | } |
| 673 | 689 | |
| 690 | +/** |
|
| 691 | + * @param string $body |
|
| 692 | + */ |
|
| 674 | 693 | function mymail($email_unsafe, $title, $body, $from = '', $html = false) { |
| 675 | 694 | global $config, $lang; |
| 676 | 695 | |
@@ -958,6 +977,9 @@ discard block |
||
| 958 | 977 | return serialize($nick_array); |
| 959 | 978 | } |
| 960 | 979 | |
| 980 | +/** |
|
| 981 | + * @param string $nick_string |
|
| 982 | + */ |
|
| 961 | 983 | function player_nick_uncompact($nick_string) { |
| 962 | 984 | try { |
| 963 | 985 | $result = unserialize($nick_string); |
@@ -1247,6 +1269,9 @@ discard block |
||
| 1247 | 1269 | return $ranks; |
| 1248 | 1270 | } |
| 1249 | 1271 | |
| 1272 | +/** |
|
| 1273 | + * @param boolean $planet_id |
|
| 1274 | + */ |
|
| 1250 | 1275 | function sys_player_new_adjust($user_id, $planet_id){return sn_function_call('sys_player_new_adjust', array($user_id, $planet_id, &$result));} |
| 1251 | 1276 | function sn_sys_player_new_adjust($user_id, $planet_id, &$result) { |
| 1252 | 1277 | return $result; |