@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | ]); |
| 56 | 56 | |
| 57 | 57 | foreach ($records as $user) { |
| 58 | - $roleHtml = $user->role->color ? '<span class="badge badge-light" style="color: ' . $user->role->color . '">' . $user->role->name . '</span>' : $user->role->name; |
|
| 58 | + $roleHtml = $user->role->color ? '<span class="badge badge-light" style="color: '.$user->role->color.'">'.$user->role->name.'</span>' : $user->role->name; |
|
| 59 | 59 | |
| 60 | 60 | $table->row([ |
| 61 | 61 | ['text' => $user->id], |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | ->add('<i class="fa fa-trash-o"></i>', ['user/delete', [$user->id]], ['class' => 'btn btn-danger', 'html' => true]) |
| 70 | 70 | ->display(), |
| 71 | 71 | 'properties' => ['class' => 'text-center'], 'html' => true], |
| 72 | - 'properties' => ['class' => 'checkbox-row' . ($user->approve_token !== null ? ' bg-warning' : null)] |
|
| 72 | + 'properties' => ['class' => 'checkbox-row'.($user->approve_token !== null ? ' bg-warning' : null)] |
|
| 73 | 73 | |
| 74 | 74 | ]); |
| 75 | 75 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | ['text' => $model->getUser()->id], |
| 35 | 35 | ['text' => $model->getUser()->email], |
| 36 | 36 | ['text' => $model->getUser()->login], |
| 37 | - ['text' => $model->getUser()->profile->nick ?? 'id' . $model->getUser()->id], |
|
| 37 | + ['text' => $model->getUser()->profile->nick ?? 'id'.$model->getUser()->id], |
|
| 38 | 38 | ['text' => Date::convertToDatetime($model->getUser()->created_at, Date::FORMAT_TO_HOUR)], |
| 39 | 39 | ])->display() ?> |
| 40 | 40 | </div> |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | $langMenu->menu([ |
| 52 | 52 | 'text' => Str::upperCase($lang), |
| 53 | 53 | 'tab' => function() use ($form, $lang) { |
| 54 | - return $form->fieldset()->text('title.' . $lang, null, __('Fill the title of the content for current language locale')) . |
|
| 55 | - '<strong>' . __('Content text') . '</strong><br />' . |
|
| 56 | - $form->field()->textarea('text.' . $lang, ['class' => 'form-control wysiwyg', 'rows' => 7]); |
|
| 54 | + return $form->fieldset()->text('title.'.$lang, null, __('Fill the title of the content for current language locale')). |
|
| 55 | + '<strong>'.__('Content text').'</strong><br />'. |
|
| 56 | + $form->field()->textarea('text.'.$lang, ['class' => 'form-control wysiwyg', 'rows' => 7]); |
|
| 57 | 57 | }, |
| 58 | 58 | 'tabActive' => $lang === \App::$Request->getLanguage() |
| 59 | 59 | ]); |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | $langMenu->menu([ |
| 73 | 73 | 'text' => Str::upperCase($lang), |
| 74 | 74 | 'tab' => function() use ($form, $lang) { |
| 75 | - return $form->fieldset()->text('metaTitle.' . $lang, null, __('Set meta title for content page (displayed in browser head). Recommended length: 50-70 chars')). |
|
| 76 | - $form->fieldset()->text('metaKeywords.' . $lang, ['class' => 'tag-selectize'], __('Set meta keywords for this content (for search engine crawlers) separated by comma')). |
|
| 77 | - $form->fieldset()->text('metaTitle.' . $lang, null, __('Set meta description for this content (for search engine crawlers). Recommended length: 200-250 chars')); |
|
| 75 | + return $form->fieldset()->text('metaTitle.'.$lang, null, __('Set meta title for content page (displayed in browser head). Recommended length: 50-70 chars')). |
|
| 76 | + $form->fieldset()->text('metaKeywords.'.$lang, ['class' => 'tag-selectize'], __('Set meta keywords for this content (for search engine crawlers) separated by comma')). |
|
| 77 | + $form->fieldset()->text('metaTitle.'.$lang, null, __('Set meta description for this content (for search engine crawlers). Recommended length: 200-250 chars')); |
|
| 78 | 78 | }, |
| 79 | 79 | 'tabActive' => $lang === \App::$Request->getLanguage() |
| 80 | 80 | ]); |
@@ -92,16 +92,16 @@ discard block |
||
| 92 | 92 | <div class="dropzone dropzone-previews" id="ffcms-dropzone"></div> |
| 93 | 93 | </div> |
| 94 | 94 | <div class="col-md-4"> |
| 95 | - ' . $form->fieldset()->select('poster', ['options' => [__('Not selected...')]], __("Select image from gallery as a poster for this content")) . ' |
|
| 95 | + ' . $form->fieldset()->select('poster', ['options' => [__('Not selected...')]], __("Select image from gallery as a poster for this content")).' |
|
| 96 | 96 | </div> |
| 97 | 97 | </div><br/><br/>'; |
| 98 | 98 | }]) |
| 99 | 99 | ->menu(['text' => __('Other'), 'tab' => function() use ($form, $model) { |
| 100 | - return $form->fieldset()->boolean('display', null, __('Can users view this content or only available for administrators?')) . |
|
| 101 | - $form->fieldset()->boolean('important', null, __('Make this material important and stack it on top of all news?')) . |
|
| 102 | - $form->fieldset()->text('createdAt', ['class' => 'form-control datepick'], __('Set the date of creation or leave empty for current date')) . |
|
| 103 | - $form->fieldset()->select('authorId', ['options' => $model->getUserIdName(), 'optionsKey' => true, 'class' => 'selectize-option'], __('Enter author user_id or leave empty to set current user as author')) . |
|
| 104 | - $form->fieldset()->text('source', null, __('Set source URL if this content is copied from another website')) . |
|
| 100 | + return $form->fieldset()->boolean('display', null, __('Can users view this content or only available for administrators?')). |
|
| 101 | + $form->fieldset()->boolean('important', null, __('Make this material important and stack it on top of all news?')). |
|
| 102 | + $form->fieldset()->text('createdAt', ['class' => 'form-control datepick'], __('Set the date of creation or leave empty for current date')). |
|
| 103 | + $form->fieldset()->select('authorId', ['options' => $model->getUserIdName(), 'optionsKey' => true, 'class' => 'selectize-option'], __('Enter author user_id or leave empty to set current user as author')). |
|
| 104 | + $form->fieldset()->text('source', null, __('Set source URL if this content is copied from another website')). |
|
| 105 | 105 | $form->fieldset()->text('addRating', null, __('Add or reduce this content rating. Example: 5 gives +5 to total rating, -5 gives -5 to total')); |
| 106 | 106 | }]); |
| 107 | 107 | |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | ['text' => $comment->id], |
| 129 | 129 | ['text' => Text::snippet(\App::$Security->strip_tags($comment->message), 100)], |
| 130 | 130 | ['text' => $comment->getAnswerCount()], |
| 131 | - ['text' => Url::a(['user/update', [$comment->user_id]], ($comment->user->profile->nick ?? 'id' . $comment->user->id)), 'html' => true], |
|
| 131 | + ['text' => Url::a(['user/update', [$comment->user_id]], ($comment->user->profile->nick ?? 'id'.$comment->user->id)), 'html' => true], |
|
| 132 | 132 | ['text' => $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm']) |
| 133 | 133 | ->add('<i class="fa fa-pencil"></i>', ['comments/read', [$comment->id]], ['html' => true, 'class' => 'btn btn-primary', 'target' => '_blank']) |
| 134 | 134 | ->add('<i class="fa fa-trash-o"></i>', ['comments/delete', ['comment', $comment->id]], ['html' => true, 'class' => 'btn btn-danger', 'target' => '_blank']) |
| 135 | - ->display(),'properties' => ['class' => 'text-center'], 'html' => true |
|
| 135 | + ->display(), 'properties' => ['class' => 'text-center'], 'html' => true |
|
| 136 | 136 | ] |
| 137 | 137 | ]); |
| 138 | 138 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | var DropzoneFiles = []; |
| 239 | 239 | $('#ffcms-dropzone').dropzone({ |
| 240 | 240 | url: script_url + '/api/content/galleryupload/<?= $model->galleryFreeId ?>?lang=' + script_lang, |
| 241 | - dictDefaultMessage: '<?= __('Drop files here to upload in gallery') . '<br />' . __('(or click here)') ?>', |
|
| 241 | + dictDefaultMessage: '<?= __('Drop files here to upload in gallery').'<br />'.__('(or click here)') ?>', |
|
| 242 | 242 | acceptedFiles: ".jpeg,.jpg,.png,.gif,.webp", |
| 243 | 243 | addRemoveLinks: true, |
| 244 | 244 | removedfile: function (file) { // file remove click, lets try to remove file from server & make visual changes |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | <h1><?= __('Category list') ?></h1> |
| 26 | 26 | <div class="row"> |
| 27 | 27 | <div class="col-md-12"> |
| 28 | - <?= Url::a(['content/categoryupdate'], '<i class="fa fa-plus"></i> ' . __('Add category'), ['class' => 'btn btn-primary', 'html' => true]) ?> |
|
| 28 | + <?= Url::a(['content/categoryupdate'], '<i class="fa fa-plus"></i> '.__('Add category'), ['class' => 'btn btn-primary', 'html' => true]) ?> |
|
| 29 | 29 | </div> |
| 30 | 30 | </div> |
| 31 | 31 | <div class="table-responsive"> |
@@ -56,17 +56,17 @@ discard block |
||
| 56 | 56 | <tr> |
| 57 | 57 | <td> |
| 58 | 58 | <div class="row"> |
| 59 | - <div class="d-none d-md-block col-md-<?= $offset ?> col-xs-<?= $offset+2 ?> " style="border-bottom: 2px solid #8a8a8a;height: 1px;padding-top: 10px;"></div> |
|
| 60 | - <div class="col-md-<?= $set ?> col-xs-<?= $set-2 ?>"> |
|
| 59 | + <div class="d-none d-md-block col-md-<?= $offset ?> col-xs-<?= $offset + 2 ?> " style="border-bottom: 2px solid #8a8a8a;height: 1px;padding-top: 10px;"></div> |
|
| 60 | + <div class="col-md-<?= $set ?> col-xs-<?= $set - 2 ?>"> |
|
| 61 | 61 | <?= $row->getLocaled('title') ?> |
| 62 | 62 | <sup>id: <?= $row->id ?></sup> |
| 63 | - <a href="<?= \App::$Alias->scriptUrl . '/content/list/' . $row->path ?>" target="_blank" class="badge badge-secondary">/<?= $row->path ?></a> |
|
| 63 | + <a href="<?= \App::$Alias->scriptUrl.'/content/list/'.$row->path ?>" target="_blank" class="badge badge-secondary">/<?= $row->path ?></a> |
|
| 64 | 64 | </div> |
| 65 | 65 | </div> |
| 66 | 66 | </td> |
| 67 | 67 | <td class="text-center"> |
| 68 | 68 | <?php $btn = $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm', 'dropdown' => ['class' => 'btn-group btn-group-sm'], 'role' => 'group'], 4) |
| 69 | - ->add('<i class="fa fa-eye"></i>', [\App::$Alias->scriptUrl . '/content/list/' . $row->path], ['html' => true, 'target' => '_blank']) |
|
| 69 | + ->add('<i class="fa fa-eye"></i>', [\App::$Alias->scriptUrl.'/content/list/'.$row->path], ['html' => true, 'target' => '_blank']) |
|
| 70 | 70 | ->add('<i class="fa fa-plus"></i>', ['content/categoryupdate', null, ['parent' => $row->id]], ['class' => 'btn btn-success', 'data-toggle' => 'tooltip', 'title' => __('Add subcategory'), 'html' => true]) |
| 71 | 71 | ->add('<i class="fa fa-cog"></i>', ['content/categoryupdate', [$row->id]], ['class' => 'btn btn-primary', 'data-toggle' => 'tooltip', 'title' => __('Category configurations'), 'html' => true]); |
| 72 | 72 | if ($row->id > 1) { |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function make() |
| 72 | 72 | { |
| 73 | - if ((bool)$this->comments) { |
|
| 73 | + if ((bool) $this->comments) { |
|
| 74 | 74 | CommentPost::where('user_id', $this->_user->id)->delete(); |
| 75 | 75 | CommentAnswer::where('user_id', $this->_user->id)->delete(); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if ((bool)$this->content) { |
|
| 78 | + if ((bool) $this->content) { |
|
| 79 | 79 | $contents = Content::where('author_id', $this->_user->id); |
| 80 | 80 | $ids = $contents->pluck('id')->toArray(); |
| 81 | 81 | if ($ids && count($ids) > 0) { |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if ((bool)$this->feedback) { |
|
| 88 | + if ((bool) $this->feedback) { |
|
| 89 | 89 | FeedbackPost::where('user_id', $this->_user->id) |
| 90 | 90 | ->update(['readed' => true, 'closed' => true]); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if ((bool)$this->wall) { |
|
| 93 | + if ((bool) $this->wall) { |
|
| 94 | 94 | WallPost::where('sender_id', $this->_user->id)->delete(); |
| 95 | 95 | WallAnswer::where('user_id', $this->_user->id)->delete(); |
| 96 | 96 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | foreach ($this->users as $user) { |
| 80 | 80 | $uid = $user->id; |
| 81 | 81 | // delete whole website info for this user |
| 82 | - if ((bool)$this->delete) { |
|
| 82 | + if ((bool) $this->delete) { |
|
| 83 | 83 | $model = new FormUserClear($user); |
| 84 | 84 | $model->comments = true; |
| 85 | 85 | $model->content = true; |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // delete avatars |
| 92 | - File::remove('/upload/user/avatar/big/' . $uid . '.jpg'); |
|
| 93 | - File::remove('/upload/user/avatar/medium/' . $uid . '.jpg'); |
|
| 94 | - File::remove('/upload/user/avatar/small/' . $uid . '.jpg'); |
|
| 95 | - File::remove('/upload/user/avatar/original/' . $uid . '.jpg'); |
|
| 92 | + File::remove('/upload/user/avatar/big/'.$uid.'.jpg'); |
|
| 93 | + File::remove('/upload/user/avatar/medium/'.$uid.'.jpg'); |
|
| 94 | + File::remove('/upload/user/avatar/small/'.$uid.'.jpg'); |
|
| 95 | + File::remove('/upload/user/avatar/original/'.$uid.'.jpg'); |
|
| 96 | 96 | // delete user profile and auth data |
| 97 | 97 | $user->profile()->delete(); |
| 98 | 98 | // delete user provider data |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | if (!$this->_content->id) { |
| 67 | 67 | $this->_new = true; |
| 68 | 68 | if (!$this->galleryFreeId) { |
| 69 | - $this->galleryFreeId = '_tmp_' . Str::randomLatin(mt_rand(16, 32)); |
|
| 69 | + $this->galleryFreeId = '_tmp_'.Str::randomLatin(mt_rand(16, 32)); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if (!$this->authorId) { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $this->categoryId = 1; |
| 78 | 78 | } |
| 79 | 79 | if (!$this->path) { |
| 80 | - $this->path = Integer::random(8) . '-' . date('d-m-Y'); |
|
| 80 | + $this->path = Integer::random(8).'-'.date('d-m-Y'); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if ($this->cloneId > 0) { |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | public function rules(): array |
| 116 | 116 | { |
| 117 | 117 | $res = [ |
| 118 | - ['title.' . App::$Request->getLanguage(), 'required'], |
|
| 119 | - ['text.' . App::$Request->getLanguage(), 'required'], |
|
| 118 | + ['title.'.App::$Request->getLanguage(), 'required'], |
|
| 119 | + ['text.'.App::$Request->getLanguage(), 'required'], |
|
| 120 | 120 | ['text', 'used'], |
| 121 | 121 | ['path', 'reverse_match', '/[\/\'~`\!@#\$%\^&\*\(\)+=\{\}\[\]\|;:"\<\>,\?\\\]/'], |
| 122 | 122 | [['path', 'categoryId', 'authorId', 'display', 'galleryFreeId', 'title', 'important'], 'required'], |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | ]; |
| 130 | 130 | |
| 131 | 131 | foreach (App::$Properties->get('languages') as $lang) { |
| 132 | - $res[] = ['title.' . $lang, 'length_max', 120, null, true, true]; |
|
| 133 | - $res[] = ['keywords.' . $lang, 'length_max', 150]; |
|
| 134 | - $res[] = ['description.' . $lang, 'length_max', 250]; |
|
| 132 | + $res[] = ['title.'.$lang, 'length_max', 120, null, true, true]; |
|
| 133 | + $res[] = ['keywords.'.$lang, 'length_max', 150]; |
|
| 134 | + $res[] = ['description.'.$lang, 'length_max', 250]; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | return $res; |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | $this->_content->meta_keywords = $this->metaKeywords; |
| 188 | 188 | $this->_content->meta_description = $this->metaDescription; |
| 189 | 189 | $this->_content->source = $this->source; |
| 190 | - $this->_content->important = (int)$this->important; |
|
| 190 | + $this->_content->important = (int) $this->important; |
|
| 191 | 191 | // check if rating is changed |
| 192 | - if ((int)$this->addRating !== 0) { |
|
| 193 | - $this->_content->rating += (int)$this->addRating; |
|
| 192 | + if ((int) $this->addRating !== 0) { |
|
| 193 | + $this->_content->rating += (int) $this->addRating; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // check if date is updated |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // save poster data |
| 202 | - $posterPath = '/upload/gallery/' . $this->galleryFreeId . '/orig/' . $this->poster; |
|
| 202 | + $posterPath = '/upload/gallery/'.$this->galleryFreeId.'/orig/'.$this->poster; |
|
| 203 | 203 | if (File::exist($posterPath)) { |
| 204 | 204 | $this->_content->poster = $this->poster; |
| 205 | 205 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // move files |
| 236 | 236 | if ($tmpGalleryId !== $this->_content->id) { |
| 237 | - Directory::rename('/upload/gallery/' . $tmpGalleryId, $this->_content->id); |
|
| 237 | + Directory::rename('/upload/gallery/'.$tmpGalleryId, $this->_content->id); |
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
@@ -273,9 +273,9 @@ discard block |
||
| 273 | 273 | public function getUserIdName(): ?array |
| 274 | 274 | { |
| 275 | 275 | $users = []; |
| 276 | - User::with('profile')->get()->each(function ($user) use (&$users) { |
|
| 276 | + User::with('profile')->get()->each(function($user) use (&$users) { |
|
| 277 | 277 | /** @var User $user */ |
| 278 | - $users[$user->id] = ($user->profile->nick ?? 'id' . $user->id) . ' (' . $user->email . ')'; |
|
| 278 | + $users[$user->id] = ($user->profile->nick ?? 'id'.$user->id).' ('.$user->email.')'; |
|
| 279 | 279 | }); |
| 280 | 280 | |
| 281 | 281 | return $users; |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | // set current user id |
| 58 | 58 | $this->authorId = App::$User->identity()->getId(); |
| 59 | 59 | // set true if it is a new content item |
| 60 | - if ($this->_record->id === null || (int)$this->_record->id < 1) { |
|
| 60 | + if ($this->_record->id === null || (int) $this->_record->id < 1) { |
|
| 61 | 61 | $this->_new = true; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // set random path slug if not defined |
| 65 | 65 | if ($this->path === null || Str::likeEmpty($this->path)) { |
| 66 | - $randPath = date('d-m-Y') . '-' . Str::randomLatin(mt_rand(8, 12)); |
|
| 66 | + $randPath = date('d-m-Y').'-'.Str::randomLatin(mt_rand(8, 12)); |
|
| 67 | 67 | $this->path = Str::lowerCase($randPath); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -107,21 +107,21 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $r = [ |
| 109 | 109 | [['path', 'categoryId'], 'required'], |
| 110 | - ['title.' . App::$Request->getLanguage(), 'required'], |
|
| 111 | - ['text.' . App::$Request->getLanguage(), 'required', null, true, true], |
|
| 110 | + ['title.'.App::$Request->getLanguage(), 'required'], |
|
| 111 | + ['text.'.App::$Request->getLanguage(), 'required', null, true, true], |
|
| 112 | 112 | ['text', 'used', null, true, true], |
| 113 | 113 | ['path', 'direct_match', '/^[a-zA-Z0-9\-]+$/'], |
| 114 | 114 | ['categoryId', 'in', $this->categoryIds()], |
| 115 | 115 | ['path', 'Apps\Model\Front\Content\FormNarrowContentUpdate::validatePath'], |
| 116 | 116 | ['poster', 'used'], |
| 117 | 117 | ['poster', 'isFile', ['jpg', 'png', 'gif', 'jpeg']], |
| 118 | - ['poster', 'sizeFile', (int)$this->_configs['gallerySize'] * 1024] // in bytes |
|
| 118 | + ['poster', 'sizeFile', (int) $this->_configs['gallerySize'] * 1024] // in bytes |
|
| 119 | 119 | ]; |
| 120 | 120 | |
| 121 | 121 | foreach (App::$Properties->get('languages') as $lang) { |
| 122 | - $r[] = ['title.' . $lang, 'length_max', 120, null, true, true]; |
|
| 123 | - $r[] = ['keywords.' . $lang, 'length_max', 150]; |
|
| 124 | - $r[] = ['description.' . $lang, 'length_max', 250]; |
|
| 122 | + $r[] = ['title.'.$lang, 'length_max', 120, null, true, true]; |
|
| 123 | + $r[] = ['keywords.'.$lang, 'length_max', 150]; |
|
| 124 | + $r[] = ['description.'.$lang, 'length_max', 250]; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | return $r; |
@@ -147,16 +147,16 @@ discard block |
||
| 147 | 147 | $this->_record->title = $this->title; |
| 148 | 148 | $this->_record->text = $this->text; |
| 149 | 149 | $this->_record->path = $this->path; |
| 150 | - $this->_record->category_id = (int)$this->categoryId; |
|
| 150 | + $this->_record->category_id = (int) $this->categoryId; |
|
| 151 | 151 | $this->_record->display = 0; // set to premoderation |
| 152 | - $this->_record->author_id = (int)$this->authorId; |
|
| 152 | + $this->_record->author_id = (int) $this->authorId; |
|
| 153 | 153 | $this->_record->save(); |
| 154 | 154 | |
| 155 | 155 | // work with poster data |
| 156 | 156 | if ($this->poster !== null) { |
| 157 | 157 | // lets move poster from tmp to gallery |
| 158 | - $originDir = '/upload/gallery/' . $this->_record->id . '/orig/'; |
|
| 159 | - $thumbDir = '/upload/gallery/' . $this->_record->id . '/thumb/'; |
|
| 158 | + $originDir = '/upload/gallery/'.$this->_record->id.'/orig/'; |
|
| 159 | + $thumbDir = '/upload/gallery/'.$this->_record->id.'/thumb/'; |
|
| 160 | 160 | if (!Directory::exist($originDir)) { |
| 161 | 161 | Directory::create($originDir); |
| 162 | 162 | } |
@@ -165,17 +165,17 @@ discard block |
||
| 165 | 165 | Directory::create($thumbDir); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $fileName = App::$Security->simpleHash($this->poster->getClientOriginalName() . $this->poster->getSize()); |
|
| 169 | - $newFullName = $fileName . '.' . $this->poster->guessExtension(); |
|
| 168 | + $fileName = App::$Security->simpleHash($this->poster->getClientOriginalName().$this->poster->getSize()); |
|
| 169 | + $newFullName = $fileName.'.'.$this->poster->guessExtension(); |
|
| 170 | 170 | // move poster to upload gallery directory |
| 171 | 171 | $this->poster->move(Normalize::diskFullPath($originDir), $newFullName); |
| 172 | 172 | // initialize image resizer |
| 173 | 173 | $thumb = new Image(); |
| 174 | - $thumb->setCacheDir(root . '/Private/Cache/images'); |
|
| 174 | + $thumb->setCacheDir(root.'/Private/Cache/images'); |
|
| 175 | 175 | |
| 176 | 176 | // open original file, resize it and save |
| 177 | - $thumbSaveName = Normalize::diskFullPath($thumbDir) . '/' . $fileName . '.jpg'; |
|
| 178 | - $thumb->open(Normalize::diskFullPath($originDir) . DIRECTORY_SEPARATOR . $newFullName) |
|
| 177 | + $thumbSaveName = Normalize::diskFullPath($thumbDir).'/'.$fileName.'.jpg'; |
|
| 178 | + $thumb->open(Normalize::diskFullPath($originDir).DIRECTORY_SEPARATOR.$newFullName) |
|
| 179 | 179 | ->cropResize($this->_configs['galleryResize']) |
| 180 | 180 | ->save($thumbSaveName, 'jpg', 90); |
| 181 | 181 | $thumb = null; |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | ->withTrashed() |
| 32 | 32 | ->findOrNew($id); |
| 33 | 33 | $isNew = $record->id === null; |
| 34 | - $cloneId = (int)$this->request->query->get('from', 0); |
|
| 34 | + $cloneId = (int) $this->request->query->get('from', 0); |
|
| 35 | 35 | |
| 36 | 36 | // init model |
| 37 | 37 | $model = new FormContentUpdate($record, $cloneId); |