Commit 01ebf78ca49d7aae7a6d51922c6636191fddcb16
0 parents
Initial commit
Showing
210 changed files
with
6138 additions
and
0 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 210 files are displayed.
1 | +++ a/LICENSE.md | ||
1 | +The Yii framework is free software. It is released under the terms of | ||
2 | +the following BSD License. | ||
3 | + | ||
4 | +Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) | ||
5 | +All rights reserved. | ||
6 | + | ||
7 | +Redistribution and use in source and binary forms, with or without | ||
8 | +modification, are permitted provided that the following conditions | ||
9 | +are met: | ||
10 | + | ||
11 | + * Redistributions of source code must retain the above copyright | ||
12 | + notice, this list of conditions and the following disclaimer. | ||
13 | + * Redistributions in binary form must reproduce the above copyright | ||
14 | + notice, this list of conditions and the following disclaimer in | ||
15 | + the documentation and/or other materials provided with the | ||
16 | + distribution. | ||
17 | + * Neither the name of Yii Software LLC nor the names of its | ||
18 | + contributors may be used to endorse or promote products derived | ||
19 | + from this software without specific prior written permission. | ||
20 | + | ||
21 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
22 | +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
23 | +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
24 | +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
25 | +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
26 | +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
27 | +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
28 | +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
29 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
30 | +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
31 | +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
32 | +POSSIBILITY OF SUCH DAMAGE. |
1 | +++ a/README.md | ||
1 | +Yii 2 Advanced Project Template | ||
2 | +=============================== | ||
3 | + | ||
4 | +Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for | ||
5 | +developing complex Web applications with multiple tiers. | ||
6 | + | ||
7 | +The template includes three tiers: front end, back end, and console, each of which | ||
8 | +is a separate Yii application. | ||
9 | + | ||
10 | +The template is designed to work in a team development environment. It supports | ||
11 | +deploying the application in different environments. | ||
12 | + | ||
13 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | ||
14 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | ||
15 | +[](https://travis-ci.org/yiisoft/yii2-app-advanced) | ||
16 | + | ||
17 | +DIRECTORY STRUCTURE | ||
18 | +------------------- | ||
19 | + | ||
20 | +``` | ||
21 | +common | ||
22 | + config/ contains shared configurations | ||
23 | + mail/ contains view files for e-mails | ||
24 | + models/ contains model classes used in both backend and frontend | ||
25 | +console | ||
26 | + config/ contains console configurations | ||
27 | + controllers/ contains console controllers (commands) | ||
28 | + migrations/ contains database migrations | ||
29 | + models/ contains console-specific model classes | ||
30 | + runtime/ contains files generated during runtime | ||
31 | +backend | ||
32 | + assets/ contains application assets such as JavaScript and CSS | ||
33 | + config/ contains backend configurations | ||
34 | + controllers/ contains Web controller classes | ||
35 | + models/ contains backend-specific model classes | ||
36 | + runtime/ contains files generated during runtime | ||
37 | + views/ contains view files for the Web application | ||
38 | + web/ contains the entry script and Web resources | ||
39 | +frontend | ||
40 | + assets/ contains application assets such as JavaScript and CSS | ||
41 | + config/ contains frontend configurations | ||
42 | + controllers/ contains Web controller classes | ||
43 | + models/ contains frontend-specific model classes | ||
44 | + runtime/ contains files generated during runtime | ||
45 | + views/ contains view files for the Web application | ||
46 | + web/ contains the entry script and Web resources | ||
47 | + widgets/ contains frontend widgets | ||
48 | +vendor/ contains dependent 3rd-party packages | ||
49 | +environments/ contains environment-based overrides | ||
50 | +tests contains various tests for the advanced application | ||
51 | + codeception/ contains tests developed with Codeception PHP Testing Framework | ||
52 | +``` |
1 | +++ a/backend/assets/AppAsset.php | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * @link http://www.yiiframework.com/ | ||
4 | + * @copyright Copyright (c) 2008 Yii Software LLC | ||
5 | + * @license http://www.yiiframework.com/license/ | ||
6 | + */ | ||
7 | + | ||
8 | +namespace backend\assets; | ||
9 | + | ||
10 | +use yii\web\AssetBundle; | ||
11 | + | ||
12 | +/** | ||
13 | + * @author Qiang Xue <qiang.xue@gmail.com> | ||
14 | + * @since 2.0 | ||
15 | + */ | ||
16 | +class AppAsset extends AssetBundle | ||
17 | +{ | ||
18 | + public $basePath = '@webroot'; | ||
19 | + public $baseUrl = '@web'; | ||
20 | + public $css = [ | ||
21 | + 'css/site.css', | ||
22 | + ]; | ||
23 | + public $js = [ | ||
24 | + 'js/main.js', | ||
25 | + ]; | ||
26 | + public $depends = [ | ||
27 | + 'yii\web\YiiAsset', | ||
28 | + 'yii\bootstrap\BootstrapAsset', | ||
29 | + 'yii\web\JqueryAsset', | ||
30 | + ]; | ||
31 | +} |
1 | +++ a/backend/components/ConstantTrait.php | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: denys | ||
5 | + * Date: 20.10.15 | ||
6 | + * Time: 15:48 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace backend\components; | ||
10 | + | ||
11 | +use ReflectionClass; | ||
12 | + | ||
13 | +trait ConstantTrait | ||
14 | +{ | ||
15 | + public function getConstants() | ||
16 | + { | ||
17 | + $oClass = new ReflectionClass(get_class($this)); | ||
18 | + return $oClass->getConstants(); | ||
19 | + } | ||
20 | +} | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
1 | +++ a/backend/components/croppers/AbstractCrop.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\components\croppers; | ||
4 | + | ||
5 | + | ||
6 | +use backend\components\ConstantTrait; | ||
7 | +use Imagine\Image\Box; | ||
8 | +use Imagine\Image\Point; | ||
9 | + | ||
10 | +abstract class AbstractCrop | ||
11 | +{ | ||
12 | + use ConstantTrait; | ||
13 | + | ||
14 | + public function crop($image, $path) | ||
15 | + { | ||
16 | + $image->crop(new Point(static::X, static::Y), new Box(static::WIDTH, static::HEIGHT)) | ||
17 | + ->save($path); | ||
18 | + } | ||
19 | +} | ||
0 | \ No newline at end of file | 20 | \ No newline at end of file |
1 | +++ a/backend/components/croppers/CropContext.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\components\croppers; | ||
4 | + | ||
5 | + | ||
6 | +class CropContext | ||
7 | +{ | ||
8 | + /** | ||
9 | + * @var CropInterface | ||
10 | + */ | ||
11 | + private $cropper; | ||
12 | + | ||
13 | + public function __construct(AbstractCrop $abstractCrop) { | ||
14 | + $this->cropper = $abstractCrop; | ||
15 | + } | ||
16 | + | ||
17 | + public function cropImage($image, $path) { | ||
18 | + $this->cropper->crop($image, $path); | ||
19 | + } | ||
20 | +} | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
1 | +++ a/backend/components/croppers/CropFactory.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\components\croppers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +class CropFactory | ||
8 | +{ | ||
9 | + private static $instance; | ||
10 | + private $crops = []; | ||
11 | + | ||
12 | + private function __construct() { | ||
13 | + $this->init(); | ||
14 | + } | ||
15 | + | ||
16 | + private function init() { | ||
17 | + $this->crops[] = new EconomixCrop(); | ||
18 | + $this->crops[] = new GoldenGardenFlowersCrop(); | ||
19 | + $this->crops[] = new GoldenGardenVegiesCrop(); | ||
20 | + $this->crops[] = new GoldenGardenGiantCrop(); | ||
21 | + $this->crops[] = new UkrSeedsNovikGiantCrop(); | ||
22 | + $this->crops[] = new UkrSeedsNovikMiniCrop(); | ||
23 | + $this->crops[] = new UkrSeedsNovikVegiesCrop(); | ||
24 | + $this->crops[] = new UkrSeedsNovikFlowersCrop(); | ||
25 | + $this->crops[] = new UkrSeedsTekVegiesCrop(); | ||
26 | + $this->crops[] = new UkrSeedsFloraMiniCrop(); | ||
27 | + $this->crops[] = new UkrSeedsFloraVegiesCrop(); | ||
28 | + } | ||
29 | + | ||
30 | + public function getCrop($crop_id) { | ||
31 | + return $this->crops[$crop_id]; | ||
32 | + } | ||
33 | + | ||
34 | + public static function getInstance() { | ||
35 | + if (null === self::$instance) { | ||
36 | + self::$instance = new self(); | ||
37 | + } | ||
38 | + return self::$instance; | ||
39 | + } | ||
40 | +} | ||
0 | \ No newline at end of file | 41 | \ No newline at end of file |
1 | +++ a/backend/components/croppers/EconomixCrop.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\components\croppers; | ||
4 | + | ||
5 | + | ||
6 | +/** | ||
7 | + * Class EconomixCrop | ||
8 | + * Economix Flora 70x120 | ||
9 | + * @package backend\components\croppers | ||
10 | + */ | ||
11 | +class EconomixCrop extends AbstractCrop | ||
12 | +{ | ||
13 | + const WIDTH = 296; | ||
14 | + const HEIGHT = 500; | ||
15 | + const X = 302; | ||
16 | + const Y = 599; | ||
17 | + /* previous | ||
18 | + * const WIDTH = 394; | ||
19 | + const HEIGHT = 666; | ||
20 | + const X = 598; | ||
21 | + const Y = 799;*/ | ||
22 | +} | ||
0 | \ No newline at end of file | 23 | \ No newline at end of file |
backend/components/croppers/GoldenGardenFlowersCrop.php
0 → 100644
1 | +++ a/backend/components/croppers/GoldenGardenFlowersCrop.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\components\croppers; | ||
4 | + | ||
5 | + | ||
6 | +class GoldenGardenFlowersCrop extends AbstractCrop | ||
7 | +{ | ||
8 | + const WIDTH = 946; | ||
9 | + const HEIGHT = 1773; | ||
10 | + const X = 235; | ||
11 | + const Y = 1746; | ||
12 | +} | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
backend/components/croppers/GoldenGardenGiantCrop.php
0 → 100644
backend/components/croppers/GoldenGardenVegiesCrop.php
0 → 100644
1 | +++ a/backend/components/croppers/GoldenGardenVegiesCrop.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\components\croppers; | ||
4 | + | ||
5 | + | ||
6 | +class GoldenGardenVegiesCrop extends AbstractCrop | ||
7 | +{ | ||
8 | + const WIDTH = 946; | ||
9 | + const HEIGHT = 1773; | ||
10 | + const X = 827; | ||
11 | + const Y = 1746; | ||
12 | +} | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
backend/components/croppers/UkrSeedsFloraMiniCrop.php
0 → 100644
backend/components/croppers/UkrSeedsFloraVegiesCrop.php
0 → 100644
backend/components/croppers/UkrSeedsNovikFlowersCrop.php
0 → 100644
backend/components/croppers/UkrSeedsNovikGiantCrop.php
0 → 100644
backend/components/croppers/UkrSeedsNovikMiniCrop.php
0 → 100644
backend/components/croppers/UkrSeedsNovikVegiesCrop.php
0 → 100644
backend/components/croppers/UkrSeedsTekVegiesCrop.php
0 → 100644
1 | +++ a/backend/config/main.php | ||
1 | +<?php | ||
2 | +$params = array_merge( | ||
3 | + require(__DIR__ . '/../../common/config/params.php'), | ||
4 | + require(__DIR__ . '/../../common/config/params-local.php'), | ||
5 | + require(__DIR__ . '/params.php'), | ||
6 | + require(__DIR__ . '/params-local.php') | ||
7 | +); | ||
8 | + | ||
9 | +return [ | ||
10 | + 'id' => 'app-backend', | ||
11 | + 'basePath' => dirname(__DIR__), | ||
12 | + 'controllerNamespace' => 'backend\controllers', | ||
13 | + 'bootstrap' => ['log'], | ||
14 | + 'modules' => [], | ||
15 | + 'components' => [ | ||
16 | + 'imagine' => 'Imagine\Gd\Imagine', | ||
17 | + 'user' => [ | ||
18 | + 'identityClass' => 'common\models\User', | ||
19 | + 'enableAutoLogin' => true, | ||
20 | + ], | ||
21 | + 'log' => [ | ||
22 | + 'traceLevel' => YII_DEBUG ? 3 : 0, | ||
23 | + 'targets' => [ | ||
24 | + [ | ||
25 | + 'class' => 'yii\log\FileTarget', | ||
26 | + 'levels' => ['error', 'warning'], | ||
27 | + ], | ||
28 | + ], | ||
29 | + ], | ||
30 | + 'errorHandler' => [ | ||
31 | + 'errorAction' => 'site/error', | ||
32 | + ], | ||
33 | + ], | ||
34 | + 'params' => $params, | ||
35 | +]; |
1 | +++ a/backend/config/params.php | ||
1 | +<?php | ||
2 | +return [ | ||
3 | + 'adminEmail' => 'admin@example.com', | ||
4 | + 'ukrSeeds' => [ | ||
5 | + 0 => 'Economix Flora 70x120', | ||
6 | + 1 => 'GoldenGarden Novik Flowers 80x150', | ||
7 | + 2 => 'GoldenGarden Novik Vegetables 80x150', | ||
8 | + 3 => 'GoldenGarden Novik Giant 115x165', | ||
9 | + 4 => 'UkrSeeds Novik Giant 115x165', | ||
10 | + 5 => 'UkrSeeds Novik Mini 70x120', | ||
11 | + 6 => 'UkrSeeds Novik Vegetables 80x150', | ||
12 | + 7 => 'UkrSeeds Novik Flowers 80x150', | ||
13 | + 8 => 'UkrSeeds Tek Vegetables 80x150', | ||
14 | + 9 => 'UkrSeeds Flora Mini 70x120', | ||
15 | + 10 => 'UkrSeeds Flora Vegetables 80x150', | ||
16 | + ] | ||
17 | +]; |
1 | +++ a/backend/controllers/ImageController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use backend\components\croppers\CropContext; | ||
6 | +use backend\components\croppers\CropFactory; | ||
7 | + | ||
8 | +use Yii; | ||
9 | +use yii\web\Controller; | ||
10 | +use backend\models\UploadForm; | ||
11 | +use yii\web\UploadedFile; | ||
12 | + | ||
13 | +class ImageController extends Controller | ||
14 | +{ | ||
15 | + public function actionIndex() | ||
16 | + { | ||
17 | + $request = Yii::$app->request; | ||
18 | + $model = new UploadForm(); | ||
19 | + $ukrSeeds = Yii::$app->params['ukrSeeds']; | ||
20 | + | ||
21 | + if ($request->isPost) { | ||
22 | + $model->imageFiles = UploadedFile::getInstances($model, 'imageFiles'); | ||
23 | + $model->upload(); | ||
24 | + | ||
25 | + $crop_id = $request->post('crop_id'); | ||
26 | + | ||
27 | + $cropFactory = CropFactory::getInstance(); | ||
28 | + $cropContext = new CropContext($cropFactory->getCrop($crop_id)); | ||
29 | + | ||
30 | + foreach($model->imageFiles as $file) { | ||
31 | + $path = dirname(dirname(__DIR__)) . '/uploads/' . $file->baseName . '.' . $file->extension; | ||
32 | + $image = Yii::$app->imagine->open($path); | ||
33 | + $cropContext->cropImage($image, $path); | ||
34 | + } | ||
35 | + } | ||
36 | + return $this->render('index', ['model' => $model, 'ukrSeeds' => $ukrSeeds]); | ||
37 | + } | ||
38 | + | ||
39 | + public function actionGetParams($crop_id) | ||
40 | + { | ||
41 | + if (Yii::$app->request->isAjax) { | ||
42 | + | ||
43 | + $cropFactory = CropFactory::getInstance(); | ||
44 | + | ||
45 | + $res = [ | ||
46 | + 'body' => $cropFactory->getCrop($crop_id)->getConstants(), | ||
47 | + 'success' => true, | ||
48 | + ]; | ||
49 | + | ||
50 | + return json_encode($res); | ||
51 | + } | ||
52 | + } | ||
53 | +} | ||
0 | \ No newline at end of file | 54 | \ No newline at end of file |
1 | +++ a/backend/controllers/SiteController.php | ||
1 | +<?php | ||
2 | +namespace backend\controllers; | ||
3 | + | ||
4 | +use Yii; | ||
5 | +use yii\filters\AccessControl; | ||
6 | +use yii\web\Controller; | ||
7 | +use common\models\LoginForm; | ||
8 | +use yii\filters\VerbFilter; | ||
9 | + | ||
10 | +/** | ||
11 | + * Site controller | ||
12 | + */ | ||
13 | +class SiteController extends Controller | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function behaviors() | ||
19 | + { | ||
20 | + return [ | ||
21 | + 'access' => [ | ||
22 | + 'class' => AccessControl::className(), | ||
23 | + 'rules' => [ | ||
24 | + [ | ||
25 | + 'actions' => ['login', 'error'], | ||
26 | + 'allow' => true, | ||
27 | + ], | ||
28 | + [ | ||
29 | + 'actions' => ['logout', 'index'], | ||
30 | + 'allow' => true, | ||
31 | + 'roles' => ['@'], | ||
32 | + ], | ||
33 | + ], | ||
34 | + ], | ||
35 | + 'verbs' => [ | ||
36 | + 'class' => VerbFilter::className(), | ||
37 | + 'actions' => [ | ||
38 | + 'logout' => ['post'], | ||
39 | + ], | ||
40 | + ], | ||
41 | + ]; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * @inheritdoc | ||
46 | + */ | ||
47 | + public function actions() | ||
48 | + { | ||
49 | + return [ | ||
50 | + 'error' => [ | ||
51 | + 'class' => 'yii\web\ErrorAction', | ||
52 | + ], | ||
53 | + ]; | ||
54 | + } | ||
55 | + | ||
56 | + public function actionIndex() | ||
57 | + { | ||
58 | + return $this->render('index'); | ||
59 | + } | ||
60 | + | ||
61 | + public function actionLogin() | ||
62 | + { | ||
63 | + if (!\Yii::$app->user->isGuest) { | ||
64 | + return $this->goHome(); | ||
65 | + } | ||
66 | + | ||
67 | + $model = new LoginForm(); | ||
68 | + if ($model->load(Yii::$app->request->post()) && $model->login()) { | ||
69 | + return $this->goBack(); | ||
70 | + } else { | ||
71 | + return $this->render('login', [ | ||
72 | + 'model' => $model, | ||
73 | + ]); | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + public function actionLogout() | ||
78 | + { | ||
79 | + Yii::$app->user->logout(); | ||
80 | + | ||
81 | + return $this->goHome(); | ||
82 | + } | ||
83 | +} |
1 | +++ a/backend/models/UploadForm.php | ||
1 | +<?php | ||
2 | +namespace backend\models; | ||
3 | + | ||
4 | +use yii\base\Model; | ||
5 | +use yii\web\UploadedFile; | ||
6 | + | ||
7 | +class UploadForm extends Model | ||
8 | +{ | ||
9 | + public $imageFiles; | ||
10 | + | ||
11 | + public function rules() | ||
12 | + { | ||
13 | + return [ | ||
14 | + [['imageFiles'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg', 'maxFiles' => 4], | ||
15 | + | ||
16 | + ]; | ||
17 | + } | ||
18 | + | ||
19 | + public function upload() | ||
20 | + { | ||
21 | + if ($this->validate()) { | ||
22 | + foreach($this->imageFiles as $file) { | ||
23 | + $path = dirname(dirname(__DIR__)) . '/uploads/' . $file->baseName . '.' . $file->extension; | ||
24 | + $file->saveAs($path); | ||
25 | + } | ||
26 | + return true; | ||
27 | + } else { | ||
28 | + return false; | ||
29 | + } | ||
30 | + } | ||
31 | +} | ||
0 | \ No newline at end of file | 32 | \ No newline at end of file |
1 | +++ a/backend/views/image/index.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use \kartik\file\FileInput; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | +use yii\helpers\Html; | ||
6 | + | ||
7 | +/* @var $this yii\web\View */ | ||
8 | +$this->title = 'Image cropper'; | ||
9 | +?> | ||
10 | +<?php $form = ActiveForm::begin(['options' => ['enctype'=>'multipart/form-data']]); ?> | ||
11 | + <?= $form->field($model, 'imageFiles[]')->widget(FileInput::classname(), [ | ||
12 | + 'options' => ['accept' => 'image/*', 'multiple' => true], | ||
13 | + 'language' => 'ru' | ||
14 | + ]); ?> | ||
15 | + <?= Html::dropDownList('crop_id', null, $ukrSeeds, ['id' => 'ukr_seeds']) ?> | ||
16 | +<?php $form->end(); ?> | ||
17 | +<?= Html::buttonInput('Draw', ['onclick' => 'js:draw();', 'style' => 'display : block']) ?> | ||
18 | +<canvas/> | ||
19 | + | ||
20 | + |
1 | +++ a/backend/views/layouts/main.php | ||
1 | +<?php | ||
2 | +use backend\assets\AppAsset; | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\bootstrap\Nav; | ||
5 | +use yii\bootstrap\NavBar; | ||
6 | +use yii\widgets\Breadcrumbs; | ||
7 | + | ||
8 | +/* @var $this \yii\web\View */ | ||
9 | +/* @var $content string */ | ||
10 | + | ||
11 | +AppAsset::register($this); | ||
12 | +?> | ||
13 | +<?php $this->beginPage() ?> | ||
14 | +<!DOCTYPE html> | ||
15 | +<html lang="<?= Yii::$app->language ?>"> | ||
16 | +<head> | ||
17 | + <meta charset="<?= Yii::$app->charset ?>"> | ||
18 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
19 | + <?= Html::csrfMetaTags() ?> | ||
20 | + <title><?= Html::encode($this->title) ?></title> | ||
21 | + <?php $this->head() ?> | ||
22 | +</head> | ||
23 | +<body> | ||
24 | + <?php $this->beginBody() ?> | ||
25 | + <div class="wrap"> | ||
26 | + <?php | ||
27 | + NavBar::begin([ | ||
28 | + 'brandLabel' => 'My Company', | ||
29 | + 'brandUrl' => Yii::$app->homeUrl, | ||
30 | + 'options' => [ | ||
31 | + 'class' => 'navbar-inverse navbar-fixed-top', | ||
32 | + ], | ||
33 | + ]); | ||
34 | + $menuItems = [ | ||
35 | + ['label' => 'Home', 'url' => ['/site/index']], | ||
36 | + ]; | ||
37 | + if (Yii::$app->user->isGuest) { | ||
38 | + $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; | ||
39 | + } else { | ||
40 | + $menuItems[] = [ | ||
41 | + 'label' => 'Logout (' . Yii::$app->user->identity->username . ')', | ||
42 | + 'url' => ['/site/logout'], | ||
43 | + 'linkOptions' => ['data-method' => 'post'] | ||
44 | + ]; | ||
45 | + } | ||
46 | + echo Nav::widget([ | ||
47 | + 'options' => ['class' => 'navbar-nav navbar-right'], | ||
48 | + 'items' => $menuItems, | ||
49 | + ]); | ||
50 | + NavBar::end(); | ||
51 | + ?> | ||
52 | + | ||
53 | + <div class="container"> | ||
54 | + <?= Breadcrumbs::widget([ | ||
55 | + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | ||
56 | + ]) ?> | ||
57 | + <?= $content ?> | ||
58 | + </div> | ||
59 | + </div> | ||
60 | + | ||
61 | + <footer class="footer"> | ||
62 | + <div class="container"> | ||
63 | + <p class="pull-left">© My Company <?= date('Y') ?></p> | ||
64 | + <p class="pull-right"><?= Yii::powered() ?></p> | ||
65 | + </div> | ||
66 | + </footer> | ||
67 | + | ||
68 | + <?php $this->endBody() ?> | ||
69 | +</body> | ||
70 | +</html> | ||
71 | +<?php $this->endPage() ?> |
1 | +++ a/backend/views/site/error.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $name string */ | ||
7 | +/* @var $message string */ | ||
8 | +/* @var $exception Exception */ | ||
9 | + | ||
10 | +$this->title = $name; | ||
11 | +?> | ||
12 | +<div class="site-error"> | ||
13 | + | ||
14 | + <h1><?= Html::encode($this->title) ?></h1> | ||
15 | + | ||
16 | + <div class="alert alert-danger"> | ||
17 | + <?= nl2br(Html::encode($message)) ?> | ||
18 | + </div> | ||
19 | + | ||
20 | + <p> | ||
21 | + The above error occurred while the Web server was processing your request. | ||
22 | + </p> | ||
23 | + <p> | ||
24 | + Please contact us if you think this is a server error. Thank you. | ||
25 | + </p> | ||
26 | + | ||
27 | +</div> |
1 | +++ a/backend/views/site/index.php | ||
1 | +<?php | ||
2 | +/* @var $this yii\web\View */ | ||
3 | + | ||
4 | +$this->title = 'My Yii Application'; | ||
5 | +?> | ||
6 | +<div class="site-index"> | ||
7 | + | ||
8 | + <div class="jumbotron"> | ||
9 | + <h1>Congratulations!</h1> | ||
10 | + | ||
11 | + <p class="lead">You have successfully created your Yii-powered application.</p> | ||
12 | + | ||
13 | + <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p> | ||
14 | + </div> | ||
15 | + | ||
16 | + <div class="body-content"> | ||
17 | + | ||
18 | + <div class="row"> | ||
19 | + <div class="col-lg-4"> | ||
20 | + <h2>Heading</h2> | ||
21 | + | ||
22 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | ||
23 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | ||
24 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | ||
25 | + fugiat nulla pariatur.</p> | ||
26 | + | ||
27 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation »</a></p> | ||
28 | + </div> | ||
29 | + <div class="col-lg-4"> | ||
30 | + <h2>Heading</h2> | ||
31 | + | ||
32 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | ||
33 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | ||
34 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | ||
35 | + fugiat nulla pariatur.</p> | ||
36 | + | ||
37 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum »</a></p> | ||
38 | + </div> | ||
39 | + <div class="col-lg-4"> | ||
40 | + <h2>Heading</h2> | ||
41 | + | ||
42 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | ||
43 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | ||
44 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | ||
45 | + fugiat nulla pariatur.</p> | ||
46 | + | ||
47 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions »</a></p> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | + | ||
51 | + </div> | ||
52 | +</div> |
1 | +++ a/backend/views/site/login.php | ||
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | +use yii\bootstrap\ActiveForm; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $form yii\bootstrap\ActiveForm */ | ||
7 | +/* @var $model \common\models\LoginForm */ | ||
8 | + | ||
9 | +$this->title = 'Login'; | ||
10 | +$this->params['breadcrumbs'][] = $this->title; | ||
11 | +?> | ||
12 | +<div class="site-login"> | ||
13 | + <h1><?= Html::encode($this->title) ?></h1> | ||
14 | + | ||
15 | + <p>Please fill out the following fields to login:</p> | ||
16 | + | ||
17 | + <div class="row"> | ||
18 | + <div class="col-lg-5"> | ||
19 | + <?php $form = ActiveForm::begin(['id' => 'login-form']); ?> | ||
20 | + <?= $form->field($model, 'username') ?> | ||
21 | + <?= $form->field($model, 'password')->passwordInput() ?> | ||
22 | + <?= $form->field($model, 'rememberMe')->checkbox() ?> | ||
23 | + <div class="form-group"> | ||
24 | + <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?> | ||
25 | + </div> | ||
26 | + <?php ActiveForm::end(); ?> | ||
27 | + </div> | ||
28 | + </div> | ||
29 | +</div> |
1 | +++ a/backend/web/css/site.css | ||
1 | +html, | ||
2 | +body { | ||
3 | + height: 100%; | ||
4 | +} | ||
5 | + | ||
6 | +.wrap { | ||
7 | + min-height: 100%; | ||
8 | + height: auto; | ||
9 | + margin: 0 auto -60px; | ||
10 | + padding: 0 0 60px; | ||
11 | +} | ||
12 | + | ||
13 | +.wrap > .container { | ||
14 | + padding: 70px 15px 20px; | ||
15 | +} | ||
16 | + | ||
17 | +.footer { | ||
18 | + height: 60px; | ||
19 | + background-color: #f5f5f5; | ||
20 | + border-top: 1px solid #ddd; | ||
21 | + padding-top: 20px; | ||
22 | +} | ||
23 | + | ||
24 | +.jumbotron { | ||
25 | + text-align: center; | ||
26 | + background-color: transparent; | ||
27 | +} | ||
28 | + | ||
29 | +.jumbotron .btn { | ||
30 | + font-size: 21px; | ||
31 | + padding: 14px 24px; | ||
32 | +} | ||
33 | + | ||
34 | +.not-set { | ||
35 | + color: #c55; | ||
36 | + font-style: italic; | ||
37 | +} | ||
38 | + | ||
39 | +/* add sorting icons to gridview sort links */ | ||
40 | +a.asc:after, a.desc:after { | ||
41 | + position: relative; | ||
42 | + top: 1px; | ||
43 | + display: inline-block; | ||
44 | + font-family: 'Glyphicons Halflings'; | ||
45 | + font-style: normal; | ||
46 | + font-weight: normal; | ||
47 | + line-height: 1; | ||
48 | + padding-left: 5px; | ||
49 | +} | ||
50 | + | ||
51 | +a.asc:after { | ||
52 | + content: /*"\e113"*/ "\e151"; | ||
53 | +} | ||
54 | + | ||
55 | +a.desc:after { | ||
56 | + content: /*"\e114"*/ "\e152"; | ||
57 | +} | ||
58 | + | ||
59 | +.sort-numerical a.asc:after { | ||
60 | + content: "\e153"; | ||
61 | +} | ||
62 | + | ||
63 | +.sort-numerical a.desc:after { | ||
64 | + content: "\e154"; | ||
65 | +} | ||
66 | + | ||
67 | +.sort-ordinal a.asc:after { | ||
68 | + content: "\e155"; | ||
69 | +} | ||
70 | + | ||
71 | +.sort-ordinal a.desc:after { | ||
72 | + content: "\e156"; | ||
73 | +} | ||
74 | + | ||
75 | +.grid-view th { | ||
76 | + white-space: nowrap; | ||
77 | +} | ||
78 | + | ||
79 | +.hint-block { | ||
80 | + display: block; | ||
81 | + margin-top: 5px; | ||
82 | + color: #999; | ||
83 | +} | ||
84 | + | ||
85 | +.error-summary { | ||
86 | + color: #a94442; | ||
87 | + background: #fdf7f7; | ||
88 | + border-left: 3px solid #eed3d7; | ||
89 | + padding: 10px 20px; | ||
90 | + margin: 0 0 15px 0; | ||
91 | +} |
No preview for this file type
104 KB
1 | +++ a/backend/web/js/main.js | ||
1 | +var canvas = $('canvas').attr({'width' : 1200, 'height' : 500}).css('border', '1px solid black'); | ||
2 | +var context = canvas.get(0).getContext('2d'); | ||
3 | + | ||
4 | +var model = { | ||
5 | + width : 0, | ||
6 | + height : 0, | ||
7 | + point : { | ||
8 | + x : 0, | ||
9 | + y : 0 | ||
10 | + } | ||
11 | +}; | ||
12 | + | ||
13 | +var select = $('#ukr_seeds'); | ||
14 | +select.change(getParams); | ||
15 | + | ||
16 | +getParams(); | ||
17 | + | ||
18 | +function getParams() | ||
19 | +{ | ||
20 | + $.ajax({ | ||
21 | + url: location.href + '/get-params', | ||
22 | + data: { | ||
23 | + 'crop_id': select.val() | ||
24 | + }, | ||
25 | + type: 'GET', | ||
26 | + dataType: 'json', | ||
27 | + success: function(data) { | ||
28 | + model.width = data.body.WIDTH; | ||
29 | + model.height = data.body.HEIGHT; | ||
30 | + model.point.x = data.body.X; | ||
31 | + model.point.y = data.body.Y; | ||
32 | + canvas.attr({'width' : model.width + 20, 'height' : model.height + 20}); | ||
33 | + context.clearRect(0, 0, canvas.width, canvas.height); | ||
34 | + console.log(model); | ||
35 | + } | ||
36 | + }); | ||
37 | +} | ||
38 | + | ||
39 | +function draw() | ||
40 | +{ | ||
41 | + var image = $('img').get(0); | ||
42 | + context.clearRect(0, 0, canvas.width, canvas.height); | ||
43 | + context.drawImage(image, model.point.x, model.point.y, model.width, model.height, 10, 10, model.width, model.height); | ||
44 | + console.log( image.width, image.height ); | ||
45 | +} | ||
0 | \ No newline at end of file | 46 | \ No newline at end of file |
1 | +++ a/common/mail/layouts/html.php | ||
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | + | ||
4 | +/* @var $this \yii\web\View view component instance */ | ||
5 | +/* @var $message \yii\mail\MessageInterface the message being composed */ | ||
6 | +/* @var $content string main view render result */ | ||
7 | +?> | ||
8 | +<?php $this->beginPage() ?> | ||
9 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
10 | +<html xmlns="http://www.w3.org/1999/xhtml"> | ||
11 | +<head> | ||
12 | + <meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" /> | ||
13 | + <title><?= Html::encode($this->title) ?></title> | ||
14 | + <?php $this->head() ?> | ||
15 | +</head> | ||
16 | +<body> | ||
17 | + <?php $this->beginBody() ?> | ||
18 | + <?= $content ?> | ||
19 | + <?php $this->endBody() ?> | ||
20 | +</body> | ||
21 | +</html> | ||
22 | +<?php $this->endPage() ?> |
1 | +++ a/common/mail/layouts/text.php | ||
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | + | ||
4 | +/* @var $this \yii\web\View view component instance */ | ||
5 | +/* @var $message \yii\mail\MessageInterface the message being composed */ | ||
6 | +/* @var $content string main view render result */ | ||
7 | +?> | ||
8 | +<?php $this->beginPage() ?> | ||
9 | +<?php $this->beginBody() ?> | ||
10 | +<?= $content ?> | ||
11 | +<?php $this->endBody() ?> | ||
12 | +<?php $this->endPage() ?> |
1 | +++ a/common/mail/passwordResetToken-html.php | ||
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | + | ||
4 | +/* @var $this yii\web\View */ | ||
5 | +/* @var $user common\models\User */ | ||
6 | + | ||
7 | +$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); | ||
8 | +?> | ||
9 | +<div class="password-reset"> | ||
10 | + <p>Hello <?= Html::encode($user->username) ?>,</p> | ||
11 | + | ||
12 | + <p>Follow the link below to reset your password:</p> | ||
13 | + | ||
14 | + <p><?= Html::a(Html::encode($resetLink), $resetLink) ?></p> | ||
15 | +</div> |
1 | +++ a/common/mail/passwordResetToken-text.php | ||
1 | +<?php | ||
2 | + | ||
3 | +/* @var $this yii\web\View */ | ||
4 | +/* @var $user common\models\User */ | ||
5 | + | ||
6 | +$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); | ||
7 | +?> | ||
8 | +Hello <?= $user->username ?>, | ||
9 | + | ||
10 | +Follow the link below to reset your password: | ||
11 | + | ||
12 | +<?= $resetLink ?> |
1 | +++ a/common/models/LoginForm.php | ||
1 | +<?php | ||
2 | +namespace common\models; | ||
3 | + | ||
4 | +use Yii; | ||
5 | +use yii\base\Model; | ||
6 | + | ||
7 | +/** | ||
8 | + * Login form | ||
9 | + */ | ||
10 | +class LoginForm extends Model | ||
11 | +{ | ||
12 | + public $username; | ||
13 | + public $password; | ||
14 | + public $rememberMe = true; | ||
15 | + | ||
16 | + private $_user = false; | ||
17 | + | ||
18 | + | ||
19 | + /** | ||
20 | + * @inheritdoc | ||
21 | + */ | ||
22 | + public function rules() | ||
23 | + { | ||
24 | + return [ | ||
25 | + // username and password are both required | ||
26 | + [['username', 'password'], 'required'], | ||
27 | + // rememberMe must be a boolean value | ||
28 | + ['rememberMe', 'boolean'], | ||
29 | + // password is validated by validatePassword() | ||
30 | + ['password', 'validatePassword'], | ||
31 | + ]; | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Validates the password. | ||
36 | + * This method serves as the inline validation for password. | ||
37 | + * | ||
38 | + * @param string $attribute the attribute currently being validated | ||
39 | + * @param array $params the additional name-value pairs given in the rule | ||
40 | + */ | ||
41 | + public function validatePassword($attribute, $params) | ||
42 | + { | ||
43 | + if (!$this->hasErrors()) { | ||
44 | + $user = $this->getUser(); | ||
45 | + if (!$user || !$user->validatePassword($this->password)) { | ||
46 | + $this->addError($attribute, 'Incorrect username or password.'); | ||
47 | + } | ||
48 | + } | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * Logs in a user using the provided username and password. | ||
53 | + * | ||
54 | + * @return boolean whether the user is logged in successfully | ||
55 | + */ | ||
56 | + public function login() | ||
57 | + { | ||
58 | + if ($this->validate()) { | ||
59 | + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); | ||
60 | + } else { | ||
61 | + return false; | ||
62 | + } | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * Finds user by [[username]] | ||
67 | + * | ||
68 | + * @return User|null | ||
69 | + */ | ||
70 | + public function getUser() | ||
71 | + { | ||
72 | + if ($this->_user === false) { | ||
73 | + $this->_user = User::findByUsername($this->username); | ||
74 | + } | ||
75 | + | ||
76 | + return $this->_user; | ||
77 | + } | ||
78 | +} |
1 | +++ a/common/models/User.php | ||
1 | +<?php | ||
2 | +namespace common\models; | ||
3 | + | ||
4 | +use Yii; | ||
5 | +use yii\base\NotSupportedException; | ||
6 | +use yii\behaviors\TimestampBehavior; | ||
7 | +use yii\db\ActiveRecord; | ||
8 | +use yii\web\IdentityInterface; | ||
9 | + | ||
10 | +/** | ||
11 | + * User model | ||
12 | + * | ||
13 | + * @property integer $id | ||
14 | + * @property string $username | ||
15 | + * @property string $password_hash | ||
16 | + * @property string $password_reset_token | ||
17 | + * @property string $email | ||
18 | + * @property string $auth_key | ||
19 | + * @property integer $status | ||
20 | + * @property integer $created_at | ||
21 | + * @property integer $updated_at | ||
22 | + * @property string $password write-only password | ||
23 | + */ | ||
24 | +class User extends ActiveRecord implements IdentityInterface | ||
25 | +{ | ||
26 | + const STATUS_DELETED = 0; | ||
27 | + const STATUS_ACTIVE = 10; | ||
28 | + | ||
29 | + /** | ||
30 | + * @inheritdoc | ||
31 | + */ | ||
32 | + public static function tableName() | ||
33 | + { | ||
34 | + return '{{%user}}'; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * @inheritdoc | ||
39 | + */ | ||
40 | + public function behaviors() | ||
41 | + { | ||
42 | + return [ | ||
43 | + TimestampBehavior::className(), | ||
44 | + ]; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * @inheritdoc | ||
49 | + */ | ||
50 | + public function rules() | ||
51 | + { | ||
52 | + return [ | ||
53 | + ['status', 'default', 'value' => self::STATUS_ACTIVE], | ||
54 | + ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], | ||
55 | + ]; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * @inheritdoc | ||
60 | + */ | ||
61 | + public static function findIdentity($id) | ||
62 | + { | ||
63 | + return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * @inheritdoc | ||
68 | + */ | ||
69 | + public static function findIdentityByAccessToken($token, $type = null) | ||
70 | + { | ||
71 | + throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Finds user by username | ||
76 | + * | ||
77 | + * @param string $username | ||
78 | + * @return static|null | ||
79 | + */ | ||
80 | + public static function findByUsername($username) | ||
81 | + { | ||
82 | + return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Finds user by password reset token | ||
87 | + * | ||
88 | + * @param string $token password reset token | ||
89 | + * @return static|null | ||
90 | + */ | ||
91 | + public static function findByPasswordResetToken($token) | ||
92 | + { | ||
93 | + if (!static::isPasswordResetTokenValid($token)) { | ||
94 | + return null; | ||
95 | + } | ||
96 | + | ||
97 | + return static::findOne([ | ||
98 | + 'password_reset_token' => $token, | ||
99 | + 'status' => self::STATUS_ACTIVE, | ||
100 | + ]); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * Finds out if password reset token is valid | ||
105 | + * | ||
106 | + * @param string $token password reset token | ||
107 | + * @return boolean | ||
108 | + */ | ||
109 | + public static function isPasswordResetTokenValid($token) | ||
110 | + { | ||
111 | + if (empty($token)) { | ||
112 | + return false; | ||
113 | + } | ||
114 | + $expire = Yii::$app->params['user.passwordResetTokenExpire']; | ||
115 | + $parts = explode('_', $token); | ||
116 | + $timestamp = (int) end($parts); | ||
117 | + return $timestamp + $expire >= time(); | ||
118 | + } | ||
119 | + | ||
120 | + /** | ||
121 | + * @inheritdoc | ||
122 | + */ | ||
123 | + public function getId() | ||
124 | + { | ||
125 | + return $this->getPrimaryKey(); | ||
126 | + } | ||
127 | + | ||
128 | + /** | ||
129 | + * @inheritdoc | ||
130 | + */ | ||
131 | + public function getAuthKey() | ||
132 | + { | ||
133 | + return $this->auth_key; | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
137 | + * @inheritdoc | ||
138 | + */ | ||
139 | + public function validateAuthKey($authKey) | ||
140 | + { | ||
141 | + return $this->getAuthKey() === $authKey; | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * Validates password | ||
146 | + * | ||
147 | + * @param string $password password to validate | ||
148 | + * @return boolean if password provided is valid for current user | ||
149 | + */ | ||
150 | + public function validatePassword($password) | ||
151 | + { | ||
152 | + return Yii::$app->security->validatePassword($password, $this->password_hash); | ||
153 | + } | ||
154 | + | ||
155 | + /** | ||
156 | + * Generates password hash from password and sets it to the model | ||
157 | + * | ||
158 | + * @param string $password | ||
159 | + */ | ||
160 | + public function setPassword($password) | ||
161 | + { | ||
162 | + $this->password_hash = Yii::$app->security->generatePasswordHash($password); | ||
163 | + } | ||
164 | + | ||
165 | + /** | ||
166 | + * Generates "remember me" authentication key | ||
167 | + */ | ||
168 | + public function generateAuthKey() | ||
169 | + { | ||
170 | + $this->auth_key = Yii::$app->security->generateRandomString(); | ||
171 | + } | ||
172 | + | ||
173 | + /** | ||
174 | + * Generates new password reset token | ||
175 | + */ | ||
176 | + public function generatePasswordResetToken() | ||
177 | + { | ||
178 | + $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); | ||
179 | + } | ||
180 | + | ||
181 | + /** | ||
182 | + * Removes password reset token | ||
183 | + */ | ||
184 | + public function removePasswordResetToken() | ||
185 | + { | ||
186 | + $this->password_reset_token = null; | ||
187 | + } | ||
188 | +} |
1 | +++ a/composer.json | ||
1 | +{ | ||
2 | + "name": "yiisoft/yii2-app-advanced", | ||
3 | + "description": "Yii 2 Advanced Project Template", | ||
4 | + "keywords": ["yii2", "framework", "advanced", "project template"], | ||
5 | + "homepage": "http://www.yiiframework.com/", | ||
6 | + "type": "project", | ||
7 | + "license": "BSD-3-Clause", | ||
8 | + "support": { | ||
9 | + "issues": "https://github.com/yiisoft/yii2/issues?state=open", | ||
10 | + "forum": "http://www.yiiframework.com/forum/", | ||
11 | + "wiki": "http://www.yiiframework.com/wiki/", | ||
12 | + "irc": "irc://irc.freenode.net/yii", | ||
13 | + "source": "https://github.com/yiisoft/yii2" | ||
14 | + }, | ||
15 | + "minimum-stability": "stable", | ||
16 | + "require": { | ||
17 | + "php": ">=5.4.0", | ||
18 | + "yiisoft/yii2": ">=2.0.4", | ||
19 | + "yiisoft/yii2-bootstrap": "*", | ||
20 | + "yiisoft/yii2-swiftmailer": "*", | ||
21 | + "yiisoft/yii2-imagine": "~2.0.0", | ||
22 | + "kartik-v/yii2-widget-fileinput": "@dev" | ||
23 | + }, | ||
24 | + "require-dev": { | ||
25 | + "yiisoft/yii2-codeception": "*", | ||
26 | + "yiisoft/yii2-debug": "*", | ||
27 | + "yiisoft/yii2-gii": "*", | ||
28 | + "yiisoft/yii2-faker": "*", | ||
29 | + "yiisoft/yii2-imagine": "~2.0.0" | ||
30 | + }, | ||
31 | + "config": { | ||
32 | + "process-timeout": 1800 | ||
33 | + }, | ||
34 | + "extra": { | ||
35 | + "asset-installer-paths": { | ||
36 | + "npm-asset-library": "vendor/npm", | ||
37 | + "bower-asset-library": "vendor/bower" | ||
38 | + } | ||
39 | + } | ||
40 | +} |
1 | +++ a/composer.lock | ||
1 | +{ | ||
2 | + "_readme": [ | ||
3 | + "This file locks the dependencies of your project to a known state", | ||
4 | + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", | ||
5 | + "This file is @generated automatically" | ||
6 | + ], | ||
7 | + "hash": "ff5bec9bbd6546ea49291f5e366ffeed", | ||
8 | + "content-hash": "5ff673161b2e2d58895f013dd3ce2851", | ||
9 | + "packages": [ | ||
10 | + { | ||
11 | + "name": "bower-asset/bootstrap", | ||
12 | + "version": "v3.3.5", | ||
13 | + "source": { | ||
14 | + "type": "git", | ||
15 | + "url": "https://github.com/twbs/bootstrap.git", | ||
16 | + "reference": "16b48259a62f576e52c903c476bd42b90ab22482" | ||
17 | + }, | ||
18 | + "dist": { | ||
19 | + "type": "zip", | ||
20 | + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/16b48259a62f576e52c903c476bd42b90ab22482", | ||
21 | + "reference": "16b48259a62f576e52c903c476bd42b90ab22482", | ||
22 | + "shasum": "" | ||
23 | + }, | ||
24 | + "require": { | ||
25 | + "bower-asset/jquery": ">=1.9.1" | ||
26 | + }, | ||
27 | + "type": "bower-asset-library", | ||
28 | + "extra": { | ||
29 | + "bower-asset-main": [ | ||
30 | + "less/bootstrap.less", | ||
31 | + "dist/js/bootstrap.js" | ||
32 | + ], | ||
33 | + "bower-asset-ignore": [ | ||
34 | + "/.*", | ||
35 | + "_config.yml", | ||
36 | + "CNAME", | ||
37 | + "composer.json", | ||
38 | + "CONTRIBUTING.md", | ||
39 | + "docs", | ||
40 | + "js/tests", | ||
41 | + "test-infra" | ||
42 | + ] | ||
43 | + }, | ||
44 | + "license": [ | ||
45 | + "MIT" | ||
46 | + ], | ||
47 | + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", | ||
48 | + "keywords": [ | ||
49 | + "css", | ||
50 | + "framework", | ||
51 | + "front-end", | ||
52 | + "js", | ||
53 | + "less", | ||
54 | + "mobile-first", | ||
55 | + "responsive", | ||
56 | + "web" | ||
57 | + ] | ||
58 | + }, | ||
59 | + { | ||
60 | + "name": "bower-asset/jquery", | ||
61 | + "version": "2.1.4", | ||
62 | + "source": { | ||
63 | + "type": "git", | ||
64 | + "url": "https://github.com/jquery/jquery.git", | ||
65 | + "reference": "7751e69b615c6eca6f783a81e292a55725af6b85" | ||
66 | + }, | ||
67 | + "dist": { | ||
68 | + "type": "zip", | ||
69 | + "url": "https://api.github.com/repos/jquery/jquery/zipball/7751e69b615c6eca6f783a81e292a55725af6b85", | ||
70 | + "reference": "7751e69b615c6eca6f783a81e292a55725af6b85", | ||
71 | + "shasum": "" | ||
72 | + }, | ||
73 | + "require-dev": { | ||
74 | + "bower-asset/qunit": "1.14.0", | ||
75 | + "bower-asset/requirejs": "2.1.10", | ||
76 | + "bower-asset/sinon": "1.8.1", | ||
77 | + "bower-asset/sizzle": "2.1.1-patch2" | ||
78 | + }, | ||
79 | + "type": "bower-asset-library", | ||
80 | + "extra": { | ||
81 | + "bower-asset-main": "dist/jquery.js", | ||
82 | + "bower-asset-ignore": [ | ||
83 | + "**/.*", | ||
84 | + "build", | ||
85 | + "dist/cdn", | ||
86 | + "speed", | ||
87 | + "test", | ||
88 | + "*.md", | ||
89 | + "AUTHORS.txt", | ||
90 | + "Gruntfile.js", | ||
91 | + "package.json" | ||
92 | + ] | ||
93 | + }, | ||
94 | + "license": [ | ||
95 | + "MIT" | ||
96 | + ], | ||
97 | + "keywords": [ | ||
98 | + "javascript", | ||
99 | + "jquery", | ||
100 | + "library" | ||
101 | + ] | ||
102 | + }, | ||
103 | + { | ||
104 | + "name": "bower-asset/jquery.inputmask", | ||
105 | + "version": "3.1.63", | ||
106 | + "source": { | ||
107 | + "type": "git", | ||
108 | + "url": "https://github.com/RobinHerbots/jquery.inputmask.git", | ||
109 | + "reference": "c40c7287eadc31e341ebbf0c02352eb55b9cbc48" | ||
110 | + }, | ||
111 | + "dist": { | ||
112 | + "type": "zip", | ||
113 | + "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/c40c7287eadc31e341ebbf0c02352eb55b9cbc48", | ||
114 | + "reference": "c40c7287eadc31e341ebbf0c02352eb55b9cbc48", | ||
115 | + "shasum": "" | ||
116 | + }, | ||
117 | + "require": { | ||
118 | + "bower-asset/jquery": ">=1.7" | ||
119 | + }, | ||
120 | + "type": "bower-asset-library", | ||
121 | + "extra": { | ||
122 | + "bower-asset-main": [ | ||
123 | + "./dist/inputmask/jquery.inputmask.js", | ||
124 | + "./dist/inputmask/jquery.inputmask.extensions.js", | ||
125 | + "./dist/inputmask/jquery.inputmask.date.extensions.js", | ||
126 | + "./dist/inputmask/jquery.inputmask.numeric.extensions.js", | ||
127 | + "./dist/inputmask/jquery.inputmask.phone.extensions.js", | ||
128 | + "./dist/inputmask/jquery.inputmask.regex.extensions.js" | ||
129 | + ], | ||
130 | + "bower-asset-ignore": [ | ||
131 | + "**/.*", | ||
132 | + "qunit/", | ||
133 | + "nuget/", | ||
134 | + "tools/", | ||
135 | + "js/", | ||
136 | + "*.md", | ||
137 | + "build.properties", | ||
138 | + "build.xml", | ||
139 | + "jquery.inputmask.jquery.json" | ||
140 | + ] | ||
141 | + }, | ||
142 | + "license": [ | ||
143 | + "http://opensource.org/licenses/mit-license.php" | ||
144 | + ], | ||
145 | + "description": "jquery.inputmask is a jquery plugin which create an input mask.", | ||
146 | + "keywords": [ | ||
147 | + "form", | ||
148 | + "input", | ||
149 | + "inputmask", | ||
150 | + "jquery", | ||
151 | + "mask", | ||
152 | + "plugins" | ||
153 | + ] | ||
154 | + }, | ||
155 | + { | ||
156 | + "name": "bower-asset/punycode", | ||
157 | + "version": "v1.3.2", | ||
158 | + "source": { | ||
159 | + "type": "git", | ||
160 | + "url": "https://github.com/bestiejs/punycode.js.git", | ||
161 | + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" | ||
162 | + }, | ||
163 | + "dist": { | ||
164 | + "type": "zip", | ||
165 | + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", | ||
166 | + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", | ||
167 | + "shasum": "" | ||
168 | + }, | ||
169 | + "type": "bower-asset-library", | ||
170 | + "extra": { | ||
171 | + "bower-asset-main": "punycode.js", | ||
172 | + "bower-asset-ignore": [ | ||
173 | + "coverage", | ||
174 | + "tests", | ||
175 | + ".*", | ||
176 | + "component.json", | ||
177 | + "Gruntfile.js", | ||
178 | + "node_modules", | ||
179 | + "package.json" | ||
180 | + ] | ||
181 | + } | ||
182 | + }, | ||
183 | + { | ||
184 | + "name": "bower-asset/yii2-pjax", | ||
185 | + "version": "v2.0.4", | ||
186 | + "source": { | ||
187 | + "type": "git", | ||
188 | + "url": "https://github.com/yiisoft/jquery-pjax.git", | ||
189 | + "reference": "3f20897307cca046fca5323b318475ae9dac0ca0" | ||
190 | + }, | ||
191 | + "dist": { | ||
192 | + "type": "zip", | ||
193 | + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/3f20897307cca046fca5323b318475ae9dac0ca0", | ||
194 | + "reference": "3f20897307cca046fca5323b318475ae9dac0ca0", | ||
195 | + "shasum": "" | ||
196 | + }, | ||
197 | + "require": { | ||
198 | + "bower-asset/jquery": ">=1.8" | ||
199 | + }, | ||
200 | + "type": "bower-asset-library", | ||
201 | + "extra": { | ||
202 | + "bower-asset-main": "./jquery.pjax.js", | ||
203 | + "bower-asset-ignore": [ | ||
204 | + ".travis.yml", | ||
205 | + "Gemfile", | ||
206 | + "Gemfile.lock", | ||
207 | + "vendor/", | ||
208 | + "script/", | ||
209 | + "test/" | ||
210 | + ] | ||
211 | + }, | ||
212 | + "license": [ | ||
213 | + "MIT" | ||
214 | + ] | ||
215 | + }, | ||
216 | + { | ||
217 | + "name": "cebe/markdown", | ||
218 | + "version": "1.1.0", | ||
219 | + "source": { | ||
220 | + "type": "git", | ||
221 | + "url": "https://github.com/cebe/markdown.git", | ||
222 | + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2" | ||
223 | + }, | ||
224 | + "dist": { | ||
225 | + "type": "zip", | ||
226 | + "url": "https://api.github.com/repos/cebe/markdown/zipball/54a2c49de31cc44e864ebf0500a35ef21d0010b2", | ||
227 | + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2", | ||
228 | + "shasum": "" | ||
229 | + }, | ||
230 | + "require": { | ||
231 | + "lib-pcre": "*", | ||
232 | + "php": ">=5.4.0" | ||
233 | + }, | ||
234 | + "require-dev": { | ||
235 | + "cebe/indent": "*", | ||
236 | + "facebook/xhprof": "*@dev", | ||
237 | + "phpunit/phpunit": "4.1.*" | ||
238 | + }, | ||
239 | + "bin": [ | ||
240 | + "bin/markdown" | ||
241 | + ], | ||
242 | + "type": "library", | ||
243 | + "extra": { | ||
244 | + "branch-alias": { | ||
245 | + "dev-master": "1.1.x-dev" | ||
246 | + } | ||
247 | + }, | ||
248 | + "autoload": { | ||
249 | + "psr-4": { | ||
250 | + "cebe\\markdown\\": "" | ||
251 | + } | ||
252 | + }, | ||
253 | + "notification-url": "https://packagist.org/downloads/", | ||
254 | + "license": [ | ||
255 | + "MIT" | ||
256 | + ], | ||
257 | + "authors": [ | ||
258 | + { | ||
259 | + "name": "Carsten Brandt", | ||
260 | + "email": "mail@cebe.cc", | ||
261 | + "homepage": "http://cebe.cc/", | ||
262 | + "role": "Creator" | ||
263 | + } | ||
264 | + ], | ||
265 | + "description": "A super fast, highly extensible markdown parser for PHP", | ||
266 | + "homepage": "https://github.com/cebe/markdown#readme", | ||
267 | + "keywords": [ | ||
268 | + "extensible", | ||
269 | + "fast", | ||
270 | + "gfm", | ||
271 | + "markdown", | ||
272 | + "markdown-extra" | ||
273 | + ], | ||
274 | + "time": "2015-03-06 05:28:07" | ||
275 | + }, | ||
276 | + { | ||
277 | + "name": "ezyang/htmlpurifier", | ||
278 | + "version": "v4.6.0", | ||
279 | + "source": { | ||
280 | + "type": "git", | ||
281 | + "url": "https://github.com/ezyang/htmlpurifier.git", | ||
282 | + "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd" | ||
283 | + }, | ||
284 | + "dist": { | ||
285 | + "type": "zip", | ||
286 | + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/6f389f0f25b90d0b495308efcfa073981177f0fd", | ||
287 | + "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd", | ||
288 | + "shasum": "" | ||
289 | + }, | ||
290 | + "require": { | ||
291 | + "php": ">=5.2" | ||
292 | + }, | ||
293 | + "type": "library", | ||
294 | + "autoload": { | ||
295 | + "psr-0": { | ||
296 | + "HTMLPurifier": "library/" | ||
297 | + }, | ||
298 | + "files": [ | ||
299 | + "library/HTMLPurifier.composer.php" | ||
300 | + ] | ||
301 | + }, | ||
302 | + "notification-url": "https://packagist.org/downloads/", | ||
303 | + "license": [ | ||
304 | + "LGPL" | ||
305 | + ], | ||
306 | + "authors": [ | ||
307 | + { | ||
308 | + "name": "Edward Z. Yang", | ||
309 | + "email": "admin@htmlpurifier.org", | ||
310 | + "homepage": "http://ezyang.com" | ||
311 | + } | ||
312 | + ], | ||
313 | + "description": "Standards compliant HTML filter written in PHP", | ||
314 | + "homepage": "http://htmlpurifier.org/", | ||
315 | + "keywords": [ | ||
316 | + "html" | ||
317 | + ], | ||
318 | + "time": "2013-11-30 08:25:19" | ||
319 | + }, | ||
320 | + { | ||
321 | + "name": "imagine/imagine", | ||
322 | + "version": "v0.5.0", | ||
323 | + "source": { | ||
324 | + "type": "git", | ||
325 | + "url": "https://github.com/avalanche123/Imagine.git", | ||
326 | + "reference": "f64ec666baaa800edcbf237db41121a569230709" | ||
327 | + }, | ||
328 | + "dist": { | ||
329 | + "type": "zip", | ||
330 | + "url": "https://api.github.com/repos/avalanche123/Imagine/zipball/f64ec666baaa800edcbf237db41121a569230709", | ||
331 | + "reference": "f64ec666baaa800edcbf237db41121a569230709", | ||
332 | + "shasum": "" | ||
333 | + }, | ||
334 | + "require": { | ||
335 | + "php": ">=5.3.2" | ||
336 | + }, | ||
337 | + "require-dev": { | ||
338 | + "sami/sami": "dev-master" | ||
339 | + }, | ||
340 | + "suggest": { | ||
341 | + "ext-gd": "to use the GD implementation", | ||
342 | + "ext-gmagick": "to use the Gmagick implementation", | ||
343 | + "ext-imagick": "to use the Imagick implementation" | ||
344 | + }, | ||
345 | + "type": "library", | ||
346 | + "autoload": { | ||
347 | + "psr-0": { | ||
348 | + "Imagine": "lib/" | ||
349 | + } | ||
350 | + }, | ||
351 | + "notification-url": "https://packagist.org/downloads/", | ||
352 | + "license": [ | ||
353 | + "MIT" | ||
354 | + ], | ||
355 | + "authors": [ | ||
356 | + { | ||
357 | + "name": "Bulat Shakirzyanov", | ||
358 | + "email": "mallluhuct@gmail.com", | ||
359 | + "homepage": "http://avalanche123.com" | ||
360 | + } | ||
361 | + ], | ||
362 | + "description": "Image processing for PHP 5.3", | ||
363 | + "homepage": "http://imagine.readthedocs.org/", | ||
364 | + "keywords": [ | ||
365 | + "drawing", | ||
366 | + "graphics", | ||
367 | + "image manipulation", | ||
368 | + "image processing" | ||
369 | + ], | ||
370 | + "time": "2013-07-10 17:25:36" | ||
371 | + }, | ||
372 | + { | ||
373 | + "name": "kartik-v/bootstrap-fileinput", | ||
374 | + "version": "v4.2.7", | ||
375 | + "source": { | ||
376 | + "type": "git", | ||
377 | + "url": "https://github.com/kartik-v/bootstrap-fileinput.git", | ||
378 | + "reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78" | ||
379 | + }, | ||
380 | + "dist": { | ||
381 | + "type": "zip", | ||
382 | + "url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/0468bbba9c28c1250aca83eba9b33e32ec135f78", | ||
383 | + "reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78", | ||
384 | + "shasum": "" | ||
385 | + }, | ||
386 | + "type": "library", | ||
387 | + "autoload": { | ||
388 | + "psr-4": { | ||
389 | + "kartik\\plugins\\fileinput\\": "" | ||
390 | + } | ||
391 | + }, | ||
392 | + "notification-url": "https://packagist.org/downloads/", | ||
393 | + "license": [ | ||
394 | + "BSD-3-Clause" | ||
395 | + ], | ||
396 | + "authors": [ | ||
397 | + { | ||
398 | + "name": "Kartik Visweswaran", | ||
399 | + "email": "kartikv2@gmail.com", | ||
400 | + "homepage": "http://www.krajee.com/" | ||
401 | + } | ||
402 | + ], | ||
403 | + "description": "An enhanced HTML 5 file input for Bootstrap 3.x with features for file preview for many file types, multiple selection, ajax uploads, and more.", | ||
404 | + "homepage": "https://github.com/kartik-v/bootstrap-fileinput", | ||
405 | + "keywords": [ | ||
406 | + "ajax", | ||
407 | + "bootstrap", | ||
408 | + "delete", | ||
409 | + "file", | ||
410 | + "image", | ||
411 | + "input", | ||
412 | + "jquery", | ||
413 | + "multiple", | ||
414 | + "preview", | ||
415 | + "progress", | ||
416 | + "upload" | ||
417 | + ], | ||
418 | + "time": "2015-09-13 17:39:44" | ||
419 | + }, | ||
420 | + { | ||
421 | + "name": "kartik-v/yii2-krajee-base", | ||
422 | + "version": "v1.7.7", | ||
423 | + "source": { | ||
424 | + "type": "git", | ||
425 | + "url": "https://github.com/kartik-v/yii2-krajee-base.git", | ||
426 | + "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19" | ||
427 | + }, | ||
428 | + "dist": { | ||
429 | + "type": "zip", | ||
430 | + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", | ||
431 | + "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", | ||
432 | + "shasum": "" | ||
433 | + }, | ||
434 | + "require": { | ||
435 | + "yiisoft/yii2-bootstrap": "@dev" | ||
436 | + }, | ||
437 | + "type": "yii2-extension", | ||
438 | + "autoload": { | ||
439 | + "psr-4": { | ||
440 | + "kartik\\base\\": "" | ||
441 | + } | ||
442 | + }, | ||
443 | + "notification-url": "https://packagist.org/downloads/", | ||
444 | + "license": [ | ||
445 | + "BSD-3-Clause" | ||
446 | + ], | ||
447 | + "authors": [ | ||
448 | + { | ||
449 | + "name": "Kartik Visweswaran", | ||
450 | + "email": "kartikv2@gmail.com", | ||
451 | + "homepage": "http://www.krajee.com/" | ||
452 | + } | ||
453 | + ], | ||
454 | + "description": "Base library and foundation components for all Yii2 Krajee extensions.", | ||
455 | + "homepage": "https://github.com/kartik-v/yii2-krajee-base", | ||
456 | + "keywords": [ | ||
457 | + "base", | ||
458 | + "extension", | ||
459 | + "foundation", | ||
460 | + "krajee", | ||
461 | + "widget", | ||
462 | + "yii2" | ||
463 | + ], | ||
464 | + "time": "2015-06-16 05:19:57" | ||
465 | + }, | ||
466 | + { | ||
467 | + "name": "kartik-v/yii2-widget-fileinput", | ||
468 | + "version": "dev-master", | ||
469 | + "source": { | ||
470 | + "type": "git", | ||
471 | + "url": "https://github.com/kartik-v/yii2-widget-fileinput.git", | ||
472 | + "reference": "084447f095888ddb09a95a1a363842ca87e01c9d" | ||
473 | + }, | ||
474 | + "dist": { | ||
475 | + "type": "zip", | ||
476 | + "url": "https://api.github.com/repos/kartik-v/yii2-widget-fileinput/zipball/084447f095888ddb09a95a1a363842ca87e01c9d", | ||
477 | + "reference": "084447f095888ddb09a95a1a363842ca87e01c9d", | ||
478 | + "shasum": "" | ||
479 | + }, | ||
480 | + "require": { | ||
481 | + "kartik-v/bootstrap-fileinput": "~4.2", | ||
482 | + "kartik-v/yii2-krajee-base": "~1.7" | ||
483 | + }, | ||
484 | + "type": "yii2-extension", | ||
485 | + "autoload": { | ||
486 | + "psr-4": { | ||
487 | + "kartik\\file\\": "" | ||
488 | + } | ||
489 | + }, | ||
490 | + "notification-url": "https://packagist.org/downloads/", | ||
491 | + "license": [ | ||
492 | + "BSD-3-Clause" | ||
493 | + ], | ||
494 | + "authors": [ | ||
495 | + { | ||
496 | + "name": "Kartik Visweswaran", | ||
497 | + "email": "kartikv2@gmail.com", | ||
498 | + "homepage": "http://www.krajee.com/" | ||
499 | + } | ||
500 | + ], | ||
501 | + "description": "An enhanced FileInput widget for Bootstrap 3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)", | ||
502 | + "homepage": "https://github.com/kartik-v/yii2-widget-fileinput", | ||
503 | + "keywords": [ | ||
504 | + "extension", | ||
505 | + "file", | ||
506 | + "form", | ||
507 | + "input", | ||
508 | + "jquery", | ||
509 | + "plugin", | ||
510 | + "upload", | ||
511 | + "widget", | ||
512 | + "yii2" | ||
513 | + ], | ||
514 | + "time": "2015-08-17 13:03:50" | ||
515 | + }, | ||
516 | + { | ||
517 | + "name": "swiftmailer/swiftmailer", | ||
518 | + "version": "v5.4.1", | ||
519 | + "source": { | ||
520 | + "type": "git", | ||
521 | + "url": "https://github.com/swiftmailer/swiftmailer.git", | ||
522 | + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" | ||
523 | + }, | ||
524 | + "dist": { | ||
525 | + "type": "zip", | ||
526 | + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", | ||
527 | + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", | ||
528 | + "shasum": "" | ||
529 | + }, | ||
530 | + "require": { | ||
531 | + "php": ">=5.3.3" | ||
532 | + }, | ||
533 | + "require-dev": { | ||
534 | + "mockery/mockery": "~0.9.1,<0.9.4" | ||
535 | + }, | ||
536 | + "type": "library", | ||
537 | + "extra": { | ||
538 | + "branch-alias": { | ||
539 | + "dev-master": "5.4-dev" | ||
540 | + } | ||
541 | + }, | ||
542 | + "autoload": { | ||
543 | + "files": [ | ||
544 | + "lib/swift_required.php" | ||
545 | + ] | ||
546 | + }, | ||
547 | + "notification-url": "https://packagist.org/downloads/", | ||
548 | + "license": [ | ||
549 | + "MIT" | ||
550 | + ], | ||
551 | + "authors": [ | ||
552 | + { | ||
553 | + "name": "Chris Corbyn" | ||
554 | + }, | ||
555 | + { | ||
556 | + "name": "Fabien Potencier", | ||
557 | + "email": "fabien@symfony.com" | ||
558 | + } | ||
559 | + ], | ||
560 | + "description": "Swiftmailer, free feature-rich PHP mailer", | ||
561 | + "homepage": "http://swiftmailer.org", | ||
562 | + "keywords": [ | ||
563 | + "email", | ||
564 | + "mail", | ||
565 | + "mailer" | ||
566 | + ], | ||
567 | + "time": "2015-06-06 14:19:39" | ||
568 | + }, | ||
569 | + { | ||
570 | + "name": "yiisoft/yii2", | ||
571 | + "version": "2.0.6", | ||
572 | + "source": { | ||
573 | + "type": "git", | ||
574 | + "url": "https://github.com/yiisoft/yii2-framework.git", | ||
575 | + "reference": "f42b2eb80f61992438661b01d0d74c6738e2ff38" | ||
576 | + }, | ||
577 | + "dist": { | ||
578 | + "type": "zip", | ||
579 | + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/f42b2eb80f61992438661b01d0d74c6738e2ff38", | ||
580 | + "reference": "f42b2eb80f61992438661b01d0d74c6738e2ff38", | ||
581 | + "shasum": "" | ||
582 | + }, | ||
583 | + "require": { | ||
584 | + "bower-asset/jquery": "2.1.*@stable | 1.11.*@stable", | ||
585 | + "bower-asset/jquery.inputmask": "3.1.*", | ||
586 | + "bower-asset/punycode": "1.3.*", | ||
587 | + "bower-asset/yii2-pjax": ">=2.0.1", | ||
588 | + "cebe/markdown": "~1.0.0 | ~1.1.0", | ||
589 | + "ext-mbstring": "*", | ||
590 | + "ezyang/htmlpurifier": "4.6.*", | ||
591 | + "lib-pcre": "*", | ||
592 | + "php": ">=5.4.0", | ||
593 | + "yiisoft/yii2-composer": "*" | ||
594 | + }, | ||
595 | + "bin": [ | ||
596 | + "yii" | ||
597 | + ], | ||
598 | + "type": "library", | ||
599 | + "extra": { | ||
600 | + "branch-alias": { | ||
601 | + "dev-master": "2.0.x-dev" | ||
602 | + } | ||
603 | + }, | ||
604 | + "autoload": { | ||
605 | + "psr-4": { | ||
606 | + "yii\\": "" | ||
607 | + } | ||
608 | + }, | ||
609 | + "notification-url": "https://packagist.org/downloads/", | ||
610 | + "license": [ | ||
611 | + "BSD-3-Clause" | ||
612 | + ], | ||
613 | + "authors": [ | ||
614 | + { | ||
615 | + "name": "Qiang Xue", | ||
616 | + "email": "qiang.xue@gmail.com", | ||
617 | + "homepage": "http://www.yiiframework.com/", | ||
618 | + "role": "Founder and project lead" | ||
619 | + }, | ||
620 | + { | ||
621 | + "name": "Alexander Makarov", | ||
622 | + "email": "sam@rmcreative.ru", | ||
623 | + "homepage": "http://rmcreative.ru/", | ||
624 | + "role": "Core framework development" | ||
625 | + }, | ||
626 | + { | ||
627 | + "name": "Maurizio Domba", | ||
628 | + "homepage": "http://mdomba.info/", | ||
629 | + "role": "Core framework development" | ||
630 | + }, | ||
631 | + { | ||
632 | + "name": "Carsten Brandt", | ||
633 | + "email": "mail@cebe.cc", | ||
634 | + "homepage": "http://cebe.cc/", | ||
635 | + "role": "Core framework development" | ||
636 | + }, | ||
637 | + { | ||
638 | + "name": "Timur Ruziev", | ||
639 | + "email": "resurtm@gmail.com", | ||
640 | + "homepage": "http://resurtm.com/", | ||
641 | + "role": "Core framework development" | ||
642 | + }, | ||
643 | + { | ||
644 | + "name": "Paul Klimov", | ||
645 | + "email": "klimov.paul@gmail.com", | ||
646 | + "role": "Core framework development" | ||
647 | + } | ||
648 | + ], | ||
649 | + "description": "Yii PHP Framework Version 2", | ||
650 | + "homepage": "http://www.yiiframework.com/", | ||
651 | + "keywords": [ | ||
652 | + "framework", | ||
653 | + "yii2" | ||
654 | + ], | ||
655 | + "time": "2015-08-05 22:00:30" | ||
656 | + }, | ||
657 | + { | ||
658 | + "name": "yiisoft/yii2-bootstrap", | ||
659 | + "version": "2.0.5", | ||
660 | + "source": { | ||
661 | + "type": "git", | ||
662 | + "url": "https://github.com/yiisoft/yii2-bootstrap.git", | ||
663 | + "reference": "1464f93834b1d5edb1f5625f7ffd6c3723fa4923" | ||
664 | + }, | ||
665 | + "dist": { | ||
666 | + "type": "zip", | ||
667 | + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/1464f93834b1d5edb1f5625f7ffd6c3723fa4923", | ||
668 | + "reference": "1464f93834b1d5edb1f5625f7ffd6c3723fa4923", | ||
669 | + "shasum": "" | ||
670 | + }, | ||
671 | + "require": { | ||
672 | + "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", | ||
673 | + "yiisoft/yii2": ">=2.0.6" | ||
674 | + }, | ||
675 | + "type": "yii2-extension", | ||
676 | + "extra": { | ||
677 | + "branch-alias": { | ||
678 | + "dev-master": "2.0.x-dev" | ||
679 | + }, | ||
680 | + "asset-installer-paths": { | ||
681 | + "npm-asset-library": "vendor/npm", | ||
682 | + "bower-asset-library": "vendor/bower" | ||
683 | + } | ||
684 | + }, | ||
685 | + "autoload": { | ||
686 | + "psr-4": { | ||
687 | + "yii\\bootstrap\\": "" | ||
688 | + } | ||
689 | + }, | ||
690 | + "notification-url": "https://packagist.org/downloads/", | ||
691 | + "license": [ | ||
692 | + "BSD-3-Clause" | ||
693 | + ], | ||
694 | + "authors": [ | ||
695 | + { | ||
696 | + "name": "Qiang Xue", | ||
697 | + "email": "qiang.xue@gmail.com" | ||
698 | + } | ||
699 | + ], | ||
700 | + "description": "The Twitter Bootstrap extension for the Yii framework", | ||
701 | + "keywords": [ | ||
702 | + "bootstrap", | ||
703 | + "yii2" | ||
704 | + ], | ||
705 | + "time": "2015-09-23 17:48:24" | ||
706 | + }, | ||
707 | + { | ||
708 | + "name": "yiisoft/yii2-composer", | ||
709 | + "version": "2.0.3", | ||
710 | + "source": { | ||
711 | + "type": "git", | ||
712 | + "url": "https://github.com/yiisoft/yii2-composer.git", | ||
713 | + "reference": "ca8d23707ae47d20b0454e4b135c156f6da6d7be" | ||
714 | + }, | ||
715 | + "dist": { | ||
716 | + "type": "zip", | ||
717 | + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/ca8d23707ae47d20b0454e4b135c156f6da6d7be", | ||
718 | + "reference": "ca8d23707ae47d20b0454e4b135c156f6da6d7be", | ||
719 | + "shasum": "" | ||
720 | + }, | ||
721 | + "require": { | ||
722 | + "composer-plugin-api": "1.0.0" | ||
723 | + }, | ||
724 | + "type": "composer-plugin", | ||
725 | + "extra": { | ||
726 | + "class": "yii\\composer\\Plugin", | ||
727 | + "branch-alias": { | ||
728 | + "dev-master": "2.0.x-dev" | ||
729 | + } | ||
730 | + }, | ||
731 | + "autoload": { | ||
732 | + "psr-4": { | ||
733 | + "yii\\composer\\": "" | ||
734 | + } | ||
735 | + }, | ||
736 | + "notification-url": "https://packagist.org/downloads/", | ||
737 | + "license": [ | ||
738 | + "BSD-3-Clause" | ||
739 | + ], | ||
740 | + "authors": [ | ||
741 | + { | ||
742 | + "name": "Qiang Xue", | ||
743 | + "email": "qiang.xue@gmail.com" | ||
744 | + } | ||
745 | + ], | ||
746 | + "description": "The composer plugin for Yii extension installer", | ||
747 | + "keywords": [ | ||
748 | + "composer", | ||
749 | + "extension installer", | ||
750 | + "yii2" | ||
751 | + ], | ||
752 | + "time": "2015-03-01 06:22:44" | ||
753 | + }, | ||
754 | + { | ||
755 | + "name": "yiisoft/yii2-imagine", | ||
756 | + "version": "2.0.3", | ||
757 | + "source": { | ||
758 | + "type": "git", | ||
759 | + "url": "https://github.com/yiisoft/yii2-imagine.git", | ||
760 | + "reference": "0961343138b65bba447de84b2b300899617e6acc" | ||
761 | + }, | ||
762 | + "dist": { | ||
763 | + "type": "zip", | ||
764 | + "url": "https://api.github.com/repos/yiisoft/yii2-imagine/zipball/0961343138b65bba447de84b2b300899617e6acc", | ||
765 | + "reference": "0961343138b65bba447de84b2b300899617e6acc", | ||
766 | + "shasum": "" | ||
767 | + }, | ||
768 | + "require": { | ||
769 | + "imagine/imagine": "0.5.*", | ||
770 | + "yiisoft/yii2": "*" | ||
771 | + }, | ||
772 | + "type": "yii2-extension", | ||
773 | + "extra": { | ||
774 | + "branch-alias": { | ||
775 | + "dev-master": "2.0.x-dev" | ||
776 | + } | ||
777 | + }, | ||
778 | + "autoload": { | ||
779 | + "psr-4": { | ||
780 | + "yii\\imagine\\": "" | ||
781 | + } | ||
782 | + }, | ||
783 | + "notification-url": "https://packagist.org/downloads/", | ||
784 | + "license": [ | ||
785 | + "BSD-3-Clause" | ||
786 | + ], | ||
787 | + "authors": [ | ||
788 | + { | ||
789 | + "name": "Antonio Ramirez", | ||
790 | + "email": "amigo.cobos@gmail.com" | ||
791 | + } | ||
792 | + ], | ||
793 | + "description": "The Imagine integration for the Yii framework", | ||
794 | + "keywords": [ | ||
795 | + "helper", | ||
796 | + "image", | ||
797 | + "imagine", | ||
798 | + "yii2" | ||
799 | + ], | ||
800 | + "time": "2015-03-01 06:22:44" | ||
801 | + }, | ||
802 | + { | ||
803 | + "name": "yiisoft/yii2-swiftmailer", | ||
804 | + "version": "2.0.4", | ||
805 | + "source": { | ||
806 | + "type": "git", | ||
807 | + "url": "https://github.com/yiisoft/yii2-swiftmailer.git", | ||
808 | + "reference": "4ec435a89e30b203cea99770910fb5499cb3627a" | ||
809 | + }, | ||
810 | + "dist": { | ||
811 | + "type": "zip", | ||
812 | + "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/4ec435a89e30b203cea99770910fb5499cb3627a", | ||
813 | + "reference": "4ec435a89e30b203cea99770910fb5499cb3627a", | ||
814 | + "shasum": "" | ||
815 | + }, | ||
816 | + "require": { | ||
817 | + "swiftmailer/swiftmailer": "~5.0", | ||
818 | + "yiisoft/yii2": ">=2.0.4" | ||
819 | + }, | ||
820 | + "type": "yii2-extension", | ||
821 | + "extra": { | ||
822 | + "branch-alias": { | ||
823 | + "dev-master": "2.0.x-dev" | ||
824 | + } | ||
825 | + }, | ||
826 | + "autoload": { | ||
827 | + "psr-4": { | ||
828 | + "yii\\swiftmailer\\": "" | ||
829 | + } | ||
830 | + }, | ||
831 | + "notification-url": "https://packagist.org/downloads/", | ||
832 | + "license": [ | ||
833 | + "BSD-3-Clause" | ||
834 | + ], | ||
835 | + "authors": [ | ||
836 | + { | ||
837 | + "name": "Paul Klimov", | ||
838 | + "email": "klimov.paul@gmail.com" | ||
839 | + } | ||
840 | + ], | ||
841 | + "description": "The SwiftMailer integration for the Yii framework", | ||
842 | + "keywords": [ | ||
843 | + "email", | ||
844 | + "mail", | ||
845 | + "mailer", | ||
846 | + "swift", | ||
847 | + "swiftmailer", | ||
848 | + "yii2" | ||
849 | + ], | ||
850 | + "time": "2015-05-10 22:12:32" | ||
851 | + } | ||
852 | + ], | ||
853 | + "packages-dev": [ | ||
854 | + { | ||
855 | + "name": "bower-asset/typeahead.js", | ||
856 | + "version": "v0.10.5", | ||
857 | + "source": { | ||
858 | + "type": "git", | ||
859 | + "url": "https://github.com/twitter/typeahead.js.git", | ||
860 | + "reference": "5f198b87d1af845da502ea9df93a5e84801ce742" | ||
861 | + }, | ||
862 | + "dist": { | ||
863 | + "type": "zip", | ||
864 | + "url": "https://api.github.com/repos/twitter/typeahead.js/zipball/5f198b87d1af845da502ea9df93a5e84801ce742", | ||
865 | + "reference": "5f198b87d1af845da502ea9df93a5e84801ce742", | ||
866 | + "shasum": "" | ||
867 | + }, | ||
868 | + "require": { | ||
869 | + "bower-asset/jquery": ">=1.7" | ||
870 | + }, | ||
871 | + "require-dev": { | ||
872 | + "bower-asset/jasmine-ajax": ">=1.3.1,<1.4", | ||
873 | + "bower-asset/jasmine-jquery": ">=1.5.2,<1.6", | ||
874 | + "bower-asset/jquery": ">=1.7,<1.8" | ||
875 | + }, | ||
876 | + "type": "bower-asset-library", | ||
877 | + "extra": { | ||
878 | + "bower-asset-main": "dist/typeahead.bundle.js" | ||
879 | + } | ||
880 | + }, | ||
881 | + { | ||
882 | + "name": "fzaninotto/faker", | ||
883 | + "version": "v1.5.0", | ||
884 | + "source": { | ||
885 | + "type": "git", | ||
886 | + "url": "https://github.com/fzaninotto/Faker.git", | ||
887 | + "reference": "d0190b156bcca848d401fb80f31f504f37141c8d" | ||
888 | + }, | ||
889 | + "dist": { | ||
890 | + "type": "zip", | ||
891 | + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d0190b156bcca848d401fb80f31f504f37141c8d", | ||
892 | + "reference": "d0190b156bcca848d401fb80f31f504f37141c8d", | ||
893 | + "shasum": "" | ||
894 | + }, | ||
895 | + "require": { | ||
896 | + "php": ">=5.3.3" | ||
897 | + }, | ||
898 | + "require-dev": { | ||
899 | + "phpunit/phpunit": "~4.0", | ||
900 | + "squizlabs/php_codesniffer": "~1.5" | ||
901 | + }, | ||
902 | + "suggest": { | ||
903 | + "ext-intl": "*" | ||
904 | + }, | ||
905 | + "type": "library", | ||
906 | + "extra": { | ||
907 | + "branch-alias": { | ||
908 | + "dev-master": "1.5.x-dev" | ||
909 | + } | ||
910 | + }, | ||
911 | + "autoload": { | ||
912 | + "psr-4": { | ||
913 | + "Faker\\": "src/Faker/" | ||
914 | + } | ||
915 | + }, | ||
916 | + "notification-url": "https://packagist.org/downloads/", | ||
917 | + "license": [ | ||
918 | + "MIT" | ||
919 | + ], | ||
920 | + "authors": [ | ||
921 | + { | ||
922 | + "name": "François Zaninotto" | ||
923 | + } | ||
924 | + ], | ||
925 | + "description": "Faker is a PHP library that generates fake data for you.", | ||
926 | + "keywords": [ | ||
927 | + "data", | ||
928 | + "faker", | ||
929 | + "fixtures" | ||
930 | + ], | ||
931 | + "time": "2015-05-29 06:29:14" | ||
932 | + }, | ||
933 | + { | ||
934 | + "name": "phpspec/php-diff", | ||
935 | + "version": "v1.0.2", | ||
936 | + "source": { | ||
937 | + "type": "git", | ||
938 | + "url": "https://github.com/phpspec/php-diff.git", | ||
939 | + "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a" | ||
940 | + }, | ||
941 | + "dist": { | ||
942 | + "type": "zip", | ||
943 | + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/30e103d19519fe678ae64a60d77884ef3d71b28a", | ||
944 | + "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a", | ||
945 | + "shasum": "" | ||
946 | + }, | ||
947 | + "type": "library", | ||
948 | + "autoload": { | ||
949 | + "psr-0": { | ||
950 | + "Diff": "lib/" | ||
951 | + } | ||
952 | + }, | ||
953 | + "notification-url": "https://packagist.org/downloads/", | ||
954 | + "license": [ | ||
955 | + "BSD-3-Clause" | ||
956 | + ], | ||
957 | + "authors": [ | ||
958 | + { | ||
959 | + "name": "Chris Boulton", | ||
960 | + "homepage": "http://github.com/chrisboulton", | ||
961 | + "role": "Original developer" | ||
962 | + } | ||
963 | + ], | ||
964 | + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", | ||
965 | + "time": "2013-11-01 13:02:21" | ||
966 | + }, | ||
967 | + { | ||
968 | + "name": "yiisoft/yii2-codeception", | ||
969 | + "version": "2.0.4", | ||
970 | + "source": { | ||
971 | + "type": "git", | ||
972 | + "url": "https://github.com/yiisoft/yii2-codeception.git", | ||
973 | + "reference": "de5007e7a99359597abbfe1c88dca3ce620061c5" | ||
974 | + }, | ||
975 | + "dist": { | ||
976 | + "type": "zip", | ||
977 | + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/de5007e7a99359597abbfe1c88dca3ce620061c5", | ||
978 | + "reference": "de5007e7a99359597abbfe1c88dca3ce620061c5", | ||
979 | + "shasum": "" | ||
980 | + }, | ||
981 | + "require": { | ||
982 | + "yiisoft/yii2": ">=2.0.4" | ||
983 | + }, | ||
984 | + "type": "yii2-extension", | ||
985 | + "extra": { | ||
986 | + "branch-alias": { | ||
987 | + "dev-master": "2.0.x-dev" | ||
988 | + } | ||
989 | + }, | ||
990 | + "autoload": { | ||
991 | + "psr-4": { | ||
992 | + "yii\\codeception\\": "" | ||
993 | + } | ||
994 | + }, | ||
995 | + "notification-url": "https://packagist.org/downloads/", | ||
996 | + "license": [ | ||
997 | + "BSD-3-Clause" | ||
998 | + ], | ||
999 | + "authors": [ | ||
1000 | + { | ||
1001 | + "name": "Mark Jebri", | ||
1002 | + "email": "mark.github@yandex.ru" | ||
1003 | + } | ||
1004 | + ], | ||
1005 | + "description": "The Codeception integration for the Yii framework", | ||
1006 | + "keywords": [ | ||
1007 | + "codeception", | ||
1008 | + "yii2" | ||
1009 | + ], | ||
1010 | + "time": "2015-05-10 22:08:30" | ||
1011 | + }, | ||
1012 | + { | ||
1013 | + "name": "yiisoft/yii2-debug", | ||
1014 | + "version": "2.0.5", | ||
1015 | + "source": { | ||
1016 | + "type": "git", | ||
1017 | + "url": "https://github.com/yiisoft/yii2-debug.git", | ||
1018 | + "reference": "1b302e67521d46feb2413d9d96ca94ed82b39b0e" | ||
1019 | + }, | ||
1020 | + "dist": { | ||
1021 | + "type": "zip", | ||
1022 | + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/1b302e67521d46feb2413d9d96ca94ed82b39b0e", | ||
1023 | + "reference": "1b302e67521d46feb2413d9d96ca94ed82b39b0e", | ||
1024 | + "shasum": "" | ||
1025 | + }, | ||
1026 | + "require": { | ||
1027 | + "yiisoft/yii2": ">=2.0.4", | ||
1028 | + "yiisoft/yii2-bootstrap": "*" | ||
1029 | + }, | ||
1030 | + "type": "yii2-extension", | ||
1031 | + "extra": { | ||
1032 | + "branch-alias": { | ||
1033 | + "dev-master": "2.0.x-dev" | ||
1034 | + } | ||
1035 | + }, | ||
1036 | + "autoload": { | ||
1037 | + "psr-4": { | ||
1038 | + "yii\\debug\\": "" | ||
1039 | + } | ||
1040 | + }, | ||
1041 | + "notification-url": "https://packagist.org/downloads/", | ||
1042 | + "license": [ | ||
1043 | + "BSD-3-Clause" | ||
1044 | + ], | ||
1045 | + "authors": [ | ||
1046 | + { | ||
1047 | + "name": "Qiang Xue", | ||
1048 | + "email": "qiang.xue@gmail.com" | ||
1049 | + } | ||
1050 | + ], | ||
1051 | + "description": "The debugger extension for the Yii framework", | ||
1052 | + "keywords": [ | ||
1053 | + "debug", | ||
1054 | + "debugger", | ||
1055 | + "yii2" | ||
1056 | + ], | ||
1057 | + "time": "2015-08-06 16:14:06" | ||
1058 | + }, | ||
1059 | + { | ||
1060 | + "name": "yiisoft/yii2-faker", | ||
1061 | + "version": "2.0.3", | ||
1062 | + "source": { | ||
1063 | + "type": "git", | ||
1064 | + "url": "https://github.com/yiisoft/yii2-faker.git", | ||
1065 | + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c" | ||
1066 | + }, | ||
1067 | + "dist": { | ||
1068 | + "type": "zip", | ||
1069 | + "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/b88ca69ee226a3610b2c26c026c3203d7ac50f6c", | ||
1070 | + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c", | ||
1071 | + "shasum": "" | ||
1072 | + }, | ||
1073 | + "require": { | ||
1074 | + "fzaninotto/faker": "*", | ||
1075 | + "yiisoft/yii2": "*" | ||
1076 | + }, | ||
1077 | + "type": "yii2-extension", | ||
1078 | + "extra": { | ||
1079 | + "branch-alias": { | ||
1080 | + "dev-master": "2.0.x-dev" | ||
1081 | + } | ||
1082 | + }, | ||
1083 | + "autoload": { | ||
1084 | + "psr-4": { | ||
1085 | + "yii\\faker\\": "" | ||
1086 | + } | ||
1087 | + }, | ||
1088 | + "notification-url": "https://packagist.org/downloads/", | ||
1089 | + "license": [ | ||
1090 | + "BSD-3-Clause" | ||
1091 | + ], | ||
1092 | + "authors": [ | ||
1093 | + { | ||
1094 | + "name": "Mark Jebri", | ||
1095 | + "email": "mark.github@yandex.ru" | ||
1096 | + } | ||
1097 | + ], | ||
1098 | + "description": "Fixture generator. The Faker integration for the Yii framework.", | ||
1099 | + "keywords": [ | ||
1100 | + "Fixture", | ||
1101 | + "faker", | ||
1102 | + "yii2" | ||
1103 | + ], | ||
1104 | + "time": "2015-03-01 06:22:44" | ||
1105 | + }, | ||
1106 | + { | ||
1107 | + "name": "yiisoft/yii2-gii", | ||
1108 | + "version": "2.0.4", | ||
1109 | + "source": { | ||
1110 | + "type": "git", | ||
1111 | + "url": "https://github.com/yiisoft/yii2-gii.git", | ||
1112 | + "reference": "e5a023e8779bd774194842ec1b8fb4917cf04007" | ||
1113 | + }, | ||
1114 | + "dist": { | ||
1115 | + "type": "zip", | ||
1116 | + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/e5a023e8779bd774194842ec1b8fb4917cf04007", | ||
1117 | + "reference": "e5a023e8779bd774194842ec1b8fb4917cf04007", | ||
1118 | + "shasum": "" | ||
1119 | + }, | ||
1120 | + "require": { | ||
1121 | + "bower-asset/typeahead.js": "0.10.*", | ||
1122 | + "phpspec/php-diff": ">=1.0.2", | ||
1123 | + "yiisoft/yii2": ">=2.0.4", | ||
1124 | + "yiisoft/yii2-bootstrap": "~2.0" | ||
1125 | + }, | ||
1126 | + "type": "yii2-extension", | ||
1127 | + "extra": { | ||
1128 | + "branch-alias": { | ||
1129 | + "dev-master": "2.0.x-dev" | ||
1130 | + }, | ||
1131 | + "asset-installer-paths": { | ||
1132 | + "npm-asset-library": "vendor/npm", | ||
1133 | + "bower-asset-library": "vendor/bower" | ||
1134 | + } | ||
1135 | + }, | ||
1136 | + "autoload": { | ||
1137 | + "psr-4": { | ||
1138 | + "yii\\gii\\": "" | ||
1139 | + } | ||
1140 | + }, | ||
1141 | + "notification-url": "https://packagist.org/downloads/", | ||
1142 | + "license": [ | ||
1143 | + "BSD-3-Clause" | ||
1144 | + ], | ||
1145 | + "authors": [ | ||
1146 | + { | ||
1147 | + "name": "Qiang Xue", | ||
1148 | + "email": "qiang.xue@gmail.com" | ||
1149 | + } | ||
1150 | + ], | ||
1151 | + "description": "The Gii extension for the Yii framework", | ||
1152 | + "keywords": [ | ||
1153 | + "code generator", | ||
1154 | + "gii", | ||
1155 | + "yii2" | ||
1156 | + ], | ||
1157 | + "time": "2015-05-10 22:09:31" | ||
1158 | + } | ||
1159 | + ], | ||
1160 | + "aliases": [], | ||
1161 | + "minimum-stability": "stable", | ||
1162 | + "stability-flags": { | ||
1163 | + "kartik-v/yii2-widget-fileinput": 20 | ||
1164 | + }, | ||
1165 | + "prefer-stable": false, | ||
1166 | + "prefer-lowest": false, | ||
1167 | + "platform": { | ||
1168 | + "php": ">=5.4.0" | ||
1169 | + }, | ||
1170 | + "platform-dev": [] | ||
1171 | +} |
1 | +++ a/console/config/main.php | ||
1 | +<?php | ||
2 | +$params = array_merge( | ||
3 | + require(__DIR__ . '/../../common/config/params.php'), | ||
4 | + require(__DIR__ . '/../../common/config/params-local.php'), | ||
5 | + require(__DIR__ . '/params.php'), | ||
6 | + require(__DIR__ . '/params-local.php') | ||
7 | +); | ||
8 | + | ||
9 | +return [ | ||
10 | + 'id' => 'app-console', | ||
11 | + 'basePath' => dirname(__DIR__), | ||
12 | + 'bootstrap' => ['log'], | ||
13 | + 'controllerNamespace' => 'console\controllers', | ||
14 | + 'components' => [ | ||
15 | + 'log' => [ | ||
16 | + 'targets' => [ | ||
17 | + [ | ||
18 | + 'class' => 'yii\log\FileTarget', | ||
19 | + 'levels' => ['error', 'warning'], | ||
20 | + ], | ||
21 | + ], | ||
22 | + ], | ||
23 | + ], | ||
24 | + 'params' => $params, | ||
25 | +]; |
1 | +++ a/console/controllers/.gitkeep |
1 | +++ a/console/migrations/m130524_201442_init.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Schema; | ||
4 | +use yii\db\Migration; | ||
5 | + | ||
6 | +class m130524_201442_init extends Migration | ||
7 | +{ | ||
8 | + public function up() | ||
9 | + { | ||
10 | + $tableOptions = null; | ||
11 | + if ($this->db->driverName === 'mysql') { | ||
12 | + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci | ||
13 | + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; | ||
14 | + } | ||
15 | + | ||
16 | + $this->createTable('{{%user}}', [ | ||
17 | + 'id' => Schema::TYPE_PK, | ||
18 | + 'username' => Schema::TYPE_STRING . ' NOT NULL', | ||
19 | + 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', | ||
20 | + 'password_hash' => Schema::TYPE_STRING . ' NOT NULL', | ||
21 | + 'password_reset_token' => Schema::TYPE_STRING, | ||
22 | + 'email' => Schema::TYPE_STRING . ' NOT NULL', | ||
23 | + | ||
24 | + 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', | ||
25 | + 'created_at' => Schema::TYPE_INTEGER . ' NOT NULL', | ||
26 | + 'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL', | ||
27 | + ], $tableOptions); | ||
28 | + } | ||
29 | + | ||
30 | + public function down() | ||
31 | + { | ||
32 | + $this->dropTable('{{%user}}'); | ||
33 | + } | ||
34 | +} |
1 | +++ a/environments/dev/backend/config/main-local.php | ||
1 | +<?php | ||
2 | + | ||
3 | +$config = [ | ||
4 | + 'components' => [ | ||
5 | + 'request' => [ | ||
6 | + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation | ||
7 | + 'cookieValidationKey' => '', | ||
8 | + ], | ||
9 | + ], | ||
10 | +]; | ||
11 | + | ||
12 | +if (!YII_ENV_TEST) { | ||
13 | + // configuration adjustments for 'dev' environment | ||
14 | + $config['bootstrap'][] = 'debug'; | ||
15 | + $config['modules']['debug'] = 'yii\debug\Module'; | ||
16 | + | ||
17 | + $config['bootstrap'][] = 'gii'; | ||
18 | + $config['modules']['gii'] = 'yii\gii\Module'; | ||
19 | +} | ||
20 | + | ||
21 | +return $config; |
1 | +++ a/environments/dev/backend/web/index-test.php | ||
1 | +<?php | ||
2 | + | ||
3 | +// NOTE: Make sure this file is not accessible when deployed to production | ||
4 | +if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) { | ||
5 | + die('You are not allowed to access this file.'); | ||
6 | +} | ||
7 | + | ||
8 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
9 | +defined('YII_ENV') or define('YII_ENV', 'test'); | ||
10 | + | ||
11 | +require(__DIR__ . '/../../vendor/autoload.php'); | ||
12 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | ||
13 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | ||
14 | +require(__DIR__ . '/../config/bootstrap.php'); | ||
15 | + | ||
16 | + | ||
17 | +$config = require(__DIR__ . '/../../tests/codeception/config/backend/acceptance.php'); | ||
18 | + | ||
19 | +(new yii\web\Application($config))->run(); |
1 | +++ a/environments/dev/backend/web/index.php | ||
1 | +<?php | ||
2 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
3 | +defined('YII_ENV') or define('YII_ENV', 'dev'); | ||
4 | + | ||
5 | +require(__DIR__ . '/../../vendor/autoload.php'); | ||
6 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | ||
7 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | ||
8 | +require(__DIR__ . '/../config/bootstrap.php'); | ||
9 | + | ||
10 | +$config = yii\helpers\ArrayHelper::merge( | ||
11 | + require(__DIR__ . '/../../common/config/main.php'), | ||
12 | + require(__DIR__ . '/../../common/config/main-local.php'), | ||
13 | + require(__DIR__ . '/../config/main.php'), | ||
14 | + require(__DIR__ . '/../config/main-local.php') | ||
15 | +); | ||
16 | + | ||
17 | +$application = new yii\web\Application($config); | ||
18 | +$application->run(); |
1 | +++ a/environments/dev/common/config/main-local.php | ||
1 | +<?php | ||
2 | +return [ | ||
3 | + 'components' => [ | ||
4 | + 'db' => [ | ||
5 | + 'class' => 'yii\db\Connection', | ||
6 | + 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', | ||
7 | + 'username' => 'root', | ||
8 | + 'password' => '', | ||
9 | + 'charset' => 'utf8', | ||
10 | + ], | ||
11 | + 'mailer' => [ | ||
12 | + 'class' => 'yii\swiftmailer\Mailer', | ||
13 | + 'viewPath' => '@common/mail', | ||
14 | + // send all mails to a file by default. You have to set | ||
15 | + // 'useFileTransport' to false and configure a transport | ||
16 | + // for the mailer to send real emails. | ||
17 | + 'useFileTransport' => true, | ||
18 | + ], | ||
19 | + ], | ||
20 | +]; |
1 | +++ a/environments/dev/frontend/config/main-local.php | ||
1 | +<?php | ||
2 | + | ||
3 | +$config = [ | ||
4 | + 'components' => [ | ||
5 | + 'request' => [ | ||
6 | + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation | ||
7 | + 'cookieValidationKey' => '', | ||
8 | + ], | ||
9 | + ], | ||
10 | +]; | ||
11 | + | ||
12 | +if (!YII_ENV_TEST) { | ||
13 | + // configuration adjustments for 'dev' environment | ||
14 | + $config['bootstrap'][] = 'debug'; | ||
15 | + $config['modules']['debug'] = 'yii\debug\Module'; | ||
16 | + | ||
17 | + $config['bootstrap'][] = 'gii'; | ||
18 | + $config['modules']['gii'] = 'yii\gii\Module'; | ||
19 | +} | ||
20 | + | ||
21 | +return $config; |
1 | +++ a/environments/dev/frontend/web/index-test.php | ||
1 | +<?php | ||
2 | + | ||
3 | +// NOTE: Make sure this file is not accessible when deployed to production | ||
4 | +if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) { | ||
5 | + die('You are not allowed to access this file.'); | ||
6 | +} | ||
7 | + | ||
8 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
9 | +defined('YII_ENV') or define('YII_ENV', 'test'); | ||
10 | + | ||
11 | +require(__DIR__ . '/../../vendor/autoload.php'); | ||
12 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | ||
13 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | ||
14 | +require(__DIR__ . '/../config/bootstrap.php'); | ||
15 | + | ||
16 | +$config = require(__DIR__ . '/../../tests/codeception/config/frontend/acceptance.php'); | ||
17 | + | ||
18 | +(new yii\web\Application($config))->run(); |
1 | +++ a/environments/dev/frontend/web/index.php | ||
1 | +<?php | ||
2 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
3 | +defined('YII_ENV') or define('YII_ENV', 'dev'); | ||
4 | + | ||
5 | +require(__DIR__ . '/../../vendor/autoload.php'); | ||
6 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | ||
7 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | ||
8 | +require(__DIR__ . '/../config/bootstrap.php'); | ||
9 | + | ||
10 | +$config = yii\helpers\ArrayHelper::merge( | ||
11 | + require(__DIR__ . '/../../common/config/main.php'), | ||
12 | + require(__DIR__ . '/../../common/config/main-local.php'), | ||
13 | + require(__DIR__ . '/../config/main.php'), | ||
14 | + require(__DIR__ . '/../config/main-local.php') | ||
15 | +); | ||
16 | + | ||
17 | +$application = new yii\web\Application($config); | ||
18 | +$application->run(); |
1 | +++ a/environments/dev/yii | ||
1 | +#!/usr/bin/env php | ||
2 | +<?php | ||
3 | +/** | ||
4 | + * Yii console bootstrap file. | ||
5 | + * | ||
6 | + * @link http://www.yiiframework.com/ | ||
7 | + * @copyright Copyright (c) 2008 Yii Software LLC | ||
8 | + * @license http://www.yiiframework.com/license/ | ||
9 | + */ | ||
10 | + | ||
11 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
12 | +defined('YII_ENV') or define('YII_ENV', 'dev'); | ||
13 | + | ||
14 | +// fcgi doesn't have STDIN and STDOUT defined by default | ||
15 | +defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); | ||
16 | +defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); | ||
17 | + | ||
18 | +require(__DIR__ . '/vendor/autoload.php'); | ||
19 | +require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); | ||
20 | +require(__DIR__ . '/common/config/bootstrap.php'); | ||
21 | +require(__DIR__ . '/console/config/bootstrap.php'); | ||
22 | + | ||
23 | +$config = yii\helpers\ArrayHelper::merge( | ||
24 | + require(__DIR__ . '/common/config/main.php'), | ||
25 | + require(__DIR__ . '/common/config/main-local.php'), | ||
26 | + require(__DIR__ . '/console/config/main.php'), | ||
27 | + require(__DIR__ . '/console/config/main-local.php') | ||
28 | +); | ||
29 | + | ||
30 | +$application = new yii\console\Application($config); | ||
31 | +$exitCode = $application->run(); | ||
32 | +exit($exitCode); |
1 | +++ a/environments/index.php | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * The manifest of files that are local to specific environment. | ||
4 | + * This file returns a list of environments that the application | ||
5 | + * may be installed under. The returned data must be in the following | ||
6 | + * format: | ||
7 | + * | ||
8 | + * ```php | ||
9 | + * return [ | ||
10 | + * 'environment name' => [ | ||
11 | + * 'path' => 'directory storing the local files', | ||
12 | + * 'skipFiles' => [ | ||
13 | + * // list of files that should only copied once and skipped if they already exist | ||
14 | + * ], | ||
15 | + * 'setWritable' => [ | ||
16 | + * // list of directories that should be set writable | ||
17 | + * ], | ||
18 | + * 'setExecutable' => [ | ||
19 | + * // list of files that should be set executable | ||
20 | + * ], | ||
21 | + * 'setCookieValidationKey' => [ | ||
22 | + * // list of config files that need to be inserted with automatically generated cookie validation keys | ||
23 | + * ], | ||
24 | + * 'createSymlink' => [ | ||
25 | + * // list of symlinks to be created. Keys are symlinks, and values are the targets. | ||
26 | + * ], | ||
27 | + * ], | ||
28 | + * ]; | ||
29 | + * ``` | ||
30 | + */ | ||
31 | +return [ | ||
32 | + 'Development' => [ | ||
33 | + 'path' => 'dev', | ||
34 | + 'setWritable' => [ | ||
35 | + 'backend/runtime', | ||
36 | + 'backend/web/assets', | ||
37 | + 'frontend/runtime', | ||
38 | + 'frontend/web/assets', | ||
39 | + ], | ||
40 | + 'setExecutable' => [ | ||
41 | + 'yii', | ||
42 | + 'tests/codeception/bin/yii', | ||
43 | + ], | ||
44 | + 'setCookieValidationKey' => [ | ||
45 | + 'backend/config/main-local.php', | ||
46 | + 'frontend/config/main-local.php', | ||
47 | + ], | ||
48 | + ], | ||
49 | + 'Production' => [ | ||
50 | + 'path' => 'prod', | ||
51 | + 'setWritable' => [ | ||
52 | + 'backend/runtime', | ||
53 | + 'backend/web/assets', | ||
54 | + 'frontend/runtime', | ||
55 | + 'frontend/web/assets', | ||
56 | + ], | ||
57 | + 'setExecutable' => [ | ||
58 | + 'yii', | ||
59 | + ], | ||
60 | + 'setCookieValidationKey' => [ | ||
61 | + 'backend/config/main-local.php', | ||
62 | + 'frontend/config/main-local.php', | ||
63 | + ], | ||
64 | + ], | ||
65 | +]; |
1 | +++ a/environments/prod/backend/web/index.php | ||
1 | +<?php | ||
2 | +defined('YII_DEBUG') or define('YII_DEBUG', false); | ||
3 | +defined('YII_ENV') or define('YII_ENV', 'prod'); | ||
4 | + | ||
5 | +require(__DIR__ . '/../../vendor/autoload.php'); | ||
6 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | ||
7 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | ||
8 | +require(__DIR__ . '/../config/bootstrap.php'); | ||
9 | + | ||
10 | +$config = yii\helpers\ArrayHelper::merge( | ||
11 | + require(__DIR__ . '/../../common/config/main.php'), | ||
12 | + require(__DIR__ . '/../../common/config/main-local.php'), | ||
13 | + require(__DIR__ . '/../config/main.php'), | ||
14 | + require(__DIR__ . '/../config/main-local.php') | ||
15 | +); | ||
16 | + | ||
17 | +$application = new yii\web\Application($config); | ||
18 | +$application->run(); |
1 | +++ a/environments/prod/common/config/main-local.php | ||
1 | +<?php | ||
2 | +return [ | ||
3 | + 'components' => [ | ||
4 | + 'db' => [ | ||
5 | + 'class' => 'yii\db\Connection', | ||
6 | + 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', | ||
7 | + 'username' => 'root', | ||
8 | + 'password' => '', | ||
9 | + 'charset' => 'utf8', | ||
10 | + ], | ||
11 | + 'mailer' => [ | ||
12 | + 'class' => 'yii\swiftmailer\Mailer', | ||
13 | + 'viewPath' => '@common/mail', | ||
14 | + ], | ||
15 | + ], | ||
16 | +]; |
1 | +++ a/environments/prod/frontend/web/index.php | ||
1 | +<?php | ||
2 | +defined('YII_DEBUG') or define('YII_DEBUG', false); | ||
3 | +defined('YII_ENV') or define('YII_ENV', 'prod'); | ||
4 | + | ||
5 | +require(__DIR__ . '/../../vendor/autoload.php'); | ||
6 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | ||
7 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | ||
8 | +require(__DIR__ . '/../config/bootstrap.php'); | ||
9 | + | ||
10 | +$config = yii\helpers\ArrayHelper::merge( | ||
11 | + require(__DIR__ . '/../../common/config/main.php'), | ||
12 | + require(__DIR__ . '/../../common/config/main-local.php'), | ||
13 | + require(__DIR__ . '/../config/main.php'), | ||
14 | + require(__DIR__ . '/../config/main-local.php') | ||
15 | +); | ||
16 | + | ||
17 | +$application = new yii\web\Application($config); | ||
18 | +$application->run(); |
1 | +++ a/environments/prod/yii | ||
1 | +#!/usr/bin/env php | ||
2 | +<?php | ||
3 | +/** | ||
4 | + * Yii console bootstrap file. | ||
5 | + * | ||
6 | + * @link http://www.yiiframework.com/ | ||
7 | + * @copyright Copyright (c) 2008 Yii Software LLC | ||
8 | + * @license http://www.yiiframework.com/license/ | ||
9 | + */ | ||
10 | + | ||
11 | +defined('YII_DEBUG') or define('YII_DEBUG', false); | ||
12 | +defined('YII_ENV') or define('YII_ENV', 'prod'); | ||
13 | + | ||
14 | +// fcgi doesn't have STDIN and STDOUT defined by default | ||
15 | +defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); | ||
16 | +defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); | ||
17 | + | ||
18 | +require(__DIR__ . '/vendor/autoload.php'); | ||
19 | +require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); | ||
20 | +require(__DIR__ . '/common/config/bootstrap.php'); | ||
21 | +require(__DIR__ . '/console/config/bootstrap.php'); | ||
22 | + | ||
23 | +$config = yii\helpers\ArrayHelper::merge( | ||
24 | + require(__DIR__ . '/common/config/main.php'), | ||
25 | + require(__DIR__ . '/common/config/main-local.php'), | ||
26 | + require(__DIR__ . '/console/config/main.php'), | ||
27 | + require(__DIR__ . '/console/config/main-local.php') | ||
28 | +); | ||
29 | + | ||
30 | +$application = new yii\console\Application($config); | ||
31 | +$exitCode = $application->run(); | ||
32 | +exit($exitCode); |
1 | +++ a/frontend/assets/AppAsset.php | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * @link http://www.yiiframework.com/ | ||
4 | + * @copyright Copyright (c) 2008 Yii Software LLC | ||
5 | + * @license http://www.yiiframework.com/license/ | ||
6 | + */ | ||
7 | + | ||
8 | +namespace frontend\assets; | ||
9 | + | ||
10 | +use yii\web\AssetBundle; | ||
11 | + | ||
12 | +/** | ||
13 | + * @author Qiang Xue <qiang.xue@gmail.com> | ||
14 | + * @since 2.0 | ||
15 | + */ | ||
16 | +class AppAsset extends AssetBundle | ||
17 | +{ | ||
18 | + public $basePath = '@webroot'; | ||
19 | + public $baseUrl = '@web'; | ||
20 | + public $css = [ | ||
21 | + 'css/site.css', | ||
22 | + ]; | ||
23 | + public $js = [ | ||
24 | + ]; | ||
25 | + public $depends = [ | ||
26 | + 'yii\web\YiiAsset', | ||
27 | + 'yii\bootstrap\BootstrapAsset', | ||
28 | + ]; | ||
29 | +} |
1 | +++ a/frontend/config/main.php | ||
1 | +<?php | ||
2 | +$params = array_merge( | ||
3 | + require(__DIR__ . '/../../common/config/params.php'), | ||
4 | + require(__DIR__ . '/../../common/config/params-local.php'), | ||
5 | + require(__DIR__ . '/params.php'), | ||
6 | + require(__DIR__ . '/params-local.php') | ||
7 | +); | ||
8 | + | ||
9 | +return [ | ||
10 | + 'id' => 'app-frontend', | ||
11 | + 'basePath' => dirname(__DIR__), | ||
12 | + 'bootstrap' => ['log'], | ||
13 | + 'controllerNamespace' => 'frontend\controllers', | ||
14 | + 'components' => [ | ||
15 | + 'user' => [ | ||
16 | + 'identityClass' => 'common\models\User', | ||
17 | + 'enableAutoLogin' => true, | ||
18 | + ], | ||
19 | + 'log' => [ | ||
20 | + 'traceLevel' => YII_DEBUG ? 3 : 0, | ||
21 | + 'targets' => [ | ||
22 | + [ | ||
23 | + 'class' => 'yii\log\FileTarget', | ||
24 | + 'levels' => ['error', 'warning'], | ||
25 | + ], | ||
26 | + ], | ||
27 | + ], | ||
28 | + 'errorHandler' => [ | ||
29 | + 'errorAction' => 'site/error', | ||
30 | + ], | ||
31 | + ], | ||
32 | + 'params' => $params, | ||
33 | +]; |
1 | +++ a/frontend/controllers/SiteController.php | ||
1 | +<?php | ||
2 | +namespace frontend\controllers; | ||
3 | + | ||
4 | +use Yii; | ||
5 | +use common\models\LoginForm; | ||
6 | +use frontend\models\PasswordResetRequestForm; | ||
7 | +use frontend\models\ResetPasswordForm; | ||
8 | +use frontend\models\SignupForm; | ||
9 | +use frontend\models\ContactForm; | ||
10 | +use yii\base\InvalidParamException; | ||
11 | +use yii\web\BadRequestHttpException; | ||
12 | +use yii\web\Controller; | ||
13 | +use yii\filters\VerbFilter; | ||
14 | +use yii\filters\AccessControl; | ||
15 | + | ||
16 | +/** | ||
17 | + * Site controller | ||
18 | + */ | ||
19 | +class SiteController extends Controller | ||
20 | +{ | ||
21 | + /** | ||
22 | + * @inheritdoc | ||
23 | + */ | ||
24 | + public function behaviors() | ||
25 | + { | ||
26 | + return [ | ||
27 | + 'access' => [ | ||
28 | + 'class' => AccessControl::className(), | ||
29 | + 'only' => ['logout', 'signup'], | ||
30 | + 'rules' => [ | ||
31 | + [ | ||
32 | + 'actions' => ['signup'], | ||
33 | + 'allow' => true, | ||
34 | + 'roles' => ['?'], | ||
35 | + ], | ||
36 | + [ | ||
37 | + 'actions' => ['logout'], | ||
38 | + 'allow' => true, | ||
39 | + 'roles' => ['@'], | ||
40 | + ], | ||
41 | + ], | ||
42 | + ], | ||
43 | + 'verbs' => [ | ||
44 | + 'class' => VerbFilter::className(), | ||
45 | + 'actions' => [ | ||
46 | + 'logout' => ['post'], | ||
47 | + ], | ||
48 | + ], | ||
49 | + ]; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * @inheritdoc | ||
54 | + */ | ||
55 | + public function actions() | ||
56 | + { | ||
57 | + return [ | ||
58 | + 'error' => [ | ||
59 | + 'class' => 'yii\web\ErrorAction', | ||
60 | + ], | ||
61 | + 'captcha' => [ | ||
62 | + 'class' => 'yii\captcha\CaptchaAction', | ||
63 | + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, | ||
64 | + ], | ||
65 | + ]; | ||
66 | + } | ||
67 | + | ||
68 | + public function actionIndex() | ||
69 | + { | ||
70 | + return $this->render('index'); | ||
71 | + } | ||
72 | + | ||
73 | + public function actionLogin() | ||
74 | + { | ||
75 | + if (!\Yii::$app->user->isGuest) { | ||
76 | + return $this->goHome(); | ||
77 | + } | ||
78 | + | ||
79 | + $model = new LoginForm(); | ||
80 | + if ($model->load(Yii::$app->request->post()) && $model->login()) { | ||
81 | + return $this->goBack(); | ||
82 | + } else { | ||
83 | + return $this->render('login', [ | ||
84 | + 'model' => $model, | ||
85 | + ]); | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | + public function actionLogout() | ||
90 | + { | ||
91 | + Yii::$app->user->logout(); | ||
92 | + | ||
93 | + return $this->goHome(); | ||
94 | + } | ||
95 | + | ||
96 | + public function actionContact() | ||
97 | + { | ||
98 | + $model = new ContactForm(); | ||
99 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { | ||
100 | + if ($model->sendEmail(Yii::$app->params['adminEmail'])) { | ||
101 | + Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.'); | ||
102 | + } else { | ||
103 | + Yii::$app->session->setFlash('error', 'There was an error sending email.'); | ||
104 | + } | ||
105 | + | ||
106 | + return $this->refresh(); | ||
107 | + } else { | ||
108 | + return $this->render('contact', [ | ||
109 | + 'model' => $model, | ||
110 | + ]); | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | + public function actionAbout() | ||
115 | + { | ||
116 | + return $this->render('about'); | ||
117 | + } | ||
118 | + | ||
119 | + public function actionSignup() | ||
120 | + { | ||
121 | + $model = new SignupForm(); | ||
122 | + if ($model->load(Yii::$app->request->post())) { | ||
123 | + if ($user = $model->signup()) { | ||
124 | + if (Yii::$app->getUser()->login($user)) { | ||
125 | + return $this->goHome(); | ||
126 | + } | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + return $this->render('signup', [ | ||
131 | + 'model' => $model, | ||
132 | + ]); | ||
133 | + } | ||
134 | + | ||
135 | + public function actionRequestPasswordReset() | ||
136 | + { | ||
137 | + $model = new PasswordResetRequestForm(); | ||
138 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { | ||
139 | + if ($model->sendEmail()) { | ||
140 | + Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.'); | ||
141 | + | ||
142 | + return $this->goHome(); | ||
143 | + } else { | ||
144 | + Yii::$app->getSession()->setFlash('error', 'Sorry, we are unable to reset password for email provided.'); | ||
145 | + } | ||
146 | + } | ||
147 | + | ||
148 | + return $this->render('requestPasswordResetToken', [ | ||
149 | + 'model' => $model, | ||
150 | + ]); | ||
151 | + } | ||
152 | + | ||
153 | + public function actionResetPassword($token) | ||
154 | + { | ||
155 | + try { | ||
156 | + $model = new ResetPasswordForm($token); | ||
157 | + } catch (InvalidParamException $e) { | ||
158 | + throw new BadRequestHttpException($e->getMessage()); | ||
159 | + } | ||
160 | + | ||
161 | + if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { | ||
162 | + Yii::$app->getSession()->setFlash('success', 'New password was saved.'); | ||
163 | + | ||
164 | + return $this->goHome(); | ||
165 | + } | ||
166 | + | ||
167 | + return $this->render('resetPassword', [ | ||
168 | + 'model' => $model, | ||
169 | + ]); | ||
170 | + } | ||
171 | +} |
1 | +++ a/frontend/models/ContactForm.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace frontend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | + | ||
8 | +/** | ||
9 | + * ContactForm is the model behind the contact form. | ||
10 | + */ | ||
11 | +class ContactForm extends Model | ||
12 | +{ | ||
13 | + public $name; | ||
14 | + public $email; | ||
15 | + public $subject; | ||
16 | + public $body; | ||
17 | + public $verifyCode; | ||
18 | + | ||
19 | + /** | ||
20 | + * @inheritdoc | ||
21 | + */ | ||
22 | + public function rules() | ||
23 | + { | ||
24 | + return [ | ||
25 | + // name, email, subject and body are required | ||
26 | + [['name', 'email', 'subject', 'body'], 'required'], | ||
27 | + // email has to be a valid email address | ||
28 | + ['email', 'email'], | ||
29 | + // verifyCode needs to be entered correctly | ||
30 | + ['verifyCode', 'captcha'], | ||
31 | + ]; | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * @inheritdoc | ||
36 | + */ | ||
37 | + public function attributeLabels() | ||
38 | + { | ||
39 | + return [ | ||
40 | + 'verifyCode' => 'Verification Code', | ||
41 | + ]; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Sends an email to the specified email address using the information collected by this model. | ||
46 | + * | ||
47 | + * @param string $email the target email address | ||
48 | + * @return boolean whether the email was sent | ||
49 | + */ | ||
50 | + public function sendEmail($email) | ||
51 | + { | ||
52 | + return Yii::$app->mailer->compose() | ||
53 | + ->setTo($email) | ||
54 | + ->setFrom([$this->email => $this->name]) | ||
55 | + ->setSubject($this->subject) | ||
56 | + ->setTextBody($this->body) | ||
57 | + ->send(); | ||
58 | + } | ||
59 | +} |
1 | +++ a/frontend/models/PasswordResetRequestForm.php | ||
1 | +<?php | ||
2 | +namespace frontend\models; | ||
3 | + | ||
4 | +use common\models\User; | ||
5 | +use yii\base\Model; | ||
6 | + | ||
7 | +/** | ||
8 | + * Password reset request form | ||
9 | + */ | ||
10 | +class PasswordResetRequestForm extends Model | ||
11 | +{ | ||
12 | + public $email; | ||
13 | + | ||
14 | + /** | ||
15 | + * @inheritdoc | ||
16 | + */ | ||
17 | + public function rules() | ||
18 | + { | ||
19 | + return [ | ||
20 | + ['email', 'filter', 'filter' => 'trim'], | ||
21 | + ['email', 'required'], | ||
22 | + ['email', 'email'], | ||
23 | + ['email', 'exist', | ||
24 | + 'targetClass' => '\common\models\User', | ||
25 | + 'filter' => ['status' => User::STATUS_ACTIVE], | ||
26 | + 'message' => 'There is no user with such email.' | ||
27 | + ], | ||
28 | + ]; | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * Sends an email with a link, for resetting the password. | ||
33 | + * | ||
34 | + * @return boolean whether the email was send | ||
35 | + */ | ||
36 | + public function sendEmail() | ||
37 | + { | ||
38 | + /* @var $user User */ | ||
39 | + $user = User::findOne([ | ||
40 | + 'status' => User::STATUS_ACTIVE, | ||
41 | + 'email' => $this->email, | ||
42 | + ]); | ||
43 | + | ||
44 | + if ($user) { | ||
45 | + if (!User::isPasswordResetTokenValid($user->password_reset_token)) { | ||
46 | + $user->generatePasswordResetToken(); | ||
47 | + } | ||
48 | + | ||
49 | + if ($user->save()) { | ||
50 | + return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user]) | ||
51 | + ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot']) | ||
52 | + ->setTo($this->email) | ||
53 | + ->setSubject('Password reset for ' . \Yii::$app->name) | ||
54 | + ->send(); | ||
55 | + } | ||
56 | + } | ||
57 | + | ||
58 | + return false; | ||
59 | + } | ||
60 | +} |
1 | +++ a/frontend/models/ResetPasswordForm.php | ||
1 | +<?php | ||
2 | +namespace frontend\models; | ||
3 | + | ||
4 | +use common\models\User; | ||
5 | +use yii\base\InvalidParamException; | ||
6 | +use yii\base\Model; | ||
7 | +use Yii; | ||
8 | + | ||
9 | +/** | ||
10 | + * Password reset form | ||
11 | + */ | ||
12 | +class ResetPasswordForm extends Model | ||
13 | +{ | ||
14 | + public $password; | ||
15 | + | ||
16 | + /** | ||
17 | + * @var \common\models\User | ||
18 | + */ | ||
19 | + private $_user; | ||
20 | + | ||
21 | + | ||
22 | + /** | ||
23 | + * Creates a form model given a token. | ||
24 | + * | ||
25 | + * @param string $token | ||
26 | + * @param array $config name-value pairs that will be used to initialize the object properties | ||
27 | + * @throws \yii\base\InvalidParamException if token is empty or not valid | ||
28 | + */ | ||
29 | + public function __construct($token, $config = []) | ||
30 | + { | ||
31 | + if (empty($token) || !is_string($token)) { | ||
32 | + throw new InvalidParamException('Password reset token cannot be blank.'); | ||
33 | + } | ||
34 | + $this->_user = User::findByPasswordResetToken($token); | ||
35 | + if (!$this->_user) { | ||
36 | + throw new InvalidParamException('Wrong password reset token.'); | ||
37 | + } | ||
38 | + parent::__construct($config); | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * @inheritdoc | ||
43 | + */ | ||
44 | + public function rules() | ||
45 | + { | ||
46 | + return [ | ||
47 | + ['password', 'required'], | ||
48 | + ['password', 'string', 'min' => 6], | ||
49 | + ]; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * Resets password. | ||
54 | + * | ||
55 | + * @return boolean if password was reset. | ||
56 | + */ | ||
57 | + public function resetPassword() | ||
58 | + { | ||
59 | + $user = $this->_user; | ||
60 | + $user->setPassword($this->password); | ||
61 | + $user->removePasswordResetToken(); | ||
62 | + | ||
63 | + return $user->save(false); | ||
64 | + } | ||
65 | +} |
1 | +++ a/frontend/models/SignupForm.php | ||
1 | +<?php | ||
2 | +namespace frontend\models; | ||
3 | + | ||
4 | +use common\models\User; | ||
5 | +use yii\base\Model; | ||
6 | +use Yii; | ||
7 | + | ||
8 | +/** | ||
9 | + * Signup form | ||
10 | + */ | ||
11 | +class SignupForm extends Model | ||
12 | +{ | ||
13 | + public $first_name; | ||
14 | + public $last_name; | ||
15 | + public $username; | ||
16 | + public $email; | ||
17 | + public $password; | ||
18 | + | ||
19 | + /** | ||
20 | + * @inheritdoc | ||
21 | + */ | ||
22 | + public function rules() | ||
23 | + { | ||
24 | + return [ | ||
25 | + ['username', 'filter', 'filter' => 'trim'], | ||
26 | + ['username', 'required'], | ||
27 | + ['first_name', 'required'], | ||
28 | + ['last_name', 'required'], | ||
29 | + ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], | ||
30 | + ['username', 'string', 'min' => 2, 'max' => 255], | ||
31 | + | ||
32 | + ['email', 'filter', 'filter' => 'trim'], | ||
33 | + ['email', 'required'], | ||
34 | + ['email', 'email'], | ||
35 | + ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'], | ||
36 | + | ||
37 | + ['password', 'required'], | ||
38 | + ['password', 'string', 'min' => 6], | ||
39 | + ]; | ||
40 | + } | ||
41 | + | ||
42 | + /** | ||
43 | + * Signs user up. | ||
44 | + * | ||
45 | + * @return User|null the saved model or null if saving fails | ||
46 | + */ | ||
47 | + public function signup() | ||
48 | + { | ||
49 | + if ($this->validate()) { | ||
50 | + $user = new User(); | ||
51 | + $user->first_name = $this->first_name; | ||
52 | + $user->last_name = $this->last_name; | ||
53 | + $user->username = $this->username; | ||
54 | + $user->email = $this->email; | ||
55 | + $user->setPassword($this->password); | ||
56 | + $user->generateAuthKey(); | ||
57 | + if ($user->save()) { | ||
58 | + return $user; | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + return null; | ||
63 | + } | ||
64 | +} |
1 | +++ a/frontend/views/layouts/main.php | ||
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | +use yii\bootstrap\Nav; | ||
4 | +use yii\bootstrap\NavBar; | ||
5 | +use yii\widgets\Breadcrumbs; | ||
6 | +use frontend\assets\AppAsset; | ||
7 | +use frontend\widgets\Alert; | ||
8 | + | ||
9 | +/* @var $this \yii\web\View */ | ||
10 | +/* @var $content string */ | ||
11 | + | ||
12 | +AppAsset::register($this); | ||
13 | +?> | ||
14 | +<?php $this->beginPage() ?> | ||
15 | +<!DOCTYPE html> | ||
16 | +<html lang="<?= Yii::$app->language ?>"> | ||
17 | +<head> | ||
18 | + <meta charset="<?= Yii::$app->charset ?>"> | ||
19 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
20 | + <?= Html::csrfMetaTags() ?> | ||
21 | + <title><?= Html::encode($this->title) ?></title> | ||
22 | + <?php $this->head() ?> | ||
23 | +</head> | ||
24 | +<body> | ||
25 | + <?php $this->beginBody() ?> | ||
26 | + <div class="wrap"> | ||
27 | + <?php | ||
28 | + NavBar::begin([ | ||
29 | + 'brandLabel' => 'My Company', | ||
30 | + 'brandUrl' => Yii::$app->homeUrl, | ||
31 | + 'options' => [ | ||
32 | + 'class' => 'navbar-inverse navbar-fixed-top', | ||
33 | + ], | ||
34 | + ]); | ||
35 | + $menuItems = [ | ||
36 | + ['label' => 'Home', 'url' => ['/site/index']], | ||
37 | + ['label' => 'About', 'url' => ['/site/about']], | ||
38 | + ['label' => 'Contact', 'url' => ['/site/contact']], | ||
39 | + ]; | ||
40 | + if (Yii::$app->user->isGuest) { | ||
41 | + $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; | ||
42 | + $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; | ||
43 | + } else { | ||
44 | + $menuItems[] = [ | ||
45 | + 'label' => 'Logout (' . Yii::$app->user->identity->username . ')', | ||
46 | + 'url' => ['/site/logout'], | ||
47 | + 'linkOptions' => ['data-method' => 'post'] | ||
48 | + ]; | ||
49 | + } | ||
50 | + echo Nav::widget([ | ||
51 | + 'options' => ['class' => 'navbar-nav navbar-right'], | ||
52 | + 'items' => $menuItems, | ||
53 | + ]); | ||
54 | + NavBar::end(); | ||
55 | + ?> | ||
56 | + | ||
57 | + <div class="container"> | ||
58 | + <?= Breadcrumbs::widget([ | ||
59 | + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | ||
60 | + ]) ?> | ||
61 | + <?= Alert::widget() ?> | ||
62 | + <?= $content ?> | ||
63 | + </div> | ||
64 | + </div> | ||
65 | + | ||
66 | + <footer class="footer"> | ||
67 | + <div class="container"> | ||
68 | + <p class="pull-left">© My Company <?= date('Y') ?></p> | ||
69 | + <p class="pull-right"><?= Yii::powered() ?></p> | ||
70 | + </div> | ||
71 | + </footer> | ||
72 | + | ||
73 | + <?php $this->endBody() ?> | ||
74 | +</body> | ||
75 | +</html> | ||
76 | +<?php $this->endPage() ?> |
1 | +++ a/frontend/views/site/about.php | ||
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | + | ||
4 | +/* @var $this yii\web\View */ | ||
5 | +$this->title = 'About'; | ||
6 | +$this->params['breadcrumbs'][] = $this->title; | ||
7 | +?> | ||
8 | +<div class="site-about"> | ||
9 | + <h1><?= Html::encode($this->title) ?></h1> | ||
10 | + | ||
11 | + <p>This is the About page. You may modify the following file to customize its content:</p> | ||
12 | + | ||
13 | + <code><?= __FILE__ ?></code> | ||
14 | +</div> |
1 | +++ a/frontend/views/site/contact.php | ||
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | +use yii\bootstrap\ActiveForm; | ||
4 | +use yii\captcha\Captcha; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $form yii\bootstrap\ActiveForm */ | ||
8 | +/* @var $model \frontend\models\ContactForm */ | ||
9 | + | ||
10 | +$this->title = 'Contact'; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="site-contact"> | ||
14 | + <h1><?= Html::encode($this->title) ?></h1> | ||
15 | + | ||
16 | + <p> | ||
17 | + If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. | ||
18 | + </p> | ||
19 | + | ||
20 | + <div class="row"> | ||
21 | + <div class="col-lg-5"> | ||
22 | + <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?> | ||
23 | + <?= $form->field($model, 'name') ?> | ||
24 | + <?= $form->field($model, 'email') ?> | ||
25 | + <?= $form->field($model, 'subject') ?> | ||
26 | + <?= $form->field($model, 'body')->textArea(['rows' => 6]) ?> | ||
27 | + <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [ | ||
28 | + 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>', | ||
29 | + ]) ?> | ||
30 | + <div class="form-group"> | ||
31 | + <?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?> | ||
32 | + </div> | ||
33 | + <?php ActiveForm::end(); ?> | ||
34 | + </div> | ||
35 | + </div> | ||
36 | + | ||
37 | +</div> |
1 | +++ a/frontend/views/site/error.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $name string */ | ||
7 | +/* @var $message string */ | ||
8 | +/* @var $exception Exception */ | ||
9 | + | ||
10 | +$this->title = $name; | ||
11 | +?> | ||
12 | +<div class="site-error"> | ||
13 | + | ||
14 | + <h1><?= Html::encode($this->title) ?></h1> | ||
15 | + | ||
16 | + <div class="alert alert-danger"> | ||
17 | + <?= nl2br(Html::encode($message)) ?> | ||
18 | + </div> | ||
19 | + | ||
20 | + <p> | ||
21 | + The above error occurred while the Web server was processing your request. | ||
22 | + </p> | ||
23 | + <p> | ||
24 | + Please contact us if you think this is a server error. Thank you. | ||
25 | + </p> | ||
26 | + | ||
27 | +</div> |
1 | +++ a/frontend/views/site/index.php | ||
1 | +<?php | ||
2 | +/* @var $this yii\web\View */ | ||
3 | +$this->title = 'My Yii Application'; | ||
4 | +?> | ||
5 | +<div class="site-index"> | ||
6 | + | ||
7 | + <div class="jumbotron"> | ||
8 | + <h1>Congratulations!</h1> | ||
9 | + | ||
10 | + <p class="lead">You have successfully created your Yii-powered application.</p> | ||
11 | + | ||
12 | + <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p> | ||
13 | + </div> | ||
14 | + | ||
15 | + <div class="body-content"> | ||
16 | + | ||
17 | + <div class="row"> | ||
18 | + <div class="col-lg-4"> | ||
19 | + <h2>Heading</h2> | ||
20 | + | ||
21 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | ||
22 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | ||
23 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | ||
24 | + fugiat nulla pariatur.</p> | ||
25 | + | ||
26 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation »</a></p> | ||
27 | + </div> | ||
28 | + <div class="col-lg-4"> | ||
29 | + <h2>Heading</h2> | ||
30 | + | ||
31 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | ||
32 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | ||
33 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | ||
34 | + fugiat nulla pariatur.</p> | ||
35 | + | ||
36 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum »</a></p> | ||
37 | + </div> | ||
38 | + <div class="col-lg-4"> | ||
39 | + <h2>Heading</h2> | ||
40 | + | ||
41 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | ||
42 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | ||
43 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | ||
44 | + fugiat nulla pariatur.</p> | ||
45 | + | ||
46 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions »</a></p> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | + | ||
50 | + </div> | ||
51 | +</div> |