@@ -71,7 +71,8 @@ |
||
71 | 71 | if (empty($_COOKIE['notification-device'])) { |
72 | 72 | $deviceKey = Tools::randomString(70); |
73 | 73 | setcookie("notification-device", $deviceKey, time() + 360000, "/"); |
74 | - } else { |
|
74 | + } |
|
75 | + else { |
|
75 | 76 | $deviceKey = $_COOKIE['notification-device']; |
76 | 77 | setcookie("notification-device", $_COOKIE['notification-device'], time() + 360000, "/"); |
77 | 78 | } |
@@ -28,7 +28,8 @@ |
||
28 | 28 | } |
29 | 29 | if (!file_exists($absolutePath)) { |
30 | 30 | return ''; |
31 | - } else { |
|
31 | + } |
|
32 | + else { |
|
32 | 33 | $options = []; |
33 | 34 | if ($resize) { |
34 | 35 | $resize = explode('x', $resize); |
@@ -65,7 +65,8 @@ |
||
65 | 65 | $val = @self::$server->get($name . serialize($params)); |
66 | 66 | if ($val !== false) { |
67 | 67 | return $val; |
68 | - } else { |
|
68 | + } |
|
69 | + else { |
|
69 | 70 | if (is_callable($callback, true)) { |
70 | 71 | $val = $callback($params); |
71 | 72 | self::set($name, $params, $val); |
@@ -105,7 +105,8 @@ |
||
105 | 105 | $moduleClassName = $this->findModuleClass($className); |
106 | 106 | if (!is_bool($moduleClassName) && $moduleClassName != $className) { |
107 | 107 | return $this->_objects[$moduleClassName][$paramsStr] = $this->_objects[$className][$paramsStr] = $this->getObject($moduleClassName); |
108 | - } elseif (Module::installed($className, $this) && class_exists($className)) { |
|
108 | + } |
|
109 | + elseif (Module::installed($className, $this) && class_exists($className)) { |
|
109 | 110 | $this->_objects[$className][$paramsStr] = new $className($this); |
110 | 111 | } |
111 | 112 | if (isset($this->_objects[$className][$paramsStr])) { |
@@ -19,9 +19,11 @@ discard block |
||
19 | 19 | public function __construct() { |
20 | 20 | if (!empty($_SERVER['REQUEST_TIME_FLOAT'])) { |
21 | 21 | $this->startTime = $_SERVER['REQUEST_TIME_FLOAT']; |
22 | - } elseif (!empty($_SERVER['REQUEST_TIME'])) { |
|
22 | + } |
|
23 | + elseif (!empty($_SERVER['REQUEST_TIME'])) { |
|
23 | 24 | $this->startTime = $_SERVER['REQUEST_TIME']; |
24 | - } else { |
|
25 | + } |
|
26 | + else { |
|
25 | 27 | $this->startTime = time(); |
26 | 28 | } |
27 | 29 | $this->log[] = array('name' => 'System init', 'start' => $this->startTime, 'end' => microtime(true)); |
@@ -39,7 +41,8 @@ discard block |
||
39 | 41 | if ($this->run) { |
40 | 42 | if ($key === false) { |
41 | 43 | $this->log[$this->lastLog]['end'] = microtime(true); |
42 | - } else { |
|
44 | + } |
|
45 | + else { |
|
43 | 46 | $this->log[$key]['end'] = microtime(true); |
44 | 47 | } |
45 | 48 | } |
@@ -70,11 +73,14 @@ discard block |
||
70 | 73 | foreach ($this->log as $log) { |
71 | 74 | if (!empty($log['status'])) { |
72 | 75 | echo "<tr class = '{$log['status']}'><td>{$log['name']}</td><td>{$log['status']}</td></tr>"; |
73 | - } else { |
|
74 | - if (empty($log['end'])) |
|
75 | - $log['end'] = microtime(true); |
|
76 | - if (empty($log['start'])) |
|
77 | - $log['start'] = microtime(true); |
|
76 | + } |
|
77 | + else { |
|
78 | + if (empty($log['end'])) { |
|
79 | + $log['end'] = microtime(true); |
|
80 | + } |
|
81 | + if (empty($log['start'])) { |
|
82 | + $log['start'] = microtime(true); |
|
83 | + } |
|
78 | 84 | echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>"; |
79 | 85 | } |
80 | 86 | } |
@@ -84,12 +90,15 @@ discard block |
||
84 | 90 | |
85 | 91 | public function convertSize($size) { |
86 | 92 | |
87 | - if ($size < 1024) |
|
88 | - return $size . "B"; |
|
89 | - elseif ($size < 1048576) |
|
90 | - return round($size / 1024, 2) . "KB"; |
|
91 | - else |
|
92 | - return round($size / 1048576, 2) . "MB"; |
|
93 | + if ($size < 1024) { |
|
94 | + return $size . "B"; |
|
95 | + } |
|
96 | + elseif ($size < 1048576) { |
|
97 | + return round($size / 1024, 2) . "KB"; |
|
98 | + } |
|
99 | + else { |
|
100 | + return round($size / 1048576, 2) . "MB"; |
|
101 | + } |
|
93 | 102 | } |
94 | 103 | |
95 | 104 | public function __destruct() { |
@@ -68,7 +68,8 @@ |
||
68 | 68 | include_once 'composer/vendor/autoload.php'; |
69 | 69 | if ($needOutput) { |
70 | 70 | $output = new Symfony\Component\Console\Output\StreamOutput(fopen('php://output', 'w')); |
71 | - } else { |
|
71 | + } |
|
72 | + else { |
|
72 | 73 | $output = null; |
73 | 74 | } |
74 | 75 | $path = str_replace('\\', '/', $path === null ? App::$primary->path . '/' : $path); |
@@ -49,7 +49,8 @@ discard block |
||
49 | 49 | case 'method': |
50 | 50 | if (!empty($colInfo['colParams']['params'])) { |
51 | 51 | $values = call_user_func_array([App::$cur->$colInfo['colParams']['module'], $colInfo['colParams']['method']], $colInfo['colParams']['params']); |
52 | - } else { |
|
52 | + } |
|
53 | + else { |
|
53 | 54 | $values = $colInfo['colParams']['module']->$colInfo['colParams']['method'](); |
54 | 55 | } |
55 | 56 | return !empty($values[$this->model->{$this->valueKey}]) ? $values[$this->model->{$this->valueKey}] : 'Не задано'; |
@@ -63,7 +64,8 @@ discard block |
||
63 | 64 | $file = Files\File::get($this->model->{$this->valueKey}); |
64 | 65 | if ($file) { |
65 | 66 | return '<img src="' . $file->path . '?resize=60x120" />'; |
66 | - } else { |
|
67 | + } |
|
68 | + else { |
|
67 | 69 | return '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
68 | 70 | } |
69 | 71 | case 'bool': |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | $html .=" {$key} = '"; |
27 | 27 | if (!is_array($value)) { |
28 | 28 | $html .= addcslashes($value, "'"); |
29 | - } else { |
|
29 | + } |
|
30 | + else { |
|
30 | 31 | $html .= json_encode($value); |
31 | 32 | } |
32 | 33 | $html .= "'"; |
@@ -34,9 +35,11 @@ discard block |
||
34 | 35 | } |
35 | 36 | if ($noCloseTag === null) { |
36 | 37 | $html .= ' />'; |
37 | - } elseif ($noCloseTag === false) { |
|
38 | + } |
|
39 | + elseif ($noCloseTag === false) { |
|
38 | 40 | $html .= ">{$body}</{$tag}>"; |
39 | - } else { |
|
41 | + } |
|
42 | + else { |
|
40 | 43 | $html .= ">{$body}"; |
41 | 44 | } |
42 | 45 | return $html; |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | return self::$_configs['custom'][$path]; |
46 | 46 | } |
47 | 47 | |
48 | - if (!file_exists($path)) |
|
49 | - return []; |
|
48 | + if (!file_exists($path)) { |
|
49 | + return []; |
|
50 | + } |
|
50 | 51 | |
51 | 52 | return self::$_configs['custom'][$path] = include $path; |
52 | 53 | } |
@@ -85,7 +86,8 @@ discard block |
||
85 | 86 | return self::$_configs['shareModules'][$module]; |
86 | 87 | } |
87 | 88 | $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php"; |
88 | - } else { |
|
89 | + } |
|
90 | + else { |
|
89 | 91 | if (isset(self::$_configs['share'])) { |
90 | 92 | return self::$_configs['share']; |
91 | 93 | } |
@@ -94,14 +96,16 @@ discard block |
||
94 | 96 | if (!file_exists($path)) { |
95 | 97 | if (file_exists(INJI_SYSTEM_DIR . "/modules/{$module}/defaultConfig.php")) { |
96 | 98 | $path = INJI_SYSTEM_DIR . "/modules/{$module}/defaultConfig.php"; |
97 | - } else { |
|
99 | + } |
|
100 | + else { |
|
98 | 101 | return []; |
99 | 102 | } |
100 | 103 | } |
101 | 104 | |
102 | 105 | if ($module) { |
103 | 106 | return self::$_configs['shareModules'][$module] = include $path; |
104 | - } else { |
|
107 | + } |
|
108 | + else { |
|
105 | 109 | return self::$_configs['share'] = include $path; |
106 | 110 | } |
107 | 111 | } |
@@ -122,7 +126,8 @@ discard block |
||
122 | 126 | if ($system) { |
123 | 127 | $appName = 'system'; |
124 | 128 | $appPath = INJI_SYSTEM_DIR; |
125 | - } else { |
|
129 | + } |
|
130 | + else { |
|
126 | 131 | $appName = $app->name; |
127 | 132 | $appPath = $app->path; |
128 | 133 | } |
@@ -176,7 +181,8 @@ discard block |
||
176 | 181 | $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php"; |
177 | 182 | self::$_configs['shareModules'][$module] = $data; |
178 | 183 | Inji::$inst->event('Config-change-shareModules-' . $module, $data); |
179 | - } else { |
|
184 | + } |
|
185 | + else { |
|
180 | 186 | $path = INJI_PROGRAM_DIR . "/config/config.php"; |
181 | 187 | self::$_configs['share'] = $data; |
182 | 188 | Inji::$inst->event('Config-change-share', $data); |