@@ -41,7 +41,6 @@ |
||
| 41 | 41 | use Cake\Http\ServerRequest; |
| 42 | 42 | use Cake\Log\Log; |
| 43 | 43 | use Cake\Mailer\Email; |
| 44 | -use Cake\Routing\DispatcherFactory; |
|
| 45 | 44 | use Cake\Utility\Inflector; |
| 46 | 45 | use Cake\Utility\Security; |
| 47 | 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; |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | * You should copy `config/.env.default to `config/.env` and set/modify the |
| 51 | 51 | * variables as required. |
| 52 | 52 | */ |
| 53 | -if (!env('APP_NAME') && file_exists(CONFIG . '.env')) { |
|
| 54 | - $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']); |
|
| 53 | +if (!env('APP_NAME') && file_exists(CONFIG.'.env')) { |
|
| 54 | + $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG.'.env']); |
|
| 55 | 55 | $dotenv->parse() |
| 56 | 56 | ->putenv() |
| 57 | 57 | ->toEnv() |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * Load additional config files |
| 75 | 75 | */ |
| 76 | 76 | Configure::load('saito_config', 'default'); |
| 77 | - Configure::config('saitoCore', new PhpConfig(APP . '/Lib/')); |
|
| 77 | + Configure::config('saitoCore', new PhpConfig(APP.'/Lib/')); |
|
| 78 | 78 | Configure::load('version', 'saitoCore'); |
| 79 | 79 | |
| 80 | 80 | Configure::write( |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | Configure::load('email', 'default'); |
| 86 | 86 | } catch (\Exception $e) { |
| 87 | - exit($e->getMessage() . "\n"); |
|
| 87 | + exit($e->getMessage()."\n"); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /* |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * Include the CLI bootstrap overrides. |
| 137 | 137 | */ |
| 138 | 138 | if ($isCli) { |
| 139 | - require __DIR__ . '/bootstrap_cli.php'; |
|
| 139 | + require __DIR__.'/bootstrap_cli.php'; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /* |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $httpHost = env('HTTP_HOST'); |
| 155 | 155 | if (isset($httpHost)) { |
| 156 | - Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost); |
|
| 156 | + Configure::write('App.fullBaseUrl', 'http'.$s.'://'.$httpHost); |
|
| 157 | 157 | } |
| 158 | 158 | unset($httpHost, $s); |
| 159 | 159 | } |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | /* |
| 176 | 176 | * Setup detectors for mobile and tablet. |
| 177 | 177 | */ |
| 178 | -ServerRequest::addDetector('mobile', function ($request) { |
|
| 178 | +ServerRequest::addDetector('mobile', function($request) { |
|
| 179 | 179 | $detector = new \Detection\MobileDetect(); |
| 180 | 180 | |
| 181 | 181 | return $detector->isMobile(); |
| 182 | 182 | }); |
| 183 | -ServerRequest::addDetector('tablet', function ($request) { |
|
| 183 | +ServerRequest::addDetector('tablet', function($request) { |
|
| 184 | 184 | $detector = new \Detection\MobileDetect(); |
| 185 | 185 | |
| 186 | 186 | return $detector->isTablet(); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | Plugin::load('ImageUploader', ['bootstrap' => true, 'routes' => true]); |
| 233 | 233 | |
| 234 | -include Cake\Core\App::path('Lib')[0] . 'BaseFunctions.php'; |
|
| 234 | +include Cake\Core\App::path('Lib')[0].'BaseFunctions.php'; |
|
| 235 | 235 | |
| 236 | 236 | \Cake\Event\EventManager::instance()->on(\Saito\Event\SaitoEventManager::getInstance()); |
| 237 | 237 | |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | use App\Controller\AppController; |
| 16 | 16 | use Cake\Controller\Component\AuthComponent; |
| 17 | 17 | use Cake\Core\Configure; |
| 18 | -use Cake\Event\Event; |
|
| 19 | 18 | |
| 20 | 19 | /** |
| 21 | 20 | * Api App Controller |
@@ -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 |
@@ -20,8 +20,6 @@ |
||
| 20 | 20 | use Cake\Http\Exception\NotFoundException; |
| 21 | 21 | use Cake\Network\Exception\MethodNotAllowedException; |
| 22 | 22 | use Cake\ORM\Entity; |
| 23 | -use Cake\ORM\Query; |
|
| 24 | -use Saito\App\Registry; |
|
| 25 | 23 | use Saito\Exception\SaitoForbiddenException; |
| 26 | 24 | |
| 27 | 25 | /** |
@@ -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 |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function edit($id) |
| 86 | 86 | { |
| 87 | - $id = (int)$id; |
|
| 87 | + $id = (int) $id; |
|
| 88 | 88 | $bookmark = $this->getBookmark($id); |
| 89 | 89 | |
| 90 | 90 | $this->Bookmarks->patchEntity( |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function delete($id) |
| 111 | 111 | { |
| 112 | - $id = (int)$id; |
|
| 112 | + $id = (int) $id; |
|
| 113 | 113 | $bookmark = $this->getBookmark($id); |
| 114 | 114 | if (!$this->Bookmarks->delete($bookmark)) { |
| 115 | 115 | throw new GenericApiException('The bookmark could not be deleted.'); |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | |
| 13 | 13 | namespace Bookmarks\Lib; |
| 14 | 14 | |
| 15 | -use App\Controller\Component\CurrentUserComponent; |
|
| 16 | 15 | use Cake\ORM\TableRegistry; |
| 17 | 16 | use Saito\User\CurrentUser\CurrentUserInterface; |
| 18 | 17 | |
@@ -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 |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use App\Controller\AppController; |
| 6 | 6 | use App\Model\Table\EntriesTable; |
| 7 | -use Cake\Core\Configure; |
|
| 8 | 7 | use Cake\Event\Event; |
| 9 | 8 | use Cake\Http\Exception\BadRequestException; |
| 10 | 9 | use Feeds\Model\Behavior\FeedsPostingBehavior; |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | use App\Lib\Model\Table\AppTable; |
| 16 | 16 | use Cake\Core\Configure; |
| 17 | -use Cake\Datasource\EntityInterface; |
|
| 18 | 17 | use Cake\Event\Event; |
| 19 | 18 | use Cake\Filesystem\File; |
| 20 | 19 | use Cake\ORM\RulesChecker; |
@@ -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 |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | ->notBlank('user_id') |
| 52 | 52 | ->requirePresence(['name', 'size', 'type', 'user_id'], 'create'); |
| 53 | 53 | |
| 54 | - $maxUploadSize = (int)Configure::read('Saito.Settings.upload_max_img_size'); |
|
| 54 | + $maxUploadSize = (int) Configure::read('Saito.Settings.upload_max_img_size'); |
|
| 55 | 55 | $validator->add( |
| 56 | 56 | 'document', |
| 57 | 57 | [ |
| 58 | 58 | 'fileSize' => [ |
| 59 | - 'rule' => ['fileSize', '<', $maxUploadSize . 'kB'], |
|
| 59 | + 'rule' => ['fileSize', '<', $maxUploadSize.'kB'], |
|
| 60 | 60 | 'message' => __d( |
| 61 | 61 | 'image_uploader', |
| 62 | 62 | 'validation.error.fileSize', |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | public function buildRules(RulesChecker $rules) |
| 84 | 84 | { |
| 85 | 85 | // check max allowed number of uploads per user |
| 86 | - $nMax = (int)Configure::read('Saito.Settings.upload_max_number_of_uploads'); |
|
| 86 | + $nMax = (int) Configure::read('Saito.Settings.upload_max_number_of_uploads'); |
|
| 87 | 87 | $rules->add( |
| 88 | - function (Upload $entity, array $options) use ($nMax) { |
|
| 88 | + function(Upload $entity, array $options) use ($nMax) { |
|
| 89 | 89 | $count = $this->findByUserId($entity->get('user_id'))->count(); |
| 90 | 90 | |
| 91 | 91 | return $count < $nMax; |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | $ratio = $size / $target; |
| 206 | 206 | $ratio = sqrt($ratio); |
| 207 | 207 | |
| 208 | - $newwidth = (int)($width / $ratio); |
|
| 209 | - $newheight = (int)($height / $ratio); |
|
| 208 | + $newwidth = (int) ($width / $ratio); |
|
| 209 | + $newheight = (int) ($height / $ratio); |
|
| 210 | 210 | $destination = imagecreatetruecolor($newwidth, $newheight); |
| 211 | 211 | |
| 212 | 212 | $source = imagecreatefromstring($raw); |
@@ -13,13 +13,11 @@ |
||
| 13 | 13 | namespace ImageUploader\Test\TestCase\Controller; |
| 14 | 14 | |
| 15 | 15 | use Api\Error\Exception\GenericApiException; |
| 16 | -use Cake\Cache\Cache; |
|
| 17 | 16 | use Cake\Core\Configure; |
| 18 | 17 | use Cake\Core\Plugin; |
| 19 | 18 | use Cake\Filesystem\File; |
| 20 | 19 | use Cake\Http\Exception\UnauthorizedException; |
| 21 | 20 | use Cake\ORM\TableRegistry; |
| 22 | -use claviska\SimpleImage; |
|
| 23 | 21 | use Saito\Exception\SaitoForbiddenException; |
| 24 | 22 | use Saito\Test\IntegrationTestCase; |
| 25 | 23 | |
@@ -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 |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | parent::setUp(); |
| 47 | 47 | |
| 48 | - $this->file = new File(TMP . 'my new-upload.png'); |
|
| 48 | + $this->file = new File(TMP.'my new-upload.png'); |
|
| 49 | 49 | $this->mockMediaFile($this->file); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | 0 => [ |
| 74 | 74 | 'file' => [ |
| 75 | 75 | 'tmp_name' => $this->file->path, |
| 76 | - 'name' => $this->file->name() . '.' . $this->file->ext(), |
|
| 76 | + 'name' => $this->file->name().'.'.$this->file->ext(), |
|
| 77 | 77 | 'size' => $this->file->size(), |
| 78 | 78 | 'type' => $this->file->mime(), |
| 79 | 79 | ] |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | ]; |
| 83 | 83 | $this->post('api/v2/uploads.json', $data); |
| 84 | 84 | |
| 85 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 85 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 86 | 86 | |
| 87 | 87 | $this->assertResponseCode(200); |
| 88 | 88 | |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $this->loginJwt(1); |
| 114 | 114 | unset($this->file); |
| 115 | - $this->file = new File(TMP . 'tmp_exif.jpg'); |
|
| 115 | + $this->file = new File(TMP.'tmp_exif.jpg'); |
|
| 116 | 116 | |
| 117 | - $fixture = new File($path = Plugin::path('ImageUploader') . 'tests/Fixture/exif-with-location.jpg'); |
|
| 117 | + $fixture = new File($path = Plugin::path('ImageUploader').'tests/Fixture/exif-with-location.jpg'); |
|
| 118 | 118 | $fixture->copy($this->file->path); |
| 119 | 119 | |
| 120 | - $readExif = function (File $file) { |
|
| 120 | + $readExif = function(File $file) { |
|
| 121 | 121 | //@codingStandardsIgnoreStart |
| 122 | 122 | return @exif_read_data($file->path); |
| 123 | 123 | //@codingStandardsIgnoreEnd |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | 0 => [ |
| 133 | 133 | 'file' => [ |
| 134 | 134 | 'tmp_name' => $this->file->path, |
| 135 | - 'name' => $this->file->name() . '.' . $this->file->ext(), |
|
| 135 | + 'name' => $this->file->name().'.'.$this->file->ext(), |
|
| 136 | 136 | 'size' => $this->file->size(), |
| 137 | 137 | 'type' => $this->file->mime(), |
| 138 | 138 | ] |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | ]; |
| 142 | 142 | $this->post('api/v2/uploads.json', $data); |
| 143 | 143 | |
| 144 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 144 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 145 | 145 | |
| 146 | 146 | $this->assertResponseCode(200); |
| 147 | 147 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | $this->get('api/v2/uploads'); |
| 224 | 224 | |
| 225 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 225 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 226 | 226 | |
| 227 | 227 | $this->assertResponseCode(200); |
| 228 | 228 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $this->delete('api/v2/uploads/1'); |
| 262 | 262 | |
| 263 | - $response = json_decode((string)$this->_response->getBody(), true); |
|
| 263 | + $response = json_decode((string) $this->_response->getBody(), true); |
|
| 264 | 264 | |
| 265 | 265 | $this->assertResponseCode(204); |
| 266 | 266 | |
@@ -14,8 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | use Cake\Core\Configure; |
| 16 | 16 | use Cake\Datasource\ConnectionManager; |
| 17 | -use Cake\Datasource\ConnectionRegistry; |
|
| 18 | -use Cake\Event\Event; |
|
| 19 | 17 | use Cake\Filesystem\File; |
| 20 | 18 | use Cake\ORM\Table; |
| 21 | 19 | use Cake\ORM\TableRegistry; |
@@ -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 |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if ($hasSettingsTable) { |
| 65 | 65 | $this->log('Installer found Settings-table. Moving on to Updater.', LogLevel::INFO, ['saito.install']); |
| 66 | 66 | //// disable installer and move on to updater instead |
| 67 | - $token = (new File(CONFIG . 'installer')) |
|
| 67 | + $token = (new File(CONFIG.'installer')) |
|
| 68 | 68 | ->delete(); |
| 69 | 69 | |
| 70 | 70 | return $this->redirect('/'); |
@@ -13,11 +13,7 @@ |
||
| 13 | 13 | namespace Installer\Controller; |
| 14 | 14 | |
| 15 | 15 | use Cake\Core\Configure; |
| 16 | -use Cake\Event\Event; |
|
| 17 | 16 | use Cake\Filesystem\File; |
| 18 | -use Cake\I18n\I18n; |
|
| 19 | -use Cake\ORM\Table; |
|
| 20 | -use Cake\ORM\TableRegistry; |
|
| 21 | 17 | use Installer\Form\UpdaterStartForm; |
| 22 | 18 | use Installer\Lib\DbVersion; |
| 23 | 19 | use Psr\Log\LogLevel; |
@@ -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 |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function start() |
| 52 | 52 | { |
| 53 | - $token = new File(CONFIG . 'updater'); |
|
| 53 | + $token = new File(CONFIG.'updater'); |
|
| 54 | 54 | |
| 55 | 55 | if ($token->exists()) { |
| 56 | 56 | $this->renderFailure(__d('installer', 'update.failure.explanation'), 1529737182); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | (new DbVersion($this->Settings))->set($this->saitoVersion); |
| 107 | 107 | $this->logCurrentState('Post upgrade state.'); |
| 108 | 108 | } catch (\Throwable $e) { |
| 109 | - $this->logCurrentState('Migration failed: ' . $e->getMessage()); |
|
| 109 | + $this->logCurrentState('Migration failed: '.$e->getMessage()); |
|
| 110 | 110 | |
| 111 | 111 | return $this->redirect('/'); |
| 112 | 112 | } |