Completed
Push — work-fleets ( 1c4183...d64c53 )
by SuperNova.WS
05:36
created
docs/txt2html.php 2 patches
Braces   +22 added lines, -26 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 function dump($value,$varname = "",$level=0,$dumper = "")
4 4
 {
5
-  if ($varname) $varname .= " = ";
5
+  if ($varname) {
6
+    $varname .= " = ";
7
+  }
6 8
 
7 9
   if ($level==-1)
8 10
   {
@@ -13,7 +15,9 @@  discard block
 block discarded – undo
13 15
     $trans["\0"]='⊕';
14 16
     return strtr(htmlspecialchars($value),$trans);
15 17
   }
16
-  if ($level==0) $dumper = '<pre>' . $varname;
18
+  if ($level==0) {
19
+    $dumper = '<pre>' . $varname;
20
+  }
17 21
 
18 22
   $type = gettype($value);
19 23
   $dumper .= $type;
@@ -22,9 +26,9 @@  discard block
 block discarded – undo
22 26
   {
23 27
     $dumper .= '('.strlen($value).')';
24 28
     $value = dump($value,"",-1);
25
-  }
26
-  elseif ($type=='boolean') $value= ($value?'true':'false');
27
-  elseif ($type=='object')
29
+  } elseif ($type=='boolean') {
30
+    $value= ($value?'true':'false');
31
+  } elseif ($type=='object')
28 32
   {
29 33
     $props= get_class_vars(get_class($value));
30 34
     $dumper .= '('.count($props).') <u>'.get_class($value).'</u>';
@@ -34,8 +38,7 @@  discard block
 block discarded – undo
34 38
       $dumper .= dump($value->$key,"",$level+1);
35 39
     }
36 40
     $value= '';
37
-  }
38
-  elseif ($type=='array')
41
+  } elseif ($type=='array')
39 42
   {
40 43
     $dumper .= '('.count($value).')';
41 44
     foreach($value as $key=>$val)
@@ -46,7 +49,9 @@  discard block
 block discarded – undo
46 49
     $value= '';
47 50
   }
48 51
   $dumper .= " <b>$value</b>";
49
-  if ($level==0) $dumper .= '</pre>';
52
+  if ($level==0) {
53
+    $dumper .= '</pre>';
54
+  }
50 55
   return $dumper;
51 56
 }
52 57
 
@@ -70,8 +75,7 @@  discard block
 block discarded – undo
70 75
 if(substr(getcwd(), -4) != 'docs')
71 76
 {
72 77
   $path_prefix = 'docs/';
73
-}
74
-else
78
+} else
75 79
 {
76 80
   $path_prefix = '';
77 81
 }
@@ -119,8 +123,7 @@  discard block
 block discarded – undo
119 123
       $buffer['name'] = $chapter[0];
120 124
     }
121 125
     $prev_chapter_is_header = true;
122
-  }
123
-  else
126
+  } else
124 127
   {
125 128
     $prev_chapter_is_header = false;
126 129
     foreach($chapter as &$note)
@@ -150,8 +153,7 @@  discard block
 block discarded – undo
150 153
           if(!isset($note_out['name']))
151 154
           {
152 155
             $note_out['name'] = $buf_str;
153
-          }
154
-          else
156
+          } else
155 157
           {
156 158
             $note_out['lines'][] = $buf_str;
157 159
           }
@@ -228,36 +230,31 @@  discard block
 block discarded – undo
228 230
             if($matches[2])
229 231
             {
230 232
               buf_print("<ol>\r\n");
231
-            }
232
-            else
233
+            } else
233 234
             {
234 235
               buf_print("<ul>\r\n");
235 236
             }
236 237
             buf_print('<li>');
237 238
             $last_spaces = $matches[1];
238 239
             $depth[] = $matches[2];
239
-          }
240
-          elseif(strlen($matches[1]) < strlen($last_spaces) && count($depth))
240
+          } elseif(strlen($matches[1]) < strlen($last_spaces) && count($depth))
241 241
           {
242 242
             if(array_pop($depth))
243 243
             {
244 244
               buf_print("</ol>\r\n");
245
-            }
246
-            else
245
+            } else
247 246
             {
248 247
               buf_print("</ul>\r\n");
249 248
             }
250 249
             $last_spaces = $matches[1];
251 250
             buf_print('<li>');
