@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | /** |
| 161 | 161 | * Get user person like a object via email |
| 162 | 162 | * @param string $email |
| 163 | - * @return null|static |
|
| 163 | + * @return null|ActiveModel |
|
| 164 | 164 | */ |
| 165 | 165 | public static function getIdentityViaEmail($email) |
| 166 | 166 | { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | /** |
| 211 | 211 | * Get user logs |
| 212 | - * @return \Apps\ActiveRecord\UserLog |
|
| 212 | + * @return \Illuminate\Database\Eloquent\Relations\HasMany |
|
| 213 | 213 | */ |
| 214 | 214 | public function getLogs() |
| 215 | 215 | { |
@@ -35,15 +35,15 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // convert id to real integer |
| 38 | - $user_id = (int)$user_id; |
|
| 38 | + $user_id = (int) $user_id; |
|
| 39 | 39 | |
| 40 | 40 | if (!Obj::isInt($user_id) || $user_id < 1) { |
| 41 | 41 | return null; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // check in memory cache object |
| 45 | - if (MainApp::$Memory->get('user.object.cache.' . $user_id) !== null) { |
|
| 46 | - return MainApp::$Memory->get('user.object.cache.' . $user_id); |
|
| 45 | + if (MainApp::$Memory->get('user.object.cache.'.$user_id) !== null) { |
|
| 46 | + return MainApp::$Memory->get('user.object.cache.'.$user_id); |
|
| 47 | 47 | } |
| 48 | 48 | // not founded in memory? lets make query |
| 49 | 49 | $user = self::find($user_id); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // store cache and return object |
| 56 | - MainApp::$Memory->set('user.object.cache.' . $user->id, $user); |
|
| 56 | + MainApp::$Memory->set('user.object.cache.'.$user->id, $user); |
|
| 57 | 57 | return $user; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function getId() |
| 65 | 65 | { |
| 66 | - return (int)$this->id; |
|
| 66 | + return (int) $this->id; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public static function isAuth() |
| 85 | 85 | { |
| 86 | 86 | // get data from session |
| 87 | - $sessionUserId = (int)MainApp::$Session->get('ff_user_id', 0); |
|
| 87 | + $sessionUserId = (int) MainApp::$Session->get('ff_user_id', 0); |
|
| 88 | 88 | |
| 89 | 89 | // check if session contains user id data |
| 90 | 90 | if ($sessionUserId < 1) { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | return false; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - return ((int)$identity->id > 0 && (int)$identity->id === $sessionUserId); |
|
| 106 | + return ((int) $identity->id > 0 && (int) $identity->id === $sessionUserId); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -118,12 +118,12 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // convert id to real integer |
| 121 | - $id = (int)$id; |
|
| 121 | + $id = (int) $id; |
|
| 122 | 122 | |
| 123 | - $find = MainApp::$Memory->get('user.counter.cache.' . $id); |
|
| 123 | + $find = MainApp::$Memory->get('user.counter.cache.'.$id); |
|
| 124 | 124 | if ($find === null) { |
| 125 | 125 | $find = self::where('id', '=', $id)->count(); |
| 126 | - MainApp::$Memory->set('user.counter.cache.' . $id, $find); |
|
| 126 | + MainApp::$Memory->set('user.counter.cache.'.$id, $find); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return $find === 1; |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Ffcms\Core\Exception\NotFoundException; |
| 15 | 15 | use Ffcms\Core\Helper\Type\Obj; |
| 16 | 16 | use Ffcms\Core\Helper\Type\Str; |
| 17 | -use Apps\ActiveRecord\UserLog; |
|
| 18 | 17 | |
| 19 | 18 | /** |
| 20 | 19 | * Class User - standard user controller: login/signup/logout/etc |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | App::$Session->getFlashBag()->add('error', __('User is never exist or password is incorrect!')); |
| 55 | 55 | // initialize fail event |
| 56 | 56 | App::$Event->run(static::EVENT_USER_LOGIN_FAIL, [ |
| 57 | - 'model' => $loginForm |
|
| 57 | + 'model' => $loginForm |
|
| 58 | 58 | ]); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | if ($registerForm->tryRegister($configs['registrationType'] === 1)) { |
| 115 | 115 | // initialize succes signup event |
| 116 | 116 | App::$Event->run(static::EVENT_USER_REGISTER_SUCCESS, [ |
| 117 | - 'model' => $registerForm |
|
| 117 | + 'model' => $registerForm |
|
| 118 | 118 | ]); |
| 119 | 119 | // send notification of successful registering |
| 120 | 120 | App::$Session->getFlashBag()->add('success', __('Your account is registered. You must confirm account via email')); |
| 121 | 121 | } else { |
| 122 | 122 | // init fail signup event |
| 123 | 123 | App::$Event->run(static::EVENT_USER_REGISTER_FAIL, [ |
| 124 | - 'model' => $registerForm |
|
| 124 | + 'model' => $registerForm |
|
| 125 | 125 | ]); |
| 126 | 126 | App::$Session->getFlashBag()->add('error', __('Login or email is always used on website')); |
| 127 | 127 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Make query to database |
| 81 | - * @return object |
|
| 81 | + * @return string |
|
| 82 | 82 | */ |
| 83 | 83 | private function makeQuery() |
| 84 | 84 | { |
@@ -10,18 +10,18 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class Contenttag extends AbstractWidget |
| 12 | 12 | { |
| 13 | - use OopTools; |
|
| 13 | + use OopTools; |
|
| 14 | 14 | |
| 15 | - public $count; |
|
| 16 | - public $cache; |
|
| 15 | + public $count; |
|
| 16 | + public $cache; |
|
| 17 | 17 | |
| 18 | - public $tpl = 'widgets/contenttag/default'; |
|
| 18 | + public $tpl = 'widgets/contenttag/default'; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Set default configurations if not defined |
|
| 22 | - * {@inheritDoc} |
|
| 23 | - * @see \Ffcms\Core\Arch\Widget::init() |
|
| 24 | - */ |
|
| 20 | + /** |
|
| 21 | + * Set default configurations if not defined |
|
| 22 | + * {@inheritDoc} |
|
| 23 | + * @see \Ffcms\Core\Arch\Widget::init() |
|
| 24 | + */ |
|
| 25 | 25 | public function init() |
| 26 | 26 | { |
| 27 | 27 | $cfg = $this->getConfigs(); |
@@ -43,29 +43,29 @@ discard block |
||
| 43 | 43 | public function display() |
| 44 | 44 | { |
| 45 | 45 | // get special properties hash |
| 46 | - $classHash = $this->createStringClassSnapshotHash(); |
|
| 46 | + $classHash = $this->createStringClassSnapshotHash(); |
|
| 47 | 47 | |
| 48 | - // get records rows from cache or directly from db |
|
| 49 | - $records = null; |
|
| 50 | - if ($this->cache === 0) { |
|
| 51 | - $records = $this->makeQuery(); |
|
| 52 | - } else { |
|
| 53 | - $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
| 54 | - if ($records === null) { |
|
| 55 | - $records = $this->makeQuery(); |
|
| 56 | - App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
| 57 | - } |
|
| 58 | - } |
|
| 48 | + // get records rows from cache or directly from db |
|
| 49 | + $records = null; |
|
| 50 | + if ($this->cache === 0) { |
|
| 51 | + $records = $this->makeQuery(); |
|
| 52 | + } else { |
|
| 53 | + $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
| 54 | + if ($records === null) { |
|
| 55 | + $records = $this->makeQuery(); |
|
| 56 | + App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - // check if result is not empty |
|
| 60 | + // check if result is not empty |
|
| 61 | 61 | if ($records === null || $records->count() < 1) { |
| 62 | 62 | return __('Content tags is not found'); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // render view |
| 66 | - return App::$View->render($this->tpl, [ |
|
| 67 | - 'records' => $records |
|
| 68 | - ]); |
|
| 66 | + return App::$View->render($this->tpl, [ |
|
| 67 | + 'records' => $records |
|
| 68 | + ]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | private function makeQuery() |
| 76 | 76 | { |
| 77 | 77 | return TagRecord::select([ |
| 78 | - App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
| 79 | - App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
| 80 | - ])->groupBy('tag') |
|
| 81 | - ->orderBy('count', 'DESC') |
|
| 82 | - ->take($this->count) |
|
| 83 | - ->get(); |
|
| 78 | + App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
| 79 | + App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
| 80 | + ])->groupBy('tag') |
|
| 81 | + ->orderBy('count', 'DESC') |
|
| 82 | + ->take($this->count) |
|
| 83 | + ->get(); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |
@@ -5,28 +5,28 @@ |
||
| 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/ContentTag.php'); |
|
| 16 | -require_once(root . '/Private/Database/Tables/FeedbackAnswer.php'); |
|
| 17 | -require_once(root . '/Private/Database/Tables/FeedbackPost.php'); |
|
| 18 | -require_once(root . '/Private/Database/Tables/Invite.php'); |
|
| 19 | -require_once(root . '/Private/Database/Tables/Message.php'); |
|
| 20 | -require_once(root . '/Private/Database/Tables/Profile.php'); |
|
| 21 | -require_once(root . '/Private/Database/Tables/ProfileField.php'); |
|
| 22 | -require_once(root . '/Private/Database/Tables/ProfileRating.php'); |
|
| 23 | -require_once(root . '/Private/Database/Tables/Role.php'); |
|
| 24 | -require_once(root . '/Private/Database/Tables/Session.php'); |
|
| 25 | -require_once(root . '/Private/Database/Tables/User.php'); |
|
| 26 | -require_once(root . '/Private/Database/Tables/UserLog.php'); |
|
| 27 | -require_once(root . '/Private/Database/Tables/UserRecovery.php'); |
|
| 28 | -require_once(root . '/Private/Database/Tables/WallPost.php'); |
|
| 29 | -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/ContentTag.php'); |
|
| 16 | +require_once(root.'/Private/Database/Tables/FeedbackAnswer.php'); |
|
| 17 | +require_once(root.'/Private/Database/Tables/FeedbackPost.php'); |
|
| 18 | +require_once(root.'/Private/Database/Tables/Invite.php'); |
|
| 19 | +require_once(root.'/Private/Database/Tables/Message.php'); |
|
| 20 | +require_once(root.'/Private/Database/Tables/Profile.php'); |
|
| 21 | +require_once(root.'/Private/Database/Tables/ProfileField.php'); |
|
| 22 | +require_once(root.'/Private/Database/Tables/ProfileRating.php'); |
|
| 23 | +require_once(root.'/Private/Database/Tables/Role.php'); |
|
| 24 | +require_once(root.'/Private/Database/Tables/Session.php'); |
|
| 25 | +require_once(root.'/Private/Database/Tables/User.php'); |
|
| 26 | +require_once(root.'/Private/Database/Tables/UserLog.php'); |
|
| 27 | +require_once(root.'/Private/Database/Tables/UserRecovery.php'); |
|
| 28 | +require_once(root.'/Private/Database/Tables/WallPost.php'); |
|
| 29 | +require_once(root.'/Private/Database/Tables/WallAnswer.php'); |
|
| 30 | 30 | |
| 31 | 31 | // insert demo content |
| 32 | -require_once (root . '/Private/Database/Other/DemoContent.php'); |
|
| 33 | 32 | \ No newline at end of file |
| 33 | +require_once (root.'/Private/Database/Other/DemoContent.php'); |
|
| 34 | 34 | \ No newline at end of file |