@@ -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 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | $status = $object->disabled; |
14 | 14 | |
15 | - $object->disabled = (int)!$status; // magic inside: bool to int and reverse - 0 => 1, 1 => 0 |
|
15 | + $object->disabled = (int) !$status; // magic inside: bool to int and reverse - 0 => 1, 1 => 0 |
|
16 | 16 | $object->save(); |
17 | 17 | } |
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -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; |
@@ -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']; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function rules() |
83 | 83 | { |
84 | - $res = [ |
|
84 | + $res = [ |
|
85 | 85 | ['title.' . App::$Request->getLanguage(), 'required'], |
86 | 86 | ['text.' . App::$Request->getLanguage(), 'required', null, true, true], |
87 | 87 | ['text', 'used', null, true, true], |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $this->_content->meta_description = Serialize::encode(App::$Security->strip_tags($this->metaDescription)); |
143 | 143 | $this->_content->source = App::$Security->strip_tags($this->source); |
144 | 144 | // check if rating is changed |
145 | - if ((int)$this->addRating !== 0) { |
|
146 | - $this->_content->rating += (int)$this->addRating; |
|
145 | + if ((int) $this->addRating !== 0) { |
|
146 | + $this->_content->rating += (int) $this->addRating; |
|
147 | 147 | } |
148 | 148 | // check if special comment hash is exist |
149 | 149 | if ($this->_new || Str::length($this->_content->comment_hash) < 32) { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $data = ContentCategory::getSortedCategories(); |
182 | 182 | $response = []; |
183 | 183 | foreach ($data as $key=>$val) { |
184 | - $response[] = (string)$key; |
|
184 | + $response[] = (string) $key; |
|
185 | 185 | } |
186 | 186 | return $response; |
187 | 187 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | if ($this->newpassword !== null && Str::length($this->newpassword) >= 3) { |
99 | 99 | $this->_user->password = App::$Security->password_hash($this->newpassword); |
100 | 100 | } |
101 | - } elseif($property === 'approve_token') { |
|
101 | + } elseif ($property === 'approve_token') { |
|
102 | 102 | if ($value == "1") { |
103 | 103 | $this->_user->approve_token = '0'; |
104 | 104 | } else { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | $this->scanFiles = json_decode(File::read('/Private/Antivirus/ScanFiles.json')); |
48 | 48 | if (File::exist('/Private/Antivirus/Infected.json')) { |
49 | - $this->infected = (array)json_decode(File::read('/Private/Antivirus/Infected.json')); |
|
49 | + $this->infected = (array) json_decode(File::read('/Private/Antivirus/Infected.json')); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $detected = true; |
115 | 115 | $pos = $found[0][1]; |
116 | 116 | $this->infected[$path][] = [ |
117 | - 'pos' => (int)$pos, |
|
117 | + 'pos' => (int) $pos, |
|
118 | 118 | 'sigId' => $attrId, |
119 | 119 | 'sigRule' => $sigContent, |
120 | 120 | 'sever' => $attrSever, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | (($pos = strpos($normalized, $sigContent)) !== false) |
129 | 129 | ) { |
130 | 130 | $this->infected[$path][] = [ |
131 | - 'pos' => (int)$pos, |
|
131 | + 'pos' => (int) $pos, |
|
132 | 132 | 'sigId' => $attrId, |
133 | 133 | 'sigRule' => $sigContent, |
134 | 134 | 'sever' => $attrSever, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | private function prepareScanlist() |
150 | 150 | { |
151 | - $files = (object)File::listFiles(root, $this->affectedExt); |
|
151 | + $files = (object) File::listFiles(root, $this->affectedExt); |
|
152 | 152 | File::write('/Private/Antivirus/ScanFiles.json', json_encode($files)); |
153 | 153 | } |
154 | 154 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ]; |
57 | 57 | |
58 | 58 | // check if this category is hidden |
59 | - if ((int)$this->categoryData['configs']['showCategory'] !== 1) { |
|
59 | + if ((int) $this->categoryData['configs']['showCategory'] !== 1) { |
|
60 | 60 | throw new ForbiddenException(); |
61 | 61 | } |
62 | 62 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | // find first paragraph ending |
82 | 82 | $breakPosition = mb_strpos($text, '</p>', null, 'UTF-8'); |
83 | 83 | // cut text from position caret before </p> (+4 symbols to save item as valid) |
84 | - $text = Str::substr($text, 0, $breakPosition+4); |
|
84 | + $text = Str::substr($text, 0, $breakPosition + 4); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $itemPath = $this->_allCategories[$row->category_id]['path']; |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | 'author' => App::$User->identity($row->author_id), |
129 | 129 | 'poster' => $poster, |
130 | 130 | 'thumb' => $thumb, |
131 | - 'views' => (int)$row->views, |
|
132 | - 'rating' => (int)$row->rating, |
|
131 | + 'views' => (int) $row->views, |
|
132 | + 'rating' => (int) $row->rating, |
|
133 | 133 | 'category' => $this->_allCategories[$row->category_id], |
134 | 134 | 'uri' => '/content/read/' . $itemPath, |
135 | 135 | 'tags' => $tags |
@@ -86,7 +86,7 @@ |
||
86 | 86 | $this->authorName = Str::likeEmpty($profile->nick) ? __('No name') : $profile->nick; |
87 | 87 | } |
88 | 88 | $this->source = $this->_content->source; |
89 | - $this->views = $this->_content->views+1; |
|
89 | + $this->views = $this->_content->views + 1; |
|
90 | 90 | // check for dependence, add '' for general cat, ex: general/depend1/depend2/.../depend-n |
91 | 91 | $catNestingArray = Arr::merge([0 => ''], explode('/', $this->catPath)); |
92 | 92 | if ($catNestingArray > 1) { |