@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | if ('' === static::$file_name) return null; |
77 | 77 | |
78 | - $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
|
78 | + $file_name = (DIR_SYSTEM_DATA.static::$file_name); |
|
79 | 79 | |
80 | 80 | if (null === ($data = JSON::load($file_name))) return null; |
81 | 81 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | if ('' === static::$file_name) return false; |
94 | 94 | |
95 | - $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
|
95 | + $file_name = (DIR_SYSTEM_DATA.static::$file_name); |
|
96 | 96 | |
97 | 97 | if (null === ($data = $this->validate($data))) return false; |
98 | 98 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | if ('' === static::$file_name) return false; |
111 | 111 | |
112 | - $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
|
112 | + $file_name = (DIR_SYSTEM_DATA.static::$file_name); |
|
113 | 113 | |
114 | 114 | return (!Explorer::isFile($file_name) || Explorer::removeFile($file_name)); |
115 | 115 | } |
@@ -18,48 +18,62 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function addArray(string $name) { |
20 | 20 | |
21 | - if ('' !== $name) return $this->properties[$name] = new _Array; |
|
21 | + if ('' !== $name) { |
|
22 | + return $this->properties[$name] = new _Array; |
|
23 | + } |
|
22 | 24 | } |
23 | 25 | |
24 | 26 | # Add boolean property |
25 | 27 | |
26 | 28 | protected function addBoolean(string $name) { |
27 | 29 | |
28 | - if ('' !== $name) return $this->properties[$name] = new _Boolean; |
|
30 | + if ('' !== $name) { |
|
31 | + return $this->properties[$name] = new _Boolean; |
|
32 | + } |
|
29 | 33 | } |
30 | 34 | |
31 | 35 | # Add integer property |
32 | 36 | |
33 | 37 | protected function addInteger(string $name) { |
34 | 38 | |
35 | - if ('' !== $name) return $this->properties[$name] = new _Integer; |
|
39 | + if ('' !== $name) { |
|
40 | + return $this->properties[$name] = new _Integer; |
|
41 | + } |
|
36 | 42 | } |
37 | 43 | |
38 | 44 | # Add object property |
39 | 45 | |
40 | 46 | protected function addObject(string $name) { |
41 | 47 | |
42 | - if ('' !== $name) return $this->properties[$name] = new _Object; |
|
48 | + if ('' !== $name) { |
|
49 | + return $this->properties[$name] = new _Object; |
|
50 | + } |
|
43 | 51 | } |
44 | 52 | |
45 | 53 | # Add string property |
46 | 54 | |
47 | 55 | protected function addString(string $name) { |
48 | 56 | |
49 | - if ('' !== $name) return $this->properties[$name] = new _String; |
|
57 | + if ('' !== $name) { |
|
58 | + return $this->properties[$name] = new _String; |
|
59 | + } |
|
50 | 60 | } |
51 | 61 | |
52 | 62 | # Validate data |
53 | 63 | |
54 | 64 | public function validate($data) { |
55 | 65 | |
56 | - if (!is_array($data)) return null; |
|
66 | + if (!is_array($data)) { |
|
67 | + return null; |
|
68 | + } |
|
57 | 69 | |
58 | 70 | $result = []; |
59 | 71 | |
60 | 72 | foreach ($this->properties as $name => $property) { |
61 | 73 | |
62 | - if (!isset($data[$name]) || (null === ($value = $property->validate($data[$name])))) return null; |
|
74 | + if (!isset($data[$name]) || (null === ($value = $property->validate($data[$name])))) { |
|
75 | + return null; |
|
76 | + } |
|
63 | 77 | |
64 | 78 | $result[$name] = $value; |
65 | 79 | } |
@@ -73,13 +87,19 @@ discard block |
||
73 | 87 | |
74 | 88 | public function load() { |
75 | 89 | |
76 | - if ('' === static::$file_name) return null; |
|
90 | + if ('' === static::$file_name) { |
|
91 | + return null; |
|
92 | + } |
|
77 | 93 | |
78 | 94 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
79 | 95 | |
80 | - if (null === ($data = JSON::load($file_name))) return null; |
|
96 | + if (null === ($data = JSON::load($file_name))) { |
|
97 | + return null; |
|
98 | + } |
|
81 | 99 | |
82 | - if (null === ($data = $this->validate($data))) return null; |
|
100 | + if (null === ($data = $this->validate($data))) { |
|
101 | + return null; |
|
102 | + } |
|
83 | 103 | |
84 | 104 | # ------------------------ |
85 | 105 | |
@@ -90,13 +110,19 @@ discard block |
||
90 | 110 | |
91 | 111 | public function save(array $data) { |
92 | 112 | |
93 | - if ('' === static::$file_name) return false; |
|
113 | + if ('' === static::$file_name) { |
|
114 | + return false; |
|
115 | + } |
|
94 | 116 | |
95 | 117 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
96 | 118 | |
97 | - if (null === ($data = $this->validate($data))) return false; |
|
119 | + if (null === ($data = $this->validate($data))) { |
|
120 | + return false; |
|
121 | + } |
|
98 | 122 | |
99 | - if (false === JSON::save($file_name, $data)) return false; |
|
123 | + if (false === JSON::save($file_name, $data)) { |
|
124 | + return false; |
|
125 | + } |
|
100 | 126 | |
101 | 127 | # ------------------------ |
102 | 128 | |
@@ -107,7 +133,9 @@ discard block |
||
107 | 133 | |
108 | 134 | public function remove() { |
109 | 135 | |
110 | - if ('' === static::$file_name) return false; |
|
136 | + if ('' === static::$file_name) { |
|
137 | + return false; |
|
138 | + } |
|
111 | 139 | |
112 | 140 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
113 | 141 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | public static function sendStatus(int $code) { |
136 | 136 | |
137 | - if (self::isStatusCode($code)) header($_SERVER['SERVER_PROTOCOL'] . ' ' . self::$status_codes[$code]); |
|
137 | + if (self::isStatusCode($code)) header($_SERVER['SERVER_PROTOCOL'].' '.self::$status_codes[$code]); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | |
146 | 146 | if (self::isTextContentType($type)) { |
147 | 147 | |
148 | - return header('Content-type: ' . self::$content_types_text[$type] . '; charset=UTF-8'); |
|
148 | + return header('Content-type: '.self::$content_types_text[$type].'; charset=UTF-8'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (self::isMediaContentType($type)) { |
152 | 152 | |
153 | - return header('Content-type: ' . self::$content_types_media[$type]); |
|
153 | + return header('Content-type: '.self::$content_types_media[$type]); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | |
163 | 163 | if (self::$cache_sent) return; |
164 | 164 | |
165 | - header('Expires: ' . gmdate('D, d M Y H:i:s', (REQUEST_TIME + $expires)) . ' GMT'); |
|
165 | + header('Expires: '.gmdate('D, d M Y H:i:s', (REQUEST_TIME + $expires)).' GMT'); |
|
166 | 166 | |
167 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', REQUEST_TIME) . ' GMT'); |
|
167 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', REQUEST_TIME).' GMT'); |
|
168 | 168 | |
169 | 169 | $limiter = ($public ? 'public' : 'private'); |
170 | 170 | |
171 | - header('Cache-Control: ' . $limiter . ', max-age=' . $expires . ', pre-check=' . $expires); |
|
171 | + header('Cache-Control: '.$limiter.', max-age='.$expires.', pre-check='.$expires); |
|
172 | 172 | |
173 | - header('Pragma: ' . $limiter); |
|
173 | + header('Pragma: '.$limiter); |
|
174 | 174 | |
175 | 175 | # ------------------------ |
176 | 176 | |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | |
186 | 186 | if (self::$cache_sent) return; |
187 | 187 | |
188 | - header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('-1 day')) . ' GMT'); |
|
188 | + header('Expires: '.gmdate('D, d M Y H:i:s', strtotime('-1 day')).' GMT'); |
|
189 | 189 | |
190 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', strtotime('-1 day')) . ' GMT'); |
|
190 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', strtotime('-1 day')).' GMT'); |
|
191 | 191 | |
192 | 192 | header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); |
193 | 193 |
@@ -134,7 +134,9 @@ discard block |
||
134 | 134 | |
135 | 135 | public static function sendStatus(int $code) { |
136 | 136 | |
137 | - if (self::isStatusCode($code)) header($_SERVER['SERVER_PROTOCOL'] . ' ' . self::$status_codes[$code]); |
|
137 | + if (self::isStatusCode($code)) { |
|
138 | + header($_SERVER['SERVER_PROTOCOL'] . ' ' . self::$status_codes[$code]); |
|
139 | + } |
|
138 | 140 | } |
139 | 141 | |
140 | 142 | /** |
@@ -160,7 +162,9 @@ discard block |
||
160 | 162 | |
161 | 163 | public static function sendCache(int $expires, bool $public = false) { |
162 | 164 | |
163 | - if (self::$cache_sent) return; |
|
165 | + if (self::$cache_sent) { |
|
166 | + return; |
|
167 | + } |
|
164 | 168 | |
165 | 169 | header('Expires: ' . gmdate('D, d M Y H:i:s', (REQUEST_TIME + $expires)) . ' GMT'); |
166 | 170 | |
@@ -183,7 +187,9 @@ discard block |
||
183 | 187 | |
184 | 188 | public static function sendNoCache() { |
185 | 189 | |
186 | - if (self::$cache_sent) return; |
|
190 | + if (self::$cache_sent) { |
|
191 | + return; |
|
192 | + } |
|
187 | 193 | |
188 | 194 | header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('-1 day')) . ' GMT'); |
189 | 195 |
@@ -23,15 +23,23 @@ discard block |
||
23 | 23 | |
24 | 24 | // Ignore error to avoid warning when trying to connect to unavailable host |
25 | 25 | |
26 | - if (false === ($link = @mysqli_connect($server, $user, $password))) throw new Exception\DBConnect; |
|
26 | + if (false === ($link = @mysqli_connect($server, $user, $password))) { |
|
27 | + throw new Exception\DBConnect; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | # Set encoding |
29 | 31 | |
30 | - if (!mysqli_query($link, "SET character_set_client = 'utf8'")) throw new Exception\DBCharset; |
|
32 | + if (!mysqli_query($link, "SET character_set_client = 'utf8'")) { |
|
33 | + throw new Exception\DBCharset; |
|
34 | + } |
|
31 | 35 | |
32 | - if (!mysqli_query($link, "SET character_set_results = 'utf8'")) throw new Exception\DBCharset; |
|
36 | + if (!mysqli_query($link, "SET character_set_results = 'utf8'")) { |
|
37 | + throw new Exception\DBCharset; |
|
38 | + } |
|
33 | 39 | |
34 | - if (!mysqli_query($link, "SET collation_connection = 'utf8_general_ci'")) throw new Exception\DBCharset; |
|
40 | + if (!mysqli_query($link, "SET collation_connection = 'utf8_general_ci'")) { |
|
41 | + throw new Exception\DBCharset; |
|
42 | + } |
|
35 | 43 | |
36 | 44 | # ------------------------ |
37 | 45 | |
@@ -44,7 +52,9 @@ discard block |
||
44 | 52 | |
45 | 53 | public static function name(string $name) { |
46 | 54 | |
47 | - if (!mysqli_select_db(self::$link, $name)) throw new Exception\DBSelect; |
|
55 | + if (!mysqli_select_db(self::$link, $name)) { |
|
56 | + throw new Exception\DBSelect; |
|
57 | + } |
|
48 | 58 | } |
49 | 59 | |
50 | 60 | /** |
@@ -55,7 +65,9 @@ discard block |
||
55 | 65 | |
56 | 66 | public static function send(string $query) { |
57 | 67 | |
58 | - if (null === self::$link) return (self::$last = false); |
|
68 | + if (null === self::$link) { |
|
69 | + return (self::$last = false); |
|
70 | + } |
|
59 | 71 | |
60 | 72 | $time = microtime(true); $result = mysqli_query(self::$link, $query); $time = (microtime(true) - $time); |
61 | 73 |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | |
11 | 11 | private static function parseContents(string $contents, Throwable $exc) : string { |
12 | 12 | |
13 | - $contents = str_replace('$message$', $exc->getMessage(), $contents); |
|
13 | + $contents = str_replace('$message$', $exc->getMessage(), $contents); |
|
14 | 14 | |
15 | - $contents = str_replace('$file$', $exc->getFile(), $contents); |
|
15 | + $contents = str_replace('$file$', $exc->getFile(), $contents); |
|
16 | 16 | |
17 | - $contents = str_replace('$line$', $exc->getLine(), $contents); |
|
17 | + $contents = str_replace('$line$', $exc->getLine(), $contents); |
|
18 | 18 | |
19 | - $contents = str_replace('$trace$', nl2br($exc->getTraceAsString()), $contents); |
|
19 | + $contents = str_replace('$trace$', nl2br($exc->getTraceAsString()), $contents); |
|
20 | 20 | |
21 | 21 | # ------------------------ |
22 | 22 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | # Load template |
56 | 56 | |
57 | - $file_name = (DIR_TEMPLATES . 'Exception.tpl'); |
|
57 | + $file_name = (DIR_TEMPLATES.'Exception.tpl'); |
|
58 | 58 | |
59 | 59 | if (false === ($contents = @file_get_contents($file_name))) $output = nl2br($exc); |
60 | 60 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | header('Pragma: no-cache'); |
72 | 72 | |
73 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); |
|
73 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal Server Error', true, 500); |
|
74 | 74 | |
75 | 75 | header('Content-type: text/html; charset=UTF-8'); |
76 | 76 |
@@ -29,17 +29,29 @@ discard block |
||
29 | 29 | |
30 | 30 | public static function getIP() : string { |
31 | 31 | |
32 | - if (!empty($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; |
|
32 | + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
33 | + return $_SERVER['HTTP_CLIENT_IP']; |
|
34 | + } |
|
33 | 35 | |
34 | - if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
36 | + if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
37 | + return $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
38 | + } |
|
35 | 39 | |
36 | - if (!empty($_SERVER['HTTP_X_FORWARDED'])) return $_SERVER['HTTP_X_FORWARDED']; |
|
40 | + if (!empty($_SERVER['HTTP_X_FORWARDED'])) { |
|
41 | + return $_SERVER['HTTP_X_FORWARDED']; |
|
42 | + } |
|
37 | 43 | |
38 | - if (!empty($_SERVER['HTTP_FORWARDED_FOR'])) return $_SERVER['HTTP_FORWARDED_FOR']; |
|
44 | + if (!empty($_SERVER['HTTP_FORWARDED_FOR'])) { |
|
45 | + return $_SERVER['HTTP_FORWARDED_FOR']; |
|
46 | + } |
|
39 | 47 | |
40 | - if (!empty($_SERVER['HTTP_FORWARDED'])) return $_SERVER['HTTP_FORWARDED']; |
|
48 | + if (!empty($_SERVER['HTTP_FORWARDED'])) { |
|
49 | + return $_SERVER['HTTP_FORWARDED']; |
|
50 | + } |
|
41 | 51 | |
42 | - if (!empty($_SERVER['REMOTE_ADDR'])) return $_SERVER['REMOTE_ADDR']; |
|
52 | + if (!empty($_SERVER['REMOTE_ADDR'])) { |
|
53 | + return $_SERVER['REMOTE_ADDR']; |
|
54 | + } |
|
43 | 55 | |
44 | 56 | # ------------------------ |
45 | 57 | |
@@ -56,9 +68,11 @@ discard block |
||
56 | 68 | |
57 | 69 | $file_name = (DIR_TEMPLATES . 'Exception.tpl'); |
58 | 70 | |
59 | - if (false === ($contents = @file_get_contents($file_name))) $output = nl2br($exc); |
|
60 | - |
|
61 | - else $output = self::parseContents($contents, $exc); |
|
71 | + if (false === ($contents = @file_get_contents($file_name))) { |
|
72 | + $output = nl2br($exc); |
|
73 | + } else { |
|
74 | + $output = self::parseContents($contents, $exc); |
|
75 | + } |
|
62 | 76 | |
63 | 77 | # Set headers |
64 | 78 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | |
64 | 64 | # Check target file |
65 | 65 | |
66 | - $base_name = basename($file['name']); $file_name = ($dir_name . '/' . $base_name); |
|
66 | + $base_name = basename($file['name']); $file_name = ($dir_name.'/'.$base_name); |
|
67 | 67 | |
68 | 68 | if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS'; |
69 | 69 |
@@ -12,19 +12,33 @@ discard block |
||
12 | 12 | |
13 | 13 | private static function translateError(int $error) { |
14 | 14 | |
15 | - if ($error === UPLOAD_ERR_INI_SIZE) return 'UPLOADER_ERROR_INI_SIZE'; |
|
15 | + if ($error === UPLOAD_ERR_INI_SIZE) { |
|
16 | + return 'UPLOADER_ERROR_INI_SIZE'; |
|
17 | + } |
|
16 | 18 | |
17 | - if ($error === UPLOAD_ERR_FORM_SIZE) return 'UPLOADER_ERROR_FORM_SIZE'; |
|
19 | + if ($error === UPLOAD_ERR_FORM_SIZE) { |
|
20 | + return 'UPLOADER_ERROR_FORM_SIZE'; |
|
21 | + } |
|
18 | 22 | |
19 | - if ($error === UPLOAD_ERR_PARTIAL) return 'UPLOADER_ERROR_PARTIAL'; |
|
23 | + if ($error === UPLOAD_ERR_PARTIAL) { |
|
24 | + return 'UPLOADER_ERROR_PARTIAL'; |
|
25 | + } |
|
20 | 26 | |
21 | - if ($error === UPLOAD_ERR_NO_FILE) return 'UPLOADER_ERROR_NO_FILE'; |
|
27 | + if ($error === UPLOAD_ERR_NO_FILE) { |
|
28 | + return 'UPLOADER_ERROR_NO_FILE'; |
|
29 | + } |
|
22 | 30 | |
23 | - if ($error === UPLOAD_ERR_NO_TMP_DIR) return 'UPLOADER_ERROR_NO_TMP_DIR'; |
|
31 | + if ($error === UPLOAD_ERR_NO_TMP_DIR) { |
|
32 | + return 'UPLOADER_ERROR_NO_TMP_DIR'; |
|
33 | + } |
|
24 | 34 | |
25 | - if ($error === UPLOAD_ERR_CANT_WRITE) return 'UPLOADER_ERROR_CANT_WRITE'; |
|
35 | + if ($error === UPLOAD_ERR_CANT_WRITE) { |
|
36 | + return 'UPLOADER_ERROR_CANT_WRITE'; |
|
37 | + } |
|
26 | 38 | |
27 | - if ($error === UPLOAD_ERR_EXTENSION) return 'UPLOADER_ERROR_EXTENSION'; |
|
39 | + if ($error === UPLOAD_ERR_EXTENSION) { |
|
40 | + return 'UPLOADER_ERROR_EXTENSION'; |
|
41 | + } |
|
28 | 42 | |
29 | 43 | # ------------------------ |
30 | 44 | |
@@ -35,19 +49,27 @@ discard block |
||
35 | 49 | |
36 | 50 | public static function save(string $name, string $dir_name) { |
37 | 51 | |
38 | - if (false === ($file = Request::file($name))) return false; |
|
52 | + if (false === ($file = Request::file($name))) { |
|
53 | + return false; |
|
54 | + } |
|
39 | 55 | |
40 | 56 | # Check for upload errors |
41 | 57 | |
42 | - if ($file['error'] !== UPLOAD_ERR_OK) return self::translateError($file['error']); |
|
58 | + if ($file['error'] !== UPLOAD_ERR_OK) { |
|
59 | + return self::translateError($file['error']); |
|
60 | + } |
|
43 | 61 | |
44 | 62 | # Check for secure upload |
45 | 63 | |
46 | - if (!is_uploaded_file($file['tmp_name'])) return 'UPLOADER_ERROR_SECURITY'; |
|
64 | + if (!is_uploaded_file($file['tmp_name'])) { |
|
65 | + return 'UPLOADER_ERROR_SECURITY'; |
|
66 | + } |
|
47 | 67 | |
48 | 68 | # Check size |
49 | 69 | |
50 | - if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) return 'UPLOADER_ERROR_SIZE'; |
|
70 | + if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) { |
|
71 | + return 'UPLOADER_ERROR_SIZE'; |
|
72 | + } |
|
51 | 73 | |
52 | 74 | # Check file extension |
53 | 75 | |
@@ -55,21 +77,29 @@ discard block |
||
55 | 77 | |
56 | 78 | $extension = strtolower(Explorer::getExtension($file['name'], false)); |
57 | 79 | |
58 | - if (in_array($extension, $extensions, true)) return 'UPLOADER_ERROR_TYPE'; |
|
80 | + if (in_array($extension, $extensions, true)) { |
|
81 | + return 'UPLOADER_ERROR_TYPE'; |
|
82 | + } |
|
59 | 83 | |
60 | 84 | # Check target directory |
61 | 85 | |
62 | - if (!Explorer::isDir($dir_name) && !Explorer::createDir($dir_name)) return 'UPLOADER_ERROR_DIR'; |
|
86 | + if (!Explorer::isDir($dir_name) && !Explorer::createDir($dir_name)) { |
|
87 | + return 'UPLOADER_ERROR_DIR'; |
|
88 | + } |
|
63 | 89 | |
64 | 90 | # Check target file |
65 | 91 | |
66 | 92 | $base_name = basename($file['name']); $file_name = ($dir_name . '/' . $base_name); |
67 | 93 | |
68 | - if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS'; |
|
94 | + if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) { |
|
95 | + return 'UPLOADER_ERROR_EXISTS'; |
|
96 | + } |
|
69 | 97 | |
70 | 98 | # Save uploaded file |
71 | 99 | |
72 | - if (!@move_uploaded_file($file['tmp_name'], $file_name)) return 'UPLOADER_ERROR_SAVE'; |
|
100 | + if (!@move_uploaded_file($file['tmp_name'], $file_name)) { |
|
101 | + return 'UPLOADER_ERROR_SAVE'; |
|
102 | + } |
|
73 | 103 | |
74 | 104 | # Set upload data |
75 | 105 |
@@ -22,9 +22,9 @@ |
||
22 | 22 | |
23 | 23 | # Save uploaded file |
24 | 24 | |
25 | - if (true === ($upload = (Uploader::save('upload', (DIR_UPLOADS . $target_dir))))) { |
|
25 | + if (true === ($upload = (Uploader::save('upload', (DIR_UPLOADS.$target_dir))))) { |
|
26 | 26 | |
27 | - $base_name = Uploader::baseName(); $url = (INSTALL_PATH . '/uploads/' . $target_dir . $base_name); |
|
27 | + $base_name = Uploader::baseName(); $url = (INSTALL_PATH.'/uploads/'.$target_dir.$base_name); |
|
28 | 28 | |
29 | 29 | $ajax->set('uploaded', 1)->set('fileName', $base_name)->set('url', $url); |
30 | 30 |
@@ -10,7 +10,9 @@ |
||
10 | 10 | |
11 | 11 | protected function handle() { |
12 | 12 | |
13 | - if (!Request::isAjax()) return false; |
|
13 | + if (!Request::isAjax()) { |
|
14 | + return false; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | # Create response |
16 | 18 |
@@ -2,68 +2,68 @@ |
||
2 | 2 | |
3 | 3 | # Cadmium |
4 | 4 | |
5 | -define('CADMIUM_NAME', 'Cadmium CMS'); |
|
6 | -define('CADMIUM_HOME', 'http://cadmium-cms.com'); |
|
5 | +define('CADMIUM_NAME', 'Cadmium CMS'); |
|
6 | +define('CADMIUM_HOME', 'http://cadmium-cms.com'); |
|
7 | 7 | |
8 | -define('CADMIUM_VERSION', '0.4.2'); |
|
9 | -define('CADMIUM_COPY', '2016'); |
|
8 | +define('CADMIUM_VERSION', '0.4.2'); |
|
9 | +define('CADMIUM_COPY', '2016'); |
|
10 | 10 | |
11 | 11 | # External |
12 | 12 | |
13 | -define('JQUERY_VERSION', '3.1.1'); |
|
14 | -define('SEMANTIC_UI_VERSION', '2.2.6'); |
|
15 | -define('CKEDITOR_VERSION', '4.6.0'); |
|
13 | +define('JQUERY_VERSION', '3.1.1'); |
|
14 | +define('SEMANTIC_UI_VERSION', '2.2.6'); |
|
15 | +define('CKEDITOR_VERSION', '4.6.0'); |
|
16 | 16 | |
17 | 17 | # Sections |
18 | 18 | |
19 | -define('SECTION_ADMIN', 'admin'); |
|
20 | -define('SECTION_SITE', 'site'); |
|
19 | +define('SECTION_ADMIN', 'admin'); |
|
20 | +define('SECTION_SITE', 'site'); |
|
21 | 21 | |
22 | 22 | # Filemanager types |
23 | 23 | |
24 | -define('FILEMANAGER_TYPE_DIR', 'dir'); |
|
25 | -define('FILEMANAGER_TYPE_FILE', 'file'); |
|
24 | +define('FILEMANAGER_TYPE_DIR', 'dir'); |
|
25 | +define('FILEMANAGER_TYPE_FILE', 'file'); |
|
26 | 26 | |
27 | 27 | # Access |
28 | 28 | |
29 | -define('ACCESS_PUBLIC', 0); |
|
30 | -define('ACCESS_REGISTERED', 1); |
|
31 | -define('ACCESS_ADMINISTRATOR', 2); |
|
29 | +define('ACCESS_PUBLIC', 0); |
|
30 | +define('ACCESS_REGISTERED', 1); |
|
31 | +define('ACCESS_ADMINISTRATOR', 2); |
|
32 | 32 | |
33 | 33 | # Frequency |
34 | 34 | |
35 | -define('FREQUENCY_ALWAYS', 'always'); |
|
36 | -define('FREQUENCY_HOURLY', 'hourly'); |
|
37 | -define('FREQUENCY_DAILY', 'daily'); |
|
38 | -define('FREQUENCY_WEEKLY', 'weekly'); |
|
39 | -define('FREQUENCY_MONTHLY', 'monthly'); |
|
40 | -define('FREQUENCY_YEARLY', 'yearly'); |
|
41 | -define('FREQUENCY_NEVER', 'never'); |
|
35 | +define('FREQUENCY_ALWAYS', 'always'); |
|
36 | +define('FREQUENCY_HOURLY', 'hourly'); |
|
37 | +define('FREQUENCY_DAILY', 'daily'); |
|
38 | +define('FREQUENCY_WEEKLY', 'weekly'); |
|
39 | +define('FREQUENCY_MONTHLY', 'monthly'); |
|
40 | +define('FREQUENCY_YEARLY', 'yearly'); |
|
41 | +define('FREQUENCY_NEVER', 'never'); |
|
42 | 42 | |
43 | 43 | # Rank |
44 | 44 | |
45 | -define('RANK_GUEST', 0); |
|
46 | -define('RANK_USER', 1); |
|
47 | -define('RANK_ADMINISTRATOR', 2); |
|
45 | +define('RANK_GUEST', 0); |
|
46 | +define('RANK_USER', 1); |
|
47 | +define('RANK_ADMINISTRATOR', 2); |
|
48 | 48 | |
49 | 49 | # Sex |
50 | 50 | |
51 | -define('SEX_NOT_SELECTED', 0); |
|
52 | -define('SEX_MALE', 1); |
|
53 | -define('SEX_FEMALE', 2); |
|
51 | +define('SEX_NOT_SELECTED', 0); |
|
52 | +define('SEX_MALE', 1); |
|
53 | +define('SEX_FEMALE', 2); |
|
54 | 54 | |
55 | 55 | # Status |
56 | 56 | |
57 | -define('STATUS_ONLINE', 0); |
|
58 | -define('STATUS_MAINTENANCE', 1); |
|
59 | -define('STATUS_UPDATE', 2); |
|
57 | +define('STATUS_ONLINE', 0); |
|
58 | +define('STATUS_MAINTENANCE', 1); |
|
59 | +define('STATUS_UPDATE', 2); |
|
60 | 60 | |
61 | 61 | # Target |
62 | 62 | |
63 | -define('TARGET_SELF', 0); |
|
64 | -define('TARGET_BLANK', 1); |
|
63 | +define('TARGET_SELF', 0); |
|
64 | +define('TARGET_BLANK', 1); |
|
65 | 65 | |
66 | 66 | # Visibility |
67 | 67 | |
68 | -define('VISIBILITY_DRAFT', 0); |
|
69 | -define('VISIBILITY_PUBLISHED', 1); |
|
68 | +define('VISIBILITY_DRAFT', 0); |
|
69 | +define('VISIBILITY_PUBLISHED', 1); |