#1467: Редирект 301

parent f0fbe93b
...@@ -86,7 +86,7 @@ class PostAdminController extends AdminController ...@@ -86,7 +86,7 @@ class PostAdminController extends AdminController
*/ */
public function actionCreate() public function actionCreate()
{ {
$model = new Post(); $model = new Post('manual');
if (Yii::$app->request->isPost) if (Yii::$app->request->isPost)
{ {
...@@ -124,6 +124,7 @@ class PostAdminController extends AdminController ...@@ -124,6 +124,7 @@ class PostAdminController extends AdminController
public function actionUpdate($id) public function actionUpdate($id)
{ {
$model = $this->findModel($id); $model = $this->findModel($id);
$model->setScenario('manual');
if (Yii::$app->request->isPost) if (Yii::$app->request->isPost)
{ {
...@@ -162,7 +163,7 @@ class PostAdminController extends AdminController ...@@ -162,7 +163,7 @@ class PostAdminController extends AdminController
{ {
$this->findModel($id)->delete(); $this->findModel($id)->delete();
return $this->redirect(['index']); return $this->redirect(['manage']);
} }
public function actionAutocomplete($term) public function actionAutocomplete($term)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace common\modules\blog\controllers; namespace common\modules\blog\controllers;
use common\modules\blog\models\SearchPost; use common\modules\blog\models\SearchPost;
use common\modules\languages\models\Languages;
use Yii; use Yii;
use common\components\BaseController; use common\components\BaseController;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
...@@ -95,6 +96,11 @@ class PostController extends BaseController ...@@ -95,6 +96,11 @@ class PostController extends BaseController
throw new NotFoundHttpException('The requested page does not exist.'); throw new NotFoundHttpException('The requested page does not exist.');
} }
$language = Languages::getCurrent();
if($model->lang_id != $language->id) {
return $this->redirect(['/blog']);
}
$this->meta_title = Yii::t('app', 'Tag') . ': ' . $model->name; $this->meta_title = Yii::t('app', 'Tag') . ': ' . $model->name;
return $this->render('tag', [ return $this->render('tag', [
......
...@@ -16,6 +16,7 @@ use dosamigos\transliterator\TransliteratorHelper; ...@@ -16,6 +16,7 @@ use dosamigos\transliterator\TransliteratorHelper;
* *
* @property integer $id * @property integer $id
* @property string $name * @property string $name
* @property integer $lang_id
* @property integer $created_at * @property integer $created_at
* @property integer $updated_at * @property integer $updated_at
* *
...@@ -44,7 +45,7 @@ class PostTag extends \common\components\ActiveRecordModel ...@@ -44,7 +45,7 @@ class PostTag extends \common\components\ActiveRecordModel
{ {
return [ return [
[['name'], 'required'], [['name'], 'required'],
[['lang_id'], 'safe'], [['lang_id'], 'required', 'on' => 'manual'],
[['created_at', 'updated_at', 'lang_id'], 'integer'], [['created_at', 'updated_at', 'lang_id'], 'integer'],
[['name', 'translit'], 'string', 'max' => 255], [['name', 'translit'], 'string', 'max' => 255],
]; ];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment