Completed
Push — master ( a99636...57f009 )
by Nazar
04:33
created
components/modules/Uploader/events/installed.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   Uploader
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Uploader
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs\modules\Uploader;
10 10
 use
11 11
 	cs\Config,
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 	cs\Event,
14 14
 	cs\Storage;
15 15
 /**
16
- * Supports next events:
17
- *  System/upload_files/del_tag
18
- *  [
19
- *   'url' => url, //Optional
20
- *   'tag' => tag  //Optional ("%" symbol may be used at the end of string to delete all files, that starts from specified string)
21
- *  ]
22
- */
16
+	 * Supports next events:
17
+	 *  System/upload_files/del_tag
18
+	 *  [
19
+	 *   'url' => url, //Optional
20
+	 *   'tag' => tag  //Optional ("%" symbol may be used at the end of string to delete all files, that starts from specified string)
21
+	 *  ]
22
+	 */
23 23
 Event::instance()
24 24
 	->on(
25 25
 		'admin/System/components/modules/uninstall/before',
Please login to merge, or discard this patch.
components/modules/Uploader/events/uninstalled.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   Uploader
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Uploader
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs;
10 10
 Event::instance()->on(
11 11
 	'admin/System/components/modules/install/after',
Please login to merge, or discard this patch.
components/modules/Uploader/events/enabled.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   Uploader
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Uploader
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 /**
10
- * Supports next events:
11
- *  System/upload_files/add_tag
12
- *  [
13
- *   'url' => url, //Required
14
- *   'tag' => tag  //Required
15
- *  ]
16
- */
10
+	 * Supports next events:
11
+	 *  System/upload_files/add_tag
12
+	 *  [
13
+	 *   'url' => url, //Required
14
+	 *   'tag' => tag  //Required
15
+	 *  ]
16
+	 */
17 17
 namespace cs\modules\Uploader;
18 18
 use
19 19
 	cs\Config,
Please login to merge, or discard this patch.
components/modules/Uploader/api/index.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   Uploader
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Uploader
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs;
10 10
 use Karwana\Mime\Mime;
11 11
 $L    = new Language\Prefix('uploader_');
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 $User = User::instance();
14 14
 interface_off();
15 15
 /**
16
- * File should be specified
17
- */
16
+	 * File should be specified
17
+	 */
18 18
 if (!isset($_FILES['file'])) {
19 19
 	throw new ExitException('File Not Specified', 400);
20 20
 }
21 21
 /**
22
- * Getting Uploader module configuration
23
- */
22
+	 * Getting Uploader module configuration
23
+	 */
24 24
 $module_data   = Config::instance()->module('Uploader');
25 25
 $max_file_size = (int)$module_data->max_file_size;
26 26
 switch (substr(strtolower($module_data->max_file_size), -2)) {
@@ -44,25 +44,25 @@  discard block
 block discarded – undo
44 44
 	throw new ExitException(500);
45 45
 }
46 46
 /**
47
- * Only registered users allowed
48
- */
47
+	 * Only registered users allowed
48
+	 */
49 49
 if (!$User->user()) {
50 50
 	throw new ExitException(403);
51 51
 }
52 52
 /**
53
- * Getting instances of storage and database
54
- */
53
+	 * Getting instances of storage and database
54
+	 */
55 55
 $storage = Storage::instance()->storage($module_data->storage('files'));
56 56
 /**
57
- * @var DB\_Abstract $cdb
58
- */
57
+	 * @var DB\_Abstract $cdb
58
+	 */
59 59
 $cdb = DB::instance()->db_prime($module_data->db('files'));
60 60
 if (!$storage || !$cdb) {
61 61
 	throw new ExitException(500);
62 62
 }
63 63
 /**
64
- * Moving file into storage
65
- */
64
+	 * Moving file into storage
65
+	 */
66 66
 if (!$module_data->directory_created) {
67 67
 	$storage->mkdir('Uploader');
68 68
 	$module_data->directory_created = 1;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	throw new ExitException(500);
83 83
 }
84 84
 /**
85
- * Registering file in database
86
- */
85
+	 * Registering file in database
86
+	 */
87 87
 if (!$cdb->q(
88 88
 	"INSERT INTO `[prefix]uploader_files`
89 89
 		(`user`, `uploaded`, `source`, `url`)
Please login to merge, or discard this patch.
components/modules/Uploader/events.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   Uploader
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Uploader
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs;
10 10
 Event::instance()
11 11
 	->on(
Please login to merge, or discard this patch.
components/modules/Uploader/Mime/Mime.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 	private static $mime_types;
18 18
 
19
-	private static function ensureDataLoaded() {
19
+	private static function ensureDataLoaded () {
20 20
 		if (!isset(static::$mime_types)) {
21 21
 			$json_path = implode(DIRECTORY_SEPARATOR, array(__DIR__, 'Resources', 'mime_types.json'));
22 22
 			static::$mime_types = json_decode(file_get_contents($json_path), true);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @return string|null The associated MIME type or null if none found.
33 33
 	 */
34
-	public static function getTypeForExtension($extension) {
34
+	public static function getTypeForExtension ($extension) {
35 35
 		static::ensureDataLoaded();
36 36
 
37 37
 		$extension = strtolower($extension);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return string|null The first available associated extension or null if none found.
56 56
 	 */
57
-	public static function getExtensionForType($mime_type) {
57
+	public static function getExtensionForType ($mime_type) {
58 58
 		static::ensureDataLoaded();
59 59
 
60 60
 		if (!static::hasType($mime_type)) {
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @return string[]|null An array of all the associated extensions or null if none found.
79 79
 	 */
80
-	public static function getExtensionsForType($mime_type) {
80
+	public static function getExtensionsForType ($mime_type) {
81 81
 		static::ensureDataLoaded();
82 82
 
83 83
 		if (static::hasType($mime_type)) {
84
-			return (array) static::$mime_types[$mime_type];
84
+			return (array)static::$mime_types[$mime_type];
85 85
 		}
86 86
 	}
87 87
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @return boolean
95 95
 	 */
96
-	public static function hasExtension($extension) {
96
+	public static function hasExtension ($extension) {
97 97
 		static::ensureDataLoaded();
98 98
 
99 99
 		$extension = strtolower($extension);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return boolean
120 120
 	 */
121
-	public static function hasType($mime_type) {
121
+	public static function hasType ($mime_type) {
122 122
 		static::ensureDataLoaded();
123 123
 		return isset(static::$mime_types[$mime_type]);
124 124
 	}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return string|null The associated MIME type or the default if none found.
135 135
 	 */
136
-	public static function guessType($file_path, $reference_name = null, $default = 'application/octet-stream') {
136
+	public static function guessType ($file_path, $reference_name = null, $default = 'application/octet-stream') {
137 137
 		if (!$reference_name) {
138 138
 			$reference_name = basename($file_path);
139 139
 		}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return string|null The associated extension or the default if none found.
165 165
 	 */
166
-	public static function guessExtension($file_path, $reference_name = null, $default = 'bin') {
166
+	public static function guessExtension ($file_path, $reference_name = null, $default = 'bin') {
167 167
 		if (!$reference_name) {
168 168
 			$reference_name = basename($file_path);
169 169
 		}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return string|null The associated MIME type or null if no known type was detected.
190 190
 	 */
191
-	public static function getMagicType($file_path) {
191
+	public static function getMagicType ($file_path) {
192 192
 		$file_info = finfo_open(FILEINFO_MIME_TYPE);
193 193
 		$mime_type = finfo_file($file_info, $file_path);
194 194
 		finfo_close($file_info);
Please login to merge, or discard this patch.
components/modules/Uploader/admin/index.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   Uploader
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Uploader
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs;
10 10
 use            h;
11 11
 include __DIR__.'/save.php';
Please login to merge, or discard this patch.
components/modules/Uploader/admin/save.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package   Uploader
4
- * @category  modules
5
- * @author    Nazar Mokrynskyi <[email protected]>
6
- * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
- * @license   MIT License, see license.txt
8
- */
3
+	 * @package   Uploader
4
+	 * @category  modules
5
+	 * @author    Nazar Mokrynskyi <[email protected]>
6
+	 * @copyright Copyright (c) 2015, Nazar Mokrynskyi
7
+	 * @license   MIT License, see license.txt
8
+	 */
9 9
 namespace cs;
10 10
 if (isset($_POST['save'])) {
11 11
 	$module_data                    = Config::instance()->module('Uploader');
Please login to merge, or discard this patch.