@@ -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 |
@@ -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 | |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | |
| 13 | 13 | namespace Installer\Test\TestCase\Controller; |
| 14 | 14 | |
| 15 | -use App\Model\Table\SettingsTable; |
|
| 16 | 15 | use Cake\Core\Configure; |
| 17 | 16 | use Cake\Datasource\ConnectionManager; |
| 18 | 17 | use Cake\Filesystem\File; |
@@ -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,7 +35,7 @@ discard block |
||
| 35 | 35 | public function setUp() |
| 36 | 36 | { |
| 37 | 37 | parent::setUp(); |
| 38 | - $this->token = new File(CONFIG . 'updater'); |
|
| 38 | + $this->token = new File(CONFIG.'updater'); |
|
| 39 | 39 | $this->dbVersion = (new DbVersion(TableRegistry::get('Settings'))); |
| 40 | 40 | Configure::write('Saito.updated', false); |
| 41 | 41 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $this->assertResponseOk(); |
| 56 | 56 | $this->assertEquals('failure', $this->_controller->viewBuilder()->getTemplate()); |
| 57 | - $this->assertResponseContains((string)1529737182); |
|
| 57 | + $this->assertResponseContains((string) 1529737182); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function testUpdaterShowFailureNoDbVersionString() |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $this->assertResponseOk(); |
| 66 | 66 | $this->assertEquals('failure', $this->_controller->viewBuilder()->getTemplate()); |
| 67 | - $this->assertResponseContains((string)1529737397); |
|
| 67 | + $this->assertResponseContains((string) 1529737397); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function testUpdaterShowFailureWrongDbVersionString() |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $this->assertResponseOk(); |
| 76 | 76 | $this->assertEquals('failure', $this->_controller->viewBuilder()->getTemplate()); |
| 77 | - $this->assertResponseContains((string)1529737648); |
|
| 77 | + $this->assertResponseContains((string) 1529737648); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function testUpdaterInitMigrationsFormEmpty() |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | namespace App\Auth; |
| 11 | 11 | |
| 12 | 12 | use Cake\Auth\BaseAuthenticate; |
| 13 | -use Cake\Core\Configure; |
|
| 14 | 13 | use Cake\Event\Event; |
| 15 | 14 | use Cake\Http\Response; |
| 16 | 15 | use Cake\Http\ServerRequest; |
@@ -16,7 +16,6 @@ discard block |
||
| 16 | 16 | use Cake\Core\Configure; |
| 17 | 17 | use Cake\Event\Event; |
| 18 | 18 | use Cake\ORM\TableRegistry; |
| 19 | -use Cake\Routing\Router; |
|
| 20 | 19 | use Cake\Utility\Security; |
| 21 | 20 | use Firebase\JWT\JWT; |
| 22 | 21 | use Saito\App\Registry; |
@@ -26,7 +25,6 @@ discard block |
||
| 26 | 25 | use Saito\User\CurrentUser\CurrentUserInterface; |
| 27 | 26 | use Saito\User\CurrentUser\CurrentUserTrait; |
| 28 | 27 | use Saito\User\LastRefresh; |
| 29 | -use Saito\User\ReadPostings; |
|
| 30 | 28 | use Saito\User\ReadPostings\ReadPostingsCookie; |
| 31 | 29 | use Saito\User\ReadPostings\ReadPostingsDatabase; |
| 32 | 30 | use Saito\User\ReadPostings\ReadPostingsDummy; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | //= set persistent Cookie |
| 183 | - $setCookie = (bool)$this->request->getData('remember_me'); |
|
| 183 | + $setCookie = (bool) $this->request->getData('remember_me'); |
|
| 184 | 184 | if ($setCookie) { |
| 185 | 185 | (new CurrentUserCookie($this->getController()))->write($this->getId()); |
| 186 | 186 | }; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $auth->setConfig('loginAction', '/login'); |
| 293 | 293 | |
| 294 | 294 | $here = urlencode($this->getController()->getRequest()->getRequestTarget()); |
| 295 | - $auth->setConfig('unauthorizedRedirect', '/login?redirect=' . $here); |
|
| 295 | + $auth->setConfig('unauthorizedRedirect', '/login?redirect='.$here); |
|
| 296 | 296 | |
| 297 | 297 | if ($this->isLoggedIn()) { |
| 298 | 298 | $auth->allow(); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | private function setJwtCookie(Controller $controller): void |
| 320 | 320 | { |
| 321 | - $cookieKey = Configure::read('Session.cookie') . '-jwt'; |
|
| 321 | + $cookieKey = Configure::read('Session.cookie').'-jwt'; |
|
| 322 | 322 | $cookie = (new Storage($controller, $cookieKey, ['http' => false, 'expire' => '+1 week'])); |
| 323 | 323 | |
| 324 | 324 | $existingToken = $cookie->read(); |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace App\Controller\Component; |
| 4 | 4 | |
| 5 | 5 | use Cake\Controller\Component; |
| 6 | -use Cake\Core\Configure; |
|
| 7 | 6 | use Saito\User\ForumsUserInterface; |
| 8 | 7 | |
| 9 | 8 | class SlidetabsComponent extends Component |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $tabs = $slidetabs; |
| 50 | 50 | } |
| 51 | 51 | $tabs = array_map( |
| 52 | - function ($v) { |
|
| 52 | + function($v) { |
|
| 53 | 53 | return $this->_available[$v]; |
| 54 | 54 | }, |
| 55 | 55 | $tabs |