diff --git a/config/test.php b/config/test.php index a23616e..7f4ef36 100644 --- a/config/test.php +++ b/config/test.php @@ -22,7 +22,7 @@ ], 'request' => [ 'cookieValidationKey' => 'test', - 'enableCsrfValidation' => false, + 'enableCsrfValidation' => true, // but if you absolutely need it set cookie domain to localhost /* 'csrfCookie' => [ diff --git a/config/web.php b/config/web.php index 4d645cf..eca0f47 100644 --- a/config/web.php +++ b/config/web.php @@ -38,14 +38,12 @@ ], ], 'db' => require(__DIR__ . '/db.php'), - /* 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ], ], - */ ], 'params' => $params, ]; diff --git a/controllers/AppController.php b/controllers/AppController.php new file mode 100644 index 0000000..de51731 --- /dev/null +++ b/controllers/AppController.php @@ -0,0 +1,10 @@ +render('index', [ + 'model' => $model, + ]); + } + + /** + * @return string + */ + public function actionBoolean() + { + $model = new BooleanForm(); + + return $this->render('boolean', [ + 'model' => $model, + ]); + } + + /** + * @return string + */ + public function actionCaptcha() + { + $model = new Captcha(); + + return $this->render('captcha', [ + 'model' => $model + ]); + + } + + /** + * @return string + */ + public function actionOthers() + { + $model = new OthersForm; + + return $this->render('others', [ + 'model' => $model + ]); + } +} \ No newline at end of file diff --git a/models/BooleanForm.php b/models/BooleanForm.php new file mode 100644 index 0000000..872a7b2 --- /dev/null +++ b/models/BooleanForm.php @@ -0,0 +1,21 @@ + true, 'falseValue' => false, 'strict' => true], + + ]; + } +} \ No newline at end of file diff --git a/models/Captcha.php b/models/Captcha.php new file mode 100644 index 0000000..885a204 --- /dev/null +++ b/models/Captcha.php @@ -0,0 +1,17 @@ + 30, 'operator' => '>='], + [['event_date'], 'required'], + [['event_date'], 'date', 'format' => 'php:Y-m-d'], + ['default', 'default', 'value' => null], + ['salary', 'double'], + ['integerCount', 'integer', 'min' => 0, 'max' => 5], + ['email', 'email'], + ['primaryImage', 'file', 'extensions' => ['png', 'jpg', 'gif'], 'maxSize' => 1024*1024], + ]; + } +} \ No newline at end of file diff --git a/models/TextForm.php b/models/TextForm.php new file mode 100644 index 0000000..3b58d31 --- /dev/null +++ b/models/TextForm.php @@ -0,0 +1,23 @@ + [4, 24]], + ]; + } +} \ No newline at end of file diff --git a/views/validator/boolean.php b/views/validator/boolean.php new file mode 100644 index 0000000..86e8325 --- /dev/null +++ b/views/validator/boolean.php @@ -0,0 +1,16 @@ + + +

Boolean validator

+ + + +field($model, 'select')->checkbox() ?> + +
+ 'btn btn-primary']) ?> +
+ + \ No newline at end of file diff --git a/views/validator/captcha.php b/views/validator/captcha.php new file mode 100644 index 0000000..07f2d4e --- /dev/null +++ b/views/validator/captcha.php @@ -0,0 +1,19 @@ + + +

Captcha validator

+ + + +field($model, 'verifyCode')->widget(Captcha::className(), [ + 'template' => '
{image}
{input}
', +]) ?> + +
+ 'btn btn-primary', 'name' => 'contact-button']) ?> +
+ + \ No newline at end of file diff --git a/views/validator/index.php b/views/validator/index.php new file mode 100644 index 0000000..6ab8288 --- /dev/null +++ b/views/validator/index.php @@ -0,0 +1,16 @@ + + +

Text validator

+ + + +field($model, 'text')->textInput(['autofocus' => true]) ?> + +
+ 'btn btn-primary']) ?> +
+ + \ No newline at end of file diff --git a/views/validator/others.php b/views/validator/others.php new file mode 100644 index 0000000..2bcf411 --- /dev/null +++ b/views/validator/others.php @@ -0,0 +1,81 @@ + + +

Others validator

+ + + +field($model, 'age') ?> + +
+ 'btn btn-primary']) ?> +
+ + +
+ + +field($model, 'event_date')->textInput(); ?> + +
+ 'btn btn-primary']) ?> +
+ + +
+ + +field($model, 'default')->textInput(); ?> + +
+ 'btn btn-primary']) ?> +
+ + + +
+ + +field($model, 'salary') ?> + +
+ 'btn btn-primary']) ?> +
+ + + +
+ + +field($model, 'integerCount') ?> + +
+ 'btn btn-primary']) ?> +
+ + + +
+ + +field($model, 'email') ?> + +
+ 'btn btn-primary']) ?> +
+ + + +
+ + +field($model, 'primaryImage')->fileInput() ?> + +
+ 'btn btn-primary']) ?> +
+ + + diff --git a/web/.htaccess b/web/.htaccess new file mode 100644 index 0000000..4a62798 --- /dev/null +++ b/web/.htaccess @@ -0,0 +1,11 @@ +Options +FollowSymLinks +IndexIgnore */* + +RewriteEngine on + +# if a directory or a file exists, use it directly +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d + +# otherwise forward it to index.php +RewriteRule . index.php \ No newline at end of file