@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | protected static $autoloaderRegistered = false; |
25 | 25 | |
26 | 26 | protected static function _constructorStatic() { |
27 | - if(!static::$autoloaderRegistered) { |
|
27 | + if (!static::$autoloaderRegistered) { |
|
28 | 28 | spl_autoload_register(array(__CLASS__, 'autoloader')); |
29 | 29 | static::$autoloaderRegistered = true; |
30 | 30 | } |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | public static function autoloader($class) { |
37 | 37 | static::_constructorStatic(); |
38 | 38 | |
39 | - foreach(static::$folders as $data) { |
|
39 | + foreach (static::$folders as $data) { |
|
40 | 40 | $theClassFile = $class; |
41 | 41 | |
42 | - if($data[static::P_PREFIX] && strrpos($class, $data[static::P_PREFIX]) !== false) { |
|
42 | + if ($data[static::P_PREFIX] && strrpos($class, $data[static::P_PREFIX]) !== false) { |
|
43 | 43 | $theClassFile = substr($class, strlen($data[static::P_PREFIX])); |
44 | 44 | } |
45 | 45 | |
46 | 46 | $classFullFileName = str_replace('\\', '/', $data[static::P_FOLDER] . $theClassFile) . DOT_PHP_EX; |
47 | - if(file_exists($classFullFileName) && is_file($classFullFileName)) { |
|
47 | + if (file_exists($classFullFileName) && is_file($classFullFileName)) { |
|
48 | 48 | require_once($classFullFileName); |
49 | - if(method_exists($class, '_constructorStatic')) { |
|
49 | + if (method_exists($class, '_constructorStatic')) { |
|
50 | 50 | $class::_constructorStatic(); |
51 | 51 | } |
52 | 52 | } |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | |
63 | 63 | $absoluteClassRoot = str_replace('\\', '/', SN_ROOT_PHYSICAL . $absoluteClassRoot); |
64 | 64 | |
65 | - if(!($absoluteClassRoot = realpath($absoluteClassRoot))) { |
|
65 | + if (!($absoluteClassRoot = realpath($absoluteClassRoot))) { |
|
66 | 66 | // TODO - throw new \Exception("There is some error when installing autoloader for '{$absoluteClassRoot}' class prefix '{$classPrefix}'"); |
67 | 67 | return; |
68 | 68 | } |
69 | 69 | $absoluteClassRoot = str_replace('\\', '/', $absoluteClassRoot) . '/'; |
70 | 70 | |
71 | - if($classPrefix && strrpos($classPrefix, 1) != '\\') { |
|
71 | + if ($classPrefix && strrpos($classPrefix, 1) != '\\') { |
|
72 | 72 | $classPrefix .= '\\'; |
73 | 73 | } |
74 | 74 |
@@ -88,91 +88,91 @@ |
||
88 | 88 | |
89 | 89 | // Services -------------------------------------------------------------------------------------------------------- |
90 | 90 | // Default db |
91 | - $gc->db = function (GlobalContainer $c) { |
|
91 | + $gc->db = function(GlobalContainer $c) { |
|
92 | 92 | SN::$db = new \db_mysql($c); |
93 | 93 | |
94 | 94 | return SN::$db; |
95 | 95 | }; |
96 | 96 | |
97 | - $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
|
97 | + $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */ |
|
98 | 98 | GlobalContainer $c) { |
99 | 99 | return new \debug(); |
100 | 100 | }; |
101 | 101 | |
102 | - $gc->cache = function (GlobalContainer $gc) { |
|
102 | + $gc->cache = function(GlobalContainer $gc) { |
|
103 | 103 | return new \classCache($gc->cachePrefix); |
104 | 104 | }; |
105 | 105 | |
106 | - $gc->config = function (GlobalContainer $gc) { |
|
106 | + $gc->config = function(GlobalContainer $gc) { |
|
107 | 107 | return new \classConfig($gc->cachePrefix); |
108 | 108 | }; |
109 | 109 | |
110 | 110 | |
111 | - $gc->repository = function (GlobalContainer $gc) { |
|
111 | + $gc->repository = function(GlobalContainer $gc) { |
|
112 | 112 | return new Repository($gc); |
113 | 113 | }; |
114 | 114 | |
115 | - $gc->storage = function (GlobalContainer $gc) { |
|
115 | + $gc->storage = function(GlobalContainer $gc) { |
|
116 | 116 | return new \Storage($gc); |
117 | 117 | }; |
118 | 118 | |
119 | - $gc->design = function (GlobalContainer $gc) { |
|
119 | + $gc->design = function(GlobalContainer $gc) { |
|
120 | 120 | return new \Design($gc); |
121 | 121 | }; |
122 | 122 | |
123 | - $gc->bbCodeParser = function (GlobalContainer $gc) { |
|
123 | + $gc->bbCodeParser = function(GlobalContainer $gc) { |
|
124 | 124 | return new \BBCodeParser($gc); |
125 | 125 | }; |
126 | 126 | |
127 | - $gc->fleetDispatcher = function (GlobalContainer $gc) { |
|
127 | + $gc->fleetDispatcher = function(GlobalContainer $gc) { |
|
128 | 128 | return new \FleetDispatcher($gc); |
129 | 129 | }; |
130 | 130 | |
131 | - $gc->watchdog = function (GlobalContainer $gc) { |
|
131 | + $gc->watchdog = function(GlobalContainer $gc) { |
|
132 | 132 | return new Watchdog($gc); |
133 | 133 | }; |
134 | 134 | |
135 | - $gc->eventBus = function (GlobalContainer $gc) { |
|
135 | + $gc->eventBus = function(GlobalContainer $gc) { |
|
136 | 136 | return new EventBus($gc); |
137 | 137 | }; |
138 | 138 | |
139 | - $gc->valueStorage = function (GlobalContainer $gc) { |
|
139 | + $gc->valueStorage = function(GlobalContainer $gc) { |
|
140 | 140 | return new ValueStorage([]); |
141 | 141 | }; |
142 | 142 | |
143 | - $gc->bonusCatalog = function (GlobalContainer $gc) { |
|
143 | + $gc->bonusCatalog = function(GlobalContainer $gc) { |
|
144 | 144 | return new BonusCatalog($gc); |
145 | 145 | }; |
146 | 146 | |
147 | - $gc->general = function (GlobalContainer $gc) { |
|
147 | + $gc->general = function(GlobalContainer $gc) { |
|
148 | 148 | return new General($gc); |
149 | 149 | }; |
150 | 150 | |
151 | - $gc->economicHelper = function (GlobalContainer $gc) { |
|
151 | + $gc->economicHelper = function(GlobalContainer $gc) { |
|
152 | 152 | return new EconomicHelper($gc); |
153 | 153 | }; |
154 | 154 | |
155 | - $gc->playerLevelHelper = function (GlobalContainer $gc) { |
|
155 | + $gc->playerLevelHelper = function(GlobalContainer $gc) { |
|
156 | 156 | return new PlayerLevelHelper($gc); |
157 | 157 | }; |
158 | 158 | |
159 | - $gc->pimp = function (GlobalContainer $gc) { |
|
159 | + $gc->pimp = function(GlobalContainer $gc) { |
|
160 | 160 | return new SnPimp($gc); |
161 | 161 | }; |
162 | 162 | |
163 | 163 | // Dummy objects --------------------------------------------------------------------------------------------------- |
164 | - $gc->theUser = function (GlobalContainer $gc) { |
|
164 | + $gc->theUser = function(GlobalContainer $gc) { |
|
165 | 165 | return new \TheUser($gc); |
166 | 166 | }; |
167 | 167 | |
168 | 168 | |
169 | 169 | // Models ---------------------------------------------------------------------------------------------------------- |
170 | 170 | $gc->skinEntityClass = \SkinV2::class; |
171 | - $gc->skinModel = function (GlobalContainer $gc) { |
|
171 | + $gc->skinModel = function(GlobalContainer $gc) { |
|
172 | 172 | return new \SkinModel($gc); |
173 | 173 | }; |
174 | 174 | |
175 | - $gc->textModel = function (GlobalContainer $gc) { |
|
175 | + $gc->textModel = function(GlobalContainer $gc) { |
|
176 | 176 | return new \TextModel($gc); |
177 | 177 | }; |
178 | 178 |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
7 | 7 | |
8 | 8 | $template = gettemplate('ali_info', true); |
9 | 9 | |
10 | -if($mode == 'exit') |
|
10 | +if ($mode == 'exit') |
|
11 | 11 | { |
12 | 12 | if ($ally['ally_owner'] == $user['id']) |
13 | 13 | { |
@@ -24,25 +24,25 @@ discard block |
||
24 | 24 | messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
25 | 25 | } |
26 | 26 | } |
27 | -elseif($mode == 'ainfo') |
|
27 | +elseif ($mode == 'ainfo') |
|
28 | 28 | { |
29 | 29 | $tag = sys_get_param_str('tag'); |
30 | 30 | $id_ally = sys_get_param_id('a'); |
31 | - if($tag) |
|
31 | + if ($tag) |
|
32 | 32 | { |
33 | 33 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
34 | 34 | } |
35 | - elseif($id_ally) |
|
35 | + elseif ($id_ally) |
|
36 | 36 | { |
37 | 37 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
38 | 38 | } |
39 | 39 | |
40 | - if(!$ally) |
|
40 | + if (!$ally) |
|
41 | 41 | { |
42 | 42 | messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
43 | 43 | } |
44 | 44 | |
45 | - if(!$ally['ally_description']) |
|
45 | + if (!$ally['ally_description']) |
|
46 | 46 | { |
47 | 47 | $ally['ally_description'] = $lang['Ally_nodescription']; |
48 | 48 | } |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | 'EXTERNAL' => true, |
52 | 52 | 'USER_ALLY_ID' => $user['ally_id'], |
53 | 53 | )); |
54 | - $page_header = $lang['sys_alliance']; |
|
54 | + $page_header = $lang['sys_alliance']; |
|
55 | 55 | } |
56 | 56 | else |
57 | 57 | { |
58 | 58 | $page_header = $lang['your_alliance']; |
59 | 59 | |
60 | - if($ally['ally_owner'] == $user['id']) |
|
60 | + if ($ally['ally_owner'] == $user['id']) |
|
61 | 61 | { |
62 | 62 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
63 | 63 | } |
64 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
64 | + elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
65 | 65 | { |
66 | 66 | $range = $ranks[$user['ally_rank_id']]['name']; |
67 | 67 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | )); |
106 | 106 | |
107 | 107 | $relations = ali_relations($ally['id']); |
108 | -foreach($relations as $relation) |
|
108 | +foreach ($relations as $relation) |
|
109 | 109 | { |
110 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
110 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
111 | 111 | { |
112 | 112 | $template->assign_block_vars('relation', array( |
113 | 113 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | displayP($page_item); |
284 | 284 | } |
285 | 285 | |
286 | - if(is_array($template_result[TEMPLATE_EXTRA_ARRAY]) && !empty($template_result[TEMPLATE_EXTRA_ARRAY])) { |
|
287 | - foreach($template_result[TEMPLATE_EXTRA_ARRAY] as $extraName => $extraTemplate) { |
|
286 | + if (is_array($template_result[TEMPLATE_EXTRA_ARRAY]) && !empty($template_result[TEMPLATE_EXTRA_ARRAY])) { |
|
287 | + foreach ($template_result[TEMPLATE_EXTRA_ARRAY] as $extraName => $extraTemplate) { |
|
288 | 288 | /** |
289 | 289 | * @var template $extraTemplate |
290 | 290 | */ |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | renderFooter(); |
298 | 298 | } |
299 | 299 | |
300 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
300 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
301 | 301 | |
302 | 302 | sn_db_disconnect(); |
303 | 303 | |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
612 | -SN::$afterInit[] = function () { |
|
612 | +SN::$afterInit[] = function() { |
|
613 | 613 | SN::$gc->pimp->add()->tpl_render_topnav($t = 'sn_tpl_render_topnav', [], null); |
614 | 614 | }; |
615 | 615 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | global $lang, $config, $sn_module_list, $template_result, $sn_mvc; |
625 | 625 | |
626 | 626 | // This call was not first one... Using results from previous call |
627 | - if(!empty($prevUser['username'])) { |
|
627 | + if (!empty($prevUser['username'])) { |
|
628 | 628 | $user = $prevUser; |
629 | 629 | } |
630 | 630 | |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | 'QUE_ID' => QUE_RESEARCH, |
683 | 683 | 'QUE_HTML' => 'topnav', |
684 | 684 | |
685 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
685 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
686 | 686 | |
687 | 687 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
688 | 688 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | 'LANG' => $language ? $language : '', |
977 | 977 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
978 | 978 | |
979 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
979 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
980 | 980 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
981 | 981 | )); |
982 | 982 |