@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace mdm\admin; |
| 4 | 4 | |
| 5 | -if(!class_exists('yii\base\BaseObject')){ |
|
| 5 | +if (!class_exists('yii\base\BaseObject')) { |
|
| 6 | 6 | class_alias('yii\base\Object', 'yii\base\BaseObject'); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | $user = $this->getUser(); |
| 70 | 70 | |
| 71 | 71 | $request = Yii::$app->getRequest(); |
| 72 | - if($request->getIsPost()){ |
|
| 72 | + if ($request->getIsPost()) { |
|
| 73 | 73 | $params = $request->post(); |
| 74 | - }else{ |
|
| 74 | + } else { |
|
| 75 | 75 | $params = $request->get(); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if (Helper::checkRoute('/' . $actionId, $params, $user)) { |
|
| 78 | + if (Helper::checkRoute('/'.$actionId, $params, $user)) { |
|
| 79 | 79 | return true; |
| 80 | 80 | } |
| 81 | 81 | $this->denyAccess($user); |
@@ -108,15 +108,15 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $user = $this->getUser(); |
| 111 | - if($user->getIsGuest()) |
|
| 111 | + if ($user->getIsGuest()) |
|
| 112 | 112 | { |
| 113 | 113 | $loginUrl = null; |
| 114 | - if(is_array($user->loginUrl) && isset($user->loginUrl[0])){ |
|
| 114 | + if (is_array($user->loginUrl) && isset($user->loginUrl[0])) { |
|
| 115 | 115 | $loginUrl = $user->loginUrl[0]; |
| 116 | - }else if(is_string($user->loginUrl)){ |
|
| 116 | + } else if (is_string($user->loginUrl)) { |
|
| 117 | 117 | $loginUrl = $user->loginUrl; |
| 118 | 118 | } |
| 119 | - if(!is_null($loginUrl) && trim($loginUrl,'/') === $uniqueId) |
|
| 119 | + if (!is_null($loginUrl) && trim($loginUrl, '/') === $uniqueId) |
|
| 120 | 120 | { |
| 121 | 121 | return false; |
| 122 | 122 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | // convert action uniqueId into an ID relative to the module |
| 127 | 127 | $mid = $this->owner->getUniqueId(); |
| 128 | 128 | $id = $uniqueId; |
| 129 | - if ($mid !== '' && strpos($id, $mid . '/') === 0) { |
|
| 129 | + if ($mid !== '' && strpos($id, $mid.'/') === 0) { |
|
| 130 | 130 | $id = substr($id, strlen($mid) + 1); |
| 131 | 131 | } |
| 132 | 132 | } else { |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | public function getUser() |
| 72 | 72 | { |
| 73 | 73 | if ($this->_user === false) { |
| 74 | - $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User'; |
|
| 74 | + $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User'; |
|
| 75 | 75 | $this->_user = $class::findByUsername($this->username); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | } |
| 87 | 87 | $expire = ArrayHelper::getValue(Yii::$app->params, 'user.passwordResetTokenExpire', 24 * 3600); |
| 88 | 88 | $parts = explode('_', $token); |
| 89 | - $timestamp = (int) end($parts); |
|
| 89 | + $timestamp = (int)end($parts); |
|
| 90 | 90 | return $timestamp + $expire >= time(); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function rules() |
| 24 | 24 | { |
| 25 | - $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User'; |
|
| 25 | + $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User'; |
|
| 26 | 26 | return [ |
| 27 | 27 | ['username', 'filter', 'filter' => 'trim'], |
| 28 | 28 | ['username', 'required'], |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public function signup() |
| 51 | 51 | { |
| 52 | 52 | if ($this->validate()) { |
| 53 | - $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User'; |
|
| 53 | + $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User'; |
|
| 54 | 54 | $user = new $class(); |
| 55 | 55 | $user->username = $this->username; |
| 56 | 56 | $user->email = $this->email; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function rules() |
| 20 | 20 | { |
| 21 | - $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User'; |
|
| 21 | + $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User'; |
|
| 22 | 22 | return [ |
| 23 | 23 | ['email', 'filter', 'filter' => 'trim'], |
| 24 | 24 | ['email', 'required'], |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | public function sendEmail() |
| 40 | 40 | { |
| 41 | 41 | /* @var $user User */ |
| 42 | - $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User'; |
|
| 42 | + $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User'; |
|
| 43 | 43 | $user = $class::findOne([ |
| 44 | 44 | 'status' => UserStatus::ACTIVE, |
| 45 | 45 | 'email' => $this->email, |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | if ($user) { |
| 49 | 49 | if (!ResetPassword::isPasswordResetTokenValid($user->password_reset_token)) { |
| 50 | - $user->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); |
|
| 50 | + $user->password_reset_token = Yii::$app->security->generateRandomString().'_'.time(); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if ($user->save()) { |
| 54 | 54 | return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user]) |
| 55 | - ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot']) |
|
| 55 | + ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name.' robot']) |
|
| 56 | 56 | ->setTo($this->email) |
| 57 | - ->setSubject('Password reset for ' . Yii::$app->name) |
|
| 57 | + ->setSubject('Password reset for '.Yii::$app->name) |
|
| 58 | 58 | ->send(); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function rules() |
| 23 | 23 | { |
| 24 | 24 | return [ |
| 25 | - [['id', 'status',], 'integer'], |
|
| 25 | + [['id', 'status', ], 'integer'], |
|
| 26 | 26 | [['username', 'email'], 'safe'], |
| 27 | 27 | ]; |
| 28 | 28 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function search($params) |
| 38 | 38 | { |
| 39 | 39 | /* @var $query \yii\db\ActiveQuery */ |
| 40 | - $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User'; |
|
| 40 | + $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User'; |
|
| 41 | 41 | $query = $class::find(); |
| 42 | 42 | |
| 43 | 43 | $dataProvider = new ActiveDataProvider([ |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function getMenus() |
| 120 | 120 | { |
| 121 | 121 | if ($this->_normalizeMenus === null) { |
| 122 | - $mid = '/' . $this->getUniqueId() . '/'; |
|
| 122 | + $mid = '/'.$this->getUniqueId().'/'; |
|
| 123 | 123 | // resolve core menus |
| 124 | 124 | $this->_normalizeMenus = []; |
| 125 | 125 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | foreach ($this->_coreItems as $id => $lable) { |
| 134 | 134 | if (!isset($conditions[$id]) || $conditions[$id]) { |
| 135 | - $this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', $lable), 'url' => [$mid . $id]]; |
|
| 135 | + $this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', $lable), 'url' => [$mid.$id]]; |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $this->_normalizeMenus[$id] = isset($this->_normalizeMenus[$id]) ? array_merge($this->_normalizeMenus[$id], $value) |
| 149 | 149 | : $value; |
| 150 | 150 | if (!isset($this->_normalizeMenus[$id]['url'])) { |
| 151 | - $this->_normalizeMenus[$id]['url'] = [$mid . $id]; |
|
| 151 | + $this->_normalizeMenus[$id]['url'] = [$mid.$id]; |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $view->params['breadcrumbs'][] = [ |
| 178 | 178 | 'label' => ($this->defaultUrlLabel ?: Yii::t('rbac-admin', 'Admin')), |
| 179 | - 'url' => ['/' . ($this->defaultUrl ?: $this->uniqueId)], |
|
| 179 | + 'url' => ['/'.($this->defaultUrl ?: $this->uniqueId)], |
|
| 180 | 180 | ]; |
| 181 | 181 | return true; |
| 182 | 182 | } |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | <?php |
| 24 | 24 | foreach ($menus as $menu) { |
| 25 | 25 | $r = \mdm\admin\components\Helper::checkRoute($menu['url'][0]); |
| 26 | - if($r) { |
|
| 27 | - $label = Html::tag('i', '', ['class' => 'glyphicon glyphicon-chevron-right pull-right']) . |
|
| 26 | + if ($r) { |
|
| 27 | + $label = Html::tag('i', '', ['class' => 'glyphicon glyphicon-chevron-right pull-right']). |
|
| 28 | 28 | Html::tag('span', Html::encode($menu['label']), []); |
| 29 | 29 | $active = $menu['active'] ? ' active' : ''; |
| 30 | 30 | echo Html::a($label, $menu['url'], [ |
| 31 | - 'class' => 'list-group-item' . $active, |
|
| 31 | + 'class' => 'list-group-item'.$active, |
|
| 32 | 32 | ]); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | </div> |
| 42 | 42 | <?php |
| 43 | 43 | list(, $url) = Yii::$app->assetManager->publish('@mdm/admin/assets'); |
| 44 | -$this->registerCssFile($url . '/list-item.css'); |
|
| 44 | +$this->registerCssFile($url.'/list-item.css'); |
|
| 45 | 45 | ?> |
| 46 | 46 | |
| 47 | 47 | <?php $this->endContent(); ?> |