Completed
Push — work-fleets ( 45d3a1...6724fd )
by SuperNova.WS
09:14 queued 03:18
created
includes/general.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
   } else {
38 38
     // TODO: This is left for backward compatibility. Appropriate code should be rewrote!
39
-    $func_name = isset(classSupernova::$functions[$func_name]) && is_callable(classSupernova::$functions[$func_name]) ? classSupernova::$functions[$func_name] : ('sn_' . $func_name);
39
+    $func_name = isset(classSupernova::$functions[$func_name]) && is_callable(classSupernova::$functions[$func_name]) ? classSupernova::$functions[$func_name] : ('sn_'.$func_name);
40 40
     if (is_callable($func_name)) {
41 41
       $result = call_user_func_array($func_name, $func_arg);
42 42
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function get_exchange_rate($currency_symbol) {
113 113
   $currency_symbol = strtolower($currency_symbol);
114
-  $config_field = 'payment_currency_exchange_' . $currency_symbol;
114
+  $config_field = 'payment_currency_exchange_'.$currency_symbol;
115 115
 
116 116
   // Заворачиваем получение стоимости ММ через перекрываемую процедуру
117 117
   $exchange_rate = floatval($currency_symbol == 'mm_' ? get_mm_cost() : classSupernova::$config->$config_field);
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
   $from = trim($from ? $from : classSupernova::$config->game_adminEmail);
624 624
 
625 625
   $head = '';
626
-  $head .= "Content-Type: text/" . ($html ? 'html' : 'plain') . "; charset=utf-8 \r\n";
627
-  $head .= "Date: " . date('r') . " \r\n";
626
+  $head .= "Content-Type: text/".($html ? 'html' : 'plain')."; charset=utf-8 \r\n";
627
+  $head .= "Date: ".date('r')." \r\n";
628 628
   $classConfig = classSupernova::$config;
629 629
   $head .= "Return-Path: {$classConfig->game_adminEmail} \r\n";
630 630
   $head .= "From: {$from} \r\n";
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
   $body = str_replace("\n", "\r\n", $body);
638 638
 
639 639
   if ($html) {
640
-    $body = '<html><head><base href="' . SN_ROOT_VIRTUAL . '"></head><body>' . nl2br($body) . '</body></html>';
640
+    $body = '<html><head><base href="'.SN_ROOT_VIRTUAL.'"></head><body>'.nl2br($body).'</body></html>';
641 641
   }
642 642
 
643
-  $title = '=?UTF-8?B?' . base64_encode($title) . '?=';
643
+  $title = '=?UTF-8?B?'.base64_encode($title).'?=';
644 644
 
645 645
   return @mail($email_unsafe, $title, $body, $head);
646 646
 }
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
   $classLocale = classLocale::$lang;
657 657
 
658 658
   return
659
-    ($full || $time ? "{$time} {$classLocale['sys_day']}&nbsp;" : '') .
660
-    ($full || $hours ? "{$hours} {$classLocale['sys_hrs']}&nbsp;" : '') .
661
-    ($full || $minutes ? "{$minutes} {$classLocale['sys_min']}&nbsp;" : '') .
659
+    ($full || $time ? "{$time} {$classLocale['sys_day']}&nbsp;" : '').
660
+    ($full || $hours ? "{$hours} {$classLocale['sys_hrs']}&nbsp;" : '').
661
+    ($full || $minutes ? "{$minutes} {$classLocale['sys_min']}&nbsp;" : '').
662 662
     ($full || !$time || $seconds ? "{$seconds} {$classLocale['sys_sec']}" : '');
663 663
 }
664 664
 
665 665
 function sys_time_human_system($time) {
666
-  return $time ? date(FMT_DATE_TIME_SQL, $time) . " ({$time}), " . sys_time_human(SN_TIME_NOW - $time) : '{NEVER}';
666
+  return $time ? date(FMT_DATE_TIME_SQL, $time)." ({$time}), ".sys_time_human(SN_TIME_NOW - $time) : '{NEVER}';
667 667
 }
668 668
 
669 669
 function sys_redirect($url) {
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
       // usw..
757 757
     );
758 758
 
759
-    $rexep = "#" . strtr(preg_quote($format), $masks) . "#";
759
+    $rexep = "#".strtr(preg_quote($format), $masks)."#";
760 760
     if (preg_match($rexep, $date, $out)) {
761 761
       $ret = array(
762
-        "tm_sec"  => (int)$out['S'],
763
-        "tm_min"  => (int)$out['M'],
764
-        "tm_hour" => (int)$out['H'],
765
-        "tm_mday" => (int)$out['d'],
762
+        "tm_sec"  => (int) $out['S'],
763
+        "tm_min"  => (int) $out['M'],
764
+        "tm_hour" => (int) $out['H'],
765
+        "tm_mday" => (int) $out['d'],
766 766
         "tm_mon"  => $out['m'] ? $out['m'] - 1 : 0,
767 767
         "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
768 768
       );
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $functions[$function_name] = array();
833 833
       } elseif (!isset($functions[$function_name])) {
834 834
         $functions[$function_name] = array();
835
-        $sn_function_name = 'sn_' . $function_name . ($sub_type ? '_' . $sub_type : '');
835
+        $sn_function_name = 'sn_'.$function_name.($sub_type ? '_'.$sub_type : '');
836 836
         $functions[$function_name][] = $sn_function_name;
837 837
       }
838 838
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
   }
900 900
 
901 901
   if (isset($nick_array[NICK_GENDER])) {
902
-    $result[NICK_GENDER] = '<img src="' . ($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH) . 'images/gender_' . $nick_array[NICK_GENDER] . '.png" />';
902
+    $result[NICK_GENDER] = '<img src="'.($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH).'images/gender_'.$nick_array[NICK_GENDER].'.png" />';
903 903
   }
904 904
 
905 905
   if (isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) {
@@ -931,14 +931,14 @@  discard block
 block discarded – undo
931 931
   }
932 932
 
