├── .bowerrc ├── .gitignore ├── LICENSE.md ├── README.md ├── Vagrantfile ├── app ├── app.js ├── bootstrap.js ├── pages │ ├── AboutPage.vue │ ├── LandingPage.vue │ └── LoginPage.vue └── routes.js ├── assets └── AppAsset.php ├── codeception.yml ├── commands ├── HelloController.php └── MakeController.php ├── composer.json ├── config ├── console.php ├── db.php ├── params.php ├── test.php ├── test_db.php └── web.php ├── controllers ├── ApiController.php └── SiteController.php ├── docker-compose.yml ├── mail └── layouts │ └── html.php ├── models ├── ContactForm.php ├── LoginForm.php └── User.php ├── package.json ├── requirements.php ├── runtime └── .gitignore ├── tests ├── _bootstrap.php ├── _data │ └── .gitkeep ├── _output │ └── .gitignore ├── _support │ ├── AcceptanceTester.php │ ├── FunctionalTester.php │ └── UnitTester.php ├── acceptance.suite.yml.example ├── acceptance │ ├── AboutCest.php │ ├── ContactCest.php │ ├── HomeCest.php │ ├── LoginCest.php │ └── _bootstrap.php ├── bin │ ├── yii │ └── yii.bat ├── functional.suite.yml ├── functional │ ├── ContactFormCest.php │ ├── LoginFormCest.php │ └── _bootstrap.php ├── unit.suite.yml └── unit │ ├── _bootstrap.php │ └── models │ ├── ContactFormTest.php │ ├── LoginFormTest.php │ └── UserTest.php ├── vagrant ├── config │ ├── .gitignore │ └── vagrant-local.example.yml ├── nginx │ ├── app.conf │ └── log │ │ └── .gitignore └── provision │ ├── always-as-root.sh │ ├── once-as-root.sh │ └── once-as-vagrant.sh ├── views ├── layouts │ └── main.php └── site │ ├── about.php │ ├── contact.php │ ├── error.php │ ├── index.php │ └── login.php ├── web ├── .htaccess ├── assets │ └── .gitignore ├── css │ └── site.css ├── favicon.ico ├── index-test.php ├── index.php └── robots.txt ├── webpack.config.js ├── webpack.mix.js ├── widgets └── Alert.php ├── yii └── yii.bat /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory" : "vendor/bower-asset" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # phpstorm project files 2 | .idea 3 | 4 | # netbeans project files 5 | nbproject 6 | 7 | # zend studio for eclipse project files 8 | .buildpath 9 | .project 10 | .settings 11 | 12 | # windows thumbnail cache 13 | Thumbs.db 14 | 15 | # composer vendor dir 16 | /vendor 17 | 18 | # composer itself is not needed 19 | composer.phar 20 | 21 | # Mac DS_Store Files 22 | .DS_Store 23 | 24 | # phpunit itself is not needed 25 | phpunit.phar 26 | # local phpunit config 27 | /phpunit.xml 28 | 29 | tests/_output/* 30 | tests/_support/_generated 31 | 32 | #vagrant folder 33 | /.vagrant 34 | 35 | #generated js file 36 | web/app.js 37 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Yii Software LLC nor the names of its 15 | contributors may be used to endorse or promote products derived 16 | from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
5 | This is the About page. 6 |
7 | 8 |You have successfully created your Yii-powered application.
8 | 9 | 10 |Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut 19 | labore et 20 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut 21 | aliquip 22 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum 23 | dolore eu 24 | fugiat nulla pariatur.
25 | 26 |Yii Documentation » 27 |
28 |Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut 33 | labore et 34 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut 35 | aliquip 36 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum 37 | dolore eu 38 | fugiat nulla pariatur.
39 | 40 | 41 |Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut 46 | labore et 47 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut 48 | aliquip 49 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum 50 | dolore eu 51 | fugiat nulla pariatur.
52 | 53 | 55 |Please fill out the following fields to login:
10 | 11 |{{login_error}}
20 |{{password_error}}
32 |app\models\User::$users
.
50 | The path to yii framework seems to be incorrect.
\n" 34 | . 'You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . ".
\n" 35 | . 'Please refer to the README on how to install Yii.
\n"; 36 | 37 | if (!empty($_SERVER['argv'])) { 38 | // do not print HTML when used in console mode 39 | echo strip_tags($message); 40 | } else { 41 | echo $message; 42 | } 43 | exit(1); 44 | } 45 | 46 | require_once($frameworkPath . '/requirements/YiiRequirementChecker.php'); 47 | $requirementsChecker = new YiiRequirementChecker(); 48 | 49 | $gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.'; 50 | $gdOK = $imagickOK = false; 51 | 52 | if (extension_loaded('imagick')) { 53 | $imagick = new Imagick(); 54 | $imagickFormats = $imagick->queryFormats('PNG'); 55 | if (in_array('PNG', $imagickFormats)) { 56 | $imagickOK = true; 57 | } else { 58 | $imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.'; 59 | } 60 | } 61 | 62 | if (extension_loaded('gd')) { 63 | $gdInfo = gd_info(); 64 | if (!empty($gdInfo['FreeType Support'])) { 65 | $gdOK = true; 66 | } else { 67 | $gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.'; 68 | } 69 | } 70 | 71 | /** 72 | * Adjust requirements according to your application specifics. 73 | */ 74 | $requirements = array( 75 | // Database : 76 | array( 77 | 'name' => 'PDO extension', 78 | 'mandatory' => true, 79 | 'condition' => extension_loaded('pdo'), 80 | 'by' => 'All DB-related classes', 81 | ), 82 | array( 83 | 'name' => 'PDO SQLite extension', 84 | 'mandatory' => false, 85 | 'condition' => extension_loaded('pdo_sqlite'), 86 | 'by' => 'All DB-related classes', 87 | 'memo' => 'Required for SQLite database.', 88 | ), 89 | array( 90 | 'name' => 'PDO MySQL extension', 91 | 'mandatory' => false, 92 | 'condition' => extension_loaded('pdo_mysql'), 93 | 'by' => 'All DB-related classes', 94 | 'memo' => 'Required for MySQL database.', 95 | ), 96 | array( 97 | 'name' => 'PDO PostgreSQL extension', 98 | 'mandatory' => false, 99 | 'condition' => extension_loaded('pdo_pgsql'), 100 | 'by' => 'All DB-related classes', 101 | 'memo' => 'Required for PostgreSQL database.', 102 | ), 103 | // Cache : 104 | array( 105 | 'name' => 'Memcache extension', 106 | 'mandatory' => false, 107 | 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), 108 | 'by' => 'MemCache', 109 | 'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached totrue
.' : ''
110 | ),
111 | // CAPTCHA:
112 | array(
113 | 'name' => 'GD PHP extension with FreeType support',
114 | 'mandatory' => false,
115 | 'condition' => $gdOK,
116 | 'by' => 'Captcha',
117 | 'memo' => $gdMemo,
118 | ),
119 | array(
120 | 'name' => 'ImageMagick PHP extension with PNG support',
121 | 'mandatory' => false,
122 | 'condition' => $imagickOK,
123 | 'by' => 'Captcha',
124 | 'memo' => $imagickMemo,
125 | ),
126 | // PHP ini :
127 | 'phpExposePhp' => array(
128 | 'name' => 'Expose PHP',
129 | 'mandatory' => false,
130 | 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
131 | 'by' => 'Security reasons',
132 | 'memo' => '"expose_php" should be disabled at php.ini',
133 | ),
134 | 'phpAllowUrlInclude' => array(
135 | 'name' => 'PHP allow url include',
136 | 'mandatory' => false,
137 | 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
138 | 'by' => 'Security reasons',
139 | 'memo' => '"allow_url_include" should be disabled at php.ini',
140 | ),
141 | 'phpSmtp' => array(
142 | 'name' => 'PHP mail SMTP',
143 | 'mandatory' => false,
144 | 'condition' => strlen(ini_get('SMTP')) > 0,
145 | 'by' => 'Email sending',
146 | 'memo' => 'PHP mail SMTP server required',
147 | ),
148 | );
149 |
150 | // OPcache check
151 | if (!version_compare(phpversion(), '5.5', '>=')) {
152 | $requirements[] = array(
153 | 'name' => 'APC extension',
154 | 'mandatory' => false,
155 | 'condition' => extension_loaded('apc'),
156 | 'by' => 'ApcCache',
157 | );
158 | }
159 |
160 | $requirementsChecker->checkYii()->check($requirements)->render();
161 |
--------------------------------------------------------------------------------
/runtime/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/tests/_bootstrap.php:
--------------------------------------------------------------------------------
1 | amOnPage(Url::toRoute('/site/about'));
10 | $I->see('About', 'h1');
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/tests/acceptance/ContactCest.php:
--------------------------------------------------------------------------------
1 | amOnPage(Url::toRoute('/site/contact'));
10 | }
11 |
12 | public function contactPageWorks(AcceptanceTester $I)
13 | {
14 | $I->wantTo('ensure that contact page works');
15 | $I->see('Contact', 'h1');
16 | }
17 |
18 | public function contactFormCanBeSubmitted(AcceptanceTester $I)
19 | {
20 | $I->amGoingTo('submit contact form with correct data');
21 | $I->fillField('#contactform-name', 'tester');
22 | $I->fillField('#contactform-email', 'tester@example.com');
23 | $I->fillField('#contactform-subject', 'test subject');
24 | $I->fillField('#contactform-body', 'test content');
25 | $I->fillField('#contactform-verifycode', 'testme');
26 |
27 | $I->click('contact-button');
28 |
29 | $I->wait(2); // wait for button to be clicked
30 |
31 | $I->dontSeeElement('#contact-form');
32 | $I->see('Thank you for contacting us. We will respond to you as soon as possible.');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tests/acceptance/HomeCest.php:
--------------------------------------------------------------------------------
1 | amOnPage(Url::toRoute('/site/index'));
10 | $I->see('My Company');
11 |
12 | $I->seeLink('About');
13 | $I->click('About');
14 | $I->wait(2); // wait for page to be opened
15 |
16 | $I->see('This is the About page.');
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/acceptance/LoginCest.php:
--------------------------------------------------------------------------------
1 | amOnPage(Url::toRoute('/site/login'));
10 | $I->see('Login', 'h1');
11 |
12 | $I->amGoingTo('try to login with correct credentials');
13 | $I->fillField('input[name="LoginForm[username]"]', 'admin');
14 | $I->fillField('input[name="LoginForm[password]"]', 'admin');
15 | $I->click('login-button');
16 | $I->wait(2); // wait for button to be clicked
17 |
18 | $I->expectTo('see user info');
19 | $I->see('Logout');
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/acceptance/_bootstrap.php:
--------------------------------------------------------------------------------
1 | [
21 | 'db' => require __DIR__ . '/../../config/test_db.php'
22 | ]
23 | ]
24 | );
25 |
26 |
27 | $application = new yii\console\Application($config);
28 | $exitCode = $application->run();
29 | exit($exitCode);
30 |
--------------------------------------------------------------------------------
/tests/bin/yii.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | rem -------------------------------------------------------------
4 | rem Yii command line bootstrap script for Windows.
5 | rem
6 | rem @author Qiang Xue 14 | This is the About page. You may modify the following file to customize its content: 15 |
16 | 17 |= __FILE__ ?>
18 |
24 | Note that if you turn on the Yii debugger, you should be able
25 | to view the mail message on the mail panel of the debugger.
26 | mailer->useFileTransport): ?>
27 | Because the application is in development mode, the email is not sent but saved as
28 | a file under = Yii::getAlias(Yii::$app->mailer->fileTransportPath) ?>
.
29 | Please configure the useFileTransport
property of the mail
30 | application component to be false to enable email sending.
31 |
32 |
37 | If you have business inquiries or other questions, please fill out the following form to contact us. 38 | Thank you. 39 |
40 | 41 |21 | The above error occurred while the Web server was processing your request. 22 |
23 |24 | Please contact us if you think this is a server error. Thank you. 25 |
26 | 27 |Please fill out the following fields to login:
17 | 18 | 'login-form', 20 | 'layout' => 'horizontal', 21 | 'fieldConfig' => [ 22 | 'template' => "{label}\napp\models\User::$users
.
46 |