252
-          }
253
-          elseif(strlen($last_spaces) == strlen($matches[1]))
251
+          } elseif(strlen($last_spaces) == strlen($matches[1]))
254 252
           {
255 253
             if($matches[2] == '' && $depth[count($depth) - 1] != '')
256 254
             {
257 255
               buf_print("</ol>\r\n");
258 256
               buf_print("<ul>\r\n");
259
-            }
260
-            elseif($matches[2] != '' && $depth[count($depth) - 1] == '')
257
+            } elseif($matches[2] != '' && $depth[count($depth) - 1] == '')
261 258
             {
262 259
               buf_print("</ul>\r\n");
263 260
               buf_print("<ol>\r\n");
@@ -274,8 +271,7 @@  discard block
 block discarded – undo
274 271
         if(array_pop($depth))
275 272
         {
276 273
           buf_print("</ol>\r\n");
277
-        }
278
-        else
274
+        } else
279 275
         {
280 276
           buf_print("</ul>\r\n");
281 277
         }
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,58 +1,58 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function dump($value,$varname = "",$level=0,$dumper = "")
3
+function dump($value, $varname = "", $level = 0, $dumper = "")
4 4
 {
5 5
   if ($varname) $varname .= " = ";
6 6
 
7
-  if ($level==-1)
7
+  if ($level == -1)
8 8
   {
9
-    $trans[' ']='&there4;';
10
-    $trans["\t"]='&rArr;';
11
-    $trans["\n"]='&para;;';
12
-    $trans["\r"]='&lArr;';
13
-    $trans["\0"]='&oplus;';
14
-    return strtr(htmlspecialchars($value),$trans);
9
+    $trans[' '] = '&there4;';
10
+    $trans["\t"] = '&rArr;';
11
+    $trans["\n"] = '&para;;';
12
+    $trans["\r"] = '&lArr;';
13
+    $trans["\0"] = '&oplus;';
14
+    return strtr(htmlspecialchars($value), $trans);
15 15
   }
16
-  if ($level==0) $dumper = '<pre>' . $varname;
16
+  if ($level == 0) $dumper = '<pre>'.$varname;
17 17
 
18 18
   $type = gettype($value);
19 19
   $dumper .= $type;
20 20
 
21
-  if ($type=='string')
21
+  if ($type == 'string')
22 22
   {
23 23
     $dumper .= '('.strlen($value).')';
24
-    $value = dump($value,"",-1);
24
+    $value = dump($value, "", -1);
25 25
   }
26
-  elseif ($type=='boolean') $value= ($value?'true':'false');
27
-  elseif ($type=='object')
26
+  elseif ($type == 'boolean') $value = ($value ? 'true' : 'false');
27
+  elseif ($type == 'object')
28 28
   {
29
-    $props= get_class_vars(get_class($value));
29
+    $props = get_class_vars(get_class($value));
30 30
     $dumper .= '('.count($props).') <u>'.get_class($value).'</u>';
31
-    foreach($props as $key=>$val)
31
+    foreach ($props as $key=>$val)
32 32
     {
33
-      $dumper .= "\n".str_repeat("\t",$level+1).$key.' => ';
34
-      $dumper .= dump($value->$key,"",$level+1);
33
+      $dumper .= "\n".str_repeat("\t", $level + 1).$key.' => ';
34
+      $dumper .= dump($value->$key, "", $level + 1);
35 35
     }
36
-    $value= '';
36
+    $value = '';
37 37
   }
38
-  elseif ($type=='array')
38
+  elseif ($type == 'array')
39 39
   {
40 40
     $dumper .= '('.count($value).')';
41
-    foreach($value as $key=>$val)
41
+    foreach ($value as $key=>$val)
42 42
     {
43
-      $dumper .= "\n".str_repeat("\t",$level+1).dump($key,"",-1).' => ';
44
-      $dumper .= dump($val,"",$level+1);
43
+      $dumper .= "\n".str_repeat("\t", $level + 1).dump($key, "", -1).' => ';
44
+      $dumper .= dump($val, "", $level + 1);
45 45
     }
46
-    $value= '';
46
+    $value = '';
47 47
   }
48 48
   $dumper .= " <b>$value</b>";
49
-  if ($level==0) $dumper .= '</pre>';
49
+  if ($level == 0) $dumper .= '</pre>';
50 50
   return $dumper;
51 51
 }
52 52
 
53 53
 function pdump($value, $varname = '')
54 54
 {
55
-  print('<span style="text-align: left">' . dump($value, $varname) . '</span>');
55
+  print('<span style="text-align: left">'.dump($value, $varname).'</span>');
56 56
 }
57 57
 
58 58
 function debug($value, $varname = '')
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
   $output_buffer .= $string;
68 68
 }
69 69
 
70
-if(substr(getcwd(), -4) != 'docs')
70
+if (substr(getcwd(), -4) != 'docs')
71 71
 {
72 72
   $path_prefix = 'docs/';
73 73
 }
@@ -80,22 +80,22 @@  discard block
 block discarded – undo
80 80
 
81 81
 $filename = 'changelog';
82 82
 
83
-$input =  file_get_contents($path_prefix . $filename . '.txt');
83
+$input = file_get_contents($path_prefix.$filename.'.txt');
84 84
 //$input = iconv('CP1251', 'UTF-8', $input);
85 85
 
86 86
 $input = preg_replace("/\r\n\d\d\d\d\-\d\d\-\d\d\ \d\d\:\d\d/", "[D] $0", $input);
87 87
 
88
-while(strpos($input, "\r\n\r\n") !== false)
88
+while (strpos($input, "\r\n\r\n") !== false)
89 89
 {
90 90
   $input = str_replace("\r\n\r\n", "\r\n", $input);
91 91
 }
92
-while(strpos($input, "~~~") !== false)
92
+while (strpos($input, "~~~") !== false)
93 93
 {
94 94
   $input = str_replace("~~~", "~~", $input);
95 95
 }
96 96
 $input = str_replace("\r\n~~", "~~", $input);
97 97
 
98
-while(strpos($input, "===") !== false)
98
+while (strpos($input, "===") !== false)
99 99
 {
100 100
   $input = str_replace("===", "==", $input);
101 101
 }
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 $prev_chapter_is_header = false;
107 107
 $output = array();
108 108
 $buffer = array();
