diff --git a/.htaccess b/.htaccess index 95e7327..e0d7e7b 100644 --- a/.htaccess +++ b/.htaccess @@ -81,21 +81,21 @@ AddDefaultCharset utf-8 # кеширование в браузере на стороне пользователя -# -#ExpiresActive On -#ExpiresDefault "access 7 days" -#ExpiresByType application/javascript "access plus 1 year" -#ExpiresByType text/javascript "access plus 1 year" -#ExpiresByType text/css "access plus 1 year" -#ExpiresByType text/html "access plus 7 day" -#ExpiresByType text/x-javascript "access 1 year" -#ExpiresByType image/gif "access plus 1 year" -#ExpiresByType image/jpeg "access plus 1 year" -#ExpiresByType image/png "access plus 1 year" -#ExpiresByType image/jpg "access plus 1 year" -#ExpiresByType image/x-icon "access 1 year" -#ExpiresByType application/x-shockwave-flash "access 1 year" -# + +ExpiresActive On +ExpiresDefault "access 7 days" +ExpiresByType application/javascript "access plus 1 year" +ExpiresByType text/javascript "access plus 1 year" +ExpiresByType text/css "access plus 1 year" +ExpiresByType text/html "access plus 7 day" +ExpiresByType text/x-javascript "access 1 year" +ExpiresByType image/gif "access plus 1 year" +ExpiresByType image/jpeg "access plus 1 year" +ExpiresByType image/png "access plus 1 year" +ExpiresByType image/jpg "access plus 1 year" +ExpiresByType image/x-icon "access 1 year" +ExpiresByType application/x-shockwave-flash "access 1 year" + AddOutputFilterByType DEFLATE text/plain @@ -117,25 +117,25 @@ RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}.gz -f RewriteRule ^(.*)$ $1.gz [QSA,L] -## Cache-Control -# -## 30 дней -# -#Header set Cache-Control "max-age=2592000, public" -# -## 30 дней -# -#Header set Cache-Control "max-age=2592000, public" -# -## 2 дня -# -#Header set Cache-Control "max-age=172800, public, must-revalidate" -# -## 1 день -# -#Header set Cache-Control "max-age=172800, private, must-revalidate" -# -# +# Cache-Control + +# 30 дней + +Header set Cache-Control "max-age=2592000, public" + +# 30 дней + +Header set Cache-Control "max-age=2592000, public" + +# 2 дня + +Header set Cache-Control "max-age=172800, public, must-revalidate" + +# 1 день + +Header set Cache-Control "max-age=172800, private, must-revalidate" + + #Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE diff --git a/backend/controllers/UserController.php b/backend/controllers/UserController.php index 68d4c58..214a67b 100644 --- a/backend/controllers/UserController.php +++ b/backend/controllers/UserController.php @@ -114,16 +114,22 @@ class UserController extends Controller public function actionUpdate($id) { $model = $this->findModel($id); + if (Yii::$app->request->isAjax) { + Yii::$app->response->format = Response::FORMAT_JSON; + $model->load(Yii::$app->request->post()); + return ActiveForm::validate($model); + }else if ($model->load(Yii::$app->request->post()) && $model->validate()) { + $model->save(); - if ($model->load(Yii::$app->request->post()) && $model->save()) { - - $auth = Yii::$app->authManager; - $authorRole = $auth->getRole('author'); - $auth->assign($authorRole, $model->id); + foreach($model->role as $k => $role){ + $auth = Yii::$app->authManager; + $authorRole = $auth->getRole($role); + $auth->assign($authorRole, $model->id); + } return $this->redirect(['view', 'id' => $model->id]); } else { - return $this->render('update', [ + return $this->render('create', [ 'model' => $model, ]); } diff --git a/common/widgets/Mailer.php b/common/widgets/Mailer.php index 1c7abe5..aa61ff7 100755 --- a/common/widgets/Mailer.php +++ b/common/widgets/Mailer.php @@ -19,18 +19,18 @@ class Mailer extends Widget{ public function run(){ -// $mail = new \PHPMailer(); -// -// $mail->IsSMTP(); -// -// $mail->CharSet = 'UTF-8'; -// $mail->Username = "dockdep@gmail.com"; -// $mail->Password = "k0l0b04eg@"; -// $mail->SetFrom('dockdep@gmail.com'); -// $mail->Subject = $this->subject; -// $mail->MsgHTML('test'); -// $address = "dockdep@gmail.com"; -// $mail->AddAddress($address); + $mail = new \PHPMailer(); + + $mail->IsSMTP(); + + $mail->CharSet = 'UTF-8'; + $mail->Username = "dockdep@gmail.com"; + $mail->Password = "k0l0b04eg@"; + $mail->SetFrom('dockdep@gmail.com'); + $mail->Subject = $this->subject; + $mail->MsgHTML($this->render('test')); + $address = "dockdep@gmail.com"; + $mail->AddAddress($address); // $mail->AddAddress($this->email); // if(!$mail->send()) { // diff --git a/common/widgets/views/test.php b/common/widgets/views/test.php new file mode 100644 index 0000000..41e1cee --- /dev/null +++ b/common/widgets/views/test.php @@ -0,0 +1 @@ +

H1

\ No newline at end of file diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index dac6410..2d0d84f 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -28,22 +28,11 @@ class SiteController extends Controller public function actionIndex() { -// $catalogs = Catalog::find()->where(['parent_id'=>'0'])->all(); $modelText = Page::find()->where(['translit'=>'home'])->one(); -// $news = News::find()->orderBy('id DESC')->limit(4)->all(); -// $products_new = Products::find()->where(['new'=>'1'])->orderBy('id DESC')->innerJoinWith(['cost'])->groupBy('id')->limit(4)->all(); -// //print_r($products_new); -// $products_top = Products::find()->where(['top'=>'1'])->orderBy('id DESC')->innerJoinWith(['cost'])->groupBy('id')->limit(4)->all(); -// //print_r($products_top); -// //$products_sale = Products::find()->where(['sale'=>'1'])->innerJoinWith(['cost'])->orderBy('id DESC')->limit(4)->all(); -// $products_akciya = Products::find()->where(['akciya'=>'1'])->innerJoinWith(['cost'])->orderBy('id DESC')->limit(4)->all(); + return $this->render('index', [ 'text'=>$modelText, -// 'catalogs'=>$catalogs, -// 'news'=>$news, -// 'products_new'=>$products_new, -// 'products_top'=>$products_top, -// 'products_akciya'=>$products_akciya, + ]); } -- libgit2 0.21.4