@@ -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 |
@@ -202,7 +202,7 @@ |
||
202 | 202 | $findAnswer->delete(); |
203 | 203 | |
204 | 204 | $this->response = json_encode([ |
205 | - 'status' => 1, |
|
205 | + 'status' => 1, |
|
206 | 206 | 'message' => 'ok' |
207 | 207 | ]); |
208 | 208 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $answerTime = Date::convertToTimestamp($lastAnswer->created_at); |
150 | 150 | $cfgs = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
151 | 151 | // hmm, maybe past less then delay required? |
152 | - if ($now - (int)$cfgs['delayBetweenPost'] < $answerTime) { |
|
152 | + if ($now - (int) $cfgs['delayBetweenPost'] < $answerTime) { |
|
153 | 153 | throw new JsonException('Delay between answers not pass'); |
154 | 154 | } |
155 | 155 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $postInfo = $findAnswer->getWallPost(); |
197 | 197 | |
198 | 198 | // if not a target user of answer and not answer owner - lets throw exception |
199 | - if($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
199 | + if ($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
200 | 200 | throw new JsonException('Access declined!'); |
201 | 201 | } |
202 | 202 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // sender is not myself? then i'm - target (remote user is sender user->to_me) |
257 | 257 | if ($row->sender_id !== $user->id) { |
258 | 258 | $userList[] = $row->sender_id; |
259 | - if ((int)$row->tread === 0) { |
|
259 | + if ((int) $row->tread === 0) { |
|
260 | 260 | $unreadList[] = $row->sender_id; |
261 | 261 | } |
262 | 262 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | // get special types for this action |
326 | 326 | $queryType = App::$Request->get('type'); |
327 | - $queryId = (int)App::$Request->get('id'); |
|
327 | + $queryId = (int) App::$Request->get('id'); |
|
328 | 328 | // get current user object |
329 | 329 | $user = App::$User->identity(); |
330 | 330 | |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | switch ($queryType) { |
341 | 341 | case 'after': |
342 | 342 | $messages = Message::where('id', '>', $queryId) |
343 | - ->where(function ($query) use ($cor_id, $user) { |
|
344 | - $query->where(function ($q) use ($cor_id, $user){ |
|
343 | + ->where(function($query) use ($cor_id, $user) { |
|
344 | + $query->where(function($q) use ($cor_id, $user){ |
|
345 | 345 | $q->where('target_id', '=', $user->getId()) |
346 | 346 | ->where('sender_id', '=', $cor_id); |
347 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
347 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
348 | 348 | $q->where('target_id', '=', $cor_id) |
349 | 349 | ->where('sender_id', '=', $user->getId()); |
350 | 350 | }); |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | break; |
353 | 353 | case 'before': |
354 | 354 | $messages = Message::where('id', '<', $queryId) |
355 | - ->where(function ($query) use ($cor_id, $user) { |
|
356 | - $query->where(function ($q) use ($cor_id, $user){ |
|
355 | + ->where(function($query) use ($cor_id, $user) { |
|
356 | + $query->where(function($q) use ($cor_id, $user){ |
|
357 | 357 | $q->where('target_id', '=', $user->getId()) |
358 | 358 | ->where('sender_id', '=', $cor_id); |
359 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
359 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
360 | 360 | $q->where('target_id', '=', $cor_id) |
361 | 361 | ->where('sender_id', '=', $user->getId()); |
362 | 362 | }); |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | $this->setJsonHeader(); |
456 | 456 | |
457 | 457 | // get operation type and target user id |
458 | - $target_id = (int)App::$Request->get('target'); |
|
458 | + $target_id = (int) App::$Request->get('target'); |
|
459 | 459 | $type = App::$Request->get('type'); |
460 | 460 | |
461 | 461 | // check type of query |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | $cfg = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
472 | 472 | // check if rating is enabled for website |
473 | - if ((int)$cfg['rating'] !== 1) { |
|
473 | + if ((int) $cfg['rating'] !== 1) { |
|
474 | 474 | throw new JsonException('Rating is disabled'); |
475 | 475 | } |
476 | 476 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | $records = null; |
37 | 37 | |
38 | 38 | // set current page and offset |
39 | - $page = (int)App::$Request->query->get('page'); |
|
39 | + $page = (int) App::$Request->query->get('page'); |
|
40 | 40 | $cfgs = Serialize::decode($this->application->configs); |
41 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
41 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
42 | 42 | if ($userPerPage < 1) { |
43 | 43 | $userPerPage = 1; |
44 | 44 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | switch ($filter_name) { |
48 | 48 | case 'rating': // rating list, order by rating DESC |
49 | 49 | // check if rating is enabled |
50 | - if ((int)$cfgs['rating'] !== 1) { |
|
50 | + if ((int) $cfgs['rating'] !== 1) { |
|
51 | 51 | throw new NotFoundException(); |
52 | 52 | } |
53 | 53 | $records = (new ProfileRecords())->orderBy('rating', 'DESC'); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'pagination' => $pagination, |
92 | 92 | 'id' => $filter_name, |
93 | 93 | 'add' => $filter_value, |
94 | - 'ratingOn' => (int)$cfgs['rating'] |
|
94 | + 'ratingOn' => (int) $cfgs['rating'] |
|
95 | 95 | ]); |
96 | 96 | } |
97 | 97 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function actionShow($userId) |
105 | 105 | { |
106 | 106 | $cfg = Serialize::decode($this->application->configs); |
107 | - if ((int)$cfg['guestView'] !== 1 && !App::$User->isAuth()) { |
|
107 | + if ((int) $cfg['guestView'] !== 1 && !App::$User->isAuth()) { |
|
108 | 108 | throw new ForbiddenException('You must be registered user to view other profile'); |
109 | 109 | } |
110 | 110 | // check if target exists |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | App::$Session->getFlashBag()->add('error', __('This user are in your black list or you are in blacklist!')); |
127 | 127 | } else { |
128 | 128 | // check if message added |
129 | - if ($wallModel->makePost($targetPersone, $viewerPersone, (int)$cfg['delayBetweenPost'])) { |
|
129 | + if ($wallModel->makePost($targetPersone, $viewerPersone, (int) $cfg['delayBetweenPost'])) { |
|
130 | 130 | App::$Session->getFlashBag()->add('success', __('The message was successful posted!')); |
131 | 131 | } else { |
132 | 132 | App::$Session->getFlashBag()->add('warning', __('Posting message was failed! You need to wait some time...')); |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | |
138 | 138 | $query = $targetPersone->getWall(); // relation hasMany from users to walls |
139 | 139 | // pagination and query params |
140 | - $wallPage = (int)App::$Request->query->get('page'); |
|
141 | - $wallItems = (int)$cfg['wallPostOnPage']; |
|
140 | + $wallPage = (int) App::$Request->query->get('page'); |
|
141 | + $wallItems = (int) $cfg['wallPostOnPage']; |
|
142 | 142 | $wallOffset = $wallPage * $wallItems; |
143 | 143 | |
144 | 144 | // build pagination |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'notify' => App::$Session->getFlashBag()->all(), |
161 | 161 | 'wallRecords' => $wallRecords, |
162 | 162 | 'pagination' => $wallPagination, |
163 | - 'ratingOn' => (int)$cfg['rating'] === 1 |
|
163 | + 'ratingOn' => (int) $cfg['rating'] === 1 |
|
164 | 164 | ]); |
165 | 165 | } |
166 | 166 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | // set user id from ?id= get param if form not sended |
322 | 322 | if (!$model->send()) { |
323 | - $uid = (int)App::$Request->query->get('id'); |
|
323 | + $uid = (int) App::$Request->query->get('id'); |
|
324 | 324 | if ($uid > 0) { |
325 | 325 | $model->id = $uid; |
326 | 326 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | // get blocked users |
339 | 339 | $records = Blacklist::where('user_id', '=', $user->getId()); |
340 | 340 | |
341 | - $page = (int)App::$Request->query->get('page'); |
|
341 | + $page = (int) App::$Request->query->get('page'); |
|
342 | 342 | $offset = $page * self::BLOCK_PER_PAGE; |
343 | 343 | |
344 | 344 | // build pagination |
@@ -411,15 +411,15 @@ discard block |
||
411 | 411 | if ($model->send() && $model->validate()) { |
412 | 412 | // get records from db |
413 | 413 | $records = ProfileRecords::where('nick', 'like', '%' . $model->query . '%'); |
414 | - $page = (int)App::$Request->query->get('page'); |
|
415 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
414 | + $page = (int) App::$Request->query->get('page'); |
|
415 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
416 | 416 | if ($userPerPage < 1) { |
417 | 417 | $userPerPage = 1; |
418 | 418 | } |
419 | 419 | $offset = $page * $userPerPage; |
420 | 420 | // build pagination |
421 | 421 | $pagination = new SimplePagination([ |
422 | - 'url' => ['profile/search', null, null, [$model->getFormName().'[query]' => $model->query, $model->getFormName().'[submit]' => true]], |
|
422 | + 'url' => ['profile/search', null, null, [$model->getFormName() . '[query]' => $model->query, $model->getFormName() . '[submit]' => true]], |
|
423 | 423 | 'page' => $page, |
424 | 424 | 'step' => $userPerPage, |
425 | 425 | 'total' => $records->count() |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | 'model' => $model->export(), |
435 | 435 | 'records' => $records, |
436 | 436 | 'pagination' => $pagination, |
437 | - 'ratingOn' => (int)$cfgs['rating'] |
|
437 | + 'ratingOn' => (int) $cfgs['rating'] |
|
438 | 438 | ]); |
439 | 439 | } |
440 | 440 | } |
441 | 441 | \ No newline at end of file |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Pass properties from record construction |
|
33 | - */ |
|
32 | + * Pass properties from record construction |
|
33 | + */ |
|
34 | 34 | public function before() |
35 | 35 | { |
36 | 36 | $this->title = Serialize::getDecodeLocale($this->_record->title); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Form labels |
|
42 | - */ |
|
41 | + * Form labels |
|
42 | + */ |
|
43 | 43 | public function labels() |
44 | 44 | { |
45 | 45 | return [ |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * Validation rules |
|
54 | - */ |
|
53 | + * Validation rules |
|
54 | + */ |
|
55 | 55 | public function rules() |
56 | 56 | { |
57 | 57 | return [ |
@@ -110,7 +110,7 @@ |
||
110 | 110 | $response = []; |
111 | 111 | foreach ($data as $key=>$val) { |
112 | 112 | if ($this->_record->id !== $key) { |
113 | - $response[] = (string)$key; |
|
113 | + $response[] = (string) $key; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | return $response; |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Pass properties from default record values |
|
42 | - */ |
|
41 | + * Pass properties from default record values |
|
42 | + */ |
|
43 | 43 | public function before() |
44 | 44 | { |
45 | 45 | if ($this->_record->id === null) { |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | - * Form labels |
|
78 | - */ |
|
77 | + * Form labels |
|
78 | + */ |
|
79 | 79 | public function labels() |
80 | 80 | { |
81 | 81 | return [ |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | - * Validation rules |
|
97 | - */ |
|
96 | + * Validation rules |
|
97 | + */ |
|
98 | 98 | public function rules() |
99 | 99 | { |
100 | 100 | $rules = [ |
@@ -102,7 +102,7 @@ |
||
102 | 102 | ]; |
103 | 103 | |
104 | 104 | // general category |
105 | - if ($this->_new === false && (int)$this->_record->id === 1) { |
|
105 | + if ($this->_new === false && (int) $this->_record->id === 1) { |
|
106 | 106 | $rules[] = ['path', 'used']; |
107 | 107 | } else { |
108 | 108 | $rules[] = ['path', 'required']; |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ffcms\Core\App; |
6 | 6 | use Ffcms\Core\Arch\Model; |
7 | -use Ffcms\Core\Helper\Type\Obj; |
|
8 | 7 | use Ffcms\Core\Helper\Type\Str; |
9 | 8 | use Ffcms\Core\Interfaces\iUser; |
10 | 9 |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
18 | - * Example of usage magic labels for future form helper usage |
|
19 | - */ |
|
18 | + * Example of usage magic labels for future form helper usage |
|
19 | + */ |
|
20 | 20 | public function labels() |
21 | 21 | { |
22 | 22 | return [ |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | - * Typo rules |
|
29 | - */ |
|
28 | + * Typo rules |
|
29 | + */ |
|
30 | 30 | public function rules() |
31 | 31 | { |
32 | 32 | return []; |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | - * Set readable title of content to property |
|
28 | - */ |
|
27 | + * Set readable title of content to property |
|
28 | + */ |
|
29 | 29 | public function before() |
30 | 30 | { |
31 | 31 | $this->id = $this->_record->id; |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | - * Form labels |
|
37 | - */ |
|
36 | + * Form labels |
|
37 | + */ |
|
38 | 38 | public function labels() |
39 | 39 | { |
40 | 40 | return [ |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * Validation does not matter |
|
47 | - */ |
|
46 | + * Validation does not matter |
|
47 | + */ |
|
48 | 48 | public function rules() |
49 | 49 | { |
50 | 50 | return [ |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
23 | - * Pass properties |
|
24 | - */ |
|
23 | + * Pass properties |
|
24 | + */ |
|
25 | 25 | public function before() |
26 | 26 | { |
27 | 27 | $this->id = $this->_record->id; |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Form label |
|
33 | - */ |
|
32 | + * Form label |
|
33 | + */ |
|
34 | 34 | public function labels() |
35 | 35 | { |
36 | 36 | return [ |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * Typical rules |
|
43 | - */ |
|
42 | + * Typical rules |
|
43 | + */ |
|
44 | 44 | public function rules() |
45 | 45 | { |
46 | 46 | return []; |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
31 | - * Set model properties based on defaults config values |
|
32 | - */ |
|
31 | + * Set model properties based on defaults config values |
|
32 | + */ |
|
33 | 33 | public function before() |
34 | 34 | { |
35 | 35 | foreach ($this->_configs as $property => $value) { |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * Form labels |
|
44 | - */ |
|
43 | + * Form labels |
|
44 | + */ |
|
45 | 45 | public function labels() |
46 | 46 | { |
47 | 47 | return [ |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Validation rules |
|
61 | - */ |
|
60 | + * Validation rules |
|
61 | + */ |
|
62 | 62 | public function rules() |
63 | 63 | { |
64 | 64 | return [ |