109
-foreach($input as &$chapter)
109
+foreach ($input as &$chapter)
110 110
 {
111 111
   $chapter = preg_split("/(\r\n[\[])/", $chapter, -1, PREG_SPLIT_NO_EMPTY); // , PREG_SPLIT_DELIM_CAPTURE
112 112
 
113
-  if(count($chapter) == 1 && !$prev_chapter_is_header)
113
+  if (count($chapter) == 1 && !$prev_chapter_is_header)
114 114
   {
115
-    if(!empty($chapter))
115
+    if (!empty($chapter))
116 116
     {
117 117
       $output[] = $buffer;
118 118
       $buffer = array();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
   else
124 124
   {
125 125
     $prev_chapter_is_header = false;
126
-    foreach($chapter as &$note)
126
+    foreach ($chapter as &$note)
127 127
     {
128 128
       $note = explode("\r\n", $note);
129 129
       $new_note = true;
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 
132 132
       $note_out = array();
133 133
 
134
-      foreach($note as &$line)
134
+      foreach ($note as &$line)
135 135
       {
136
-        if(!$line)
136
+        if (!$line)
137 137
         {
138 138
           continue;
139 139
         }
140
-        if($new_note)
140
+        if ($new_note)
141 141
         {
142 142
           // 78 - 3 = 75
143 143
           $note_out['style'] = $line[0];
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
         }
146 146
 
147 147
         $buf_str .= $line;
148
-        if(mb_strlen($line, 'utf-8') < ($new_note ? 75 : 79))
148
+        if (mb_strlen($line, 'utf-8') < ($new_note ? 75 : 79))
149 149
         {
150
-          if(!isset($note_out['name']))
150
+          if (!isset($note_out['name']))
151 151
           {
152 152
             $note_out['name'] = $buf_str;
153 153
           }
@@ -201,31 +201,31 @@  discard block
 block discarded – undo
201 201
   'D' => 'date',
202 202
 );
203 203
 
204
-foreach($output as $chapter)
204
+foreach ($output as $chapter)
205 205
 {
206
-  if(!$chapter)
206
+  if (!$chapter)
207 207
   {
208 208
     continue;
209 209
   }
210 210
 
211 211
   buf_print("<h1>{$chapter['name']}</h1>\r\n");
212
-  foreach($chapter['content'] as $block)
212
+  foreach ($chapter['content'] as $block)
213 213
   {
214
-    buf_print("<div class=\"{$styles[$block['style']]}\">" . ($block['style'] != 'D' ? "[{$block['style']}]&nbsp;" : ''));
215
-    buf_print(preg_replace("/\s{2,10}/", " ", $block['name']) . '<br />');
216
-    if(isset($block['lines']))
214
+    buf_print("<div class=\"{$styles[$block['style']]}\">".($block['style'] != 'D' ? "[{$block['style']}]&nbsp;" : ''));
215
+    buf_print(preg_replace("/\s{2,10}/", " ", $block['name']).'<br />');
216
+    if (isset($block['lines']))
217 217
     {
218 218
       $last_spaces = '';
219 219
       $depth = array();
220
-      foreach($block['lines'] as $line)
220
+      foreach ($block['lines'] as $line)
221 221
       {
222
-        if(preg_match("/^(\s+)(\d*|\s)\.*\s*(.*)/", $line, $matches))
222
+        if (preg_match("/^(\s+)(\d*|\s)\.*\s*(.*)/", $line, $matches))
223 223
         {
224 224
           //$line = strlen($matches[1]) . '/' . $matches[2] . '/' . $matches[3];
225 225
           $line = $matches[3];
226
-          if(strlen($matches[1]) > strlen($last_spaces))
226
+          if (strlen($matches[1]) > strlen($last_spaces))
227 227
           {
228
-            if($matches[2])
228
+            if ($matches[2])
229 229
             {
230 230
               buf_print("<ol>\r\n");
231 231
             }
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
             $last_spaces = $matches[1];
238 238
             $depth[] = $matches[2];
239 239
           }
240
-          elseif(strlen($matches[1]) < strlen($last_spaces) && count($depth))
240
+          elseif (strlen($matches[1]) < strlen($last_spaces) && count($depth))
241 241
           {
242
-            if(array_pop($depth))
242
+            if (array_pop($depth))
243 243
             {
244 244
               buf_print("</ol>\r\n");
245 245
             }
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
             $last_spaces = $matches[1];
251 251
             buf_print('<li>');
252 252
           }
253
-          elseif(strlen($last_spaces) == strlen($matches[1]))
253
+          elseif (strlen($last_spaces) == strlen($matches[1]))
254 254
           {
255
-            if($matches[2] == '' && $depth[count($depth) - 1] != '')
255
+            if ($matches[2] == '' && $depth[count($depth) - 1] != '')
256 256
             {
257 257
               buf_print("</ol>\r\n");
258 258
               buf_print("<ul>\r\n");
259 259
             }
260
-            elseif($matches[2] != '' && $depth[count($depth) - 1] == '')
260
+            elseif ($matches[2] != '' && $depth[count($depth) - 1] == '')
261 261
             {
262 262
               buf_print("</ul>\r\n");
263 263
               buf_print("<ol>\r\n");
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
           }
268 268
         }
269 269
         $line = preg_replace("/\s{2,10}/", " ", $line);
270
-        buf_print($line . "<br />\r\n");
270
+        buf_print($line."<br />\r\n");
271 271
       }
272
-      while(count($depth))
272
+      while (count($depth))
273 273
       {
274
-        if(array_pop($depth))
274
+        if (array_pop($depth))
275 275
         {
276 276
           buf_print("</ol>\r\n");
277 277
         }
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 }
287 287
 buf_print("</body>\r\n</html>\r\n");
288 288
 
289
-$html = file_get_contents($path_prefix . 'html/' . $filename . '.html');
290
-if($html != $output_buffer)
289
+$html = file_get_contents($path_prefix.'html/'.$filename.'.html');
290
+if ($html != $output_buffer)
291 291
 {
292
-  file_put_contents($path_prefix . 'html/' . $filename . '.html', $output_buffer);
293
-  if(!$path_prefix)
292
+  file_put_contents($path_prefix.'html/'.$filename.'.html', $output_buffer);
293
+  if (!$path_prefix)
294 294
   {
295 295
     print($output_buffer);
296 296
   }
Please login to merge, or discard this patch.
scheduler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@
 block discarded – undo
24 24
 
25 25
 // require_once('includes/includes/scheduler_process.php');
26 26
 
27
-if(($result = scheduler_process()) && !defined('IN_ADMIN')) {
27
+if (($result = scheduler_process()) && !defined('IN_ADMIN')) {
28 28
   $result = htmlspecialchars($result, ENT_QUOTES, 'UTF-8');
29 29
   print(json_encode($result));
30 30
 }
31 31
 
32
-if(!defined('IN_ADMIN')) {
32
+if (!defined('IN_ADMIN')) {
33 33
   die();
34 34
 }
Please login to merge, or discard this patch.
includes/alliance/ali_external_request.inc 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     header('Location: alliance.php');
21 21
   }
22 22
 
23
-  if($user_request['request_denied'])
23
+  if ($user_request['request_denied'])
24 24
   {
25 25
     $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']);
26 26
   }
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true);
44 44
 
45
-if(!$ally)
45
+if (!$ally)
46 46
 {
47 47
   message($lang['ali_sys_notFound'], $lang['ali_req_title']);
48 48
 }
49 49
 
50
-if($ally['ally_request_notallow'])
50
+if ($ally['ally_request_notallow'])
51 51
 {
52 52
   message($lang['ali_req_not_allowed'], $lang['ali_req_title']);
53 53
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
     ));
116 116
 
117 117
     display($template, $lang['tech'][STRUC_MOON_GATE]);
118
-  }
119
-  else
118
+  } else
120 119
   {
121 120
     message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
Please login to merge, or discard this patch.
includes/includes/uni_rename.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
       sn_db_transaction_commit();
47 47
       sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}");
48 48
     }
49
-  }
50
-  catch (exception $e)
49
+  } catch (exception $e)
51 50
   {
52 51
     sn_db_transaction_rollback();
53 52
     $template->assign_block_vars('result', array(
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
     $uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']);
12 12
     $uni_system = sys_get_param_int('system');
13 13
 
14
-    if($uni_galaxy < 1 || $uni_galaxy > Vector::$knownGalaxies)
14
+    if ($uni_galaxy < 1 || $uni_galaxy > Vector::$knownGalaxies)
15 15
     {
16 16
       throw new exception(classLocale::$lang['uni_msg_error_wrong_galaxy'], ERR_ERROR);
17 17
     }
18 18
 
19
-    if($uni_system < 0 || $uni_system > Vector::$knownSystems)
19
+    if ($uni_system < 0 || $uni_system > Vector::$knownSystems)
20 20
     {
21 21
       throw new exception(classLocale::$lang['uni_msg_error_wrong_system'], ERR_ERROR);
22 22
     }
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
     $uni_row['universe_price'] += $uni_system ? classSupernova::$config->uni_price_system : classSupernova::$config->uni_price_galaxy;
26 26
     $uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$classLocale['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$classLocale['sys_galaxy']} {$uni_galaxy}"));
27 27
 
28
-    if(sys_get_param_str('uni_name_submit'))
28
+    if (sys_get_param_str('uni_name_submit'))
29 29
     {
30 30
       $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name'));
31 31
 
32 32
       $uni_price = sys_get_param_float('uni_price');
33
-      if($uni_price < $uni_row['universe_price'])
33
+      if ($uni_price < $uni_row['universe_price'])
34 34
       {
35 35
         throw new exception(classLocale::$lang['uni_msg_error_low_price'], ERR_ERROR);
36 36
       }
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
       sn_db_transaction_start();
40 40
       $user = db_user_by_id($user['id'], true);
41 41
       // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price)
42
-      if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price)
42
+      if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price)
43 43
       {
44 44
         throw new exception(classLocale::$lang['uni_msg_error_no_dm'], ERR_ERROR);
45 45
       }
46 46
 
47
-      if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name')))
47
+      if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to ".sys_get_param_str_unsafe('uni_name')))
48 48
       {
49 49
         throw new exception(classLocale::$lang['sys_msg_err_update_dm'], ERR_ERROR);
50 50
       }
@@ -74,4 +74,4 @@  discard block
 block discarded – undo
74 74
     'PAGE_HINT'   => classLocale::$lang['uni_name_page_hint'],
75 75
   ));
76 76
 
77
-  display($template, classLocale::$lang['sys_universe'] . ' - ' . classLocale::$lang['uni_naming'], true, '', false);
77
+  display($template, classLocale::$lang['sys_universe'].' - '.classLocale::$lang['uni_naming'], true, '', false);
Please login to merge, or discard this patch.
includes/includes/market_info.inc 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@
 block discarded – undo
79 79
 
80 80
     sn_db_transaction_commit();
81 81
     throw new Exception($info_action, ERR_NONE);
82
-  }
83
-  catch (Exception $e)
82
+  } catch (Exception $e)
84 83
   {
85 84
     sn_db_transaction_rollback();
86 85
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true)
5
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true)
6 6
 {
7 7
   classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
8 8
 }
@@ -17,54 +17,54 @@  discard block
 block discarded – undo
17 17
 ));
18 18
 
19 19
 $info_action = sys_get_param_int('action');
20
-if($info_action)
20
+if ($info_action)
21 21
 {
22 22
   try
23 23
   {
24 24
     sn_db_transaction_start();
25 25
 
26 26
     $user = db_user_by_id($user['id'], true);
27
-    if(mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info)
27
+    if (mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info)
28 28
     {
29 29
       throw new Exception(MARKET_NO_DM, ERR_ERROR);
30 30
     }
31 31
 
32
-    switch($info_action)
32
+    switch ($info_action)
33 33
     {
34 34
       case MARKET_INFO_PLAYER:
35 35
         $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name');
36
-        if(!$user_info_name_unsafe)
36
+        if (!$user_info_name_unsafe)
37 37
         {
38 38
           throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR);
39 39
         }
40 40
 
41
-        if(is_id($user_info_name_unsafe))
41
+        if (is_id($user_info_name_unsafe))
42 42
         {
43 43
           $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true);
44 44
         }
45
-        if(!is_array($user_info))
45
+        if (!is_array($user_info))
46 46
         {
47 47
           $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true);
48 48
         }
49
-        if(!is_array($user_info))
49
+        if (!is_array($user_info))
50 50
         {
51 51
           throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR);
52 52
         }
