@@ -10,7 +10,6 @@ |
||
10 | 10 | use Ffcms\Core\Exception\ForbiddenException; |
11 | 11 | use Ffcms\Core\Helper\FileSystem\File; |
12 | 12 | use Ffcms\Core\Helper\Type\Str; |
13 | -use Ffcms\Core\Helper\Url; |
|
14 | 13 | |
15 | 14 | class Main extends ApiController |
16 | 15 | { |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | 'roots' => [ |
39 | 39 | [ |
40 | 40 | 'driver' => 'LocalFileSystem', |
41 | - 'path' => root . '/upload/', |
|
42 | - 'URL' => App::$Alias->scriptUrl . '/upload/' |
|
41 | + 'path' => root.'/upload/', |
|
42 | + 'URL' => App::$Alias->scriptUrl.'/upload/' |
|
43 | 43 | ] |
44 | 44 | ] |
45 | 45 | ])); |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | { |
105 | 105 | $this->setJsonHeader(); |
106 | 106 | // get ffcms news if cache is not available |
107 | - $cache = App::$Cache->getItem('download.ffcms.api.news.' . $this->lang); |
|
107 | + $cache = App::$Cache->getItem('download.ffcms.api.news.'.$this->lang); |
|
108 | 108 | if ($cache->isHit()) { |
109 | - $cache->set(File::getFromUrl('https://ffcms.org/api/api/news?lang=' . $this->lang)) |
|
109 | + $cache->set(File::getFromUrl('https://ffcms.org/api/api/news?lang='.$this->lang)) |
|
110 | 110 | ->expiresAfter(1440); |
111 | 111 | } |
112 | 112 | $news = $cache->get(); |
@@ -18,10 +18,8 @@ |
||
18 | 18 | use Ffcms\Core\Helper\Text; |
19 | 19 | use Ffcms\Core\Helper\Type\Any; |
20 | 20 | use Ffcms\Core\Helper\Type\Arr; |
21 | -use Ffcms\Core\Helper\Type\Obj; |
|
22 | 21 | use Ffcms\Core\Helper\Type\Str; |
23 | 22 | use Illuminate\Database\Capsule\Manager as Capsule; |
24 | -use Illuminate\Database\MySqlConnection; |
|
25 | 23 | |
26 | 24 | /** |
27 | 25 | * Class Profile. Api controller provide ajax/json for user profile features |
@@ -243,7 +243,7 @@ |
||
243 | 243 | $findAnswer->delete(); |
244 | 244 | |
245 | 245 | return json_encode([ |
246 | - 'status' => 1, |
|
246 | + 'status' => 1, |
|
247 | 247 | 'message' => 'ok' |
248 | 248 | ]); |
249 | 249 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $answerTime = Date::convertToTimestamp($lastAnswer->created_at); |
175 | 175 | $cfgs = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
176 | 176 | // hmm, maybe past less then delay required? |
177 | - if ($now - (int)$cfgs['delayBetweenPost'] < $answerTime) { |
|
177 | + if ($now - (int) $cfgs['delayBetweenPost'] < $answerTime) { |
|
178 | 178 | throw new ForbiddenException('Delay between answers not pass'); |
179 | 179 | } |
180 | 180 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // add notification for target user |
190 | 190 | if ($viewer->id !== $target_id) { |
191 | 191 | $notify = new EntityAddNotification($target_id); |
192 | - $notify->add('/profile/show/' . $target_id . '#wall-post-' . $wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [ |
|
192 | + $notify->add('/profile/show/'.$target_id.'#wall-post-'.$wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [ |
|
193 | 193 | 'snippet' => Text::snippet($message, 50), |
194 | 194 | 'post' => $wallRow->message |
195 | 195 | ]); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | // sender is not myself? then i'm - target (remote user is sender user->to_me) |
299 | 299 | if ($row->sender_id !== $user->id) { |
300 | 300 | $userList[] = $row->sender_id; |
301 | - if ((bool)$row->readed !== true) { |
|
301 | + if ((bool) $row->readed !== true) { |
|
302 | 302 | $unreadList[] = $row->sender_id; |
303 | 303 | } |
304 | 304 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | // get special types for this action |
381 | 381 | $queryType = $this->request->get('type'); |
382 | - $queryId = (int)$this->request->get('id'); |
|
382 | + $queryId = (int) $this->request->get('id'); |
|
383 | 383 | // get current user object |
384 | 384 | $user = App::$User->identity(); |
385 | 385 | |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | switch ($queryType) { |
396 | 396 | case 'after': |
397 | 397 | $messages = Message::where('id', '>', $queryId) |
398 | - ->where(function ($query) use ($cor_id, $user) { |
|
399 | - $query->where(function ($q) use ($cor_id, $user) { |
|
398 | + ->where(function($query) use ($cor_id, $user) { |
|
399 | + $query->where(function($q) use ($cor_id, $user) { |
|
400 | 400 | $q->where('target_id', '=', $user->getId()) |
401 | 401 | ->where('sender_id', '=', $cor_id); |
402 | - })->orWhere(function ($q) use ($cor_id, $user) { |
|
402 | + })->orWhere(function($q) use ($cor_id, $user) { |
|
403 | 403 | $q->where('target_id', '=', $cor_id) |
404 | 404 | ->where('sender_id', '=', $user->getId()); |
405 | 405 | }); |
@@ -407,21 +407,21 @@ discard block |
||
407 | 407 | break; |
408 | 408 | case 'before': |
409 | 409 | $messages = Message::where('id', '<', $queryId) |
410 | - ->where(function ($query) use ($cor_id, $user) { |
|
411 | - $query->where(function ($q) use ($cor_id, $user) { |
|
410 | + ->where(function($query) use ($cor_id, $user) { |
|
411 | + $query->where(function($q) use ($cor_id, $user) { |
|
412 | 412 | $q->where('target_id', '=', $user->getId()) |
413 | 413 | ->where('sender_id', '=', $cor_id); |
414 | - })->orWhere(function ($q) use ($cor_id, $user) { |
|
414 | + })->orWhere(function($q) use ($cor_id, $user) { |
|
415 | 415 | $q->where('target_id', '=', $cor_id) |
416 | 416 | ->where('sender_id', '=', $user->getId()); |
417 | 417 | }); |
418 | 418 | }); |
419 | 419 | break; |
420 | 420 | default: |
421 | - $messages = Message::where(function ($query) use ($cor_id, $user) { |
|
421 | + $messages = Message::where(function($query) use ($cor_id, $user) { |
|
422 | 422 | $query->where('target_id', '=', $user->getId()) |
423 | 423 | ->where('sender_id', '=', $cor_id); |
424 | - })->orWhere(function ($query) use ($cor_id, $user) { |
|
424 | + })->orWhere(function($query) use ($cor_id, $user) { |
|
425 | 425 | $query->where('target_id', '=', $cor_id) |
426 | 426 | ->where('sender_id', '=', $user->getId()); |
427 | 427 | }); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | ]; |
453 | 453 | |
454 | 454 | // update status to readed |
455 | - if ((bool)$msg->readed !== true && $msg->sender_id !== $user->id) { |
|
455 | + if ((bool) $msg->readed !== true && $msg->sender_id !== $user->id) { |
|
456 | 456 | $msg->readed = true; |
457 | 457 | $msg->save(); |
458 | 458 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->setJsonHeader(); |
521 | 521 | |
522 | 522 | // get operation type and target user id |
523 | - $targetId = (int)$this->request->get('target'); |
|
523 | + $targetId = (int) $this->request->get('target'); |
|
524 | 524 | $type = $this->request->get('type'); |
525 | 525 | |
526 | 526 | // check type of query |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | |
536 | 536 | $cfg = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
537 | 537 | // check if rating is enabled for website |
538 | - if (!(bool)$cfg['rating']) { |
|
538 | + if (!(bool) $cfg['rating']) { |
|
539 | 539 | throw new NativeException('Rating is disabled'); |
540 | 540 | } |
541 | 541 |
@@ -11,7 +11,6 @@ |
||
11 | 11 | use Ffcms\Core\Helper\FileSystem\Directory; |
12 | 12 | use Ffcms\Core\Helper\FileSystem\File; |
13 | 13 | use Ffcms\Core\Helper\Type\Any; |
14 | -use Ffcms\Core\Helper\Type\Obj; |
|
15 | 14 | use Ffcms\Core\Helper\Type\Str; |
16 | 15 | |
17 | 16 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if ($this->_content->id === null) { |
60 | 60 | $this->_new = true; |
61 | 61 | if (!$this->galleryFreeId) { |
62 | - $this->galleryFreeId = '_tmp_' . Str::randomLatin(mt_rand(16, 32)); |
|
62 | + $this->galleryFreeId = '_tmp_'.Str::randomLatin(mt_rand(16, 32)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | if (!$this->authorId) { |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | public function rules(): array |
95 | 95 | { |
96 | 96 | $res = [ |
97 | - ['title.' . App::$Request->getLanguage(), 'required'], |
|
98 | - ['text.' . App::$Request->getLanguage(), 'required'], |
|
97 | + ['title.'.App::$Request->getLanguage(), 'required'], |
|
98 | + ['text.'.App::$Request->getLanguage(), 'required'], |
|
99 | 99 | ['text', 'used'], |
100 | 100 | ['path', 'reverse_match', '/[\/\'~`\!@#\$%\^&\*\(\)+=\{\}\[\]\|;:"\<\>,\?\\\]/'], |
101 | 101 | [['path', 'categoryId', 'authorId', 'display', 'galleryFreeId', 'title', 'important'], 'required'], |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | ]; |
109 | 109 | |
110 | 110 | foreach (App::$Properties->get('languages') as $lang) { |
111 | - $res[] = ['title.' . $lang, 'length_max', 120, null, true, true]; |
|
112 | - $res[] = ['keywords.' . $lang, 'length_max', 150]; |
|
113 | - $res[] = ['description.' . $lang, 'length_max', 250]; |
|
111 | + $res[] = ['title.'.$lang, 'length_max', 120, null, true, true]; |
|
112 | + $res[] = ['keywords.'.$lang, 'length_max', 150]; |
|
113 | + $res[] = ['description.'.$lang, 'length_max', 250]; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | return $res; |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | $this->_content->meta_keywords = $this->metaKeywords; |
167 | 167 | $this->_content->meta_description = $this->metaDescription; |
168 | 168 | $this->_content->source = $this->source; |
169 | - $this->_content->important = (int)$this->important; |
|
169 | + $this->_content->important = (int) $this->important; |
|
170 | 170 | // check if rating is changed |
171 | - if ((int)$this->addRating !== 0) { |
|
172 | - $this->_content->rating += (int)$this->addRating; |
|
171 | + if ((int) $this->addRating !== 0) { |
|
172 | + $this->_content->rating += (int) $this->addRating; |
|
173 | 173 | } |
174 | 174 | // check if special comment hash is exist |
175 | 175 | if ($this->_new || Str::length($this->_content->comment_hash) < 32) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | // save poster data |
185 | - $posterPath = '/upload/gallery/' . $this->galleryFreeId . '/orig/' . $this->poster; |
|
185 | + $posterPath = '/upload/gallery/'.$this->galleryFreeId.'/orig/'.$this->poster; |
|
186 | 186 | if (File::exist($posterPath)) { |
187 | 187 | $this->_content->poster = $this->poster; |
188 | 188 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | // move files |
219 | 219 | if ($tmpGalleryId !== $this->_content->id) { |
220 | - Directory::rename('/upload/gallery/' . $tmpGalleryId, $this->_content->id); |
|
220 | + Directory::rename('/upload/gallery/'.$tmpGalleryId, $this->_content->id); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Apps\ActiveRecord\System; |
6 | 6 | use Ffcms\Core\Arch\Model; |
7 | -use Ffcms\Core\Helper\FileSystem\File; |
|
8 | 7 | use Ffcms\Core\Helper\Type\Str; |
9 | 8 | use Ffcms\Core\Managers\MigrationsManager; |
10 | 9 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $name = Str::firstIn($fullName, '-'); |
44 | 44 | // get update version number from migration name |
45 | 45 | list($type, $obj, $version) = explode('_', $name); |
46 | - $intVersion = (int)Str::replace('.', '', $this->dbVersion); |
|
46 | + $intVersion = (int) Str::replace('.', '', $this->dbVersion); |
|
47 | 47 | // if migration version > db version - implement it |
48 | 48 | if ($version > $intVersion) { |
49 | 49 | $this->updateQueries[] = $file; |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use Ffcms\Core\App; |
9 | 9 | use Ffcms\Core\Arch\Model; |
10 | 10 | use Ffcms\Core\Helper\Type\Any; |
11 | -use Ffcms\Core\Helper\Type\Obj; |
|
12 | 11 | use Ffcms\Core\Helper\Type\Str; |
13 | 12 | use Ffcms\Core\Interfaces\iUser; |
14 | 13 |
@@ -12,7 +12,6 @@ |
||
12 | 12 | use Ffcms\Core\Helper\FileSystem\File; |
13 | 13 | use Ffcms\Core\Helper\Type\Any; |
14 | 14 | use Ffcms\Core\Helper\Type\Arr; |
15 | -use Ffcms\Core\Helper\Type\Obj; |
|
16 | 15 | use Ffcms\Core\Helper\Type\Str; |
17 | 16 | |
18 | 17 | /** |
@@ -66,7 +66,7 @@ |
||
66 | 66 | /** |
67 | 67 | * Prepare model attributes from passed objects |
68 | 68 | * @throws ForbiddenException |
69 | - */ |
|
69 | + */ |
|
70 | 70 | public function before() |
71 | 71 | { |
72 | 72 | $this->id = $this->_content->id; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $this->id = $this->_content->id; |
73 | 73 | $this->title = $this->_content->getLocaled('title'); |
74 | 74 | $this->text = $this->_content->getLocaled('text'); |
75 | - $this->display = (bool)$this->_content->display; |
|
75 | + $this->display = (bool) $this->_content->display; |
|
76 | 76 | |
77 | 77 | // check if title and text are exists |
78 | 78 | if (Str::length($this->title) < 1 || Str::length($this->text) < 1) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | $this->source = $this->_content->source; |
105 | - $this->views = $this->_content->views+1; |
|
105 | + $this->views = $this->_content->views + 1; |
|
106 | 106 | // check for dependence, add '' for general cat, ex: general/depend1/depend2/.../depend-n |
107 | 107 | $catNestingArray = Arr::merge([0 => ''], explode('/', $this->catPath)); |
108 | 108 | if ($catNestingArray > 1) { |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | ]; |
135 | 135 | |
136 | 136 | // get gallery images and poster data |
137 | - $galleryPath = '/upload/gallery/' . $this->_content->id; |
|
137 | + $galleryPath = '/upload/gallery/'.$this->_content->id; |
|
138 | 138 | // check if gallery folder is exist |
139 | 139 | if (Directory::exist($galleryPath)) { |
140 | - $originImages = File::listFiles($galleryPath . '/orig/', ['.jpg', '.png', '.gif', '.jpeg', '.bmp', '.webp'], true); |
|
140 | + $originImages = File::listFiles($galleryPath.'/orig/', ['.jpg', '.png', '.gif', '.jpeg', '.bmp', '.webp'], true); |
|
141 | 141 | // generate poster data |
142 | 142 | if (Arr::in($this->_content->poster, $originImages)) { |
143 | 143 | // original poster |
144 | 144 | $posterName = $this->_content->poster; |
145 | - $this->posterFull = $galleryPath . '/orig/' . $posterName; |
|
145 | + $this->posterFull = $galleryPath.'/orig/'.$posterName; |
|
146 | 146 | if (!File::exist($this->posterFull)) { |
147 | 147 | $this->posterFull = null; |
148 | 148 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $posterSplit = explode('.', $posterName); |
152 | 152 | array_pop($posterSplit); |
153 | 153 | $posterCleanName = implode('.', $posterSplit); |
154 | - $this->posterThumb = $galleryPath . '/thumb/' . $posterCleanName . '.jpg'; |
|
154 | + $this->posterThumb = $galleryPath.'/thumb/'.$posterCleanName.'.jpg'; |
|
155 | 155 | if (!File::exist($this->posterThumb)) { |
156 | 156 | $this->posterThumb = null; |
157 | 157 | } |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | continue; |
168 | 168 | } |
169 | 169 | |
170 | - $thumbPath = $galleryPath . '/thumb/' . $imageClearName . '.jpg'; |
|
170 | + $thumbPath = $galleryPath.'/thumb/'.$imageClearName.'.jpg'; |
|
171 | 171 | if (File::exist($thumbPath)) { |
172 | - $this->galleryItems[$thumbPath] = $galleryPath . '/orig/' . $image; |
|
172 | + $this->galleryItems[$thumbPath] = $galleryPath.'/orig/'.$image; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $this->rating = $this->_content->rating; |
179 | 179 | $ignoredRate = App::$Session->get('content.rate.ignore'); |
180 | 180 | $this->canRate = true; |
181 | - if (Any::isArray($ignoredRate) && Arr::in((string)$this->id, $ignoredRate)) { |
|
181 | + if (Any::isArray($ignoredRate) && Arr::in((string) $this->id, $ignoredRate)) { |
|
182 | 182 | $this->canRate = false; |
183 | 183 | } |
184 | 184 | if (!App::$User->isAuth()) { |
@@ -32,7 +32,7 @@ |
||
32 | 32 | /** |
33 | 33 | * EntityContentSearch constructor. Pass search terms (query string) to model and used items to skip it by id. |
34 | 34 | * @param $terms |
35 | - * @param int|array $skipIds |
|
35 | + * @param integer $skipIds |
|
36 | 36 | * @param int|null $categoryId |
37 | 37 | */ |
38 | 38 | public function __construct($terms, $skipIds = 0, $categoryId = null) |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use Ffcms\Core\Exception\NotFoundException; |
9 | 9 | use Ffcms\Core\Helper\Text; |
10 | 10 | use Ffcms\Core\Helper\Type\Any; |
11 | -use Ffcms\Core\Helper\Type\Obj; |
|
12 | 11 | use Ffcms\Core\Helper\Type\Str; |
13 | 12 | |
14 | 13 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | $index = implode('-', $this->_skip); |
63 | 63 | // try to get this slow query from cache |
64 | - $cache = App::$Cache->getItem('entity.content.search.index.' . $index); |
|
64 | + $cache = App::$Cache->getItem('entity.content.search.index.'.$index); |
|
65 | 65 | if (!$cache->isHit()) { |
66 | 66 | $cache->set($this->makeSearch()); |
67 | 67 | $cache->expiresAfter(static::CACHE_TIME); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $this->items[] = [ |
95 | 95 | 'title' => $item->getLocaled('title'), |
96 | 96 | 'snippet' => Text::snippet($text), |
97 | - 'uri' => '/content/read/' . $item->getPath(), |
|
97 | + 'uri' => '/content/read/'.$item->getPath(), |
|
98 | 98 | 'thumb' => $item->getPosterThumbUri() |
99 | 99 | ]; |
100 | 100 | } |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Ffcms\Core\Helper\FileSystem\Directory; |
10 | 10 | use Ffcms\Core\Helper\FileSystem\Normalize; |
11 | 11 | use Ffcms\Core\Helper\Type\Any; |
12 | -use Ffcms\Core\Helper\Type\Obj; |
|
13 | 12 | use Ffcms\Core\Helper\Type\Str; |
14 | 13 | use Gregwar\Image\Image; |
15 | 14 |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | - * Set default values from database record |
|
48 | - */ |
|
47 | + * Set default values from database record |
|
48 | + */ |
|
49 | 49 | public function before() |
50 | 50 | { |
51 | 51 | // set data from db record |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | - * Form labels |
|
89 | - * @return array |
|
90 | - */ |
|
88 | + * Form labels |
|
89 | + * @return array |
|
90 | + */ |
|
91 | 91 | public function labels(): array |
92 | 92 | { |
93 | 93 | return [ |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * Content update form validation rules |
|
104 | - * @return array |
|
105 | - */ |
|
103 | + * Content update form validation rules |
|
104 | + * @return array |
|
105 | + */ |
|
106 | 106 | public function rules(): array |
107 | 107 | { |
108 | 108 | $r = [ |
@@ -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,9 +147,9 @@ 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 | if ($this->_new) { |
154 | 154 | $this->_record->comment_hash = $this->generateCommentHash(); |
155 | 155 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | // work with poster data |
160 | 160 | if ($this->poster !== null) { |
161 | 161 | // lets move poster from tmp to gallery |
162 | - $originDir = '/upload/gallery/' . $this->_record->id . '/orig/'; |
|
163 | - $thumbDir = '/upload/gallery/' . $this->_record->id . '/thumb/'; |
|
162 | + $originDir = '/upload/gallery/'.$this->_record->id.'/orig/'; |
|
163 | + $thumbDir = '/upload/gallery/'.$this->_record->id.'/thumb/'; |
|
164 | 164 | if (!Directory::exist($originDir)) { |
165 | 165 | Directory::create($originDir); |
166 | 166 | } |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | Directory::create($thumbDir); |
170 | 170 | } |
171 | 171 | |
172 | - $fileName = App::$Security->simpleHash($this->poster->getClientOriginalName() . $this->poster->getSize()); |
|
173 | - $newFullName = $fileName . '.' . $this->poster->guessExtension(); |
|
172 | + $fileName = App::$Security->simpleHash($this->poster->getClientOriginalName().$this->poster->getSize()); |
|
173 | + $newFullName = $fileName.'.'.$this->poster->guessExtension(); |
|
174 | 174 | // move poster to upload gallery directory |
175 | 175 | $this->poster->move(Normalize::diskFullPath($originDir), $newFullName); |
176 | 176 | // initialize image resizer |
177 | 177 | $thumb = new Image(); |
178 | - $thumb->setCacheDir(root . '/Private/Cache/images'); |
|
178 | + $thumb->setCacheDir(root.'/Private/Cache/images'); |
|
179 | 179 | |
180 | 180 | // open original file, resize it and save |
181 | - $thumbSaveName = Normalize::diskFullPath($thumbDir) . '/' . $fileName . '.jpg'; |
|
182 | - $thumb->open(Normalize::diskFullPath($originDir) . DIRECTORY_SEPARATOR . $newFullName) |
|
181 | + $thumbSaveName = Normalize::diskFullPath($thumbDir).'/'.$fileName.'.jpg'; |
|
182 | + $thumb->open(Normalize::diskFullPath($originDir).DIRECTORY_SEPARATOR.$newFullName) |
|
183 | 183 | ->cropResize($this->_configs['galleryResize']) |
184 | 184 | ->save($thumbSaveName, 'jpg', 90); |
185 | 185 | $thumb = null; |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Apps\Model\Install\Main; |
4 | 4 | |
5 | -use Apps\ActiveRecord\Migration; |
|
6 | 5 | use Apps\ActiveRecord\Profile; |
7 | 6 | use Apps\ActiveRecord\System; |
8 | 7 | use Apps\ActiveRecord\User; |
@@ -105,14 +105,14 @@ |
||
105 | 105 | $cfg['baseDomain'] = $this->baseDomain; |
106 | 106 | $cfg['database'] = $this->db; |
107 | 107 | $cfg['singleLanguage'] = $this->singleLanguage; |
108 | - $cfg['multiLanguage'] = (bool)$this->multiLanguage; |
|
109 | - $cfg['passwordSalt'] = '$2a$07$' . Str::randomLatinNumeric(mt_rand(21, 30)) . '$'; |
|
110 | - $cfg['debug']['cookie']['key'] = 'fdebug_' . Str::randomLatinNumeric(mt_rand(4, 16)); |
|
108 | + $cfg['multiLanguage'] = (bool) $this->multiLanguage; |
|
109 | + $cfg['passwordSalt'] = '$2a$07$'.Str::randomLatinNumeric(mt_rand(21, 30)).'$'; |
|
110 | + $cfg['debug']['cookie']['key'] = 'fdebug_'.Str::randomLatinNumeric(mt_rand(4, 16)); |
|
111 | 111 | $cfg['debug']['cookie']['value'] = Str::randomLatinNumeric(mt_rand(32, 128)); |
112 | 112 | $cfg['mail'] = $this->mail; |
113 | 113 | |
114 | 114 | // initialize migrations table |
115 | - App::$Database->getConnection('install')->getSchemaBuilder()->create('migrations', function ($table) { |
|
115 | + App::$Database->getConnection('install')->getSchemaBuilder()->create('migrations', function($table) { |
|
116 | 116 | $table->increments('id'); |
117 | 117 | $table->string('migration', 128)->unique(); |
118 | 118 | $table->timestamps(); |