Passed
Branch trunk (7dc288)
by SuperNova.WS
06:07
created
includes/pages/chat.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
classes/phpbb_hook.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
admin/includes/admin_planet_edit.inc.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
   }
Please login to merge, or discard this patch.
includes/includes/art_artifact.php 1 patch
Braces   +9 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function art_use(&$user, &$planetrow, $unit_id)
4
-{
3
+function art_use(&$user, &$planetrow, $unit_id) {
5 4
   global $lang;
6 5
 
7 6
   if(!in_array($unit_id, sn_get_groups('artifacts')))
@@ -34,14 +33,12 @@  discard block
 block discarded – undo
34 33
           {
35 34
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
36 35
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moon_chance));
37
-          }
38
-          else
36
+          } else
39 37
           {
40 38
             $message = $lang['art_lhc_moon_fail'];
41 39
           }
42 40
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message);
43
-        }
44
-        else
41
+        } else
45 42
         {
46 43
           $message = $lang['art_moon_exists'];
47 44
         }
@@ -69,8 +66,9 @@  discard block
 block discarded – undo
69 66
         $sectors_used = 0;
70 67
         foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
71 68
         {
72
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
73
-            continue;
69
+          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
70
+                      continue;
71
+          }
74 72
           $sectors_used += $levels_deployed;
75 73
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
76 74
         }
@@ -104,8 +102,7 @@  discard block
 block discarded – undo
104 102
           DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']);
105 103
           $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left']));
106 104
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message);
107
-        }
108
-        else
105
+        } else
109 106
         {
110 107
           $message = $lang['art_heurestic_chip_no_research'];
111 108
         }
@@ -133,8 +130,7 @@  discard block
 block discarded – undo
133 130
             $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left'])
134 131
           );
135 132
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message);
136
-        }
137
-        else
133
+        } else
138 134
         {
139 135
           $message = $lang['art_nano_builder_no_que'];
140 136
         }
@@ -146,8 +142,7 @@  discard block
 block discarded – undo
146 142
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user);
147 143
       OldDbChangeSet::db_changeset_apply($db_changeset);
148 144
     }
149
-  }
150
-  else
145
+  } else
151 146
   {
152 147
     $message = $lang['art_err_no_artifact'];
153 148
   }
Please login to merge, or discard this patch.
includes/functions/tpl_helpers.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Compare function to sort fleet in time order
4
-function tpl_assign_fleet_compare($a, $b)
5
-{
4
+function tpl_assign_fleet_compare($a, $b) {
6 5
   if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET'])
7 6
   {
8 7
     if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT'])
@@ -10,15 +9,13 @@  discard block
 block discarded – undo
10 9
       return 0;
11 10
     }
12 11
     return ($a['fleet']['OV_LEFT'] < $b['fleet']['OV_LEFT']) ? -1 : 1;
13
-  }
14
-  else
12
+  } else
15 13
   {
16 14
     return $a['fleet']['OV_THIS_PLANET'] ? -1 : 1;
17 15
   }
18 16
 }
19 17
 
