@@ -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 |
@@ -32,8 +32,8 @@ |
||
32 | 32 | foreach ($records as $item) { |
33 | 33 | $message = Str::sub(\App::$Security->strip_tags($item->message), 0, 50); |
34 | 34 | $author = Simplify::parseUserNick($item->user_id, $item->guest_name); |
35 | - if ((int)$item->user_id > 0) { |
|
36 | - $author = Url::link(['user/update', (int)$item->user_id], $author); |
|
35 | + if ((int) $item->user_id > 0) { |
|
36 | + $author = Url::link(['user/update', (int) $item->user_id], $author); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | App::$Session->set('content.rate.ignore', $ignored); |
65 | 65 | |
66 | 66 | // save rating changes to database |
67 | - switch($this->_type) { |
|
67 | + switch ($this->_type) { |
|
68 | 68 | case 'plus': |
69 | 69 | $this->_content->rating += 1; |
70 | 70 | break; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->_content->save(); |
77 | 77 | |
78 | 78 | // update content author rating |
79 | - $authorId = (int)$this->_content->author_id; |
|
79 | + $authorId = (int) $this->_content->author_id; |
|
80 | 80 | if ($authorId > 0 && App::$User->isExist($authorId)) { |
81 | 81 | $authorObject = App::$User->identity($authorId); |
82 | 82 | if ($authorObject !== null) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $this->setJsonHeader(); |
33 | 33 | $configs = AppRecord::getConfigs('widget', 'Comments'); |
34 | 34 | |
35 | - $replayTo = (int)App::$Request->request->get('replay-to'); |
|
35 | + $replayTo = (int) App::$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)App::$Request->request->get('message')); |
|
47 | + $model->message = App::$Security->secureHtml((string) App::$Request->request->get('message')); |
|
48 | 48 | $model->guestName = App::$Security->strip_tags(App::$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)App::$Request->query->get('path'); |
|
84 | + $path = (string) App::$Request->query->get('path'); |
|
85 | 85 | if (Str::likeEmpty($path)) { |
86 | 86 | throw new NotFoundException('Wrong path'); |
87 | 87 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $query = CommentPost::where('pathway', '=', $path); |
91 | 91 | |
92 | 92 | // check if comments is depend of language locale |
93 | - if ((int)$configs['onlyLocale'] === 1) { |
|
93 | + if ((int) $configs['onlyLocale'] === 1) { |
|
94 | 94 | $query = $query->where('lang', '=', App::$Request->getLanguage()); |
95 | 95 | } |
96 | 96 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $this->setJsonHeader(); |
142 | 142 | // check input data |
143 | - if (!Obj::isLikeInt($commentId) || (int)$commentId < 1) { |
|
143 | + if (!Obj::isLikeInt($commentId) || (int) $commentId < 1) { |
|
144 | 144 | throw new ForbiddenException('Input data is incorrect'); |
145 | 145 | } |
146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // get data from db by comment id |
151 | 151 | $records = CommentAnswer::where('comment_id', '=', $commentId); |
152 | - if ((int)$configs['onlyLocale'] === 1) { |
|
152 | + if ((int) $configs['onlyLocale'] === 1) { |
|
153 | 153 | $records = $records->where('lang', '=', App::$Request->getLanguage()); |
154 | 154 | } |
155 | 155 | |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | foreach ($path as $id => $uri) { |
194 | 194 | $query = CommentPost::where('pathway', '=', $uri); |
195 | 195 | // check if comments is depend of language locale |
196 | - if ((int)$configs['onlyLocale'] === 1) { |
|
196 | + if ((int) $configs['onlyLocale'] === 1) { |
|
197 | 197 | $query = $query->where('lang', '=', App::$Request->getLanguage()); |
198 | 198 | } |
199 | 199 | // set itemId => count |
200 | - $count[(int)$id] = $query->count(); |
|
200 | + $count[(int) $id] = $query->count(); |
|
201 | 201 | } |
202 | 202 | // render json response |
203 | 203 | return json_encode(['status' => 1, 'count' => $count]); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | public function before() |
31 | 31 | { |
32 | 32 | $this->categories = Serialize::decode($this->_configs['categories']); |
33 | - $this->count = (int)$this->_configs['count']; |
|
34 | - $this->cache = (int)$this->_configs['cache']; |
|
33 | + $this->count = (int) $this->_configs['count']; |
|
34 | + $this->cache = (int) $this->_configs['cache']; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | public function getResult() |
65 | 65 | { |
66 | 66 | return [ |
67 | - 'count' => (int)$this->count, |
|
68 | - 'cache' => (int)$this->cache, |
|
67 | + 'count' => (int) $this->count, |
|
68 | + 'cache' => (int) $this->cache, |
|
69 | 69 | 'categories' => Serialize::encode($this->categories) |
70 | 70 | ]; |
71 | 71 | } |
@@ -5,27 +5,27 @@ |
||
5 | 5 | } |
6 | 6 | |
7 | 7 | // require all tables |
8 | -require_once(root . '/Private/Database/Tables/App.php'); |
|
9 | -require_once(root . '/Private/Database/Tables/Blacklist.php'); |
|
10 | -require_once(root . '/Private/Database/Tables/CommentAnswer.php'); |
|
11 | -require_once(root . '/Private/Database/Tables/CommentPost.php'); |
|
12 | -require_once(root . '/Private/Database/Tables/Content.php'); |
|
13 | -require_once(root . '/Private/Database/Tables/ContentCategory.php'); |
|
14 | -require_once(root . '/Private/Database/Tables/ContentRating.php'); |
|
15 | -require_once(root . '/Private/Database/Tables/FeedbackAnswer.php'); |
|
16 | -require_once(root . '/Private/Database/Tables/FeedbackPost.php'); |
|
17 | -require_once(root . '/Private/Database/Tables/Invite.php'); |
|
18 | -require_once(root . '/Private/Database/Tables/Message.php'); |
|
19 | -require_once(root . '/Private/Database/Tables/Profile.php'); |
|
20 | -require_once(root . '/Private/Database/Tables/ProfileField.php'); |
|
21 | -require_once(root . '/Private/Database/Tables/ProfileRating.php'); |
|
22 | -require_once(root . '/Private/Database/Tables/Role.php'); |
|
23 | -require_once(root . '/Private/Database/Tables/Session.php'); |
|
24 | -require_once(root . '/Private/Database/Tables/StaticContent.php'); |
|
25 | -require_once(root . '/Private/Database/Tables/User.php'); |
|
26 | -require_once(root . '/Private/Database/Tables/UserRecovery.php'); |
|
27 | -require_once(root . '/Private/Database/Tables/WallPost.php'); |
|
28 | -require_once(root . '/Private/Database/Tables/WallAnswer.php'); |
|
8 | +require_once(root.'/Private/Database/Tables/App.php'); |
|
9 | +require_once(root.'/Private/Database/Tables/Blacklist.php'); |
|
10 | +require_once(root.'/Private/Database/Tables/CommentAnswer.php'); |
|
11 | +require_once(root.'/Private/Database/Tables/CommentPost.php'); |
|
12 | +require_once(root.'/Private/Database/Tables/Content.php'); |
|
13 | +require_once(root.'/Private/Database/Tables/ContentCategory.php'); |
|
14 | +require_once(root.'/Private/Database/Tables/ContentRating.php'); |
|
15 | +require_once(root.'/Private/Database/Tables/FeedbackAnswer.php'); |
|
16 | +require_once(root.'/Private/Database/Tables/FeedbackPost.php'); |
|
17 | +require_once(root.'/Private/Database/Tables/Invite.php'); |
|
18 | +require_once(root.'/Private/Database/Tables/Message.php'); |
|
19 | +require_once(root.'/Private/Database/Tables/Profile.php'); |
|
20 | +require_once(root.'/Private/Database/Tables/ProfileField.php'); |
|
21 | +require_once(root.'/Private/Database/Tables/ProfileRating.php'); |
|
22 | +require_once(root.'/Private/Database/Tables/Role.php'); |
|
23 | +require_once(root.'/Private/Database/Tables/Session.php'); |
|
24 | +require_once(root.'/Private/Database/Tables/StaticContent.php'); |
|
25 | +require_once(root.'/Private/Database/Tables/User.php'); |
|
26 | +require_once(root.'/Private/Database/Tables/UserRecovery.php'); |
|
27 | +require_once(root.'/Private/Database/Tables/WallPost.php'); |
|
28 | +require_once(root.'/Private/Database/Tables/WallAnswer.php'); |
|
29 | 29 | |
30 | 30 | // insert demo content |
31 | -require_once (root . '/Private/Database/Other/DemoContent.php'); |
|
32 | 31 | \ No newline at end of file |
32 | +require_once (root.'/Private/Database/Other/DemoContent.php'); |
|
33 | 33 | \ No newline at end of file |
@@ -46,7 +46,7 @@ |
||
46 | 46 | ]); |
47 | 47 | |
48 | 48 | $configs->newcontent = serialize([ |
49 | - 'categories' => serialize(['2','3']), |
|
49 | + 'categories' => serialize(['2', '3']), |
|
50 | 50 | 'count' => '5', |
51 | 51 | 'cache' => '60' |
52 | 52 | ]); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | date_default_timezone_set('Europe/Moscow'); |
12 | 12 | |
13 | 13 | return [ |
14 | - 'Database' => function () { |
|
14 | + 'Database' => function() { |
|
15 | 15 | $capsule = new Capsule; |
16 | 16 | if (env_name !== 'Install') { |
17 | 17 | try { |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | try { |
35 | 35 | $pdo = \App::$Database->connection()->getPdo(); |
36 | 36 | $handler = new PdoSessionHandler($pdo, [ |
37 | - 'db_table' => App::$Properties->get('database')['prefix'] . 'sessions' |
|
37 | + 'db_table' => App::$Properties->get('database')['prefix'].'sessions' |
|
38 | 38 | ]); |
39 | 39 | } catch (Exception $e) { |
40 | - $handler = new NativeFileSessionHandler(root . '/Private/Sessions'); |
|
40 | + $handler = new NativeFileSessionHandler(root.'/Private/Sessions'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $storage = new NativeSessionStorage([ |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | |
49 | 49 | return new Session($storage); |
50 | 50 | }, |
51 | - 'User' => function () { |
|
51 | + 'User' => function() { |
|
52 | 52 | return new Apps\ActiveRecord\User(); |
53 | 53 | }, |
54 | - 'Mailer' => function () { |
|
54 | + 'Mailer' => function() { |
|
55 | 55 | $swiftTransport = Swift_MailTransport::newInstance(); |
56 | 56 | return Swift_Mailer::newInstance($swiftTransport); |
57 | 57 | }, |
58 | - 'Captcha' => function () { |
|
58 | + 'Captcha' => function() { |
|
59 | 59 | return new Extend\Core\Captcha\Gregwar(); |
60 | 60 | }, |
61 | - 'Cache' => function () { |
|
62 | - phpFastCache::setup('path', root . '/Private/Cache'); |
|
61 | + 'Cache' => function() { |
|
62 | + phpFastCache::setup('path', root.'/Private/Cache'); |
|
63 | 63 | return \phpFastCache(); |
64 | 64 | } |
65 | 65 | ]; |
66 | 66 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | <?php |
26 | 26 | $items = []; |
27 | -foreach($records as $role) { |
|
27 | +foreach ($records as $role) { |
|
28 | 28 | $permissions = explode(';', $role->permissions); |
29 | 29 | $permissionsLabel = null; |
30 | 30 | foreach ($permissions as $perm) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } else { |
37 | 37 | $labelMark = 'label-default'; |
38 | 38 | } |
39 | - $permissionsLabel .= '<span class="label ' . $labelMark . '">' . $perm . '</span> '; |
|
39 | + $permissionsLabel .= '<span class="label '.$labelMark.'">'.$perm.'</span> '; |
|
40 | 40 | } |
41 | 41 | $items[] = [ |
42 | 42 | ['text' => $role->id], |