53
-        if($user_info['id'] == $user['id'])
53
+        if ($user_info['id'] == $user['id'])
54 54
         {
55 55
           throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR);
56 56
         }
57 57
 
58 58
         $msg_text = array();
59
-        foreach(sn_get_groups('mercenaries') as $mercenary_id)
59
+        foreach (sn_get_groups('mercenaries') as $mercenary_id)
60 60
         {
61
-          $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, null, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']);
61
+          $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - ".(($mercenary_level = mrc_get_level($user_info, null, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']);
62 62
         }
63
-        if($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM))
63
+        if ($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM))
64 64
         {
65 65
           $msg_text[] = "{$classLocale['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$classLocale['sys_level']}";
66 66
         }
67
-        $msg_text = sprintf(classLocale::$lang['eco_mrk_info_player_message'], $user_info['id'], $user_info['username']) . "\r\n" . implode("\r\n", $msg_text);
67
+        $msg_text = sprintf(classLocale::$lang['eco_mrk_info_player_message'], $user_info['id'], $user_info['username'])."\r\n".implode("\r\n", $msg_text);
68 68
 
69 69
         msg_send_simple_message($user['id'], 0, SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['eco_mrk_info_msg_from'], "{$classLocale['eco_mrk_info_player']} ID {$user_info['id']} [{$user_info['username']}]", $msg_text, false, true);
70 70
       break;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
       break;
75 75
     }
76 76
 
77
-    if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}"))
77
+    if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}"))
78 78
     {
79 79
       // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR);
80 80
     }
Please login to merge, or discard this patch.
includes/includes/market_trader.inc 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
3
+if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
4 4
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
   // $dm_db_name = pname_resource_name(RES_DARK_MATTER);
29 29
   $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0;