933 933
   if (isset($nick_array[NICK_CLASS])) {
934
-    $result[NICK_CLASS] = '<span ' . $nick_array[NICK_CLASS] . '>';
934
+    $result[NICK_CLASS] = '<span '.$nick_array[NICK_CLASS].'>';
935 935
     $result[NICK_CLASS_END] = '</span>';
936 936
   }
937 937
 
938 938
   $result[NICK_NICK] = sys_safe_output($nick_array[NICK_NICK]);
939 939
 
940 940
   if (isset($nick_array[NICK_ALLY])) {
941
-    $result[NICK_ALLY] = '[' . sys_safe_output($nick_array[NICK_ALLY]) . ']';
941
+    $result[NICK_ALLY] = '['.sys_safe_output($nick_array[NICK_ALLY]).']';
942 942
   }
943 943
 
944 944
   $result[NICK_HTML] = true;
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
   */
962 962
 
963 963
 
964
-  if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
964
+  if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW).date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
965 965
     $result[NICK_BIRTHSDAY] = '';
966 966
   }
967 967
 
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
   }
984 984
 
985 985
   if ((isset($options['class']) && $options['class'])) {
986
-    $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' ' . $result_options[NICK_CLASS] : '') . $options['class'];
986
+    $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' '.$result_options[NICK_CLASS] : '').$options['class'];
987 987
   }
988 988
 
989 989
   if ($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) {
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
     foreach ($temp as $user_id) {
1012 1012
       $user_id = floatval($user_id);
1013 1013
       if ($user_id) {
1014
-        $user_skip_list[] = '`id` = ' . $user_id;
1014
+        $user_skip_list[] = '`id` = '.$user_id;
1015 1015
       }
1016 1016
     }
1017 1017
   }
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
     $time_left = min(floor($time_left / PERIOD_DAY), $term_original);
1411 1411
     $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0;
1412 1412
 
1413
-    array_walk_recursive($result, function (&$value) use ($cost_left) {
1413
+    array_walk_recursive($result, function(&$value) use ($cost_left) {
1414 1414
       $value -= $cost_left;
1415 1415
     });
1416 1416
   }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 }
1466 1466
 
1467 1467
 function print_rr($var, $capture = false) {
1468
-  $print = '<pre>' . htmlspecialchars(print_r($var, true)) . '</pre>';
1468
+  $print = '<pre>'.htmlspecialchars(print_r($var, true)).'</pre>';
1469 1469
   if ($capture) {
1470 1470
     return $print;
1471 1471
   } else {
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
       break;
1568 1568
     }
1569 1569
     $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1;
1570
-    usort($ListToSort, function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
1570
+    usort($ListToSort, function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
1571 1571
       return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : (
1572 1572
       $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0
1573 1573
       );
Please login to merge, or discard this patch.
Doc Comments   +34 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 require_once('general_pname.php');
13 13
 
14 14
 /**
15
- * @param       $func_name
15
+ * @param       string $func_name
16 16
  * @param array $func_arg
17 17
  *
18 18
  * @return mixed
@@ -63,6 +63,9 @@  discard block
 block discarded – undo
63 63
 }
64 64
 
65 65
 // ----------------------------------------------------------------------------------------------------------------
66
+/**
67
+ * @param string $filename
68
+ */
66 69
 function sys_file_read($filename) {
67 70
   return @file_get_contents($filename);
68 71
 }
@@ -105,7 +108,7 @@  discard block
 block discarded – undo
105 108
 /**
106 109
  * Получение курса обмены валюты в серверную валюту
107 110
  *
108
- * @param $currency_symbol
111
+ * @param string $currency_symbol
109 112
  *
110 113
  * @return float
111 114
  */
@@ -146,7 +149,7 @@  discard block
 block discarded – undo
146 149
  * @param float     $n
147 150
  * @param int|bool  $floor
148 151
  * @param int|bool  $color
149
- * @param int|bool  $limit
152
+ * @param boolean  $limit
150 153
  * @param bool|null $style
151 154
  *
152 155
  * @return array|float|string
@@ -239,6 +242,9 @@  discard block
 block discarded – undo
239 242
   return preg_replace($ListCensure, '*', $String);
240 243
 }
241 244
 
245
+/**
246
+ * @param string $email
247
+ */
242 248
 function is_email($email) {
243 249
   return (preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email));
244 250
 }
@@ -276,6 +282,9 @@  discard block
 block discarded – undo
276 282
   return floatval(sys_get_param($param_name, $default));
277 283
 }
278 284
 
285
+/**
286
+ * @param string $param_name
287
+ */
279 288
 function sys_get_param_escaped($param_name, $default = '') {
280 289
   return db_escape(sys_get_param($param_name, $default));
281 290
 }
@@ -444,6 +453,9 @@  discard block
 block discarded – undo
444 453
 }
445 454
 
446 455
 // Generates random string of $length symbols from $allowed_chars charset
456
+/**
457
+ * @param string $allowed_chars
458
+ */
447 459
 function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) {
448 460
   $allowed_length = strlen($allowed_chars);
449 461
 
@@ -548,6 +560,10 @@  discard block
 block discarded – undo
548 560
   return implode(';', $fleet_string);
549 561
 }
550 562
 
563
+/**
564
+ * @param string $title
565
+ * @param string $body
566
+ */
551 567
 function mymail($email_unsafe, $title, $body, $from = '', $html = false) {
552 568
   $from = trim($from ? $from : classSupernova::$config->game_adminEmail);
553 569
 
@@ -808,6 +824,9 @@  discard block
 block discarded – undo
808 824
   return serialize($nick_array);
809 825
 }
810 826
 
