public function actionGear()
    {
        if (!\Yii::$app->user->can('gear'))
            throw new ForbiddenHttpException(Module::t('core', 'Access denied.'));

        $model = new \sergmoro1\blog\models\GearForm();
        $error = false;
        if ($model->load(\Yii::$app->request->post())) {
            $syntax = new ParamsSyntaxChecker();
            if($syntax->check($model->params)) {
                // new name for archive params file
                $f = 'params_'. date('Ymd_Hi', time()) .'.php';
                // if frontend/runtime/params do not exists then make it
                if(!is_dir(($dir = \Yii::getAlias('@frontend/runtime/params'))))
                    mkdir($dir);
                // save just edited params to the temporary file
                file_put_contents(\Yii::getAlias('@frontend/runtime/params/params.php'), $model->params);
                // verify array by loading it
                if(($params = include(\Yii::getAlias('@frontend/runtime/params/params.php'))) && is_array($params)) {
                    // copy current params to runtime folder with a new name of file
                    copy(\Yii::getAlias('@frontend/config/params.php'), \Yii::getAlias('@frontend/runtime/params/' . $f));
                    // save changes to runtime/params.php
                    if(file_put_contents(\Yii::getAlias('@frontend/config/params.php'), $model->params))
                        return $this->goHome();
                    else
                        $error = 'Params file can\'t be saved.';
                } else {
                    $error = 'Params loading error.';
                }
            } else
                $error = Module::t('core', 'Wrong syntax') . ($syntax->error['line'] 
                    ? ' ' . Module::t('core', 'near line') . ': ' . $syntax->error['line'] . 
                        ' ('. Module::t('core', 'after') . ' <code>' . $syntax->error['prev'] . '</code> ' . 
                        (isset($syntax->error['must']) && $syntax->error['must'] 
                            ? Module::t('core', 'should be') 
                            : Module::t('core', 'should not be')
                        ) . ' <code>' . $syntax->error['token'] . '</code>)'
                    : ': ' . Module::t('core', 'unpaired brackets')
                ) . '.';
        } else {
            // load params
            $model->params = file_get_contents(\Yii::getAlias('@frontend/config/params.php'));
        }
        return $this->render('gear', [
            'model' => $model,
            'error' => $error,
        ]);
    }
public function actionGear()
    {
        if (!\Yii::$app->user->can('gear'))
            throw new ForbiddenHttpException(Module::t('core', 'Access denied.'));

        $model = new \sergmoro1\blog\models\GearForm();
        $error = false;
        if ($model->load(\Yii::$app->request->post())) {
            $syntax = new ParamsSyntaxChecker();
            if($syntax->check($model->params)) {
                // new name for archive params file
                $f = 'params_'. date('Ymd_Hi', time()) .'.php';
                // if frontend/runtime/params do not exists then make it
                if(!is_dir(($dir = \Yii::getAlias('@frontend/runtime/params'))))
                    mkdir($dir);
                // save just edited params to the temporary file
                file_put_contents(\Yii::getAlias('@frontend/runtime/params/params.php'), $model->params);
                // verify array by loading it
                if(($params = include(\Yii::getAlias('@frontend/runtime/params/params.php'))) && is_array($params)) {
                    // copy current params to runtime folder with a new name of file
                    copy(\Yii::getAlias('@frontend/config/params.php'), \Yii::getAlias('@frontend/runtime/params/' . $f));
                    // save changes to runtime/params.php
                    if(file_put_contents(\Yii::getAlias('@frontend/config/params.php'), $model->params))
                        return $this->goHome();
                    else
                        $error = 'Params file can\'t be saved.';
                } else {
                    $error = 'Params loading error.';
                }
            } else
                $error = Module::t('core', 'Wrong syntax') . ($syntax->error['line'] 
                    ? ' ' . Module::t('core', 'near line') . ': ' . $syntax->error['line'] . 
                        ' ('. Module::t('core', 'after') . ' <code>' . $syntax->error['prev'] . '</code> ' . 
                        (isset($syntax->error['must']) && $syntax->error['must'] 
                            ? Module::t('core', 'should be') 
                            : Module::t('core', 'should not be')
                        ) . ' <code>' . $syntax->error['token'] . '</code>)'
                    : ': ' . Module::t('core', 'unpaired brackets')
                ) . '.';
        } else {
            // load params
            $model->params = file_get_contents(\Yii::getAlias('@frontend/config/params.php'));
        }
        return $this->render('gear', [
            'model' => $model,
            'error' => $error,
        ]);
    }
public function actionGear ( ) { if ( ! \ Yii :: $ app -> user -> can ( 'gear' ) ) throw new ForbiddenHttpException ( Module :: t ( 'core' , 'Access denied.' ) ) ; $ model = new \ sergmoro1 \ blog \ models \ GearForm ( ) ; $ error = false ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) ) { $ syntax = new ParamsSyntaxChecker ( ) ; if ( $ syntax -> check ( $ model -> params ) ) { // new name for archive params file $ f = 'params_' . date ( 'Ymd_Hi' , time ( ) ) . '.php' ; // if frontend/runtime/params do not exists then make it if ( ! is_dir ( ( $ dir = \ Yii :: getAlias ( '@frontend/runtime/params' ) ) ) ) mkdir ( $ dir ) ; // save just edited params to the temporary file file_put_contents ( \ Yii :: getAlias ( '@frontend/runtime/params/params.php' ) , $ model -> params ) ; // verify array by loading it if ( ( $ params = include ( \ Yii :: getAlias ( '@frontend/runtime/params/params.php' ) ) ) && is_array ( $ params ) ) { // copy current params to runtime folder with a new name of file copy ( \ Yii :: getAlias ( '@frontend/config/params.php' ) , \ Yii :: getAlias ( '@frontend/runtime/params/' . $ f ) ) ; // save changes to runtime/params.php if ( file_put_contents ( \ Yii :: getAlias ( '@frontend/config/params.php' ) , $ model -> params ) ) return $ this -> goHome ( ) ; else $ error = 'Params file can\'t be saved.' ; } else { $ error = 'Params loading error.' ; } } else $ error = Module :: t ( 'core' , 'Wrong syntax' ) . ( $ syntax -> error [ 'line' ] ? ' ' . Module :: t ( 'core' , 'near line' ) . ': ' . $ syntax -> error [ 'line' ] . ' (' . Module :: t ( 'core' , 'after' ) . ' <code>' . $ syntax -> error [ 'prev' ] . '</code> ' . ( isset ( $ syntax -> error [ 'must' ] ) && $ syntax -> error [ 'must' ] ? Module :: t ( 'core' , 'should be' ) : Module :: t ( 'core' , 'should not be' ) ) . ' <code>' . $ syntax -> error [ 'token' ] . '</code>)' : ': ' . Module :: t ( 'core' , 'unpaired brackets' ) ) . '.' ; } else { // load params $ model -> params = file_get_contents ( \ Yii :: getAlias ( '@frontend/config/params.php' ) ) ; } return $ this -> render ( 'gear' , [ 'model' => $ model , 'error' => $ error , ] ) ; }
Gear or params.

@return mixed
Gear or params .