Completed
Push — work-fleets ( 070fe2...d6c2ef )
by SuperNova.WS
05:43
created
admin/messall.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
  * @copyright 2008 by ??????? for XNova
8 8
  */
9 9
 
10
-define('INSIDE'  , true);
11
-define('INSTALL' , false);
10
+define('INSIDE', true);
11
+define('INSTALL', false);
12 12
 define('IN_ADMIN', true);
13 13
 
14 14
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
15 15
 
16
-if($user['authlevel'] < 3)
16
+if ($user['authlevel'] < 3)
17 17
 {
18 18
   AdminMessage($lang['adm_err_denied']);
19 19
 }
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
   }
38 38
   if ($config->tresc != '' and $config->temat) {
39 39
     $Time    = time();
40
-    $From    = '<font color="'. $kolor .'">'. $ranga ." ".$user['username']."</font>";
41
-    $Subject = '<font color="'. $kolor .'">'. $config->temat ."</font>";
42
-    $Message = '<font color="'. $kolor .'"><b>'. $config->tresc ."</b></font>";
40
+    $From    = '<font color="' . $kolor . '">' . $ranga . " " . $user['username'] . "</font>";
41
+    $Subject = '<font color="' . $kolor . '">' . $config->temat . "</font>";
42
+    $Message = '<font color="' . $kolor . '"><b>' . $config->tresc . "</b></font>";
43 43
     $sq      = db_user_list('', false, 'id');
44
-    foreach($sq as $u)
44
+    foreach ($sq as $u)
45 45
     // while ($u = db_fetch($sq))
46 46
     {
47
-      msg_send_simple_message ($u['id'], $user['id'], $Time, MSG_TYPE_ADMIN, $From, $Subject, $Message);
47
+      msg_send_simple_message($u['id'], $user['id'], $Time, MSG_TYPE_ADMIN, $From, $Subject, $Message);
48 48
     }
49 49
     message("<font color=\"lime\">Херня на польском</font>", "Complete", "../overview." . PHP_EX, 3);
50 50
   }
51 51
 } else {
52 52
   $parse['dpath'] = $dpath;
53
-  $parse['debug'] = ($config->debug == 1) ? " checked='checked'/":'';
53
+  $parse['debug'] = ($config->debug == 1) ? " checked='checked'/" : '';
54 54
   $page .= parsetemplate(gettemplate('admin/messall_body'), $parse);
55
-  display($page, '', false,'', true);
55
+  display($page, '', false, '', true);
56 56
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,11 +41,12 @@
 block discarded – undo
41 41
     $Subject = '<font color="'. $kolor .'">'. $config->temat ."</font>";
42 42
     $Message = '<font color="'. $kolor .'"><b>'. $config->tresc ."</b></font>";
43 43
     $sq      = db_user_list('', false, 'id');
44
-    foreach($sq as $u)
45
-    // while ($u = db_fetch($sq))
44
+    foreach($sq as $u) {
45
+        // while ($u = db_fetch($sq))
46 46
     {
47 47
       msg_send_simple_message ($u['id'], $user['id'], $Time, MSG_TYPE_ADMIN, $From, $Subject, $Message);
48 48
     }
49
+    }
49 50
     message("<font color=\"lime\">Херня на польском</font>", "Complete", "../overview." . PHP_EX, 3);
50 51
   }