827
+/**
828
+ * @param string $nick_string
829
+ */
811 830
 function player_nick_uncompact($nick_string) {
812 831
   try {
813 832
     $result = unserialize($nick_string);
@@ -987,6 +1006,9 @@  discard block
 block discarded – undo
987 1006
   return $result;
988 1007
 }
989 1008
 
1009
+/**
1010
+ * @param string $groups
1011
+ */
990 1012
 function isInGroup($groups, $unitId) {
991 1013
   $group = sn_get_groups($groups);
992 1014
   return !empty($group[$unitId]);
@@ -1054,6 +1076,9 @@  discard block
 block discarded – undo
1054 1076
   return $ranks;
1055 1077
 }
1056 1078
 
1079
+/**
1080
+ * @param boolean $planet_id
1081
+ */
1057 1082
 function sys_player_new_adjust($user_id, $planet_id) { return sn_function_call(__FUNCTION__, array($user_id, $planet_id, &$result)); }
1058 1083
 
1059 1084
 function sn_sys_player_new_adjust($user_id, $planet_id, &$result) {
@@ -1204,6 +1229,9 @@  discard block
 block discarded – undo
1204 1229
   return $rates;
1205 1230
 }
1206 1231
 
1232
+/**
1233
+ * @param integer $in_resource
1234
+ */
1207 1235
 function get_unit_cost_in(&$cost, $in_resource = RES_METAL) {
1208 1236
   static $rates;
1209 1237
 
@@ -1370,6 +1398,9 @@  discard block
 block discarded – undo
1370 1398
   return version_compare(sn_version_compare_extra($ver1), sn_version_compare_extra($ver2));
1371 1399
 }
1372 1400
 
1401
+/**
1402
+ * @param string $name
1403
+ */
1373 1404
 function sn_setcookie($name, $value = null, $expire = null, $path = SN_ROOT_RELATIVE, $domain = null, $secure = null, $httponly = null) {
1374 1405
   $_COOKIE[$name] = $value;
1375 1406
 
Please login to merge, or discard this patch.
officer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $template = gettemplate('viewreport', true);
6 6
 $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']);
Please login to merge, or discard this patch.
logout.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $template = gettemplate('viewreport', true);
6 6
 $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']);
Please login to merge, or discard this patch.
admin/adm_metamatter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
 define('INSTALL', false);
14 14
 define('IN_ADMIN', true);
15 15
 
16
-require('../common.' . substr(strrchr(__FILE__, '.'), 1));
16
+require('../common.'.substr(strrchr(__FILE__, '.'), 1));
17 17
 
18 18
 if (!sn_module_get_active_count('payment')) {
19
-  sys_redirect(SN_ROOT_VIRTUAL . 'admin/overview.php');
19
+  sys_redirect(SN_ROOT_VIRTUAL.'admin/overview.php');
20 20
 }
21 21
 
22 22
 if ($user['authlevel'] < 3) {
Please login to merge, or discard this patch.
server_info.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $template = gettemplate('viewreport', true);
6 6
 $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']);
Please login to merge, or discard this patch.
includes/functions/int_banner_create.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
       $img_name = classSupernova::$config->int_userbar_background;
25 25
     break;
26 26
   }
27
-  $size = getimagesize(SN_ROOT_PHYSICAL . $img_name);
28
-  $im = imagecreatefrompng(SN_ROOT_PHYSICAL . $img_name);
27
+  $size = getimagesize(SN_ROOT_PHYSICAL.$img_name);
28
+  $im = imagecreatefrompng(SN_ROOT_PHYSICAL.$img_name);
29 29
   $image = imagecreatetruecolor($size[0], $size[1]);
30 30
   imagecopy($image, $im, 0, 0, 0, 0, $size[0], $size[1]);
31 31
   imagedestroy($im);
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
   $txt_color2 = imagecolorallocatealpha($image, 255, 255, 255, 40);
38 38
 
39 39
   $fonts = array(
40
-    'userbar'  => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_userbar_font,
41
-    'universe' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontUniverse,
42
-    'raids'    => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontRaids,
43
-    'info'     => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontInfo,
40
+    'userbar'  => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_userbar_font,
41
+    'universe' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontUniverse,
42
+    'raids'    => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontRaids,
43
+    'info'     => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontInfo,
44 44
   );
45 45
 
46 46
   if ($id) {
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     $b_user = $user['username'];
53 53
     $b_ally = $user['ally_name'];
54 54
     $b_planet = $planet_row['name'];
55
-    $b_xyz = "[" . $planet_row['galaxy'] . ":" . $planet_row['system'] . ":" . $planet_row['planet'] . "]";
56
-    $b_lvl = ($user['total_rank'] ? $user['total_rank'] : classSupernova::$config->users_amount) . "/" . classSupernova::$config->users_amount;
55
+    $b_xyz = "[".$planet_row['galaxy'].":".$planet_row['system'].":".$planet_row['planet']."]";
56
+    $b_lvl = ($user['total_rank'] ? $user['total_rank'] : classSupernova::$config->users_amount)."/".classSupernova::$config->users_amount;
57 57
   } else {
58 58
     $b_user = classLocale::$lang['ov_banner_empty_id'];
59 59
     $b_lvl = '';
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
         imagettftext($image, 9, 0, 410 - $is[2], 35, $txt_color, $fonts['info'], $b_ally);
89 89
 
90 90
         // Player b_planet
91
-        imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet . " " . $b_xyz);
92
-        imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet . " " . $b_xyz);
91
+        imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet." ".$b_xyz);
92
+        imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet." ".$b_xyz);
93 93
 
94 94
         //StatPoint
95
-        $b_points = classLocale::$lang['ov_points'] . ": " . pretty_number(!empty($user['total_points']) ? $user['total_points'] : 0);
95
+        $b_points = classLocale::$lang['ov_points'].": ".pretty_number(!empty($user['total_points']) ? $user['total_points'] : 0);
96 96
         $is = imagettfbbox(8, 0, $fonts['info'], $b_points);
97 97
         imagettftext($image, 8, 0, 412 - $is[2], 11, $txt_shadow, $fonts['info'], $b_points);
98 98
         imagettftext($image, 8, 0, 410 - $is[2], 9, $txt_color, $fonts['info'], $b_points);
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
         //Raids Total
101 101
         imagettftext($image, 6, 0, 8, 37, $txt_shadow2, $fonts['raids'], classLocale::$lang['NumberOfRaids']);
102 102
         imagettftext($image, 6, 0, 6, 35, $txt_color2, $fonts['raids'], classLocale::$lang['NumberOfRaids']);
