@@ -15,7 +15,6 @@ |
||
15 | 15 | use Ffcms\Core\Helper\Date; |
16 | 16 | use Ffcms\Core\Helper\Type\Obj; |
17 | 17 | use Ffcms\Core\Helper\Type\Str; |
18 | -use Ffcms\Core\Interfaces\iUser; |
|
19 | 18 | use Illuminate\Database\Capsule\Manager as Capsule; |
20 | 19 | use Ffcms\Core\Exception\NativeException; |
21 | 20 | use Ffcms\Core\Exception\ForbiddenException; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $answerTime = Date::convertToTimestamp($lastAnswer->created_at); |
160 | 160 | $cfgs = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
161 | 161 | // hmm, maybe past less then delay required? |
162 | - if ($now - (int)$cfgs['delayBetweenPost'] < $answerTime) { |
|
162 | + if ($now - (int) $cfgs['delayBetweenPost'] < $answerTime) { |
|
163 | 163 | throw new ForbiddenException('Delay between answers not pass'); |
164 | 164 | } |
165 | 165 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // add notification for target user |
175 | 175 | if ($viewer->id !== $target_id) { |
176 | 176 | $notify = new EntityAddNotification($target_id); |
177 | - $notify->add('/profile/show/' . $target_id . '#wall-post-' . $wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [ |
|
177 | + $notify->add('/profile/show/'.$target_id.'#wall-post-'.$wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [ |
|
178 | 178 | 'snippet' => Text::snippet($message, 50), |
179 | 179 | 'post' => $wallRow->message |
180 | 180 | ]); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $postInfo = $findAnswer->getWallPost(); |
219 | 219 | |
220 | 220 | // if not a target user of answer and not answer owner - lets throw exception |
221 | - if($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
221 | + if ($postInfo->target_id !== $viewer->id && $findAnswer->user_id !== $viewer->id) { |
|
222 | 222 | throw new ForbiddenException('Access declined!'); |
223 | 223 | } |
224 | 224 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // sender is not myself? then i'm - target (remote user is sender user->to_me) |
280 | 280 | if ($row->sender_id !== $user->id) { |
281 | 281 | $userList[] = $row->sender_id; |
282 | - if ((int)$row->tread === 0) { |
|
282 | + if ((int) $row->tread === 0) { |
|
283 | 283 | $unreadList[] = $row->sender_id; |
284 | 284 | } |
285 | 285 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | |
352 | 352 | // get special types for this action |
353 | 353 | $queryType = App::$Request->get('type'); |
354 | - $queryId = (int)App::$Request->get('id'); |
|
354 | + $queryId = (int) App::$Request->get('id'); |
|
355 | 355 | // get current user object |
356 | 356 | $user = App::$User->identity(); |
357 | 357 | |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | switch ($queryType) { |
368 | 368 | case 'after': |
369 | 369 | $messages = Message::where('id', '>', $queryId) |
370 | - ->where(function ($query) use ($cor_id, $user) { |
|
371 | - $query->where(function ($q) use ($cor_id, $user){ |
|
370 | + ->where(function($query) use ($cor_id, $user) { |
|
371 | + $query->where(function($q) use ($cor_id, $user){ |
|
372 | 372 | $q->where('target_id', '=', $user->getId()) |
373 | 373 | ->where('sender_id', '=', $cor_id); |
374 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
374 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
375 | 375 | $q->where('target_id', '=', $cor_id) |
376 | 376 | ->where('sender_id', '=', $user->getId()); |
377 | 377 | }); |
@@ -379,11 +379,11 @@ discard block |
||
379 | 379 | break; |
380 | 380 | case 'before': |
381 | 381 | $messages = Message::where('id', '<', $queryId) |
382 | - ->where(function ($query) use ($cor_id, $user) { |
|
383 | - $query->where(function ($q) use ($cor_id, $user){ |
|
382 | + ->where(function($query) use ($cor_id, $user) { |
|
383 | + $query->where(function($q) use ($cor_id, $user){ |
|
384 | 384 | $q->where('target_id', '=', $user->getId()) |
385 | 385 | ->where('sender_id', '=', $cor_id); |
386 | - })->orWhere(function ($q) use ($cor_id, $user){ |
|
386 | + })->orWhere(function($q) use ($cor_id, $user){ |
|
387 | 387 | $q->where('target_id', '=', $cor_id) |
388 | 388 | ->where('sender_id', '=', $user->getId()); |
389 | 389 | }); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $this->setJsonHeader(); |
492 | 492 | |
493 | 493 | // get operation type and target user id |
494 | - $target_id = (int)App::$Request->get('target'); |
|
494 | + $target_id = (int) App::$Request->get('target'); |
|
495 | 495 | $type = App::$Request->get('type'); |
496 | 496 | |
497 | 497 | // check type of query |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | |
507 | 507 | $cfg = \Apps\ActiveRecord\App::getConfigs('app', 'Profile'); |
508 | 508 | // check if rating is enabled for website |
509 | - if ((int)$cfg['rating'] !== 1) { |
|
509 | + if ((int) $cfg['rating'] !== 1) { |
|
510 | 510 | throw new NativeException('Rating is disabled'); |
511 | 511 | } |
512 | 512 |
@@ -1,6 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | use Ffcms\Core\Helper\Date; |
3 | -use Ffcms\Core\Helper\Text; |
|
4 | 3 | use Ffcms\Core\Helper\Url; |
5 | 4 | use Apps\Model\Api\Comments\EntityCommentData; |
6 | 5 |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | $records = null; |
52 | 52 | |
53 | 53 | // set current page and offset |
54 | - $page = (int)App::$Request->query->get('page', 0); |
|
54 | + $page = (int) App::$Request->query->get('page', 0); |
|
55 | 55 | $cfgs = Serialize::decode($this->application->configs); |
56 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
56 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
57 | 57 | if ($userPerPage < 1) { |
58 | 58 | $userPerPage = 1; |
59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | switch ($filter_name) { |
63 | 63 | case 'rating': // rating list, order by rating DESC |
64 | 64 | // check if rating is enabled |
65 | - if ((int)$cfgs['rating'] !== 1) { |
|
65 | + if ((int) $cfgs['rating'] !== 1) { |
|
66 | 66 | throw new NotFoundException(); |
67 | 67 | } |
68 | 68 | $records = (new ProfileRecords())->orderBy('rating', 'DESC'); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (Str::likeEmpty($filter_value)) { |
72 | 72 | throw new NotFoundException(); |
73 | 73 | } |
74 | - $records = (new ProfileRecords())->where('hobby', 'like', '%' . $filter_value . '%'); |
|
74 | + $records = (new ProfileRecords())->where('hobby', 'like', '%'.$filter_value.'%'); |
|
75 | 75 | break; |
76 | 76 | case 'city': |
77 | 77 | if (Str::likeEmpty($filter_value)) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if ($filter_value === null || !Obj::isLikeInt($filter_value)) { |
84 | 84 | throw new NotFoundException(); |
85 | 85 | } |
86 | - $records = (new ProfileRecords())->where('birthday', 'like', $filter_value . '-%'); |
|
86 | + $records = (new ProfileRecords())->where('birthday', 'like', $filter_value.'-%'); |
|
87 | 87 | break; |
88 | 88 | case 'all': |
89 | 89 | $records = (new ProfileRecords())->orderBy('id', 'DESC'); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'pagination' => $pagination, |
107 | 107 | 'id' => $filter_name, |
108 | 108 | 'add' => $filter_value, |
109 | - 'ratingOn' => (int)$cfgs['rating'] |
|
109 | + 'ratingOn' => (int) $cfgs['rating'] |
|
110 | 110 | ]); |
111 | 111 | } |
112 | 112 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public function actionShow($userId) |
123 | 123 | { |
124 | 124 | $cfg = Serialize::decode($this->application->configs); |
125 | - if ((int)$cfg['guestView'] !== 1 && !App::$User->isAuth()) { |
|
125 | + if ((int) $cfg['guestView'] !== 1 && !App::$User->isAuth()) { |
|
126 | 126 | throw new ForbiddenException(__('You must login to view other profile')); |
127 | 127 | } |
128 | 128 | // check if target exists |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | App::$Session->getFlashBag()->add('error', __('This user are in your black list or you are in blacklist!')); |
145 | 145 | } else { |
146 | 146 | // check if message added |
147 | - if ($wallModel->makePost($targetPersone, $viewerPersone, (int)$cfg['delayBetweenPost'])) { |
|
147 | + if ($wallModel->makePost($targetPersone, $viewerPersone, (int) $cfg['delayBetweenPost'])) { |
|
148 | 148 | App::$Session->getFlashBag()->add('success', __('The message was successful posted!')); |
149 | 149 | } else { |
150 | 150 | App::$Session->getFlashBag()->add('warning', __('Posting message was failed! Please, wait few seconds')); |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | |
156 | 156 | $query = $targetPersone->getWall(); // relation hasMany from users to walls |
157 | 157 | // pagination and query params |
158 | - $wallPage = (int)App::$Request->query->get('page'); |
|
159 | - $wallItems = (int)$cfg['wallPostOnPage']; |
|
158 | + $wallPage = (int) App::$Request->query->get('page'); |
|
159 | + $wallItems = (int) $cfg['wallPostOnPage']; |
|
160 | 160 | $wallOffset = $wallPage * $wallItems; |
161 | 161 | |
162 | 162 | // build pagination |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | 'notify' => App::$Session->getFlashBag()->all(), |
179 | 179 | 'wallRecords' => $wallRecords, |
180 | 180 | 'pagination' => $wallPagination, |
181 | - 'ratingOn' => (int)$cfg['rating'] === 1 |
|
181 | + 'ratingOn' => (int) $cfg['rating'] === 1 |
|
182 | 182 | ]); |
183 | 183 | } |
184 | 184 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $wallModel = new FormWallPostDelete($wallPost); |
251 | 251 | if ($wallModel->send() && $wallModel->validate()) { |
252 | 252 | $wallModel->make(); |
253 | - App::$Response->redirect('profile/show/' . $wallPost->target_id); |
|
253 | + App::$Response->redirect('profile/show/'.$wallPost->target_id); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | return App::$View->render('wall_delete', [ |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | // get page index and current user object |
285 | - $page = (int)App::$Request->query->get('page', 0); |
|
285 | + $page = (int) App::$Request->query->get('page', 0); |
|
286 | 286 | $offset = $page * static::NOTIFY_PER_PAGE; |
287 | 287 | $user = App::$User->identity(); |
288 | 288 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // set user id from ?id= get param if form not sended |
393 | 393 | if (!$model->send()) { |
394 | - $uid = (int)App::$Request->query->get('id'); |
|
394 | + $uid = (int) App::$Request->query->get('id'); |
|
395 | 395 | if ($uid > 0) { |
396 | 396 | $model->id = $uid; |
397 | 397 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | // get blocked users |
410 | 410 | $records = Blacklist::where('user_id', '=', $user->getId()); |
411 | 411 | |
412 | - $page = (int)App::$Request->query->get('page'); |
|
412 | + $page = (int) App::$Request->query->get('page'); |
|
413 | 413 | $offset = $page * self::BLOCK_PER_PAGE; |
414 | 414 | |
415 | 415 | // build pagination |
@@ -514,9 +514,9 @@ discard block |
||
514 | 514 | // check if request is sended |
515 | 515 | if ($model->send() && $model->validate()) { |
516 | 516 | // get records from db |
517 | - $records = ProfileRecords::where('nick', 'like', '%' . $model->query . '%'); |
|
518 | - $page = (int)App::$Request->query->get('page'); |
|
519 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
517 | + $records = ProfileRecords::where('nick', 'like', '%'.$model->query.'%'); |
|
518 | + $page = (int) App::$Request->query->get('page'); |
|
519 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
520 | 520 | if ($userPerPage < 1) { |
521 | 521 | $userPerPage = 1; |
522 | 522 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | 'model' => $model->filter(), |
539 | 539 | 'records' => $records, |
540 | 540 | 'pagination' => $pagination, |
541 | - 'ratingOn' => (int)$cfgs['rating'] |
|
541 | + 'ratingOn' => (int) $cfgs['rating'] |
|
542 | 542 | ]); |
543 | 543 | } |
544 | 544 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | // build sitemap from content items via business model |
563 | 563 | $sitemap = new EntityBuildMap($langs); |
564 | 564 | foreach ($profiles->get() as $user) { |
565 | - $sitemap->add('profile/show/' . $user->user_id, $user->updated_at, 'weekly', 0.2); |
|
565 | + $sitemap->add('profile/show/'.$user->user_id, $user->updated_at, 'weekly', 0.2); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | $sitemap->save('profile'); |
@@ -2,11 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Apps\Model\Front\Profile; |
4 | 4 | |
5 | -use Apps\ActiveRecord\Blacklist; |
|
6 | 5 | use Apps\ActiveRecord\WallPost as WallRecords; |
7 | 6 | use Ffcms\Core\App; |
8 | 7 | use Ffcms\Core\Helper\Text; |
9 | -use Ffcms\Core\Helper\Url; |
|
10 | 8 | use Ffcms\Core\Interfaces\iUser; |
11 | 9 | use Ffcms\Core\Arch\Model; |
12 | 10 | use Ffcms\Core\Helper\Date; |
@@ -62,7 +62,7 @@ |
||
62 | 62 | // add user notification |
63 | 63 | if ($target->id !== $viewer->id) { |
64 | 64 | $notify = new EntityAddNotification($target->id); |
65 | - $notify->add('profile/show/' . $target->id . '#wall-post-' . $record->id, EntityAddNotification::MSG_ADD_WALLPOST, ['snippet' => Text::snippet($this->message, 50)]); |
|
65 | + $notify->add('profile/show/'.$target->id.'#wall-post-'.$record->id, EntityAddNotification::MSG_ADD_WALLPOST, ['snippet' => Text::snippet($this->message, 50)]); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // cleanup message |
@@ -15,19 +15,19 @@ |
||
15 | 15 | <h1><?= __('Sitemap') ?></h1> |
16 | 16 | <hr /> |
17 | 17 | <p><?= __('Sitemap its a special application to generate sitemap as xml file over sitemap standart for search engines.') ?></p> |
18 | -<p><?= __('Sitemap main index') ?>: <a href="<?= \App::$Alias->scriptUrl . '/sitemap' ?>" target="_blank">/sitemap</a></p> |
|
18 | +<p><?= __('Sitemap main index') ?>: <a href="<?= \App::$Alias->scriptUrl.'/sitemap' ?>" target="_blank">/sitemap</a></p> |
|
19 | 19 | <h3><?= __('Sitemap files') ?></h3> |
20 | 20 | <?php |
21 | 21 | $items = []; |
22 | 22 | if ($model->files === null || count($model->files) < 1) { |
23 | - echo '<p class="alert alert-warning">' . __('No sitemap files found! Maybe cron manager is not configured') . '</p>'; |
|
23 | + echo '<p class="alert alert-warning">'.__('No sitemap files found! Maybe cron manager is not configured').'</p>'; |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | -foreach($model->files as $file) { |
|
27 | +foreach ($model->files as $file) { |
|
28 | 28 | $items[] = [ |
29 | 29 | 'type' => 'link', |
30 | - 'link' => \App::$Alias->scriptUrl . $file, |
|
30 | + 'link' => \App::$Alias->scriptUrl.$file, |
|
31 | 31 | 'text' => $file, |
32 | 32 | 'linkProperty' => ['target' => '_blank'] |
33 | 33 | ]; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | <hr /> |
18 | 18 | <?php |
19 | 19 | if ($model->items === null || count($model->items) < 1) { |
20 | - echo '<p class="alert alert-warning">' . __('No notifications available') . '</p>'; |
|
20 | + echo '<p class="alert alert-warning">'.__('No notifications available').'</p>'; |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | ?> |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | public function check() |
50 | 50 | { |
51 | 51 | // check if user is auth'd or guest name is defined |
52 | - if (!App::$User->isAuth() && ((int)$this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { |
|
52 | + if (!App::$User->isAuth() && ((int) $this->_configs['guestAdd'] !== 1 || Str::length($this->guestName) < 2)) { |
|
53 | 53 | throw new JsonException(__('Guest name is not defined')); |
54 | 54 | } |
55 | 55 | |
56 | 56 | // guest moderation |
57 | - if (!App::$User->isAuth() && (bool)$this->_configs['guestModerate']) { |
|
57 | + if (!App::$User->isAuth() && (bool) $this->_configs['guestModerate']) { |
|
58 | 58 | $captcha = App::$Request->request->get('captcha'); |
59 | 59 | if (!App::$Captcha->validate($captcha)) { |
60 | 60 | throw new JsonException(__('Captcha is incorrect! Click on image to refresh and try again')); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // check if message length is correct |
70 | - if (Str::length($this->message) < (int)$this->_configs['minLength'] || Str::length($this->message) > (int)$this->_configs['maxLength']) { |
|
70 | + if (Str::length($this->message) < (int) $this->_configs['minLength'] || Str::length($this->message) > (int) $this->_configs['maxLength']) { |
|
71 | 71 | throw new JsonException(__('Message length is incorrect. Current: %cur%, min - %min%, max - %max%', [ |
72 | 72 | 'cur' => Str::length($this->message), |
73 | 73 | 'min' => $this->_configs['minLength'], |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | $record->lang = App::$Request->getLanguage(); |
113 | 113 | $record->ip = $this->ip; |
114 | 114 | // check if premoderation is enabled and user is guest |
115 | - if ((bool)$this->_configs['guestModerate'] && $this->_userId < 1) { |
|
115 | + if ((bool) $this->_configs['guestModerate'] && $this->_userId < 1) { |
|
116 | 116 | $record->moderate = 1; |
117 | 117 | } |
118 | 118 | $record->save(); |
119 | 119 | |
120 | 120 | // add notification for comment post owner |
121 | 121 | $commentPost = $record->getCommentPost(); |
122 | - if ($commentPost !== null && (int)$commentPost->user_id !== 0 && (int)$commentPost->user_id !== $this->_userId) { |
|
123 | - $notify = new EntityAddNotification((int)$commentPost->user_id); |
|
122 | + if ($commentPost !== null && (int) $commentPost->user_id !== 0 && (int) $commentPost->user_id !== $this->_userId) { |
|
123 | + $notify = new EntityAddNotification((int) $commentPost->user_id); |
|
124 | 124 | $notify->add($commentPost->pathway, EntityAddNotification::MSG_ADD_COMMENTANSWER, [ |
125 | 125 | 'snippet' => Text::snippet(App::$Security->strip_tags($this->message), 50), |
126 | 126 | 'post' => Text::snippet(App::$Security->strip_tags($commentPost->message), 50) |
@@ -16,7 +16,7 @@ |
||
16 | 16 | const MSG_DEFAULT = 'New notification event: «%snippet%»'; |
17 | 17 | const MSG_ADD_WALLPOST = 'New post on the wall: «%snippet%»'; |
18 | 18 | const MSG_ADD_WALLANSWER = 'New answer «%snippet%» for wall post «%post%»'; |
19 | - const MSG_ADD_COMMENTANSWER ='New answer «%snippet%» to your comment «%post%»'; |
|
19 | + const MSG_ADD_COMMENTANSWER = 'New answer «%snippet%» to your comment «%post%»'; |
|
20 | 20 | |
21 | 21 | private $_targetId; |
22 | 22 |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | $scan = File::listFiles(static::INDEX_PATH, ['.xml'], true); |
48 | 48 | if (Obj::isArray($scan)) { |
49 | 49 | foreach ($scan as $file) { |
50 | - if ($this->_lang !== null && !Str::contains('.' . $this->_lang, $file)) { |
|
50 | + if ($this->_lang !== null && !Str::contains('.'.$this->_lang, $file)) { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | - $this->files[] = static::INDEX_PATH . '/' . $file; |
|
53 | + $this->files[] = static::INDEX_PATH.'/'.$file; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // build file information data |
68 | 68 | foreach ($this->files as $file) { |
69 | 69 | $this->info[] = [ |
70 | - 'loc' => App::$Alias->scriptUrl . $file, |
|
70 | + 'loc' => App::$Alias->scriptUrl.$file, |
|
71 | 71 | 'lastmod' => Date::convertToDatetime(File::mTime($file), 'c') |
72 | 72 | ]; |
73 | 73 | } |