30
-  if($exchangeTo && is_array($tradeList = $_POST['spend'])) {
30
+  if ($exchangeTo && is_array($tradeList = $_POST['spend'])) {
31 31
     $value = 0;
32 32
     $qry = array();
33 33
 
34 34
     sn_db_transaction_start();
35
-    if($planetrow['id_owner']) {
35
+    if ($planetrow['id_owner']) {
36 36
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
37 37
       $planetrow = $global_data['planet'];
38 38
     }
@@ -41,27 +41,27 @@  discard block
 block discarded – undo
41 41
       $user = db_user_by_id($user['id'], true);
42 42
     }
43 43
 
44
-    foreach(sn_get_groups('resources_trader') as $resource_id) {
44
+    foreach (sn_get_groups('resources_trader') as $resource_id) {
45 45
       $amount = floatval($tradeList[$resource_id]);
46
-      if($amount < 0) {
46
+      if ($amount < 0) {
47 47
         $debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305);
48 48
       }
49 49
 
50
-      if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
50
+      if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
51 51
         continue;
52 52
       }
53 53
 
54 54
       $resource_db_name = pname_resource_name($resource_id);
55
-      if($exchangeTo == RES_DARK_MATTER) {
55
+      if ($exchangeTo == RES_DARK_MATTER) {
56 56
         $sign = '+';
57 57
         $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]);
58 58
         $value += $amount;
59 59
       } else {
60 60
         $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]);
61
-        if($resource_id == RES_DARK_MATTER) {
61
+        if ($resource_id == RES_DARK_MATTER) {
62 62
           $amount = 0;
63 63
         } else {
64
-          if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
64
+          if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
65 65
             $intError = MARKET_NO_RESOURCES;
66 66
             break;
67 67
           }
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
         }
71 71
       }
72 72
 
73
-      if($amount) {
73
+      if ($amount) {
74 74
         $qry[] = "`{$resource_db_name}` = `{$resource_db_name}` {$sign} {$amount}";
75 75
       }
76 76
     }
77 77
 
