@@ -15,7 +15,6 @@ |
||
15 | 15 | use Ffcms\Core\Helper\FileSystem\Normalize; |
16 | 16 | use Ffcms\Core\Helper\Type\Any; |
17 | 17 | use Ffcms\Core\Helper\Type\Arr; |
18 | -use Ffcms\Core\Helper\Type\Obj; |
|
19 | 18 | use Ffcms\Core\Helper\Type\Str; |
20 | 19 | use Gregwar\Image\Image; |
21 | 20 |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | parent::before(); |
35 | 35 | $configs = AppRecord::getConfigs('app', 'Content'); |
36 | 36 | // prevent null-type config data |
37 | - if ((int)$configs['gallerySize'] > 0) { |
|
38 | - $this->maxSize = (int)$configs['gallerySize'] * 1024; |
|
37 | + if ((int) $configs['gallerySize'] > 0) { |
|
38 | + $this->maxSize = (int) $configs['gallerySize'] * 1024; |
|
39 | 39 | } |
40 | 40 | |
41 | - if ((int)$configs['galleryResize'] > 0) { |
|
42 | - $this->maxResize = (int)$configs['galleryResize']; |
|
41 | + if ((int) $configs['galleryResize'] > 0) { |
|
42 | + $this->maxResize = (int) $configs['galleryResize']; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | // check if directory exist |
122 | - if (!Directory::exist('/upload/gallery/' . $id)) { |
|
123 | - Directory::create('/upload/gallery/' . $id); |
|
122 | + if (!Directory::exist('/upload/gallery/'.$id)) { |
|
123 | + Directory::create('/upload/gallery/'.$id); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // get file object |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | // check file size |
134 | 134 | if ($file->getSize() < 1 || $file->getSize() > $this->maxSize) { |
135 | - throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int)($this->maxSize/1024)])); |
|
135 | + throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int) ($this->maxSize / 1024)])); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // check file extension |
@@ -141,41 +141,41 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | // create origin directory |
144 | - $originPath = '/upload/gallery/' . $id . '/orig/'; |
|
144 | + $originPath = '/upload/gallery/'.$id.'/orig/'; |
|
145 | 145 | if (!Directory::exist($originPath)) { |
146 | 146 | Directory::create($originPath); |
147 | 147 | } |
148 | 148 | |
149 | 149 | // lets make a new file name |
150 | - $fileName = App::$Security->simpleHash($file->getClientOriginalName() . $file->getSize()); |
|
151 | - $fileNewName = $fileName . '.' . $file->guessExtension(); |
|
150 | + $fileName = App::$Security->simpleHash($file->getClientOriginalName().$file->getSize()); |
|
151 | + $fileNewName = $fileName.'.'.$file->guessExtension(); |
|
152 | 152 | // check if image is already loaded |
153 | - if (File::exist($originPath . $fileNewName)) { |
|
153 | + if (File::exist($originPath.$fileNewName)) { |
|
154 | 154 | throw new ForbiddenException(__('File is always exists!')); |
155 | 155 | } |
156 | 156 | // save file from tmp to gallery origin directory |
157 | 157 | $file->move(Normalize::diskFullPath($originPath), $fileNewName); |
158 | 158 | |
159 | 159 | // lets resize preview image for it |
160 | - $thumbPath = '/upload/gallery/' . $id . '/thumb/'; |
|
160 | + $thumbPath = '/upload/gallery/'.$id.'/thumb/'; |
|
161 | 161 | if (!Directory::exist($thumbPath)) { |
162 | 162 | Directory::create($thumbPath); |
163 | 163 | } |
164 | 164 | |
165 | 165 | $thumb = new Image(); |
166 | - $thumb->setCacheDir(root . '/Private/Cache/images'); |
|
166 | + $thumb->setCacheDir(root.'/Private/Cache/images'); |
|
167 | 167 | |
168 | 168 | // open original file, resize it and save |
169 | - $thumbSaveName = Normalize::diskFullPath($thumbPath) . '/' . $fileName . '.jpg'; |
|
170 | - $thumb->open(Normalize::diskFullPath($originPath) . DIRECTORY_SEPARATOR . $fileNewName) |
|
169 | + $thumbSaveName = Normalize::diskFullPath($thumbPath).'/'.$fileName.'.jpg'; |
|
170 | + $thumb->open(Normalize::diskFullPath($originPath).DIRECTORY_SEPARATOR.$fileNewName) |
|
171 | 171 | ->cropResize($this->maxResize) |
172 | 172 | ->save($thumbSaveName, 'jpg', 90); |
173 | 173 | $thumb = null; |
174 | 174 | |
175 | 175 | $this->setJsonHeader(); |
176 | 176 | return json_encode(['status' => 1, 'file' => [ |
177 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
178 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $fileNewName, |
|
177 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
178 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$fileNewName, |
|
179 | 179 | 'name' => $fileNewName |
180 | 180 | ]]); |
181 | 181 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | throw new NativeException('Permission denied'); |
200 | 200 | } |
201 | 201 | |
202 | - $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/'); |
|
202 | + $thumbDir = Normalize::diskFullPath('/upload/gallery/'.$id.'/orig/'); |
|
203 | 203 | if (!Directory::exist($thumbDir)) { |
204 | 204 | throw new NotFoundException('Nothing found'); |
205 | 205 | } |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | $fileExt = Str::lastIn($file, '.'); |
215 | 215 | $fileName = Str::sub($file, 0, -Str::length($fileExt)); |
216 | 216 | $output[] = [ |
217 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
218 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $file, |
|
217 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
218 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$file, |
|
219 | 219 | 'name' => $file, |
220 | - 'size' => File::size('/upload/gallery/' . $id . '/orig/' . $file) |
|
220 | + 'size' => File::size('/upload/gallery/'.$id.'/orig/'.$file) |
|
221 | 221 | ]; |
222 | 222 | } |
223 | 223 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | public function actionGallerydelete($id, $file = null) |
237 | 237 | { |
238 | 238 | if (!$file || Str::likeEmpty($file)) { |
239 | - $file = (string)$this->request->query->get('file', null); |
|
239 | + $file = (string) $this->request->query->get('file', null); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | // check passed data |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | // generate path |
255 | - $thumb = '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg'; |
|
256 | - $full = '/upload/gallery/' . $id . '/orig/' . $file; |
|
255 | + $thumb = '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg'; |
|
256 | + $full = '/upload/gallery/'.$id.'/orig/'.$file; |
|
257 | 257 | |
258 | 258 | // check if file exists and remove |
259 | 259 | if (File::exist($thumb) || File::exist($full)) { |
@@ -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 |
@@ -25,7 +25,6 @@ |
||
25 | 25 | use Ffcms\Core\Exception\SyntaxException; |
26 | 26 | use Ffcms\Core\Helper\HTML\SimplePagination; |
27 | 27 | use Ffcms\Core\Helper\Type\Any; |
28 | -use Ffcms\Core\Helper\Type\Obj; |
|
29 | 28 | use Ffcms\Core\Helper\Type\Str; |
30 | 29 | use Ffcms\Core\Helper\Url; |
31 | 30 |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | $records = null; |
53 | 53 | |
54 | 54 | // set current page and offset |
55 | - $page = (int)$this->request->query->get('page', 0); |
|
55 | + $page = (int) $this->request->query->get('page', 0); |
|
56 | 56 | $cfgs = $this->application->configs; |
57 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
57 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
58 | 58 | if ($userPerPage < 1) { |
59 | 59 | $userPerPage = 1; |
60 | 60 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | switch ($name) { |
64 | 64 | case 'rating': // rating list, order by rating DESC |
65 | 65 | // check if rating is enabled |
66 | - if ((int)$cfgs['rating'] !== 1) { |
|
66 | + if ((int) $cfgs['rating'] !== 1) { |
|
67 | 67 | throw new NotFoundException(); |
68 | 68 | } |
69 | 69 | $records = (new ProfileRecords())->orderBy('rating', 'DESC'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if (Str::likeEmpty($value)) { |
73 | 73 | throw new NotFoundException(); |
74 | 74 | } |
75 | - $records = (new ProfileRecords())->where('hobby', 'like', '%' . $value . '%'); |
|
75 | + $records = (new ProfileRecords())->where('hobby', 'like', '%'.$value.'%'); |
|
76 | 76 | break; |
77 | 77 | case 'city': |
78 | 78 | if (Str::likeEmpty($value)) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if ($value === null || !Any::isInt($value)) { |
85 | 85 | throw new NotFoundException(); |
86 | 86 | } |
87 | - $records = (new ProfileRecords())->where('birthday', 'like', $value . '-%'); |
|
87 | + $records = (new ProfileRecords())->where('birthday', 'like', $value.'-%'); |
|
88 | 88 | break; |
89 | 89 | case 'all': |
90 | 90 | $records = (new ProfileRecords())->orderBy('id', 'DESC'); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'pagination' => $pagination, |
115 | 115 | 'id' => $name, |
116 | 116 | 'add' => $value, |
117 | - 'ratingOn' => (int)$cfgs['rating'] |
|
117 | + 'ratingOn' => (int) $cfgs['rating'] |
|
118 | 118 | ]); |
119 | 119 | } |
120 | 120 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function actionShow($userId) |
130 | 130 | { |
131 | 131 | $cfg = $this->application->configs; |
132 | - if (!(bool)$cfg['guestView'] && !App::$User->isAuth()) { |
|
132 | + if (!(bool) $cfg['guestView'] && !App::$User->isAuth()) { |
|
133 | 133 | throw new ForbiddenException(__('You must login to view other profile')); |
134 | 134 | } |
135 | 135 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | App::$Session->getFlashBag()->add('error', __('This user are in your black list or you are in blacklist!')); |
153 | 153 | } else { |
154 | 154 | // check if message added |
155 | - if ($wallModel->makePost($targetPersone, $viewerPersone, (int)$cfg['delayBetweenPost'])) { |
|
155 | + if ($wallModel->makePost($targetPersone, $viewerPersone, (int) $cfg['delayBetweenPost'])) { |
|
156 | 156 | App::$Session->getFlashBag()->add('success', __('The message was successful posted!')); |
157 | 157 | } else { |
158 | 158 | App::$Session->getFlashBag()->add('warning', __('Posting message was failed! Please, wait few seconds')); |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | // pagination and query params |
165 | - $wallPage = (int)$this->request->query->get('page'); |
|
166 | - $wallItems = (int)$cfg['wallPostOnPage']; |
|
165 | + $wallPage = (int) $this->request->query->get('page'); |
|
166 | + $wallItems = (int) $cfg['wallPostOnPage']; |
|
167 | 167 | $wallOffset = $wallPage * $wallItems; |
168 | 168 | |
169 | 169 | // get wall posts by target user_id |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | 'notify' => App::$Session->getFlashBag()->all(), |
194 | 194 | 'wallRecords' => $wallRecords, |
195 | 195 | 'pagination' => $wallPagination, |
196 | - 'ratingOn' => (int)$cfg['rating'] === 1 |
|
196 | + 'ratingOn' => (int) $cfg['rating'] === 1 |
|
197 | 197 | ]); |
198 | 198 | } |
199 | 199 | |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | { |
207 | 207 | $cfg = $this->application->configs; |
208 | 208 | // get pagination page id and calc offset |
209 | - $page = (int)$this->request->query->get('page'); |
|
209 | + $page = (int) $this->request->query->get('page'); |
|
210 | 210 | $items = 10; |
211 | - if ((int)$cfg['wallPostOnFeed'] >= 1) { |
|
212 | - $items = (int)$cfg['wallPostOnFeed']; |
|
211 | + if ((int) $cfg['wallPostOnFeed'] >= 1) { |
|
212 | + $items = (int) $cfg['wallPostOnFeed']; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $offset = $page * $items; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $wallModel = new FormWallPostDelete($wallPost); |
308 | 308 | if ($wallModel->send() && $wallModel->validate()) { |
309 | 309 | $wallModel->make(); |
310 | - $this->response->redirect('profile/show/' . $wallPost->target_id); |
|
310 | + $this->response->redirect('profile/show/'.$wallPost->target_id); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | return $this->view->render('wall_delete', [ |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | // get page index and current user object |
349 | - $page = (int)$this->request->query->get('page', 0); |
|
349 | + $page = (int) $this->request->query->get('page', 0); |
|
350 | 350 | $offset = $page * static::NOTIFY_PER_PAGE; |
351 | 351 | $user = App::$User->identity(); |
352 | 352 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | // set user id from ?id= get param if form not sended |
464 | 464 | if (!$model->send()) { |
465 | - $uid = (int)$this->request->query->get('id'); |
|
465 | + $uid = (int) $this->request->query->get('id'); |
|
466 | 466 | if ($uid > 0) { |
467 | 467 | $model->id = $uid; |
468 | 468 | } |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | // get blocked users |
481 | 481 | $query = Blacklist::where('user_id', '=', $user->getId()); |
482 | 482 | |
483 | - $page = (int)$this->request->query->get('page'); |
|
483 | + $page = (int) $this->request->query->get('page'); |
|
484 | 484 | $offset = $page * self::BLOCK_PER_PAGE; |
485 | 485 | |
486 | 486 | // build pagination |
@@ -590,9 +590,9 @@ discard block |
||
590 | 590 | // check if request is sended |
591 | 591 | if ($model->send() && $model->validate()) { |
592 | 592 | // get records from db |
593 | - $records = ProfileRecords::where('nick', 'like', '%' . $model->query . '%'); |
|
594 | - $page = (int)$this->request->query->get('page'); |
|
595 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
593 | + $records = ProfileRecords::where('nick', 'like', '%'.$model->query.'%'); |
|
594 | + $page = (int) $this->request->query->get('page'); |
|
595 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
596 | 596 | if ($userPerPage < 1) { |
597 | 597 | $userPerPage = 1; |
598 | 598 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | 'model' => $model, |
617 | 617 | 'records' => $records, |
618 | 618 | 'pagination' => $pagination, |
619 | - 'ratingOn' => (int)$cfgs['rating'] |
|
619 | + 'ratingOn' => (int) $cfgs['rating'] |
|
620 | 620 | ]); |
621 | 621 | } |
622 | 622 | |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | // build sitemap from content items via business model |
641 | 641 | $sitemap = new EntityBuildMap($langs); |
642 | 642 | foreach ($profiles->get() as $user) { |
643 | - $sitemap->add('profile/show/' . $user->user_id, $user->updated_at, 'weekly', 0.2); |
|
643 | + $sitemap->add('profile/show/'.$user->user_id, $user->updated_at, 'weekly', 0.2); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | $sitemap->save('profile'); |
@@ -16,7 +16,6 @@ |
||
16 | 16 | use Ffcms\Core\Exception\NotFoundException; |
17 | 17 | use Ffcms\Core\Exception\SyntaxException; |
18 | 18 | use Ffcms\Core\Helper\Type\Any; |
19 | -use Ffcms\Core\Helper\Type\Obj; |
|
20 | 19 | use Ffcms\Core\Helper\Type\Str; |
21 | 20 | |
22 | 21 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | App::$Session->getFlashBag()->add('error', __('User is never exist or password is incorrect!')); |
67 | 67 | // initialize fail event |
68 | 68 | App::$Event->run(static::EVENT_USER_LOGIN_FAIL, [ |
69 | - 'model' => $loginForm |
|
69 | + 'model' => $loginForm |
|
70 | 70 | ]); |
71 | 71 | } |
72 | 72 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | if ($registerForm->tryRegister($activation)) { |
196 | 196 | // initialize succes signup event |
197 | 197 | App::$Event->run(static::EVENT_USER_REGISTER_SUCCESS, [ |
198 | - 'model' => $registerForm |
|
198 | + 'model' => $registerForm |
|
199 | 199 | ]); |
200 | 200 | // if no activation is required - just open session and redirect user to main page |
201 | 201 | if (!$activation) { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } else { |
209 | 209 | // init fail signup event |
210 | 210 | App::$Event->run(static::EVENT_USER_REGISTER_FAIL, [ |
211 | - 'model' => $registerForm |
|
211 | + 'model' => $registerForm |
|
212 | 212 | ]); |
213 | 213 | App::$Session->getFlashBag()->add('error', __('Login or email is always used on website')); |
214 | 214 | } |
@@ -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()) { |