@@ -56,7 +56,7 @@ |
||
| 56 | 56 | ]); |
| 57 | 57 | |
| 58 | 58 | $configs->newcontent = serialize([ |
| 59 | - 'categories' => ['2','3'], |
|
| 59 | + 'categories' => ['2', '3'], |
|
| 60 | 60 | 'count' => '5', |
| 61 | 61 | 'cache' => '60' |
| 62 | 62 | ]); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function before() |
| 44 | 44 | { |
| 45 | 45 | foreach ($this->_apps as $app) { |
| 46 | - $this->_definedControllers[] = (string)$app->sys_name; |
|
| 46 | + $this->_definedControllers[] = (string) $app->sys_name; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | parent::before(); |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | public function make() |
| 80 | 80 | { |
| 81 | 81 | $cName = ucfirst(Str::lowerCase($this->sysname)); |
| 82 | - $cPath = 'Apps\Controller\Admin\\' . $cName; |
|
| 82 | + $cPath = 'Apps\Controller\Admin\\'.$cName; |
|
| 83 | 83 | // if object class is not loaded - prevent install |
| 84 | - if (!class_exists($cPath) || !defined($cPath . '::VERSION')) { |
|
| 84 | + if (!class_exists($cPath) || !defined($cPath.'::VERSION')) { |
|
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // get ext version |
| 89 | - $cVersion = constant($cPath . '::VERSION'); |
|
| 89 | + $cVersion = constant($cPath.'::VERSION'); |
|
| 90 | 90 | if ($cVersion === null || Str::likeEmpty($cVersion)) { |
| 91 | 91 | $cVersion = '1.0.0'; |
| 92 | 92 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // callback to install method in extension |
| 104 | 104 | if (method_exists($cPath, 'install')) { |
| 105 | - call_user_func($cPath . '::install'); |
|
| 105 | + call_user_func($cPath.'::install'); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return true; |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | parent::before(); |
| 34 | 34 | $configs = AppRecord::getConfigs('app', 'Content'); |
| 35 | 35 | // prevent null-type config data |
| 36 | - if ((int)$configs['gallerySize'] > 0) { |
|
| 37 | - $this->maxSize = (int)$configs['gallerySize'] * 1024; |
|
| 36 | + if ((int) $configs['gallerySize'] > 0) { |
|
| 37 | + $this->maxSize = (int) $configs['gallerySize'] * 1024; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if ((int)$configs['galleryResize'] > 0) { |
|
| 41 | - $this->maxResize = (int)$configs['galleryResize']; |
|
| 40 | + if ((int) $configs['galleryResize'] > 0) { |
|
| 41 | + $this->maxResize = (int) $configs['galleryResize']; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // check if directory exist |
| 120 | - if (!Directory::exist('/upload/gallery/' . $id)) { |
|
| 121 | - Directory::create('/upload/gallery/' . $id); |
|
| 120 | + if (!Directory::exist('/upload/gallery/'.$id)) { |
|
| 121 | + Directory::create('/upload/gallery/'.$id); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // get file object |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | // check file size |
| 132 | 132 | if ($file->getSize() < 1 || $file->getSize() > $this->maxSize) { |
| 133 | - throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int)($this->maxSize/1024)])); |
|
| 133 | + throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int) ($this->maxSize / 1024)])); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // check file extension |
@@ -139,41 +139,41 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // create origin directory |
| 142 | - $originPath = '/upload/gallery/' . $id . '/orig/'; |
|
| 142 | + $originPath = '/upload/gallery/'.$id.'/orig/'; |
|
| 143 | 143 | if (!Directory::exist($originPath)) { |
| 144 | 144 | Directory::create($originPath); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // lets make a new file name |
| 148 | - $fileName = App::$Security->simpleHash($file->getClientOriginalName() . $file->getSize()); |
|
| 149 | - $fileNewName = $fileName . '.' . $file->guessExtension(); |
|
| 148 | + $fileName = App::$Security->simpleHash($file->getClientOriginalName().$file->getSize()); |
|
| 149 | + $fileNewName = $fileName.'.'.$file->guessExtension(); |
|
| 150 | 150 | // check if image is already loaded |
| 151 | - if (File::exist($originPath . $fileNewName)) { |
|
| 151 | + if (File::exist($originPath.$fileNewName)) { |
|
| 152 | 152 | throw new ForbiddenException(__('File is always exists!')); |
| 153 | 153 | } |
| 154 | 154 | // save file from tmp to gallery origin directory |
| 155 | 155 | $file->move(Normalize::diskFullPath($originPath), $fileNewName); |
| 156 | 156 | |
| 157 | 157 | // lets resize preview image for it |
| 158 | - $thumbPath = '/upload/gallery/' . $id . '/thumb/'; |
|
| 158 | + $thumbPath = '/upload/gallery/'.$id.'/thumb/'; |
|
| 159 | 159 | if (!Directory::exist($thumbPath)) { |
| 160 | 160 | Directory::create($thumbPath); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $thumb = new Image(); |
| 164 | - $thumb->setCacheDir(root . '/Private/Cache/images'); |
|
| 164 | + $thumb->setCacheDir(root.'/Private/Cache/images'); |
|
| 165 | 165 | |
| 166 | 166 | // open original file, resize it and save |
| 167 | - $thumbSaveName = Normalize::diskFullPath($thumbPath) . '/' . $fileName . '.jpg'; |
|
| 168 | - $thumb->open(Normalize::diskFullPath($originPath) . DIRECTORY_SEPARATOR . $fileNewName) |
|
| 167 | + $thumbSaveName = Normalize::diskFullPath($thumbPath).'/'.$fileName.'.jpg'; |
|
| 168 | + $thumb->open(Normalize::diskFullPath($originPath).DIRECTORY_SEPARATOR.$fileNewName) |
|
| 169 | 169 | ->cropResize($this->maxResize) |
| 170 | 170 | ->save($thumbSaveName, 'jpg', 90); |
| 171 | 171 | $thumb = null; |
| 172 | 172 | |
| 173 | 173 | $this->setJsonHeader(); |
| 174 | 174 | return json_encode(['status' => 1, 'file' => [ |
| 175 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
| 176 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $fileNewName, |
|
| 175 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
| 176 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$fileNewName, |
|
| 177 | 177 | 'name' => $fileNewName |
| 178 | 178 | ]]); |
| 179 | 179 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | throw new NativeException('Permission denied'); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/'); |
|
| 200 | + $thumbDir = Normalize::diskFullPath('/upload/gallery/'.$id.'/orig/'); |
|
| 201 | 201 | if (!Directory::exist($thumbDir)) { |
| 202 | 202 | throw new NotFoundException('Nothing found'); |
| 203 | 203 | } |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | $fileExt = Str::lastIn($file, '.'); |
| 213 | 213 | $fileName = Str::sub($file, 0, -Str::length($fileExt)); |
| 214 | 214 | $output[] = [ |
| 215 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
| 216 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $file, |
|
| 215 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
| 216 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$file, |
|
| 217 | 217 | 'name' => $file, |
| 218 | - 'size' => File::size('/upload/gallery/' . $id . '/orig/' . $file) |
|
| 218 | + 'size' => File::size('/upload/gallery/'.$id.'/orig/'.$file) |
|
| 219 | 219 | ]; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | public function actionGallerydelete($id, $file = null) |
| 235 | 235 | { |
| 236 | 236 | if ($file === null || Str::likeEmpty($file)) { |
| 237 | - $file = (string)$this->request->query->get('file', null); |
|
| 237 | + $file = (string) $this->request->query->get('file', null); |
|
| 238 | 238 | } |
| 239 | 239 | // check passed data |
| 240 | 240 | if (Str::likeEmpty($file) || !Obj::isLikeInt($id)) { |
@@ -249,8 +249,8 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // generate path |
| 252 | - $thumb = '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg'; |
|
| 253 | - $full = '/upload/gallery/' . $id . '/orig/' . $file; |
|
| 252 | + $thumb = '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg'; |
|
| 253 | + $full = '/upload/gallery/'.$id.'/orig/'.$file; |
|
| 254 | 254 | |
| 255 | 255 | // check if file exists and remove |
| 256 | 256 | if (File::exist($thumb) || File::exist($full)) { |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * FormContentPublish constructor. Pass records inside |
| 20 | - * @param Content[]|Collection $records |
|
| 20 | + * @param \Ffcms\Core\Arch\ActiveModel $records |
|
| 21 | 21 | */ |
| 22 | 22 | public function __construct($records) |
| 23 | 23 | { |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Apps\Model\Front\Profile; |
| 4 | 4 | |
| 5 | 5 | use Apps\ActiveRecord\Blacklist; |
| 6 | -use Ffcms\Core\App; |
|
| 7 | 6 | use Ffcms\Core\Arch\Model; |
| 8 | 7 | use Ffcms\Core\Interfaces\iUser; |
| 9 | 8 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $connector = new \elFinderConnector(new \elFinder([ |
| 38 | 38 | 'locale' => '', |
| 39 | 39 | 'roots' => [ |
| 40 | - ['driver' => 'LocalFileSystem', 'path' => root . '/upload/', 'URL' => App::$Alias->scriptUrl . '/upload/'] |
|
| 40 | + ['driver' => 'LocalFileSystem', 'path' => root.'/upload/', 'URL' => App::$Alias->scriptUrl.'/upload/'] |
|
| 41 | 41 | ] |
| 42 | 42 | ])); |
| 43 | 43 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | if (App::$Cache->get('download.ffcms.api.news.'.$this->lang) !== null) { |
| 106 | 106 | $news = App::$Cache->get('download.ffcms.api.news.'.$this->lang); |
| 107 | 107 | } else { |
| 108 | - $news = Url::download('https://ffcms.org/api/api/news?lang=' . $this->lang); |
|
| 108 | + $news = Url::download('https://ffcms.org/api/api/news?lang='.$this->lang); |
|
| 109 | 109 | if ($news !== null && !Str::likeEmpty($news)) { |
| 110 | 110 | App::$Cache->set('download.ffcms.api.news.'.$this->lang, $news, 3600 * 12); |
| 111 | 111 | } |
@@ -56,7 +56,10 @@ |
||
| 56 | 56 | |
| 57 | 57 | <?php if($model->checkAll()): ?> |
| 58 | 58 | <?= \Ffcms\Core\Helper\Url::link('main/install', __('Start install'), ['class' => 'btn btn-success btn-block']) ?> |
| 59 | -<?php else: ?> |
|
| 59 | +<?php else { |
|
| 60 | + : ?> |
|
| 60 | 61 | <?= \Ffcms\Core\Helper\Url::link('main/index', __('Check again'), ['class' => 'btn btn-warning btn-block']) ?> |
| 61 | -<?php endif; ?> |
|
| 62 | +<?php endif; |
|
| 63 | +} |
|
| 64 | +?> |
|
| 62 | 65 | |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | foreach ($all as $file) { |
| 41 | 41 | $file = Str::cleanExtension(basename($file)); |
| 42 | 42 | // $file="3.0.0-3.0.1" become to $start = 3.0.0,$end=3.0.1 |
| 43 | - list($start,$end) = explode('-', $file); |
|
| 43 | + list($start, $end) = explode('-', $file); |
|
| 44 | 44 | // true: start <= db & script >= $end |
| 45 | - if (version_compare($this->dbVersion, $start) !== 1 && version_compare($this->scriptVersion, $end) !== -1) { |
|
| 45 | + if (version_compare($this->dbVersion, $start) !== 1 && version_compare($this->scriptVersion, $end) !== -1) { |
|
| 46 | 46 | $this->updateQueries[] = $file; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | // run update queries from included files |
| 58 | 58 | foreach ($this->updateQueries as $file) { |
| 59 | - @include root . '/Private/Database/Updates/' . $file . '.php'; |
|
| 59 | + @include root.'/Private/Database/Updates/'.$file.'.php'; |
|
| 60 | 60 | } |
| 61 | 61 | // update version in db table |
| 62 | 62 | $row = System::getVar('version'); |
@@ -34,12 +34,12 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function make() |
| 36 | 36 | { |
| 37 | - $archive = $this->name . '.zip'; |
|
| 37 | + $archive = $this->name.'.zip'; |
|
| 38 | 38 | // download archive |
| 39 | - File::saveFromUrl($this->url, '/' . $archive); |
|
| 39 | + File::saveFromUrl($this->url, '/'.$archive); |
|
| 40 | 40 | // extract archive |
| 41 | 41 | $zip = new \ZipArchive(); |
| 42 | - if ($zip->open(root . '/' . $archive) === true) { |
|
| 42 | + if ($zip->open(root.'/'.$archive) === true) { |
|
| 43 | 43 | $zip->extractTo(root); |
| 44 | 44 | $zip->close(); |
| 45 | 45 | // cleanup cache |