78
-    if($exchangeTo != RES_DARK_MATTER) {
78
+    if ($exchangeTo != RES_DARK_MATTER) {
79 79
       $amount = floor($value);
80 80
       $exchange_to_db_name = pname_resource_name($exchangeTo);
81 81
       $qry[] = "`{$exchange_to_db_name}` = `{$exchange_to_db_name}` + {$amount}";
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError;
87 87
     $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError;
88 88
 
89
-    if($intError == MARKET_DEAL) {
89
+    if ($intError == MARKET_DEAL) {
90 90
       $qry = implode(', ', $qry);
91 91
       $table = $planetrow['id_owner'] ? 'planets' : 'users';
92 92
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo,
112 112
   ));
113 113
 
114
-  foreach(sn_get_groups('resources_trader') as $resource_id) {
115
-    if($resource_id == RES_DARK_MATTER) {
114
+  foreach (sn_get_groups('resources_trader') as $resource_id) {
115
+    if ($resource_id == RES_DARK_MATTER) {
116 116
       $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - $config->rpg_cost_trader);
117 117
     } else {
118 118
       $amount = floor(mrc_get_level($user, $planetrow, $resource_id));
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
     if($planetrow['id_owner']) {
36 36
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
37 37
       $planetrow = $global_data['planet'];
38
-    }
39
-    else {
38
+    } else {
40 39
       // Locking user record
41 40
       $user = db_user_by_id($user['id'], true);
42 41
     }
Please login to merge, or discard this patch.
includes/classes/core_classes.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
     !is_array($offset) ? $offset = array($offset) : false;
39 39
 
40 40
     $current_leaf = $this->__get(reset($offset));
41
-    while(($leaf_index = next($offset)) !== false) {
42
-      if(!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
41
+    while (($leaf_index = next($offset)) !== false) {
42
+      if (!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
43 43
         unset($current_leaf);
44 44
         break;
45 45
       }
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
     !is_array($offset) ? $offset = array($offset) : false;
66 66
 
67
-    if($this->offsetExists($offset)) {
67
+    if ($this->offsetExists($offset)) {
68 68
       $result = $this->__get(reset($offset));
69
-      while(($leaf_index = next($offset)) !== false) {
69
+      while (($leaf_index = next($offset)) !== false) {
70 70
         $result = $result[$leaf_index];
71 71
       }
72 72
     }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
    */
92 92
   public function offsetSet($offset, $value = null) {
93 93
     // Если нет никакого индекса - значит нечего записывать
94
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
94
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
95 95
       return;
96 96
     }
97 97
 
98 98
     // Если в массиве индекса только один элемент - значит это просто индекс
99
-    if(is_array($offset) && count($offset) == 1) {
99
+    if (is_array($offset) && count($offset) == 1) {
100 100
       // Разворачиваем его в индекс
101 101
       $offset = array(reset($offset) => $value);
102 102
       unset($value);
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
     }
105 105
 
106 106
     // Адресация многомерного массива через массив индексов в $option
107
-    if(is_array($offset) && isset($value)) {
107
+    if (is_array($offset) && isset($value)) {
108 108
       // TODO - а не переделать ли это всё на __isset() ??
109 109
 //pdump($offset, '$offset');
110 110
 //pdump($value, '$value');
111 111
       // Вытаскиваем корневой элемент
112 112
       $root = $this->__get(reset($offset));
113 113
       $current_leaf = &$root;
114
-      while(($leaf_index = next($offset)) !== false) {
114
+      while (($leaf_index = next($offset)) !== false) {
115 115
         !is_array($current_leaf[$leaf_index]) ? $current_leaf[$leaf_index] = array() : false;
116 116
         $current_leaf = &$current_leaf[$leaf_index];
117 117
       }
118 118
 //pdump($current_leaf, '$current_leaf');
119 119
 //pdump($value, '$value');
120
-      if($current_leaf != $value) {
120
+      if ($current_leaf != $value) {
121 121
         $current_leaf = $value;
122 122
 //pdump(reset($offset), 'reset($offset)');
123 123
 //pdump($root, '$root');
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       // Пакетная запись из массива ключ -> значение
129 129
       !is_array($offset) ? $offset = array($offset => $value) : false;
130 130
 
131
-      foreach($offset as $key => $value) {
131
+      foreach ($offset as $key => $value) {
132 132
         $this->__get($key) !== $value ? $this->__set($key, $value) : false;
133 133
       }
134 134
     }
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
    */
150 150
   public function offsetUnset($offset) {
151 151
     // Если нет никакого индекса - значит нечего записывать
152
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
152
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
153 153
       return;
154 154
     }
155 155
 
156 156
     !is_array($offset) ? $offset = array($offset) : false;
157 157
 
158
-    if($this->offsetExists($offset)) {
158
+    if ($this->offsetExists($offset)) {
159 159
 //pdump($offset);
160 160
       // Перематываем массив в конец
161 161
       $key_to_delete = end($offset);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 //pdump($key_to_delete, '$key_to_delete');
164 164
       $parent_offset = $offset;
165 165
       array_pop($parent_offset);
166
-      if(!count($parent_offset)) {
166
+      if (!count($parent_offset)) {
167 167
         // В массиве был один элемент - мы удаляем в корне. Просто удаляем элемент
168 168
         $this->__unset($key_to_delete);
169 169
       } else {
Please login to merge, or discard this patch.
includes/classes/Confirmation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
       // $query = static::$db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' AND `type` = {$confirmation_type_safe} FOR UPDATE", true);
42 42
       // Тип не нужен для проверки - код подтверждения должен быть уникален от слова "совсем"
43 43
       $query = $this->db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE", true);
44
-    } while($query);
44
+    } while ($query);
45 45
 
46 46
     $this->db->doquery(
47 47
       "REPLACE INTO {{confirmations}}
Please login to merge, or discard this patch.
includes/classes/functions_template.php 2 patches
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
66 66
       {
67 67
         return;
68 68
         trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
69
-      }
70
-      else
69
+      } else
71 70
       {
72 71
         $this->template->files[$handle] = $this->template->files_inherit[$handle];
73 72
       }
@@ -225,15 +224,13 @@  discard block
 block discarded – undo
225 224
               $var = substr($temp, 2, -1);
226 225
               //$file = $this->template->_tpldata['DEFINE']['.'][$var];
227 226
               $temp = "\$this->_tpldata['DEFINE']['.']['$var']";
228
-            }
229
-            else
227
+            } else
230 228
             {
231 229
               $var = substr($temp, 1, -1);
232 230
               //$file = $this->template->_rootref[$var];
233 231
               $temp = "\$this->_rootref['$var']";
234 232
             }
235
-          }
236
-          else
233
+          } else
237 234
           {
238 235
             $file = $temp;
239 236
           }
@@ -381,8 +378,7 @@  discard block
 block discarded – undo
381 378
       if ($match[2] < 0)
382 379
       {
383 380
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
384
-      }
385
-      else
381
+      } else
386 382
       {
387 383
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
388 384
       }
@@ -390,17 +386,14 @@  discard block
 block discarded – undo
390 386
       if (strlen($match[3]) < 1 || $match[3] == -1)
391 387
       {
392 388
         $loop_end = '$_' . $tag_args . '_count';
393
-      }
394
-      else if ($match[3] >= 0)
389
+      } else if ($match[3] >= 0)
395 390
       {
396 391
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
397
-      }
398
-      else //if ($match[3] < -1)
392
+      } else //if ($match[3] < -1)
399 393
       {
400 394
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
401 395
       }
402
-    }
403
-    else
396
+    } else
404 397
     {
405 398
       $loop_start = 0;
406 399
       $loop_end = '$_' . $tag_args . '_count';
@@ -413,8 +406,7 @@  discard block
 block discarded – undo
413 406
     {
414 407
       // We need to implode $no_nesting times from the end...
415 408
       $block = array_slice($this->block_names, -$no_nesting);
416
-    }
417
-    else
409
+    } else
418 410
     {
419 411
       $block = $this->block_names;
420 412
     }
@@ -424,8 +416,7 @@  discard block
 block discarded – undo
424 416
       // Block is not nested.
425 417
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
426 418
       $varref = "\$this->_tpldata['$tag_args']";
427
-    }
428
-    else
419
+    } else
429 420
     {
430 421
       // This block is nested.
431 422
       // Generate a namespace string for this block.
@@ -573,8 +564,7 @@  discard block
 block discarded – undo
573 564
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
574 565
           {
575 566
             $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
576
-          }
577
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
567
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
578 568
           {
579 569
             // Allow checking if loops are set with .loopname
580 570
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -590,8 +580,7 @@  discard block
 block discarded – undo
590 580
 
591 581
               // Add the block reference for the last child.
592 582
               $varref .= "['" . $block . "']";
593
-            }
594
-            else
583
+            } else
595 584
             {
596 585
               $varref = '$this->_tpldata';
597 586
 
@@ -599,8 +588,7 @@  discard block
 block discarded – undo
599 588
               $varref .= "['" . $blocks[0] . "']";
600 589
             }
601 590
             $token = "sizeof($varref)";
602
-          }
603
-          else if (!empty($token))
591
+          } else if (!empty($token))
604 592
           {
605 593
             $token = '(' . $token . ')';
606 594
           }
@@ -645,8 +633,7 @@  discard block
 block discarded – undo
645 633
 
646 634
       // Now replace the php code
647 635
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
648
-    }
649
-    else
636
+    } else
650 637
     {
651 638
       preg_match('#true|false|\.#i', $match[4], $type);
652 639
 
@@ -708,8 +695,7 @@  discard block
 block discarded – undo
708 695
     {
709 696
       $negate_expr = true;
710 697
       $expr_type = array_shift($tokens);
711
-    }
712
-    else
698
+    } else
713 699
     {
714 700
       $expr_type = $first_token;
715 701
     }
@@ -722,8 +708,7 @@  discard block
 block discarded – undo
722 708
           $expr_end++;
723 709
           $expr_arg = $tokens[$expr_end++];
724 710
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
725
-        }
726
-        else
711
+        } else
727 712
         {
728 713
           $expr = "!($is_arg & 1)";
729 714
         }
@@ -735,8 +720,7 @@  discard block
 block discarded – undo
735 720
           $expr_end++;
736 721
           $expr_arg = $tokens[$expr_end++];
737 722
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
738
-        }
739
-        else
723
+        } else
740 724
         {
741 725
           $expr = "($is_arg & 1)";
742 726
         }
@@ -818,12 +802,10 @@  discard block
 block discarded – undo
818 802
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
819 803
       }
820 804
       return $varref;
821
-    }
822
-    else if ($include_last_iterator)
805
+    } else if ($include_last_iterator)
823 806
     {
824 807
       return '$_'. $blocks[$blockcount] . '_val';
825
-    }
826
-    else
808
+    } else
827 809
     {
828 810
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
829 811
     }
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         'template_data'     => trim(@file_get_contents($this->template->files[$handle])),
92 92
       );
93 93
 
94
-      $sql = 'INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
94
+      $sql = 'INSERT INTO '.STYLES_TEMPLATE_DATA_TABLE.' '.$db->sql_build_array('INSERT', $sql_ary);
95 95
       $db->sql_query($sql);