20
-function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets')
21
-{
18
+function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') {
22 19
   if(!$fleets)
23 20
   {
24 21
     return;
@@ -41,8 +38,7 @@  discard block
 block discarded – undo
41 38
 }
42 39
 
43 40
 // function that parses internal fleet representation (as array(id => count))
44
-function tpl_parse_fleet_sn($fleet, $fleet_id)
45
-{
41
+function tpl_parse_fleet_sn($fleet, $fleet_id) {
46 42
   global $lang, $user;
47 43
 
48 44
   $user_data = &$user;
@@ -182,8 +178,7 @@  discard block
 block discarded – undo
182 178
   return $result;
183 179
 }
184 180
 
185
-function tpl_parse_planet_que($que, $planet, $que_id)
186
-{
181
+function tpl_parse_planet_que($que, $planet, $que_id) {
187 182
   $hangar_que = array();
188 183
   $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']];
189 184
   if(!empty($que_hangar))
@@ -198,8 +193,7 @@  discard block
 block discarded – undo
198 193
   return $hangar_que;
199 194
 }
200 195
 
201
-function tpl_parse_planet($planet, &$fleets)
202
-{
196
+function tpl_parse_planet($planet, &$fleets) {
203 197
   global $lang;
204 198
 
205 199
   $que = que_get($planet['id_owner'], $planet['id'], false);
@@ -268,8 +262,7 @@  discard block
 block discarded – undo
268 262
   return $result;
269 263
 }
270 264
 
271
-function flt_get_fleets_to_planet($planet, $fleet_db_list = 0)
272
-{
265
+function flt_get_fleets_to_planet($planet, $fleet_db_list = 0) {
273 266
   if(!($planet && $planet['id']) && !$fleet_db_list)
274 267
   {
275 268
     return $planet;
@@ -291,8 +284,7 @@  discard block
 block discarded – undo
291 284
         continue;
292 285
       }
293 286
       $fleet_ownage = 'own';
294
-    }
295
-    else
287
+    } else
296 288
     {
297 289
       switch($fleet['fleet_mission'])
298 290
       {
@@ -340,8 +332,7 @@  discard block
 block discarded – undo
340 332
  * @param array    $planetrow
341 333
  * @param array    $fleets_to_planet
342 334
  */
343
-function tpl_set_resource_info(&$template, $planetrow, $fleets_to_planet = array())
344
-{
335
+function tpl_set_resource_info(&$template, $planetrow, $fleets_to_planet = array()) {
345 336
   $template->assign_vars(array(
346 337
     'RESOURCE_ROUNDING' => 0,
347 338
 
Please login to merge, or discard this patch.
classes/template.php 1 patch
Braces   +29 added lines, -58 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
resources.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
includes/functions/msg_send_simple_message.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
    1.5 - copyright (c) 2010-2011 by Gorlum for http://supernova.ws
16 16
          [+] SuperMassMailing - authlevel=3 player can send messages to whole server ('*' as $owners)
17 17
  */
18
-function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0)
19
-{
18
+function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) {
20 19
   global $user;
21 20
 
22 21
   $ally_id = $ally_id ? $ally_id : $user['ally_id'];
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
  * @param bool $force
50 49
  * @param bool $json
51 50
  */
52
-function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false)
53
-{
51
+function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) {
54 52
   global $config, $user, $sn_message_class_list;
55 53
 
56 54
   if(!$owners)
@@ -91,8 +89,7 @@  discard block
 block discarded – undo
91 89
     // TODO Добавить $sender - рассылка может быть и от кого-то
92 90
     db_message_insert_all($message_type, $from, $subject, $text);
93 91
     $owners = [];
94
-  }
95
-  else
92
+  } else
96 93
   {
97 94
     $insert_values = [];
98 95
     $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}', '" . intval($json) . "')");
@@ -102,8 +99,7 @@  discard block
 block discarded – undo
102 99
       if($user['id'] != $owner)
103 100
       {
104 101
         $owner_row = db_user_by_id($owner);
105
-      }
106
-      else
102
+      } else
107 103
       {
108 104
         $owner_row = $user;
109 105
       }
Please login to merge, or discard this patch.
classes/classSupernova.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -419,7 +419,8 @@  discard block
 block discarded – undo
419 419
     $location_info = &static::$location_info[$location_type];
420 420
     $id_field = $location_info[P_ID];
421 421
     $table_name = $location_info[P_TABLE_NAME];
422
-    if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ?
422
+    if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) {
423
+      // TODO Как-то вернуть может быть LIMIT 1 ?
423 424
     {
424 425
       if (static::$db->db_affected_rows()) {
425 426
         // Обновляем данные только если ряд был затронут
@@ -427,6 +428,7 @@  discard block
 block discarded – undo
427 428
 
428 429
         // Тут именно так, а не cache_unset - что бы в кэшах автоматически обновилась запись. Будет нужно на будущее
429 430
         _SnCacheInternal::$data[$location_type][$record_id] = null;
431
+    }
430 432
         // Вытаскиваем обновленную запись
431 433
         static::db_get_record_by_id($location_type, $record_id);
432 434
         _SnCacheInternal::cache_clear($location_type, false); // Мягкий сброс - только $queries
@@ -460,9 +462,11 @@  discard block
 block discarded – undo
460 462
     $set = trim($set);
461 463
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
462 464
     if ($result = static::db_query_insert("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
463
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
465
+      if (static::$db->db_affected_rows()) {
466
+        // Обновляем данные только если ряд был затронут
464 467
       {
465 468
         $record_id = db_insert_id();
469
+      }
466 470
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
467 471
         $result = static::db_get_record_by_id($location_type, $record_id);
468 472
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
@@ -483,10 +487,12 @@  discard block
 block discarded – undo
483 487
     $id_field = $location_info[P_ID];
484 488
     $table_name = $location_info[P_TABLE_NAME];
485 489
     if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}")) {
486
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
490
+      if (static::$db->db_affected_rows()) {
491
+        // Обновляем данные только если ряд был затронут
487 492
       {
488 493
         _SnCacheInternal::cache_unset($location_type, $safe_record_id);
489 494
       }
495
+      }
490 496
     }
491 497
 
492 498
     return $result;
@@ -500,11 +506,13 @@  discard block
 block discarded – undo
500 506
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
501 507
 
502 508
     if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE {$condition}")) {
503
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
509
+      if (static::$db->db_affected_rows()) {
510
+        // Обновляем данные только если ряд был затронут
504 511
       {
505 512
         // Обнуление кэша, потому что непонятно, что поменялось
506 513
         _SnCacheInternal::cache_clear($location_type);
507 514
       }
515
+      }
508 516
     }
509 517
 
510 518
     return $result;
Please login to merge, or discard this patch.