@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | use Cake\Core\App; |
35 | 35 | use Cake\Core\Configure; |
36 | 36 | use Cake\Core\Configure\Engine\PhpConfig; |
37 | -use Cake\Core\Plugin; |
|
38 | 37 | use Cake\Database\Type; |
39 | 38 | use Cake\Datasource\ConnectionManager; |
40 | 39 | use Cake\Error\ErrorHandler; |
@@ -42,7 +41,6 @@ discard block |
||
42 | 41 | use Cake\Log\Log; |
43 | 42 | use Cake\Mailer\Email; |
44 | 43 | use Cake\Mailer\TransportFactory; |
45 | -use Cake\Routing\DispatcherFactory; |
|
46 | 44 | use Cake\Utility\Inflector; |
47 | 45 | use Cake\Utility\Security; |
48 | 46 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /* |
17 | 17 | * Configure paths required to find CakePHP + general filepath constants |
18 | 18 | */ |
19 | -require __DIR__ . '/paths.php'; |
|
19 | +require __DIR__.'/paths.php'; |
|
20 | 20 | |
21 | 21 | /* |
22 | 22 | * Bootstrap CakePHP. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * - Registering the CakePHP autoloader. |
28 | 28 | * - Setting the default application paths. |
29 | 29 | */ |
30 | -require CORE_PATH . 'config' . DS . 'bootstrap.php'; |
|
30 | +require CORE_PATH.'config'.DS.'bootstrap.php'; |
|
31 | 31 | |
32 | 32 | use Cake\Cache\Cache; |
33 | 33 | use Cake\Console\ConsoleErrorHandler; |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * You should copy `config/.env.default to `config/.env` and set/modify the |
52 | 52 | * variables as required. |
53 | 53 | */ |
54 | -if (!env('APP_NAME') && file_exists(CONFIG . '.env')) { |
|
55 | - $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']); |
|
54 | +if (!env('APP_NAME') && file_exists(CONFIG.'.env')) { |
|
55 | + $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG.'.env']); |
|
56 | 56 | $dotenv->parse() |
57 | 57 | ->putenv() |
58 | 58 | ->toEnv() |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * Load additional config files |
76 | 76 | */ |
77 | 77 | Configure::load('saito_config', 'default'); |
78 | - Configure::config('saitoCore', new PhpConfig(APP . '/Lib/')); |
|
78 | + Configure::config('saitoCore', new PhpConfig(APP.'/Lib/')); |
|
79 | 79 | Configure::load('version', 'saitoCore'); |
80 | 80 | |
81 | 81 | Configure::write( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | Configure::load('email', 'default'); |
87 | 87 | } catch (\Exception $e) { |
88 | - exit($e->getMessage() . "\n"); |
|
88 | + exit($e->getMessage()."\n"); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /* |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * Include the CLI bootstrap overrides. |
138 | 138 | */ |
139 | 139 | if ($isCli) { |
140 | - require __DIR__ . '/bootstrap_cli.php'; |
|
140 | + require __DIR__.'/bootstrap_cli.php'; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /* |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | $httpHost = env('HTTP_HOST'); |
156 | 156 | if (isset($httpHost)) { |
157 | - Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost); |
|
157 | + Configure::write('App.fullBaseUrl', 'http'.$s.'://'.$httpHost); |
|
158 | 158 | } |
159 | 159 | unset($httpHost, $s); |
160 | 160 | } |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | /* |
177 | 177 | * Setup detectors for mobile and tablet. |
178 | 178 | */ |
179 | -ServerRequest::addDetector('mobile', function ($request) { |
|
179 | +ServerRequest::addDetector('mobile', function($request) { |
|
180 | 180 | $detector = new \Detection\MobileDetect(); |
181 | 181 | |
182 | 182 | return $detector->isMobile(); |
183 | 183 | }); |
184 | -ServerRequest::addDetector('tablet', function ($request) { |
|
184 | +ServerRequest::addDetector('tablet', function($request) { |
|
185 | 185 | $detector = new \Detection\MobileDetect(); |
186 | 186 | |
187 | 187 | return $detector->isTablet(); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | Inflector::rules('plural', ['/^(smil)ey$/i' => '\1ies']); |
221 | 221 | Inflector::rules('singular', ['/^(smil)ies$/i' => '\1ey']); |
222 | 222 | |
223 | -include Cake\Core\App::path('Lib')[0] . 'BaseFunctions.php'; |
|
223 | +include Cake\Core\App::path('Lib')[0].'BaseFunctions.php'; |
|
224 | 224 | |
225 | 225 | \Cake\Event\EventManager::instance()->on(\Saito\Event\SaitoEventManager::getInstance()); |
226 | 226 |
@@ -5,10 +5,8 @@ |
||
5 | 5 | use Cake\Core\Configure; |
6 | 6 | use Cake\Event\EventManager; |
7 | 7 | use Cake\Filesystem\File; |
8 | -use Cake\Mailer\Email; |
|
9 | 8 | use Cake\Mailer\TransportFactory; |
10 | 9 | use Cake\Utility\Inflector; |
11 | -use claviska\SimpleImage; |
|
12 | 10 | use Cron\Lib\Cron; |
13 | 11 | use Plugin\BbcodeParser\src\Lib\Markup; |
14 | 12 | use Saito\App\Registry; |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace App\Model\Table; |
11 | 11 | |
12 | 12 | use App\Lib\Model\Table\AppSettingTable; |
13 | -use Cake\Core\Configure; |
|
14 | 13 | use Cake\Validation\Validator; |
15 | 14 | use \Stopwatch\Lib\Stopwatch; |
16 | 15 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $Uploads = TableRegistry::get('ImageUploader.Uploads'); |
34 | 34 | $upload = $Uploads->get(1); |
35 | 35 | |
36 | - $file = new File(Configure::read('Saito.Settings.uploadDirectory') . $upload->get('name')); |
|
36 | + $file = new File(Configure::read('Saito.Settings.uploadDirectory').$upload->get('name')); |
|
37 | 37 | $raw = (new SimpleImage()) |
38 | 38 | ->fromNew(500, 500, 'blue') |
39 | 39 | ->toString($upload->get('type')); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | Plugin::configureCache(); // cache isn't bootstraped through request yet |
45 | 45 | $this->assertFalse(Cache::read($upload->get('id'), Plugin::CACHE_KEY)); |
46 | 46 | |
47 | - $this->get('/api/v2/uploads/thumb/1?h=' . $upload->get('hash')); |
|
47 | + $this->get('/api/v2/uploads/thumb/1?h='.$upload->get('hash')); |
|
48 | 48 | |
49 | 49 | $cache = Cache::read($upload->get('id'), Plugin::CACHE_KEY); |
50 | 50 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->assertSame(300, imagesx($image)); |
53 | 53 | $this->assertSame(300, imagesy($image)); |
54 | 54 | $this->assertSame($upload->get('type'), $cache['type']); |
55 | - $this->assertResponseEquals($cache['raw'], (string)$this->_response->getBody()); |
|
55 | + $this->assertResponseEquals($cache['raw'], (string) $this->_response->getBody()); |
|
56 | 56 | $this->assertHeader('content-type', 'image/png'); |
57 | 57 | |
58 | 58 | //// cleanup |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $Uploads = TableRegistry::get('ImageUploader.Uploads'); |
72 | 72 | $upload = $Uploads->get(1); |
73 | 73 | |
74 | - $file = new File(Configure::read('Saito.Settings.uploadDirectory') . $upload->get('name')); |
|
74 | + $file = new File(Configure::read('Saito.Settings.uploadDirectory').$upload->get('name')); |
|
75 | 75 | $raw = (new SimpleImage()) |
76 | 76 | ->fromNew(100, 100, 'blue') |
77 | 77 | ->toString($upload->get('type')); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function thumb(): Response |
37 | 37 | { |
38 | - $id = (int)$this->request->getParam('id'); |
|
39 | - ['hash' => $fingerprint, 'type' => $type, 'raw' => $raw] = Cache::remember((string)$id, function () use ($id) { |
|
38 | + $id = (int) $this->request->getParam('id'); |
|
39 | + ['hash' => $fingerprint, 'type' => $type, 'raw' => $raw] = Cache::remember((string) $id, function() use ($id) { |
|
40 | 40 | $Uploads = $this->loadModel('ImageUploader.Uploads'); |
41 | 41 | $document = $Uploads->get($id); |
42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | return compact('hash', 'raw', 'type'); |
56 | 56 | }, Plugin::CACHE_KEY); |
57 | 57 | |
58 | - $hash = (string)$this->request->getQuery('h'); |
|
58 | + $hash = (string) $this->request->getQuery('h'); |
|
59 | 59 | if ($hash !== $fingerprint) { |
60 | 60 | throw new SaitoForbiddenException( |
61 | 61 | "Attempt to access image-thumbnail $id." |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |