@@ -71,7 +71,7 @@ |
||
71 | 71 | } else { |
72 | 72 | // set level marker based on slashes count in pathway |
73 | 73 | $slashCount = Str::entryCount($path, '/'); |
74 | - for ($i=-1; $i <= $slashCount; $i++) { |
|
74 | + for ($i = -1; $i <= $slashCount; $i++) { |
|
75 | 75 | $title .= '--'; |
76 | 76 | } |
77 | 77 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | // convert id to real integer |
26 | - $user_id = (int)$user_id; |
|
26 | + $user_id = (int) $user_id; |
|
27 | 27 | |
28 | 28 | if (!Obj::isInt($user_id) || $user_id < 1) { |
29 | 29 | return null; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function getId() |
53 | 53 | { |
54 | - return (int)$this->id; |
|
54 | + return (int) $this->id; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | // get data from session |
75 | 75 | $session_token = MainApp::$Session->get('ff_user_token', null); |
76 | - $session_id = (int)MainApp::$Session->get('ff_user_id', 0); |
|
76 | + $session_id = (int) MainApp::$Session->get('ff_user_id', 0); |
|
77 | 77 | |
78 | 78 | // validate session data |
79 | 79 | if (null === $session_token || $session_id < 1 || Str::length($session_token) < 64) { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // convert id to real integer |
110 | - $id = (int)$id; |
|
110 | + $id = (int) $id; |
|
111 | 111 | |
112 | 112 | $find = MainApp::$Memory->get('user.counter.cache.' . $id); |
113 | 113 | if ($find === null) { |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | $search = \Apps\ActiveRecord\App::where('sys_name', '=', $controller_name)->first(); |
27 | 27 | |
28 | - if ($search === null || (int)$search->id < 1) { |
|
28 | + if ($search === null || (int) $search->id < 1) { |
|
29 | 29 | throw new ForbiddenException(); |
30 | 30 | } |
31 | 31 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function actionIndex() |
33 | 33 | { |
34 | 34 | // set current page and offset |
35 | - $page = (int)App::$Request->query->get('page'); |
|
35 | + $page = (int) App::$Request->query->get('page'); |
|
36 | 36 | $offset = $page * self::ITEM_PER_PAGE; |
37 | 37 | |
38 | 38 | $query = null; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if ($type === 'trash') { |
42 | 42 | $query = ContentEntity::onlyTrashed(); |
43 | 43 | } elseif (Obj::isLikeInt($type)) { // sounds like category id ;) |
44 | - $query = ContentEntity::where('category_id', '=', (int)$type); |
|
44 | + $query = ContentEntity::where('category_id', '=', (int) $type); |
|
45 | 45 | } else { |
46 | 46 | $query = new ContentEntity(); |
47 | 47 | $type = 'all'; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | if ($model->send() && $model->validate()) { |
184 | 184 | // remove all trashed items |
185 | 185 | foreach ($records->get() as $item) { |
186 | - $galleryPath = '/upload/gallery/' . (int)$item->id; |
|
186 | + $galleryPath = '/upload/gallery/' . (int) $item->id; |
|
187 | 187 | if (Directory::exist($galleryPath)) { |
188 | 188 | Directory::remove($galleryPath); |
189 | 189 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | public function actionCategoryupdate($id = null) |
254 | 254 | { |
255 | 255 | // get owner id for new rows |
256 | - $parentId = (int)App::$Request->query->get('parent'); |
|
256 | + $parentId = (int) App::$Request->query->get('parent'); |
|
257 | 257 | |
258 | 258 | // get relation and pass to model |
259 | 259 | $record = ContentCategory::findOrNew($id); |
@@ -117,9 +117,9 @@ |
||
117 | 117 | */ |
118 | 118 | public function actionDeleteroute() |
119 | 119 | { |
120 | - $type = (string)App::$Request->query->get('type'); |
|
121 | - $loader = (string)App::$Request->query->get('loader'); |
|
122 | - $source = Str::lowerCase((string)App::$Request->query->get('path')); |
|
120 | + $type = (string) App::$Request->query->get('type'); |
|
121 | + $loader = (string) App::$Request->query->get('loader'); |
|
122 | + $source = Str::lowerCase((string) App::$Request->query->get('path')); |
|
123 | 123 | |
124 | 124 | $model = new EntityDeleteRoute($type, $loader, $source); |
125 | 125 | if ($model->send()) { |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $query = new UserRecords(); |
27 | 27 | |
28 | 28 | // set current page and offset |
29 | - $page = (int)App::$Request->query->get('page'); |
|
29 | + $page = (int) App::$Request->query->get('page'); |
|
30 | 30 | $offset = $page * self::ITEM_PER_PAGE; |
31 | 31 | |
32 | 32 | // build pagination |
@@ -19,9 +19,9 @@ |
||
19 | 19 | // set header |
20 | 20 | $this->setJsonHeader(); |
21 | 21 | // offset can be only integer |
22 | - $offset = (int)$offset; |
|
22 | + $offset = (int) $offset; |
|
23 | 23 | // get comment target path and check |
24 | - $path = (string)App::$Request->query->get('path'); |
|
24 | + $path = (string) App::$Request->query->get('path'); |
|
25 | 25 | if (Str::likeEmpty($path)) { |
26 | 26 | throw new JsonException('Wrong path'); |
27 | 27 | } |
@@ -26,12 +26,12 @@ |
||
26 | 26 | parent::before(); |
27 | 27 | $configs = AppRecord::getConfigs('app', 'Content'); |
28 | 28 | // prevent null-type config data |
29 | - if ((int)$configs['gallerySize'] > 0) { |
|
30 | - $this->maxSize = (int)$configs['gallerySize'] * 1024; |
|
29 | + if ((int) $configs['gallerySize'] > 0) { |
|
30 | + $this->maxSize = (int) $configs['gallerySize'] * 1024; |
|
31 | 31 | } |
32 | 32 | |
33 | - if ((int)$configs['galleryResize'] > 0) { |
|
34 | - $this->maxResize = (int)$configs['galleryResize']; |
|
33 | + if ((int) $configs['galleryResize'] > 0) { |
|
34 | + $this->maxResize = (int) $configs['galleryResize']; |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $answerTime = Date::convertToTimestamp($lastAnswer->created_at); |
148 | 148 | $cfgs = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
149 | 149 | // hmm, maybe past less then delay required? |
150 | - if ($now - (int)$cfgs['delayBetweenPost'] < $answerTime) { |
|
150 | + if ($now - (int) $cfgs['delayBetweenPost'] < $answerTime) { |
|
151 | 151 | throw new JsonException('Delay between answers not pass'); |
152 | 152 | } |
153 | 153 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $postInfo = $findAnswer->getWallPost(); |
195 | 195 | |
196 | 196 | // if not a target user of answer and not answer owner - lets throw exception |
197 | - if($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
197 | + if ($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
198 | 198 | throw new JsonException('Access declined!'); |
199 | 199 | } |
200 | 200 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | // sender is not myself? then i'm - target (remote user is sender user->to_me) |
255 | 255 | if ($row->sender_id !== $user->id) { |
256 | 256 | $userList[] = $row->sender_id; |
257 | - if ((int)$row->tread === 0) { |
|
257 | + if ((int) $row->tread === 0) { |
|
258 | 258 | $unreadList[] = $row->sender_id; |
259 | 259 | } |
260 | 260 | } |
@@ -272,8 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | $response[] = [ |
274 | 274 | 'user_id' => $user_id, |
275 | - 'user_nick' => $identity->getProfile()->nick === null ? App::$Translate->get('Profile', 'No name') : |
|
276 | - App::$Security->strip_tags($identity->getProfile()->nick), |
|
275 | + 'user_nick' => $identity->getProfile()->nick === null ? App::$Translate->get('Profile', 'No name') : App::$Security->strip_tags($identity->getProfile()->nick), |
|
277 | 276 | 'user_avatar' => $identity->getProfile()->getAvatarUrl('small'), |
278 | 277 | 'message_new' => Arr::in($user_id, $unreadList), |
279 | 278 | 'user_block' => !Blacklist::check($user->id, $identity->id) |
@@ -323,7 +322,7 @@ discard block |
||
323 | 322 | |
324 | 323 | // get special types for this action |
325 | 324 | $queryType = App::$Request->get('type'); |
326 | - $queryId = (int)App::$Request->get('id'); |
|
325 | + $queryId = (int) App::$Request->get('id'); |
|
327 | 326 | // get current user object |
328 | 327 | $user = App::$User->identity(); |
329 | 328 | |
@@ -339,11 +338,11 @@ discard block |
||
339 | 338 | switch ($queryType) { |
340 | 339 | case 'after': |
341 | 340 | $messages = Message::where('id', '>', $queryId) |
342 | - ->where(function ($query) use ($cor_id, $user) { |
|
343 | - $query->where(function ($q) use ($cor_id, $user){ |
|
341 | + ->where(function($query) use ($cor_id, $user) { |
|
342 | + $query->where(function($q) use ($cor_id, $user){ |
|
344 | 343 | $q->where('target_id', '=', $user->getId()) |
345 | 344 | ->where('sender_id', '=', $cor_id); |
346 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
345 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
347 | 346 | $q->where('target_id', '=', $cor_id) |
348 | 347 | ->where('sender_id', '=', $user->getId()); |
349 | 348 | }); |
@@ -351,11 +350,11 @@ discard block |
||
351 | 350 | break; |
352 | 351 | case 'before': |
353 | 352 | $messages = Message::where('id', '<', $queryId) |
354 | - ->where(function ($query) use ($cor_id, $user) { |
|
355 | - $query->where(function ($q) use ($cor_id, $user){ |
|
353 | + ->where(function($query) use ($cor_id, $user) { |
|
354 | + $query->where(function($q) use ($cor_id, $user){ |
|
356 | 355 | $q->where('target_id', '=', $user->getId()) |
357 | 356 | ->where('sender_id', '=', $cor_id); |
358 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
357 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
359 | 358 | $q->where('target_id', '=', $cor_id) |
360 | 359 | ->where('sender_id', '=', $user->getId()); |
361 | 360 | }); |
@@ -454,7 +453,7 @@ discard block |
||
454 | 453 | $this->setJsonHeader(); |
455 | 454 | |
456 | 455 | // get operation type and target user id |
457 | - $target_id = (int)App::$Request->get('target'); |
|
456 | + $target_id = (int) App::$Request->get('target'); |
|
458 | 457 | $type = App::$Request->get('type'); |
459 | 458 | |
460 | 459 | // check type of query |
@@ -469,7 +468,7 @@ discard block |
||
469 | 468 | |
470 | 469 | $cfg = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
471 | 470 | // check if rating is enabled for website |
472 | - if ((int)$cfg['rating'] !== 1) { |
|
471 | + if ((int) $cfg['rating'] !== 1) { |
|
473 | 472 | throw new JsonException('Rating is disabled'); |
474 | 473 | } |
475 | 474 |