96 96
     }
97 97
   }
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
     preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
140 140
     $include_blocks = $matches[1];
141
-    if($include_blocks)
141
+    if ($include_blocks)
142 142
     {
143
-      foreach($include_blocks as &$included_file)
143
+      foreach ($include_blocks as &$included_file)
144 144
       {
145 145
         $included_file .= '.tpl.html';
146 146
       }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
       {
170 170
         case 'BEGIN':
171 171
           $this->block_else_level[] = false;
172
-          $compile_blocks[] = '<?php ' . $this->compile_tag_block($block_val[2]) . ' ?>';
172
+          $compile_blocks[] = '<?php '.$this->compile_tag_block($block_val[2]).' ?>';
173 173
         break;
174 174
 
175 175
         case 'BEGINELSE':
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 
180 180
         case 'END':
181 181
           array_pop($this->block_names);
182
-          $compile_blocks[] = '<?php ' . ((array_pop($this->block_else_level)) ? '}' : '}}') . ' ?>';
182
+          $compile_blocks[] = '<?php '.((array_pop($this->block_else_level)) ? '}' : '}}').' ?>';
183 183
         break;
184 184
 
185 185
         case 'IF':
186
-          $compile_blocks[] = '<?php ' . $this->compile_tag_if($block_val[2], false) . ' ?>';
186
+          $compile_blocks[] = '<?php '.$this->compile_tag_if($block_val[2], false).' ?>';
187 187
         break;
188 188
 
189 189
         case 'ELSE':
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         break;
192 192
 
193 193
         case 'ELSEIF':
194
-          $compile_blocks[] = '<?php ' . $this->compile_tag_if($block_val[2], true) . ' ?>';
194
+          $compile_blocks[] = '<?php '.$this->compile_tag_if($block_val[2], true).' ?>';
195 195
         break;
196 196
 
197 197
         case 'ENDIF':
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
         break;
200 200
 
201 201
         case 'DEFINE':
202
-          $compile_blocks[] = '<?php ' . $this->compile_tag_define($block_val[2], true) . ' ?>';
202
+          $compile_blocks[] = '<?php '.$this->compile_tag_define($block_val[2], true).' ?>';
203 203
         break;
204 204
 
205 205
         case 'UNDEFINE':
206
-          $compile_blocks[] = '<?php ' . $this->compile_tag_define($block_val[2], false) . ' ?>';
206
+          $compile_blocks[] = '<?php '.$this->compile_tag_define($block_val[2], false).' ?>';
207 207
         break;
208 208
 
209 209
         case 'INCLUDE':
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             $file = $temp;
235 235
           }
236 236
 
237
-          $compile_blocks[] = '<?php ' . $this->compile_tag_include($temp) . ' ?>';
237
+          $compile_blocks[] = '<?php '.$this->compile_tag_include($temp).' ?>';
238 238
 
239 239
           // No point in checking variable includes
240 240
           if ($file)
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
         break;
245 245
 
246 246
         case 'INCLUDEPHP':
247
-          $compile_blocks[] = (classSupernova::$config->tpl_allow_php) ? '<?php ' . $this->compile_tag_include_php(array_shift($includephp_blocks)) . ' ?>' : '';
247
+          $compile_blocks[] = (classSupernova::$config->tpl_allow_php) ? '<?php '.$this->compile_tag_include_php(array_shift($includephp_blocks)).' ?>' : '';
248 248
         break;
249 249
 
250 250
         case 'PHP':
251
-          $compile_blocks[] = (classSupernova::$config->tpl_allow_php) ? '<?php ' . array_shift($php_blocks) . ' ?>' : '';
251
+          $compile_blocks[] = (classSupernova::$config->tpl_allow_php) ? '<?php '.array_shift($php_blocks).' ?>' : '';
252 252
         break;
253 253
 
254 254
         default:
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     for ($i = 0, $size = sizeof($text_blocks); $i < $size; $i++)
264 264
     {
265 265
       $trim_check_text = trim($text_blocks[$i]);
266
-      $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
266
+      $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '').((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '').((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
267 267
     }
268 268
 
269 269
     // Remove unused opening/closing tags
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     // we'll strip out such occurences, minimising such switching
279 279
     if ($no_echo)
280 280
     {
281
-      return "\$$echo_var .= '" . $template_php . "'";
281
+      return "\$$echo_var .= '".$template_php."'";
282 282
     }
283 283
 
284 284
     return $template_php;
@@ -373,30 +373,30 @@  discard block
 block discarded – undo
373 373
 
374 374
       if ($match[2] < 0)
375 375
       {
376
-        $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
376
+        $loop_start = '($_'.$tag_args.'_count '.$match[2].' < 0 ? 0 : $_'.$tag_args.'_count '.$match[2].')';
377 377
       }
378 378
       else
379 379
       {
380
-        $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
380
+        $loop_start = '($_'.$tag_args.'_count < '.$match[2].' ? $_'.$tag_args.'_count : '.$match[2].')';
381 381
       }
382 382
 
383 383
       if (strlen($match[3]) < 1 || $match[3] == -1)
384 384
       {
385
-        $loop_end = '$_' . $tag_args . '_count';
385
+        $loop_end = '$_'.$tag_args.'_count';
386 386
       }
387 387
       else if ($match[3] >= 0)
388 388
       {
389
-        $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
389
+        $loop_end = '('.($match[3] + 1).' > $_'.$tag_args.'_count ? $_'.$tag_args.'_count : '.($match[3] + 1).')';
390 390
       }
391 391
       else //if ($match[3] < -1)
392 392
       {
393
-        $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
393
+        $loop_end = '$_'.$tag_args.'_count'.($match[3] + 1);
394 394
       }
395 395
     }
396 396
     else
397 397
     {
398 398
       $loop_start = 0;
399
-      $loop_end = '$_' . $tag_args . '_count';
399
+      $loop_end = '$_'.$tag_args.'_count';
400 400
     }
401 401
 
402 402
     $tag_template_php = '';
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     if (sizeof($block) < 2)
416 416
     {
417 417
       // Block is not nested.
418
-      $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
418
+      $tag_template_php = '$_'.$tag_args."_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
419 419
       $varref = "\$this->_tpldata['$tag_args']";
420 420
     }
421 421
     else
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
       $varref = $this->generate_block_data_ref($namespace, false);
430 430
 
431 431
       // Create the for loop code to iterate over this block.
432
-      $tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
432
+      $tag_template_php = '$_'.$tag_args.'_count = (isset('.$varref.')) ? sizeof('.$varref.') : 0;';
433 433
     }
434 434
 
435
-    $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
435
+    $tag_template_php .= 'if ($_'.$tag_args.'_count) {';
436 436
 
437 437
     /**
438 438
     * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
     * </code>
445 445
     */
446 446
 
447
-    $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
447
+    $tag_template_php .= 'for ($_'.$tag_args.'_i = '.$loop_start.'; $_'.$tag_args.'_i < '.$loop_end.'; ++$_'.$tag_args.'_i){';
448 448
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
449
-    $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
450
-    $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];';
449
+    $tag_template_php .= '$_'.$tag_args.'_val = &'.$varref.'[$_'.$tag_args.'_i];';
450
+    $tag_template_php .= '$this->_block_value["'.$tag_args.'"] = &'.$varref.'[$_'.$tag_args.'_i];';
451 451
 
