@@ -25,14 +25,14 @@ |
||
25 | 25 | public function actionIndex() |
26 | 26 | { |
27 | 27 | // get search query value from GET headers |
28 | - $query = (string)$this->request->query->get('query', null); |
|
28 | + $query = (string) $this->request->query->get('query', null); |
|
29 | 29 | // strip html tags |
30 | 30 | $query = App::$Security->strip_tags($query); |
31 | 31 | // get configs |
32 | 32 | $configs = $this->getConfigs(); |
33 | 33 | |
34 | 34 | // check search query length |
35 | - if (Str::likeEmpty($query) || Str::length($query) < (int)$configs['minLength']) { |
|
35 | + if (Str::likeEmpty($query) || Str::length($query) < (int) $configs['minLength']) { |
|
36 | 36 | throw new NotFoundException(__('Search query is too short!')); |
37 | 37 | } |
38 | 38 |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $answerTime = Date::convertToTimestamp($lastAnswer->created_at); |
161 | 161 | $cfgs = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
162 | 162 | // hmm, maybe past less then delay required? |
163 | - if ($now - (int)$cfgs['delayBetweenPost'] < $answerTime) { |
|
163 | + if ($now - (int) $cfgs['delayBetweenPost'] < $answerTime) { |
|
164 | 164 | throw new ForbiddenException('Delay between answers not pass'); |
165 | 165 | } |
166 | 166 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | // add notification for target user |
176 | 176 | if ($viewer->id !== $target_id) { |
177 | 177 | $notify = new EntityAddNotification($target_id); |
178 | - $notify->add('/profile/show/' . $target_id . '#wall-post-' . $wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [ |
|
178 | + $notify->add('/profile/show/'.$target_id.'#wall-post-'.$wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [ |
|
179 | 179 | 'snippet' => Text::snippet($message, 50), |
180 | 180 | 'post' => $wallRow->message |
181 | 181 | ]); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $postInfo = $findAnswer->getWallPost(); |
220 | 220 | |
221 | 221 | // if not a target user of answer and not answer owner - lets throw exception |
222 | - if($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
222 | + if ($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
223 | 223 | throw new ForbiddenException('Access declined!'); |
224 | 224 | } |
225 | 225 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | // sender is not myself? then i'm - target (remote user is sender user->to_me) |
281 | 281 | if ($row->sender_id !== $user->id) { |
282 | 282 | $userList[] = $row->sender_id; |
283 | - if ((int)$row->tread === 0) { |
|
283 | + if ((int) $row->tread === 0) { |
|
284 | 284 | $unreadList[] = $row->sender_id; |
285 | 285 | } |
286 | 286 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | // get special types for this action |
362 | 362 | $queryType = $this->request->get('type'); |
363 | - $queryId = (int)$this->request->get('id'); |
|
363 | + $queryId = (int) $this->request->get('id'); |
|
364 | 364 | // get current user object |
365 | 365 | $user = App::$User->identity(); |
366 | 366 | |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | switch ($queryType) { |
377 | 377 | case 'after': |
378 | 378 | $messages = Message::where('id', '>', $queryId) |
379 | - ->where(function ($query) use ($cor_id, $user) { |
|
380 | - $query->where(function ($q) use ($cor_id, $user){ |
|
379 | + ->where(function($query) use ($cor_id, $user) { |
|
380 | + $query->where(function($q) use ($cor_id, $user){ |
|
381 | 381 | $q->where('target_id', '=', $user->getId()) |
382 | 382 | ->where('sender_id', '=', $cor_id); |
383 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
383 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
384 | 384 | $q->where('target_id', '=', $cor_id) |
385 | 385 | ->where('sender_id', '=', $user->getId()); |
386 | 386 | }); |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | break; |
389 | 389 | case 'before': |
390 | 390 | $messages = Message::where('id', '<', $queryId) |
391 | - ->where(function ($query) use ($cor_id, $user) { |
|
392 | - $query->where(function ($q) use ($cor_id, $user){ |
|
391 | + ->where(function($query) use ($cor_id, $user) { |
|
392 | + $query->where(function($q) use ($cor_id, $user){ |
|
393 | 393 | $q->where('target_id', '=', $user->getId()) |
394 | 394 | ->where('sender_id', '=', $cor_id); |
395 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
395 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
396 | 396 | $q->where('target_id', '=', $cor_id) |
397 | 397 | ->where('sender_id', '=', $user->getId()); |
398 | 398 | }); |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $this->setJsonHeader(); |
501 | 501 | |
502 | 502 | // get operation type and target user id |
503 | - $target_id = (int)$this->request->get('target'); |
|
503 | + $target_id = (int) $this->request->get('target'); |
|
504 | 504 | $type = $this->request->get('type'); |
505 | 505 | |
506 | 506 | // check type of query |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | |
516 | 516 | $cfg = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
517 | 517 | // check if rating is enabled for website |
518 | - if ((int)$cfg['rating'] !== 1) { |
|
518 | + if ((int) $cfg['rating'] !== 1) { |
|
519 | 519 | throw new NativeException('Rating is disabled'); |
520 | 520 | } |
521 | 521 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $this->setJsonHeader(); |
33 | 33 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
34 | 34 | |
35 | - $replayTo = (int)$this->request->request->get('replay-to'); |
|
35 | + $replayTo = (int) $this->request->request->get('replay-to'); |
|
36 | 36 | $model = null; |
37 | 37 | // check if its a answer (comment answer type) |
38 | 38 | if ($replayTo > 0) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | // pass general comment params to model |
47 | - $model->message = App::$Security->secureHtml((string)$this->request->request->get('message')); |
|
47 | + $model->message = App::$Security->secureHtml((string) $this->request->request->get('message')); |
|
48 | 48 | $model->guestName = App::$Security->strip_tags($this->request->request->get('guest-name')); |
49 | 49 | |
50 | 50 | // check model conditions before add new row |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | // get configs |
77 | 77 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
78 | 78 | // items per page |
79 | - $perPage = (int)$configs['perPage']; |
|
79 | + $perPage = (int) $configs['perPage']; |
|
80 | 80 | // offset can be only integer |
81 | - $index = (int)$index; |
|
81 | + $index = (int) $index; |
|
82 | 82 | $offset = $perPage * $index; |
83 | 83 | // get comment target path and check |
84 | - $path = (string)$this->request->query->get('path'); |
|
84 | + $path = (string) $this->request->query->get('path'); |
|
85 | 85 | if (Str::likeEmpty($path)) { |
86 | 86 | throw new NotFoundException('Wrong path'); |
87 | 87 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ->where('moderate', '=', 0); |
92 | 92 | |
93 | 93 | // check if comments is depend of language locale |
94 | - if ((int)$configs['onlyLocale'] === 1) { |
|
94 | + if ((int) $configs['onlyLocale'] === 1) { |
|
95 | 95 | $query = $query->where('lang', '=', $this->request->getLanguage()); |
96 | 96 | } |
97 | 97 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | $this->setJsonHeader(); |
143 | 143 | // check input data |
144 | - if (!Obj::isLikeInt($commentId) || (int)$commentId < 1) { |
|
144 | + if (!Obj::isLikeInt($commentId) || (int) $commentId < 1) { |
|
145 | 145 | throw new ForbiddenException('Input data is incorrect'); |
146 | 146 | } |
147 | 147 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | // get data from db by comment id |
152 | 152 | $records = CommentAnswer::where('comment_id', '=', $commentId) |
153 | 153 | ->where('moderate', '=', 0); |
154 | - if ((int)$configs['onlyLocale'] === 1) { |
|
154 | + if ((int) $configs['onlyLocale'] === 1) { |
|
155 | 155 | $records = $records->where('lang', '=', $this->request->getLanguage()); |
156 | 156 | } |
157 | 157 | |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | foreach ($path as $id => $uri) { |
196 | 196 | $query = CommentPost::where('pathway', '=', $uri)->where('moderate', '=', 0); |
197 | 197 | // check if comments is depend of language locale |
198 | - if ((int)$configs['onlyLocale'] === 1) { |
|
198 | + if ((int) $configs['onlyLocale'] === 1) { |
|
199 | 199 | $query = $query->where('lang', '=', $this->request->getLanguage()); |
200 | 200 | } |
201 | 201 | // set itemId => count |
202 | - $count[(int)$id] = $query->count(); |
|
202 | + $count[(int) $id] = $query->count(); |
|
203 | 203 | } |
204 | 204 | // render json response |
205 | 205 | return json_encode(['status' => 1, 'count' => $count]); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function actionIndex() |
41 | 41 | { |
42 | 42 | // set current page and offset |
43 | - $page = (int)$this->request->query->get('page'); |
|
43 | + $page = (int) $this->request->query->get('page'); |
|
44 | 44 | $offset = $page * self::ITEM_PER_PAGE; |
45 | 45 | |
46 | 46 | $query = null; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } elseif ($type === 'moderate') { // only items on moderate |
52 | 52 | $query = ContentEntity::where('display', '=', 0); |
53 | 53 | } elseif (Obj::isLikeInt($type)) { // sounds like category id ;) |
54 | - $query = ContentEntity::where('category_id', '=', (int)$type); |
|
54 | + $query = ContentEntity::where('category_id', '=', (int) $type); |
|
55 | 55 | } else { |
56 | 56 | $query = new ContentEntity(); |
57 | 57 | $type = 'all'; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | if ($model->send() && $model->validate()) { |
198 | 198 | // remove all trashed items |
199 | 199 | foreach ($records->get() as $item) { |
200 | - $galleryPath = '/upload/gallery/' . (int)$item->id; |
|
200 | + $galleryPath = '/upload/gallery/'.(int) $item->id; |
|
201 | 201 | if (Directory::exist($galleryPath)) { |
202 | 202 | Directory::remove($galleryPath); |
203 | 203 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | public function actionCategoryupdate($id = null) |
275 | 275 | { |
276 | 276 | // get owner id for new rows |
277 | - $parentId = (int)$this->request->query->get('parent'); |
|
277 | + $parentId = (int) $this->request->query->get('parent'); |
|
278 | 278 | |
279 | 279 | // get relation and pass to model |
280 | 280 | $record = ContentCategory::findOrNew($id); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function actionIndex() |
34 | 34 | { |
35 | 35 | // set current page and offset |
36 | - $page = (int)$this->request->query->get('page'); |
|
36 | + $page = (int) $this->request->query->get('page'); |
|
37 | 37 | $offset = $page * self::ITEM_PER_PAGE; |
38 | 38 | |
39 | 39 | // get feedback posts AR table |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | // initialize model with answer add if thread is not closed |
77 | 77 | $model = null; |
78 | - if ((int)$record->closed !== 1) { |
|
78 | + if ((int) $record->closed !== 1) { |
|
79 | 79 | $model = new FormAnswerAdd($record, App::$User->identity()->getId()); |
80 | 80 | if ($model->send()) { |
81 | 81 | if ($model->validate()) { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | case 'answer': |
116 | 116 | $record = FeedbackAnswer::find($id); |
117 | 117 | if ($record !== null && $record !== false) { |
118 | - $postId = (int)$record->getFeedbackPost()->id; |
|
118 | + $postId = (int) $record->getFeedbackPost()->id; |
|
119 | 119 | } |
120 | 120 | break; |
121 | 121 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | if ($model->validate()) { |
132 | 132 | $model->make(); |
133 | 133 | App::$Session->getFlashBag()->add('success', __('Feedback item are successful changed')); |
134 | - $this->response->redirect('feedback/read/' . $postId); |
|
134 | + $this->response->redirect('feedback/read/'.$postId); |
|
135 | 135 | } else { |
136 | 136 | App::$Session->getFlashBag()->add('danger', __('Updating is failed')); |
137 | 137 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | App::$Session->getFlashBag()->add('success', __('Feedback request is changed!')); |
182 | 182 | |
183 | 183 | // redirect to feedback post read |
184 | - $this->response->redirect('feedback/read/' . $id); |
|
184 | + $this->response->redirect('feedback/read/'.$id); |
|
185 | 185 | return null; |
186 | 186 | } |
187 | 187 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // its a answer, lets remove it and redirect back in post |
227 | 227 | $postId = $record->feedback_id; |
228 | 228 | $record->delete(); |
229 | - $this->response->redirect('feedback/read/' . $postId); |
|
229 | + $this->response->redirect('feedback/read/'.$postId); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $query = new UserRecords(); |
41 | 41 | |
42 | 42 | // set current page and offset |
43 | - $page = (int)$this->request->query->get('page', 0); |
|
43 | + $page = (int) $this->request->query->get('page', 0); |
|
44 | 44 | $offset = $page * self::ITEM_PER_PAGE; |
45 | 45 | |
46 | 46 | // build pagination |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function actionDelete($id = null) |
105 | 105 | { |
106 | 106 | // check if id is passed or get data from GET as array ids |
107 | - if ($id === 0 || (int)$id < 1) { |
|
107 | + if ($id === 0 || (int) $id < 1) { |
|
108 | 108 | $ids = $this->request->query->get('selected'); |
109 | 109 | if (Obj::isArray($ids) && Arr::onlyNumericValues($ids)) { |
110 | 110 | $id = $ids; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $query = new ProfileRecords(); |
34 | 34 | |
35 | 35 | // set current page and offset |
36 | - $page = (int)$this->request->query->get('page'); |
|
36 | + $page = (int) $this->request->query->get('page'); |
|
37 | 37 | $offset = $page * self::ITEM_PER_PAGE; |
38 | 38 | |
39 | 39 | // build pagination |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function actionDelete($id) |
62 | 62 | { |
63 | - $this->response->redirect('user/delete/' . $id); |
|
63 | + $this->response->redirect('user/delete/'.$id); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | // cache some data |
38 | 38 | $rootSize = App::$Cache->get('root.size'); |
39 | 39 | if ($rootSize === null) { |
40 | - $rootSize = round(Directory::getSize('/') / (1024*1000), 2) . ' mb'; |
|
40 | + $rootSize = round(Directory::getSize('/') / (1024 * 1000), 2).' mb'; |
|
41 | 41 | App::$Cache->set('root.size', $rootSize, 86400); // 24 hours caching = 60 * 60 * 24 |
42 | 42 | } |
43 | 43 | $loadAvg = App::$Cache->get('load.average'); |
44 | 44 | if ($loadAvg === null) { |
45 | 45 | $loadAvg = Environment::loadAverage(); |
46 | - App::$Cache->set('load.average', $loadAvg, 60*5); // 5 min cache |
|
46 | + App::$Cache->set('load.average', $loadAvg, 60 * 5); // 5 min cache |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // prepare system statistic |
50 | 50 | $stats = [ |
51 | - 'ff_version' => App::$Properties->version['num'] . ' (' . App::$Properties->version['date'] . ')', |
|
52 | - 'php_version' => Environment::phpVersion() . ' (' . Environment::phpSAPI() . ')', |
|
51 | + 'ff_version' => App::$Properties->version['num'].' ('.App::$Properties->version['date'].')', |
|
52 | + 'php_version' => Environment::phpVersion().' ('.Environment::phpSAPI().')', |
|
53 | 53 | 'os_name' => Environment::osName(), |
54 | - 'database_name' => App::$Database->connection()->getDatabaseName() . ' (' . App::$Database->connection()->getDriverName() . ')', |
|
54 | + 'database_name' => App::$Database->connection()->getDatabaseName().' ('.App::$Database->connection()->getDriverName().')', |
|
55 | 55 | 'file_size' => $rootSize, |
56 | 56 | 'load_avg' => $loadAvg |
57 | 57 | ]; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function actionFiles() |
104 | 104 | { |
105 | 105 | return $this->view->render('files', [ |
106 | - 'connector' => App::$Alias->scriptUrl . '/api/main/files?lang=' . $this->request->getLanguage() |
|
106 | + 'connector' => App::$Alias->scriptUrl.'/api/main/files?lang='.$this->request->getLanguage() |
|
107 | 107 | ]); |
108 | 108 | } |
109 | 109 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function actionDeleteroute() |
176 | 176 | { |
177 | - $type = (string)$this->request->query->get('type'); |
|
178 | - $loader = (string)$this->request->query->get('loader'); |
|
179 | - $source = Str::lowerCase((string)$this->request->query->get('path')); |
|
177 | + $type = (string) $this->request->query->get('type'); |
|
178 | + $loader = (string) $this->request->query->get('loader'); |
|
179 | + $source = Str::lowerCase((string) $this->request->query->get('path')); |
|
180 | 180 | |
181 | 181 | $model = new EntityDeleteRoute($type, $loader, $source); |
182 | 182 | if ($model->send() && $model->validate()) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | $stats = App::$Cache->stats(); |
201 | 201 | // get size in mb from cache stats |
202 | - $size = round((int)$stats['size'] / (1024*1024), 2); |
|
202 | + $size = round((int) $stats['size'] / (1024 * 1024), 2); |
|
203 | 203 | |
204 | 204 | // check if submited |
205 | 205 | if ($this->request->request->get('clearcache', false)) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function actionIndex() |
41 | 41 | { |
42 | 42 | // set current page and offset |
43 | - $page = (int)$this->request->query->get('page'); |
|
43 | + $page = (int) $this->request->query->get('page'); |
|
44 | 44 | $offset = $page * self::ITEM_PER_PAGE; |
45 | 45 | |
46 | 46 | // initialize active record model |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | public function actionDelete($type, $id = 0) |
141 | 141 | { |
142 | 142 | // sounds like a multiply delete definition |
143 | - if ($id === 0 || (int)$id < 1) { |
|
143 | + if ($id === 0 || (int) $id < 1) { |
|
144 | 144 | $ids = $this->request->query->get('selected'); |
145 | 145 | if (Obj::isArray($ids) && Arr::onlyNumericValues($ids)) { |
146 | 146 | $id = $ids; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | if ($model->send() && $model->validate()) { |
175 | 175 | $model->make(); |
176 | 176 | App::$Session->getFlashBag()->add('success', __('Comments or answers are successful deleted!')); |
177 | - $this->response->redirect('comments/' . ($type === 'answer' ? 'answerlist' : 'index')); |
|
177 | + $this->response->redirect('comments/'.($type === 'answer' ? 'answerlist' : 'index')); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // render view |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | public function actionPublish($type, $id = 0) |
196 | 196 | { |
197 | 197 | // check if it multiple accept ids |
198 | - if ($id === 0 || (int)$id < 1) { |
|
198 | + if ($id === 0 || (int) $id < 1) { |
|
199 | 199 | $ids = $this->request->query->get('selected'); |
200 | 200 | if (Obj::isArray($ids) && Arr::onlyNumericValues($ids)) { |
201 | 201 | $id = $ids; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | if ($model->send()) { |
230 | 230 | $model->make(); |
231 | 231 | App::$Session->getFlashBag()->add('success', __('Comments or answers are successful published')); |
232 | - $this->response->redirect('comments/' . ($type === 'answer' ? 'answerlist' : 'index')); |
|
232 | + $this->response->redirect('comments/'.($type === 'answer' ? 'answerlist' : 'index')); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | return $this->view->render('publish', [ |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | public function actionAnswerlist() |
247 | 247 | { |
248 | 248 | // set current page and offset |
249 | - $page = (int)$this->request->query->get('page'); |
|
249 | + $page = (int) $this->request->query->get('page'); |
|
250 | 250 | $offset = $page * self::ITEM_PER_PAGE; |
251 | 251 | |
252 | 252 | // initialize ar answers model |