@@ -23,16 +23,14 @@ discard block |
||
23 | 23 | $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); |
24 | 24 | messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
25 | 25 | } |
26 | -} |
|
27 | -elseif($mode == 'ainfo') |
|
26 | +} elseif($mode == 'ainfo') |
|
28 | 27 | { |
29 | 28 | $tag = sys_get_param_str('tag'); |
30 | 29 | $id_ally = sys_get_param_id('a'); |
31 | 30 | if($tag) |
32 | 31 | { |
33 | 32 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
34 | - } |
|
35 | - elseif($id_ally) |
|
33 | + } elseif($id_ally) |
|
36 | 34 | { |
37 | 35 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
38 | 36 | } |
@@ -52,20 +50,17 @@ discard block |
||
52 | 50 | 'USER_ALLY_ID' => $user['ally_id'], |
53 | 51 | )); |
54 | 52 | $page_header = $lang['sys_alliance']; |
55 | -} |
|
56 | -else |
|
53 | +} else |
|
57 | 54 | { |
58 | 55 | $page_header = $lang['your_alliance']; |
59 | 56 | |
60 | 57 | if($ally['ally_owner'] == $user['id']) |
61 | 58 | { |
62 | 59 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
63 | - } |
|
64 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
60 | + } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
65 | 61 | { |
66 | 62 | $range = $ranks[$user['ally_rank_id']]['name']; |
67 | - } |
|
68 | - else |
|
63 | + } else |
|
69 | 64 | { |
70 | 65 | $range = $lang['member']; |
71 | 66 | } |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | ->doInsert(); |
67 | 67 | |
68 | 68 | $accept_offer = false; |
69 | - } |
|
70 | - else |
|
69 | + } else |
|
71 | 70 | { |
72 | 71 | $accept_offer = true; |
73 | 72 | $negotiation = array( |
@@ -78,8 +77,7 @@ discard block |
||
78 | 77 | 'alliance_negotiation_relation' => $alliance_negotiation_relation, |
79 | 78 | ); |
80 | 79 | } |
81 | -} |
|
82 | -else |
|
80 | +} else |
|
83 | 81 | { |
84 | 82 | $offer_id = sys_get_param_id('offer_id'); |
85 | 83 | if($offer_id) |
@@ -90,31 +88,26 @@ discard block |
||
90 | 88 | if(!$negotiation) |
91 | 89 | { |
92 | 90 | messageBox($lang['ali_dip_err_offer_none'], $page_title); |
93 | - } |
|
94 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
91 | + } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
95 | 92 | { |
96 | 93 | // TODO: Add log of hack attempt |
97 | 94 | messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
98 | - } |
|
99 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
95 | + } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
100 | 96 | { |
101 | 97 | if($offer_answer == 'accept') |
102 | 98 | { |
103 | 99 | // TODO: Add log of hack attempt |
104 | 100 | messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
105 | - } |
|
106 | - elseif($offer_answer == 'deny') |
|
101 | + } elseif($offer_answer == 'deny') |
|
107 | 102 | { |
108 | 103 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
109 | 104 | } |
110 | - } |
|
111 | - else |
|
105 | + } else |
|
112 | 106 | { |
113 | 107 | if($offer_answer == 'accept') |
114 | 108 | { |
115 | 109 | $accept_offer = true; |
116 | - } |
|
117 | - elseif($offer_answer == 'deny') |
|
110 | + } elseif($offer_answer == 'deny') |
|
118 | 111 | { |
119 | 112 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
120 | 113 | } |
@@ -37,8 +37,7 @@ |
||
37 | 37 | </script>'; |
38 | 38 | |
39 | 39 | messageBoxAdmin("{$script}<img src=\"design/images/progressbar.gif\"><br>{$lang['sys_wait']}", $lang['adm_stat_title'], '', 0); |
40 | -} |
|
41 | -else |
|
40 | +} else |
|
42 | 41 | { |
43 | 42 | messageBoxAdmin($lang['adm_stat_already_started'], $lang['adm_stat_title'], 'admin/overview.php'); |
44 | 43 | } |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @return array |
24 | 24 | * @deprecated |
25 | 25 | */ |
26 | - public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null) |
|
27 | - { |
|
26 | + public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null) { |
|
28 | 27 | if(!is_array($user)) |
29 | 28 | { |
30 | 29 | // TODO - remove later |
@@ -61,8 +60,7 @@ discard block |
||
61 | 60 | ), |
62 | 61 | ), |
63 | 62 | ); |
64 | - } |
|
65 | - else |
|
63 | + } else |
|
66 | 64 | { |
67 | 65 | $db_changeset = array( |
68 | 66 | 'action' => SQL_OP_INSERT, |
@@ -176,14 +174,21 @@ discard block |
||
176 | 174 | */ |
177 | 175 | public static function db_changeset_apply($db_changeset) { |
178 | 176 | $result = true; |
179 | - if(!is_array($db_changeset) || empty($db_changeset)) return $result; |
|
177 | + if(!is_array($db_changeset) || empty($db_changeset)) { |
|
178 | + return $result; |
|
179 | + } |
|
180 | 180 | |
181 | 181 | foreach($db_changeset as $table_name => &$table_data) { |
182 | 182 | foreach($table_data as $record_id => &$conditions) { |
183 | 183 | OldDbChangeSet::db_changeset_condition_compile($conditions, $table_name); |
184 | 184 | |
185 | - if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue; |
|
186 | - if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице |
|
185 | + if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) { |
|
186 | + continue; |
|
187 | + } |
|
188 | + if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) { |
|
189 | + continue; |
|
190 | + } |
|
191 | + // Защита от случайного удаления всех данных в таблице |
|
187 | 192 | |
188 | 193 | if($conditions[P_LOCATION] != LOC_NONE) { |
189 | 194 | switch($conditions['action']) |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -function sn_chat_model() |
|
8 | -{ |
|
7 | +function sn_chat_model() { |
|
9 | 8 | global $config, $user, $template_result, $lang; |
10 | 9 | |
11 | 10 | $config->array_set('users', $user['id'], 'chat_last_activity', SN_TIME_MICRO); |
@@ -44,15 +43,13 @@ discard block |
||
44 | 43 | |
45 | 44 | $template_result['PAGE_HEADER'] = $page_title; |
46 | 45 | } |
47 | -function sn_chat_view($template = null) |
|
48 | -{ |
|
46 | +function sn_chat_view($template = null) { |
|
49 | 47 | $template = gettemplate('chat_body', $template); |
50 | 48 | |
51 | 49 | return $template; |
52 | 50 | } |
53 | 51 | |
54 | -function sn_chat_add_model() |
|
55 | -{ |
|
52 | +function sn_chat_add_model() { |
|
56 | 53 | global $config, $user; |
57 | 54 | |
58 | 55 | define('IN_AJAX', true); |
@@ -76,8 +73,7 @@ discard block |
||
76 | 73 | |
77 | 74 | die(); |
78 | 75 | } |
79 | -function sn_chat_msg_view($template = null) |
|
80 | -{ |
|
76 | +function sn_chat_msg_view($template = null) { |
|
81 | 77 | global $config, $user, $lang; |
82 | 78 | |
83 | 79 | define('IN_AJAX', true); |
@@ -99,8 +95,7 @@ discard block |
||
99 | 95 | 'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')), |
100 | 96 | 'DISABLE' => true, |
101 | 97 | ); |
102 | - } |
|
103 | - else |
|
98 | + } else |
|
104 | 99 | { |
105 | 100 | $alliance = sys_get_param_str('ally') && $user['ally_id'] ? $user['ally_id'] : 0; |
106 | 101 | |
@@ -121,8 +116,7 @@ discard block |
||
121 | 116 | } |
122 | 117 | |
123 | 118 | $page = min($page_count, max(0, sys_get_param_int('sheet'))); |
124 | - } |
|
125 | - else |
|
119 | + } else |
|
126 | 120 | { |
127 | 121 | $last_message = sys_get_param_id('last_message'); |
128 | 122 | $where_add = $last_message ? "AND `messageid` > {$last_message}" : ''; |
@@ -171,8 +165,7 @@ discard block |
||
171 | 165 | { |
172 | 166 | $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}"; |
173 | 167 | display($template, $pageTitle); |
174 | - } |
|
175 | - else |
|
168 | + } else |
|
176 | 169 | { |
177 | 170 | $result['last_message'] = $last_message; |
178 | 171 | $result['html'] = templateRenderToHtml($template); |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * phpBB Hook Class |
24 | 24 | */ |
25 | -class phpbb_hook |
|
26 | -{ |
|
25 | +class phpbb_hook { |
|
27 | 26 | /** |
28 | 27 | * Registered hooks |
29 | 28 | */ |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * |
45 | 44 | * @param array $valid_hooks array containing the hookable functions/methods |
46 | 45 | */ |
47 | - function phpbb_hook($valid_hooks) |
|
48 | - { |
|
46 | + function phpbb_hook($valid_hooks) { |
|
49 | 47 | foreach ($valid_hooks as $_null => $method) |
50 | 48 | { |
51 | 49 | $this->add_hook($method); |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition |
66 | 64 | * @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain. |
67 | 65 | */ |
68 | - function register($definition, $hook, $mode = 'normal') |
|
69 | - { |
|
66 | + function register($definition, $hook, $mode = 'normal') { |
|
70 | 67 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
71 | 68 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
72 | 69 | |
@@ -79,8 +76,7 @@ discard block |
||
79 | 76 | if (!isset($this->hooks[$class][$function]['standalone'])) |
80 | 77 | { |
81 | 78 | $this->hooks[$class][$function] = array('standalone' => $hook); |
82 | - } |
|
83 | - else |
|
79 | + } else |
|
84 | 80 | { |
85 | 81 | trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE); |
86 | 82 | } |
@@ -106,8 +102,7 @@ discard block |
||
106 | 102 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
107 | 103 | * @return bool False if no hook got executed, true otherwise |
108 | 104 | */ |
109 | - function call_hook($definition) |
|
110 | - { |
|
105 | + function call_hook($definition) { |
|
111 | 106 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
112 | 107 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
113 | 108 | |
@@ -128,8 +123,7 @@ discard block |
||
128 | 123 | if (isset($this->hooks[$class][$function]['standalone'])) |
129 | 124 | { |
130 | 125 | $this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments); |
131 | - } |
|
132 | - else |
|
126 | + } else |
|
133 | 127 | { |
134 | 128 | foreach (array('first', 'normal', 'last') as $mode) |
135 | 129 | { |
@@ -159,8 +153,7 @@ discard block |
||
159 | 153 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
160 | 154 | * @return mixed False if nothing returned if there is no result, else array('result' => ... ) |
161 | 155 | */ |
162 | - function previous_hook_result($definition) |
|
163 | - { |
|
156 | + function previous_hook_result($definition) { |
|
164 | 157 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
165 | 158 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
166 | 159 | |
@@ -178,8 +171,7 @@ discard block |
||
178 | 171 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
179 | 172 | * @return bool True if results are there, false if not |
180 | 173 | */ |
181 | - function hook_return($definition) |
|
182 | - { |
|
174 | + function hook_return($definition) { |
|
183 | 175 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
184 | 176 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
185 | 177 | |
@@ -197,8 +189,7 @@ discard block |
||
197 | 189 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
198 | 190 | * @return mixed The result |
199 | 191 | */ |
200 | - function hook_return_result($definition) |
|
201 | - { |
|
192 | + function hook_return_result($definition) { |
|
202 | 193 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
203 | 194 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
204 | 195 | |
@@ -217,8 +208,7 @@ discard block |
||
217 | 208 | * |
218 | 209 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
219 | 210 | */ |
220 | - function add_hook($definition) |
|
221 | - { |
|
211 | + function add_hook($definition) { |
|
222 | 212 | if (!is_array($definition)) |
223 | 213 | { |
224 | 214 | $definition = array('__global', $definition); |
@@ -232,8 +222,7 @@ discard block |
||
232 | 222 | * |
233 | 223 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
234 | 224 | */ |
235 | - function remove_hook($definition) |
|
236 | - { |
|
225 | + function remove_hook($definition) { |
|
237 | 226 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
238 | 227 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
239 | 228 |
@@ -1,8 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
4 | -function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
|
5 | -{ |
|
4 | +function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) { |
|
6 | 5 | global $lang; |
7 | 6 | |
8 | 7 | $admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array( |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * @param $edit_planet_row |
26 | 25 | * @param $mode |
27 | 26 | */ |
28 | -function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) |
|
29 | -{ |
|
27 | +function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
|
30 | 28 | global $lang; |
31 | 29 | |
32 | 30 | $unit_list = sn_get_groups($mode); |
@@ -48,15 +46,13 @@ discard block |
||
48 | 46 | } |
49 | 47 | |
50 | 48 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
51 | -function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
|
52 | -{ |
|
49 | +function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
|
53 | 50 | if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
54 | 51 | { |
55 | 52 | $unit_amount = round($unit_amount); |
56 | 53 | $unit_name = get_unit_param($unit_id, P_NAME); |
57 | 54 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |
58 | - } |
|
59 | - else |
|
55 | + } else |
|
60 | 56 | { |
61 | 57 | $result = ''; |
62 | 58 | } |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | * Base Template class. |
23 | 23 | * @package phpBB3 |
24 | 24 | */ |
25 | -class template |
|
26 | -{ |
|
25 | +class template { |
|
27 | 26 | /** variable that holds all the data we'll be substituting into |
28 | 27 | * the compiled templates. Takes form: |
29 | 28 | * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value |
@@ -82,8 +81,7 @@ discard block |
||
82 | 81 | * Set template location |
83 | 82 | * @access public |
84 | 83 | */ |
85 | - function set_template() |
|
86 | - { |
|
84 | + function set_template() { |
|
87 | 85 | global $user; |
88 | 86 | |
89 | 87 | if (file_exists($this->rootPhysical. 'styles/' . $user->theme['template_path'] . '/template')) |
@@ -108,8 +106,7 @@ discard block |
||
108 | 106 | { |
109 | 107 | $this->inherit_root = $this->rootPhysical . 'styles/' . $user->theme['template_inherit_path'] . '/template'; |
110 | 108 | } |
111 | - } |
|
112 | - else |
|
109 | + } else |
|
113 | 110 | { |
114 | 111 | trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR); |
115 | 112 | } |
@@ -123,8 +120,7 @@ discard block |
||
123 | 120 | * Set custom template location (able to use directory outside of phpBB) |
124 | 121 | * @access public |
125 | 122 | */ |
126 | - function set_custom_template($template_path, $template_name, $fallback_template_path = false) |
|
127 | - { |
|
123 | + function set_custom_template($template_path, $template_name, $fallback_template_path = false) { |
|
128 | 124 | global $user; |
129 | 125 | |
130 | 126 | // Make sure $template_path has no ending slash |
@@ -145,8 +141,7 @@ discard block |
||
145 | 141 | |
146 | 142 | $this->inherit_root = $fallback_template_path; |
147 | 143 | $this->orig_tpl_inherits_id = true; |
148 | - } |
|
149 | - else |
|
144 | + } else |
|
150 | 145 | { |
151 | 146 | $this->orig_tpl_inherits_id = false; |
152 | 147 | } |
@@ -165,8 +160,7 @@ discard block |
||
165 | 160 | * should be a hash of handle => filename pairs. |
166 | 161 | * @access public |
167 | 162 | */ |
168 | - function set_filenames($filename_array) |
|
169 | - { |
|
163 | + function set_filenames($filename_array) { |
|
170 | 164 | if (!is_array($filename_array)) |
171 | 165 | { |
172 | 166 | return false; |
@@ -194,8 +188,7 @@ discard block |
||
194 | 188 | * Destroy template data set |
195 | 189 | * @access public |
196 | 190 | */ |
197 | - function destroy() |
|
198 | - { |
|
191 | + function destroy() { |
|
199 | 192 | $this->_tpldata = array('.' => array(0 => array())); |
200 | 193 | $this->_rootref = &$this->_tpldata['.'][0]; |
201 | 194 | } |
@@ -204,8 +197,7 @@ discard block |
||
204 | 197 | * Reset/empty complete block |
205 | 198 | * @access public |
206 | 199 | */ |
207 | - function destroy_block_vars($blockname) |
|
208 | - { |
|
200 | + function destroy_block_vars($blockname) { |
|
209 | 201 | if (strpos($blockname, '.') !== false) |
210 | 202 | { |
211 | 203 | // Nested block. |
@@ -220,8 +212,7 @@ discard block |
||
220 | 212 | } |
221 | 213 | |
222 | 214 | unset($str[$blocks[$blockcount]]); |
223 | - } |
|
224 | - else |
|
215 | + } else |
|
225 | 216 | { |
226 | 217 | // Top-level block. |
227 | 218 | unset($this->_tpldata[$blockname]); |
@@ -234,8 +225,7 @@ discard block |
||
234 | 225 | * Display handle |
235 | 226 | * @access public |
236 | 227 | */ |
237 | - function display($handle, $include_once = true) |
|
238 | - { |
|
228 | + function display($handle, $include_once = true) { |
|
239 | 229 | /** |
240 | 230 | * @var phpbb_hook $phpbb_hook |
241 | 231 | */ |
@@ -264,8 +254,7 @@ discard block |
||
264 | 254 | if ($filename = $this->_tpl_load($handle)) |
265 | 255 | { |
266 | 256 | ($include_once) ? include_once($filename) : include($filename); |
267 | - } |
|
268 | - else |
|
257 | + } else |
|
269 | 258 | { |
270 | 259 | $this->evaluate($this->compiled_code[$handle]); |
271 | 260 | } |
@@ -277,8 +266,7 @@ discard block |
||
277 | 266 | * Display the handle and assign the output to a template variable or return the compiled result. |
278 | 267 | * @access public |
279 | 268 | */ |
280 | - function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) |
|
281 | - { |
|
269 | + function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) { |
|
282 | 270 | ob_start(); |
283 | 271 | $this->display($handle, $include_once); |
284 | 272 | $contents = ob_get_clean(); |
@@ -297,8 +285,7 @@ discard block |
||
297 | 285 | * Load a compiled template if possible, if not, recompile it |
298 | 286 | * @access private |
299 | 287 | */ |
300 | - function _tpl_load(&$handle) |
|
301 | - { |
|
288 | + function _tpl_load(&$handle) { |
|
302 | 289 | global $user, $config; |
303 | 290 | |
304 | 291 | if (!isset($this->filename[$handle])) |
@@ -319,8 +306,7 @@ discard block |
||
319 | 306 | if (!file_exists($filename) || @filesize($filename) === 0) |
320 | 307 | { |
321 | 308 | $recompile = true; |
322 | - } |
|
323 | - else if ($config->load_tplcompile) |
|
309 | + } else if ($config->load_tplcompile) |
|
324 | 310 | { |
325 | 311 | // No way around it: we need to check inheritance here |
326 | 312 | if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle])) |
@@ -403,15 +389,13 @@ discard block |
||
403 | 389 | $this->files[$row['template_filename']] = $file; |
404 | 390 | $this->files_inherit[$row['template_filename']] = $file; |
405 | 391 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
406 | - } |
|
407 | - else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
392 | + } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
408 | 393 | { |
409 | 394 | // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that. |
410 | 395 | $force_reload = true; |
411 | 396 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
412 | 397 | } |
413 | - } |
|
414 | - else |
|
398 | + } else |
|
415 | 399 | { |
416 | 400 | $this->files_template[$row['template_filename']] = $user->theme['template_id']; |
417 | 401 | } |
@@ -421,8 +405,7 @@ discard block |
||
421 | 405 | if ($row['template_filename'] == $this->filename[$handle]) |
422 | 406 | { |
423 | 407 | $compile->_tpl_load_file($handle, true); |
424 | - } |
|
425 | - else |
|
408 | + } else |
|
426 | 409 | { |
427 | 410 | $this->files[$row['template_filename']] = $file; |
428 | 411 | $this->filename[$row['template_filename']] = $row['template_filename']; |
@@ -437,8 +420,7 @@ discard block |
||
437 | 420 | { |
438 | 421 | $this->compiled_code[$handle] = $compile->compile(trim($row['template_data'])); |
439 | 422 | $compile->compile_write($handle, $this->compiled_code[$handle]); |
440 | - } |
|
441 | - else |
|
423 | + } else |
|
442 | 424 | { |
443 | 425 | // Only bother compiling if it doesn't already exist |
444 | 426 | if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX)) |
@@ -449,8 +431,7 @@ discard block |
||
449 | 431 | } |
450 | 432 | } |
451 | 433 | } |
452 | - } |
|
453 | - else |
|
434 | + } else |
|
454 | 435 | { |
455 | 436 | $file = $this->root . '/' . $row['template_filename']; |
456 | 437 | |
@@ -477,8 +458,7 @@ discard block |
||
477 | 458 | * Assign key variable pairs from an array |
478 | 459 | * @access public |
479 | 460 | */ |
480 | - function assign_vars($vararray) |
|
481 | - { |
|
461 | + function assign_vars($vararray) { |
|
482 | 462 | foreach ($vararray as $key => $val) |
483 | 463 | { |
484 | 464 | $this->_rootref[$key] = $val; |
@@ -491,8 +471,7 @@ discard block |
||
491 | 471 | * Assign a single variable to a single key |
492 | 472 | * @access public |
493 | 473 | */ |
494 | - function assign_var($varname, $varval) |
|
495 | - { |
|
474 | + function assign_var($varname, $varval) { |
|
496 | 475 | $this->_rootref[$varname] = $varval; |
497 | 476 | |
498 | 477 | return true; |
@@ -502,8 +481,7 @@ discard block |
||
502 | 481 | * Assign key variable pairs from an array to a specified block |
503 | 482 | * @access public |
504 | 483 | */ |
505 | - function assign_block_vars($blockname, $vararray) |
|
506 | - { |
|
484 | + function assign_block_vars($blockname, $vararray) { |
|
507 | 485 | if (strpos($blockname, '.') !== false) |
508 | 486 | { |
509 | 487 | // Nested block. |
@@ -538,8 +516,7 @@ discard block |
||
538 | 516 | // We're adding a new iteration to this block with the given |
539 | 517 | // variable assignments. |
540 | 518 | $str[$blocks[$blockcount]][] = $vararray; |
541 | - } |
|
542 | - else |
|
519 | + } else |
|
543 | 520 | { |
544 | 521 | // Top-level block. |
545 | 522 | $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; |
@@ -593,8 +570,7 @@ discard block |
||
593 | 570 | * @return bool false on error, true on success |
594 | 571 | * @access public |
595 | 572 | */ |
596 | - function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') |
|
597 | - { |
|
573 | + function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') { |
|
598 | 574 | if (strpos($blockname, '.') !== false) |
599 | 575 | { |
600 | 576 | // Nested blocks are not supported |
@@ -639,8 +615,7 @@ discard block |
||
639 | 615 | $key = sizeof($this->_tpldata[$blockname]); |
640 | 616 | unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); |
641 | 617 | $vararray['S_LAST_ROW'] = true; |
642 | - } |
|
643 | - else if ($key === 0) |
|
618 | + } else if ($key === 0) |
|
644 | 619 | { |
645 | 620 | unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); |
646 | 621 | $vararray['S_FIRST_ROW'] = true; |
@@ -679,8 +654,7 @@ discard block |
||
679 | 654 | * Include a separate template |
680 | 655 | * @access private |
681 | 656 | */ |
682 | - function _tpl_include($filename, $include = true) |
|
683 | - { |
|
657 | + function _tpl_include($filename, $include = true) { |
|
684 | 658 | // This is used to access global vars |
685 | 659 | global $lang, $config, $user; |
686 | 660 | |
@@ -710,8 +684,7 @@ discard block |
||
710 | 684 | * Include a php-file |
711 | 685 | * @access private |
712 | 686 | */ |
713 | - function _php_include($filename) |
|
714 | - { |
|
687 | + function _php_include($filename) { |
|
715 | 688 | $file = $this->rootPhysical . $filename; |
716 | 689 | |
717 | 690 | if (!file_exists($file)) |
@@ -727,8 +700,7 @@ discard block |
||
727 | 700 | * Assign key variable pairs from an array with block support |
728 | 701 | * @access public |
729 | 702 | */ |
730 | - function assign_recursive($values, $name = '') |
|
731 | - { |
|
703 | + function assign_recursive($values, $name = '') { |
|
732 | 704 | if(isset($values['.'])) |
733 | 705 | { |
734 | 706 | $values_extra = $values['.']; |
@@ -738,8 +710,7 @@ discard block |
||
738 | 710 | if(!$name) |
739 | 711 | { |
740 | 712 | $this->assign_vars($values); |
741 | - } |
|
742 | - else |
|
713 | + } else |
|
743 | 714 | { |
744 | 715 | $this->assign_block_vars($name, $values); |
745 | 716 | } |
@@ -30,8 +30,7 @@ |
||
30 | 30 | * @param $resource_id |
31 | 31 | * @param ResourceCalculations $capsObj |
32 | 32 | */ |
33 | -function int_calc_storage_bar($resource_id, $capsObj) |
|
34 | -{ |
|
33 | +function int_calc_storage_bar($resource_id, $capsObj) { |
|
35 | 34 | global $lang, $template, $planetrow, $user; |
36 | 35 | |
37 | 36 | $totalProduction = $capsObj->getProduction($resource_id); |