Commit 58743b317cc5184757020b71d2cd239b19aa54b4
0 parents
init commit - base on yii2 advanced, clear main layout and and add simple upload…
… form and add htaccess
Showing
192 changed files
with
5627 additions
and
0 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 192 files are displayed.
| 1 | +++ a/.htaccess | |
| 1 | +Mod_Autoindex | |
| 2 | +<IfModule mod_autoindex.c> | |
| 3 | + # Запрещаем просмотр содержимого папок | |
| 4 | + Options -Indexes | |
| 5 | +</IfModule> | |
| 6 | + | |
| 7 | +Mod_Rewrite | |
| 8 | +<IfModule mod_rewrite.c> | |
| 9 | + Options +FollowSymlinks | |
| 10 | + # Включаем mod_rewrite | |
| 11 | + RewriteEngine On | |
| 12 | + IndexIgnore */* | |
| 13 | + # Перенаправляем administrator на входной скрипт админки | |
| 14 | + RewriteRule ^administrator/(.*)?$ /backend/web/$1 [L,PT] | |
| 15 | + RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] | |
| 16 | + # Перенаправляем все запросы на входной скрипт | |
| 17 | + RewriteRule ^([^/].*)?$ /frontend/web/$1 | |
| 18 | +</IfModule> | |
| 0 | 19 | \ No newline at end of file | ... | ... |
| 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 | +Documentation is at [docs/guide/README.md](docs/guide/README.md). | |
| 14 | + | |
| 15 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | |
| 16 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | |
| 17 | +[](https://travis-ci.org/yiisoft/yii2-app-advanced) | |
| 18 | + | |
| 19 | +DIRECTORY STRUCTURE | |
| 20 | +------------------- | |
| 21 | + | |
| 22 | +``` | |
| 23 | +common | |
| 24 | + config/ contains shared configurations | |
| 25 | + mail/ contains view files for e-mails | |
| 26 | + models/ contains model classes used in both backend and frontend | |
| 27 | +console | |
| 28 | + config/ contains console configurations | |
| 29 | + controllers/ contains console controllers (commands) | |
| 30 | + migrations/ contains database migrations | |
| 31 | + models/ contains console-specific model classes | |
| 32 | + runtime/ contains files generated during runtime | |
| 33 | +backend | |
| 34 | + assets/ contains application assets such as JavaScript and CSS | |
| 35 | + config/ contains backend configurations | |
| 36 | + controllers/ contains Web controller classes | |
| 37 | + models/ contains backend-specific model classes | |
| 38 | + runtime/ contains files generated during runtime | |
| 39 | + views/ contains view files for the Web application | |
| 40 | + web/ contains the entry script and Web resources | |
| 41 | +frontend | |
| 42 | + assets/ contains application assets such as JavaScript and CSS | |
| 43 | + config/ contains frontend configurations | |
| 44 | + controllers/ contains Web controller classes | |
| 45 | + models/ contains frontend-specific model classes | |
| 46 | + runtime/ contains files generated during runtime | |
| 47 | + views/ contains view files for the Web application | |
| 48 | + web/ contains the entry script and Web resources | |
| 49 | + widgets/ contains frontend widgets | |
| 50 | +vendor/ contains dependent 3rd-party packages | |
| 51 | +environments/ contains environment-based overrides | |
| 52 | +tests contains various tests for the advanced application | |
| 53 | + codeception/ contains tests developed with Codeception PHP Testing Framework | |
| 54 | +``` | ... | ... |
| 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 | + ]; | |
| 25 | + public $depends = [ | |
| 26 | + 'yii\web\YiiAsset', | |
| 27 | + 'yii\bootstrap\BootstrapAsset', | |
| 28 | + ]; | |
| 29 | +} | ... | ... |
| 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 | + 'user' => [ | |
| 17 | + 'identityClass' => 'common\models\User', | |
| 18 | + 'enableAutoLogin' => true, | |
| 19 | + ], | |
| 20 | + 'log' => [ | |
| 21 | + 'traceLevel' => YII_DEBUG ? 3 : 0, | |
| 22 | + 'targets' => [ | |
| 23 | + [ | |
| 24 | + 'class' => 'yii\log\FileTarget', | |
| 25 | + 'levels' => ['error', 'warning'], | |
| 26 | + ], | |
| 27 | + ], | |
| 28 | + ], | |
| 29 | + 'errorHandler' => [ | |
| 30 | + 'errorAction' => 'site/error', | |
| 31 | + ], | |
| 32 | + ], | |
| 33 | + 'params' => $params, | |
| 34 | +]; | ... | ... |
| 1 | +++ a/backend/controllers/ParserController.php | |
| 1 | +<?php | |
| 2 | +namespace backend\controllers; | |
| 3 | + | |
| 4 | +use Yii; | |
| 5 | +use yii\filters\AccessControl; | |
| 6 | +use yii\web\Controller; | |
| 7 | +use yii\filters\VerbFilter; | |
| 8 | +use app\models\UploadForm; | |
| 9 | +use yii\web\UploadedFile; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Site controller | |
| 13 | + */ | |
| 14 | +class ParserController extends Controller | |
| 15 | +{ | |
| 16 | + /** | |
| 17 | + * @inheritdoc | |
| 18 | + */ | |
| 19 | + public function behaviors() | |
| 20 | + { | |
| 21 | + return [ | |
| 22 | + 'access' => [ | |
| 23 | + 'class' => AccessControl::className(), | |
| 24 | + 'rules' => [ | |
| 25 | + [ | |
| 26 | + 'actions' => ['index'], | |
| 27 | + 'allow' => true, | |
| 28 | + 'roles' => ['@'], | |
| 29 | + ], | |
| 30 | + ], | |
| 31 | + ], | |
| 32 | + 'verbs' => [ | |
| 33 | + 'class' => VerbFilter::className(), | |
| 34 | + 'actions' => [ | |
| 35 | + 'logout' => ['post'], | |
| 36 | + ], | |
| 37 | + ], | |
| 38 | + ]; | |
| 39 | + } | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * @inheritdoc | |
| 43 | + */ | |
| 44 | + public function actions() | |
| 45 | + { | |
| 46 | + return [ | |
| 47 | + 'error' => [ | |
| 48 | + 'class' => 'yii\web\ErrorAction', | |
| 49 | + ], | |
| 50 | + ]; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public function actionIndex() | |
| 54 | + { | |
| 55 | + $model = new UploadForm(); | |
| 56 | + | |
| 57 | + if (Yii::$app->request->isPost) { | |
| 58 | + $model->file = UploadedFile::getInstance($model, 'file'); | |
| 59 | + | |
| 60 | + if ($model->file && $model->validate()) { | |
| 61 | + $model->file->saveAs(Yii::getAlias('@webroot') . '/uploads/' . $model->file->baseName . '.' . $model->file->extension); | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + return $this->render('parser', ['model' => $model]); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | +} | ... | ... |
| 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 app\models; | |
| 3 | + | |
| 4 | +use yii\base\Model; | |
| 5 | +use yii\web\UploadedFile; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * UploadForm is the model behind the upload form. | |
| 9 | + */ | |
| 10 | +class UploadForm extends Model | |
| 11 | +{ | |
| 12 | + /** | |
| 13 | + * @var UploadedFile file attribute | |
| 14 | + */ | |
| 15 | + public $file; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * @return array the validation rules. | |
| 19 | + */ | |
| 20 | + public function rules() | |
| 21 | + { | |
| 22 | + return [ | |
| 23 | + [['file'], 'file'], | |
| 24 | + ]; | |
| 25 | + } | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
| 1 | +++ a/backend/views/layouts/main.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this \yii\web\View */ | |
| 4 | +/* @var $content string */ | |
| 5 | + | |
| 6 | +use backend\assets\AppAsset; | |
| 7 | +use yii\helpers\Html; | |
| 8 | +use yii\bootstrap\Nav; | |
| 9 | +use yii\bootstrap\NavBar; | |
| 10 | +use yii\widgets\Breadcrumbs; | |
| 11 | +use common\widgets\Alert; | |
| 12 | +use yii\widgets\Menu; | |
| 13 | + | |
| 14 | +AppAsset::register($this); | |
| 15 | +?> | |
| 16 | +<?php $this->beginPage() ?> | |
| 17 | +<!DOCTYPE html> | |
| 18 | +<html lang="<?= Yii::$app->language ?>"> | |
| 19 | +<head> | |
| 20 | + <meta charset="<?= Yii::$app->charset ?>"> | |
| 21 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| 22 | + <?= Html::csrfMetaTags() ?> | |
| 23 | + <title><?= Html::encode($this->title) ?></title> | |
| 24 | + <?php $this->head() ?> | |
| 25 | +</head> | |
| 26 | +<body> | |
| 27 | +<?php $this->beginBody() ?> | |
| 28 | + | |
| 29 | +<div class="wrap"> | |
| 30 | + | |
| 31 | + | |
| 32 | + <div class="container"> | |
| 33 | + <div class="right_block"> | |
| 34 | + <?= $content ?> | |
| 35 | + </div> | |
| 36 | + <div class="left_block"> | |
| 37 | + <?php | |
| 38 | + echo Menu::widget([ | |
| 39 | + 'options' => ['class' => 'nav nav-pills nav-stacked'], | |
| 40 | + 'items' => [ | |
| 41 | + ['label' => 'Загрузка прайсов', 'url' => ['parser/index']], | |
| 42 | +// | |
| 43 | + ], | |
| 44 | + ]); | |
| 45 | + ?> | |
| 46 | + | |
| 47 | + </div> | |
| 48 | + | |
| 49 | + </div> | |
| 50 | + | |
| 51 | + <footer class="footer"> | |
| 52 | + <div class="container"> | |
| 53 | + | |
| 54 | + </div> | |
| 55 | + </footer> | |
| 56 | + | |
| 57 | + <?php $this->endBody() ?> | |
| 58 | +</body> | |
| 59 | +</html> | |
| 60 | +<?php $this->endPage() ?> | ... | ... |
| 1 | +++ a/backend/views/parser/parser.php | |
| 1 | +<?php | |
| 2 | +use yii\widgets\ActiveForm; | |
| 3 | +?> | |
| 4 | + | |
| 5 | +<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?> | |
| 6 | + | |
| 7 | +<?= $form->field($model, 'file')->fileInput() ?> | |
| 8 | + | |
| 9 | +<button>Отправить</button> | |
| 10 | + | |
| 11 | +<?php ActiveForm::end() ?> | |
| 0 | 12 | \ No newline at end of file | ... | ... |
| 1 | +++ a/backend/views/site/error.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $name string */ | |
| 5 | +/* @var $message string */ | |
| 6 | +/* @var $exception Exception */ | |
| 7 | + | |
| 8 | +use yii\helpers\Html; | |
| 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/login.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
| 5 | +/* @var $model \common\models\LoginForm */ | |
| 6 | + | |
| 7 | +use yii\helpers\Html; | |
| 8 | +use yii\bootstrap\ActiveForm; | |
| 9 | + | |
| 10 | +$this->title = 'Login'; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="site-login"> | |
| 14 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 15 | + | |
| 16 | + <p>Please fill out the following fields to login:</p> | |
| 17 | + | |
| 18 | + <div class="row"> | |
| 19 | + <div class="col-lg-5"> | |
| 20 | + <?php $form = ActiveForm::begin(['id' => 'login-form']); ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'username') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'password')->passwordInput() ?> | |
| 25 | + | |
| 26 | + <?= $form->field($model, 'rememberMe')->checkbox() ?> | |
| 27 | + | |
| 28 | + <div class="form-group"> | |
| 29 | + <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?> | |
| 30 | + </div> | |
| 31 | + | |
| 32 | + <?php ActiveForm::end(); ?> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | +</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 | +} | |
| 92 | + | |
| 93 | +.container{ | |
| 94 | + min-width: 960px; | |
| 95 | +} | |
| 96 | + | |
| 97 | +.left_block{ | |
| 98 | + width: 15%; | |
| 99 | + float: left; | |
| 100 | +} | |
| 101 | +.right_block{ | |
| 102 | + float: left; | |
| 103 | + width: 80%; | |
| 104 | + margin-left: 20px; | |
| 105 | +} | |
| 106 | +.active_{ | |
| 107 | + background: none; | |
| 108 | +} | |
| 109 | +.non_active{ | |
| 110 | + background: #adadad; | |
| 111 | +} | |
| 112 | + | |
| 113 | +.site-login { | |
| 114 | + width: 700px; | |
| 115 | + margin: 100px auto; | |
| 116 | +} | |
| 117 | + | |
| 118 | +.gallery_image{ | |
| 119 | + | |
| 120 | + position: relative; | |
| 121 | + margin-left: 20px; | |
| 122 | + margin-top: 20px; | |
| 123 | + display: inline-block; | |
| 124 | +} | |
| 125 | +.delete-gallery-item{ | |
| 126 | + background-color: #fff; | |
| 127 | + opacity: 0.5; | |
| 128 | + font-size: 20px; | |
| 129 | + position: absolute; | |
| 130 | + top: 5px; | |
| 131 | + right: 5px; | |
| 132 | + cursor: pointer; | |
| 133 | +} | |
| 134 | + | |
| 135 | +.delete-field-item{ | |
| 136 | + position: absolute; | |
| 137 | + top: 33%; | |
| 138 | + right: -35px; | |
| 139 | + font-size: 15px; | |
| 140 | + cursor: pointer; | |
| 141 | +} | |
| 142 | + | |
| 143 | +.form-group{ | |
| 144 | + position: relative; | |
| 145 | +} | |
| 0 | 146 | \ No newline at end of file | ... | ... |
No preview for this file type
| 1 | +++ a/common/config/bootstrap.php | |
| 1 | +<?php | |
| 2 | +Yii::setAlias('common', dirname(__DIR__)); | |
| 3 | +Yii::setAlias('frontend', dirname(dirname(__DIR__)) . '/frontend'); | |
| 4 | +Yii::setAlias('backend', dirname(dirname(__DIR__)) . '/backend'); | |
| 5 | +Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console'); | ... | ... |
| 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; | |
| 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 | + protected function getUser() | |
| 71 | + { | |
| 72 | + if ($this->_user === null) { | |
| 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 | + | |
| 115 | + $timestamp = (int) substr($token, strrpos($token, '_') + 1); | |
| 116 | + $expire = Yii::$app->params['user.passwordResetTokenExpire']; | |
| 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/common/widgets/Alert.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 common\widgets; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Alert widget renders a message from session flash. All flash messages are displayed | |
| 12 | + * in the sequence they were assigned using setFlash. You can set message as following: | |
| 13 | + * | |
| 14 | + * ```php | |
| 15 | + * \Yii::$app->session->setFlash('error', 'This is the message'); | |
| 16 | + * \Yii::$app->session->setFlash('success', 'This is the message'); | |
| 17 | + * \Yii::$app->session->setFlash('info', 'This is the message'); | |
| 18 | + * ``` | |
| 19 | + * | |
| 20 | + * Multiple messages could be set as follows: | |
| 21 | + * | |
| 22 | + * ```php | |
| 23 | + * \Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); | |
| 24 | + * ``` | |
| 25 | + * | |
| 26 | + * @author Kartik Visweswaran <kartikv2@gmail.com> | |
| 27 | + * @author Alexander Makarov <sam@rmcreative.ru> | |
| 28 | + */ | |
| 29 | +class Alert extends \yii\bootstrap\Widget | |
| 30 | +{ | |
| 31 | + /** | |
| 32 | + * @var array the alert types configuration for the flash messages. | |
| 33 | + * This array is setup as $key => $value, where: | |
| 34 | + * - $key is the name of the session flash variable | |
| 35 | + * - $value is the bootstrap alert type (i.e. danger, success, info, warning) | |
| 36 | + */ | |
| 37 | + public $alertTypes = [ | |
| 38 | + 'error' => 'alert-danger', | |
| 39 | + 'danger' => 'alert-danger', | |
| 40 | + 'success' => 'alert-success', | |
| 41 | + 'info' => 'alert-info', | |
| 42 | + 'warning' => 'alert-warning' | |
| 43 | + ]; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * @var array the options for rendering the close button tag. | |
| 47 | + */ | |
| 48 | + public $closeButton = []; | |
| 49 | + | |
| 50 | + public function init() | |
| 51 | + { | |
| 52 | + parent::init(); | |
| 53 | + | |
| 54 | + $session = \Yii::$app->session; | |
| 55 | + $flashes = $session->getAllFlashes(); | |
| 56 | + $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; | |
| 57 | + | |
| 58 | + foreach ($flashes as $type => $data) { | |
| 59 | + if (isset($this->alertTypes[$type])) { | |
| 60 | + $data = (array) $data; | |
| 61 | + foreach ($data as $i => $message) { | |
| 62 | + /* initialize css class for each alert box */ | |
| 63 | + $this->options['class'] = $this->alertTypes[$type] . $appendCss; | |
| 64 | + | |
| 65 | + /* assign unique id to each alert box */ | |
| 66 | + $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; | |
| 67 | + | |
| 68 | + echo \yii\bootstrap\Alert::widget([ | |
| 69 | + 'body' => $message, | |
| 70 | + 'closeButton' => $this->closeButton, | |
| 71 | + 'options' => $this->options, | |
| 72 | + ]); | |
| 73 | + } | |
| 74 | + | |
| 75 | + $session->removeFlash($type); | |
| 76 | + } | |
| 77 | + } | |
| 78 | + } | |
| 79 | +} | ... | ... |
| 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.6", | |
| 19 | + "yiisoft/yii2-bootstrap": "*", | |
| 20 | + "yiisoft/yii2-swiftmailer": "*" | |
| 21 | + }, | |
| 22 | + "require-dev": { | |
| 23 | + "yiisoft/yii2-codeception": "*", | |
| 24 | + "yiisoft/yii2-debug": "*", | |
| 25 | + "yiisoft/yii2-gii": "*", | |
| 26 | + "yiisoft/yii2-faker": "*" | |
| 27 | + }, | |
| 28 | + "config": { | |
| 29 | + "process-timeout": 1800 | |
| 30 | + }, | |
| 31 | + "extra": { | |
| 32 | + "asset-installer-paths": { | |
| 33 | + "npm-asset-library": "vendor/npm", | |
| 34 | + "bower-asset-library": "vendor/bower" | |
| 35 | + } | |
| 36 | + } | |
| 37 | +} | ... | ... |
| 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": "8580bd82955b1fbb80d47024e184056e", | |
| 8 | + "packages": [ | |
| 9 | + { | |
| 10 | + "name": "bower-asset/bootstrap", | |
| 11 | + "version": "v3.3.5", | |
| 12 | + "source": { | |
| 13 | + "type": "git", | |
| 14 | + "url": "https://github.com/twbs/bootstrap.git", | |
| 15 | + "reference": "16b48259a62f576e52c903c476bd42b90ab22482" | |
| 16 | + }, | |
| 17 | + "dist": { | |
| 18 | + "type": "zip", | |
| 19 | + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/16b48259a62f576e52c903c476bd42b90ab22482", | |
| 20 | + "reference": "16b48259a62f576e52c903c476bd42b90ab22482", | |
| 21 | + "shasum": "" | |
| 22 | + }, | |
| 23 | + "require": { | |
| 24 | + "bower-asset/jquery": ">=1.9.1" | |
| 25 | + }, | |
| 26 | + "type": "bower-asset-library", | |
| 27 | + "extra": { | |
| 28 | + "bower-asset-main": [ | |
| 29 | + "less/bootstrap.less", | |
| 30 | + "dist/js/bootstrap.js" | |
| 31 | + ], | |
| 32 | + "bower-asset-ignore": [ | |
| 33 | + "/.*", | |
| 34 | + "_config.yml", | |
| 35 | + "CNAME", | |
| 36 | + "composer.json", | |
| 37 | + "CONTRIBUTING.md", | |
| 38 | + "docs", | |
| 39 | + "js/tests", | |
| 40 | + "test-infra" | |
| 41 | + ] | |
| 42 | + }, | |
| 43 | + "license": [ | |
| 44 | + "MIT" | |
| 45 | + ], | |
| 46 | + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", | |
| 47 | + "keywords": [ | |
| 48 | + "css", | |
| 49 | + "framework", | |
| 50 | + "front-end", | |
| 51 | + "js", | |
| 52 | + "less", | |
| 53 | + "mobile-first", | |
| 54 | + "responsive", | |
| 55 | + "web" | |
| 56 | + ] | |
| 57 | + }, | |
| 58 | + { | |
| 59 | + "name": "bower-asset/jquery", | |
| 60 | + "version": "2.1.4", | |
| 61 | + "source": { | |
| 62 | + "type": "git", | |
| 63 | + "url": "https://github.com/jquery/jquery.git", | |
| 64 | + "reference": "7751e69b615c6eca6f783a81e292a55725af6b85" | |
| 65 | + }, | |
| 66 | + "dist": { | |
| 67 | + "type": "zip", | |
| 68 | + "url": "https://api.github.com/repos/jquery/jquery/zipball/7751e69b615c6eca6f783a81e292a55725af6b85", | |
| 69 | + "reference": "7751e69b615c6eca6f783a81e292a55725af6b85", | |
| 70 | + "shasum": "" | |
| 71 | + }, | |
| 72 | + "require-dev": { | |
| 73 | + "bower-asset/qunit": "1.14.0", | |
| 74 | + "bower-asset/requirejs": "2.1.10", | |
| 75 | + "bower-asset/sinon": "1.8.1", | |
| 76 | + "bower-asset/sizzle": "2.1.1-patch2" | |
| 77 | + }, | |
| 78 | + "type": "bower-asset-library", | |
| 79 | + "extra": { | |
| 80 | + "bower-asset-main": "dist/jquery.js", | |
| 81 | + "bower-asset-ignore": [ | |
| 82 | + "**/.*", | |
| 83 | + "build", | |
| 84 | + "dist/cdn", | |
| 85 | + "speed", | |
| 86 | + "test", | |
| 87 | + "*.md", | |
| 88 | + "AUTHORS.txt", | |
| 89 | + "Gruntfile.js", | |
| 90 | + "package.json" | |
| 91 | + ] | |
| 92 | + }, | |
| 93 | + "license": [ | |
| 94 | + "MIT" | |
| 95 | + ], | |
| 96 | + "keywords": [ | |
| 97 | + "javascript", | |
| 98 | + "jquery", | |
| 99 | + "library" | |
| 100 | + ] | |
| 101 | + }, | |
| 102 | + { | |
| 103 | + "name": "bower-asset/jquery.inputmask", | |
| 104 | + "version": "3.1.63", | |
| 105 | + "source": { | |
| 106 | + "type": "git", | |
| 107 | + "url": "https://github.com/RobinHerbots/jquery.inputmask.git", | |
| 108 | + "reference": "c40c7287eadc31e341ebbf0c02352eb55b9cbc48" | |
| 109 | + }, | |
| 110 | + "dist": { | |
| 111 | + "type": "zip", | |
| 112 | + "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/c40c7287eadc31e341ebbf0c02352eb55b9cbc48", | |
| 113 | + "reference": "c40c7287eadc31e341ebbf0c02352eb55b9cbc48", | |
| 114 | + "shasum": "" | |
| 115 | + }, | |
| 116 | + "require": { | |
| 117 | + "bower-asset/jquery": ">=1.7" | |
| 118 | + }, | |
| 119 | + "type": "bower-asset-library", | |
| 120 | + "extra": { | |
| 121 | + "bower-asset-main": [ | |
| 122 | + "./dist/inputmask/jquery.inputmask.js", | |
| 123 | + "./dist/inputmask/jquery.inputmask.extensions.js", | |
| 124 | + "./dist/inputmask/jquery.inputmask.date.extensions.js", | |
| 125 | + "./dist/inputmask/jquery.inputmask.numeric.extensions.js", | |
| 126 | + "./dist/inputmask/jquery.inputmask.phone.extensions.js", | |
| 127 | + "./dist/inputmask/jquery.inputmask.regex.extensions.js" | |
| 128 | + ], | |
| 129 | + "bower-asset-ignore": [ | |
| 130 | + "**/.*", | |
| 131 | + "qunit/", | |
| 132 | + "nuget/", | |
| 133 | + "tools/", | |
| 134 | + "js/", | |
| 135 | + "*.md", | |
| 136 | + "build.properties", | |
| 137 | + "build.xml", | |
| 138 | + "jquery.inputmask.jquery.json" | |
| 139 | + ] | |
| 140 | + }, | |
| 141 | + "license": [ | |
| 142 | + "http://opensource.org/licenses/mit-license.php" | |
| 143 | + ], | |
| 144 | + "description": "jquery.inputmask is a jquery plugin which create an input mask.", | |
| 145 | + "keywords": [ | |
| 146 | + "form", | |
| 147 | + "input", | |
| 148 | + "inputmask", | |
| 149 | + "jquery", | |
| 150 | + "mask", | |
| 151 | + "plugins" | |
| 152 | + ] | |
| 153 | + }, | |
| 154 | + { | |
| 155 | + "name": "bower-asset/punycode", | |
| 156 | + "version": "v1.3.2", | |
| 157 | + "source": { | |
| 158 | + "type": "git", | |
| 159 | + "url": "https://github.com/bestiejs/punycode.js.git", | |
| 160 | + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" | |
| 161 | + }, | |
| 162 | + "dist": { | |
| 163 | + "type": "zip", | |
| 164 | + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", | |
| 165 | + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", | |
| 166 | + "shasum": "" | |
| 167 | + }, | |
| 168 | + "type": "bower-asset-library", | |
| 169 | + "extra": { | |
| 170 | + "bower-asset-main": "punycode.js", | |
| 171 | + "bower-asset-ignore": [ | |
| 172 | + "coverage", | |
| 173 | + "tests", | |
| 174 | + ".*", | |
| 175 | + "component.json", | |
| 176 | + "Gruntfile.js", | |
| 177 | + "node_modules", | |
| 178 | + "package.json" | |
| 179 | + ] | |
| 180 | + } | |
| 181 | + }, | |
| 182 | + { | |
| 183 | + "name": "bower-asset/yii2-pjax", | |
| 184 | + "version": "v2.0.4", | |
| 185 | + "source": { | |
| 186 | + "type": "git", | |
| 187 | + "url": "https://github.com/yiisoft/jquery-pjax.git", | |
| 188 | + "reference": "3f20897307cca046fca5323b318475ae9dac0ca0" | |
| 189 | + }, | |
| 190 | + "dist": { | |
| 191 | + "type": "zip", | |
| 192 | + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/3f20897307cca046fca5323b318475ae9dac0ca0", | |
| 193 | + "reference": "3f20897307cca046fca5323b318475ae9dac0ca0", | |
| 194 | + "shasum": "" | |
| 195 | + }, | |
| 196 | + "require": { | |
| 197 | + "bower-asset/jquery": ">=1.8" | |
| 198 | + }, | |
| 199 | + "type": "bower-asset-library", | |
| 200 | + "extra": { | |
| 201 | + "bower-asset-main": "./jquery.pjax.js", | |
| 202 | + "bower-asset-ignore": [ | |
| 203 | + ".travis.yml", | |
| 204 | + "Gemfile", | |
| 205 | + "Gemfile.lock", | |
| 206 | + "vendor/", | |
| 207 | + "script/", | |
| 208 | + "test/" | |
| 209 | + ] | |
| 210 | + }, | |
| 211 | + "license": [ | |
| 212 | + "MIT" | |
| 213 | + ] | |
| 214 | + }, | |
| 215 | + { | |
| 216 | + "name": "cebe/markdown", | |
| 217 | + "version": "1.1.0", | |
| 218 | + "source": { | |
| 219 | + "type": "git", | |
| 220 | + "url": "https://github.com/cebe/markdown.git", | |
| 221 | + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2" | |
| 222 | + }, | |
| 223 | + "dist": { | |
| 224 | + "type": "zip", | |
| 225 | + "url": "https://api.github.com/repos/cebe/markdown/zipball/54a2c49de31cc44e864ebf0500a35ef21d0010b2", | |
| 226 | + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2", | |
| 227 | + "shasum": "" | |
| 228 | + }, | |
| 229 | + "require": { | |
| 230 | + "lib-pcre": "*", | |
| 231 | + "php": ">=5.4.0" | |
| 232 | + }, | |
| 233 | + "require-dev": { | |
| 234 | + "cebe/indent": "*", | |
| 235 | + "facebook/xhprof": "*@dev", | |
| 236 | + "phpunit/phpunit": "4.1.*" | |
| 237 | + }, | |
| 238 | + "bin": [ | |
| 239 | + "bin/markdown" | |
| 240 | + ], | |
| 241 | + "type": "library", | |
| 242 | + "extra": { | |
| 243 | + "branch-alias": { | |
| 244 | + "dev-master": "1.1.x-dev" | |
| 245 | + } | |
| 246 | + }, | |
| 247 | + "autoload": { | |
| 248 | + "psr-4": { | |
| 249 | + "cebe\\markdown\\": "" | |
| 250 | + } | |
| 251 | + }, | |
| 252 | + "notification-url": "https://packagist.org/downloads/", | |
| 253 | + "license": [ | |
| 254 | + "MIT" | |
| 255 | + ], | |
| 256 | + "authors": [ | |
| 257 | + { | |
| 258 | + "name": "Carsten Brandt", | |
| 259 | + "email": "mail@cebe.cc", | |
| 260 | + "homepage": "http://cebe.cc/", | |
| 261 | + "role": "Creator" | |
| 262 | + } | |
| 263 | + ], | |
| 264 | + "description": "A super fast, highly extensible markdown parser for PHP", | |
| 265 | + "homepage": "https://github.com/cebe/markdown#readme", | |
| 266 | + "keywords": [ | |
| 267 | + "extensible", | |
| 268 | + "fast", | |
| 269 | + "gfm", | |
| 270 | + "markdown", | |
| 271 | + "markdown-extra" | |
| 272 | + ], | |
| 273 | + "time": "2015-03-06 05:28:07" | |
| 274 | + }, | |
| 275 | + { | |
| 276 | + "name": "ezyang/htmlpurifier", | |
| 277 | + "version": "v4.6.0", | |
| 278 | + "source": { | |
| 279 | + "type": "git", | |
| 280 | + "url": "https://github.com/ezyang/htmlpurifier.git", | |
| 281 | + "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd" | |
| 282 | + }, | |
| 283 | + "dist": { | |
| 284 | + "type": "zip", | |
| 285 | + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/6f389f0f25b90d0b495308efcfa073981177f0fd", | |
| 286 | + "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd", | |
| 287 | + "shasum": "" | |
| 288 | + }, | |
| 289 | + "require": { | |
| 290 | + "php": ">=5.2" | |
| 291 | + }, | |
| 292 | + "type": "library", | |
| 293 | + "autoload": { | |
| 294 | + "psr-0": { | |
| 295 | + "HTMLPurifier": "library/" | |
| 296 | + }, | |
| 297 | + "files": [ | |
| 298 | + "library/HTMLPurifier.composer.php" | |
| 299 | + ] | |
| 300 | + }, | |
| 301 | + "notification-url": "https://packagist.org/downloads/", | |
| 302 | + "license": [ | |
| 303 | + "LGPL" | |
| 304 | + ], | |
| 305 | + "authors": [ | |
| 306 | + { | |
| 307 | + "name": "Edward Z. Yang", | |
| 308 | + "email": "admin@htmlpurifier.org", | |
| 309 | + "homepage": "http://ezyang.com" | |
| 310 | + } | |
| 311 | + ], | |
| 312 | + "description": "Standards compliant HTML filter written in PHP", | |
| 313 | + "homepage": "http://htmlpurifier.org/", | |
| 314 | + "keywords": [ | |
| 315 | + "html" | |
| 316 | + ], | |
| 317 | + "time": "2013-11-30 08:25:19" | |
| 318 | + }, | |
| 319 | + { | |
| 320 | + "name": "swiftmailer/swiftmailer", | |
| 321 | + "version": "v5.4.1", | |
| 322 | + "source": { | |
| 323 | + "type": "git", | |
| 324 | + "url": "https://github.com/swiftmailer/swiftmailer.git", | |
| 325 | + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" | |
| 326 | + }, | |
| 327 | + "dist": { | |
| 328 | + "type": "zip", | |
| 329 | + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", | |
| 330 | + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", | |
| 331 | + "shasum": "" | |
| 332 | + }, | |
| 333 | + "require": { | |
| 334 | + "php": ">=5.3.3" | |
| 335 | + }, | |
| 336 | + "require-dev": { | |
| 337 | + "mockery/mockery": "~0.9.1,<0.9.4" | |
| 338 | + }, | |
| 339 | + "type": "library", | |
| 340 | + "extra": { | |
| 341 | + "branch-alias": { | |
| 342 | + "dev-master": "5.4-dev" | |
| 343 | + } | |
| 344 | + }, | |
| 345 | + "autoload": { | |
| 346 | + "files": [ | |
| 347 | + "lib/swift_required.php" | |
| 348 | + ] | |
| 349 | + }, | |
| 350 | + "notification-url": "https://packagist.org/downloads/", | |
| 351 | + "license": [ | |
| 352 | + "MIT" | |
| 353 | + ], | |
| 354 | + "authors": [ | |
| 355 | + { | |
| 356 | + "name": "Chris Corbyn" | |
| 357 | + }, | |
| 358 | + { | |
| 359 | + "name": "Fabien Potencier", | |
| 360 | + "email": "fabien@symfony.com" | |
| 361 | + } | |
| 362 | + ], | |
| 363 | + "description": "Swiftmailer, free feature-rich PHP mailer", | |
| 364 | + "homepage": "http://swiftmailer.org", | |
| 365 | + "keywords": [ | |
| 366 | + "email", | |
| 367 | + "mail", | |
| 368 | + "mailer" | |
| 369 | + ], | |
| 370 | + "time": "2015-06-06 14:19:39" | |
| 371 | + }, | |
| 372 | + { | |
| 373 | + "name": "yiisoft/yii2", | |
| 374 | + "version": "2.0.6", | |
| 375 | + "source": { | |
| 376 | + "type": "git", | |
| 377 | + "url": "https://github.com/yiisoft/yii2-framework.git", | |
| 378 | + "reference": "f42b2eb80f61992438661b01d0d74c6738e2ff38" | |
| 379 | + }, | |
| 380 | + "dist": { | |
| 381 | + "type": "zip", | |
| 382 | + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/f42b2eb80f61992438661b01d0d74c6738e2ff38", | |
| 383 | + "reference": "f42b2eb80f61992438661b01d0d74c6738e2ff38", | |
| 384 | + "shasum": "" | |
| 385 | + }, | |
| 386 | + "require": { | |
| 387 | + "bower-asset/jquery": "2.1.*@stable | 1.11.*@stable", | |
| 388 | + "bower-asset/jquery.inputmask": "3.1.*", | |
| 389 | + "bower-asset/punycode": "1.3.*", | |
| 390 | + "bower-asset/yii2-pjax": ">=2.0.1", | |
| 391 | + "cebe/markdown": "~1.0.0 | ~1.1.0", | |
| 392 | + "ext-mbstring": "*", | |
| 393 | + "ezyang/htmlpurifier": "4.6.*", | |
| 394 | + "lib-pcre": "*", | |
| 395 | + "php": ">=5.4.0", | |
| 396 | + "yiisoft/yii2-composer": "*" | |
| 397 | + }, | |
| 398 | + "bin": [ | |
| 399 | + "yii" | |
| 400 | + ], | |
| 401 | + "type": "library", | |
| 402 | + "extra": { | |
| 403 | + "branch-alias": { | |
| 404 | + "dev-master": "2.0.x-dev" | |
| 405 | + } | |
| 406 | + }, | |
| 407 | + "autoload": { | |
| 408 | + "psr-4": { | |
| 409 | + "yii\\": "" | |
| 410 | + } | |
| 411 | + }, | |
| 412 | + "notification-url": "https://packagist.org/downloads/", | |
| 413 | + "license": [ | |
| 414 | + "BSD-3-Clause" | |
| 415 | + ], | |
| 416 | + "authors": [ | |
| 417 | + { | |
| 418 | + "name": "Qiang Xue", | |
| 419 | + "email": "qiang.xue@gmail.com", | |
| 420 | + "homepage": "http://www.yiiframework.com/", | |
| 421 | + "role": "Founder and project lead" | |
| 422 | + }, | |
| 423 | + { | |
| 424 | + "name": "Alexander Makarov", | |
| 425 | + "email": "sam@rmcreative.ru", | |
| 426 | + "homepage": "http://rmcreative.ru/", | |
| 427 | + "role": "Core framework development" | |
| 428 | + }, | |
| 429 | + { | |
| 430 | + "name": "Maurizio Domba", | |
| 431 | + "homepage": "http://mdomba.info/", | |
| 432 | + "role": "Core framework development" | |
| 433 | + }, | |
| 434 | + { | |
| 435 | + "name": "Carsten Brandt", | |
| 436 | + "email": "mail@cebe.cc", | |
| 437 | + "homepage": "http://cebe.cc/", | |
| 438 | + "role": "Core framework development" | |
| 439 | + }, | |
| 440 | + { | |
| 441 | + "name": "Timur Ruziev", | |
| 442 | + "email": "resurtm@gmail.com", | |
| 443 | + "homepage": "http://resurtm.com/", | |
| 444 | + "role": "Core framework development" | |
| 445 | + }, | |
| 446 | + { | |
| 447 | + "name": "Paul Klimov", | |
| 448 | + "email": "klimov.paul@gmail.com", | |
| 449 | + "role": "Core framework development" | |
| 450 | + } | |
| 451 | + ], | |
| 452 | + "description": "Yii PHP Framework Version 2", | |
| 453 | + "homepage": "http://www.yiiframework.com/", | |
| 454 | + "keywords": [ | |
| 455 | + "framework", | |
| 456 | + "yii2" | |
| 457 | + ], | |
| 458 | + "time": "2015-08-05 22:00:30" | |
| 459 | + }, | |
| 460 | + { | |
| 461 | + "name": "yiisoft/yii2-bootstrap", | |
| 462 | + "version": "2.0.4", | |
| 463 | + "source": { | |
| 464 | + "type": "git", | |
| 465 | + "url": "https://github.com/yiisoft/yii2-bootstrap.git", | |
| 466 | + "reference": "1b6b1e61cf91c3cdd517d6a7e71d30bb212e4af0" | |
| 467 | + }, | |
| 468 | + "dist": { | |
| 469 | + "type": "zip", | |
| 470 | + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/1b6b1e61cf91c3cdd517d6a7e71d30bb212e4af0", | |
| 471 | + "reference": "1b6b1e61cf91c3cdd517d6a7e71d30bb212e4af0", | |
| 472 | + "shasum": "" | |
| 473 | + }, | |
| 474 | + "require": { | |
| 475 | + "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", | |
| 476 | + "yiisoft/yii2": ">=2.0.4" | |
| 477 | + }, | |
| 478 | + "type": "yii2-extension", | |
| 479 | + "extra": { | |
| 480 | + "branch-alias": { | |
| 481 | + "dev-master": "2.0.x-dev" | |
| 482 | + }, | |
| 483 | + "asset-installer-paths": { | |
| 484 | + "npm-asset-library": "vendor/npm", | |
| 485 | + "bower-asset-library": "vendor/bower" | |
| 486 | + } | |
| 487 | + }, | |
| 488 | + "autoload": { | |
| 489 | + "psr-4": { | |
| 490 | + "yii\\bootstrap\\": "" | |
| 491 | + } | |
| 492 | + }, | |
| 493 | + "notification-url": "https://packagist.org/downloads/", | |
| 494 | + "license": [ | |
| 495 | + "BSD-3-Clause" | |
| 496 | + ], | |
| 497 | + "authors": [ | |
| 498 | + { | |
| 499 | + "name": "Qiang Xue", | |
| 500 | + "email": "qiang.xue@gmail.com" | |
| 501 | + } | |
| 502 | + ], | |
| 503 | + "description": "The Twitter Bootstrap extension for the Yii framework", | |
| 504 | + "keywords": [ | |
| 505 | + "bootstrap", | |
| 506 | + "yii2" | |
| 507 | + ], | |
| 508 | + "time": "2015-05-10 22:08:17" | |
| 509 | + }, | |
| 510 | + { | |
| 511 | + "name": "yiisoft/yii2-composer", | |
| 512 | + "version": "2.0.3", | |
| 513 | + "source": { | |
| 514 | + "type": "git", | |
| 515 | + "url": "https://github.com/yiisoft/yii2-composer.git", | |
| 516 | + "reference": "ca8d23707ae47d20b0454e4b135c156f6da6d7be" | |
| 517 | + }, | |
| 518 | + "dist": { | |
| 519 | + "type": "zip", | |
| 520 | + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/ca8d23707ae47d20b0454e4b135c156f6da6d7be", | |
| 521 | + "reference": "ca8d23707ae47d20b0454e4b135c156f6da6d7be", | |
| 522 | + "shasum": "" | |
| 523 | + }, | |
| 524 | + "require": { | |
| 525 | + "composer-plugin-api": "1.0.0" | |
| 526 | + }, | |
| 527 | + "type": "composer-plugin", | |
| 528 | + "extra": { | |
| 529 | + "class": "yii\\composer\\Plugin", | |
| 530 | + "branch-alias": { | |
| 531 | + "dev-master": "2.0.x-dev" | |
| 532 | + } | |
| 533 | + }, | |
| 534 | + "autoload": { | |
| 535 | + "psr-4": { | |
| 536 | + "yii\\composer\\": "" | |
| 537 | + } | |
| 538 | + }, | |
| 539 | + "notification-url": "https://packagist.org/downloads/", | |
| 540 | + "license": [ | |
| 541 | + "BSD-3-Clause" | |
| 542 | + ], | |
| 543 | + "authors": [ | |
| 544 | + { | |
| 545 | + "name": "Qiang Xue", | |
| 546 | + "email": "qiang.xue@gmail.com" | |
| 547 | + } | |
| 548 | + ], | |
| 549 | + "description": "The composer plugin for Yii extension installer", | |
| 550 | + "keywords": [ | |
| 551 | + "composer", | |
| 552 | + "extension installer", | |
| 553 | + "yii2" | |
| 554 | + ], | |
| 555 | + "time": "2015-03-01 06:22:44" | |
| 556 | + }, | |
| 557 | + { | |
| 558 | + "name": "yiisoft/yii2-swiftmailer", | |
| 559 | + "version": "2.0.4", | |
| 560 | + "source": { | |
| 561 | + "type": "git", | |
| 562 | + "url": "https://github.com/yiisoft/yii2-swiftmailer.git", | |
| 563 | + "reference": "4ec435a89e30b203cea99770910fb5499cb3627a" | |
| 564 | + }, | |
| 565 | + "dist": { | |
| 566 | + "type": "zip", | |
| 567 | + "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/4ec435a89e30b203cea99770910fb5499cb3627a", | |
| 568 | + "reference": "4ec435a89e30b203cea99770910fb5499cb3627a", | |
| 569 | + "shasum": "" | |
| 570 | + }, | |
| 571 | + "require": { | |
| 572 | + "swiftmailer/swiftmailer": "~5.0", | |
| 573 | + "yiisoft/yii2": ">=2.0.4" | |
| 574 | + }, | |
| 575 | + "type": "yii2-extension", | |
| 576 | + "extra": { | |
| 577 | + "branch-alias": { | |
| 578 | + "dev-master": "2.0.x-dev" | |
| 579 | + } | |
| 580 | + }, | |
| 581 | + "autoload": { | |
| 582 | + "psr-4": { | |
| 583 | + "yii\\swiftmailer\\": "" | |
| 584 | + } | |
| 585 | + }, | |
| 586 | + "notification-url": "https://packagist.org/downloads/", | |
| 587 | + "license": [ | |
| 588 | + "BSD-3-Clause" | |
| 589 | + ], | |
| 590 | + "authors": [ | |
| 591 | + { | |
| 592 | + "name": "Paul Klimov", | |
| 593 | + "email": "klimov.paul@gmail.com" | |
| 594 | + } | |
| 595 | + ], | |
| 596 | + "description": "The SwiftMailer integration for the Yii framework", | |
| 597 | + "keywords": [ | |
| 598 | + "email", | |
| 599 | + "mail", | |
| 600 | + "mailer", | |
| 601 | + "swift", | |
| 602 | + "swiftmailer", | |
| 603 | + "yii2" | |
| 604 | + ], | |
| 605 | + "time": "2015-05-10 22:12:32" | |
| 606 | + } | |
| 607 | + ], | |
| 608 | + "packages-dev": [ | |
| 609 | + { | |
| 610 | + "name": "bower-asset/typeahead.js", | |
| 611 | + "version": "v0.10.5", | |
| 612 | + "source": { | |
| 613 | + "type": "git", | |
| 614 | + "url": "https://github.com/twitter/typeahead.js.git", | |
| 615 | + "reference": "5f198b87d1af845da502ea9df93a5e84801ce742" | |
| 616 | + }, | |
| 617 | + "dist": { | |
| 618 | + "type": "zip", | |
| 619 | + "url": "https://api.github.com/repos/twitter/typeahead.js/zipball/5f198b87d1af845da502ea9df93a5e84801ce742", | |
| 620 | + "reference": "5f198b87d1af845da502ea9df93a5e84801ce742", | |
| 621 | + "shasum": "" | |
| 622 | + }, | |
| 623 | + "require": { | |
| 624 | + "bower-asset/jquery": ">=1.7" | |
| 625 | + }, | |
| 626 | + "require-dev": { | |
| 627 | + "bower-asset/jasmine-ajax": "~1.3.1", | |
| 628 | + "bower-asset/jasmine-jquery": "~1.5.2", | |
| 629 | + "bower-asset/jquery": "~1.7" | |
| 630 | + }, | |
| 631 | + "type": "bower-asset-library", | |
| 632 | + "extra": { | |
| 633 | + "bower-asset-main": "dist/typeahead.bundle.js" | |
| 634 | + } | |
| 635 | + }, | |
| 636 | + { | |
| 637 | + "name": "fzaninotto/faker", | |
| 638 | + "version": "v1.5.0", | |
| 639 | + "source": { | |
| 640 | + "type": "git", | |
| 641 | + "url": "https://github.com/fzaninotto/Faker.git", | |
| 642 | + "reference": "d0190b156bcca848d401fb80f31f504f37141c8d" | |
| 643 | + }, | |
| 644 | + "dist": { | |
| 645 | + "type": "zip", | |
| 646 | + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d0190b156bcca848d401fb80f31f504f37141c8d", | |
| 647 | + "reference": "d0190b156bcca848d401fb80f31f504f37141c8d", | |
| 648 | + "shasum": "" | |
| 649 | + }, | |
| 650 | + "require": { | |
| 651 | + "php": ">=5.3.3" | |
| 652 | + }, | |
| 653 | + "require-dev": { | |
| 654 | + "phpunit/phpunit": "~4.0", | |
| 655 | + "squizlabs/php_codesniffer": "~1.5" | |
| 656 | + }, | |
| 657 | + "suggest": { | |
| 658 | + "ext-intl": "*" | |
| 659 | + }, | |
| 660 | + "type": "library", | |
| 661 | + "extra": { | |
| 662 | + "branch-alias": { | |
| 663 | + "dev-master": "1.5.x-dev" | |
| 664 | + } | |
| 665 | + }, | |
| 666 | + "autoload": { | |
| 667 | + "psr-4": { | |
| 668 | + "Faker\\": "src/Faker/" | |
| 669 | + } | |
| 670 | + }, | |
| 671 | + "notification-url": "https://packagist.org/downloads/", | |
| 672 | + "license": [ | |
| 673 | + "MIT" | |
| 674 | + ], | |
| 675 | + "authors": [ | |
| 676 | + { | |
| 677 | + "name": "François Zaninotto" | |
| 678 | + } | |
| 679 | + ], | |
| 680 | + "description": "Faker is a PHP library that generates fake data for you.", | |
| 681 | + "keywords": [ | |
| 682 | + "data", | |
| 683 | + "faker", | |
| 684 | + "fixtures" | |
| 685 | + ], | |
| 686 | + "time": "2015-05-29 06:29:14" | |
| 687 | + }, | |
| 688 | + { | |
| 689 | + "name": "phpspec/php-diff", | |
| 690 | + "version": "v1.0.2", | |
| 691 | + "source": { | |
| 692 | + "type": "git", | |
| 693 | + "url": "https://github.com/phpspec/php-diff.git", | |
| 694 | + "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a" | |
| 695 | + }, | |
| 696 | + "dist": { | |
| 697 | + "type": "zip", | |
| 698 | + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/30e103d19519fe678ae64a60d77884ef3d71b28a", | |
| 699 | + "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a", | |
| 700 | + "shasum": "" | |
| 701 | + }, | |
| 702 | + "type": "library", | |
| 703 | + "autoload": { | |
| 704 | + "psr-0": { | |
| 705 | + "Diff": "lib/" | |
| 706 | + } | |
| 707 | + }, | |
| 708 | + "notification-url": "https://packagist.org/downloads/", | |
| 709 | + "license": [ | |
| 710 | + "BSD-3-Clause" | |
| 711 | + ], | |
| 712 | + "authors": [ | |
| 713 | + { | |
| 714 | + "name": "Chris Boulton", | |
| 715 | + "homepage": "http://github.com/chrisboulton", | |
| 716 | + "role": "Original developer" | |
| 717 | + } | |
| 718 | + ], | |
| 719 | + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", | |
| 720 | + "time": "2013-11-01 13:02:21" | |
| 721 | + }, | |
| 722 | + { | |
| 723 | + "name": "yiisoft/yii2-codeception", | |
| 724 | + "version": "2.0.4", | |
| 725 | + "source": { | |
| 726 | + "type": "git", | |
| 727 | + "url": "https://github.com/yiisoft/yii2-codeception.git", | |
| 728 | + "reference": "de5007e7a99359597abbfe1c88dca3ce620061c5" | |
| 729 | + }, | |
| 730 | + "dist": { | |
| 731 | + "type": "zip", | |
| 732 | + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/de5007e7a99359597abbfe1c88dca3ce620061c5", | |
| 733 | + "reference": "de5007e7a99359597abbfe1c88dca3ce620061c5", | |
| 734 | + "shasum": "" | |
| 735 | + }, | |
| 736 | + "require": { | |
| 737 | + "yiisoft/yii2": ">=2.0.4" | |
| 738 | + }, | |
| 739 | + "type": "yii2-extension", | |
| 740 | + "extra": { | |
| 741 | + "branch-alias": { | |
| 742 | + "dev-master": "2.0.x-dev" | |
| 743 | + } | |
| 744 | + }, | |
| 745 | + "autoload": { | |
| 746 | + "psr-4": { | |
| 747 | + "yii\\codeception\\": "" | |
| 748 | + } | |
| 749 | + }, | |
| 750 | + "notification-url": "https://packagist.org/downloads/", | |
| 751 | + "license": [ | |
| 752 | + "BSD-3-Clause" | |
| 753 | + ], | |
| 754 | + "authors": [ | |
| 755 | + { | |
| 756 | + "name": "Mark Jebri", | |
| 757 | + "email": "mark.github@yandex.ru" | |
| 758 | + } | |
| 759 | + ], | |
| 760 | + "description": "The Codeception integration for the Yii framework", | |
| 761 | + "keywords": [ | |
| 762 | + "codeception", | |
| 763 | + "yii2" | |
| 764 | + ], | |
| 765 | + "time": "2015-05-10 22:08:30" | |
| 766 | + }, | |
| 767 | + { | |
| 768 | + "name": "yiisoft/yii2-debug", | |
| 769 | + "version": "2.0.4", | |
| 770 | + "source": { | |
| 771 | + "type": "git", | |
| 772 | + "url": "https://github.com/yiisoft/yii2-debug.git", | |
| 773 | + "reference": "5c7081b2be71c61d3a50d978b31edc3e0b6f2f97" | |
| 774 | + }, | |
| 775 | + "dist": { | |
| 776 | + "type": "zip", | |
| 777 | + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/5c7081b2be71c61d3a50d978b31edc3e0b6f2f97", | |
| 778 | + "reference": "5c7081b2be71c61d3a50d978b31edc3e0b6f2f97", | |
| 779 | + "shasum": "" | |
| 780 | + }, | |
| 781 | + "require": { | |
| 782 | + "yiisoft/yii2": ">=2.0.4", | |
| 783 | + "yiisoft/yii2-bootstrap": "*" | |
| 784 | + }, | |
| 785 | + "type": "yii2-extension", | |
| 786 | + "extra": { | |
| 787 | + "branch-alias": { | |
| 788 | + "dev-master": "2.0.x-dev" | |
| 789 | + } | |
| 790 | + }, | |
| 791 | + "autoload": { | |
| 792 | + "psr-4": { | |
| 793 | + "yii\\debug\\": "" | |
| 794 | + } | |
| 795 | + }, | |
| 796 | + "notification-url": "https://packagist.org/downloads/", | |
| 797 | + "license": [ | |
| 798 | + "BSD-3-Clause" | |
| 799 | + ], | |
| 800 | + "authors": [ | |
| 801 | + { | |
| 802 | + "name": "Qiang Xue", | |
| 803 | + "email": "qiang.xue@gmail.com" | |
| 804 | + } | |
| 805 | + ], | |
| 806 | + "description": "The debugger extension for the Yii framework", | |
| 807 | + "keywords": [ | |
| 808 | + "debug", | |
| 809 | + "debugger", | |
| 810 | + "yii2" | |
| 811 | + ], | |
| 812 | + "time": "2015-05-10 22:08:56" | |
| 813 | + }, | |
| 814 | + { | |
| 815 | + "name": "yiisoft/yii2-faker", | |
| 816 | + "version": "2.0.3", | |
| 817 | + "source": { | |
| 818 | + "type": "git", | |
| 819 | + "url": "https://github.com/yiisoft/yii2-faker.git", | |
| 820 | + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c" | |
| 821 | + }, | |
| 822 | + "dist": { | |
| 823 | + "type": "zip", | |
| 824 | + "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/b88ca69ee226a3610b2c26c026c3203d7ac50f6c", | |
| 825 | + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c", | |
| 826 | + "shasum": "" | |
| 827 | + }, | |
| 828 | + "require": { | |
| 829 | + "fzaninotto/faker": "*", | |
| 830 | + "yiisoft/yii2": "*" | |
| 831 | + }, | |
| 832 | + "type": "yii2-extension", | |
| 833 | + "extra": { | |
| 834 | + "branch-alias": { | |
| 835 | + "dev-master": "2.0.x-dev" | |
| 836 | + } | |
| 837 | + }, | |
| 838 | + "autoload": { | |
| 839 | + "psr-4": { | |
| 840 | + "yii\\faker\\": "" | |
| 841 | + } | |
| 842 | + }, | |
| 843 | + "notification-url": "https://packagist.org/downloads/", | |
| 844 | + "license": [ | |
| 845 | + "BSD-3-Clause" | |
| 846 | + ], | |
| 847 | + "authors": [ | |
| 848 | + { | |
| 849 | + "name": "Mark Jebri", | |
| 850 | + "email": "mark.github@yandex.ru" | |
| 851 | + } | |
| 852 | + ], | |
| 853 | + "description": "Fixture generator. The Faker integration for the Yii framework.", | |
| 854 | + "keywords": [ | |
| 855 | + "Fixture", | |
| 856 | + "faker", | |
| 857 | + "yii2" | |
| 858 | + ], | |
| 859 | + "time": "2015-03-01 06:22:44" | |
| 860 | + }, | |
| 861 | + { | |
| 862 | + "name": "yiisoft/yii2-gii", | |
| 863 | + "version": "2.0.4", | |
| 864 | + "source": { | |
| 865 | + "type": "git", | |
| 866 | + "url": "https://github.com/yiisoft/yii2-gii.git", | |
| 867 | + "reference": "e5a023e8779bd774194842ec1b8fb4917cf04007" | |
| 868 | + }, | |
| 869 | + "dist": { | |
| 870 | + "type": "zip", | |
| 871 | + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/e5a023e8779bd774194842ec1b8fb4917cf04007", | |
| 872 | + "reference": "e5a023e8779bd774194842ec1b8fb4917cf04007", | |
| 873 | + "shasum": "" | |
| 874 | + }, | |
| 875 | + "require": { | |
| 876 | + "bower-asset/typeahead.js": "0.10.*", | |
| 877 | + "phpspec/php-diff": ">=1.0.2", | |
| 878 | + "yiisoft/yii2": ">=2.0.4", | |
| 879 | + "yiisoft/yii2-bootstrap": "~2.0" | |
| 880 | + }, | |
| 881 | + "type": "yii2-extension", | |
| 882 | + "extra": { | |
| 883 | + "branch-alias": { | |
| 884 | + "dev-master": "2.0.x-dev" | |
| 885 | + }, | |
| 886 | + "asset-installer-paths": { | |
| 887 | + "npm-asset-library": "vendor/npm", | |
| 888 | + "bower-asset-library": "vendor/bower" | |
| 889 | + } | |
| 890 | + }, | |
| 891 | + "autoload": { | |
| 892 | + "psr-4": { | |
| 893 | + "yii\\gii\\": "" | |
| 894 | + } | |
| 895 | + }, | |
| 896 | + "notification-url": "https://packagist.org/downloads/", | |
| 897 | + "license": [ | |
| 898 | + "BSD-3-Clause" | |
| 899 | + ], | |
| 900 | + "authors": [ | |
| 901 | + { | |
| 902 | + "name": "Qiang Xue", | |
| 903 | + "email": "qiang.xue@gmail.com" | |
| 904 | + } | |
| 905 | + ], | |
| 906 | + "description": "The Gii extension for the Yii framework", | |
| 907 | + "keywords": [ | |
| 908 | + "code generator", | |
| 909 | + "gii", | |
| 910 | + "yii2" | |
| 911 | + ], | |
| 912 | + "time": "2015-05-10 22:09:31" | |
| 913 | + } | |
| 914 | + ], | |
| 915 | + "aliases": [], | |
| 916 | + "minimum-stability": "stable", | |
| 917 | + "stability-flags": [], | |
| 918 | + "prefer-stable": false, | |
| 919 | + "prefer-lowest": false, | |
| 920 | + "platform": { | |
| 921 | + "php": ">=5.4.0" | |
| 922 | + }, | |
| 923 | + "platform-dev": [] | |
| 924 | +} | ... | ... |
| 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' => $this->primaryKey(), | |
| 18 | + 'username' => $this->string()->notNull()->unique(), | |
| 19 | + 'auth_key' => $this->string(32)->notNull(), | |
| 20 | + 'password_hash' => $this->string()->notNull(), | |
| 21 | + 'password_reset_token' => $this->string()->unique(), | |
| 22 | + 'email' => $this->string()->notNull()->unique(), | |
| 23 | + | |
| 24 | + 'status' => $this->smallInteger()->notNull()->defaultValue(10), | |
| 25 | + 'created_at' => $this->integer()->notNull(), | |
| 26 | + 'updated_at' => $this->integer()->notNull(), | |
| 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'] = [ | |
| 16 | + 'class' => 'yii\debug\Module', | |
| 17 | + ]; | |
| 18 | + | |
| 19 | + $config['bootstrap'][] = 'gii'; | |
| 20 | + $config['modules']['gii'] = [ | |
| 21 | + 'class' => 'yii\gii\Module', | |
| 22 | + ]; | |
| 23 | +} | |
| 24 | + | |
| 25 | +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 | +require(__DIR__ . '/vendor/autoload.php'); | |
| 15 | +require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); | |
| 16 | +require(__DIR__ . '/common/config/bootstrap.php'); | |
| 17 | +require(__DIR__ . '/console/config/bootstrap.php'); | |
| 18 | + | |
| 19 | +$config = yii\helpers\ArrayHelper::merge( | |
| 20 | + require(__DIR__ . '/common/config/main.php'), | |
| 21 | + require(__DIR__ . '/common/config/main-local.php'), | |
| 22 | + require(__DIR__ . '/console/config/main.php'), | |
| 23 | + require(__DIR__ . '/console/config/main-local.php') | |
| 24 | +); | |
| 25 | + | |
| 26 | +$application = new yii\console\Application($config); | |
| 27 | +$exitCode = $application->run(); | |
| 28 | +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 | +require(__DIR__ . '/vendor/autoload.php'); | |
| 15 | +require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); | |
| 16 | +require(__DIR__ . '/common/config/bootstrap.php'); | |
| 17 | +require(__DIR__ . '/console/config/bootstrap.php'); | |
| 18 | + | |
| 19 | +$config = yii\helpers\ArrayHelper::merge( | |
| 20 | + require(__DIR__ . '/common/config/main.php'), | |
| 21 | + require(__DIR__ . '/common/config/main-local.php'), | |
| 22 | + require(__DIR__ . '/console/config/main.php'), | |
| 23 | + require(__DIR__ . '/console/config/main-local.php') | |
| 24 | +); | |
| 25 | + | |
| 26 | +$application = new yii\console\Application($config); | |
| 27 | +$exitCode = $application->run(); | |
| 28 | +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 | + /** | |
| 69 | + * Displays homepage. | |
| 70 | + * | |
| 71 | + * @return mixed | |
| 72 | + */ | |
| 73 | + public function actionIndex() | |
| 74 | + { | |
| 75 | + return $this->render('index'); | |
| 76 | + } | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * Logs in a user. | |
| 80 | + * | |
| 81 | + * @return mixed | |
| 82 | + */ | |
| 83 | + public function actionLogin() | |
| 84 | + { | |
| 85 | + if (!\Yii::$app->user->isGuest) { | |
| 86 | + return $this->goHome(); | |
| 87 | + } | |
| 88 | + | |
| 89 | + $model = new LoginForm(); | |
| 90 | + if ($model->load(Yii::$app->request->post()) && $model->login()) { | |
| 91 | + return $this->goBack(); | |
| 92 | + } else { | |
| 93 | + return $this->render('login', [ | |
| 94 | + 'model' => $model, | |
| 95 | + ]); | |
| 96 | + } | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * Logs out the current user. | |
| 101 | + * | |
| 102 | + * @return mixed | |
| 103 | + */ | |
| 104 | + public function actionLogout() | |
| 105 | + { | |
| 106 | + Yii::$app->user->logout(); | |
| 107 | + | |
| 108 | + return $this->goHome(); | |
| 109 | + } | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * Displays contact page. | |
| 113 | + * | |
| 114 | + * @return mixed | |
| 115 | + */ | |
| 116 | + public function actionContact() | |
| 117 | + { | |
| 118 | + $model = new ContactForm(); | |
| 119 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { | |
| 120 | + if ($model->sendEmail(Yii::$app->params['adminEmail'])) { | |
| 121 | + Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.'); | |
| 122 | + } else { | |
| 123 | + Yii::$app->session->setFlash('error', 'There was an error sending email.'); | |
| 124 | + } | |
| 125 | + | |
| 126 | + return $this->refresh(); | |
| 127 | + } else { | |
| 128 | + return $this->render('contact', [ | |
| 129 | + 'model' => $model, | |
| 130 | + ]); | |
| 131 | + } | |
| 132 | + } | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * Displays about page. | |
| 136 | + * | |
| 137 | + * @return mixed | |
| 138 | + */ | |
| 139 | + public function actionAbout() | |
| 140 | + { | |
| 141 | + return $this->render('about'); | |
| 142 | + } | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * Signs user up. | |
| 146 | + * | |
| 147 | + * @return mixed | |
| 148 | + */ | |
| 149 | + public function actionSignup() | |
| 150 | + { | |
| 151 | + $model = new SignupForm(); | |
| 152 | + if ($model->load(Yii::$app->request->post())) { | |
| 153 | + if ($user = $model->signup()) { | |
| 154 | + if (Yii::$app->getUser()->login($user)) { | |
| 155 | + return $this->goHome(); | |
| 156 | + } | |
| 157 | + } | |
| 158 | + } | |
| 159 | + | |
| 160 | + return $this->render('signup', [ | |
| 161 | + 'model' => $model, | |
| 162 | + ]); | |
| 163 | + } | |
| 164 | + | |
| 165 | + /** | |
| 166 | + * Requests password reset. | |
| 167 | + * | |
| 168 | + * @return mixed | |
| 169 | + */ | |
| 170 | + public function actionRequestPasswordReset() | |
| 171 | + { | |
| 172 | + $model = new PasswordResetRequestForm(); | |
| 173 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { | |
| 174 | + if ($model->sendEmail()) { | |
| 175 | + Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); | |
| 176 | + | |
| 177 | + return $this->goHome(); | |
| 178 | + } else { | |
| 179 | + Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for email provided.'); | |
| 180 | + } | |
| 181 | + } | |
| 182 | + | |
| 183 | + return $this->render('requestPasswordResetToken', [ | |
| 184 | + 'model' => $model, | |
| 185 | + ]); | |
| 186 | + } | |
| 187 | + | |
| 188 | + /** | |
| 189 | + * Resets password. | |
| 190 | + * | |
| 191 | + * @param string $token | |
| 192 | + * @return mixed | |
| 193 | + * @throws BadRequestHttpException | |
| 194 | + */ | |
| 195 | + public function actionResetPassword($token) | |
| 196 | + { | |
| 197 | + try { | |
| 198 | + $model = new ResetPasswordForm($token); | |
| 199 | + } catch (InvalidParamException $e) { | |
| 200 | + throw new BadRequestHttpException($e->getMessage()); | |
| 201 | + } | |
| 202 | + | |
| 203 | + if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { | |
| 204 | + Yii::$app->session->setFlash('success', 'New password was saved.'); | |
| 205 | + | |
| 206 | + return $this->goHome(); | |
| 207 | + } | |
| 208 | + | |
| 209 | + return $this->render('resetPassword', [ | |
| 210 | + 'model' => $model, | |
| 211 | + ]); | |
| 212 | + } | |
| 213 | +} | ... | ... |
| 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 $username; | |
| 14 | + public $email; | |
| 15 | + public $password; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * @inheritdoc | |
| 19 | + */ | |
| 20 | + public function rules() | |
| 21 | + { | |
| 22 | + return [ | |
| 23 | + ['username', 'filter', 'filter' => 'trim'], | |
| 24 | + ['username', 'required'], | |
| 25 | + ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], | |
| 26 | + ['username', 'string', 'min' => 2, 'max' => 255], | |
| 27 | + | |
| 28 | + ['email', 'filter', 'filter' => 'trim'], | |
| 29 | + ['email', 'required'], | |
| 30 | + ['email', 'email'], | |
| 31 | + ['email', 'string', 'max' => 255], | |
| 32 | + ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'], | |
| 33 | + | |
| 34 | + ['password', 'required'], | |
| 35 | + ['password', 'string', 'min' => 6], | |
| 36 | + ]; | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * Signs user up. | |
| 41 | + * | |
| 42 | + * @return User|null the saved model or null if saving fails | |
| 43 | + */ | |
| 44 | + public function signup() | |
| 45 | + { | |
| 46 | + if ($this->validate()) { | |
| 47 | + $user = new User(); | |
| 48 | + $user->username = $this->username; | |
| 49 | + $user->email = $this->email; | |
| 50 | + $user->setPassword($this->password); | |
| 51 | + $user->generateAuthKey(); | |
| 52 | + if ($user->save()) { | |
| 53 | + return $user; | |
| 54 | + } | |
| 55 | + } | |
| 56 | + | |
| 57 | + return null; | |
| 58 | + } | |
| 59 | +} | ... | ... |
| 1 | +++ a/frontend/views/layouts/main.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this \yii\web\View */ | |
| 4 | +/* @var $content string */ | |
| 5 | + | |
| 6 | +use yii\helpers\Html; | |
| 7 | +use yii\bootstrap\Nav; | |
| 8 | +use yii\bootstrap\NavBar; | |
| 9 | +use yii\widgets\Breadcrumbs; | |
| 10 | +use frontend\assets\AppAsset; | |
| 11 | +use common\widgets\Alert; | |
| 12 | + | |
| 13 | +AppAsset::register($this); | |
| 14 | +?> | |
| 15 | +<?php $this->beginPage() ?> | |
| 16 | +<!DOCTYPE html> | |
| 17 | +<html lang="<?= Yii::$app->language ?>"> | |
| 18 | +<head> | |
| 19 | + <meta charset="<?= Yii::$app->charset ?>"> | |
| 20 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| 21 | + <?= Html::csrfMetaTags() ?> | |
| 22 | + <title><?= Html::encode($this->title) ?></title> | |
| 23 | + <?php $this->head() ?> | |
| 24 | +</head> | |
| 25 | +<body> | |
| 26 | +<?php $this->beginBody() ?> | |
| 27 | + | |
| 28 | +<div class="wrap"> | |
| 29 | + <?php | |
| 30 | + NavBar::begin([ | |
| 31 | + 'brandLabel' => 'My Company', | |
| 32 | + 'brandUrl' => Yii::$app->homeUrl, | |
| 33 | + 'options' => [ | |
| 34 | + 'class' => 'navbar-inverse navbar-fixed-top', | |
| 35 | + ], | |
| 36 | + ]); | |
| 37 | + $menuItems = [ | |
| 38 | + ['label' => 'Home', 'url' => ['/site/index']], | |
| 39 | + ['label' => 'About', 'url' => ['/site/about']], | |
| 40 | + ['label' => 'Contact', 'url' => ['/site/contact']], | |
| 41 | + ]; | |
| 42 | + if (Yii::$app->user->isGuest) { | |
| 43 | + $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; | |
| 44 | + $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; | |
| 45 | + } else { | |
| 46 | + $menuItems[] = [ | |
| 47 | + 'label' => 'Logout (' . Yii::$app->user->identity->username . ')', | |
| 48 | + 'url' => ['/site/logout'], | |
| 49 | + 'linkOptions' => ['data-method' => 'post'] | |
| 50 | + ]; | |
| 51 | + } | |
| 52 | + echo Nav::widget([ | |
| 53 | + 'options' => ['class' => 'navbar-nav navbar-right'], | |
| 54 | + 'items' => $menuItems, | |
| 55 | + ]); | |
| 56 | + NavBar::end(); | |
| 57 | + ?> | |
| 58 | + | |
| 59 | + <div class="container"> | |
| 60 | + <?= Breadcrumbs::widget([ | |
| 61 | + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | |
| 62 | + ]) ?> | |
| 63 | + <?= Alert::widget() ?> | |
| 64 | + <?= $content ?> | |
| 65 | + </div> | |
| 66 | +</div> | |
| 67 | + | |
| 68 | +<footer class="footer"> | |
| 69 | + <div class="container"> | |
| 70 | + <p class="pull-left">© My Company <?= date('Y') ?></p> | |
| 71 | + | |
| 72 | + <p class="pull-right"><?= Yii::powered() ?></p> | |
| 73 | + </div> | |
| 74 | +</footer> | |
| 75 | + | |
| 76 | +<?php $this->endBody() ?> | |
| 77 | +</body> | |
| 78 | +</html> | |
| 79 | +<?php $this->endPage() ?> | ... | ... |
| 1 | +++ a/frontend/views/site/about.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | + | |
| 5 | +use yii\helpers\Html; | |
| 6 | + | |
| 7 | +$this->title = 'About'; | |
| 8 | +$this->params['breadcrumbs'][] = $this->title; | |
| 9 | +?> | |
| 10 | +<div class="site-about"> | |
| 11 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 12 | + | |
| 13 | + <p>This is the About page. You may modify the following file to customize its content:</p> | |
| 14 | + | |
| 15 | + <code><?= __FILE__ ?></code> | |
| 16 | +</div> | ... | ... |
| 1 | +++ a/frontend/views/site/contact.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
| 5 | +/* @var $model \frontend\models\ContactForm */ | |
| 6 | + | |
| 7 | +use yii\helpers\Html; | |
| 8 | +use yii\bootstrap\ActiveForm; | |
| 9 | +use yii\captcha\Captcha; | |
| 10 | + | |
| 11 | +$this->title = 'Contact'; | |
| 12 | +$this->params['breadcrumbs'][] = $this->title; | |
| 13 | +?> | |
| 14 | +<div class="site-contact"> | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <p> | |
| 18 | + If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. | |
| 19 | + </p> | |
| 20 | + | |
| 21 | + <div class="row"> | |
| 22 | + <div class="col-lg-5"> | |
| 23 | + <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?> | |
| 24 | + | |
| 25 | + <?= $form->field($model, 'name') ?> | |
| 26 | + | |
| 27 | + <?= $form->field($model, 'email') ?> | |
| 28 | + | |
| 29 | + <?= $form->field($model, 'subject') ?> | |
| 30 | + | |
| 31 | + <?= $form->field($model, 'body')->textArea(['rows' => 6]) ?> | |
| 32 | + | |
| 33 | + <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [ | |
| 34 | + 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>', | |
| 35 | + ]) ?> | |
| 36 | + | |
| 37 | + <div class="form-group"> | |
| 38 | + <?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?> | |
| 39 | + </div> | |
| 40 | + | |
| 41 | + <?php ActiveForm::end(); ?> | |
| 42 | + </div> | |
| 43 | + </div> | |
| 44 | + | |
| 45 | +</div> | ... | ... |
| 1 | +++ a/frontend/views/site/error.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $name string */ | |
| 5 | +/* @var $message string */ | |
| 6 | +/* @var $exception Exception */ | |
| 7 | + | |
| 8 | +use yii\helpers\Html; | |
| 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 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | + | |
| 5 | +$this->title = 'Автозапчасти, каталог запчастей, запчасти для иномарок в магазине ИталАвто'; | |
| 6 | +?> | |
| 7 | +<div class="site-index"> | |
| 8 | + | |
| 9 | + <div class="jumbotron"> | |
| 10 | + <h1>Congratulations!</h1> | |
| 11 | + | |
| 12 | + <p class="lead">You have successfully created your Yii-powered application.</p> | |
| 13 | + | |
| 14 | + <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p> | |
| 15 | + </div> | |
| 16 | + | |
| 17 | + <div class="body-content"> | |
| 18 | + | |
| 19 | + <div class="row"> | |
| 20 | + <div class="col-lg-4"> | |
| 21 | + <h2>Heading</h2> | |
| 22 | + | |
| 23 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
| 24 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
| 25 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
| 26 | + fugiat nulla pariatur.</p> | |
| 27 | + | |
| 28 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation »</a></p> | |
| 29 | + </div> | |
| 30 | + <div class="col-lg-4"> | |
| 31 | + <h2>Heading</h2> | |
| 32 | + | |
| 33 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
| 34 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
| 35 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
| 36 | + fugiat nulla pariatur.</p> | |
| 37 | + | |
| 38 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum »</a></p> | |
| 39 | + </div> | |
| 40 | + <div class="col-lg-4"> | |
| 41 | + <h2>Heading</h2> | |
| 42 | + | |
| 43 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
| 44 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
| 45 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
| 46 | + fugiat nulla pariatur.</p> | |
| 47 | + | |
| 48 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions »</a></p> | |
| 49 | + </div> | |
| 50 | + </div> | |
| 51 | + | |
| 52 | + </div> | |
| 53 | +</div> | ... | ... |
| 1 | +++ a/frontend/views/site/login.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
| 5 | +/* @var $model \common\models\LoginForm */ | |
| 6 | + | |
| 7 | +use yii\helpers\Html; | |
| 8 | +use yii\bootstrap\ActiveForm; | |
| 9 | + | |
| 10 | +$this->title = 'Login'; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="site-login"> | |
| 14 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 15 | + | |
| 16 | + <p>Please fill out the following fields to login:</p> | |
| 17 | + | |
| 18 | + <div class="row"> | |
| 19 | + <div class="col-lg-5"> | |
| 20 | + <?php $form = ActiveForm::begin(['id' => 'login-form']); ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'username') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'password')->passwordInput() ?> | |
| 25 | + | |
| 26 | + <?= $form->field($model, 'rememberMe')->checkbox() ?> | |
| 27 | + | |
| 28 | + <div style="color:#999;margin:1em 0"> | |
| 29 | + If you forgot your password you can <?= Html::a('reset it', ['site/request-password-reset']) ?>. | |
| 30 | + </div> | |
| 31 | + | |
| 32 | + <div class="form-group"> | |
| 33 | + <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?> | |
| 34 | + </div> | |
| 35 | + | |
| 36 | + <?php ActiveForm::end(); ?> | |
| 37 | + </div> | |
| 38 | + </div> | |
| 39 | +</div> | ... | ... |
| 1 | +++ a/frontend/views/site/requestPasswordResetToken.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
| 5 | +/* @var $model \frontend\models\PasswordResetRequestForm */ | |
| 6 | + | |
| 7 | +use yii\helpers\Html; | |
| 8 | +use yii\bootstrap\ActiveForm; | |
| 9 | + | |
| 10 | +$this->title = 'Request password reset'; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="site-request-password-reset"> | |
| 14 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 15 | + | |
| 16 | + <p>Please fill out your email. A link to reset password will be sent there.</p> | |
| 17 | + | |
| 18 | + <div class="row"> | |
| 19 | + <div class="col-lg-5"> | |
| 20 | + <?php $form = ActiveForm::begin(['id' => 'request-password-reset-form']); ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'email') ?> | |
| 23 | + | |
| 24 | + <div class="form-group"> | |
| 25 | + <?= Html::submitButton('Send', ['class' => 'btn btn-primary']) ?> | |
| 26 | + </div> | |
| 27 | + | |
| 28 | + <?php ActiveForm::end(); ?> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | +</div> | ... | ... |
| 1 | +++ a/frontend/views/site/resetPassword.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
| 5 | +/* @var $model \frontend\models\ResetPasswordForm */ | |
| 6 | + | |
| 7 | +use yii\helpers\Html; | |
| 8 | +use yii\bootstrap\ActiveForm; | |
| 9 | + | |
| 10 | +$this->title = 'Reset password'; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="site-reset-password"> | |
| 14 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 15 | + | |
| 16 | + <p>Please choose your new password:</p> | |
| 17 | + | |
| 18 | + <div class="row"> | |
| 19 | + <div class="col-lg-5"> | |
| 20 | + <?php $form = ActiveForm::begin(['id' => 'reset-password-form']); ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'password')->passwordInput() ?> | |
| 23 | + | |
| 24 | + <div class="form-group"> | |
| 25 | + <?= Html::submitButton('Save', ['class' => 'btn btn-primary']) ?> | |
| 26 | + </div> | |
| 27 | + | |
| 28 | + <?php ActiveForm::end(); ?> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | +</div> | ... | ... |
| 1 | +++ a/frontend/views/site/signup.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
| 5 | +/* @var $model \frontend\models\SignupForm */ | |
| 6 | + | |
| 7 | +use yii\helpers\Html; | |
| 8 | +use yii\bootstrap\ActiveForm; | |
| 9 | + | |
| 10 | +$this->title = 'Signup'; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="site-signup"> | |
| 14 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 15 | + | |
| 16 | + <p>Please fill out the following fields to signup:</p> | |
| 17 | + | |
| 18 | + <div class="row"> | |
| 19 | + <div class="col-lg-5"> | |
| 20 | + <?php $form = ActiveForm::begin(['id' => 'form-signup']); ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'username') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'email') ?> | |
| 25 | + | |
| 26 | + <?= $form->field($model, 'password')->passwordInput() ?> | |
| 27 | + | |
| 28 | + <div class="form-group"> | |
| 29 | + <?= Html::submitButton('Signup', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?> | |
| 30 | + </div> | |
| 31 | + | |
| 32 | + <?php ActiveForm::end(); ?> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | +</div> | ... | ... |
| 1 | +++ a/frontend/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
| 1 | +++ a/init | |
| 1 | +#!/usr/bin/env php | |
| 2 | +<?php | |
| 3 | +/** | |
| 4 | + * Yii Application Initialization Tool | |
| 5 | + * | |
| 6 | + * In order to run in non-interactive mode: | |
| 7 | + * | |
| 8 | + * init --env=Development --overwrite=n | |
| 9 | + * | |
| 10 | + * @author Alexander Makarov <sam@rmcreative.ru> | |
| 11 | + * | |
| 12 | + * @link http://www.yiiframework.com/ | |
| 13 | + * @copyright Copyright (c) 2008 Yii Software LLC | |
| 14 | + * @license http://www.yiiframework.com/license/ | |
| 15 | + */ | |
| 16 | + | |
| 17 | +if (!extension_loaded('openssl')) { | |
| 18 | + die('The OpenSSL PHP extension is required by Yii2.'); | |
| 19 | +} | |
| 20 | + | |
| 21 | +$params = getParams(); | |
| 22 | +$root = str_replace('\\', '/', __DIR__); | |
| 23 | +$envs = require("$root/environments/index.php"); | |
| 24 | +$envNames = array_keys($envs); | |
| 25 | + | |
| 26 | +echo "Yii Application Initialization Tool v1.0\n\n"; | |
| 27 | + | |
| 28 | +$envName = null; | |
| 29 | +if (empty($params['env']) || $params['env'] === '1') { | |
| 30 | + echo "Which environment do you want the application to be initialized in?\n\n"; | |
| 31 | + foreach ($envNames as $i => $name) { | |
| 32 | + echo " [$i] $name\n"; | |
| 33 | + } | |
| 34 | + echo "\n Your choice [0-" . (count($envs) - 1) . ', or "q" to quit] '; | |
| 35 | + $answer = trim(fgets(STDIN)); | |
| 36 | + | |
| 37 | + if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) { | |
| 38 | + echo "\n Quit initialization.\n"; | |
| 39 | + exit(0); | |
| 40 | + } | |
| 41 | + | |
| 42 | + if (isset($envNames[$answer])) { | |
| 43 | + $envName = $envNames[$answer]; | |
| 44 | + } | |
| 45 | +} else { | |
| 46 | + $envName = $params['env']; | |
| 47 | +} | |
| 48 | + | |
| 49 | +if (!in_array($envName, $envNames)) { | |
| 50 | + $envsList = implode(', ', $envNames); | |
| 51 | + echo "\n $envName is not a valid environment. Try one of the following: $envsList. \n"; | |
| 52 | + exit(2); | |
| 53 | +} | |
| 54 | + | |
| 55 | +$env = $envs[$envName]; | |
| 56 | + | |
| 57 | +if (empty($params['env'])) { | |
| 58 | + echo "\n Initialize the application under '{$envNames[$answer]}' environment? [yes|no] "; | |
| 59 | + $answer = trim(fgets(STDIN)); | |
| 60 | + if (strncasecmp($answer, 'y', 1)) { | |
| 61 | + echo "\n Quit initialization.\n"; | |
| 62 | + exit(0); | |
| 63 | + } | |
| 64 | +} | |
| 65 | + | |
| 66 | +echo "\n Start initialization ...\n\n"; | |
| 67 | +$files = getFileList("$root/environments/{$env['path']}"); | |
| 68 | +if (isset($env['skipFiles'])) { | |
| 69 | + $skipFiles = $env['skipFiles']; | |
| 70 | + array_walk($skipFiles, function(&$value) use($env, $root) { $value = "$root/$value"; }); | |
| 71 | + $files = array_diff($files, array_intersect_key($env['skipFiles'], array_filter($skipFiles, 'file_exists'))); | |
| 72 | +} | |
| 73 | +$all = false; | |
| 74 | +foreach ($files as $file) { | |
| 75 | + if (!copyFile($root, "environments/{$env['path']}/$file", $file, $all, $params)) { | |
| 76 | + break; | |
| 77 | + } | |
| 78 | +} | |
| 79 | + | |
| 80 | +$callbacks = ['setCookieValidationKey', 'setWritable', 'setExecutable', 'createSymlink']; | |
| 81 | +foreach ($callbacks as $callback) { | |
| 82 | + if (!empty($env[$callback])) { | |
| 83 | + $callback($root, $env[$callback]); | |
| 84 | + } | |
| 85 | +} | |
| 86 | + | |
| 87 | +echo "\n ... initialization completed.\n\n"; | |
| 88 | + | |
| 89 | +function getFileList($root, $basePath = '') | |
| 90 | +{ | |
| 91 | + $files = []; | |
| 92 | + $handle = opendir($root); | |
| 93 | + while (($path = readdir($handle)) !== false) { | |
| 94 | + if ($path === '.git' || $path === '.svn' || $path === '.' || $path === '..') { | |
| 95 | + continue; | |
| 96 | + } | |
| 97 | + $fullPath = "$root/$path"; | |
| 98 | + $relativePath = $basePath === '' ? $path : "$basePath/$path"; | |
| 99 | + if (is_dir($fullPath)) { | |
| 100 | + $files = array_merge($files, getFileList($fullPath, $relativePath)); | |
| 101 | + } else { | |
| 102 | + $files[] = $relativePath; | |
| 103 | + } | |
| 104 | + } | |
| 105 | + closedir($handle); | |
| 106 | + return $files; | |
| 107 | +} | |
| 108 | + | |
| 109 | +function copyFile($root, $source, $target, &$all, $params) | |
| 110 | +{ | |
| 111 | + if (!is_file($root . '/' . $source)) { | |
| 112 | + echo " skip $target ($source not exist)\n"; | |
| 113 | + return true; | |
| 114 | + } | |
| 115 | + if (is_file($root . '/' . $target)) { | |
| 116 | + if (file_get_contents($root . '/' . $source) === file_get_contents($root . '/' . $target)) { | |
| 117 | + echo " unchanged $target\n"; | |
| 118 | + return true; | |
| 119 | + } | |
| 120 | + if ($all) { | |
| 121 | + echo " overwrite $target\n"; | |
| 122 | + } else { | |
| 123 | + echo " exist $target\n"; | |
| 124 | + echo " ...overwrite? [Yes|No|All|Quit] "; | |
| 125 | + | |
| 126 | + | |
| 127 | + $answer = !empty($params['overwrite']) ? $params['overwrite'] : trim(fgets(STDIN)); | |
| 128 | + if (!strncasecmp($answer, 'q', 1)) { | |
| 129 | + return false; | |
| 130 | + } else { | |
| 131 | + if (!strncasecmp($answer, 'y', 1)) { | |
| 132 | + echo " overwrite $target\n"; | |
| 133 | + } else { | |
| 134 | + if (!strncasecmp($answer, 'a', 1)) { | |
| 135 | + echo " overwrite $target\n"; | |
| 136 | + $all = true; | |
| 137 | + } else { | |
| 138 | + echo " skip $target\n"; | |
| 139 | + return true; | |
| 140 | + } | |
| 141 | + } | |
| 142 | + } | |
| 143 | + } | |
| 144 | + file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source)); | |
| 145 | + return true; | |
| 146 | + } | |
| 147 | + echo " generate $target\n"; | |
| 148 | + @mkdir(dirname($root . '/' . $target), 0777, true); | |
| 149 | + file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source)); | |
| 150 | + return true; | |
| 151 | +} | |
| 152 | + | |
| 153 | +function getParams() | |
| 154 | +{ | |
| 155 | + $rawParams = []; | |
| 156 | + if (isset($_SERVER['argv'])) { | |
| 157 | + $rawParams = $_SERVER['argv']; | |
| 158 | + array_shift($rawParams); | |
| 159 | + } | |
| 160 | + | |
| 161 | + $params = []; | |
| 162 | + foreach ($rawParams as $param) { | |
| 163 | + if (preg_match('/^--(\w+)(=(.*))?$/', $param, $matches)) { | |
| 164 | + $name = $matches[1]; | |
| 165 | + $params[$name] = isset($matches[3]) ? $matches[3] : true; | |
| 166 | + } else { | |
| 167 | + $params[] = $param; | |
| 168 | + } | |
| 169 | + } | |
| 170 | + return $params; | |
| 171 | +} | |
| 172 | + | |
| 173 | +function setWritable($root, $paths) | |
| 174 | +{ | |
| 175 | + foreach ($paths as $writable) { | |
| 176 | + echo " chmod 0777 $writable\n"; | |
| 177 | + @chmod("$root/$writable", 0777); | |
| 178 | + } | |
| 179 | +} | |
| 180 | + | |
| 181 | +function setExecutable($root, $paths) | |
| 182 | +{ | |
| 183 | + foreach ($paths as $executable) { | |
| 184 | + echo " chmod 0755 $executable\n"; | |
| 185 | + @chmod("$root/$executable", 0755); | |
| 186 | + } | |
| 187 | +} | |
| 188 | + | |
| 189 | +function setCookieValidationKey($root, $paths) | |
| 190 | +{ | |
| 191 | + foreach ($paths as $file) { | |
| 192 | + echo " generate cookie validation key in $file\n"; | |
| 193 | + $file = $root . '/' . $file; | |
| 194 | + $length = 32; | |
| 195 | + $bytes = openssl_random_pseudo_bytes($length); | |
| 196 | + $key = strtr(substr(base64_encode($bytes), 0, $length), '+/=', '_-.'); | |
| 197 | + $content = preg_replace('/(("|\')cookieValidationKey("|\')\s*=>\s*)(""|\'\')/', "\\1'$key'", file_get_contents($file)); | |
| 198 | + file_put_contents($file, $content); | |
| 199 | + } | |
| 200 | +} | |
| 201 | + | |
| 202 | +function createSymlink($root, $links) { | |
| 203 | + foreach ($links as $link => $target) { | |
| 204 | + echo " symlink " . $root . "/" . $target . " " . $root . "/" . $link . "\n"; | |
| 205 | + //first removing folders to avoid errors if the folder already exists | |
| 206 | + @rmdir($root . "/" . $link); | |
| 207 | + @symlink($root . "/" . $target, $root . "/" . $link); | |
| 208 | + } | |
| 209 | +} | ... | ... |
| 1 | +++ a/init.bat | |
| 1 | +@echo off | |
| 2 | + | |
| 3 | +rem ------------------------------------------------------------- | |
| 4 | +rem Yii command line init script for Windows. | |
| 5 | +rem | |
| 6 | +rem @author Qiang Xue <qiang.xue@gmail.com> | |
| 7 | +rem @link http://www.yiiframework.com/ | |
| 8 | +rem @copyright Copyright (c) 2008 Yii Software LLC | |
| 9 | +rem @license http://www.yiiframework.com/license/ | |
| 10 | +rem ------------------------------------------------------------- | |
| 11 | + | |
| 12 | +@setlocal | |
| 13 | + | |
| 14 | +set YII_PATH=%~dp0 | |
| 15 | + | |
| 16 | +if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe | |
| 17 | + | |
| 18 | +"%PHP_COMMAND%" "%YII_PATH%init" %* | |
| 19 | + | |
| 20 | +@endlocal | ... | ... |