@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function index(): ?string |
| 27 | 27 | { |
| 28 | 28 | // set current page and offset |
| 29 | - $page = (int)$this->request->query->get('page'); |
|
| 29 | + $page = (int) $this->request->query->get('page'); |
|
| 30 | 30 | $offset = $page * self::ITEM_PER_PAGE; |
| 31 | 31 | |
| 32 | 32 | $query = null; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } elseif ($type === 'moderate') { // only items on moderate |
| 38 | 38 | $query = ContentEntity::where('display', '=', 0); |
| 39 | 39 | } elseif (Any::isInt($type)) { // sounds like category id ;) |
| 40 | - $query = ContentEntity::where('category_id', '=', (int)$type); |
|
| 40 | + $query = ContentEntity::where('category_id', '=', (int) $type); |
|
| 41 | 41 | } else { |
| 42 | 42 | $query = new ContentEntity(); |
| 43 | 43 | $type = 'all'; |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | // its a answer, lets remove it and redirect back in post |
| 62 | 62 | $postId = $record->feedback_id; |
| 63 | 63 | $record->delete(); |
| 64 | - $this->response->redirect('feedback/read/' . $postId); |
|
| 64 | + $this->response->redirect('feedback/read/'.$postId); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function index(): ?string |
| 26 | 26 | { |
| 27 | 27 | // set current page and offset |
| 28 | - $page = (int)$this->request->query->get('page'); |
|
| 28 | + $page = (int) $this->request->query->get('page'); |
|
| 29 | 29 | $offset = $page * self::ITEM_PER_PAGE; |
| 30 | 30 | |
| 31 | 31 | // get feedback posts AR table |
@@ -58,6 +58,6 @@ |
||
| 58 | 58 | App::$Session->getFlashBag()->add('success', __('Feedback request is changed!')); |
| 59 | 59 | |
| 60 | 60 | // redirect to feedback post read |
| 61 | - $this->response->redirect('feedback/read/' . $id); |
|
| 61 | + $this->response->redirect('feedback/read/'.$id); |
|
| 62 | 62 | } |
| 63 | 63 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $rootSize = App::$Cache->getItem('root.size'); |
| 32 | 32 | $loadAvg = App::$Cache->getItem('load.avarage'); |
| 33 | 33 | if (!$rootSize->isHit()) { |
| 34 | - $calcSize = round(Directory::size('/') / (1024*1000), 2) . ' mb'; |
|
| 34 | + $calcSize = round(Directory::size('/') / (1024 * 1000), 2).' mb'; |
|
| 35 | 35 | $rootSize->set($calcSize); |
| 36 | 36 | $rootSize->expiresAfter(86400); |
| 37 | 37 | App::$Cache->save($rootSize); |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // prepare system statistic |
| 46 | 46 | $stats = [ |
| 47 | - 'ff_version' => Version::VERSION . ' (' . Version::DATE . ')', |
|
| 48 | - 'php_version' => Environment::phpVersion() . ' (' . Environment::phpSAPI() . ')', |
|
| 47 | + 'ff_version' => Version::VERSION.' ('.Version::DATE.')', |
|
| 48 | + 'php_version' => Environment::phpVersion().' ('.Environment::phpSAPI().')', |
|
| 49 | 49 | 'os_name' => Environment::osName(), |
| 50 | - 'database_name' => App::$Database->connection()->getDatabaseName() . ' (' . App::$Database->connection()->getDriverName() . ')', |
|
| 50 | + 'database_name' => App::$Database->connection()->getDatabaseName().' ('.App::$Database->connection()->getDriverName().')', |
|
| 51 | 51 | 'file_size' => $rootSize->get(), |
| 52 | 52 | 'load_avg' => $loadAvg->get() |
| 53 | 53 | ]; |
@@ -41,12 +41,12 @@ |
||
| 41 | 41 | parent::before(); |
| 42 | 42 | $configs = AppRecord::getConfigs('app', 'Content'); |
| 43 | 43 | // prevent null-type config data |
| 44 | - if ((int)$configs['gallerySize'] > 0) { |
|
| 45 | - $this->maxSize = (int)$configs['gallerySize'] * 1024; |
|
| 44 | + if ((int) $configs['gallerySize'] > 0) { |
|
| 45 | + $this->maxSize = (int) $configs['gallerySize'] * 1024; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if ((int)$configs['galleryResize'] > 0) { |
|
| 49 | - $this->maxResize = (int)$configs['galleryResize']; |
|
| 48 | + if ((int) $configs['galleryResize'] > 0) { |
|
| 49 | + $this->maxResize = (int) $configs['galleryResize']; |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // check if directory exist |
| 49 | - if (!Directory::exist('/upload/gallery/' . $id)) { |
|
| 50 | - Directory::create('/upload/gallery/' . $id); |
|
| 49 | + if (!Directory::exist('/upload/gallery/'.$id)) { |
|
| 50 | + Directory::create('/upload/gallery/'.$id); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // get file object |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // check file size |
| 61 | 61 | if ($file->getSize() < 1 || $file->getSize() > $this->maxSize) { |
| 62 | - throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int)($this->maxSize/1024)])); |
|
| 62 | + throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int) ($this->maxSize / 1024)])); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // check file extension |
@@ -68,40 +68,40 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // create origin directory |
| 71 | - $originPath = '/upload/gallery/' . $id . '/orig/'; |
|
| 71 | + $originPath = '/upload/gallery/'.$id.'/orig/'; |
|
| 72 | 72 | if (!Directory::exist($originPath)) { |
| 73 | 73 | Directory::create($originPath); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // lets make a new file name |
| 77 | - $fileName = App::$Security->simpleHash($file->getClientOriginalName() . $file->getSize()); |
|
| 78 | - $fileNewName = $fileName . '.' . $file->guessExtension(); |
|
| 77 | + $fileName = App::$Security->simpleHash($file->getClientOriginalName().$file->getSize()); |
|
| 78 | + $fileNewName = $fileName.'.'.$file->guessExtension(); |
|
| 79 | 79 | // check if image is already loaded |
| 80 | - if (File::exist($originPath . $fileNewName)) { |
|
| 80 | + if (File::exist($originPath.$fileNewName)) { |
|
| 81 | 81 | throw new ForbiddenException(__('File is always exists!')); |
| 82 | 82 | } |
| 83 | 83 | // save file from tmp to gallery origin directory |
| 84 | 84 | $file->move(Normalize::diskFullPath($originPath), $fileNewName); |
| 85 | 85 | |
| 86 | 86 | // lets resize preview image for it |
| 87 | - $thumbPath = '/upload/gallery/' . $id . '/thumb/'; |
|
| 87 | + $thumbPath = '/upload/gallery/'.$id.'/thumb/'; |
|
| 88 | 88 | if (!Directory::exist($thumbPath)) { |
| 89 | 89 | Directory::create($thumbPath); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $thumb = new Image(); |
| 93 | - $thumb->setCacheDir(root . '/Private/Cache/images'); |
|
| 93 | + $thumb->setCacheDir(root.'/Private/Cache/images'); |
|
| 94 | 94 | |
| 95 | 95 | // open original file, resize it and save |
| 96 | - $thumbSaveName = Normalize::diskFullPath($thumbPath) . '/' . $fileName . '.jpg'; |
|
| 97 | - $thumb->open(Normalize::diskFullPath($originPath) . DIRECTORY_SEPARATOR . $fileNewName) |
|
| 96 | + $thumbSaveName = Normalize::diskFullPath($thumbPath).'/'.$fileName.'.jpg'; |
|
| 97 | + $thumb->open(Normalize::diskFullPath($originPath).DIRECTORY_SEPARATOR.$fileNewName) |
|
| 98 | 98 | ->cropResize($this->maxResize) |
| 99 | 99 | ->save($thumbSaveName, 'jpg', 90); |
| 100 | 100 | $thumb = null; |
| 101 | 101 | |
| 102 | 102 | return json_encode(['status' => 1, 'file' => [ |
| 103 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
| 104 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $fileNewName, |
|
| 103 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
| 104 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$fileNewName, |
|
| 105 | 105 | 'name' => $fileNewName |
| 106 | 106 | ]]); |
| 107 | 107 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $this->setJsonHeader(); |
| 34 | 34 | if (!$file || Any::isEmpty($file)) { |
| 35 | - $file = (string)$this->request->query->get('file', null); |
|
| 35 | + $file = (string) $this->request->query->get('file', null); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // check passed data |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // generate path |
| 51 | - $thumb = '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg'; |
|
| 52 | - $full = '/upload/gallery/' . $id . '/orig/' . $file; |
|
| 51 | + $thumb = '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg'; |
|
| 52 | + $full = '/upload/gallery/'.$id.'/orig/'.$file; |
|
| 53 | 53 | |
| 54 | 54 | // check if file exists and remove |
| 55 | 55 | if (File::exist($thumb) || File::exist($full)) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | throw new NativeException('Permission denied'); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/'); |
|
| 41 | + $thumbDir = Normalize::diskFullPath('/upload/gallery/'.$id.'/orig/'); |
|
| 42 | 42 | if (!Directory::exist($thumbDir)) { |
| 43 | 43 | throw new NotFoundException('Nothing found'); |
| 44 | 44 | } |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | $fileExt = Str::lastIn($file, '.'); |
| 54 | 54 | $fileName = Str::sub($file, 0, -Str::length($fileExt)); |
| 55 | 55 | $output[] = [ |
| 56 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
| 57 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $file, |
|
| 56 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
| 57 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$file, |
|
| 58 | 58 | 'name' => $file, |
| 59 | - 'size' => File::size('/upload/gallery/' . $id . '/orig/' . $file) |
|
| 59 | + 'size' => File::size('/upload/gallery/'.$id.'/orig/'.$file) |
|
| 60 | 60 | ]; |
| 61 | 61 | } |
| 62 | 62 | |