103
-        $b_points = ": " . pretty_number(!empty($user['raids']) ? $user['raids'] : 0);
103
+        $b_points = ": ".pretty_number(!empty($user['raids']) ? $user['raids'] : 0);
104 104
         imagettftext($image, 6, 0, 61, 37, $txt_shadow2, $fonts['raids'], $b_points);
105 105
         imagettftext($image, 6, 0, 59, 35, $txt_color2, $fonts['raids'], $b_points);
106 106
 
107 107
         //Raids Won
108 108
         imagettftext($image, 6, 0, 8, 47, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsWin']);
109 109
         imagettftext($image, 6, 0, 6, 45, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsWin']);
110
-        $b_points = ": " . pretty_number(!empty($user['raidswin']) ? $user['raidswin'] : 0);
110
+        $b_points = ": ".pretty_number(!empty($user['raidswin']) ? $user['raidswin'] : 0);
111 111
         imagettftext($image, 6, 0, 61, 47, $txt_shadow2, $fonts['raids'], $b_points);
112 112
         imagettftext($image, 6, 0, 59, 45, $txt_color2, $fonts['raids'], $b_points);
113 113
 
114 114
         //Raids Lost
115 115
         imagettftext($image, 6, 0, 8, 57, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsLoose']);
116 116
         imagettftext($image, 6, 0, 6, 55, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsLoose']);
117
-        $b_points = ": " . pretty_number(!empty($user['raidsloose']) ? $user['raidsloose'] : 0);
117
+        $b_points = ": ".pretty_number(!empty($user['raidsloose']) ? $user['raidsloose'] : 0);
118 118
         imagettftext($image, 6, 0, 61, 57, $txt_shadow2, $fonts['raids'], $b_points);
119 119
         imagettftext($image, 6, 0, 59, 55, $txt_color2, $fonts['raids'], $b_points);
120 120
       }
Please login to merge, or discard this patch.
includes/includes/eco_bld_structures.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
     }
69 69
     $build_unit_list = sn_get_groups('tech');
70 70
     $artifact_id = ART_HEURISTIC_CHIP;
71
-    $page_header = classLocale::$lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? "&nbsp;{$classLocale['sys_of_ally']}&nbsp;{$user['username']}" : '');
71
+    $page_header = classLocale::$lang['tech'][UNIT_TECHNOLOGIES].($user['user_as_ally'] ? "&nbsp;{$classLocale['sys_of_ally']}&nbsp;{$user['username']}" : '');
72 72
   } elseif ($que_type == QUE_MERCENARY) {
73 73
     $build_unit_list = sn_get_groups('mercenaries');
74 74
     $artifact_id = 0;
75
-    $page_header = classLocale::$lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? "&nbsp;{$classLocale['sys_of_ally']}&nbsp;{$user['username']}" : '');
75
+    $page_header = classLocale::$lang['tech'][UNIT_MERCENARIES].($user['user_as_ally'] ? "&nbsp;{$classLocale['sys_of_ally']}&nbsp;{$user['username']}" : '');
76 76
   } else {
77 77
     if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
78 78
       message(classLocale::$lang['need_hangar'], classLocale::$lang['tech'][STRUC_FACTORY_HANGAR]);
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
               * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
246 246
               * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
247 247
           ) {
248
-            $level_production_base['R' . $resource_id] = $resource_income;
248
+            $level_production_base['R'.$resource_id] = $resource_income;
249 249
           }
250 250
         }
251 251
       }
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
             * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
273 273
             * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
274 274
           ) {
275
-            $level_production['R' . $resource_id] = $resource_income;
276
-            $level_production['D' . $resource_id] = $resource_income - $level_production_base[$resource_id];
275
+            $level_production['R'.$resource_id] = $resource_income;
276
+            $level_production['D'.$resource_id] = $resource_income - $level_production_base[$resource_id];
277 277
           }
278 278
         }
279 279
         $production['.']['resource'][] = $level_production;
@@ -288,15 +288,15 @@  discard block
 block discarded – undo
288 288
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
289 289
       for ($i = 0; $i < 6; $i++) {
290 290
         $level_production = array('LEVEL' => $level_start + $i);
291
-        $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i);
292
-        $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX];
293
-        $level_production['R' . UNIT_PLAYER_COLONIES_MAX] = get_player_max_colonies($user, $level_start + $i);
294
-        $level_production['D' . UNIT_PLAYER_COLONIES_MAX] = $level_production['R' . UNIT_PLAYER_COLONIES_MAX] - $level_production_base[UNIT_PLAYER_COLONIES_MAX];
291
+        $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i);
292
+        $level_production['D'.UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX];
293
+        $level_production['R'.UNIT_PLAYER_COLONIES_MAX] = get_player_max_colonies($user, $level_start + $i);
294
+        $level_production['D'.UNIT_PLAYER_COLONIES_MAX] = $level_production['R'.UNIT_PLAYER_COLONIES_MAX] - $level_production_base[UNIT_PLAYER_COLONIES_MAX];
295 295
         $production['.']['resource'][] = $level_production;
296 296
 
297 297
         $level_production_base = array(
298
-          UNIT_PLAYER_EXPEDITIONS_MAX => $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX],
299
-          UNIT_PLAYER_COLONIES_MAX    => $level_production['R' . UNIT_PLAYER_COLONIES_MAX],
298
+          UNIT_PLAYER_EXPEDITIONS_MAX => $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX],
299
+          UNIT_PLAYER_COLONIES_MAX    => $level_production['R'.UNIT_PLAYER_COLONIES_MAX],
300 300
         );
301 301
       }
302 302
     }
Please login to merge, or discard this patch.
flotenajax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $template = gettemplate('viewreport', true);
6 6
 $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']);
Please login to merge, or discard this patch.
includes/classes/auth_local.php 2 patches
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
     $this->prepare();
94 94
 
95 95
     $this->manifest['active'] = false;