452 452
     return $tag_template_php;
453 453
   }
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
         break;
552 552
 
553 553
         case 'is':
554
-          $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
554
+          $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
555 555
           $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
556 556
 
557
-          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
557
+          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
558 558
 
559 559
           array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
560 560
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
         default:
566 566
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
567 567
           {
568
-            $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
568
+            $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]).'[\''.$varrefs[3].'\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\''.$varrefs[3].'\']' : '$this->_rootref[\''.$varrefs[3].'\']');
569 569
           }
570 570
           else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
571 571
           {
@@ -582,20 +582,20 @@  discard block
 block discarded – undo
582 582
               $varref = $this->generate_block_data_ref($namespace, true);
583 583
 
584 584
               // Add the block reference for the last child.
585
-              $varref .= "['" . $block . "']";
585
+              $varref .= "['".$block."']";
586 586
             }
587 587
             else
588 588
             {
589 589
               $varref = '$this->_tpldata';
590 590
 
591 591
               // Add the block reference for the last child.
592
-              $varref .= "['" . $blocks[0] . "']";
592
+              $varref .= "['".$blocks[0]."']";
593 593
             }
594 594
             $token = "sizeof($varref)";
595 595
           }
596 596
           else if (!empty($token))
597 597
           {
598
-            $token = '(' . $token . ')';
598
+            $token = '('.$token.')';
599 599
           }
600 600
 
601 601
         break;
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
     {
608 608
       $tokens = array('false');
609 609
     }
610
-    return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { ');
610
+    return (($elseif) ? '} else if (' : 'if (').(implode(' ', $tokens).') { ');
611 611
   }
612 612
 
613 613
   /**
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
     if (!$op)
627 627
     {
628
-      return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');';
628
+      return 'unset('.(($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true).'[\''.$match[2].'\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\''.$match[2].'\']').');';
629 629
     }
630 630
 
631 631
     // Are we a string?
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
       $match[4] = $this->compile($match[4]);
638 638
 
639 639
       // Now replace the php code
640
-      $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
640
+      $match[4] = "'".str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4])."'";
641 641
     }
642 642
     else
643 643
     {
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
       }
661 661
     }
662 662
 
663
-    return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';';
663
+    return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true).'[\''.$match[2].'\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\''.$match[2].'\']').' = '.$match[4].';';
664 664
   }
665 665
 
666 666
   /**
@@ -801,24 +801,24 @@  discard block
 block discarded – undo
801 801
       // Build up the string with everything but the last child.
802 802
       for ($i = 0; $i < $blockcount; $i++)
803 803
       {
804
-        $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
804
+        $varref .= "['".$blocks[$i]."'][\$_".$blocks[$i].'_i]';
805 805
       }
806 806
       // Add the block reference for the last child.
807
-      $varref .= "['" . $blocks[$blockcount] . "']";
807
+      $varref .= "['".$blocks[$blockcount]."']";
808 808
       // Add the iterator for the last child if requried.
809 809
       if ($include_last_iterator)
810 810
       {
811
-        $varref .= '[$_' . $blocks[$blockcount] . '_i]';
811
+        $varref .= '[$_'.$blocks[$blockcount].'_i]';
812 812
       }
813 813
       return $varref;
814 814
     }
815 815
     else if ($include_last_iterator)
816 816
     {
817
-      return '$_'. $blocks[$blockcount] . '_val';
817
+      return '$_'.$blocks[$blockcount].'_val';
818 818
     }
819 819
     else
820 820
     {
821
-      return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
821
+      return '$_'.$blocks[$blockcount - 1].'_val[\''.$blocks[$blockcount].'\']';
822 822
     }
823 823
   }
824 824
 
@@ -828,14 +828,14 @@  discard block
 block discarded – undo
828 828
   */
829 829
   function compile_write($handle, $data)
830 830
   {
831
-    $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
831
+    $filename = $this->template->cachepath.str_replace('/', '.', $this->template->filename[$handle]).DOT_PHP_EX;
832 832
 
833
-    $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
833
+    $data = "<?php if (!defined('INSIDE')) exit;".((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>'.$data);
834 834
 
835 835
     if ($fp = @fopen($filename, 'wb'))
836 836
     {
837 837
       @flock($fp, LOCK_EX);
838
-      @fwrite ($fp, $data);
838
+      @fwrite($fp, $data);
839 839
       @flock($fp, LOCK_UN);
840 840
       @fclose($fp);
841 841
 
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
   */
853 853
   private function minify($html)
854 854
   {
855
-    if(!classSupernova::$config->tpl_minifier)
855
+    if (!classSupernova::$config->tpl_minifier)
856 856
     {
857 857
       return $html;
858 858
     }
@@ -862,14 +862,14 @@  discard block
 block discarded – undo
862 862
     $html = preg_replace('/(<script[^>]*?>.*?<\/script>)/si', '#pre#', $html);
863 863
     $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags
864 864
     $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space
865
-    if(!empty($pre[0]))
865
+    if (!empty($pre[0]))
866 866
     {
867
-      foreach($pre[0] as $tag)
867
+      foreach ($pre[0] as $tag)
868 868
       {
869 869
         $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside
870 870
         $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one
871 871
         $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one
872
-        $html = preg_replace('/#pre#/', $tag, $html,1);
872
+        $html = preg_replace('/#pre#/', $tag, $html, 1);
873 873
       }
874 874
     }
875 875
 
Please login to merge, or discard this patch.