51 52
 } else {
Please login to merge, or discard this patch.
admin/admin_darkmatter.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
17 17
 
18
-if($user['authlevel'] < 3) {
18
+if ($user['authlevel'] < 3) {
19 19
   AdminMessage($lang['adm_err_denied']);
20 20
 }
21 21
 
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 $message = '';
25 25
 $message_status = ERR_ERROR;
26 26
 
27
-if($points = sys_get_param_float('points')) {
27
+if ($points = sys_get_param_float('points')) {
28 28
 // If points not empty...
29
-  if($username = sys_get_param_str_unsafe('id_user')) {
29
+  if ($username = sys_get_param_str_unsafe('id_user')) {
30 30
     $row = db_user_by_id($username, false, 'id, username', true, true);
31
-    if(!isset($row['id'])) {
31
+    if (!isset($row['id'])) {
32 32
       $row = db_user_by_username($username, false, 'id, username', true, true);
33 33
     }
34
-    if(is_array($row) && isset($row['id'])) {
34
+    if (is_array($row) && isset($row['id'])) {
35 35
       // Does anything post to DB?
36
-      if(rpg_points_change(
36
+      if (rpg_points_change(
37 37
         $row['id'],
38 38
         RPG_ADMIN,
39 39
         $points,
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
     // Points not empty but destination is not set - this means error
52 52
     $message = $lang['adm_dm_no_dest'];
53 53
   }
54
-} elseif($id_user) {
54
+} elseif ($id_user) {
55 55
   // Points is empty but destination is set - this again means error
56 56
   $message = $lang['adm_dm_no_quant'];
57 57
 }
58 58
 
59
-if(!$isNoError) {
59
+if (!$isNoError) {
60 60
   $template->assign_vars(array(
61 61
     'ID_USER' => $id_user,
62 62
     'POINTS' => $points,
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
   ));
65 65
 };
66 66
 
67
-if($message) {
67
+if ($message) {
68 68
   $template->assign_block_vars('result', array('MESSAGE' => $message, 'STATUS' => $message_status ? $message_status : ERR_NONE));
69 69
 }
70 70
 
Please login to merge, or discard this patch.
admin/paneladmina.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
  * @copyright 2008 by ??????? for XNova
9 9
  */
10 10
 
11
-define('INSIDE'  , true);
12
-define('INSTALL' , false);
11
+define('INSIDE', true);
12
+define('INSTALL', false);
13 13
 define('IN_ADMIN', true);
14 14
 
15 15
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
17
-if($user['authlevel'] < 3)
17
+if ($user['authlevel'] < 3)
18 18
 {
19 19
   AdminMessage($lang['adm_err_denied']);
20 20
 }
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 
35 35
 // Afficher les templates
36 36
 if (isset($GET_result)) {
37
-  switch ($GET_result){
37
+  switch ($GET_result) {
38 38
     case 'usr_search':
39
-      $SelUser = db_user_by_username('%'. $Pattern .'%', false, '*', true, true);
39
+      $SelUser = db_user_by_username('%' . $Pattern . '%', false, '*', true, true);
40 40
       $UsrMain = db_planet_by_id($SelUser['id_planet'], false, 'name');
41 41
 
42 42
       $bloc                   = $lang;
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
       $bloc['answer2']        = $SelUser['username'];
45 45
       $bloc['answer3']        = $SelUser['user_lastip'];
46 46
       $bloc['answer4']        = $SelUser['email'];
47
-      $bloc['answer5']        = $lang['adm_usr_level'][ $SelUser['authlevel'] ];
48
-      $bloc['answer6']        = $lang['adm_usr_genre'][ $SelUser['gender'] ];
49
-      $bloc['answer7']        = "[".$SelUser['id_planet']."] ".$UsrMain['name'];
50
-      $bloc['answer8']        = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] ";
47
+      $bloc['answer5']        = $lang['adm_usr_level'][$SelUser['authlevel']];
48
+      $bloc['answer6']        = $lang['adm_usr_genre'][$SelUser['gender']];
49
+      $bloc['answer7']        = "[" . $SelUser['id_planet'] . "] " . $UsrMain['name'];
50
+      $bloc['answer8']        = "[" . $SelUser['galaxy'] . ":" . $SelUser['system'] . ":" . $SelUser['planet'] . "] ";
51 51
       $bloc['qst_quest_complete'] = get_quest_amount_complete($SelUser['id']);
52 52
       $bloc['user_id'] = $SelUser['id'];
53 53
       $SubPanelTPL            = gettemplate('admin/admin_panel_asw1');
54
-      $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
54
+      $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
55 55
       break;
56 56
 
57 57
     case 'usr_data':
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 
110 110
       $selected_user = db_user_by_username($Pattern, false, 'id');
111 111
       $QryUpdate = db_user_set_by_id($selected_user['id'], "`authlevel` = '{$NewLvl}'");
112
-      $Message    = $lang['adm_mess_lvl1']. " ". $Pattern ." ".$lang['adm_mess_lvl2'];
113
-      $Message   .= "<font color=\"red\">".$lang['adm_usr_level'][ $NewLvl ]."</font>!";
112
+      $Message    = $lang['adm_mess_lvl1'] . " " . $Pattern . " " . $lang['adm_mess_lvl2'];
113
+      $Message   .= "<font color=\"red\">" . $lang['adm_usr_level'][$NewLvl] . "</font>!";
114 114
 
115
-      AdminMessage ( $Message, $lang['adm_mod_level'] );
115
+      AdminMessage($Message, $lang['adm_mod_level']);
116 116
       break;
117 117
 
118 118
     case 'ip_search':
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
       $bloc['adm_this_ip']    = $ip;
122 122
       $SelUser = db_user_list("`user_lastip` = '{$ip}'");
123 123
       //while ( $Usr = db_fetch($SelUser) ) {
124
-      foreach($SelUser as $Usr) {
124
+      foreach ($SelUser as $Usr) {
125 125
         $UsrMain = db_planet_by_id($Usr['id_planet'], false, 'name');
126
-        $bloc['adm_plyer_lst'] .= "<tr><th>".$Usr['username']."</th><th>[".$Usr['galaxy'].":".$Usr['system'].":".$Usr['planet']."] ".$UsrMain['name']."</th></tr>";
126
+        $bloc['adm_plyer_lst'] .= "<tr><th>" . $Usr['username'] . "</th><th>[" . $Usr['galaxy'] . ":" . $Usr['system'] . ":" . $Usr['planet'] . "] " . $UsrMain['name'] . "</th></tr>";
127 127
       }
128 128
       $SubPanelTPL            = gettemplate('admin/admin_panel_asw2');
129
-      $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
129
+      $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
130 130
       break;
131 131
     default:
132 132
       break;
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 
136 136
 // Traiter les reponses aux formulaires
137 137
 if (isset($GET_action)) {
138
-  $bloc                   = $lang;
139
-  switch ($GET_action){
138
+  $bloc = $lang;
139
+  switch ($GET_action) {
140 140
     case 'usr_search':
141
-      $SubPanelTPL            = gettemplate('admin/admin_panel_frm1');
141
+      $SubPanelTPL = gettemplate('admin/admin_panel_frm1');
142 142
       break;
143 143
 
144 144
     case 'usr_data':
145
-      $SubPanelTPL            = gettemplate('admin/admin_panel_frm4');
145
+      $SubPanelTPL = gettemplate('admin/admin_panel_frm4');
146 146
       break;
147 147
 
148 148
     case 'usr_level':
@@ -155,21 +155,21 @@  discard block
 block discarded – undo
155 155
 
156 156
 
157 157
       for ($Lvl = 0; $Lvl < 4; $Lvl++) {
158
-        $bloc['adm_level_lst'] .= '<option value="'. $Lvl .'">'. $lang['adm_usr_level'][ $Lvl ] ."</option>";
158
+        $bloc['adm_level_lst'] .= '<option value="' . $Lvl . '">' . $lang['adm_usr_level'][$Lvl] . "</option>";
159 159
       }
160
-      $SubPanelTPL            = gettemplate('admin/admin_panel_frm3');
160
+      $SubPanelTPL = gettemplate('admin/admin_panel_frm3');
161 161
       break;
162 162
 
163 163
     case 'ip_search':
164
-      $SubPanelTPL            = gettemplate('admin/admin_panel_frm2');
164
+      $SubPanelTPL = gettemplate('admin/admin_panel_frm2');
165 165
       break;
166 166
 
167 167
     default:
168 168
       break;
169 169
   }
170
-  $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
170
+  $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
171 171
 }
172 172
 
173
-$page = parsetemplate( $PanelMainTPL, $parse );
174
-display( $page, $lang['panel_mainttl'], false, '', true );
173
+$page = parsetemplate($PanelMainTPL, $parse);
174
+display($page, $lang['panel_mainttl'], false, '', true);
175 175
 ?>
Please login to merge, or discard this patch.
buildings.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
 $mode = sys_get_param_escaped('mode');
22 22
 $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode)));
23 23
 
24
-if($building_sort = sys_get_param_id('sort_elements')) {
25
-  if(!empty($lang['player_option_building_sort'][$building_sort])) {
24
+if ($building_sort = sys_get_param_id('sort_elements')) {
25
+  if (!empty($lang['player_option_building_sort'][$building_sort])) {
26 26
     classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort;
27 27
     classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0);
28 28
   }
Please login to merge, or discard this patch.
artifacts.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 
23 23
 $sn_group_artifacts = sn_get_groups('artifacts');
24 24
 
25
-if(($action = sys_get_param_int('action')) && in_array($unit_id = sys_get_param_int('unit_id'), $sn_group_artifacts))
25
+if (($action = sys_get_param_int('action')) && in_array($unit_id = sys_get_param_int('unit_id'), $sn_group_artifacts))
26 26
 {
27
-  switch($action)
27
+  switch ($action)
28 28
   {
29 29
     case ACTION_BUY:
30 30
       sn_db_transaction_start();
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
       $darkmater_cost = $build_data[BUILD_CREATE][RES_DARK_MATTER];
37 37
 
38 38
       // TODO: more correct check - with "FOR UPDATE"
39
-      if(mrc_get_level($user, null, RES_DARK_MATTER) >= $darkmater_cost)
39
+      if (mrc_get_level($user, null, RES_DARK_MATTER) >= $darkmater_cost)
40 40
       {
41 41
         $unit_max_stack = get_unit_param($unit_id, P_MAX_STACK);
42
-        if(!isset($unit_max_stack) || $unit_max_stack > mrc_get_level($user, $planetrow, $unit_id))
42
+        if (!isset($unit_max_stack) || $unit_max_stack > mrc_get_level($user, $planetrow, $unit_id))
43 43
         {
44 44
           $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, 1, $user);
45 45
           db_changeset_apply($db_changeset);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 $template = gettemplate('artifacts', true);
75 75
 
76
-foreach($sn_group_artifacts as $artifact_id)
76
+foreach ($sn_group_artifacts as $artifact_id)
77 77
 {
78 78
   $artifact_level = mrc_get_level($user, array(), $artifact_id, true);
79 79
   $build_data = eco_get_build_data($user, $planetrow, $artifact_id, $artifact_level);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     $artifact_data = get_unit_param($artifact_id);
82 82
     $artifact_data_bonus = $artifact_data['bonus'];
83 83
     $artifact_data_bonus = $artifact_data_bonus >= 0 ? "+{$artifact_data_bonus}" : "{$artifact_data_bonus}";
84
-    switch($artifact_data['bonus_type'])
84
+    switch ($artifact_data['bonus_type'])
85 85
     {
86 86
       case BONUS_PERCENT:
87 87
         $artifact_data_bonus = "{$artifact_data_bonus}% ";
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,13 +48,11 @@
 block discarded – undo
48 48
           header("Location: artifacts.php#{$unit_id}");
49 49
           ob_end_flush();
50 50
           die();
51
-        }
52
-        else
51
+        } else
53 52
         {
54 53
           $Message = $lang['off_maxed_out'];
55 54
         }
56
-      }
57
-      else
55
+      } else
58 56
       {
59 57
         $Message = $lang['sys_no_points'];
60 58
       }
Please login to merge, or discard this patch.
time_probe.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 $time_server = $time_local  - $time_diff
14 14
 */
15 15
 
16
-if($font_size = sys_get_param_str('font_size')) {
17
-  if(strpos($font_size, '%') !== false) {
16
+if ($font_size = sys_get_param_str('font_size')) {
17
+  if (strpos($font_size, '%') !== false) {
18 18
     // Размер шрифта в процентах
19 19
     $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%';
20
-  } elseif(strpos($font_size, 'px') !== false) {
20
+  } elseif (strpos($font_size, 'px') !== false) {
21 21
     // Размер шрифта в пикселях
22 22
     $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px';
23 23
   } else {
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
   classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE] = $font_size;
30 30
 } else {
31 31
   $user_time_diff = playerTimeDiff::user_time_diff_get();
32
-  if($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
32
+  if ($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
33 33
     $time_diff = intval($user_time_diff[PLAYER_OPTION_TIME_DIFF]);
34 34
   } else {
35 35
     $user_time_diff = playerTimeDiff::user_time_diff_probe();
Please login to merge, or discard this patch.
phalanx.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 
19 19
 $sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX);
20 20
 if (!intval($sensorLevel)) {
21
-  message ($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
21
+  message($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
22 22
 }
23 23
 
24 24
 if ($planetrow['planet_type'] != PT_MOON) {
25
-  message ($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
25
+  message($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
26 26
 }
27 27
 
28 28
 $scan_galaxy  = sys_get_param_int('galaxy');
29 29
 $scan_system  = sys_get_param_int('system');
30 30
 $scan_planet  = sys_get_param_int('planet');
31
-$scan_planet_type  = 1; // sys_get_param_int('planettype');
31
+$scan_planet_type = 1; // sys_get_param_int('planettype');
32 32
 $id = sys_get_param_id('id');
33 33
 
34 34
 $source_galaxy = $planetrow['galaxy'];
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 $sensorRange = GetPhalanxRange($sensorLevel);
39 39
 
40 40
 $system_distance = abs($source_system - $scan_system);
41
-if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy)
41
+if ($system_distance > $sensorRange || $scan_galaxy != $source_galaxy)
42 42
 {
43
-  message ($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
43
+  message($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
44 44
 }
45 45
 
46 46
 $cost = $sensorLevel * 1000;
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 }
52 52
 
53 53
 $planet_scanned = db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type);
54
-if(!$planet_scanned['id'])
54
+if (!$planet_scanned['id'])
55 55
 {
56 56
   message($lang['phalanx_planet_not_exists'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
57 57
 }
58 58
 
59
-if($planet_scanned['destruyed'])
59
+if ($planet_scanned['destruyed'])
60 60
 {
61
-  message ($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
61
+  message($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
62 62
 }
63 63
 
64 64
 db_planet_set_by_id($user['current_planet'], "deuterium = deuterium - {$cost}");
Please login to merge, or discard this patch.
docs/txt2html.php 2 patches
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,52 +1,52 @@  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
-    $dumper .= '('.strlen($value).')';
24
-    $value = dump($value,"",-1);
23
+    $dumper .= '(' . strlen($value) . ')';
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));
30
-    $dumper .= '('.count($props).') <u>'.get_class($value).'</u>';
31
-    foreach($props as $key=>$val)
29
+    $props = get_class_vars(get_class($value));
30
+    $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>';
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
-    $dumper .= '('.count($value).')';
41
-    foreach($value as $key=>$val)
40
+    $dumper .= '(' . count($value) . ')';
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
 
@@ -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 214
     buf_print("<div class=\"{$styles[$block['style']]}\">" . ($block['style'] != 'D' ? "[{$block['style']}]&nbsp;" : ''));
215 215
     buf_print(preg_replace("/\s{2,10}/", " ", $block['name']) . '<br />');
216
-    if(isset($block['lines']))
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");
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
         $line = preg_replace("/\s{2,10}/", " ", $line);
270 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
         }
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 buf_print("</body>\r\n</html>\r\n");
288 288
 
289 289
 $html = file_get_contents($path_prefix . 'html/' . $filename . '.html');
290
-if($html != $output_buffer)
290
+if ($html != $output_buffer)
291 291
 {
292 292
   file_put_contents($path_prefix . 'html/' . $filename . '.html', $output_buffer);
293
-  if(!$path_prefix)
293
+  if (!$path_prefix)
294 294
   {
295 295
     print($output_buffer);
296 296
   }
Please login to merge, or discard this patch.
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"]='&oplus;';
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.
index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) {
3
+if (isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) {
4 4
   require_once('common.' . substr(strrchr(__FILE__, '.'), 1));
5 5
 // pdump($sn_mvc);
6
-  if($sn_page_name) {
6
+  if ($sn_page_name) {
7 7
     // Loading page-specific language files
8 8
     global $template;
9 9
     isset($sn_mvc['model'][$sn_page_name]) and execute_hooks($sn_mvc['model'][$sn_page_name], $template);
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
       }
26 26
     }
27 27
 */
28
-    if(!empty($template_result) && is_object($template)) {
28
+    if (!empty($template_result) && is_object($template)) {
29 29
       $template->assign_recursive($template_result);
30 30
     }
31 31
     display($template);
Please login to merge, or discard this patch.