96
-    if(!empty($this->config) && is_array($this->config['db'])) {
96
+    if (!empty($this->config) && is_array($this->config['db'])) {
97 97
       // БД, отличная от стандартной
98 98
       $this->db = new db_mysql();
99 99
 
100 100
       $this->db->sn_db_connect($this->config['db']);
101
-      if($this->manifest['active'] = $this->db->connected) {
101
+      if ($this->manifest['active'] = $this->db->connected) {
102 102
         $this->provider_id = ACCOUNT_PROVIDER_CENTRAL;
103 103
 
104 104
         $this->domain = $this->config['domain'];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     }
113 113
 
114 114
     // Fallback to local DB
115
-    if(!$this->manifest['active']) {
115
+    if (!$this->manifest['active']) {
116 116
       $this->db = classSupernova::$db;
117 117
 
118 118
       $this->provider_id = ACCOUNT_PROVIDER_LOCAL;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
       $this->manifest['active'] = true;
126 126
     }
127 127
 
128
-    $this->cookie_name_impersonate = $this->cookie_name . AUTH_COOKIE_IMPERSONATE_SUFFIX;
128
+    $this->cookie_name_impersonate = $this->cookie_name.AUTH_COOKIE_IMPERSONATE_SUFFIX;
129 129
 
130 130
     $this->account = new Account($this->db);
131 131
     $this->confirmation = new Confirmation($this->db);
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
   // OK v4.5
167 167
   public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) {
168 168
     $result = parent::password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe);
169
-    if($result) {
169
+    if ($result) {
170 170
       $this->cookie_set();
171 171
     }
172 172
 
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
    */
195 195
   // OK v4.6
196 196
   protected function password_reset_send_code() {
197
-    if(!$this->is_password_reset) {
197
+    if (!$this->is_password_reset) {
198 198
       return $this->account_login_status;
199 199
     }
200 200
 
201 201
     // Проверяем поддержку сброса пароля
202
-    if(!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) {
202
+    if (!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) {
203 203
       return $this->account_login_status;
204 204
     }
205 205
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
       unset($this->account);
210 210
       $this->account = new Account($this->db);
211 211
 
212
-      if(!$this->account->db_get_by_email($email_unsafe)) {
212
+      if (!$this->account->db_get_by_email($email_unsafe)) {
213 213
         throw new Exception(PASSWORD_RESTORE_ERROR_EMAIL_NOT_EXISTS, ERR_ERROR);
214 214
         // return $this->account_login_status;
215 215
       }
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
 
220 220
       // TODO - Проверять уровень доступа аккаунта!
221 221
       // Аккаунты с АУТЛЕВЕЛ больше 0 - НЕ СБРАСЫВАЮТ ПАРОЛИ!
222
-      foreach($user_list as $user_id => $user_data) {
223
-        if($user_data['authlevel'] > AUTH_LEVEL_REGISTERED) {
222
+      foreach ($user_list as $user_id => $user_data) {
223
+        if ($user_data['authlevel'] > AUTH_LEVEL_REGISTERED) {
224 224
           throw new Exception(PASSWORD_RESTORE_ERROR_ADMIN_ACCOUNT, ERR_ERROR);
225 225
         }
226 226
       }
227 227
 
228 228
       $confirmation = $this->confirmation->db_confirmation_get_latest_by_type_and_email(CONFIRM_PASSWORD_RESET, $email_unsafe); // OK 4.5
229
-      if(isset($confirmation['create_time']) && SN_TIME_NOW - strtotime($confirmation['create_time']) < PERIOD_MINUTE_10) {
229
+      if (isset($confirmation['create_time']) && SN_TIME_NOW - strtotime($confirmation['create_time']) < PERIOD_MINUTE_10) {
230 230
         throw new Exception(PASSWORD_RESTORE_ERROR_TOO_OFTEN, ERR_ERROR);
231 231
       }
232 232
 
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 
240 240
       @$result = mymail($email_unsafe,
241 241
         sprintf(classLocale::$lang['log_lost_email_title'], classSupernova::$config->game_name),
242
-        sprintf(classLocale::$lang['log_lost_email_code'], SN_ROOT_VIRTUAL . 'login.php', $confirm_code_unsafe, date(FMT_DATE_TIME, SN_TIME_NOW + AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE), classSupernova::$config->game_name)
242
+        sprintf(classLocale::$lang['log_lost_email_code'], SN_ROOT_VIRTUAL.'login.php', $confirm_code_unsafe, date(FMT_DATE_TIME, SN_TIME_NOW + AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE), classSupernova::$config->game_name)
243 243
       );
244 244
 
245 245
       $result = $result ? PASSWORD_RESTORE_SUCCESS_CODE_SENT : PASSWORD_RESTORE_ERROR_SENDING;
246
-    } catch(Exception $e) {
246
+    } catch (Exception $e) {
247 247
       sn_db_transaction_rollback();
248 248
       $result = $e->getMessage();
249 249
     }
@@ -256,46 +256,46 @@  discard block
 block discarded – undo
256 256
    * @return int|string
257 257
    */
258 258
   protected function password_reset_confirm() {
259
-    if(!$this->is_password_reset_confirm) {
259
+    if (!$this->is_password_reset_confirm) {
260 260
       return $this->account_login_status;
261 261
     }
262 262
 
263
-    if($this->account_login_status != LOGIN_UNDEFINED) {
263
+    if ($this->account_login_status != LOGIN_UNDEFINED) {
264 264
       return $this->account_login_status;
265 265
     }
266 266
 
267 267
     // Проверяем поддержку сброса пароля
268
-    if(!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) {
268
+    if (!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) {
269 269
       return $this->account_login_status;
270 270
     }
271 271
 
272 272
     try {
273 273
       $code_unsafe = sys_get_param_str_unsafe('password_reset_code');
274
-      if(empty($code_unsafe)) {
274
+      if (empty($code_unsafe)) {
275 275
         throw new Exception(PASSWORD_RESTORE_ERROR_CODE_EMPTY, ERR_ERROR);
276 276
       }
277 277
 
278 278
       sn_db_transaction_start();
279 279
       $confirmation = $this->confirmation->db_confirmation_get_by_type_and_code(CONFIRM_PASSWORD_RESET, $code_unsafe); // OK 4.5
280 280
 
281
-      if(empty($confirmation)) {
281
+      if (empty($confirmation)) {
282 282
         throw new Exception(PASSWORD_RESTORE_ERROR_CODE_WRONG, ERR_ERROR);
283 283
       }
284 284
 
285
-      if(SN_TIME_NOW - strtotime($confirmation['create_time']) > AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE) {
285
+      if (SN_TIME_NOW - strtotime($confirmation['create_time']) > AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE) {
286 286
         throw new Exception(PASSWORD_RESTORE_ERROR_CODE_TOO_OLD, ERR_ERROR);
287 287
       }
288 288
 
289 289
       unset($this->account);
290 290
       $this->account = new Account($this->db);
291 291
 
292
-      if(!$this->account->db_get_by_email($confirmation['email'])) {
292
+      if (!$this->account->db_get_by_email($confirmation['email'])) {
293 293
         throw new Exception(PASSWORD_RESTORE_ERROR_CODE_OK_BUT_NO_ACCOUNT_FOR_EMAIL, ERR_ERROR);
294 294
       }
295 295
 
296 296
       $new_password_unsafe = $this->make_random_password();
297 297
       $salt_unsafe = $this->password_salt_generate();
298
-      if(!$this->account->db_set_password($new_password_unsafe, $salt_unsafe)) {
298
+      if (!$this->account->db_set_password($new_password_unsafe, $salt_unsafe)) {
299 299
         // Ошибка смены пароля
300 300
         throw new Exception(AUTH_ERROR_INTERNAL_PASSWORD_CHANGE_ON_RESTORE, ERR_ERROR);
301 301
       }
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
       $this->cookie_set();
306 306
       $this->login_cookie();
307 307
 
308
-      if($this->account_login_status == LOGIN_SUCCESS) {
308
+      if ($this->account_login_status == LOGIN_SUCCESS) {
309 309
         // TODO - НЕ ОБЯЗАТЕЛЬНО ОТПРАВЛЯТЬ ЧЕРЕЗ ЕМЕЙЛ! ЕСЛИ ЭТО ФЕЙСБУЧЕК ИЛИ ВКШЕЧКА - МОЖНО ЧЕРЕЗ ЛС ПИСАТЬ!!
310 310
         $message_header = sprintf(classLocale::$lang['log_lost_email_title'], classSupernova::$config->game_name);
311 311
         $message = sprintf(classLocale::$lang['log_lost_email_pass'], classSupernova::$config->game_name, $this->account->account_name, $new_password_unsafe);
312 312
         @$operation_result = mymail($confirmation['email'], $message_header, htmlspecialchars($message));
313 313
 
314 314
         $users_translated = PlayerToAccountTranslate::db_translate_get_users_from_account_list($this->provider_id, $this->account->account_id); // OK 4.5
315
-        if(!empty($users_translated)) {
315
+        if (!empty($users_translated)) {
316 316
           // Отправляем в лички письмо о сбросе пароля
317 317
 
318 318
           // ПО ОПРЕДЕЛЕНИЮ в $users_translated только
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
           //    - игроки, привязанные только к этим аккаунтам
322 322
           // Значит им всем сразу скопом можно отправлять сообщения
323 323
           $message = sprintf(classLocale::$lang['sys_password_reset_message_body'], $new_password_unsafe);
324
-          $message = sys_bbcodeParse($message) . '<br><br>';
324
+          $message = sys_bbcodeParse($message).'<br><br>';
325 325
 
326
-          foreach($users_translated as $user_id => $providers_list) {
326
+          foreach ($users_translated as $user_id => $providers_list) {
327 327
             msg_send_simple_message($user_id, 0, SN_TIME_NOW, MSG_TYPE_ADMIN, classLocale::$lang['sys_administration'], classLocale::$lang['sys_login_register_message_title'], $message);
328 328
           }
329 329
         } else {
@@ -375,10 +375,10 @@  discard block
 block discarded – undo
375 375
   // OK v4.5
376 376
   protected function register() {
377 377
     // TODO РЕГИСТРАЦИЯ ВСЕГДА ДОЛЖНА ЛОГИНИТЬ ПОЛЬЗОВАТЕЛЯ!
378
-    $this->flog('Регистрация: начинаем. Провайдер ' . $this->provider_id);
378
+    $this->flog('Регистрация: начинаем. Провайдер '.$this->provider_id);
379 379
 
380 380
     try {
381
-      if(!$this->is_register) {
381
+      if (!$this->is_register) {
382 382
         $this->flog('Регистрация: не выставлен флаг регистрации - пропускаем');
383 383
         throw new Exception(LOGIN_UNDEFINED, ERR_ERROR);
384 384
       }
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
       sn_db_transaction_start();
389 389
 
390 390
       $this->account->db_get_by_name_or_email($this->input_login_unsafe, $this->input_email_unsafe);
391
-      if($this->account->is_exists) {
392
-        if($this->account->account_email == $this->input_email_unsafe) {
391
+      if ($this->account->is_exists) {
392
+        if ($this->account->account_email == $this->input_email_unsafe) {
393 393
           throw new Exception(REGISTER_ERROR_EMAIL_EXISTS, ERR_ERROR);
394 394
         } else {
395 395
           throw new Exception(REGISTER_ERROR_ACCOUNT_NAME_EXISTS, ERR_ERROR);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
       // А вот это пока не нужно. Трансляцией аккаунтов в юзеров и созданием новых юзеров для новозашедших аккаунтов занимается Auth
412 412
       // $this->register_account();
413 413
       sn_db_transaction_commit();
414
-    } catch(Exception $e) {
414
+    } catch (Exception $e) {
415 415
       sn_db_transaction_rollback();
416 416
       $this->account_login_status == LOGIN_UNDEFINED ? $this->account_login_status = $e->getMessage() : false;
417 417
     }
@@ -427,19 +427,19 @@  discard block
 block discarded – undo
427 427
    */
428 428
   // OK v4.5
429 429
   protected function login_cookie() {
430
-    if($this->account_login_status != LOGIN_UNDEFINED) {
430
+    if ($this->account_login_status != LOGIN_UNDEFINED) {
431 431
       return $this->account_login_status;
432 432
     }
433 433
 
434 434
     // Пытаемся войти по куке
435
-    if(!empty($_COOKIE[$this->cookie_name])) {
436
-      if(count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) {
435
+    if (!empty($_COOKIE[$this->cookie_name])) {
436
+      if (count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) {
437 437
         list($account_id_unsafe, $cookie_password_hash_salted, $user_remember_me) = explode(AUTH_COOKIE_DELIMETER, $_COOKIE[$this->cookie_name]);
438 438
       } else {
439 439
         list($account_id_unsafe, $user_name, $cookie_password_hash_salted, $user_remember_me) = explode("/%/", $_COOKIE[$this->cookie_name]);
440 440
       }
441 441
 
442
-      if(
442
+      if (
443 443
         $this->account->db_get_by_id($account_id_unsafe)
444 444
         && ($this->password_encode_for_cookie($this->account->account_password) == $cookie_password_hash_salted)
445 445
       ) {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
       }
449 449
     }
450 450
 
451
-    if($this->account_login_status != LOGIN_SUCCESS) {
451
+    if ($this->account_login_status != LOGIN_SUCCESS) {
452 452
       // Невалидная кука - чистим
453 453
       $this->cookie_clear();
454 454
     }
@@ -466,29 +466,29 @@  discard block
 block discarded – undo
466 466
   protected function login_username() {
467 467
     // TODO - Логин по старым именам
468 468
     try {
469
-      if(!$this->is_login) {
469
+      if (!$this->is_login) {
470 470
         $this->flog('Логин: не выставлен флаг входа в игру - это не логин');
471 471
         throw new Exception(LOGIN_UNDEFINED, ERR_ERROR);
472 472
       }
473 473
 
474 474
       // TODO Пустое имя аккаунта
475
-      if(!$this->input_login_unsafe) {
475
+      if (!$this->input_login_unsafe) {
476 476
         throw new Exception(LOGIN_UNDEFINED, ERR_ERROR);
477 477
       }
478 478
 
479 479
       $this->login_validate_input();
480 480
 
481
-      if(!$this->account->db_get_by_name($this->input_login_unsafe) && !$this->account->db_get_by_email($this->input_login_unsafe)) {
481
+      if (!$this->account->db_get_by_name($this->input_login_unsafe) && !$this->account->db_get_by_email($this->input_login_unsafe)) {
482 482
         throw new Exception(LOGIN_ERROR_USERNAME, ERR_ERROR);
483 483
       }
484 484
 
485
-      if(!$this->account->password_check($this->input_login_password_raw)) {
485
+      if (!$this->account->password_check($this->input_login_password_raw)) {
486 486
         throw new Exception(LOGIN_ERROR_PASSWORD, ERR_ERROR);
487 487
       }
488 488
 
489 489
       $this->cookie_set();
490 490
       $this->account_login_status = LOGIN_SUCCESS;
491
-    } catch(Exception $e) {
491
+    } catch (Exception $e) {
492 492
       $this->account_login_status == LOGIN_UNDEFINED ? $this->account_login_status = $e->getMessage() : false;
493 493
     }
494 494
 
@@ -510,18 +510,18 @@  discard block
 block discarded – undo
510 510
   protected function cookie_set($account_to_impersonate = null) {
511 511
     $this_account = is_object($account_to_impersonate) ? $account_to_impersonate : $this->account;
512 512
 
513
-    if(!is_object($this_account) || !$this_account->is_exists) {
513
+    if (!is_object($this_account) || !$this_account->is_exists) {
514 514
       throw new Exception(LOGIN_ERROR_NO_ACCOUNT_FOR_COOKIE_SET, ERR_ERROR);
515 515
     }
516 516
 
517
-    if(is_object($account_to_impersonate) && $account_to_impersonate->is_exists) {
517
+    if (is_object($account_to_impersonate) && $account_to_impersonate->is_exists) {
518 518
       sn_setcookie($this->cookie_name_impersonate, $_COOKIE[$this->cookie_name], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $this->domain);
519 519
     }
520 520
 
521 521
     $expire_time = $this->remember_me ? SN_TIME_NOW + PERIOD_YEAR : 0;
522 522
 
523 523
     $password_encoded = $this->password_encode_for_cookie($this_account->account_password);
524
-    $cookie = $this_account->account_id . AUTH_COOKIE_DELIMETER . $password_encoded . AUTH_COOKIE_DELIMETER . $this->remember_me;
524
+    $cookie = $this_account->account_id.AUTH_COOKIE_DELIMETER.$password_encoded.AUTH_COOKIE_DELIMETER.$this->remember_me;
525 525
     $this->flog("cookie_set() - Устанавливаем куку {$cookie}");
526 526
     return sn_setcookie($this->cookie_name, $cookie, $expire_time, $this->sn_root_path, $this->domain);
527 527
   }
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
   // OK v4.1
533 533
   protected function cookie_clear() {
534 534
     // Автоматически вообще-то - если установлена кука имперсонатора - то чистим обычную, а куку имперсонатора - копируем в неё
535
-    if(!empty($_COOKIE[$this->cookie_name_impersonate])) {
535
+    if (!empty($_COOKIE[$this->cookie_name_impersonate])) {
536 536
       sn_setcookie($this->cookie_name, $_COOKIE[$this->cookie_name_impersonate], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $this->domain);
537 537
       sn_setcookie($this->cookie_name_impersonate, '', SN_TIME_NOW - PERIOD_WEEK, $this->sn_root_path, $this->domain);
538 538
     } else {
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
   protected function login_validate_input() {
552 552
     // Проверяем, что бы в начале и конце не было пустых символов
553 553
     // TODO - при копировании Эксель -> Опера - в конце образуются пустые места. Это не должно быть проблемой! Вынести проверку пароля в регистрацию!
554
-    if($this->input_login_password_raw != trim($this->input_login_password_raw)) {
554
+    if ($this->input_login_password_raw != trim($this->input_login_password_raw)) {
555 555
       throw new Exception(LOGIN_ERROR_PASSWORD_TRIMMED, ERR_ERROR);
556 556
     }
557
-    if(!$this->input_login_password_raw) {
557
+    if (!$this->input_login_password_raw) {
558 558
       throw new Exception(LOGIN_ERROR_PASSWORD_EMPTY, ERR_ERROR);
559 559
     }
560 560
   }
@@ -570,37 +570,37 @@  discard block
 block discarded – undo
570 570
     $this->login_validate_input();
571 571
 
572 572
     // Если нет имени пользователя - NO GO!
573
-    if(!$this->input_login_unsafe) {
573
+    if (!$this->input_login_unsafe) {
574 574
       throw new Exception(LOGIN_ERROR_USERNAME_EMPTY, ERR_ERROR);
575 575
     }
576 576
     // Если логин имеет запрещенные символы - NO GO!
577
-    if(strpbrk($this->input_login_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
577
+    if (strpbrk($this->input_login_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
578 578
       throw new Exception(LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS, ERR_ERROR);
579 579
     }
580 580
     // Если логин меньше минимальной длины - NO GO!
581
-    if(strlen($this->input_login_unsafe) < LOGIN_LENGTH_MIN) {
581
+    if (strlen($this->input_login_unsafe) < LOGIN_LENGTH_MIN) {
582 582
       throw new Exception(REGISTER_ERROR_USERNAME_SHORT, ERR_ERROR);
583 583
     }
584 584
     // Если пароль меньше минимальной длины - NO GO!
585
-    if(strlen($this->input_login_password_raw) < PASSWORD_LENGTH_MIN) {
585
+    if (strlen($this->input_login_password_raw) < PASSWORD_LENGTH_MIN) {
586 586
       throw new Exception(REGISTER_ERROR_PASSWORD_INSECURE, ERR_ERROR);
587 587
     }
588 588
     // Если пароль имеет пробельные символы в начале или конце - NO GO!
589
-    if($this->input_login_password_raw != trim($this->input_login_password_raw)) {
589
+    if ($this->input_login_password_raw != trim($this->input_login_password_raw)) {
590 590
       throw new Exception(LOGIN_ERROR_PASSWORD_TRIMMED, ERR_ERROR);
591 591
     }
592 592
     // Если пароль не совпадает с подтверждением - NO GO! То, что у пароля нет пробельных символов в начале/конце - мы уже проверили выше
593 593
     //Если они есть у повтора - значит пароль и повтор не совпадут
594
-    if($this->input_login_password_raw <> $this->input_login_password_raw_repeat) {
594
+    if ($this->input_login_password_raw <> $this->input_login_password_raw_repeat) {
595 595
       throw new Exception(REGISTER_ERROR_PASSWORD_DIFFERENT, ERR_ERROR);
596 596
     }
597 597
     // Если нет емейла - NO GO!
598 598
     // TODO - регистрация без емейла
599
-    if(!$this->input_email_unsafe) {
599
+    if (!$this->input_email_unsafe) {
600 600
       throw new Exception(REGISTER_ERROR_EMAIL_EMPTY, ERR_ERROR);
601 601
     }
602 602
     // Если емейл не является емейлом - NO GO!
603
-    if(!is_email($this->input_email_unsafe)) {
603
+    if (!is_email($this->input_email_unsafe)) {
604 604
       throw new Exception(REGISTER_ERROR_EMAIL_WRONG, ERR_ERROR);
605 605
     }
606 606
   }
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 
610 610
   // OK v4
611 611
   protected function password_encode_for_cookie($password) {
612
-    return md5("{$password}--" . $this->secret_word);
612
+    return md5("{$password}--".$this->secret_word);
613 613
   }
614 614
   // OK v4
615 615
   protected function password_encode($password, $salt) {
@@ -629,22 +629,22 @@  discard block
 block discarded – undo
629 629
     return core_auth::make_random_password();
630 630
   }
631 631
   protected function flog($message, $die = false) {
632
-    if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) {
632
+    if (!defined('DEBUG_AUTH') || !DEBUG_AUTH) {
633 633
       return;
634 634
     }
635 635
     list($called, $caller) = debug_backtrace(false);
636 636
 
637 637
     $caller_name =
638
-      ((get_called_class()) ? get_called_class() : (!empty($caller['class']) ? $caller['class'] : '')) .
639
-      (!empty($caller['type']) ? $caller['type'] : '') .
640
-      (!empty($caller['function']) ? $caller['function'] : '') .
641
-      (!empty($called['line']) ? ':' . $called['line'] : '');
638
+      ((get_called_class()) ? get_called_class() : (!empty($caller['class']) ? $caller['class'] : '')).
639
+      (!empty($caller['type']) ? $caller['type'] : '').
640
+      (!empty($caller['function']) ? $caller['function'] : '').
641
+      (!empty($called['line']) ? ':'.$called['line'] : '');
642 642
 
643 643
     $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false;
644 644
 
645 645
     classSupernova::log_file("$message - $caller_name");
646
-    if($die) {
647
-      $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>");
646
+    if ($die) {
647
+      $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в ".get_called_class()." (располагается в ".get_class()."). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>");
648 648
     }
649 649
   }
650 650
 
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,6 @@  discard block
 block discarded – undo
134 134
   /**
135 135
    * Попытка залогиниться с использованием метода $method
136 136
    *
137
-   * @param string $method_name
138 137
    */
139 138
   public function login() {
140 139
     // TODO Проверяем поддерживаемость метода
@@ -162,6 +161,10 @@  discard block
 block discarded – undo
162 161
    * @return array|bool|resource
163 162
    */
164 163
   // OK v4.5
164
+
165
+  /**
166
+   * @param string $salt_unsafe
167
+   */
165 168
   public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) {
166 169
     $result = parent::password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe);
167 170
     if($result) {
@@ -171,6 +174,9 @@  discard block
 block discarded – undo
171 174
     return $result;
172 175
   }
173 176
 
177
+  /**
178
+   * @param Account $account_to_impersonate
179
+   */
174 180
   public function impersonate($account_to_impersonate) {
175 181
     $this->cookie_set($account_to_impersonate);
176 182
   }
Please login to merge, or discard this patch.