@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 3 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 4 | 4 | |
| 5 | 5 | $template = gettemplate('viewreport', true); |
| 6 | 6 | $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']); |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | $img_name = classSupernova::$config->int_userbar_background; |
| 25 | 25 | break; |
| 26 | 26 | } |
| 27 | - $size = getimagesize(SN_ROOT_PHYSICAL . $img_name); |
|
| 28 | - $im = imagecreatefrompng(SN_ROOT_PHYSICAL . $img_name); |
|
| 27 | + $size = getimagesize(SN_ROOT_PHYSICAL.$img_name); |
|
| 28 | + $im = imagecreatefrompng(SN_ROOT_PHYSICAL.$img_name); |
|
| 29 | 29 | $image = imagecreatetruecolor($size[0], $size[1]); |
| 30 | 30 | imagecopy($image, $im, 0, 0, 0, 0, $size[0], $size[1]); |
| 31 | 31 | imagedestroy($im); |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | $txt_color2 = imagecolorallocatealpha($image, 255, 255, 255, 40); |
| 38 | 38 | |
| 39 | 39 | $fonts = array( |
| 40 | - 'userbar' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_userbar_font, |
|
| 41 | - 'universe' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontUniverse, |
|
| 42 | - 'raids' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontRaids, |
|
| 43 | - 'info' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontInfo, |
|
| 40 | + 'userbar' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_userbar_font, |
|
| 41 | + 'universe' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontUniverse, |
|
| 42 | + 'raids' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontRaids, |
|
| 43 | + 'info' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontInfo, |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | if ($id) { |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | $b_user = $user['username']; |
| 53 | 53 | $b_ally = $user['ally_name']; |
| 54 | 54 | $b_planet = $planet_row['name']; |
| 55 | - $b_xyz = "[" . $planet_row['galaxy'] . ":" . $planet_row['system'] . ":" . $planet_row['planet'] . "]"; |
|
| 56 | - $b_lvl = ($user['total_rank'] ? $user['total_rank'] : classSupernova::$config->users_amount) . "/" . classSupernova::$config->users_amount; |
|
| 55 | + $b_xyz = "[".$planet_row['galaxy'].":".$planet_row['system'].":".$planet_row['planet']."]"; |
|
| 56 | + $b_lvl = ($user['total_rank'] ? $user['total_rank'] : classSupernova::$config->users_amount)."/".classSupernova::$config->users_amount; |
|
| 57 | 57 | } else { |
| 58 | 58 | $b_user = classLocale::$lang['ov_banner_empty_id']; |
| 59 | 59 | $b_lvl = ''; |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | imagettftext($image, 9, 0, 410 - $is[2], 35, $txt_color, $fonts['info'], $b_ally); |
| 89 | 89 | |
| 90 | 90 | // Player b_planet |
| 91 | - imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet . " " . $b_xyz); |
|
| 92 | - imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet . " " . $b_xyz); |
|
| 91 | + imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet." ".$b_xyz); |
|
| 92 | + imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet." ".$b_xyz); |
|
| 93 | 93 | |
| 94 | 94 | //StatPoint |
| 95 | - $b_points = classLocale::$lang['ov_points'] . ": " . pretty_number(!empty($user['total_points']) ? $user['total_points'] : 0); |
|
| 95 | + $b_points = classLocale::$lang['ov_points'].": ".pretty_number(!empty($user['total_points']) ? $user['total_points'] : 0); |
|
| 96 | 96 | $is = imagettfbbox(8, 0, $fonts['info'], $b_points); |
| 97 | 97 | imagettftext($image, 8, 0, 412 - $is[2], 11, $txt_shadow, $fonts['info'], $b_points); |
| 98 | 98 | imagettftext($image, 8, 0, 410 - $is[2], 9, $txt_color, $fonts['info'], $b_points); |
@@ -100,21 +100,21 @@ discard block |
||
| 100 | 100 | //Raids Total |
| 101 | 101 | imagettftext($image, 6, 0, 8, 37, $txt_shadow2, $fonts['raids'], classLocale::$lang['NumberOfRaids']); |
| 102 | 102 | imagettftext($image, 6, 0, 6, 35, $txt_color2, $fonts['raids'], classLocale::$lang['NumberOfRaids']); |
| 103 | - $b_points = ": " . pretty_number(!empty($user['raids']) ? $user['raids'] : 0); |
|
| 103 | + $b_points = ": ".pretty_number(!empty($user['raids']) ? $user['raids'] : 0); |
|
| 104 | 104 | imagettftext($image, 6, 0, 61, 37, $txt_shadow2, $fonts['raids'], $b_points); |
| 105 | 105 | imagettftext($image, 6, 0, 59, 35, $txt_color2, $fonts['raids'], $b_points); |
| 106 | 106 | |
| 107 | 107 | //Raids Won |
| 108 | 108 | imagettftext($image, 6, 0, 8, 47, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsWin']); |
| 109 | 109 | imagettftext($image, 6, 0, 6, 45, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsWin']); |
| 110 | - $b_points = ": " . pretty_number(!empty($user['raidswin']) ? $user['raidswin'] : 0); |
|
| 110 | + $b_points = ": ".pretty_number(!empty($user['raidswin']) ? $user['raidswin'] : 0); |
|
| 111 | 111 | imagettftext($image, 6, 0, 61, 47, $txt_shadow2, $fonts['raids'], $b_points); |
| 112 | 112 | imagettftext($image, 6, 0, 59, 45, $txt_color2, $fonts['raids'], $b_points); |
| 113 | 113 | |
| 114 | 114 | //Raids Lost |
| 115 | 115 | imagettftext($image, 6, 0, 8, 57, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsLoose']); |
| 116 | 116 | imagettftext($image, 6, 0, 6, 55, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsLoose']); |
| 117 | - $b_points = ": " . pretty_number(!empty($user['raidsloose']) ? $user['raidsloose'] : 0); |
|
| 117 | + $b_points = ": ".pretty_number(!empty($user['raidsloose']) ? $user['raidsloose'] : 0); |
|
| 118 | 118 | imagettftext($image, 6, 0, 61, 57, $txt_shadow2, $fonts['raids'], $b_points); |
| 119 | 119 | imagettftext($image, 6, 0, 59, 55, $txt_color2, $fonts['raids'], $b_points); |
| 120 | 120 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $template->assign_vars($quest_templatized); |
| 180 | 180 | if (!empty($quest_templatized['quest_rewards_list'])) { |
| 181 | 181 | foreach ($quest_templatized['quest_rewards_list'] as $quest_reward) { |
| 182 | - $template->assign_block_vars(($block_name ? $block_name . '.' : '') . 'quest_rewards_list', $quest_reward); |
|
| 182 | + $template->assign_block_vars(($block_name ? $block_name.'.' : '').'quest_rewards_list', $quest_reward); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | $comment_reward = array(); |
| 251 | 251 | foreach ($reward_list as $unit_id => $unit_amount) { |
| 252 | - $comment_reward[] = $unit_amount . ' ' . classLocale::$lang['tech'][$unit_id]; |
|
| 252 | + $comment_reward[] = $unit_amount.' '.classLocale::$lang['tech'][$unit_id]; |
|
| 253 | 253 | $total_rewards[$user_id][$planet_id][$unit_id] += $unit_amount; |
| 254 | 254 | } |
| 255 | - $comment .= " {$classLocale['qst_msg_your_reward']} " . implode(',', $comment_reward); |
|
| 255 | + $comment .= " {$classLocale['qst_msg_your_reward']} ".implode(',', $comment_reward); |
|
| 256 | 256 | |
| 257 | 257 | msg_send_simple_message($user['id'], 0, SN_TIME_NOW, MSG_TYPE_ADMIN, classLocale::$lang['msg_from_admin'], classLocale::$lang['qst_msg_complete_subject'], $comment); |
| 258 | 258 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | $comment = call_user_func_array('sprintf', $comment); |
| 55 | 55 | } |
| 56 | 56 | // mm_points_change($user_id, $change_type, -$metamatter_to_reduce, 'ММ в ТМ: ' . (-$dark_matter) . ' ТМ = ' . $dark_matter_exists . ' ТМ + ' . $metamatter_to_reduce . ' ММ. ' . $comment); |
| 57 | - classSupernova::$auth->account->metamatter_change($change_type, -$metamatter_to_reduce, 'ММ в ТМ: ' . (-$dark_matter) . ' ТМ = ' . $dark_matter_exists . ' ТМ + ' . $metamatter_to_reduce . ' ММ. ' . $comment); |
|
| 57 | + classSupernova::$auth->account->metamatter_change($change_type, -$metamatter_to_reduce, 'ММ в ТМ: '.(-$dark_matter).' ТМ = '.$dark_matter_exists.' ТМ + '.$metamatter_to_reduce.' ММ. '.$comment); |
|
| 58 | 58 | $dark_matter = -$dark_matter_exists; |
| 59 | 59 | } |
| 60 | 60 | } else { |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | $build_unit_list = sn_get_groups('tech'); |
| 70 | 70 | $artifact_id = ART_HEURISTIC_CHIP; |
| 71 | - $page_header = classLocale::$lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? " {$classLocale['sys_of_ally']} {$user['username']}" : ''); |
|
| 71 | + $page_header = classLocale::$lang['tech'][UNIT_TECHNOLOGIES].($user['user_as_ally'] ? " {$classLocale['sys_of_ally']} {$user['username']}" : ''); |
|
| 72 | 72 | } elseif ($que_type == QUE_MERCENARY) { |
| 73 | 73 | $build_unit_list = sn_get_groups('mercenaries'); |
| 74 | 74 | $artifact_id = 0; |
| 75 | - $page_header = classLocale::$lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? " {$classLocale['sys_of_ally']} {$user['username']}" : ''); |
|
| 75 | + $page_header = classLocale::$lang['tech'][UNIT_MERCENARIES].($user['user_as_ally'] ? " {$classLocale['sys_of_ally']} {$user['username']}" : ''); |
|
| 76 | 76 | } else { |
| 77 | 77 | if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) { |
| 78 | 78 | message(classLocale::$lang['need_hangar'], classLocale::$lang['tech'][STRUC_FACTORY_HANGAR]); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
| 246 | 246 | * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1))) |
| 247 | 247 | ) { |
| 248 | - $level_production_base['R' . $resource_id] = $resource_income; |
|
| 248 | + $level_production_base['R'.$resource_id] = $resource_income; |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -272,8 +272,8 @@ discard block |
||
| 272 | 272 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
| 273 | 273 | * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1))) |
| 274 | 274 | ) { |
| 275 | - $level_production['R' . $resource_id] = $resource_income; |
|
| 276 | - $level_production['D' . $resource_id] = $resource_income - $level_production_base[$resource_id]; |
|
| 275 | + $level_production['R'.$resource_id] = $resource_income; |
|
| 276 | + $level_production['D'.$resource_id] = $resource_income - $level_production_base[$resource_id]; |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | $production['.']['resource'][] = $level_production; |
@@ -288,15 +288,15 @@ discard block |
||
| 288 | 288 | $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1; |
| 289 | 289 | for ($i = 0; $i < 6; $i++) { |
| 290 | 290 | $level_production = array('LEVEL' => $level_start + $i); |
| 291 | - $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i); |
|
| 292 | - $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX]; |
|
| 293 | - $level_production['R' . UNIT_PLAYER_COLONIES_MAX] = get_player_max_colonies($user, $level_start + $i); |
|
| 294 | - $level_production['D' . UNIT_PLAYER_COLONIES_MAX] = $level_production['R' . UNIT_PLAYER_COLONIES_MAX] - $level_production_base[UNIT_PLAYER_COLONIES_MAX]; |
|
| 291 | + $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i); |
|
| 292 | + $level_production['D'.UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX]; |
|
| 293 | + $level_production['R'.UNIT_PLAYER_COLONIES_MAX] = get_player_max_colonies($user, $level_start + $i); |
|
| 294 | + $level_production['D'.UNIT_PLAYER_COLONIES_MAX] = $level_production['R'.UNIT_PLAYER_COLONIES_MAX] - $level_production_base[UNIT_PLAYER_COLONIES_MAX]; |
|
| 295 | 295 | $production['.']['resource'][] = $level_production; |
| 296 | 296 | |
| 297 | 297 | $level_production_base = array( |
| 298 | - UNIT_PLAYER_EXPEDITIONS_MAX => $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX], |
|
| 299 | - UNIT_PLAYER_COLONIES_MAX => $level_production['R' . UNIT_PLAYER_COLONIES_MAX], |
|
| 298 | + UNIT_PLAYER_EXPEDITIONS_MAX => $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX], |
|
| 299 | + UNIT_PLAYER_COLONIES_MAX => $level_production['R'.UNIT_PLAYER_COLONIES_MAX], |
|
| 300 | 300 | ); |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | default: |
| 99 | 99 | switch (self::$mode) { |
| 100 | 100 | case CACHER_NO_CACHE: |
| 101 | - self::$data[$this->prefix . $name] = $value; |
|
| 101 | + self::$data[$this->prefix.$name] = $value; |
|
| 102 | 102 | break; |
| 103 | 103 | |
| 104 | 104 | case CACHER_XCACHE: |
| 105 | - xcache_set($this->prefix . $name, $value); |
|
| 105 | + xcache_set($this->prefix.$name, $value); |
|
| 106 | 106 | break; |
| 107 | 107 | } |
| 108 | 108 | break; |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | default: |
| 123 | 123 | switch (self::$mode) { |
| 124 | 124 | case CACHER_NO_CACHE: |
| 125 | - return self::$data[$this->prefix . $name]; |
|
| 125 | + return self::$data[$this->prefix.$name]; |
|
| 126 | 126 | break; |
| 127 | 127 | |
| 128 | 128 | case CACHER_XCACHE: |
| 129 | - return xcache_get($this->prefix . $name); |
|
| 129 | + return xcache_get($this->prefix.$name); |
|
| 130 | 130 | break; |
| 131 | 131 | |
| 132 | 132 | } |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | public function __isset($name) { |
| 140 | 140 | switch (self::$mode) { |
| 141 | 141 | case CACHER_NO_CACHE: |
| 142 | - return isset(self::$data[$this->prefix . $name]); |
|
| 142 | + return isset(self::$data[$this->prefix.$name]); |
|
| 143 | 143 | break; |
| 144 | 144 | |
| 145 | 145 | case CACHER_XCACHE: |
| 146 | - return xcache_isset($this->prefix . $name) && ($this->__get($name) !== null); |
|
| 146 | + return xcache_isset($this->prefix.$name) && ($this->__get($name) !== null); |
|
| 147 | 147 | break; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -153,25 +153,25 @@ discard block |
||
| 153 | 153 | public function __unset($name) { |
| 154 | 154 | switch (self::$mode) { |
| 155 | 155 | case CACHER_NO_CACHE: |
| 156 | - unset(self::$data[$this->prefix . $name]); |
|
| 156 | + unset(self::$data[$this->prefix.$name]); |
|
| 157 | 157 | break; |
| 158 | 158 | |
| 159 | 159 | case CACHER_XCACHE: |
| 160 | - xcache_unset($this->prefix . $name); |
|
| 160 | + xcache_unset($this->prefix.$name); |
|
| 161 | 161 | break; |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function unset_by_prefix($prefix_unset = '') { |
| 166 | 166 | static $array_clear; |
| 167 | - !$array_clear ? $array_clear = function (&$v, $k, $p) { |
|
| 167 | + !$array_clear ? $array_clear = function(&$v, $k, $p) { |
|
| 168 | 168 | strpos($k, $p) === 0 ? $v = null : false; |
| 169 | 169 | } : false; |
| 170 | 170 | |
| 171 | 171 | switch (self::$mode) { |
| 172 | 172 | case CACHER_NO_CACHE: |
| 173 | 173 | // array_walk(self::$data, create_function('&$v,$k,$p', 'if(strpos($k, $p) === 0)$v = NULL;'), $this->prefix.$prefix_unset); |
| 174 | - array_walk(self::$data, $array_clear, $this->prefix . $prefix_unset); |
|
| 174 | + array_walk(self::$data, $array_clear, $this->prefix.$prefix_unset); |
|
| 175 | 175 | |
| 176 | 176 | return true; |
| 177 | 177 | break; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | return false; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - return xcache_unset_by_prefix($this->prefix . $prefix_unset); |
|
| 184 | + return xcache_unset_by_prefix($this->prefix.$prefix_unset); |
|
| 185 | 185 | break; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if ($this->$name[0] === null) { |
| 220 | 220 | for ($i = count($name) - 1; $i > 0; $i--) { |
| 221 | 221 | $cName = "{$name[$i]}_COUNT"; |
| 222 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
| 222 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
| 223 | 223 | if ($this->$cName1 == null || $i == 1) { |
| 224 | 224 | $this->$cName++; |
| 225 | 225 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | for ($i = 1; $i < count($name); $i++) { |
| 266 | 266 | $cName = "{$name[$i]}_COUNT"; |
| 267 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
| 267 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
| 268 | 268 | |
| 269 | 269 | if ($i == 1 || $this->$cName1 === null) { |
| 270 | 270 | $this->$cName--; |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $qry[] = "('{$item_name}', '{$item_value}')"; |
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | - doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";"); |
|
| 403 | + doquery("REPLACE INTO `{{".$this->table_name."}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES ".implode(',', $qry).";"); |
|
| 404 | 404 | |
| 405 | 405 | // И только после взятия блокировок - меняем значения в кэше |
| 406 | 406 | foreach ($item_list as $item_name => $item_value) { |
@@ -600,9 +600,9 @@ discard block |
||
| 600 | 600 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
| 601 | 601 | |
| 602 | 602 | // Alliance bonus calculations |
| 603 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 603 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 604 | 604 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
| 605 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
| 605 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
| 606 | 606 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
| 607 | 607 | 'ali_bonus_members' => 10, // Minumum alliace size to start using bonus |
| 608 | 608 | |
@@ -633,25 +633,25 @@ discard block |
||
| 633 | 633 | 'deuterium_basic_income' => 0, |
| 634 | 634 | 'eco_scale_storage' => 1, |
| 635 | 635 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
| 636 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 636 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 637 | 637 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
| 638 | 638 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
| 639 | 639 | 'energy_basic_income' => 0, |
| 640 | 640 | |
| 641 | 641 | // Bashing protection settings |
| 642 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 643 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 644 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 645 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 646 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 642 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 643 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 644 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 645 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 646 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 647 | 647 | |
| 648 | 648 | 'Fleet_Cdr' => 30, |
| 649 | 649 | 'fleet_speed' => 1, |
| 650 | 650 | |
| 651 | 651 | 'fleet_update_interval' => 4, |
| 652 | 652 | |
| 653 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 654 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 653 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 654 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 655 | 655 | // Defaults |
| 656 | 656 | 'game_default_language' => 'ru', |
| 657 | 657 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -665,13 +665,13 @@ discard block |
||
| 665 | 665 | 'game_maxSystem' => 199, |
| 666 | 666 | 'game_maxPlanet' => 15, |
| 667 | 667 | // Game global settings |
| 668 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 668 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 669 | 669 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
| 670 | 670 | |
| 671 | 671 | 'game_news_actual' => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days |
| 672 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 672 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 673 | 673 | // Noob protection |
| 674 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 674 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 675 | 675 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
| 676 | 676 | |
| 677 | 677 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -721,8 +721,8 @@ discard block |
||
| 721 | 721 | 'payment_currency_exchange_wmu' => 30, |
| 722 | 722 | 'payment_currency_exchange_wmz' => 1, |
| 723 | 723 | |
| 724 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
| 725 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 724 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
| 725 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 726 | 726 | |
| 727 | 727 | 'planet_teleport_cost' => 50000, // |
| 728 | 728 | 'planet_teleport_timeout' => 86400, // |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | 'resource_multiplier' => 1, |
| 741 | 741 | |
| 742 | 742 | //Roleplay system |
| 743 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 743 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 744 | 744 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
| 745 | 745 | |
| 746 | 746 | // Black Market - General |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) { |
| 19 | 19 | return doquery( |
| 20 | - "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') . |
|
| 20 | + "SELECT p.*, u.username".($table_parent_columns ? ', p1.name AS parent_name' : ''). |
|
| 21 | 21 | " FROM {{planets}} AS p |
| 22 | 22 | LEFT JOIN {{users}} AS u ON u.id = p.id_owner" . |
| 23 | - ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : '') . |
|
| 24 | - " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}")); |
|
| 23 | + ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : ''). |
|
| 24 | + " WHERE ".($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}")); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | function db_planet_list_search($searchtext) { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | ORDER BY |
| 122 | 122 | sp.`{$Rank}_rank`, subject.{$source['id']} |
| 123 | 123 | LIMIT |
| 124 | - " . $start . ",100;"; |
|
| 124 | + ".$start.",100;"; |
|
| 125 | 125 | } else { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday` |
| 126 | 126 | $query_str = |
| 127 | 127 | "SELECT |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | ORDER BY |
| 135 | 135 | subject.{$Rank} DESC, subject.{$source['id']} |
| 136 | 136 | LIMIT |
| 137 | - " . $start . ",100;"; |
|
| 137 | + ".$start.",100;"; |
|
| 138 | 138 | } |
| 139 | 139 | } else { |
| 140 | 140 | // TODO |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | ORDER BY |
| 152 | 152 | sp.`{$Rank}_rank`, subject.id |
| 153 | 153 | LIMIT |
| 154 | - " . $start . ",100;"; |
|
| 154 | + ".$start.",100;"; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | return doquery($query_str); |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | function db_payment_list_get($flt_payer, $flt_status, $flt_test, $flt_module) { |
| 376 | 376 | $extra_conditions = |
| 377 | - ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : '') . |
|
| 378 | - ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : '') . |
|
| 379 | - ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : '') . |
|
| 377 | + ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : ''). |
|
| 378 | + ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : ''). |
|
| 379 | + ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : ''). |
|
| 380 | 380 | ($flt_module ? "AND payment_module_name = '{$flt_module}' " : ''); |
| 381 | 381 | $query = doquery("SELECT * FROM `{{payment}}` WHERE 1 {$extra_conditions} ORDER BY payment_id DESC;"); |
| 382 | 382 | |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | // Log Online ************************************************************************************************************* |
| 406 | 406 | function db_log_online_insert() { |
| 407 | - doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = " . classSupernova::$config->var_online_user_count); |
|
| 407 | + doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = ".classSupernova::$config->var_online_user_count); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | // Log ************************************************************************************************************* |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | `ban_user_id` = '{$banned['id']}', |
| 613 | 613 | `ban_user_name` = '{$banned['username']}', |
| 614 | 614 | `ban_reason` = '{$reason}', |
| 615 | - `ban_time` = " . SN_TIME_NOW . ", |
|
| 615 | + `ban_time` = ".SN_TIME_NOW.", |
|
| 616 | 616 | `ban_until` = {$ban_until}, |
| 617 | 617 | `ban_issuer_id` = '{$banner['id']}', |
| 618 | 618 | `ban_issuer_name` = '{$banner['username']}', |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | `ban_user_name` = '{$banned['username']}', |
| 635 | 635 | `ban_reason` = '{$reason}', |
| 636 | 636 | `ban_time` = 0, |
| 637 | - `ban_until` = " . SN_TIME_NOW . ", |
|
| 637 | + `ban_until` = ".SN_TIME_NOW.", |
|
| 638 | 638 | `ban_issuer_id` = '{$banner['id']}', |
| 639 | 639 | `ban_issuer_name` = '{$banner['username']}', |
| 640 | 640 | `ban_issuer_email` = '{$banner['email']}' |
@@ -693,9 +693,9 @@ discard block |
||
| 693 | 693 | function db_ube_report_get_best_battles() { |
| 694 | 694 | $query = doquery("SELECT * |
| 695 | 695 | FROM {{ube_report}} |
| 696 | - WHERE `ube_report_time_process` < DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS . " DAY)) |
|
| 696 | + WHERE `ube_report_time_process` < DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS." DAY)) |
|
| 697 | 697 | ORDER BY `ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC |
| 698 | - LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW . ";"); |
|
| 698 | + LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW.";"); |
|
| 699 | 699 | |
| 700 | 700 | return $query; |
| 701 | 701 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 3 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 4 | 4 | |
| 5 | 5 | $template = gettemplate('viewreport', true); |
| 6 | 6 | $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']); |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | $this->prepare(); |
| 94 | 94 | |
| 95 | 95 | $this->manifest['active'] = false; |
| 96 | - if(!empty($this->config) && is_array($this->config['db'])) { |
|
| 96 | + if (!empty($this->config) && is_array($this->config['db'])) { |
|
| 97 | 97 | // БД, отличная от стандартной |
| 98 | 98 | $this->db = new db_mysql(); |
| 99 | 99 | |
| 100 | 100 | $this->db->sn_db_connect($this->config['db']); |
| 101 | - if($this->manifest['active'] = $this->db->connected) { |
|
| 101 | + if ($this->manifest['active'] = $this->db->connected) { |
|
| 102 | 102 | $this->provider_id = ACCOUNT_PROVIDER_CENTRAL; |
| 103 | 103 | |
| 104 | 104 | $this->domain = $this->config['domain']; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Fallback to local DB |
| 115 | - if(!$this->manifest['active']) { |
|
| 115 | + if (!$this->manifest['active']) { |
|
| 116 | 116 | $this->db = classSupernova::$db; |
| 117 | 117 | |
| 118 | 118 | $this->provider_id = ACCOUNT_PROVIDER_LOCAL; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $this->manifest['active'] = true; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $this->cookie_name_impersonate = $this->cookie_name . AUTH_COOKIE_IMPERSONATE_SUFFIX; |
|
| 128 | + $this->cookie_name_impersonate = $this->cookie_name.AUTH_COOKIE_IMPERSONATE_SUFFIX; |
|
| 129 | 129 | |
| 130 | 130 | $this->account = new Account($this->db); |
| 131 | 131 | $this->confirmation = new Confirmation($this->db); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | // OK v4.5 |
| 167 | 167 | public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) { |
| 168 | 168 | $result = parent::password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe); |
| 169 | - if($result) { |
|
| 169 | + if ($result) { |
|
| 170 | 170 | $this->cookie_set(); |
| 171 | 171 | } |
| 172 | 172 | |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | // OK v4.6 |
| 196 | 196 | protected function password_reset_send_code() { |
| 197 | - if(!$this->is_password_reset) { |
|
| 197 | + if (!$this->is_password_reset) { |
|
| 198 | 198 | return $this->account_login_status; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // Проверяем поддержку сброса пароля |
| 202 | - if(!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) { |
|
| 202 | + if (!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) { |
|
| 203 | 203 | return $this->account_login_status; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | unset($this->account); |
| 210 | 210 | $this->account = new Account($this->db); |
| 211 | 211 | |
| 212 | - if(!$this->account->db_get_by_email($email_unsafe)) { |
|
| 212 | + if (!$this->account->db_get_by_email($email_unsafe)) { |
|
| 213 | 213 | throw new Exception(PASSWORD_RESTORE_ERROR_EMAIL_NOT_EXISTS, ERR_ERROR); |
| 214 | 214 | // return $this->account_login_status; |
| 215 | 215 | } |
@@ -219,14 +219,14 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | // TODO - Проверять уровень доступа аккаунта! |
| 221 | 221 | // Аккаунты с АУТЛЕВЕЛ больше 0 - НЕ СБРАСЫВАЮТ ПАРОЛИ! |
| 222 | - foreach($user_list as $user_id => $user_data) { |
|
| 223 | - if($user_data['authlevel'] > AUTH_LEVEL_REGISTERED) { |
|
| 222 | + foreach ($user_list as $user_id => $user_data) { |
|
| 223 | + if ($user_data['authlevel'] > AUTH_LEVEL_REGISTERED) { |
|
| 224 | 224 | throw new Exception(PASSWORD_RESTORE_ERROR_ADMIN_ACCOUNT, ERR_ERROR); |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $confirmation = $this->confirmation->db_confirmation_get_latest_by_type_and_email(CONFIRM_PASSWORD_RESET, $email_unsafe); // OK 4.5 |
| 229 | - if(isset($confirmation['create_time']) && SN_TIME_NOW - strtotime($confirmation['create_time']) < PERIOD_MINUTE_10) { |
|
| 229 | + if (isset($confirmation['create_time']) && SN_TIME_NOW - strtotime($confirmation['create_time']) < PERIOD_MINUTE_10) { |
|
| 230 | 230 | throw new Exception(PASSWORD_RESTORE_ERROR_TOO_OFTEN, ERR_ERROR); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -239,11 +239,11 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | @$result = mymail($email_unsafe, |
| 241 | 241 | sprintf(classLocale::$lang['log_lost_email_title'], classSupernova::$config->game_name), |
| 242 | - sprintf(classLocale::$lang['log_lost_email_code'], SN_ROOT_VIRTUAL . 'login.php', $confirm_code_unsafe, date(FMT_DATE_TIME, SN_TIME_NOW + AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE), classSupernova::$config->game_name) |
|
| 242 | + sprintf(classLocale::$lang['log_lost_email_code'], SN_ROOT_VIRTUAL.'login.php', $confirm_code_unsafe, date(FMT_DATE_TIME, SN_TIME_NOW + AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE), classSupernova::$config->game_name) |
|
| 243 | 243 | ); |
| 244 | 244 | |
| 245 | 245 | $result = $result ? PASSWORD_RESTORE_SUCCESS_CODE_SENT : PASSWORD_RESTORE_ERROR_SENDING; |
| 246 | - } catch(Exception $e) { |
|
| 246 | + } catch (Exception $e) { |
|
| 247 | 247 | sn_db_transaction_rollback(); |
| 248 | 248 | $result = $e->getMessage(); |
| 249 | 249 | } |
@@ -256,46 +256,46 @@ discard block |
||
| 256 | 256 | * @return int|string |
| 257 | 257 | */ |
| 258 | 258 | protected function password_reset_confirm() { |
| 259 | - if(!$this->is_password_reset_confirm) { |
|
| 259 | + if (!$this->is_password_reset_confirm) { |
|
| 260 | 260 | return $this->account_login_status; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - if($this->account_login_status != LOGIN_UNDEFINED) { |
|
| 263 | + if ($this->account_login_status != LOGIN_UNDEFINED) { |
|
| 264 | 264 | return $this->account_login_status; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // Проверяем поддержку сброса пароля |
| 268 | - if(!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) { |
|
| 268 | + if (!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) { |
|
| 269 | 269 | return $this->account_login_status; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | try { |
| 273 | 273 | $code_unsafe = sys_get_param_str_unsafe('password_reset_code'); |
| 274 | - if(empty($code_unsafe)) { |
|
| 274 | + if (empty($code_unsafe)) { |
|
| 275 | 275 | throw new Exception(PASSWORD_RESTORE_ERROR_CODE_EMPTY, ERR_ERROR); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | sn_db_transaction_start(); |
| 279 | 279 | $confirmation = $this->confirmation->db_confirmation_get_by_type_and_code(CONFIRM_PASSWORD_RESET, $code_unsafe); // OK 4.5 |
| 280 | 280 | |
| 281 | - if(empty($confirmation)) { |
|
| 281 | + if (empty($confirmation)) { |
|
| 282 | 282 | throw new Exception(PASSWORD_RESTORE_ERROR_CODE_WRONG, ERR_ERROR); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - if(SN_TIME_NOW - strtotime($confirmation['create_time']) > AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE) { |
|
| 285 | + if (SN_TIME_NOW - strtotime($confirmation['create_time']) > AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE) { |
|
| 286 | 286 | throw new Exception(PASSWORD_RESTORE_ERROR_CODE_TOO_OLD, ERR_ERROR); |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | unset($this->account); |
| 290 | 290 | $this->account = new Account($this->db); |
| 291 | 291 | |
| 292 | - if(!$this->account->db_get_by_email($confirmation['email'])) { |
|
| 292 | + if (!$this->account->db_get_by_email($confirmation['email'])) { |
|
| 293 | 293 | throw new Exception(PASSWORD_RESTORE_ERROR_CODE_OK_BUT_NO_ACCOUNT_FOR_EMAIL, ERR_ERROR); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $new_password_unsafe = $this->make_random_password(); |
| 297 | 297 | $salt_unsafe = $this->password_salt_generate(); |
| 298 | - if(!$this->account->db_set_password($new_password_unsafe, $salt_unsafe)) { |
|
| 298 | + if (!$this->account->db_set_password($new_password_unsafe, $salt_unsafe)) { |
|
| 299 | 299 | // Ошибка смены пароля |
| 300 | 300 | throw new Exception(AUTH_ERROR_INTERNAL_PASSWORD_CHANGE_ON_RESTORE, ERR_ERROR); |
| 301 | 301 | } |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | $this->cookie_set(); |
| 306 | 306 | $this->login_cookie(); |
| 307 | 307 | |
| 308 | - if($this->account_login_status == LOGIN_SUCCESS) { |
|
| 308 | + if ($this->account_login_status == LOGIN_SUCCESS) { |
|
| 309 | 309 | // TODO - НЕ ОБЯЗАТЕЛЬНО ОТПРАВЛЯТЬ ЧЕРЕЗ ЕМЕЙЛ! ЕСЛИ ЭТО ФЕЙСБУЧЕК ИЛИ ВКШЕЧКА - МОЖНО ЧЕРЕЗ ЛС ПИСАТЬ!! |
| 310 | 310 | $message_header = sprintf(classLocale::$lang['log_lost_email_title'], classSupernova::$config->game_name); |
| 311 | 311 | $message = sprintf(classLocale::$lang['log_lost_email_pass'], classSupernova::$config->game_name, $this->account->account_name, $new_password_unsafe); |
| 312 | 312 | @$operation_result = mymail($confirmation['email'], $message_header, htmlspecialchars($message)); |
| 313 | 313 | |
| 314 | 314 | $users_translated = PlayerToAccountTranslate::db_translate_get_users_from_account_list($this->provider_id, $this->account->account_id); // OK 4.5 |
| 315 | - if(!empty($users_translated)) { |
|
| 315 | + if (!empty($users_translated)) { |
|
| 316 | 316 | // Отправляем в лички письмо о сбросе пароля |
| 317 | 317 | |
| 318 | 318 | // ПО ОПРЕДЕЛЕНИЮ в $users_translated только |
@@ -321,9 +321,9 @@ discard block |
||
| 321 | 321 | // - игроки, привязанные только к этим аккаунтам |
| 322 | 322 | // Значит им всем сразу скопом можно отправлять сообщения |
| 323 | 323 | $message = sprintf(classLocale::$lang['sys_password_reset_message_body'], $new_password_unsafe); |
| 324 | - $message = sys_bbcodeParse($message) . '<br><br>'; |
|
| 324 | + $message = sys_bbcodeParse($message).'<br><br>'; |
|
| 325 | 325 | |
| 326 | - foreach($users_translated as $user_id => $providers_list) { |
|
| 326 | + foreach ($users_translated as $user_id => $providers_list) { |
|
| 327 | 327 | msg_send_simple_message($user_id, 0, SN_TIME_NOW, MSG_TYPE_ADMIN, classLocale::$lang['sys_administration'], classLocale::$lang['sys_login_register_message_title'], $message); |
| 328 | 328 | } |
| 329 | 329 | } else { |
@@ -375,10 +375,10 @@ discard block |
||
| 375 | 375 | // OK v4.5 |
| 376 | 376 | protected function register() { |
| 377 | 377 | // TODO РЕГИСТРАЦИЯ ВСЕГДА ДОЛЖНА ЛОГИНИТЬ ПОЛЬЗОВАТЕЛЯ! |
| 378 | - $this->flog('Регистрация: начинаем. Провайдер ' . $this->provider_id); |
|
| 378 | + $this->flog('Регистрация: начинаем. Провайдер '.$this->provider_id); |
|
| 379 | 379 | |
| 380 | 380 | try { |
| 381 | - if(!$this->is_register) { |
|
| 381 | + if (!$this->is_register) { |
|
| 382 | 382 | $this->flog('Регистрация: не выставлен флаг регистрации - пропускаем'); |
| 383 | 383 | throw new Exception(LOGIN_UNDEFINED, ERR_ERROR); |
| 384 | 384 | } |
@@ -388,8 +388,8 @@ discard block |
||
| 388 | 388 | sn_db_transaction_start(); |
| 389 | 389 | |
| 390 | 390 | $this->account->db_get_by_name_or_email($this->input_login_unsafe, $this->input_email_unsafe); |
| 391 | - if($this->account->is_exists) { |
|
| 392 | - if($this->account->account_email == $this->input_email_unsafe) { |
|
| 391 | + if ($this->account->is_exists) { |
|
| 392 | + if ($this->account->account_email == $this->input_email_unsafe) { |
|
| 393 | 393 | throw new Exception(REGISTER_ERROR_EMAIL_EXISTS, ERR_ERROR); |
| 394 | 394 | } else { |
| 395 | 395 | throw new Exception(REGISTER_ERROR_ACCOUNT_NAME_EXISTS, ERR_ERROR); |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | // А вот это пока не нужно. Трансляцией аккаунтов в юзеров и созданием новых юзеров для новозашедших аккаунтов занимается Auth |
| 412 | 412 | // $this->register_account(); |
| 413 | 413 | sn_db_transaction_commit(); |
| 414 | - } catch(Exception $e) { |
|
| 414 | + } catch (Exception $e) { |
|
| 415 | 415 | sn_db_transaction_rollback(); |
| 416 | 416 | $this->account_login_status == LOGIN_UNDEFINED ? $this->account_login_status = $e->getMessage() : false; |
| 417 | 417 | } |
@@ -427,19 +427,19 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | // OK v4.5 |
| 429 | 429 | protected function login_cookie() { |
| 430 | - if($this->account_login_status != LOGIN_UNDEFINED) { |
|
| 430 | + if ($this->account_login_status != LOGIN_UNDEFINED) { |
|
| 431 | 431 | return $this->account_login_status; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | // Пытаемся войти по куке |
| 435 | - if(!empty($_COOKIE[$this->cookie_name])) { |
|
| 436 | - if(count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) { |
|
| 435 | + if (!empty($_COOKIE[$this->cookie_name])) { |
|
| 436 | + if (count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) { |
|
| 437 | 437 | list($account_id_unsafe, $cookie_password_hash_salted, $user_remember_me) = explode(AUTH_COOKIE_DELIMETER, $_COOKIE[$this->cookie_name]); |
| 438 | 438 | } else { |
| 439 | 439 | list($account_id_unsafe, $user_name, $cookie_password_hash_salted, $user_remember_me) = explode("/%/", $_COOKIE[$this->cookie_name]); |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - if( |
|
| 442 | + if ( |
|
| 443 | 443 | $this->account->db_get_by_id($account_id_unsafe) |
| 444 | 444 | && ($this->password_encode_for_cookie($this->account->account_password) == $cookie_password_hash_salted) |
| 445 | 445 | ) { |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - if($this->account_login_status != LOGIN_SUCCESS) { |
|
| 451 | + if ($this->account_login_status != LOGIN_SUCCESS) { |
|
| 452 | 452 | // Невалидная кука - чистим |
| 453 | 453 | $this->cookie_clear(); |
| 454 | 454 | } |
@@ -466,29 +466,29 @@ discard block |
||
| 466 | 466 | protected function login_username() { |
| 467 | 467 | // TODO - Логин по старым именам |
| 468 | 468 | try { |
| 469 | - if(!$this->is_login) { |
|
| 469 | + if (!$this->is_login) { |
|
| 470 | 470 | $this->flog('Логин: не выставлен флаг входа в игру - это не логин'); |
| 471 | 471 | throw new Exception(LOGIN_UNDEFINED, ERR_ERROR); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | // TODO Пустое имя аккаунта |
| 475 | - if(!$this->input_login_unsafe) { |
|
| 475 | + if (!$this->input_login_unsafe) { |
|
| 476 | 476 | throw new Exception(LOGIN_UNDEFINED, ERR_ERROR); |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $this->login_validate_input(); |
| 480 | 480 | |
| 481 | - if(!$this->account->db_get_by_name($this->input_login_unsafe) && !$this->account->db_get_by_email($this->input_login_unsafe)) { |
|
| 481 | + if (!$this->account->db_get_by_name($this->input_login_unsafe) && !$this->account->db_get_by_email($this->input_login_unsafe)) { |
|
| 482 | 482 | throw new Exception(LOGIN_ERROR_USERNAME, ERR_ERROR); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if(!$this->account->password_check($this->input_login_password_raw)) { |
|
| 485 | + if (!$this->account->password_check($this->input_login_password_raw)) { |
|
| 486 | 486 | throw new Exception(LOGIN_ERROR_PASSWORD, ERR_ERROR); |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $this->cookie_set(); |
| 490 | 490 | $this->account_login_status = LOGIN_SUCCESS; |
| 491 | - } catch(Exception $e) { |
|
| 491 | + } catch (Exception $e) { |
|
| 492 | 492 | $this->account_login_status == LOGIN_UNDEFINED ? $this->account_login_status = $e->getMessage() : false; |
| 493 | 493 | } |
| 494 | 494 | |
@@ -510,18 +510,18 @@ discard block |
||
| 510 | 510 | protected function cookie_set($account_to_impersonate = null) { |
| 511 | 511 | $this_account = is_object($account_to_impersonate) ? $account_to_impersonate : $this->account; |
| 512 | 512 | |
| 513 | - if(!is_object($this_account) || !$this_account->is_exists) { |
|
| 513 | + if (!is_object($this_account) || !$this_account->is_exists) { |
|
| 514 | 514 | throw new Exception(LOGIN_ERROR_NO_ACCOUNT_FOR_COOKIE_SET, ERR_ERROR); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if(is_object($account_to_impersonate) && $account_to_impersonate->is_exists) { |
|
| 517 | + if (is_object($account_to_impersonate) && $account_to_impersonate->is_exists) { |
|
| 518 | 518 | sn_setcookie($this->cookie_name_impersonate, $_COOKIE[$this->cookie_name], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $this->domain); |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | $expire_time = $this->remember_me ? SN_TIME_NOW + PERIOD_YEAR : 0; |
| 522 | 522 | |
| 523 | 523 | $password_encoded = $this->password_encode_for_cookie($this_account->account_password); |
| 524 | - $cookie = $this_account->account_id . AUTH_COOKIE_DELIMETER . $password_encoded . AUTH_COOKIE_DELIMETER . $this->remember_me; |
|
| 524 | + $cookie = $this_account->account_id.AUTH_COOKIE_DELIMETER.$password_encoded.AUTH_COOKIE_DELIMETER.$this->remember_me; |
|
| 525 | 525 | $this->flog("cookie_set() - Устанавливаем куку {$cookie}"); |
| 526 | 526 | return sn_setcookie($this->cookie_name, $cookie, $expire_time, $this->sn_root_path, $this->domain); |
| 527 | 527 | } |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | // OK v4.1 |
| 533 | 533 | protected function cookie_clear() { |
| 534 | 534 | // Автоматически вообще-то - если установлена кука имперсонатора - то чистим обычную, а куку имперсонатора - копируем в неё |
| 535 | - if(!empty($_COOKIE[$this->cookie_name_impersonate])) { |
|
| 535 | + if (!empty($_COOKIE[$this->cookie_name_impersonate])) { |
|
| 536 | 536 | sn_setcookie($this->cookie_name, $_COOKIE[$this->cookie_name_impersonate], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $this->domain); |
| 537 | 537 | sn_setcookie($this->cookie_name_impersonate, '', SN_TIME_NOW - PERIOD_WEEK, $this->sn_root_path, $this->domain); |
| 538 | 538 | } else { |
@@ -551,10 +551,10 @@ discard block |
||
| 551 | 551 | protected function login_validate_input() { |
| 552 | 552 | // Проверяем, что бы в начале и конце не было пустых символов |
| 553 | 553 | // TODO - при копировании Эксель -> Опера - в конце образуются пустые места. Это не должно быть проблемой! Вынести проверку пароля в регистрацию! |
| 554 | - if($this->input_login_password_raw != trim($this->input_login_password_raw)) { |
|
| 554 | + if ($this->input_login_password_raw != trim($this->input_login_password_raw)) { |
|
| 555 | 555 | throw new Exception(LOGIN_ERROR_PASSWORD_TRIMMED, ERR_ERROR); |
| 556 | 556 | } |
| 557 | - if(!$this->input_login_password_raw) { |
|
| 557 | + if (!$this->input_login_password_raw) { |
|
| 558 | 558 | throw new Exception(LOGIN_ERROR_PASSWORD_EMPTY, ERR_ERROR); |
| 559 | 559 | } |
| 560 | 560 | } |
@@ -570,37 +570,37 @@ discard block |
||
| 570 | 570 | $this->login_validate_input(); |
| 571 | 571 | |
| 572 | 572 | // Если нет имени пользователя - NO GO! |
| 573 | - if(!$this->input_login_unsafe) { |
|
| 573 | + if (!$this->input_login_unsafe) { |
|
| 574 | 574 | throw new Exception(LOGIN_ERROR_USERNAME_EMPTY, ERR_ERROR); |
| 575 | 575 | } |
| 576 | 576 | // Если логин имеет запрещенные символы - NO GO! |
| 577 | - if(strpbrk($this->input_login_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
| 577 | + if (strpbrk($this->input_login_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
| 578 | 578 | throw new Exception(LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS, ERR_ERROR); |
| 579 | 579 | } |
| 580 | 580 | // Если логин меньше минимальной длины - NO GO! |
| 581 | - if(strlen($this->input_login_unsafe) < LOGIN_LENGTH_MIN) { |
|
| 581 | + if (strlen($this->input_login_unsafe) < LOGIN_LENGTH_MIN) { |
|
| 582 | 582 | throw new Exception(REGISTER_ERROR_USERNAME_SHORT, ERR_ERROR); |
| 583 | 583 | } |
| 584 | 584 | // Если пароль меньше минимальной длины - NO GO! |
| 585 | - if(strlen($this->input_login_password_raw) < PASSWORD_LENGTH_MIN) { |
|
| 585 | + if (strlen($this->input_login_password_raw) < PASSWORD_LENGTH_MIN) { |
|
| 586 | 586 | throw new Exception(REGISTER_ERROR_PASSWORD_INSECURE, ERR_ERROR); |
| 587 | 587 | } |
| 588 | 588 | // Если пароль имеет пробельные символы в начале или конце - NO GO! |
| 589 | - if($this->input_login_password_raw != trim($this->input_login_password_raw)) { |
|
| 589 | + if ($this->input_login_password_raw != trim($this->input_login_password_raw)) { |
|
| 590 | 590 | throw new Exception(LOGIN_ERROR_PASSWORD_TRIMMED, ERR_ERROR); |
| 591 | 591 | } |
| 592 | 592 | // Если пароль не совпадает с подтверждением - NO GO! То, что у пароля нет пробельных символов в начале/конце - мы уже проверили выше |
| 593 | 593 | //Если они есть у повтора - значит пароль и повтор не совпадут |
| 594 | - if($this->input_login_password_raw <> $this->input_login_password_raw_repeat) { |
|
| 594 | + if ($this->input_login_password_raw <> $this->input_login_password_raw_repeat) { |
|
| 595 | 595 | throw new Exception(REGISTER_ERROR_PASSWORD_DIFFERENT, ERR_ERROR); |
| 596 | 596 | } |
| 597 | 597 | // Если нет емейла - NO GO! |
| 598 | 598 | // TODO - регистрация без емейла |
| 599 | - if(!$this->input_email_unsafe) { |
|
| 599 | + if (!$this->input_email_unsafe) { |
|
| 600 | 600 | throw new Exception(REGISTER_ERROR_EMAIL_EMPTY, ERR_ERROR); |
| 601 | 601 | } |
| 602 | 602 | // Если емейл не является емейлом - NO GO! |
| 603 | - if(!is_email($this->input_email_unsafe)) { |
|
| 603 | + if (!is_email($this->input_email_unsafe)) { |
|
| 604 | 604 | throw new Exception(REGISTER_ERROR_EMAIL_WRONG, ERR_ERROR); |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | |
| 610 | 610 | // OK v4 |
| 611 | 611 | protected function password_encode_for_cookie($password) { |
| 612 | - return md5("{$password}--" . $this->secret_word); |
|
| 612 | + return md5("{$password}--".$this->secret_word); |
|
| 613 | 613 | } |
| 614 | 614 | // OK v4 |
| 615 | 615 | protected function password_encode($password, $salt) { |
@@ -629,22 +629,22 @@ discard block |
||
| 629 | 629 | return core_auth::make_random_password(); |
| 630 | 630 | } |
| 631 | 631 | protected function flog($message, $die = false) { |
| 632 | - if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
|
| 632 | + if (!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
|
| 633 | 633 | return; |
| 634 | 634 | } |
| 635 | 635 | list($called, $caller) = debug_backtrace(false); |
| 636 | 636 | |
| 637 | 637 | $caller_name = |
| 638 | - ((get_called_class()) ? get_called_class() : (!empty($caller['class']) ? $caller['class'] : '')) . |
|
| 639 | - (!empty($caller['type']) ? $caller['type'] : '') . |
|
| 640 | - (!empty($caller['function']) ? $caller['function'] : '') . |
|
| 641 | - (!empty($called['line']) ? ':' . $called['line'] : ''); |
|
| 638 | + ((get_called_class()) ? get_called_class() : (!empty($caller['class']) ? $caller['class'] : '')). |
|
| 639 | + (!empty($caller['type']) ? $caller['type'] : ''). |
|
| 640 | + (!empty($caller['function']) ? $caller['function'] : ''). |
|
| 641 | + (!empty($called['line']) ? ':'.$called['line'] : ''); |
|
| 642 | 642 | |
| 643 | 643 | $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false; |
| 644 | 644 | |
| 645 | 645 | classSupernova::log_file("$message - $caller_name"); |
| 646 | - if($die) { |
|
| 647 | - $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>"); |
|
| 646 | + if ($die) { |
|
| 647 | + $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в ".get_called_class()." (располагается в ".get_class()."). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>"); |
|
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | |