@@ -131,6 +131,9 @@ discard block |
||
| 131 | 131 | ); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | + /** |
|
| 135 | + * @param integer $config_user_birthday_range |
|
| 136 | + */ |
|
| 134 | 137 | public static function db_user_list_to_celebrate($config_user_birthday_range) { |
| 135 | 138 | // $query = "SELECT |
| 136 | 139 | // `id`, `username`, `user_birthday`, `user_birthday_celebrated`, |
@@ -208,6 +211,9 @@ discard block |
||
| 208 | 211 | } |
| 209 | 212 | |
| 210 | 213 | |
| 214 | + /** |
|
| 215 | + * @param string $username_unsafe |
|
| 216 | + */ |
|
| 211 | 217 | public static function db_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false) { |
| 212 | 218 | return classSupernova::db_get_user_by_username($username_unsafe, $for_update, $fields, $player, $like); |
| 213 | 219 | } |
@@ -220,6 +226,9 @@ discard block |
||
| 220 | 226 | return classSupernova::db_upd_record_by_id(LOC_USER, $user_id, $set); |
| 221 | 227 | } |
| 222 | 228 | |
| 229 | + /** |
|
| 230 | + * @param boolean $player |
|
| 231 | + */ |
|
| 223 | 232 | public static function db_user_by_id($user_id_unsafe, $for_update = false, $fields = '*', $player = null) { |
| 224 | 233 | return classSupernova::db_get_user_by_id($user_id_unsafe, $for_update, $fields, $player); |
| 225 | 234 | } |
@@ -119,10 +119,17 @@ |
||
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | + /** |
|
| 123 | + * @param string $functionName |
|
| 124 | + * @param string $alias |
|
| 125 | + */ |
|
| 122 | 126 | public function fieldSingleFunction($functionName, $field = '*', $alias = DbSqlLiteral::SQL_LITERAL_ALIAS_NONE) { |
| 123 | 127 | return $this->field(DbSqlLiteral::build($this->db)->buildSingleArgument($functionName, $field, $alias)); |
| 124 | 128 | } |
| 125 | 129 | |
| 130 | + /** |
|
| 131 | + * @param string $alias |
|
| 132 | + */ |
|
| 126 | 133 | public function fieldCount($field = '*', $alias = DbSqlLiteral::SQL_LITERAL_ALIAS_NONE) { |
| 127 | 134 | return $this->field(DbSqlLiteral::build($this->db)->count($field, $alias)); |
| 128 | 135 | } |
@@ -115,6 +115,9 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string $query |
|
| 120 | + */ |
|
| 118 | 121 | public function setQuery($query) { |
| 119 | 122 | $this->query = $query; |
| 120 | 123 | |
@@ -128,6 +131,9 @@ discard block |
||
| 128 | 131 | } |
| 129 | 132 | } |
| 130 | 133 | |
| 134 | + /** |
|
| 135 | + * @param string $comment |
|
| 136 | + */ |
|
| 131 | 137 | protected function commentAdd($comment) { |
| 132 | 138 | if (empty($this->values[static::COMMENT_PLACEHOLDER])) { |
| 133 | 139 | $this->query .= static::COMMENT_PLACEHOLDER; |
@@ -261,7 +267,7 @@ discard block |
||
| 261 | 267 | } |
| 262 | 268 | |
| 263 | 269 | /** |
| 264 | - * @return bool|mysqli_result |
|
| 270 | + * @return mysqli_result |
|
| 265 | 271 | */ |
| 266 | 272 | public function getResult() { |
| 267 | 273 | return $this->statement->get_result(); |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | * @param mixed $offset <p> |
| 119 | 119 | * The offset to assign the value to. |
| 120 | 120 | * </p> |
| 121 | - * @param mixed $value <p> |
|
| 121 | + * @param Unit $value <p> |
|
| 122 | 122 | * The value to set. |
| 123 | 123 | * </p> |
| 124 | 124 | * |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | require_once('general_pname.php'); |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @param $func_name |
|
| 15 | + * @param string $func_name |
|
| 16 | 16 | * @param array $func_arg |
| 17 | 17 | * |
| 18 | 18 | * @return mixed |
@@ -63,6 +63,9 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // ---------------------------------------------------------------------------------------------------------------- |
| 66 | +/** |
|
| 67 | + * @param string $filename |
|
| 68 | + */ |
|
| 66 | 69 | function sys_file_read($filename) { |
| 67 | 70 | return @file_get_contents($filename); |
| 68 | 71 | } |
@@ -105,7 +108,7 @@ discard block |
||
| 105 | 108 | /** |
| 106 | 109 | * Получение курса обмены валюты в серверную валюту |
| 107 | 110 | * |
| 108 | - * @param $currency_symbol |
|
| 111 | + * @param string $currency_symbol |
|
| 109 | 112 | * |
| 110 | 113 | * @return float |
| 111 | 114 | */ |
@@ -146,7 +149,7 @@ discard block |
||
| 146 | 149 | * @param float $n |
| 147 | 150 | * @param int|bool $floor |
| 148 | 151 | * @param int|bool $color |
| 149 | - * @param int|bool $limit |
|
| 152 | + * @param boolean $limit |
|
| 150 | 153 | * @param bool|null $style |
| 151 | 154 | * |
| 152 | 155 | * @return array|float|string |
@@ -239,6 +242,9 @@ discard block |
||
| 239 | 242 | return preg_replace($ListCensure, '*', $String); |
| 240 | 243 | } |
| 241 | 244 | |
| 245 | +/** |
|
| 246 | + * @param string $email |
|
| 247 | + */ |
|
| 242 | 248 | function is_email($email) { |
| 243 | 249 | 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)); |
| 244 | 250 | } |
@@ -276,6 +282,9 @@ discard block |
||
| 276 | 282 | return floatval(sys_get_param($param_name, $default)); |
| 277 | 283 | } |
| 278 | 284 | |
| 285 | +/** |
|
| 286 | + * @param string $param_name |
|
| 287 | + */ |
|
| 279 | 288 | function sys_get_param_escaped($param_name, $default = '') { |
| 280 | 289 | return db_escape(sys_get_param($param_name, $default)); |
| 281 | 290 | } |
@@ -444,6 +453,9 @@ discard block |
||
| 444 | 453 | } |
| 445 | 454 | |
| 446 | 455 | // Generates random string of $length symbols from $allowed_chars charset |
| 456 | +/** |
|
| 457 | + * @param string $allowed_chars |
|
| 458 | + */ |
|
| 447 | 459 | function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) { |
| 448 | 460 | $allowed_length = strlen($allowed_chars); |
| 449 | 461 | |
@@ -548,6 +560,10 @@ discard block |
||
| 548 | 560 | return implode(';', $fleet_string); |
| 549 | 561 | } |
| 550 | 562 | |
| 563 | +/** |
|
| 564 | + * @param string $title |
|
| 565 | + * @param string $body |
|
| 566 | + */ |
|
| 551 | 567 | function mymail($email_unsafe, $title, $body, $from = '', $html = false) { |
| 552 | 568 | $from = trim($from ? $from : classSupernova::$config->game_adminEmail); |
| 553 | 569 | |
@@ -806,6 +822,9 @@ discard block |
||
| 806 | 822 | return serialize($nick_array); |
| 807 | 823 | } |
| 808 | 824 | |
| 825 | +/** |
|
| 826 | + * @param string $nick_string |
|
| 827 | + */ |
|
| 809 | 828 | function player_nick_uncompact($nick_string) { |
| 810 | 829 | try { |
| 811 | 830 | $result = unserialize($nick_string); |
@@ -1047,6 +1066,9 @@ discard block |
||
| 1047 | 1066 | return $ranks; |
| 1048 | 1067 | } |
| 1049 | 1068 | |
| 1069 | +/** |
|
| 1070 | + * @param boolean $planet_id |
|
| 1071 | + */ |
|
| 1050 | 1072 | function sys_player_new_adjust($user_id, $planet_id) { return sn_function_call(__FUNCTION__, array($user_id, $planet_id, &$result)); } |
| 1051 | 1073 | |
| 1052 | 1074 | function sn_sys_player_new_adjust($user_id, $planet_id, &$result) { |
@@ -1197,6 +1219,9 @@ discard block |
||
| 1197 | 1219 | return $rates; |
| 1198 | 1220 | } |
| 1199 | 1221 | |
| 1222 | +/** |
|
| 1223 | + * @param integer $in_resource |
|
| 1224 | + */ |
|
| 1200 | 1225 | function get_unit_cost_in(&$cost, $in_resource = RES_METAL) { |
| 1201 | 1226 | static $rates; |
| 1202 | 1227 | |
@@ -1363,6 +1388,9 @@ discard block |
||
| 1363 | 1388 | return version_compare(sn_version_compare_extra($ver1), sn_version_compare_extra($ver2)); |
| 1364 | 1389 | } |
| 1365 | 1390 | |
| 1391 | +/** |
|
| 1392 | + * @param string $name |
|
| 1393 | + */ |
|
| 1366 | 1394 | function sn_setcookie($name, $value = null, $expire = null, $path = SN_ROOT_RELATIVE, $domain = null, $secure = null, $httponly = null) { |
| 1367 | 1395 | $_COOKIE[$name] = $value; |
| 1368 | 1396 | |
@@ -76,6 +76,9 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $name |
|
| 81 | + */ |
|
| 79 | 82 | private function getPhysicalPropertyName($name) { |
| 80 | 83 | return '_' . $name; |
| 81 | 84 | } |
@@ -146,6 +149,9 @@ discard block |
||
| 146 | 149 | return $this->propertyMethodResult($name, $diff, 'delta'); |
| 147 | 150 | } |
| 148 | 151 | |
| 152 | + /** |
|
| 153 | + * @param string $action |
|
| 154 | + */ |
|
| 149 | 155 | protected function actionProperty($action, $name, $value) { |
| 150 | 156 | $result = null; |
| 151 | 157 | // Now deciding - will we call a protected setter or will we work with protected property |
@@ -121,6 +121,9 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | + /** |
|
| 125 | + * @param string $filter |
|
| 126 | + */ |
|
| 124 | 127 | public static function queryCacheSetByFilter($location_type, $filter, $record_id) { |
| 125 | 128 | SnCache::$queries[$location_type][$filter][$record_id] = &SnCache::getDataRefByLocationAndId($location_type, $record_id); |
| 126 | 129 | } |
@@ -160,14 +163,23 @@ discard block |
||
| 160 | 163 | return true; // Не всегда - от результата |
| 161 | 164 | } |
| 162 | 165 | |
| 166 | + /** |
|
| 167 | + * @param integer $locationType |
|
| 168 | + */ |
|
| 163 | 169 | public static function getData($locationType = LOC_NONE) { |
| 164 | 170 | return $locationType == LOC_NONE ? static::$data : static::$data[$locationType]; |
| 165 | 171 | } |
| 166 | 172 | |
| 173 | + /** |
|
| 174 | + * @param integer $locationType |
|
| 175 | + */ |
|
| 167 | 176 | public static function cacheUnsetElement($locationType, $recordId) { |
| 168 | 177 | static::$data[$locationType][$recordId] = null; |
| 169 | 178 | } |
| 170 | 179 | |
| 180 | + /** |
|
| 181 | + * @param integer $locationType |
|
| 182 | + */ |
|
| 171 | 183 | public static function isArrayLocation($locationType) { |
| 172 | 184 | return is_array(static::$data[$locationType]); |
| 173 | 185 | } |
@@ -190,6 +202,9 @@ discard block |
||
| 190 | 202 | } |
| 191 | 203 | } |
| 192 | 204 | |
| 205 | + /** |
|
| 206 | + * @param integer $unit_snid |
|
| 207 | + */ |
|
| 193 | 208 | public static function getUnitLocator($location_type, $location_id, $unit_snid) { |
| 194 | 209 | return $unit_snid ? static::$locator[LOC_UNIT][$location_type][$location_id][$unit_snid] : static::$locator[LOC_UNIT][$location_type][$location_id]; |
| 195 | 210 | } |
@@ -222,14 +237,23 @@ discard block |
||
| 222 | 237 | return static::$locks; |
| 223 | 238 | } |
| 224 | 239 | |
| 240 | + /** |
|
| 241 | + * @param string $filter |
|
| 242 | + */ |
|
| 225 | 243 | public static function getQueriesByLocationAndFilter($locationType, $filter) { |
| 226 | 244 | return !empty(static::$queries[$locationType][$filter]) && is_array(static::$queries[$locationType][$filter]) ? static::$queries[$locationType][$filter] : array(); |
| 227 | 245 | } |
| 228 | 246 | |
| 247 | + /** |
|
| 248 | + * @param string $filter |
|
| 249 | + */ |
|
| 229 | 250 | public static function isQueryCacheByLocationAndFilterEmpty($locationType, $filter) { |
| 230 | 251 | return !isset(SnCache::$queries[$locationType][$filter]) || SnCache::$queries[$locationType][$filter] === null; |
| 231 | 252 | } |
| 232 | 253 | |
| 254 | + /** |
|
| 255 | + * @param string $filter |
|
| 256 | + */ |
|
| 233 | 257 | public static function queryCacheResetByLocationAndFilter($locationType, $filter) { |
| 234 | 258 | SnCache::$queries[$locationType][$filter] = array(); |
| 235 | 259 | } |
@@ -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: |
@@ -173,6 +173,9 @@ |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | + /** |
|
| 177 | + * @param string $path |
|
| 178 | + */ |
|
| 176 | 179 | protected function lng_try_filepath($path, $file_path_relative) { |
| 177 | 180 | $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
| 178 | 181 | return file_exists($file_path) ? $file_path : false; |