@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Plupload |
|
| 4 | - * @category modules |
|
| 5 | - * @author Moxiecode Systems AB |
|
| 6 | - * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | - * @copyright Moxiecode Systems AB |
|
| 8 | - * @license GNU GPL v2, see license.txt |
|
| 9 | - */ |
|
| 3 | + * @package Plupload |
|
| 4 | + * @category modules |
|
| 5 | + * @author Moxiecode Systems AB |
|
| 6 | + * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | + * @copyright Moxiecode Systems AB |
|
| 8 | + * @license GNU GPL v2, see license.txt |
|
| 9 | + */ |
|
| 10 | 10 | namespace cs; |
| 11 | 11 | Event::instance() |
| 12 | 12 | ->on( |
@@ -1,26 +1,26 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Plupload |
|
| 4 | - * @category modules |
|
| 5 | - * @author Moxiecode Systems AB |
|
| 6 | - * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | - * @copyright Moxiecode Systems AB |
|
| 8 | - * @license GNU GPL v2, see license.txt |
|
| 9 | - */ |
|
| 3 | + * @package Plupload |
|
| 4 | + * @category modules |
|
| 5 | + * @author Moxiecode Systems AB |
|
| 6 | + * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | + * @copyright Moxiecode Systems AB |
|
| 8 | + * @license GNU GPL v2, see license.txt |
|
| 9 | + */ |
|
| 10 | 10 | /** |
| 11 | - * Supports next events: |
|
| 12 | - * System/upload_files/add_tag |
|
| 13 | - * [ |
|
| 14 | - * 'url' => url //Required |
|
| 15 | - * 'tag' => tag //Required |
|
| 16 | - * ] |
|
| 17 | - * |
|
| 18 | - * System/upload_files/del_tag |
|
| 19 | - * [ |
|
| 20 | - * 'url' => url //Optional |
|
| 21 | - * 'tag' => tag //Optional ("%" symbol may be used at the end of string to delete all files, that starts from specified string) |
|
| 22 | - * ] |
|
| 23 | - */ |
|
| 11 | + * Supports next events: |
|
| 12 | + * System/upload_files/add_tag |
|
| 13 | + * [ |
|
| 14 | + * 'url' => url //Required |
|
| 15 | + * 'tag' => tag //Required |
|
| 16 | + * ] |
|
| 17 | + * |
|
| 18 | + * System/upload_files/del_tag |
|
| 19 | + * [ |
|
| 20 | + * 'url' => url //Optional |
|
| 21 | + * 'tag' => tag //Optional ("%" symbol may be used at the end of string to delete all files, that starts from specified string) |
|
| 22 | + * ] |
|
| 23 | + */ |
|
| 24 | 24 | namespace cs\modules\Plupload; |
| 25 | 25 | use |
| 26 | 26 | cs\Config, |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | ->on( |
| 33 | 33 | 'System/Page/display/before', |
| 34 | 34 | function () { |
| 35 | - $Config = Config::instance(); |
|
| 36 | - $Page = Page::instance(); |
|
| 35 | + $Config = Config::instance(); |
|
| 36 | + $Page = Page::instance(); |
|
| 37 | 37 | $Page->config([ |
| 38 | 38 | 'max_file_size' => $Config->module('Plupload')->max_file_size |
| 39 | 39 | ], 'cs.plupload'); |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | if (!isset($data['url'], $data['tag'])) { |
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | - $module_data = Config::instance()->module('Plupload'); |
|
| 49 | - $storage = Storage::instance()->{$module_data->storage('files')}; |
|
| 48 | + $module_data = Config::instance()->module('Plupload'); |
|
| 49 | + $storage = Storage::instance()->{$module_data->storage('files')}; |
|
| 50 | 50 | if (mb_strpos($data['url'], $storage->base_url()) !== 0) { |
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | - $cdb = DB::instance()->{$module_data->db('files')}(); |
|
| 54 | - $id = $cdb->qfs([ |
|
| 53 | + $cdb = DB::instance()->{$module_data->db('files')}(); |
|
| 54 | + $id = $cdb->qfs([ |
|
| 55 | 55 | "SELECT `id` |
| 56 | 56 | FROM `[prefix]plupload_files` |
| 57 | 57 | WHERE `url` = '%s' |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | if (!isset($data['url']) && !isset($data['tag'])) { |
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | - $module_data = Config::instance()->module('Plupload'); |
|
| 81 | - $storage = Storage::instance()->{$module_data->storage('files')}; |
|
| 80 | + $module_data = Config::instance()->module('Plupload'); |
|
| 81 | + $storage = Storage::instance()->{$module_data->storage('files')}; |
|
| 82 | 82 | if (isset($data['url']) && mb_strpos($data['url'], $storage->base_url()) !== 0) { |
| 83 | 83 | return false; |
| 84 | 84 | } |
| 85 | - $cdb = DB::instance()->{$module_data->db('files')}(); |
|
| 85 | + $cdb = DB::instance()->{$module_data->db('files')}(); |
|
| 86 | 86 | if (isset($data['url']) && !isset($data['tag'])) { |
| 87 | 87 | return $cdb->q( |
| 88 | 88 | "DELETE FROM `[prefix]plupload_files_tags` |
@@ -19,14 +19,14 @@ |
||
| 19 | 19 | if ($data['name'] != 'Plupload') { |
| 20 | 20 | return; |
| 21 | 21 | } |
| 22 | - $module_data = Config::instance()->module('Plupload'); |
|
| 23 | - $storage = Storage::instance()->{$module_data->storage('files')}; |
|
| 24 | - $cdb = DB::instance()->{$module_data->db('files')}; |
|
| 22 | + $module_data = Config::instance()->module('Plupload'); |
|
| 23 | + $storage = Storage::instance()->{$module_data->storage('files')}; |
|
| 24 | + $cdb = DB::instance()->{$module_data->db('files')}; |
|
| 25 | 25 | unset($module_data); |
| 26 | 26 | if (!$storage || !$cdb) { |
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | - $files = $cdb->q( |
|
| 29 | + $files = $cdb->q( |
|
| 30 | 30 | "SELECT `source` |
| 31 | 31 | FROM `[prefix]plupload_files`" |
| 32 | 32 | ); |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Plupload |
|
| 4 | - * @category modules |
|
| 5 | - * @author Moxiecode Systems AB |
|
| 6 | - * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | - * @copyright Moxiecode Systems AB |
|
| 8 | - * @license GNU GPL v2, see license.txt |
|
| 9 | - */ |
|
| 3 | + * @package Plupload |
|
| 4 | + * @category modules |
|
| 5 | + * @author Moxiecode Systems AB |
|
| 6 | + * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | + * @copyright Moxiecode Systems AB |
|
| 8 | + * @license GNU GPL v2, see license.txt |
|
| 9 | + */ |
|
| 10 | 10 | namespace cs; |
| 11 | 11 | Event::instance()->on( |
| 12 | 12 | 'admin/System/components/modules/install/after', |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Plupload |
|
| 4 | - * @category modules |
|
| 5 | - * @author Moxiecode Systems AB |
|
| 6 | - * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | - * @copyright Moxiecode Systems AB |
|
| 8 | - * @license GNU GPL v2, see license.txt |
|
| 9 | - */ |
|
| 3 | + * @package Plupload |
|
| 4 | + * @category modules |
|
| 5 | + * @author Moxiecode Systems AB |
|
| 6 | + * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | + * @copyright Moxiecode Systems AB |
|
| 8 | + * @license GNU GPL v2, see license.txt |
|
| 9 | + */ |
|
| 10 | 10 | namespace cs; |
| 11 | 11 | Event::instance()->on( |
| 12 | 12 | 'admin/System/components/modules/install/after', |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | 'admin/System/components/modules/install/after', |
| 13 | 13 | function ($data) { |
| 14 | 14 | if ($data['name'] == 'Plupload') { |
| 15 | - $Config = Config::instance(); |
|
| 16 | - $Config->module('Plupload')->max_file_size = '5mb'; |
|
| 17 | - $Config->module('Plupload')->confirmation_time = '900'; |
|
| 15 | + $Config = Config::instance(); |
|
| 16 | + $Config->module('Plupload')->max_file_size = '5mb'; |
|
| 17 | + $Config->module('Plupload')->confirmation_time = '900'; |
|
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | ); |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Plupload |
|
| 4 | - * @category modules |
|
| 5 | - * @author Moxiecode Systems AB |
|
| 6 | - * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | - * @copyright Moxiecode Systems AB |
|
| 8 | - * @license GNU GPL v2, see license.txt |
|
| 9 | - */ |
|
| 3 | + * @package Plupload |
|
| 4 | + * @category modules |
|
| 5 | + * @author Moxiecode Systems AB |
|
| 6 | + * @author Nazar Mokrynskyi <[email protected]> (integration with CleverStyle CMS) |
|
| 7 | + * @copyright Moxiecode Systems AB |
|
| 8 | + * @license GNU GPL v2, see license.txt |
|
| 9 | + */ |
|
| 10 | 10 | namespace cs; |
| 11 | 11 | use Karwana\Mime\Mime; |
| 12 | 12 | $Page = Page::instance(); |
| 13 | 13 | $User = User::instance(); |
| 14 | 14 | interface_off(); |
| 15 | 15 | /** |
| 16 | - * Only registered users allowed |
|
| 17 | - */ |
|
| 16 | + * Only registered users allowed |
|
| 17 | + */ |
|
| 18 | 18 | if (!isset($_FILES['file'])) { |
| 19 | 19 | $Page->json([ |
| 20 | 20 | 'jsonrpc' => '2.0', |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | /** |
| 30 | - * Getting Plupload module configuration |
|
| 31 | - */ |
|
| 30 | + * Getting Plupload module configuration |
|
| 31 | + */ |
|
| 32 | 32 | $module_data = Config::instance()->module('Plupload'); |
| 33 | 33 | $max_file_size = trim(strtolower($module_data->max_file_size), 'b'); |
| 34 | 34 | switch (substr($max_file_size, -1)) { |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | return; |
| 69 | 69 | } |
| 70 | 70 | /** |
| 71 | - * Only registered users allowed |
|
| 72 | - */ |
|
| 71 | + * Only registered users allowed |
|
| 72 | + */ |
|
| 73 | 73 | if (!$User->user()) { |
| 74 | 74 | $Page->json([ |
| 75 | 75 | 'jsonrpc' => '2.0', |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | /** |
| 85 | - * Getting instances of storage and database |
|
| 86 | - */ |
|
| 85 | + * Getting instances of storage and database |
|
| 86 | + */ |
|
| 87 | 87 | $storage = Storage::instance()->{$module_data->storage('files')}; |
| 88 | 88 | /** |
| 89 | - * @var DB\_Abstract $cdb |
|
| 90 | - */ |
|
| 89 | + * @var DB\_Abstract $cdb |
|
| 90 | + */ |
|
| 91 | 91 | $cdb = DB::instance()->db_prime($module_data->db('files')); |
| 92 | 92 | if (!$storage || !$cdb) { |
| 93 | 93 | $Page->json([ |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | return; |
| 102 | 102 | } |
| 103 | 103 | /** |
| 104 | - * Moving file into storage |
|
| 105 | - */ |
|
| 104 | + * Moving file into storage |
|
| 105 | + */ |
|
| 106 | 106 | if (!$module_data->directory_created) { |
| 107 | 107 | $storage->mkdir('Plupload'); |
| 108 | 108 | $module_data->directory_created = 1; |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | /** |
| 133 | - * Registering file in database |
|
| 134 | - */ |
|
| 133 | + * Registering file in database |
|
| 134 | + */ |
|
| 135 | 135 | if (!$cdb->q( |
| 136 | 136 | "INSERT INTO `[prefix]plupload_files` |
| 137 | 137 | (`user`, `uploaded`, `source`, `url`) |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * Getting Plupload module configuration |
| 31 | 31 | */ |
| 32 | -$module_data = Config::instance()->module('Plupload'); |
|
| 33 | -$max_file_size = trim(strtolower($module_data->max_file_size), 'b'); |
|
| 32 | +$module_data = Config::instance()->module('Plupload'); |
|
| 33 | +$max_file_size = trim(strtolower($module_data->max_file_size), 'b'); |
|
| 34 | 34 | switch (substr($max_file_size, -1)) { |
| 35 | 35 | case 'k': |
| 36 | 36 | $max_file_size = substr($max_file_size, 0, -1) * 1024; |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * Getting instances of storage and database |
| 86 | 86 | */ |
| 87 | -$storage = Storage::instance()->{$module_data->storage('files')}; |
|
| 87 | +$storage = Storage::instance()->{$module_data->storage('files')}; |
|
| 88 | 88 | /** |
| 89 | 89 | * @var DB\_Abstract $cdb |
| 90 | 90 | */ |
| 91 | -$cdb = DB::instance()->db_prime($module_data->db('files')); |
|
| 91 | +$cdb = DB::instance()->db_prime($module_data->db('files')); |
|
| 92 | 92 | if (!$storage || !$cdb) { |
| 93 | 93 | $Page->json([ |
| 94 | 94 | 'jsonrpc' => '2.0', |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | if (!$module_data->directory_created) { |
| 107 | 107 | $storage->mkdir('Plupload'); |
| 108 | - $module_data->directory_created = 1; |
|
| 108 | + $module_data->directory_created = 1; |
|
| 109 | 109 | } |
| 110 | -$destination_file = 'Plupload/'.date('Y-m-d'); |
|
| 110 | +$destination_file = 'Plupload/'.date('Y-m-d'); |
|
| 111 | 111 | if (!$storage->file_exists($destination_file)) { |
| 112 | 112 | $storage->mkdir($destination_file); |
| 113 | 113 | } |
| 114 | -$destination_file .= date('/H'); |
|
| 114 | +$destination_file .= date('/H'); |
|
| 115 | 115 | if (!$storage->file_exists($destination_file)) { |
| 116 | 116 | $storage->mkdir($destination_file); |
| 117 | 117 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | return; |
| 155 | 155 | } |
| 156 | 156 | if ($cdb->id() % 100 === 0) { |
| 157 | - $files_for_deletion = $cdb->qfa([ |
|
| 157 | + $files_for_deletion = $cdb->qfa([ |
|
| 158 | 158 | "SELECT `f`.`id`, `f`.`source` |
| 159 | 159 | FROM `[prefix]plupload_files` AS `f` |
| 160 | 160 | LEFT JOIN `[prefix]plupload_files_tags` AS `t` |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | time() - $module_data->confirmation_time |
| 168 | 168 | ]); |
| 169 | 169 | if ($files_for_deletion) { |
| 170 | - $ids = implode(',', array_column($files_for_deletion, 'id')); |
|
| 170 | + $ids = implode(',', array_column($files_for_deletion, 'id')); |
|
| 171 | 171 | $cdb->q([ |
| 172 | 172 | "DELETE FROM `[prefix]plupload_files` |
| 173 | 173 | WHERE `id` IN($ids)", |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | ]); |
| 177 | 177 | unset($ids); |
| 178 | 178 | } |
| 179 | - $files_for_deletion = array_column($files_for_deletion, 'source'); |
|
| 179 | + $files_for_deletion = array_column($files_for_deletion, 'source'); |
|
| 180 | 180 | foreach ($files_for_deletion as $source) { |
| 181 | 181 | if ($storage->file_exists($source)) { |
| 182 | 182 | $storage->unlink($source); |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Polls |
|
| 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 Polls |
|
| 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\Polls; |
| 10 | 10 | |
| 11 | 11 | /** |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Polls |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2014-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Polls |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2014-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs; |
| 10 | 10 | |
| 11 | 11 | Event::instance()->on( |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Polls |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2014-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Polls |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2014-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Polls; |
| 10 | 10 | |
| 11 | 11 | use |
@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Shop |
|
| 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 Shop |
|
| 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\Shop; |
| 10 | 10 | use |
| 11 | 11 | cs\CRUD, |
| 12 | 12 | cs\Language; |
| 13 | 13 | /** |
| 14 | - * @property \cs\Cache\Prefix $cache |
|
| 15 | - * @property string $table |
|
| 16 | - */ |
|
| 14 | + * @property \cs\Cache\Prefix $cache |
|
| 15 | + * @property string $table |
|
| 16 | + */ |
|
| 17 | 17 | trait Common_actions { |
| 18 | 18 | use |
| 19 | 19 | CRUD; |