├── .bowerrc ├── .gitignore ├── .travis.yml ├── Dockerfile ├── LICENSE.md ├── README.md ├── ali-pay.png ├── backend ├── assets │ └── AppAsset.php ├── config │ ├── .gitignore │ ├── bootstrap.php │ ├── main.php │ └── params.php ├── controllers │ ├── CenterController.php │ ├── Controller.php │ ├── NavController.php │ ├── NavUrlController.php │ ├── PostController.php │ ├── PostMetaController.php │ ├── RightLinkController.php │ ├── SearchLogController.php │ ├── SiteController.php │ └── UserController.php ├── models │ ├── .gitkeep │ ├── PostSearch.php │ ├── RightLinkSearch.php │ ├── SearchLogSearch.php │ └── User.php ├── runtime │ └── .gitignore ├── views │ ├── layouts │ │ ├── content.php │ │ ├── header.php │ │ ├── left.php │ │ ├── main-login.php │ │ └── main.php │ ├── nav-url │ │ ├── _form.php │ │ ├── create.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php │ ├── nav │ │ ├── _form.php │ │ ├── create.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php │ ├── post-meta │ │ ├── _form.php │ │ ├── _search.php │ │ ├── create.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php │ ├── post │ │ ├── _form.php │ │ ├── _search.php │ │ ├── create.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php │ ├── right-link │ │ ├── _form.php │ │ ├── _search.php │ │ ├── create.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php │ ├── search-log │ │ ├── _search.php │ │ └── index.php │ ├── site │ │ ├── error.php │ │ ├── index.php │ │ └── login.php │ └── user │ │ ├── _form.php │ │ ├── _search.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php └── web │ ├── .gitignore │ ├── .htaccess │ ├── assets │ └── .gitignore │ ├── css │ ├── sb-admin-2.css │ └── site.css │ ├── favicon.ico │ ├── js │ └── sb-admin-2.js │ └── robots.txt ├── common ├── assets │ ├── AtJs.php │ ├── CaretJs.php │ └── DropzoneJs.php ├── components │ ├── AssetBundle.php │ ├── ComposerInstaller.php │ ├── Config.php │ ├── Controller.php │ ├── DbAuthManager.php │ ├── FileTarget.php │ ├── GlobalFunctions.php │ ├── Mailer.php │ └── db │ │ ├── ActiveRecord.php │ │ ├── Command.php │ │ ├── Connection.php │ │ └── Migration.php ├── config │ ├── .gitignore │ ├── bootstrap.php │ ├── main.php │ └── params.php ├── grid │ └── EnumColumn.php ├── helpers │ ├── Arr.php │ ├── Avatar.php │ ├── Formatter.php │ └── UploadHelper.php ├── mail │ ├── backup.php │ ├── layouts │ │ └── html.php │ └── passwordResetToken.php ├── messages │ ├── pt-BR │ │ ├── backend.php │ │ ├── common.php │ │ └── frontend.php │ └── zh-CN │ │ ├── backend.php │ │ ├── common.php │ │ └── frontend.php ├── models │ ├── LoginForm.php │ ├── Nav.php │ ├── NavUrl.php │ ├── Post.php │ ├── PostComment.php │ ├── PostMeta.php │ ├── PostMetaSearch.php │ ├── PostSearch.php │ ├── PostTag.php │ ├── PostTagSearch.php │ ├── RightLink.php │ ├── Search.php │ ├── SearchLog.php │ ├── Session.php │ ├── User.php │ ├── UserInfo.php │ └── UserSearch.php ├── services │ ├── CommentService.php │ ├── NotificationService.php │ ├── PostService.php │ ├── TopicService.php │ ├── TweetService.php │ └── UserService.php └── widgets │ └── JsBlock.php ├── composer.json ├── composer.lock ├── console ├── config │ ├── .gitignore │ ├── bootstrap.php │ ├── main.php │ └── params.php ├── controllers │ ├── .gitkeep │ ├── InstallController.php │ └── SyncController.php ├── migrations │ ├── m130524_201442_init.php │ ├── m150104_071047_init_blog.php │ ├── m150104_091352_init_user.php │ ├── m150115_081356_create_user_info.php │ ├── m150201_142415_update_user.php │ ├── m150205_085033_update_post_comment.php │ ├── m150209_015931_setting_init.php │ ├── m150209_090406_create_user_account.php │ ├── m150211_070335_update_user_info.php │ ├── m150212_030127_update_user_info_and_post_meta.php │ ├── m150212_132400_create_topics_table.php │ ├── m150214_070754_update_post_meta.php │ ├── m150412_034147_update_site_setting.php │ ├── m150416_134819_create_notification_table.php │ ├── m150420_060807_update_post_table.php │ ├── m150424_025409_update_table_engine.php │ ├── m150424_031429_update_notification_table.php │ ├── m150424_100155_update_post_meta_table.php │ ├── m150425_031844_create_right_link.php │ ├── m150626_073539_create_nav.php │ ├── m150626_073559_create_nav_url.php │ ├── m150702_130239_create_session_init.php │ ├── m150805_085832_create_search_log_table.php │ ├── m150808_025734_update_table_character.php │ ├── m150829_091943_update_post_table.php │ ├── m160320_093621_create_merit_table.php │ ├── m160321_132724_add_donate_table.php │ ├── m160719_093527_modify_user.php │ ├── m190624_022722_create_spam_table.php │ ├── m190908_053628_init_admin.php │ └── m190908_055507_init_data.php ├── models │ └── .gitkeep └── runtime │ └── .gitignore ├── doc ├── README.md └── images │ ├── 0.png │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ └── 6.png ├── docker-files ├── docker-compose-example.yml ├── getyii.com.conf └── run.sh ├── environments ├── dev │ ├── backend │ │ ├── config │ │ │ ├── main-local.php │ │ │ └── params-local.php │ │ └── web │ │ │ ├── index-test.php │ │ │ └── index.php │ ├── common │ │ └── config │ │ │ ├── db.php │ │ │ ├── main-local.php │ │ │ └── params-local.php │ ├── console │ │ └── config │ │ │ ├── main-local.php │ │ │ └── params-local.php │ ├── frontend │ │ ├── config │ │ │ ├── main-local.php │ │ │ └── params-local.php │ │ └── web │ │ │ ├── index-test.php │ │ │ └── index.php │ └── yii ├── index.php └── prod │ ├── backend │ ├── config │ │ ├── main-local.php │ │ └── params-local.php │ └── web │ │ └── index.php │ ├── common │ └── config │ │ ├── db.php │ │ ├── main-local.php │ │ └── params-local.php │ ├── console │ └── config │ │ ├── main-local.php │ │ └── params-local.php │ ├── frontend │ ├── config │ │ ├── main-local.php │ │ └── params-local.php │ └── web │ │ └── index.php │ └── yii ├── frontend ├── assets │ ├── AppAsset.php │ ├── AtJsAsset.php │ ├── BowerAsset.php │ ├── EditorAsset.php │ └── EmojifyAsset.php ├── behaviors │ └── AfterLoginBehavior.php ├── config │ ├── .gitignore │ ├── bootstrap.php │ ├── main.php │ ├── params.php │ └── search.ini ├── controllers │ ├── NotificationController.php │ ├── PostTagController.php │ └── SiteController.php ├── messages │ └── zh-CN │ │ └── app.php ├── models │ ├── ContactForm.php │ ├── Notification.php │ ├── PasswordResetRequestForm.php │ ├── ResetPasswordForm.php │ └── SignupForm.php ├── modules │ ├── nav │ │ ├── Module.php │ │ ├── controllers │ │ │ └── DefaultController.php │ │ └── views │ │ │ └── default │ │ │ └── index.php │ ├── topic │ │ ├── Module.php │ │ ├── controllers │ │ │ ├── CommentController.php │ │ │ └── DefaultController.php │ │ ├── models │ │ │ └── Topic.php │ │ └── views │ │ │ ├── comment │ │ │ ├── _form.php │ │ │ ├── _item.php │ │ │ ├── create.php │ │ │ ├── index.php │ │ │ └── update.php │ │ │ └── default │ │ │ ├── _form.php │ │ │ ├── _item.php │ │ │ ├── create.php │ │ │ ├── index.php │ │ │ ├── update.php │ │ │ └── view.php │ ├── tweet │ │ ├── Module.php │ │ ├── controllers │ │ │ └── DefaultController.php │ │ ├── models │ │ │ ├── Tweet.php │ │ │ └── TweetSearch.php │ │ └── views │ │ │ └── default │ │ │ ├── _form.php │ │ │ ├── _item.php │ │ │ └── index.php │ └── user │ │ ├── Module.php │ │ ├── controllers │ │ ├── ActionController.php │ │ ├── DefaultController.php │ │ ├── SecurityController.php │ │ └── SettingController.php │ │ ├── models │ │ ├── AccountForm.php │ │ ├── AvatarForm.php │ │ ├── Donate.php │ │ ├── UserAccount.php │ │ └── UserMeta.php │ │ └── views │ │ ├── default │ │ ├── _view.php │ │ └── show.php │ │ └── setting │ │ ├── _alert.php │ │ ├── _menu.php │ │ ├── account.php │ │ ├── avatar.php │ │ ├── donate.php │ │ ├── networks.php │ │ └── profile.php ├── runtime │ └── .gitignore ├── views │ ├── layouts │ │ └── main.php │ ├── notification │ │ ├── _item.php │ │ └── index.php │ ├── partials │ │ ├── markdwon_help.php │ │ └── users.php │ └── site │ │ ├── _item.php │ │ ├── about.php │ │ ├── contact.php │ │ ├── contributors.php │ │ ├── error.php │ │ ├── getstart.php │ │ ├── index.php │ │ ├── login.php │ │ ├── markdown.php │ │ ├── requestPasswordResetToken.php │ │ ├── resetPassword.php │ │ ├── signup.php │ │ ├── tags.php │ │ ├── timeline.php │ │ └── users.php ├── web │ ├── .gitignore │ ├── .htaccess │ ├── assets │ │ └── .gitignore │ ├── css │ │ ├── global.css │ │ ├── site-ruyi.css │ │ └── site.css │ ├── favicon.ico │ ├── images │ │ ├── ali-pay.png │ │ ├── hard_work.gif │ │ └── wechat-pay.png │ ├── js │ │ ├── At.js │ │ ├── editor.js │ │ ├── emojify.min.js │ │ ├── jquery.pin.js │ │ ├── main.js │ │ ├── nav.js │ │ └── topic.js │ ├── robots.txt │ └── uploads │ │ └── .gitignore └── widgets │ ├── Alert.php │ ├── Connect.php │ ├── Nav.php │ ├── NewestPost.php │ ├── Node.php │ ├── Panel.php │ ├── TopicSidebar.php │ └── views │ ├── nav.php │ ├── node.php │ ├── panel.php │ └── topicSidebar.php ├── init ├── init.bat ├── requirements.php ├── tests ├── README.md ├── codeception.yml └── codeception │ ├── _output │ └── .gitignore │ ├── backend │ ├── .gitignore │ ├── _bootstrap.php │ ├── _output │ │ └── .gitignore │ ├── acceptance.suite.yml │ ├── acceptance │ │ ├── LoginCept.php │ │ └── _bootstrap.php │ ├── codeception.yml │ ├── functional.suite.yml │ ├── functional │ │ ├── LoginCept.php │ │ └── _bootstrap.php │ ├── unit.suite.yml │ └── unit │ │ ├── DbTestCase.php │ │ ├── TestCase.php │ │ ├── _bootstrap.php │ │ └── fixtures │ │ └── data │ │ └── .gitkeep │ ├── bin │ ├── _bootstrap.php │ ├── yii │ └── yii.bat │ ├── common │ ├── .gitignore │ ├── _bootstrap.php │ ├── _output │ │ └── .gitignore │ ├── _pages │ │ └── LoginPage.php │ ├── _support │ │ └── FixtureHelper.php │ ├── codeception.yml │ ├── fixtures │ │ ├── UserFixture.php │ │ └── data │ │ │ └── init_login.php │ ├── templates │ │ └── fixtures │ │ │ └── user.php │ ├── unit.suite.yml │ └── unit │ │ ├── DbTestCase.php │ │ ├── TestCase.php │ │ ├── _bootstrap.php │ │ ├── fixtures │ │ └── data │ │ │ └── models │ │ │ └── user.php │ │ └── models │ │ └── LoginFormTest.php │ ├── config │ ├── acceptance.php │ ├── backend │ │ ├── acceptance.php │ │ ├── config.php │ │ ├── functional.php │ │ └── unit.php │ ├── common │ │ └── unit.php │ ├── config.php │ ├── console │ │ └── unit.php │ ├── frontend │ │ ├── acceptance.php │ │ ├── config.php │ │ ├── functional.php │ │ └── unit.php │ ├── functional.php │ └── unit.php │ ├── console │ ├── .gitignore │ ├── _bootstrap.php │ ├── _output │ │ └── .gitignore │ ├── codeception.yml │ ├── unit.suite.yml │ └── unit │ │ ├── DbTestCase.php │ │ ├── TestCase.php │ │ ├── _bootstrap.php │ │ └── fixtures │ │ └── data │ │ └── .gitkeep │ └── frontend │ ├── .gitignore │ ├── _bootstrap.php │ ├── _output │ └── .gitignore │ ├── _pages │ ├── AboutPage.php │ ├── ContactPage.php │ └── SignupPage.php │ ├── acceptance.suite.yml │ ├── acceptance │ ├── AboutCept.php │ ├── ContactCept.php │ ├── HomeCept.php │ ├── LoginCept.php │ ├── SignupCest.php │ └── _bootstrap.php │ ├── codeception.yml │ ├── functional.suite.yml │ ├── functional │ ├── AboutCept.php │ ├── ContactCept.php │ ├── HomeCept.php │ ├── LoginCept.php │ ├── SignupCest.php │ └── _bootstrap.php │ ├── unit.suite.yml │ └── unit │ ├── DbTestCase.php │ ├── TestCase.php │ ├── _bootstrap.php │ ├── fixtures │ └── data │ │ └── models │ │ └── user.php │ └── models │ ├── ContactFormTest.php │ ├── PasswordResetRequestFormTest.php │ ├── ResetPasswordFormTest.php │ └── SignupFormTest.php ├── wechat-pay.png └── yii.bat /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory" : "vendor/bower" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # yii console command 2 | /yii 3 | 4 | # phpstorm 项目文件 5 | .idea 6 | 7 | # netbeans 项目文件 8 | nbproject 9 | 10 | # zend studio for eclipse 项目文件 11 | .buildpath 12 | .project 13 | .settings 14 | 15 | # windows 缩略图换成 16 | Thumbs.db 17 | 18 | # composer 供应商目录 19 | /vendor 20 | 21 | # composer 它本身是不需要的(客户端自行升级最新版) 22 | composer.phar 23 | 24 | # Mac DS_Store 文件 25 | .DS_Store 26 | 27 | # phpunit 它本身是不需要的 28 | phpunit.phar 29 | # 本地 phpunit 配置文件 30 | /phpunit.xml 31 | 32 | /docker-compose.yml 33 | /supervisord.log 34 | /supervisord.pid 35 | 36 | 37 | # database config 38 | /common/config/db-local.php 39 | 40 | # install lock file 41 | install.lock 42 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - 5.4 4 | - 5.5 5 | - 5.6 6 | 7 | install: 8 | - travis_retry composer self-update && composer --version 9 | - travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1" 10 | - export PATH="$HOME/.composer/vendor/bin:$PATH" 11 | 12 | before_script: composer install --prefer-source 13 | 14 | #script: phpunit --configuration phpunit.xml.dist 15 | 16 | cache: 17 | directories: 18 | - vendor 19 | 20 | #matrix: 21 | # allow_failures: 22 | # - php: hhvm -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM dcb9/php-fpm:latest 2 | 3 | MAINTAINER Bob 4 | 5 | RUN apt-get update \ 6 | && apt-get install -y --no-install-recommends git vim \ 7 | && rm -rf /var/lib/apt/lists/* 8 | 9 | # http://serverfault.com/questions/599103/make-a-docker-application-write-to-stdout 10 | RUN ln -sf /dev/stdout /var/log/nginx/access.log \ 11 | && ln -sf /dev/stderr /var/log/nginx/error.log \ 12 | && mkdir /app 13 | WORKDIR /app 14 | 15 | ENV COMPOSER_HOME /root/.composer 16 | ENV PATH /root/.composer/vendor/bin:$PATH 17 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ 18 | # add chinese image http://pkg.phpcomposer.com/ 19 | && composer config -g repositories.packagist composer http://packagist.phpcomposer.com \ 20 | && /usr/local/bin/composer global require --prefer-source --no-interaction "fxp/composer-asset-plugin" 21 | 22 | COPY docker-files/getyii.com.conf /etc/nginx/conf.d/ 23 | RUN docker-php-ext-install mysqli pdo pdo_mysql \ 24 | && rm -rf /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/example_ssl.conf 25 | COPY . /app/ 26 | 27 | RUN chmod 700 docker-files/run.sh init 28 | 29 | VOLUME ["/root/.composer", "/app/vendor"] 30 | CMD ["docker-files/run.sh"] 31 | EXPOSE 80 32 | -------------------------------------------------------------------------------- /ali-pay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/ali-pay.png -------------------------------------------------------------------------------- /backend/assets/AppAsset.php: -------------------------------------------------------------------------------- 1 | 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 | } 30 | -------------------------------------------------------------------------------- /backend/config/.gitignore: -------------------------------------------------------------------------------- 1 | main-local.php 2 | params-local.php -------------------------------------------------------------------------------- /backend/config/bootstrap.php: -------------------------------------------------------------------------------- 1 | 'app-backend', 11 | 'basePath' => dirname(__DIR__), 12 | 'controllerNamespace' => 'backend\controllers', 13 | 'bootstrap' => ['log'], 14 | 'language' => 'zh-CN', 15 | 'modules' => [ 16 | 'setting' => [ 17 | 'class' => 'funson86\setting\Module', 18 | 'controllerNamespace' => 'funson86\setting\controllers', 19 | ], 20 | 'backup' => [ 21 | 'class' => 'yiier\backup\Module', 22 | ], 23 | 'merit' => [ 24 | 'class' => 'yiier\merit\Module', 25 | ], 26 | ], 27 | 'components' => [ 28 | 'urlManager' => [ 29 | 'enablePrettyUrl' => true, 30 | 'showScriptName' => false, 31 | 'rules' => [ 32 | '/' => '/', 33 | '//' => '/', 34 | ], 35 | ], 36 | 'user' => [ 37 | 'identityClass' => 'common\models\User', 38 | 'enableAutoLogin' => true, 39 | ], 40 | 'errorHandler' => [ 41 | 'errorAction' => 'site/error', 42 | ], 43 | ], 44 | 'params' => $params, 45 | ]; 46 | -------------------------------------------------------------------------------- /backend/config/params.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 4 | ]; 5 | -------------------------------------------------------------------------------- /backend/controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 2016/3/10 14:39 5 | * description: 6 | */ 7 | 8 | namespace backend\controllers; 9 | 10 | use yii\filters\AccessControl; 11 | use common\models\User; 12 | use yii\web\ForbiddenHttpException; 13 | 14 | class Controller extends \yii\web\Controller 15 | { 16 | public function behaviors() 17 | { 18 | return [ 19 | // 后台必须登录才能使用 20 | 'access' => [ 21 | 'class' => AccessControl::className(), 22 | 'rules' => [ 23 | [ 24 | 'allow' => true, 25 | 'roles' => ['@'], 26 | ], 27 | ], 28 | ], 29 | ]; 30 | } 31 | 32 | 33 | /** 34 | * @param \yii\base\Action $action 35 | * @return bool 36 | * @throws \yii\web\BadRequestHttpException 37 | */ 38 | public function beforeAction($action) 39 | { 40 | if (parent::beforeAction($action)) { 41 | $uniqueid = $action->controller->action->uniqueid; 42 | if (!in_array($uniqueid, ['site/login', 'site/logout', 'site/error']) && !User::currUserIsSuperAdmin()) { 43 | throw new ForbiddenHttpException; 44 | } 45 | return true; 46 | } else { 47 | return false; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /backend/models/.gitkeep: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /backend/runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /backend/views/layouts/content.php: -------------------------------------------------------------------------------- 1 | 6 |
7 |
8 | blocks['content-header'])) { ?> 9 |

blocks['content-header'] ?>

10 | 11 |

12 | title !== null) { 14 | echo \yii\helpers\Html::encode($this->title); 15 | } else { 16 | echo \yii\helpers\Inflector::camel2words( 17 | \yii\helpers\Inflector::id2camel($this->context->module->id) 18 | ); 19 | echo ($this->context->module->id !== \Yii::$app->id) ? 'Module' : ''; 20 | } ?> 21 |

22 | 23 | 24 | isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], 28 | ] 29 | ) ?> 30 |
31 | 32 |
33 | 34 | 35 |
36 |
37 | 38 |
39 | 42 | Copyright © 2014-2015 Almsaeed Studio. All rights 43 | reserved. 44 |
45 | 46 | 48 |
-------------------------------------------------------------------------------- /backend/views/layouts/header.php: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | 10 | APP' . Yii::$app->setting->get('siteName') . '', Yii::$app->homeUrl, ['class' => 'logo']) ?> 11 | 12 | 32 |
33 | -------------------------------------------------------------------------------- /backend/views/layouts/main-login.php: -------------------------------------------------------------------------------- 1 | 10 | beginPage() ?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | <?= Html::encode($this->title) ?> 18 | head() ?> 19 | 20 | 21 | 22 | beginBody() ?> 23 | 24 | 25 | 26 | endBody() ?> 27 | 28 | 29 | endPage() ?> 30 | -------------------------------------------------------------------------------- /backend/views/nav-url/_form.php: -------------------------------------------------------------------------------- 1 | 11 | 12 | 34 | -------------------------------------------------------------------------------- /backend/views/nav-url/create.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Nav Url'); 7 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Nav Urls'), 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = $this->title; 9 | ?> 10 | 17 | -------------------------------------------------------------------------------- /backend/views/nav-url/index.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Nav Urls'); 10 | $this->params['breadcrumbs'][] = $this->title; 11 | ?> 12 | 38 | -------------------------------------------------------------------------------- /backend/views/nav-url/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 7 | 'modelClass' => 'Nav Url', 8 | ]) . ' ' . $model->title; 9 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Nav Urls'), 'url' => ['index']]; 10 | $this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]]; 11 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 12 | ?> 13 | 20 | -------------------------------------------------------------------------------- /backend/views/nav-url/view.php: -------------------------------------------------------------------------------- 1 | title = $model->title; 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Nav Urls'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 | 42 | -------------------------------------------------------------------------------- /backend/views/nav/_form.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 28 | -------------------------------------------------------------------------------- /backend/views/nav/create.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Nav'); 7 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Navs'), 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = $this->title; 9 | ?> 10 | 17 | -------------------------------------------------------------------------------- /backend/views/nav/index.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Navs'); 10 | $this->params['breadcrumbs'][] = $this->title; 11 | ?> 12 | 35 | -------------------------------------------------------------------------------- /backend/views/nav/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 7 | 'modelClass' => 'Nav', 8 | ]) . ' ' . $model->name; 9 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Navs'), 'url' => ['index']]; 10 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; 11 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 12 | ?> 13 | 20 | -------------------------------------------------------------------------------- /backend/views/nav/view.php: -------------------------------------------------------------------------------- 1 | title = $model->name; 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Navs'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 | 39 | -------------------------------------------------------------------------------- /backend/views/post-meta/_form.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 34 | -------------------------------------------------------------------------------- /backend/views/post-meta/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 30 | -------------------------------------------------------------------------------- /backend/views/post-meta/create.php: -------------------------------------------------------------------------------- 1 | title = 'Create Post Meta'; 7 | $this->params['breadcrumbs'][] = ['label' => 'Post Metas', 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = $this->title; 9 | ?> 10 | 17 | -------------------------------------------------------------------------------- /backend/views/post-meta/index.php: -------------------------------------------------------------------------------- 1 | title = 'Post Metas'; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 | 43 | -------------------------------------------------------------------------------- /backend/views/post-meta/update.php: -------------------------------------------------------------------------------- 1 | title = 'Update Post Meta: ' . ' ' . $model->name; 7 | $this->params['breadcrumbs'][] = ['label' => 'Post Metas', 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; 9 | $this->params['breadcrumbs'][] = 'Update'; 10 | ?> 11 | 18 | -------------------------------------------------------------------------------- /backend/views/post-meta/view.php: -------------------------------------------------------------------------------- 1 | title = $model->name; 10 | $this->params['breadcrumbs'][] = ['label' => 'Post Metas', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 | 43 | -------------------------------------------------------------------------------- /backend/views/post/create.php: -------------------------------------------------------------------------------- 1 | title = 'Create Post'; 7 | $this->params['breadcrumbs'][] = ['label' => 'Posts', 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = $this->title; 9 | ?> 10 |
11 | 12 | render('_form', [ 13 | 'model' => $model, 14 | ]) ?> 15 | 16 |
17 | -------------------------------------------------------------------------------- /backend/views/post/update.php: -------------------------------------------------------------------------------- 1 | title = 'Update Post: ' . ' ' . $model->title; 7 | $this->params['breadcrumbs'][] = ['label' => 'Posts', 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]]; 9 | $this->params['breadcrumbs'][] = 'Update'; 10 | ?> 11 |
12 | 13 | render('_form', [ 14 | 'model' => $model, 15 | ]) ?> 16 | 17 |
18 | -------------------------------------------------------------------------------- /backend/views/post/view.php: -------------------------------------------------------------------------------- 1 | title = $model->title; 10 | $this->params['breadcrumbs'][] = ['label' => 'Posts', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

16 | $model->id], ['class' => 'btn btn-primary']) ?> 17 | $model->id], [ 18 | 'class' => 'btn btn-danger', 19 | 'data' => [ 20 | 'confirm' => 'Are you sure you want to delete this item?', 21 | 'method' => 'post', 22 | ], 23 | ]) ?> 24 |

25 | 26 | $model, 28 | 'attributes' => [ 29 | 'id', 30 | 'post_meta_id', 31 | 'user_id', 32 | 'title', 33 | 'author', 34 | 'excerpt', 35 | 'image', 36 | 'content:ntext', 37 | 'tags', 38 | 'view_count', 39 | 'comment_count', 40 | 'favorite_count', 41 | 'like_count', 42 | 'hate_count', 43 | 'status', 44 | 'order', 45 | 'created_at', 46 | 'updated_at', 47 | ], 48 | ]) ?> 49 | 50 |
51 | -------------------------------------------------------------------------------- /backend/views/right-link/_form.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | -------------------------------------------------------------------------------- /backend/views/right-link/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | -------------------------------------------------------------------------------- /backend/views/right-link/create.php: -------------------------------------------------------------------------------- 1 | title = 'Create Right Link'; 7 | $this->params['breadcrumbs'][] = ['label' => 'Right Links', 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = $this->title; 9 | ?> 10 | -------------------------------------------------------------------------------- /backend/views/right-link/index.php: -------------------------------------------------------------------------------- 1 | title = '右边栏设置'; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 | -------------------------------------------------------------------------------- /backend/views/right-link/update.php: -------------------------------------------------------------------------------- 1 | title = 'Update Right Link: ' . ' ' . $model->title; 7 | $this->params['breadcrumbs'][] = ['label' => 'Right Links', 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]]; 9 | $this->params['breadcrumbs'][] = 'Update'; 10 | ?> 11 | -------------------------------------------------------------------------------- /backend/views/right-link/view.php: -------------------------------------------------------------------------------- 1 | title = $model->title; 10 | $this->params['breadcrumbs'][] = ['label' => 'Right Links', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 | -------------------------------------------------------------------------------- /backend/views/search-log/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 34 | -------------------------------------------------------------------------------- /backend/views/search-log/index.php: -------------------------------------------------------------------------------- 1 | title = 'Search Logs'; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 | render('_search', ['model' => $searchModel]); ?> 16 | 17 | 18 | $dataProvider, 20 | 'filterModel' => $searchModel, 21 | 'columns' => [ 22 | ['class' => 'yii\grid\SerialColumn'], 23 | 24 | [ 25 | 'attribute' => 'username', 26 | 'filter' => Html::activeTextInput($searchModel, 'username', ['class' => 'form-control']), 27 | 'format' => 'raw', 28 | 'value' => function ($data) { 29 | return $data->user['username']; 30 | }, 31 | ], 32 | 'keyword', 33 | 'created_at:datetime', 34 | 35 | ['class' => 'yii\grid\ActionColumn', 'template' => '{delete}'], 36 | ], 37 | ]); ?> 38 | 39 |
40 | -------------------------------------------------------------------------------- /backend/views/site/error.php: -------------------------------------------------------------------------------- 1 | title = $name; 11 | ?> 12 | 13 |
14 | 15 |
16 |

17 | 18 |
19 |

20 | 21 |

22 | 23 |

24 | 25 |

26 | The above error occurred while the Web server was processing your request. 27 | Please contact us if you think this is a server error. Thank you. 28 | Meanwhile, you may return to dashboard or try using the search 29 | form. 30 |

31 | 32 |
33 |
34 | 35 | 36 |
37 | 39 |
40 |
41 |
42 |
43 |
44 | 45 |
46 | -------------------------------------------------------------------------------- /backend/views/user/_form.php: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 | 15 | 16 | 17 | field($model, 'role')->widget(Select2Widget::classname(), [ 18 | 'items' => ['' => '选择一个权限'] + User::getRoleList(), 19 | ]); ?> 20 | 21 | field($model, 'status')->widget(Select2Widget::classname(), [ 22 | 'items' => ['' => '选择一个状态'] + User::getStatusList(), 23 | ]); ?> 24 | 25 |
26 | isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> 27 |
28 | 29 | 30 |
31 | -------------------------------------------------------------------------------- /backend/views/user/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 50 | -------------------------------------------------------------------------------- /backend/views/user/index.php: -------------------------------------------------------------------------------- 1 | title = 'Users'; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 | render('_search', ['model' => $searchModel]); ?> 16 | 17 | $dataProvider, 19 | 'filterModel' => $searchModel, 20 | 'columns' => [ 21 | ['class' => 'yii\grid\SerialColumn'], 22 | 23 | 'id', 24 | 'username', 25 | 'avatar', 26 | // 'password_reset_token', 27 | // 'email:email', 28 | // 'tagline', 29 | [ 30 | 'attribute' => 'role', 31 | 'value' => function($model) { 32 | return User::getRole($model->role)['name']; 33 | }, 34 | ], 35 | // 'status', 36 | 'created_at:datetime', 37 | 'updated_at:datetime', 38 | 39 | ['class' => 'yii\grid\ActionColumn'], 40 | ], 41 | ]); ?> 42 | 43 |
44 | -------------------------------------------------------------------------------- /backend/views/user/update.php: -------------------------------------------------------------------------------- 1 | title = 'Update User: ' . ' ' . $model->id; 7 | $this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; 8 | $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; 9 | $this->params['breadcrumbs'][] = 'Update'; 10 | ?> 11 |
12 | 13 | render('_form', [ 14 | 'model' => $model, 15 | ]) ?> 16 | 17 |
18 | -------------------------------------------------------------------------------- /backend/views/user/view.php: -------------------------------------------------------------------------------- 1 | title = $model->id; 10 | $this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

16 | $model->id], ['class' => 'btn btn-primary']) ?> 17 | $model->id], [ 18 | 'class' => 'btn btn-danger', 19 | 'data' => [ 20 | 'confirm' => 'Are you sure you want to delete this item?', 21 | 'method' => 'post', 22 | ], 23 | ]) ?> 24 |

25 | 26 | $model, 28 | 'attributes' => [ 29 | 'id', 30 | 'username', 31 | 'avatar', 32 | 'auth_key', 33 | 'password_hash', 34 | 'password_reset_token', 35 | 'email:email', 36 | 'tagline', 37 | 'role', 38 | 'status', 39 | 'created_at', 40 | 'updated_at', 41 | ], 42 | ]) ?> 43 | 44 |
45 | -------------------------------------------------------------------------------- /backend/web/.gitignore: -------------------------------------------------------------------------------- 1 | /index.php 2 | /index-test.php 3 | -------------------------------------------------------------------------------- /backend/web/.htaccess: -------------------------------------------------------------------------------- 1 | # use mod_rewrite for pretty URL support 2 | RewriteEngine on 3 | # If a directory or a file exists, use the request directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | # Otherwise forward the request to index.php 7 | RewriteRule . index.php 8 | 9 | # 七牛云存储的回调会传送HTTP_AUTHORIZATION认证秘钥,一定要放在最rewrite的后面.防止影响 10 | # PHP在CGI模式下的认证信息的获取 11 | # RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] -------------------------------------------------------------------------------- /backend/web/assets/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /backend/web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/backend/web/favicon.ico -------------------------------------------------------------------------------- /backend/web/js/sb-admin-2.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | $('#side-menu').metisMenu(); 4 | 5 | }); 6 | 7 | //Loads the correct sidebar on window load, 8 | //collapses the sidebar on window resize. 9 | // Sets the min-height of #page-wrapper to window size 10 | $(function() { 11 | $(window).bind("load resize", function() { 12 | topOffset = 50; 13 | width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width; 14 | if (width < 768) { 15 | $('div.navbar-collapse').addClass('collapse') 16 | topOffset = 100; // 2-row-menu 17 | } else { 18 | $('div.navbar-collapse').removeClass('collapse') 19 | } 20 | 21 | height = (this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height; 22 | height = height - topOffset; 23 | if (height < 1) height = 1; 24 | if (height > topOffset) { 25 | $("#page-wrapper").css("min-height", (height) + "px"); 26 | } 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /backend/web/robots.txt: -------------------------------------------------------------------------------- 1 | User-Agent: * 2 | Disallow: / 3 | -------------------------------------------------------------------------------- /common/assets/AtJs.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class AtJs extends AssetBundle 10 | { 11 | public $sourcePath = '@bower/At.js/dist'; 12 | 13 | public $css = [ 14 | 'css/jquery.atwho.min.css', 15 | ]; 16 | 17 | public $js = [ 18 | 'js/jquery.atwho.min.js', 19 | ]; 20 | } 21 | -------------------------------------------------------------------------------- /common/assets/CaretJs.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class CaretJs extends AssetBundle 10 | { 11 | public $sourcePath = '@bower/caret.js/dist'; 12 | 13 | public $css = []; 14 | 15 | public $js = [ 16 | 'jquery.caret.min.js', 17 | ]; 18 | } 19 | -------------------------------------------------------------------------------- /common/assets/DropzoneJs.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class DropzoneJs extends AssetBundle 10 | { 11 | public $sourcePath = '@vendor/enyo/dropzone/dist/min'; 12 | 13 | public $css = [ 14 | 'dropzone.min.css', 15 | ]; 16 | 17 | public $js = [ 18 | 'dropzone.min.js', 19 | ]; 20 | } 21 | -------------------------------------------------------------------------------- /common/components/AssetBundle.php: -------------------------------------------------------------------------------- 1 | YII_DEBUG // debug模式时强制拷贝 8 | ]; 9 | } -------------------------------------------------------------------------------- /common/components/ComposerInstaller.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 16/8/7 上午10:44 5 | * description: 6 | */ 7 | 8 | namespace common\components; 9 | 10 | use yii\composer\Installer; 11 | 12 | class ComposerInstaller extends Installer 13 | { 14 | public static function initProject($event) 15 | { 16 | } 17 | } -------------------------------------------------------------------------------- /common/components/DbAuthManager.php: -------------------------------------------------------------------------------- 1 | from($this->itemChildTable) 13 | ->join('INNER JOIN', $this->itemTable, implode(' AND ', [ 14 | $this->itemTable . '.name=' . $this->itemChildTable . '.child', 15 | $this->itemTable . '.type = ' . $type 16 | ])); 17 | $parents = []; 18 | foreach ($query->all($this->db) as $row) { 19 | $parents[$row['parent']][] = $row['child']; 20 | } 21 | return $parents; 22 | } 23 | 24 | /** 25 | * @params bool $recursive 是否递归显示子角色权限 26 | * @inheritdoc 27 | */ 28 | public function getPermissionsByRole($roleName, $recursive = true) 29 | { 30 | $childrenList = $recursive ? $this->getChildrenList() : $this->getChildrenListOfType(Item::TYPE_PERMISSION); 31 | $result = []; 32 | $this->getChildrenRecursive($roleName, $childrenList, $result); 33 | if (empty($result)) { 34 | return []; 35 | } 36 | $query = (new Query)->from($this->itemTable)->where([ 37 | 'type' => Item::TYPE_PERMISSION, 38 | 'name' => array_keys($result), 39 | ]); 40 | $permissions = []; 41 | foreach ($query->all($this->db) as $row) { 42 | $permissions[$row['name']] = $this->populateItem($row); 43 | } 44 | return $permissions; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /common/components/FileTarget.php: -------------------------------------------------------------------------------- 1 | 5 | * createTime : 2015/12/22 18:13 6 | * description: 7 | */ 8 | namespace common\components; 9 | 10 | use Yii; 11 | use yii\helpers\FileHelper; 12 | 13 | class FileTarget extends \yii\log\FileTarget 14 | { 15 | /** 16 | * @var bool 是否启用日志前缀 (@app/runtime/logs/error/20151223_app.log) 17 | */ 18 | public $enableDatePrefix = false; 19 | 20 | /** 21 | * @var bool 启用日志等级目录 22 | */ 23 | public $enableCategoryDir = false; 24 | 25 | private $_logFilePath = ''; 26 | 27 | public function init() 28 | { 29 | if ($this->logFile === null) { 30 | $this->logFile = Yii::$app->getRuntimePath() . '/logs/app.log'; 31 | } else { 32 | $this->logFile = Yii::getAlias($this->logFile); 33 | } 34 | $this->_logFilePath = dirname($this->logFile); 35 | 36 | // 启用日志前缀 37 | if ($this->enableDatePrefix) { 38 | $filename = basename($this->logFile); 39 | $this->logFile = $this->_logFilePath . '/' . date('Ymd') . '_' . $filename; 40 | } 41 | 42 | if (!is_dir($this->_logFilePath)) { 43 | FileHelper::createDirectory($this->_logFilePath, $this->dirMode, true); 44 | } 45 | 46 | if ($this->maxLogFiles < 1) { 47 | $this->maxLogFiles = 1; 48 | } 49 | if ($this->maxFileSize < 1) { 50 | $this->maxFileSize = 1; 51 | } 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /common/components/db/ActiveRecord.php: -------------------------------------------------------------------------------- 1 | [ 14 | 'class' => 'yii\behaviors\TimestampBehavior', 15 | ], 16 | ]; 17 | } 18 | } -------------------------------------------------------------------------------- /common/components/db/Command.php: -------------------------------------------------------------------------------- 1 | db->getQueryBuilder()->batchInsert($table, $columns, $rows); 14 | return $this->setSql('REPLACE' . substr($sql, strpos($sql, ' '))); 15 | } 16 | 17 | } 18 | 19 | ?> -------------------------------------------------------------------------------- /common/components/db/Connection.php: -------------------------------------------------------------------------------- 1 | open(); 12 | $command = new Command([ // 使用了继承了之后的Command类.. 13 | 'db' => $this, 14 | 'sql' => $sql, 15 | ]); 16 | 17 | return $command->bindValues($params); 18 | } 19 | } -------------------------------------------------------------------------------- /common/components/db/Migration.php: -------------------------------------------------------------------------------- 1 | db->driverName === 'mysql') { //Mysql 表选项 24 | $engine = $this->useTransaction ? 'InnoDB' : 'MyISAM'; 25 | $this->tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=' . $engine; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /common/config/.gitignore: -------------------------------------------------------------------------------- 1 | main-local.php 2 | params-local.php 3 | db.php 4 | -------------------------------------------------------------------------------- /common/config/bootstrap.php: -------------------------------------------------------------------------------- 1 | 'caizhenghai@gmail.com', 4 | 'backupEmail' => 'caizhenghai@qq.com', 5 | 'supportEmail' => 'forecho@foxmail.com', 6 | 'user.passwordResetTokenExpire' => 3600, 7 | // 'avatarPath' => Yii::$app->basePath . '/uploads/avatars/', 8 | // 'avatarUrl' => Yii::$app->urlManager->baseUrl . '/uploads/avatars/', 9 | 'avatarPath' => '/web/uploads/avatars/', 10 | 'avatarUrl' => '/uploads/avatars/', 11 | 'avatarCachePath' => '/web/uploads/avatars/cache/', 12 | 'avatarCacheUrl' => '/uploads/avatars/cache/', 13 | 'icon-framework' => 'fa', // Font Awesome Icon framework 14 | 'qrCodePath' => '/web/uploads/qr-code/', 15 | 'qrCodeUrl' => '/uploads/qr-code/', 16 | 'newUserPostLimit' => 0, // 防止 spam,可限制新注册用户多少秒之后才能发帖,默认 0 代表不限制,单位是秒 17 | 'smToken' => '', // https://sm.ms/home/apitoken 18 | 'createPostNeedVerify' => false, // 发帖是否需要审核 19 | ]; 20 | -------------------------------------------------------------------------------- /common/grid/EnumColumn.php: -------------------------------------------------------------------------------- 1 | 'common\grid\EnumColumn', 11 | * 'attribute' => 'role', 12 | * 'enum' => User::getRoles() 13 | * ] 14 | * @package common\components\grid 15 | */ 16 | class EnumColumn extends DataColumn 17 | { 18 | /** 19 | * @var array List of value => name pairs 20 | */ 21 | public $enum = []; 22 | /** 23 | * @var bool 24 | */ 25 | public $loadFilterDefaultValues = true; 26 | 27 | /** 28 | * @inheritdoc 29 | */ 30 | public function init() 31 | { 32 | if ($this->loadFilterDefaultValues && $this->filter === null) { 33 | $this->filter = $this->enum; 34 | } 35 | } 36 | 37 | /** 38 | * @param mixed $model 39 | * @param mixed $key 40 | * @param int $index 41 | * @return mixed 42 | */ 43 | public function getDataCellValue($model, $key, $index) 44 | { 45 | $value = parent::getDataCellValue($model, $key, $index); 46 | return ArrayHelper::getValue($this->enum, $value, $value); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /common/helpers/Arr.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 16/3/19 上午9:57 5 | * description: 6 | */ 7 | 8 | namespace common\helpers; 9 | 10 | 11 | use yii\helpers\ArrayHelper; 12 | 13 | class Arr extends ArrayHelper 14 | { 15 | /** 16 | * 随机筛选$num个数组 17 | * @param array $arr 18 | * @param int $num 19 | * @return array|false 20 | */ 21 | public static function arrayRandomAssoc(Array $arr, $num = 1) 22 | { 23 | if (!$arr) { 24 | return false; 25 | } 26 | $keys = array_keys($arr); 27 | shuffle($keys); 28 | 29 | $r = []; 30 | for ($i = 0; $i < $num; $i++) { 31 | $r[$keys[$i]] = $arr[$keys[$i]]; 32 | } 33 | return $r; 34 | } 35 | } -------------------------------------------------------------------------------- /common/helpers/Avatar.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/5/17 下午4:14 5 | * description: 6 | */ 7 | 8 | namespace common\helpers; 9 | 10 | class Avatar 11 | { 12 | public $email; 13 | public $size; 14 | 15 | public function __construct($email, $size = 50) 16 | { 17 | $this->email = $email; 18 | $this->size = $size; 19 | } 20 | 21 | public function getAvater() 22 | { 23 | // 说明: Gravatar 随机头像太丑了 所以使用 Identicon 随机头像 24 | // TODO 保存头像图片 加缓存 25 | // return $this->getGravatar(); 26 | $identicon = new \Identicon\Identicon(); 27 | return $identicon->getImageDataUri($this->email, $this->size); 28 | } 29 | 30 | /** 31 | * 根据 email 获取 gravatar 头像的地址 32 | * @return string 33 | */ 34 | private function getGravatar() 35 | { 36 | $hash = md5(strtolower(trim($this->email))); 37 | return sprintf('http://gravatar.com/avatar/%s?s=%d&d=%s', $hash, $this->size, 'identicon'); 38 | } 39 | 40 | /** 41 | * 验证email是否有对应的 Gravatar 头像(效率太低) 42 | * @return bool 43 | */ 44 | private function validateGravatar() 45 | { 46 | $hash = md5(strtolower(trim($this->email))); 47 | $uri = 'http://gravatar.com/avatar/' . $hash . '?d=404'; 48 | $headers = @get_headers($uri); 49 | if (!preg_match("|200|", $headers[0])) { 50 | return false; 51 | } else { 52 | return true; 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /common/helpers/Formatter.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 2015/8/4 14:19 5 | * description: 6 | */ 7 | 8 | namespace common\helpers; 9 | 10 | class Formatter 11 | { 12 | const DATE_FORMAT = 'php:Y-m-d'; 13 | const DATETIME_FORMAT = 'php:Y-m-d H:i:s'; 14 | const TIME_FORMAT = 'php:H:i:s'; 15 | 16 | public static function convert($dateStr, $type = 'date', $format = null) 17 | { 18 | if ($type === 'datetime') { 19 | $fmt = ($format == null) ? self::DATETIME_FORMAT : $format; 20 | } elseif ($type === 'time') { 21 | $fmt = ($format == null) ? self::TIME_FORMAT : $format; 22 | } else { 23 | $fmt = ($format == null) ? self::DATE_FORMAT : $format; 24 | } 25 | return \Yii::$app->formatter->asDate($dateStr, $fmt); 26 | } 27 | 28 | /** 29 | * 相对时间 30 | * @param $dateStr 31 | * @return string 32 | */ 33 | public static function relative($dateStr) 34 | { 35 | return \Yii::$app->formatter->asRelativeTime($dateStr); 36 | } 37 | } -------------------------------------------------------------------------------- /common/helpers/UploadHelper.php: -------------------------------------------------------------------------------- 1 | 8 | beginPage() ?> 9 | 10 | 11 | 12 | 13 | <?= Html::encode($this->title) ?> 14 | head() ?> 15 | 16 | 17 | beginBody() ?> 18 | 19 | endBody() ?> 20 | 21 | 22 | endPage() ?> 23 | -------------------------------------------------------------------------------- /common/mail/passwordResetToken.php: -------------------------------------------------------------------------------- 1 | urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); 8 | ?> 9 | 10 | Hello username) ?>, 11 | 12 | Follow the link below to reset your password: 13 | 14 | 15 | -------------------------------------------------------------------------------- /common/messages/pt-BR/common.php: -------------------------------------------------------------------------------- 1 | 'EXCLUIDO', 4 | 'ACTIVE' => 'ATIVO', 5 | 'EXCELLENT' => 'EXCELENTE', 6 | 'TOP' => 'TOP', 7 | 'Username' => 'Usuário', 8 | 'Password' => 'Senha', 9 | 'Remember Me' => 'Lembrar-me', 10 | 'Incorrect username or password.' => 'Usuário ou senha inválido', 11 | 'You don\'t have permission to login.' => 'Você não tem permissão pra autenticar', 12 | 'User ID' => 'ID do usuário', 13 | 'Type' => 'Tipo', 14 | 'Merit' => 'Mérito', 15 | 'Created At' => 'Criado em', 16 | 'Updated At' => 'Alterado em', 17 | 'Merit Template ID' => 'Cod Template Merit', 18 | 'Description' => 'Descrição', 19 | 'Action Type' => 'Tipo de Ação', 20 | 'Increment' => 'Incremento', 21 | ]; -------------------------------------------------------------------------------- /common/messages/pt-BR/frontend.php: -------------------------------------------------------------------------------- 1 | 'criado em {datetime}', 4 | 'reply_at {datetime}' => 'respondido em {datetime}', 5 | 'last_by' => 'Por', 6 | ]; -------------------------------------------------------------------------------- /common/messages/zh-CN/common.php: -------------------------------------------------------------------------------- 1 | '已删除', 5 | 'ACTIVE' => '正常', 6 | 'EXCELLENT' => '推荐', 7 | 'TOP' => '置顶', 8 | 9 | 'Username' => '用户名/邮箱', 10 | 'Password' => '密码', 11 | 'Remember Me' => '记住我', 12 | 'Incorrect username or password.' => '用户名密码验证失败。', 13 | 'You don\'t have permission to login.' => '你没有登录权限。', 14 | 'User ID' => '用户 ID', 15 | 'Type' => '分类', 16 | 'Merit' => '总值', 17 | 'Created At' => '创建时间', 18 | 'Updated At' => '更新时间', 19 | 'Merit Template ID' => '模板ID', 20 | 'Description' => '描述', 21 | 'Action Type' => '操作类型 0减去 1新增', 22 | 'Increment' => '变化值', 23 | 24 | 25 | ]; -------------------------------------------------------------------------------- /common/messages/zh-CN/frontend.php: -------------------------------------------------------------------------------- 1 | '于 {datetime} 发布', 5 | 'reply_at {datetime}' => '于 {datetime} 回复', 6 | 'last_by' => '最后由', 7 | 8 | ]; -------------------------------------------------------------------------------- /common/models/Nav.php: -------------------------------------------------------------------------------- 1 | 50] 37 | ]; 38 | } 39 | 40 | /** 41 | * @inheritdoc 42 | */ 43 | public function attributeLabels() 44 | { 45 | return [ 46 | 'id' => Yii::t('app', 'ID'), 47 | 'name' => Yii::t('app', 'Name'), 48 | 'alias' => Yii::t('app', 'Alias'), 49 | 'order' => Yii::t('app', 'Order'), 50 | 'created_at' => Yii::t('app', 'Created At'), 51 | 'updated_at' => Yii::t('app', 'Updated At'), 52 | ]; 53 | } 54 | 55 | public static function getNavList() 56 | { 57 | $data_array = ArrayHelper::map(static::find()->orderBy(['order' => SORT_ASC])->all(), 'id', 'name'); 58 | return $data_array; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /common/models/NavUrl.php: -------------------------------------------------------------------------------- 1 | 255], 39 | [['url'], 'string', 'max' => 225] 40 | ]; 41 | } 42 | 43 | /** 44 | * @inheritdoc 45 | */ 46 | public function attributeLabels() 47 | { 48 | return [ 49 | 'id' => Yii::t('app', 'ID'), 50 | 'nav_id' => Yii::t('app', 'Nav ID'), 51 | 'title' => Yii::t('app', 'Title'), 52 | 'url' => Yii::t('app', 'Url'), 53 | 'description' => Yii::t('app', 'Description'), 54 | 'order' => Yii::t('app', 'Order'), 55 | 'user_id' => Yii::t('app', 'User ID'), 56 | 'created_at' => Yii::t('app', 'Created At'), 57 | 'updated_at' => Yii::t('app', 'Updated At'), 58 | ]; 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /common/models/PostTag.php: -------------------------------------------------------------------------------- 1 | 20] 35 | ]; 36 | } 37 | 38 | /** 39 | * @inheritdoc 40 | */ 41 | public function attributeLabels() 42 | { 43 | return [ 44 | 'id' => 'ID', 45 | 'name' => '名称', 46 | 'count' => '计数', 47 | 'created_at' => '创建时间', 48 | 'updated_at' => '修改时间', 49 | ]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /common/models/Search.php: -------------------------------------------------------------------------------- 1 | where($keyword)->andWhere(['status' => [1, 2]]) 20 | ->asArray() 21 | ->offset(0) 22 | ->limit(1000) 23 | ->all(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/models/SearchLog.php: -------------------------------------------------------------------------------- 1 | 255] 33 | ]; 34 | } 35 | 36 | /** 37 | * @inheritdoc 38 | */ 39 | public function attributeLabels() 40 | { 41 | return [ 42 | 'id' => Yii::t('app', 'ID'), 43 | 'user_id' => Yii::t('app', '用户ID'), 44 | 'username' => Yii::t('app', '用户名'), 45 | 'keyword' => Yii::t('app', '搜索关键词'), 46 | 'created_at' => Yii::t('app', '创建时间'), 47 | ]; 48 | } 49 | 50 | public function getUser() 51 | { 52 | return $this->hasOne(User::className(), ['id' => 'user_id']); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /common/models/Session.php: -------------------------------------------------------------------------------- 1 | 40] 34 | ]; 35 | } 36 | 37 | /** 38 | * @inheritdoc 39 | */ 40 | public function attributeLabels() 41 | { 42 | return [ 43 | 'id' => Yii::t('app', 'ID'), 44 | 'expire' => Yii::t('app', 'Expire'), 45 | 'data' => Yii::t('app', 'Data'), 46 | ]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /common/services/CommentService.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/19 下午3:20 5 | * description: 6 | */ 7 | 8 | namespace common\services; 9 | 10 | use common\models\PostComment; 11 | 12 | class CommentService 13 | { 14 | 15 | public function userDoAction($id, $action) 16 | { 17 | $comment = PostComment::findComment($id); 18 | $user = \Yii::$app->user->getIdentity(); 19 | if (in_array($action, ['like'])) { 20 | return UserService::CommentAction($user, $comment, $action); 21 | } 22 | } 23 | 24 | /** 25 | * 过滤内容 26 | */ 27 | public function filterSame($content) 28 | { 29 | $content = strtolower($content); 30 | $content = trim($content); 31 | $data = ['test', '测试']; 32 | if (in_array($content, $data)) { 33 | return false; 34 | } 35 | $action = ['+1', '赞', '很赞' , '喜欢', '收藏', 'mark', '写的不错', '不错', '给力', '顶', '沙发', '前排', '留名', '路过']; 36 | if (in_array($content, $action)) { 37 | return false; 38 | } 39 | return true; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /common/services/TopicService.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/19 下午3:20 5 | * description: 6 | */ 7 | 8 | namespace common\services; 9 | 10 | use common\models\User; 11 | use frontend\modules\topic\models\Topic; 12 | 13 | class TopicService extends PostService 14 | { 15 | 16 | public function userDoAction($id, $action) 17 | { 18 | $topic = Topic::findTopic($id); 19 | /** @var User $user */ 20 | $user = \Yii::$app->user->getIdentity(); 21 | if (in_array($action, ['like', 'hate'])) { 22 | return UserService::TopicActionA($user, $topic, $action); 23 | } else { 24 | return UserService::TopicActionB($user, $topic, $action); 25 | } 26 | } 27 | 28 | /** 29 | * 撤销帖子 30 | * @param Topic $topic 31 | */ 32 | public static function revoke(Topic $topic) 33 | { 34 | $topic->setAttributes(['status' => Topic::STATUS_ACTIVE]); 35 | $topic->save(); 36 | } 37 | 38 | /** 39 | * 加精华 40 | * @param Topic $topic 41 | */ 42 | public static function excellent(Topic $topic) 43 | { 44 | $action = ($topic->status == Topic::STATUS_ACTIVE) ? Topic::STATUS_EXCELLENT : Topic::STATUS_ACTIVE; 45 | $topic->setAttributes(['status' => $action]); 46 | $topic->save(); 47 | } 48 | } -------------------------------------------------------------------------------- /common/services/TweetService.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/19 下午3:20 5 | * description: 6 | */ 7 | 8 | namespace common\services; 9 | 10 | use frontend\modules\topic\models\Topic; 11 | use frontend\modules\tweet\models\Tweet; 12 | use yii\helpers\Url; 13 | 14 | class TweetService extends PostService 15 | { 16 | 17 | public function userDoAction($id, $action) 18 | { 19 | $topic = Tweet::findTweet($id); 20 | $user = \Yii::$app->user->getIdentity(); 21 | return UserService::TopicActionB($user, $topic, $action); 22 | } 23 | 24 | /** 25 | * 撤销帖子 26 | * @param Topic $topic 27 | */ 28 | public static function revoke(Topic $topic) 29 | { 30 | $topic->setAttributes(['status' => Topic::STATUS_ACTIVE]); 31 | $topic->save(); 32 | } 33 | 34 | /** 35 | * 加精华 36 | * @param Topic $topic 37 | */ 38 | public static function excellent(Topic $topic) 39 | { 40 | $action = ($topic->status == Topic::STATUS_ACTIVE) ? Topic::STATUS_EXCELLENT : Topic::STATUS_ACTIVE; 41 | $topic->setAttributes(['status' => $action]); 42 | $topic->save(); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /common/widgets/JsBlock.php: -------------------------------------------------------------------------------- 1 | renderInPlace) { 29 | throw new \Exception("not implemented yet ! "); 30 | // echo $block; 31 | } 32 | $block = trim($block); 33 | /* 34 | $jsBlockPattern = '|^]*>(.+?)$|is'; 35 | if(preg_match($jsBlockPattern,$block)){ 36 | $block = preg_replace ( $jsBlockPattern , '${1}' , $block ); 37 | } 38 | */ 39 | $jsBlockPattern = '|^]*>(?P.+?)$|is'; 40 | if (preg_match($jsBlockPattern, $block, $matches)) { 41 | $block = $matches['block_content']; 42 | } 43 | 44 | $this->view->registerJs($block, $this->pos, $this->key); 45 | } 46 | } -------------------------------------------------------------------------------- /console/config/.gitignore: -------------------------------------------------------------------------------- 1 | main-local.php 2 | params-local.php -------------------------------------------------------------------------------- /console/config/bootstrap.php: -------------------------------------------------------------------------------- 1 | 'app-console', 11 | 'basePath' => dirname(__DIR__), 12 | 'bootstrap' => ['log', 'gii'], 13 | 'controllerNamespace' => 'console\controllers', 14 | 'modules' => [ 15 | 'gii' => 'yii\gii\Module', 16 | ], 17 | 'components' => [ 18 | 'log' => [ 19 | 'targets' => [ 20 | [ 21 | 'class' => 'yii\log\FileTarget', 22 | 'levels' => ['error', 'warning', 'info'], 23 | ], 24 | ], 25 | ], 26 | 'user' => [ 27 | 'class' => 'yii\web\User', 28 | 'identityClass' => 'common\models\User', 29 | //'enableAutoLogin' => true, 30 | ], 31 | ], 32 | 'params' => $params, 33 | 'controllerMap' => [ 34 | 'backup' => [ 35 | 'class' => 'yiier\backup\controllers\BackupController', 36 | ] 37 | ] 38 | ]; 39 | -------------------------------------------------------------------------------- /console/config/params.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 4 | ]; 5 | -------------------------------------------------------------------------------- /console/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/console/controllers/.gitkeep -------------------------------------------------------------------------------- /console/migrations/m130524_201442_init.php: -------------------------------------------------------------------------------- 1 | createTable('{{%user}}', [ 11 | 'id' => Schema::TYPE_PK, 12 | 'username' => Schema::TYPE_STRING . ' NOT NULL', 13 | 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', 14 | 'password_hash' => Schema::TYPE_STRING . ' NOT NULL', 15 | 'password_reset_token' => Schema::TYPE_STRING, 16 | 'email' => Schema::TYPE_STRING . ' NOT NULL', 17 | 'role' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', 18 | 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', 19 | 'created_at' => Schema::TYPE_INTEGER . ' NOT NULL', 20 | 'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL', 21 | ], $this->tableOptions); 22 | } 23 | 24 | public function down() 25 | { 26 | $this->dropTable('{{%user}}'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /console/migrations/m150115_081356_create_user_info.php: -------------------------------------------------------------------------------- 1 | createTable('{{%user_info}}', [ 11 | 'id' => Schema::TYPE_PK, 12 | 'user_id' => Schema::TYPE_INTEGER . ' UNSIGNED NOT NULL', 13 | 'info' => Schema::TYPE_STRING . ' DEFAULT NULL COMMENT "会员简介"', 14 | 'login_count' => Schema::TYPE_INTEGER . ' DEFAULT 1 COMMENT "登录次数"', 15 | 'prev_login_time' => Schema::TYPE_INTEGER . ' UNSIGNED NOT NULL COMMENT "上次登录时间"', 16 | 'prev_login_ip' => Schema::TYPE_STRING . '(32) NOT NULL COMMENT "上次登录IP"', 17 | 'last_login_time' => Schema::TYPE_INTEGER . ' UNSIGNED NOT NULL COMMENT "最后登录时间"', 18 | 'last_login_ip' => Schema::TYPE_STRING . '(32) NOT NULL COMMENT "最后登录IP"', 19 | 'created_at' => Schema::TYPE_INTEGER . ' UNSIGNED NOT NULL', 20 | 'updated_at' => Schema::TYPE_INTEGER . ' UNSIGNED NOT NULL', 21 | ], $this->tableOptions); 22 | } 23 | 24 | public function down() 25 | { 26 | echo "m150115_081356_create_user_info cannot be reverted.\n"; 27 | $this->dropTable('{{%user_info}}'); 28 | return false; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /console/migrations/m150201_142415_update_user.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%user_info}}', 'location' , Schema::TYPE_STRING . '(10) DEFAULT NULL COMMENT "城市" AFTER `info`'); 11 | $this->addColumn('{{%user_info}}', 'company' , Schema::TYPE_STRING . '(40) DEFAULT NULL COMMENT "公司" AFTER `info`'); 12 | $this->addColumn('{{%user_info}}', 'website' , Schema::TYPE_STRING . '(100) DEFAULT NULL COMMENT "个人主页" AFTER `info`'); 13 | $this->addColumn('{{%user_info}}', 'github' , Schema::TYPE_STRING . '(100) DEFAULT NULL COMMENT "GitHub 帐号" AFTER `info`'); 14 | $this->addColumn('{{%user}}', 'tagline' , Schema::TYPE_STRING . '(40) DEFAULT NULL COMMENT "一句话介绍" AFTER `email`'); 15 | } 16 | 17 | public function down() 18 | { 19 | echo "m150201_142415_update_user cannot be reverted.\n"; 20 | $this->dropColumn('{{%user_info}}', 'location'); 21 | $this->dropColumn('{{%user_info}}', 'company'); 22 | $this->dropColumn('{{%user_info}}', 'website'); 23 | $this->dropColumn('{{%user_info}}', 'github'); 24 | $this->dropColumn('{{%user}}', 'tagline'); 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /console/migrations/m150205_085033_update_post_comment.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%post_comment}}', 'updated_at', Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间'"); 11 | $this->addColumn('{{%post_comment}}', 'like_count', Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '喜欢数' AFTER `user_id`"); 12 | } 13 | 14 | public function down() 15 | { 16 | echo "m150205_085033_update_post_comment cannot be reverted.\n"; 17 | $this->dropColumn('{{%post_comment}}', 'updated_at'); 18 | $this->dropColumn('{{%post_comment}}', 'like_count'); 19 | return false; 20 | } 21 | } -------------------------------------------------------------------------------- /console/migrations/m150209_090406_create_user_account.php: -------------------------------------------------------------------------------- 1 | execute($this->delTable()); 11 | // 会员第三方登录账号表 12 | $tableName = '{{%user_account}}'; 13 | $this->createTable($tableName, [ 14 | 'id' => Schema::TYPE_PK, 15 | 'user_id' => Schema::TYPE_INTEGER . " UNSIGNED DEFAULT NULL COMMENT '用户ID'", 16 | 'provider' => Schema::TYPE_STRING . "(100) NOT NULL DEFAULT '' COMMENT '授权提供商'", 17 | 'client_id' => Schema::TYPE_STRING . " NOT NULL", 18 | 'data' => Schema::TYPE_TEXT . " NOT NULL", 19 | 'created_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间'", 20 | ], $this->tableOptions); 21 | $this->createIndex('client_id', $tableName, 'client_id'); 22 | $this->createIndex('user_id', $tableName, 'user_id'); 23 | } 24 | 25 | private function delTable() 26 | { 27 | return "DROP TABLE IF EXISTS {{%user_auth}};"; 28 | } 29 | 30 | public function down() 31 | { 32 | echo "m150209_090406_create_user_account cannot be reverted.\n"; 33 | $this->dropTable('{{%user_account}}'); 34 | return false; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /console/migrations/m150211_070335_update_user_info.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%user_info}}', 'like_count' , Schema::TYPE_INTEGER . ' DEFAULT 0 COMMENT "被赞次数" AFTER `location`'); 11 | $this->addColumn('{{%user_info}}', 'thanks_count' , Schema::TYPE_INTEGER . ' DEFAULT 0 COMMENT "被感谢次数" AFTER `location`'); 12 | $this->addColumn('{{%user_info}}', 'post_count' , Schema::TYPE_INTEGER . ' DEFAULT 0 COMMENT "发布文章数" AFTER `location`'); 13 | $this->addColumn('{{%user_info}}', 'comment_count' , Schema::TYPE_INTEGER . ' DEFAULT 0 COMMENT "发布评论数" AFTER `location`'); 14 | $this->addColumn('{{%user_info}}', 'view_count' , Schema::TYPE_INTEGER . ' DEFAULT 0 COMMENT "个人主页浏览次数" AFTER `location`'); 15 | } 16 | 17 | public function down() 18 | { 19 | echo "m150211_070335_update_user_info cannot be reverted.\n"; 20 | $this->dropColumn('{{%user_info}}', 'like_count'); 21 | $this->dropColumn('{{%user_info}}', 'thanks_count'); 22 | $this->dropColumn('{{%user_info}}', 'post_count'); 23 | $this->dropColumn('{{%user_info}}', 'comment_count'); 24 | $this->dropColumn('{{%user_info}}', 'view_count'); 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /console/migrations/m150212_030127_update_user_info_and_post_meta.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%user_info}}', 'hate_count' , Schema::TYPE_INTEGER . ' DEFAULT 0 COMMENT "喝倒彩次数" AFTER `like_count`'); 11 | } 12 | 13 | public function down() 14 | { 15 | echo "m150212_030127_update_user_info_and_post_meta cannot be reverted.\n"; 16 | $this->dropColumn('{{%user_info}}', 'hate_count'); 17 | return false; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /console/migrations/m150212_132400_create_topics_table.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%post}}', 'type' , Schema::TYPE_STRING . '(32) DEFAULT "blog" COMMENT "内容类型" AFTER `id`'); 11 | // 修改字段 12 | $this->alterColumn('{{%post}}', 'tags' , Schema::TYPE_STRING . " DEFAULT NULL COMMENT '标签 用英文逗号隔开'"); 13 | $this->alterColumn('{{%post}}', 'post_meta_id' , Schema::TYPE_INTEGER . " UNSIGNED NOT NULL COMMENT '版块ID'"); 14 | $this->createIndex('type', '{{%post}}', 'type'); 15 | } 16 | 17 | public function down() 18 | { 19 | echo "m150212_132400_create_topics_table cannot be reverted.\n"; 20 | $this->dropColumn('{{%post}}', 'type'); 21 | return false; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /console/migrations/m150214_070754_update_post_meta.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%post_meta}}', 'alias' , Schema::TYPE_STRING . "(32) DEFAULT NULL COMMENT '变量(别名)' AFTER `name`"); 11 | $this->createIndex('alias', '{{%post_meta}}', 'alias'); 12 | } 13 | 14 | public function down() 15 | { 16 | echo "m150214_070754_update_post_meta cannot be reverted.\n"; 17 | $this->dropColumn('{{%post_meta}}', 'alias'); 18 | return false; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /console/migrations/m150420_060807_update_post_table.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%post}}', 'follow_count' , Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '讨厌数' AFTER `view_count`"); 11 | } 12 | 13 | public function down() 14 | { 15 | echo "m150420_060807_update_post_table cannot be reverted.\n"; 16 | $this->dropColumn('{{%post}}', 'follow_count'); 17 | return false; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /console/migrations/m150424_025409_update_table_engine.php: -------------------------------------------------------------------------------- 1 | changeEngine('MyISAM', 'InnoDB'); 11 | } 12 | 13 | public function safeDown() 14 | { 15 | echo "m150424_025409_update_table_engine cannot be reverted.\n"; 16 | $this->changeEngine('InnoDB', 'MyISAM'); 17 | } 18 | 19 | protected function changeEngine($from, $to) 20 | { 21 | $table = [ 22 | '{{%notification}}', 23 | '{{%post}}', 24 | '{{%post_meta}}', 25 | //'{{%post_tag}}', 26 | //'{{%setting}}', 27 | '{{%user}}', 28 | '{{%user_info}}', 29 | '{{%user_meta}}', 30 | ]; 31 | foreach ($table as $key => $value) { 32 | $this->execute("ALTER TABLE $value ENGINE = {$to};"); 33 | 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /console/migrations/m150424_031429_update_notification_table.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%notification}}', 'status' , Schema::TYPE_BOOLEAN . " UNSIGNED NOT NULL DEFAULT '1' COMMENT '状态 1显示 0不显示' AFTER `data`"); 11 | } 12 | 13 | public function safeDown() 14 | { 15 | echo "m150424_031429_update_notification_table cannot be reverted.\n"; 16 | $this->dropColumn('{{%notification}}', 'status'); 17 | return false; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /console/migrations/m150424_100155_update_post_meta_table.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%post_meta}}', 'parent', Schema::TYPE_INTEGER . " UNSIGNED DEFAULT NULL COMMENT '父级ID' AFTER `name`"); 12 | } 13 | 14 | public function safeDown() 15 | { 16 | echo "m150424_100155_update_post_meta_table cannot be reverted.\n"; 17 | $this->dropColumn('{{%post_meta}}', 'parent'); 18 | return false; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /console/migrations/m150425_031844_create_right_link.php: -------------------------------------------------------------------------------- 1 | execute('DROP TABLE IF EXISTS {{%rightlink}}'); 10 | $table = '{{%right_link}}'; 11 | $this->createTable($table, [ 12 | 'id' => Schema::TYPE_PK, 13 | 'title' => Schema::TYPE_STRING . ' NOT NULL COMMENT "标题"', 14 | 'url' => Schema::TYPE_STRING . '(225) ', 15 | 'image' => Schema::TYPE_STRING . '(255) COMMENT "图片链接"', 16 | 'content' => Schema::TYPE_STRING . '(255) COMMENT "内容"', 17 | 'type' => Schema::TYPE_INTEGER . '(5) COMMENT "展示类别"', 18 | 'created_user' => Schema::TYPE_STRING . '(32) NOT NULL COMMENT "创建人"', 19 | 'created_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间'", 20 | 'updated_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间'", 21 | ], $this->tableOptions); 22 | $this->createIndex('type_index', $table, 'type'); 23 | } 24 | 25 | public function down() 26 | { 27 | echo "m150425_031844_create_rightLink cannot be reverted.\n"; 28 | $this->dropTable('{{%right_link}}'); 29 | return false; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /console/migrations/m150626_073539_create_nav.php: -------------------------------------------------------------------------------- 1 | execute('DROP TABLE IF EXISTS {{%nav}}'); 11 | $table = '{{%nav}}'; 12 | $this->createTable($table, [ 13 | 'id' => Schema::TYPE_PK, 14 | 'name' => Schema::TYPE_STRING . ' NOT NULL COMMENT "名称"', 15 | 'alias' => Schema::TYPE_STRING .' NOT NULL COMMENT "变量(别名)"', 16 | 'order' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '99' COMMENT '项目排序'", 17 | 'created_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间'", 18 | 'updated_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间'", 19 | ]); 20 | } 21 | 22 | public function down() 23 | { 24 | echo "m150626_073539_create_nav cannot be reverted.\n"; 25 | $this->dropTable('{{%nav}}'); 26 | return false; 27 | } 28 | 29 | /* 30 | // Use safeUp/safeDown to run migration code within a transaction 31 | public function safeUp() 32 | { 33 | } 34 | 35 | public function safeDown() 36 | { 37 | } 38 | */ 39 | } 40 | -------------------------------------------------------------------------------- /console/migrations/m150626_073559_create_nav_url.php: -------------------------------------------------------------------------------- 1 | execute('DROP TABLE IF EXISTS {{%nav_url}}'); 11 | $table = '{{%nav_url}}'; 12 | $this->createTable($table, [ 13 | 'id' => Schema::TYPE_PK, 14 | 'nav_id' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '导航分类ID'", 15 | 'title' => Schema::TYPE_STRING . ' NOT NULL COMMENT "标题"', 16 | 'url' => Schema::TYPE_STRING . '(225) NOT NULL COMMENT "链接"', 17 | 'description' => Schema::TYPE_STRING . '(255) COMMENT "描述"', 18 | 'order' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '99' COMMENT '项目排序'", 19 | 'user_id' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '用户ID'", 20 | 'created_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间'", 21 | 'updated_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间'", 22 | ]); 23 | } 24 | 25 | public function down() 26 | { 27 | echo "m150626_073559_create_nav_url cannot be reverted.\n"; 28 | $this->dropTable('{{%nav_url}}'); 29 | return false; 30 | } 31 | 32 | /* 33 | // Use safeUp/safeDown to run migration code within a transaction 34 | public function safeUp() 35 | { 36 | } 37 | 38 | public function safeDown() 39 | { 40 | } 41 | */ 42 | } 43 | -------------------------------------------------------------------------------- /console/migrations/m150702_130239_create_session_init.php: -------------------------------------------------------------------------------- 1 | createTable($this->tableName, [ 13 | 'id' => "varchar(40) NOT NULL", 14 | 'expire' => "int(11)", 15 | 'data' => "blob", 16 | ]); 17 | $this->addPrimaryKey('idx', $this->tableName, 'id'); 18 | $this->createIndex('idx_expire', $this->tableName, 'expire'); 19 | $this->addColumn('{{%user_info}}', 'session_id', Schema::TYPE_STRING . "(100) DEFAULT NULL AFTER `last_login_ip`"); 20 | } 21 | 22 | public function down() 23 | { 24 | echo "m150702_130239_create_session_init cannot be reverted.\n"; 25 | $this->dropTable($this->tableName); 26 | $this->dropColumn('{{%user_info}}', 'session_id'); 27 | return false; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /console/migrations/m150805_085832_create_search_log_table.php: -------------------------------------------------------------------------------- 1 | createTable($this->tableName, [ 13 | 'id' => Schema::TYPE_PK, 14 | 'user_id' => Schema::TYPE_INTEGER . " UNSIGNED DEFAULT NULL COMMENT '用户ID'", 15 | 'keyword' => Schema::TYPE_STRING . " NOT NULL DEFAULT '' COMMENT '搜索关键词'", 16 | 'created_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间'", 17 | ], $this->tableOptions); 18 | $this->createIndex('keyword', $this->tableName, 'keyword'); 19 | $this->createIndex('user_id', $this->tableName, 'user_id'); 20 | } 21 | 22 | public function down() 23 | { 24 | echo "m150805_085832_create_search_log_table cannot be reverted.\n"; 25 | $this->dropTable($this->tableName); 26 | return false; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /console/migrations/m150808_025734_update_table_character.php: -------------------------------------------------------------------------------- 1 | changeCharacter('utf8mb4', 'utf8mb4_general_ci'); 11 | } 12 | 13 | public function safeDown() 14 | { 15 | echo "m150720_031448_update_table_character cannot be reverted.\n"; 16 | $this->changeCharacter('utf8', 'utf8_general_ci'); 17 | } 18 | 19 | protected function changeCharacter($toA, $toB) 20 | { 21 | $this->execute("ALTER TABLE {{%post_comment}} MODIFY COLUMN `comment` text CHARACTER SET {$toA} COLLATE {$toB};"); 22 | $this->execute("ALTER TABLE {{%post}} MODIFY COLUMN `content` text CHARACTER SET {$toA} COLLATE {$toB};"); 23 | $this->execute("ALTER TABLE {{%notification}} MODIFY COLUMN `data` text CHARACTER SET {$toA} COLLATE {$toB};"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /console/migrations/m150829_091943_update_post_table.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%post}}', 'last_comment_username' , Schema::TYPE_STRING . '(20) DEFAULT NULL COMMENT "最后评论用户" AFTER `tags`'); 11 | $this->addColumn('{{%post}}', 'last_comment_time' , Schema::TYPE_INTEGER . ' DEFAULT NULL COMMENT "最后评论用户" AFTER `tags`'); 12 | } 13 | 14 | public function down() 15 | { 16 | echo "m150829_091943_update_post_table cannot be reverted.\n"; 17 | $this->dropColumn('{{%post}}', 'last_comment_time'); 18 | $this->dropColumn('{{%post}}', 'last_comment_username'); 19 | return false; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /console/migrations/m160321_132724_add_donate_table.php: -------------------------------------------------------------------------------- 1 | createTable($this->tableName, [ 12 | 'id' => $this->primaryKey(), 13 | 'user_id' => $this->integer()->notNull(), 14 | 'status' => $this->boolean()->defaultValue(1), 15 | 'description' => $this->string(), 16 | 'qr_code' => $this->string(), 17 | 'created_at' => $this->integer(), 18 | 'updated_at' => $this->integer(), 19 | ], $this->tableOptions); 20 | $this->createIndex('user_id', $this->tableName, 'user_id'); 21 | } 22 | 23 | public function down() 24 | { 25 | echo "m160321_132724_add_donate_table cannot be reverted.\n"; 26 | $this->dropTable($this->tableName); 27 | return false; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /console/migrations/m160719_093527_modify_user.php: -------------------------------------------------------------------------------- 1 | createIndex('idx_username', $this->userTable, 'username', true); 12 | } 13 | 14 | public function down() 15 | { 16 | $this->dropIndex('idx_username', $this->userTable); 17 | } 18 | 19 | /* 20 | // Use safeUp/safeDown to run migration code within a transaction 21 | public function safeUp() 22 | { 23 | } 24 | 25 | public function safeDown() 26 | { 27 | } 28 | */ 29 | } 30 | -------------------------------------------------------------------------------- /console/models/.gitkeep: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /console/runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | ## 本文件夹是功能详细设计文档 2 | 3 | 本文档主要由 @forecho 设计。 -------------------------------------------------------------------------------- /doc/images/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/doc/images/0.png -------------------------------------------------------------------------------- /doc/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/doc/images/1.png -------------------------------------------------------------------------------- /doc/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/doc/images/2.png -------------------------------------------------------------------------------- /doc/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/doc/images/3.png -------------------------------------------------------------------------------- /doc/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/doc/images/4.png -------------------------------------------------------------------------------- /doc/images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/doc/images/5.png -------------------------------------------------------------------------------- /doc/images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/doc/images/6.png -------------------------------------------------------------------------------- /docker-files/docker-compose-example.yml: -------------------------------------------------------------------------------- 1 | mysql: 2 | image: mysql 3 | environment: 4 | - MYSQL_DATABASE=getyii 5 | - MYSQL_ROOT_PASSWORD=getyii.com 6 | ports: 7 | - 3306:3306 8 | 9 | web: 10 | build: . 11 | links: 12 | - mysql:mysql 13 | ports: 14 | - 80:80 15 | environment: 16 | - MYSQL_INSTANCE_NAME=getyii 17 | - MYSQL_PASSWORD=getyii.com 18 | - APP_ENV=Production 19 | volumes: 20 | - ./vendor:/app/vendor:rw 21 | - ~/.composer/cache:/root/.composer/cache:rw 22 | # - .:/app:rw # you should uncomment this line if you want to develop the app. 23 | -------------------------------------------------------------------------------- /docker-files/getyii.com.conf: -------------------------------------------------------------------------------- 1 | server { 2 | charset utf-8; 3 | client_max_body_size 128M; 4 | 5 | listen 80; 6 | server_name getyii.com www.getyii.com *.dev.www.getyii.com; 7 | index index.php; 8 | set $rootdir /app/frontend/web; 9 | root $rootdir; 10 | 11 | location / { 12 | try_files $uri $uri /index.php?$args; 13 | } 14 | 15 | location ~ \.php$ { 16 | include fastcgi_params; 17 | fastcgi_index index.php; 18 | fastcgi_param SCRIPT_FILENAME $rootdir/index.php; 19 | fastcgi_pass 127.0.0.1:9000; 20 | } 21 | 22 | location ~ /\.(ht|svn|git) { 23 | deny all; 24 | } 25 | } 26 | 27 | server { 28 | charset utf-8; 29 | client_max_body_size 128M; 30 | 31 | listen 80; 32 | server_name admin.getyii.com *.dev.admin.getyii.com; 33 | index index.php; 34 | set $rootdir /app/backend/web; 35 | root $rootdir; 36 | 37 | location / { 38 | try_files $uri $uri /index.php?$args; 39 | } 40 | 41 | location ~ \.php$ { 42 | include fastcgi_params; 43 | fastcgi_index index.php; 44 | fastcgi_param SCRIPT_FILENAME $rootdir/index.php; 45 | fastcgi_pass 127.0.0.1:9000; 46 | } 47 | 48 | location ~ /\.(ht|svn|git) { 49 | deny all; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /docker-files/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -x 4 | 5 | cd /app 6 | composer install --prefer-dist --no-interaction --optimize-autoloader 7 | ./init --env=${APP_ENV:-Production} --overwrite=y 8 | ./yii migrate --interactive=0 9 | 10 | function setEnvironmentVariable() { 11 | if [ -z "$2" ]; then 12 | echo "Environment variable '$1' not set." 13 | return 14 | fi 15 | echo "env[$1] = \"$2\" ; automatically add env" >> /usr/local/etc/php-fpm.conf 16 | } 17 | 18 | sed -i '/automatically add env/d' /usr/local/etc/php-fpm.conf 19 | 20 | # Grep all ENV variables 21 | for _curVar in `env | awk -F = '{print $1}'`;do 22 | # awk has split them by the equals sign 23 | # Pass the name and value to our function 24 | setEnvironmentVariable ${_curVar} ${!_curVar} 25 | done 26 | 27 | supervisord -n 28 | # service supervisord start 29 | -------------------------------------------------------------------------------- /environments/dev/backend/config/main-local.php: -------------------------------------------------------------------------------- 1 | [ 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; 22 | -------------------------------------------------------------------------------- /environments/dev/backend/config/params-local.php: -------------------------------------------------------------------------------- 1 | run(); 20 | -------------------------------------------------------------------------------- /environments/dev/backend/web/index.php: -------------------------------------------------------------------------------- 1 | run(); 19 | -------------------------------------------------------------------------------- /environments/dev/common/config/db.php: -------------------------------------------------------------------------------- 1 | 'yii\db\Connection', 10 | 'dsn' => 'mysql:host=' . $MYSQL_PORT_3306_TCP_ADDR . ';dbname=' . $MYSQL_DB_NAME, 11 | 'username' => $MYSQL_USERNAME, 12 | 'password' => $MYSQL_PASSWORD, 13 | 'charset' => 'utf8mb4', 14 | 'enableSchemaCache' => true, 15 | 'schemaCacheDuration' => 3600, 16 | 'schemaCache' => 'cache', 17 | ]; 18 | 19 | return $db; -------------------------------------------------------------------------------- /environments/dev/common/config/main-local.php: -------------------------------------------------------------------------------- 1 | [ 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; 22 | -------------------------------------------------------------------------------- /environments/dev/frontend/config/params-local.php: -------------------------------------------------------------------------------- 1 | run(); 19 | -------------------------------------------------------------------------------- /environments/dev/frontend/web/index.php: -------------------------------------------------------------------------------- 1 | run(); 19 | -------------------------------------------------------------------------------- /environments/dev/yii: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 32 | exit($exitCode); 33 | -------------------------------------------------------------------------------- /environments/prod/backend/config/main-local.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'request' => [ 5 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 6 | 'cookieValidationKey' => '', 7 | ], 8 | ], 9 | ]; 10 | -------------------------------------------------------------------------------- /environments/prod/backend/config/params-local.php: -------------------------------------------------------------------------------- 1 | run(); 19 | -------------------------------------------------------------------------------- /environments/prod/common/config/db.php: -------------------------------------------------------------------------------- 1 | 'yii\db\Connection', 10 | 'dsn' => 'mysql:host=' . $MYSQL_PORT_3306_TCP_ADDR . ';dbname=' . $MYSQL_DB_NAME, 11 | 'username' => $MYSQL_USERNAME, 12 | 'password' => $MYSQL_PASSWORD, 13 | 'charset' => 'utf8mb4', 14 | 'enableSchemaCache' => true, 15 | 'schemaCacheDuration' => 3600, 16 | 'schemaCache' => 'cache', 17 | ]; 18 | 19 | return $db; -------------------------------------------------------------------------------- /environments/prod/common/config/main-local.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'request' => [ 5 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 6 | 'cookieValidationKey' => '', 7 | ], 8 | ], 9 | ]; 10 | -------------------------------------------------------------------------------- /environments/prod/frontend/config/params-local.php: -------------------------------------------------------------------------------- 1 | run(); 19 | -------------------------------------------------------------------------------- /environments/prod/yii: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 32 | exit($exitCode); 33 | -------------------------------------------------------------------------------- /frontend/assets/AppAsset.php: -------------------------------------------------------------------------------- 1 | 14 | * @since 2.0 15 | */ 16 | class AppAsset extends AssetBundle 17 | { 18 | public $basePath = '@webroot'; 19 | public $baseUrl = '@web'; 20 | 21 | public $css = [ 22 | 'css/global.css', 23 | 'css/site.css', //site.css or site-ruyi.css 24 | ]; 25 | 26 | public $js = [ 27 | 'js/emojify.min.js', 28 | 'js/main.js', 29 | 'js/topic.js', 30 | 'js/jquery.pin.js', 31 | 'js/nav.js', 32 | ]; 33 | 34 | public $depends = [ 35 | 'yii\web\YiiAsset', 36 | 'yii\bootstrap\BootstrapAsset', 37 | ]; 38 | } -------------------------------------------------------------------------------- /frontend/assets/AtJsAsset.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 2016/3/10 11:24 5 | * description: 6 | */ 7 | 8 | namespace frontend\assets; 9 | 10 | 11 | use yii\web\AssetBundle; 12 | 13 | class AtJsAsset extends AssetBundle 14 | { 15 | public $basePath = '@webroot'; 16 | public $baseUrl = '@web'; 17 | 18 | public $css = [ 19 | ]; 20 | 21 | public $js = [ 22 | 'js/At.js', 23 | ]; 24 | 25 | public $depends = [ 26 | 'yii\web\YiiAsset', 27 | 'common\assets\AtJs', 28 | 'common\assets\CaretJs', 29 | ]; 30 | } -------------------------------------------------------------------------------- /frontend/assets/BowerAsset.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class BowerAsset extends AssetBundle 10 | { 11 | public $sourcePath = '@bower'; 12 | public $baseUrl = '@bower'; 13 | 14 | public $css = [ 15 | 'highlightjs/styles/darkula.css', 16 | 'pace/themes/green/pace-theme-minimal.css', 17 | ]; 18 | 19 | public $js = [ 20 | 'highlightjs/highlight.pack.js', 21 | 'localforage/dist/localforage.min.js', 22 | 'pace/pace.min.js', 23 | ]; 24 | } 25 | -------------------------------------------------------------------------------- /frontend/assets/EditorAsset.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class EmojifyAsset extends AssetBundle 10 | { 11 | public $sourcePath = '@bower/emojify.js'; 12 | public $baseUrl = '@bower/emojify.js'; 13 | 14 | public $css = [ 15 | ]; 16 | 17 | public $js = [ 18 | 'dist/js/emojify.min.js', 19 | ]; 20 | } 21 | -------------------------------------------------------------------------------- /frontend/behaviors/AfterLoginBehavior.php: -------------------------------------------------------------------------------- 1 | 'afterLogin', 26 | ]; 27 | } 28 | 29 | /** 30 | * @param \yii\web\UserEvent $event 31 | * @return bool 32 | */ 33 | public function afterLogin($event) 34 | { 35 | if ($model = $event->identity->userInfo) { 36 | $model->login_count += 1; 37 | $model->prev_login_time = $model->last_login_time; 38 | $model->prev_login_ip = $model->last_login_ip; 39 | $model->last_login_time = time(); 40 | $model->last_login_ip = Yii::$app->getRequest()->getUserIP(); 41 | 42 | if (!Yii::$app->session->isActive) { 43 | Yii::$app->session->open(); 44 | } 45 | $model->session_id = Yii::$app->session->id; 46 | Yii::$app->session->close(); 47 | 48 | if ($model->save()) { 49 | return true; 50 | } 51 | } 52 | return false; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /frontend/config/.gitignore: -------------------------------------------------------------------------------- 1 | main-local.php 2 | params-local.php -------------------------------------------------------------------------------- /frontend/config/bootstrap.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 4 | 'donateNode' => ['tricks'], // 开启打赏分类 5 | 'loginNode' => ['jobs'], // 需要登录才能访问的分类 6 | 'donateTag' => ['求打赏', '技巧库'], // 开启标签 7 | 'postingIntervalLimit' => 3600, // 限制发帖间隔,单位秒。默认是 1 个小时 8 | 'setting' => [ 9 | 'xunsearch' => false, // true 表示开启 GetYii xunsearch 搜索功能,默认不开启 10 | ], 11 | ]; 12 | -------------------------------------------------------------------------------- /frontend/config/search.ini: -------------------------------------------------------------------------------- 1 | project.name = getyii 2 | project.default_charset = utf-8 3 | server.index = 8383 4 | server.search = 8384 5 | 6 | [topic_id] 7 | type = id 8 | 9 | [title] 10 | type = title 11 | 12 | [content] 13 | type = body 14 | 15 | [status] 16 | index = self 17 | tokenizer = full 18 | 19 | [updated_at] 20 | type = numeric -------------------------------------------------------------------------------- /frontend/controllers/PostTagController.php: -------------------------------------------------------------------------------- 1 | request->queryParams; 22 | $dataProvider = $searchModel->search($params); 23 | //ajax 24 | if (Yii::$app->request->getIsAjax()) { 25 | return json_encode(ArrayHelper::getColumn($dataProvider->getModels(), function ($model) { 26 | return $model->getAttributes(['name']); 27 | })); 28 | } 29 | return $this->render('index', [ 30 | 'searchModel' => $searchModel, 31 | 'dataProvider' => $dataProvider, 32 | ]); 33 | } 34 | } -------------------------------------------------------------------------------- /frontend/models/ContactForm.php: -------------------------------------------------------------------------------- 1 | '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 | } 60 | -------------------------------------------------------------------------------- /frontend/modules/nav/Module.php: -------------------------------------------------------------------------------- 1 | orderBy('order asc')->all(); 13 | return $this->render('index', ['nav' => $nav]); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /frontend/modules/topic/Module.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/20 下午9:17 5 | * description: 6 | */ 7 | 8 | ?> 9 |
10 |
11 | 添加回复 user->getIsGuest()): ?> (需要登录) 12 |
13 | 14 | render('_form', [ 15 | 'model' => $model, 16 | ]) ?> 17 |
-------------------------------------------------------------------------------- /frontend/modules/topic/views/comment/index.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/20 下午9:16 5 | * description: 6 | */ 7 | use yii\helpers\Html; 8 | ?> 9 |
10 |
11 | comment_count) ?> 12 | tags): ?> 13 | 14 | 15 | $value){ 16 | echo Html::a(Html::encode($value), 17 | ['/topic/default/index', 'tag' => $value], 18 | ['class' => 'btn btn-xs btn-primary'] 19 | ), ' ';} ?> 20 | 21 | 22 |
23 | 24 | $dataProvider, 26 | 'itemOptions' => ['class' => 'list-group-item media mt0'], 27 | 'summary' => false, 28 | 'itemView' => '_item', 29 | ]) ?> 30 |
-------------------------------------------------------------------------------- /frontend/modules/topic/views/comment/update.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/20 下午9:15 5 | * description: 6 | */ 7 | 8 | use yii\helpers\Html; 9 | 10 | /** @var \common\models\PostComment $model */ 11 | $this->title = Yii::t('app', '更新回复: ') . ' ' . $model->post->title; 12 | ?> 13 |
14 | 15 |
16 |
17 | post->title, ['/topic/default/view', 'id' => $model->post_id]) ?> 18 |
19 | 20 | render('_form', [ 21 | 'model' => $model, 22 | ]) ?> 23 |
24 |
25 | 26 | -------------------------------------------------------------------------------- /frontend/modules/topic/views/default/create.php: -------------------------------------------------------------------------------- 1 | title = '发布新话题'; 7 | // $this->params['breadcrumbs'][] = ['label' => 'Posts', 'url' => ['index']]; 8 | // $this->params['breadcrumbs'][] = $this->title; 9 | ?> 10 |
11 | 12 |
13 |
14 | title ?> 15 |
16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 |
21 |
22 | 23 | 'create' 25 | ])?> -------------------------------------------------------------------------------- /frontend/modules/topic/views/default/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update Post: ') . ' ' . $model->title; 9 | ?> 10 |
11 | 12 |
13 |
14 | title) ?> 15 |
16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 |
21 |
22 | 23 | 'create' 25 | ])?> -------------------------------------------------------------------------------- /frontend/modules/tweet/Module.php: -------------------------------------------------------------------------------- 1 | 8 |
9 | 10 | '/tweet/default/create', 12 | 'fieldConfig' => [ 13 | 'template' => "{input}\n{hint}\n{error}" 14 | ] 15 | ]); ?> 16 | 17 | field($model, 'content', [ 18 | 'selectors' => [ 19 | 'input' => '#md-input' 20 | ], 21 | ])->textarea([ 22 | 'placeholder' => t('app', 'Tweet Content'), 23 | 'id' => 'md-input', 24 | 'data-at-topic' => true, 25 | 'rows' => 5 26 | ]) ?> 27 | 28 |
29 | $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> 30 |
31 | '_blank']) ?> 32 |
33 |
34 | 35 | 36 | 37 |
-------------------------------------------------------------------------------- /frontend/modules/tweet/views/default/index.php: -------------------------------------------------------------------------------- 1 | title = '发布新动弹'; 3 | /** @var \frontend\modules\tweet\models\Tweet $model*/ 4 | /** @var \yii\data\ActiveDataProvider $dataProvider*/ 5 | ?> 6 |
7 | 8 |
9 |
10 | title ?> 11 | 500 12 |
13 | 14 | render('_form', [ 15 | 'model' => $model, 16 | ]) ?> 17 |
18 | $dataProvider, 20 | 'itemView' => '_item', 21 | 'itemOptions' => ['class' => 'list-group-item item'], 22 | 'summary' => false, 23 | // 'options' => ['class' => ''], 24 | 'pager' => [ 25 | 'class' => \kop\y2sp\ScrollPager::className(), 26 | 'eventOnRendered' => "function() { 27 | emojify.run(); 28 | $('pre code').each(function (i, block) { 29 | hljs.highlightBlock(block); 30 | }); 31 | }", 32 | 'triggerOffset' => 5 33 | ] 34 | ]); ?> 35 |
36 | 37 | 'create' 39 | ]) ?> 40 | -------------------------------------------------------------------------------- /frontend/modules/user/Module.php: -------------------------------------------------------------------------------- 1 | enableFlashMessages): ?> 10 |
11 |
12 | session->getAllFlashes() as $type => $message): ?> 13 | 14 |
15 | 16 |
17 | 18 | 19 |
20 |
21 | -------------------------------------------------------------------------------- /frontend/modules/user/views/setting/_menu.php: -------------------------------------------------------------------------------- 1 | user->identity; 12 | $networksVisible = count(Yii::$app->authClientCollection->clients) > 0; 13 | 14 | ?> 15 | 16 |
17 |
18 |

19 | getUserAvatar(24), ['class' => 'img-rounded', 'alt' => $user->username]);?> 20 | username ?> 21 |

22 |
23 |
24 | [ 26 | 'class' => 'nav nav-pills nav-stacked' 27 | ], 28 | 'items' => [ 29 | ['label' => '个人资料', 'url' => ['/user/setting/profile']], 30 | ['label' => '账号设置', 'url' => ['/user/setting/account']], 31 | ['label' => '更换头像', 'url' => ['/user/setting/avatar']], 32 | ['label' => '打赏设置', 'url' => ['/user/setting/donate']], 33 | ['label' => '账号绑定', 'url' => ['/user/setting/networks'], 'visible' => $networksVisible], 34 | ] 35 | ]) ?> 36 |
37 |
-------------------------------------------------------------------------------- /frontend/modules/user/views/setting/avatar.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Avatar'); 14 | ?> 15 | 16 |
17 |
18 | render('_menu') ?> 19 |
20 |
21 |
22 |
23 | title) ?> 24 |
25 |
26 | 'account-form', 28 | 'options' => ['enctype' => 'multipart/form-data'], 29 | ]); ?> 30 | user->getUserAvatar(200)); ?> 31 | user->getUserAvatar(50)); ?> 32 | user->getUserAvatar(24)); ?> 33 |
34 |
35 | field($model, 'avatar')->fileInput(); ?> 36 |
37 | 'btn btn-success']) ?>
38 |
39 | 40 | 41 |
42 |
43 |
44 |
45 | -------------------------------------------------------------------------------- /frontend/runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /frontend/views/notification/index.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Notifications'); 11 | ?> 12 |
13 |
14 |
15 | 'fa fa-trash']) . ' 清空', 17 | '/notification/clear', 18 | [ 19 | 'data' => [ 20 | 'disable-with' => "清空中...", 21 | 'method' => 'post', 22 | ], 23 | 'class' => 'btn btn-danger' 24 | ] 25 | ) ?> 26 | title, ['class' => 'pull-right']) ?> 27 |
28 | 29 | $dataProvider, 31 | 'itemOptions' => ['class' => 'media notification'], 32 | 'summary' => false, 33 | 'itemView' => '_item', 34 | 'options' => ['class' => 'panel-body'], 35 | 'viewParams' => ['notifyCount' => $notifyCount] 36 | ]) ?> 37 | 38 |
39 |
-------------------------------------------------------------------------------- /frontend/views/partials/markdwon_help.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/12 上午10:38 5 | * description: Markdown 提示 6 | */ 7 | ?> 8 | -------------------------------------------------------------------------------- /frontend/views/partials/users.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 2016/4/19 14:44 5 | * description: 6 | */ 7 | use yii\helpers\Html; 8 | /** @var \yii\base\Object $model */ 9 | /** @var \common\models\User $value */ 10 | ?> 11 | 12 | $value): ?> 13 |
14 |
15 |
16 | userAvatar, ['class' => 'media-object']), 17 | ['/user/default/show', 'username' => $value['username']], 18 | ['title' => $value['username']] 19 | ); ?> 20 |
21 |
22 |
23 | $value['username']], 26 | ['title' => $value['username']] 27 | ); ?> 28 |
29 |
30 | 积分:merit ? $value->merit->merit : 0 ?> 31 |
32 |
33 |
34 |
35 | 36 | -------------------------------------------------------------------------------- /frontend/views/site/about.php: -------------------------------------------------------------------------------- 1 | title = '关于'; 7 | $content = ' 8 | #### 这里是 Yii 中文社区 9 | 10 | - 爱 PHP,爱 Yii 11 | - 爱互联网,爱 Web 开发,爱最新最潮的技术 12 | - 爱学习,爱沟通,也爱传播 13 | - 我们不管你是谁,只要你喜欢 PHP,喜欢 Yii 14 | - 这里是 PHP & Yii 的中国社区,作我们最好的交流和沟通的大本营 15 | 16 | 17 | 一直以来,Yii 在中国都没有一个靠谱的社区,我们几个打算认真的把这个站做起来,改善中国 Yiier 交流的方式。我们是一个非营利组织,它旨在为中国的 PHP 和 Yii 爱好者提供一个自由,开放的交流平台。 18 | 19 | enjoy coding! enjoy yii! 20 | 21 | #### 最后 22 | 23 | - 感谢 [Ruby-China](https://github.com/ruby-china/ruby-china) 的开源代码。 24 | - 感谢 [PHPHub](https://github.com/summerblue/phphub) 的开源代码。 25 | - 感谢 [huajuan](https://github.com/callmez/huajuan) 的开源代码。 26 | - 最后再感谢一下女朋友的支持 <(▰˘◡˘▰)>。 27 | '; 28 | ?> 29 |
30 |
31 | 关于 32 |
33 |
34 | 35 |
36 |
-------------------------------------------------------------------------------- /frontend/views/site/contact.php: -------------------------------------------------------------------------------- 1 | title = '联系我们'; 7 | $content = ' 8 | ## QQ群 9 | 10 | - Yii2 中国交流群:343188481 11 | - Get√Yii 核心开发者群:321493381(本群只接受参与本站开发的 Yiier) 12 | 13 | ## 个人联系 14 | 15 | - QQ:314494687 16 | - Mail:caizhenghai[#]gmail.com 17 | 18 | '; 19 | ?> 20 |
21 |
22 | title ?> 23 |
24 |
25 | 26 |
27 |
-------------------------------------------------------------------------------- /frontend/views/site/contributors.php: -------------------------------------------------------------------------------- 1 | title = '贡献者'; 7 | $content = ' 8 | 以下是本社区的贡献者名单,排名不分先后。 9 | 10 | #### 赞助者 11 | 12 | - XXX. 13 | 14 | #### 社区维护 15 | 16 | - [forecho](/member/forecho) 17 | - [zghack](/member/zghack) 18 | 19 | #### 网站功能开发者 20 | 21 | [https://github.com/iiyii/getyii/contributors](https://github.com/iiyii/getyii/contributors) 22 | 23 | #### Logo 设计 24 | 25 | - [forecho](/member/forecho) 26 | 27 | #### 如何贡献? 28 | 29 | 有钱出钱,有力出力 30 | 31 | Github 项目地址: [https://github.com/iiyii/getyii](https://github.com/iiyii/getyii) Fork 以后提交你的改进,我们会根据情况合并到主线中去,并将你列入贡献者名单。 32 | 33 | #### 如何赞助? 34 | 35 | ![加我微信](/images/wechat-pay.png) 36 | 37 | ![加我支付宝](/images/ali-pay.png) 38 | '; 39 | ?> 40 | 41 |
42 |
43 |
title) ?>
44 |
45 | 46 |
47 |
48 |
-------------------------------------------------------------------------------- /frontend/views/site/error.php: -------------------------------------------------------------------------------- 1 | title = $name; 11 | ?> 12 |
13 | 14 |

title) ?>

15 | 16 |
17 | 18 |
19 | 20 |

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 |
28 | -------------------------------------------------------------------------------- /frontend/views/site/requestPasswordResetToken.php: -------------------------------------------------------------------------------- 1 | title = '找回密码'; 10 | ?> 11 | 12 |
13 |
14 |
15 |
title) ?>
16 |
17 | 'request-password-reset-form']); ?> 18 | field($model, 'email') ?> 19 |
20 | 'btn btn-primary']) ?> 21 |
22 | 23 |
24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /frontend/views/site/resetPassword.php: -------------------------------------------------------------------------------- 1 | title = '密码重置'; 10 | ?> 11 | 12 |
13 |
14 |
15 |
title) ?>
16 |
17 | 'reset-password-form']); ?> 18 | field($model, 'password')->passwordInput() ?> 19 |
20 | 'btn btn-primary']) ?> 21 |
22 | 23 |
24 |
25 |
26 |
-------------------------------------------------------------------------------- /frontend/views/site/signup.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Sign up'); 11 | 12 | ?> 13 | 14 |
15 |
16 |
17 |
title) ?>
18 |
19 | 'form-signup', 21 | 'enableAjaxValidation' => true, 22 | 'enableClientValidation' => false 23 | ]); ?> 24 | field($model, 'username') ?> 25 | field($model, 'email') ?> 26 | field($model, 'password')->passwordInput() ?> 27 |
28 | 'btn btn-primary', 'name' => 'signup-button']) ?> 29 |
30 | 31 |
32 | 35 |
36 |
37 |
38 | -------------------------------------------------------------------------------- /frontend/views/site/tags.php: -------------------------------------------------------------------------------- 1 | title = '标签云'; 7 | ?> 8 |
9 |
10 | title; ?> 11 |
12 |
13 | count / 3); 15 | echo Html::a($tag->name, ['/topic/default/index', 'tag' => $tag->name], ['class' => 'cloud-' . $i]); 16 | } ?> 17 |
18 |
-------------------------------------------------------------------------------- /frontend/views/site/timeline.php: -------------------------------------------------------------------------------- 1 | title = '时间线'; 7 | $content = ' 8 | **2015年5月1日** 9 | - 网站重新上线,全新改版只做社区! 10 | - 原来的版本命名为[V1](https://github.com/iiyii/getyii/tree/v1),可能不会再更新,没有通知系统。 11 | 12 | **2015年4月15日** 13 | - 解决几个BUG 14 | 15 | **2015年4月12日** 16 | - 更换 MarkDown 在线编辑器。 17 | - 添加统计功能 18 | 19 | **2015年3月2日** 20 | - 在 [yiichina](http://www.yiichina.com/topic/5685) 上发帖推广 21 | 22 | **2015年2月14日** 23 | - 吸引到第一位开发者-[kevin](http://www.getyii.com/member/kevin) 注册账号 24 | 25 | **2015年2月06日** 26 | - 上线测试 27 | 28 | '; 29 | ?> 30 |
31 |
32 | title ?> 33 |
34 |
35 | 36 |
37 |
-------------------------------------------------------------------------------- /frontend/views/site/users.php: -------------------------------------------------------------------------------- 1 | title = '活跃用户'; 5 | ?> 6 |
7 |
8 | TOP 100 活跃会员 9 |
目前已经有 位会员加入了 Get Yii
10 |
11 | 12 |
13 | render('/partials/users', ['model' => $model]); ?> 14 |
15 |
-------------------------------------------------------------------------------- /frontend/web/.gitignore: -------------------------------------------------------------------------------- 1 | /index.php 2 | /index-test.php 3 | -------------------------------------------------------------------------------- /frontend/web/.htaccess: -------------------------------------------------------------------------------- 1 | # use mod_rewrite for pretty URL support 2 | RewriteEngine on 3 | # If a directory or a file exists, use the request directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | # Otherwise forward the request to index.php 7 | RewriteRule . index.php 8 | 9 | # 七牛云存储的回调会传送HTTP_AUTHORIZATION认证秘钥,一定要放在最rewrite的后面.防止影响 10 | # PHP在CGI模式下的认证信息的获取 11 | # RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] -------------------------------------------------------------------------------- /frontend/web/assets/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /frontend/web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/frontend/web/favicon.ico -------------------------------------------------------------------------------- /frontend/web/images/ali-pay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/frontend/web/images/ali-pay.png -------------------------------------------------------------------------------- /frontend/web/images/hard_work.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/frontend/web/images/hard_work.gif -------------------------------------------------------------------------------- /frontend/web/images/wechat-pay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/frontend/web/images/wechat-pay.png -------------------------------------------------------------------------------- /frontend/web/js/At.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2016/3/10. 3 | */ 4 | var emojis = ["plus1", "ok_hand", "joy", "clap", "smile", "smirk", "sleepy", "smiley", "heart", "kiss", "copyright", "coffee"]; 5 | var emojisList = $.map(emojis, function (value, i) { 6 | return {'id': i, 'name': value}; 7 | }); 8 | $(".field-md-input textarea").atwho({ 9 | at: ':', 10 | displayTpl: "
  • ${name}
  • ", 11 | insertTpl: ":${name}:", 12 | data: emojisList 13 | }).atwho({ 14 | at: "@", 15 | data: "/at-users", 16 | //data: ["one", "two", "three"], 17 | limit: 6 18 | }); 19 | $("[data-at-topic]").atwho({ // 动弹话题 20 | at: "#", 21 | data: ['每日打卡', '干货分享', '心情', '小贴士'], 22 | limit: 6, 23 | suffix: '# ' 24 | }); 25 | $("[data-at-floor]").atwho({ // 楼层 26 | at: "#", 27 | data: Array.apply(null, Array(99)).map(function (_, i) { 28 | return (i + 1) + '楼'; 29 | }), 30 | limit: 6, 31 | suffix: ' ' 32 | }); -------------------------------------------------------------------------------- /frontend/web/js/editor.js: -------------------------------------------------------------------------------- 1 | // function insertString (merged, line) { 2 | // var editor = ace.edit("markdown"); 3 | // editor.$blockScrolling = Infinity; 4 | // var source = editor.getValue(); 5 | // var prefixBreak = source ? "\n" : ''; 6 | // var srcMerged = prefixBreak + merged; 7 | // editor.insert(srcMerged); 8 | // editor.gotoLine(editor.getCursorPosition().row + line); 9 | // } 10 | // 11 | // $('.insert-codes a').click(function (e) { 12 | // e.preventDefault(); 13 | // var language = $(this).data('lang'); 14 | // insertString("```" + language + "\n\n```\n", -1); 15 | // }); 16 | // // var $editor = $('#md-input').dropzone({ 17 | // // url: "https://sm.ms/api/upload", 18 | // // paramName: 'smfile', 19 | // // clickable: true, 20 | // // previewsContainer: '#dropzone-previewer', 21 | // // headers: { 'Cache-Control': null, 'X-Requested-With': null }, 22 | // // success: function(file, response){ 23 | // // if (response.code == 'success') { 24 | // // var img = response.data.url; 25 | // // insertString("![](" + img + ")\n", 1); 26 | // // } else { 27 | // // alert(response.msg); 28 | // // } 29 | // // } 30 | // // }); 31 | // 32 | // // $('#topic-upload-image').click(function(e){ 33 | // // $editor.click(); 34 | // // }) 35 | // 36 | -------------------------------------------------------------------------------- /frontend/web/js/nav.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by ruzuojun on 2015/6/26. 3 | */ 4 | 5 | // $(".pinned").pin({containerSelector: ".container", minWidth: 940}); 6 | // $(function () { 7 | // $('[data-toggle="tooltip"]').tooltip() 8 | // }) -------------------------------------------------------------------------------- /frontend/web/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: -------------------------------------------------------------------------------- /frontend/web/uploads/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /frontend/widgets/Nav.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/23 下午4:13 5 | * description: 6 | */ 7 | 8 | namespace frontend\widgets; 9 | 10 | use common\services\UserService; 11 | 12 | class Nav extends \yii\bootstrap\Widget 13 | { 14 | 15 | public function run() 16 | { 17 | $notifyCount = UserService::findNotifyCount(); 18 | 19 | return $this->render('nav', [ 20 | 'notifyCount' => $notifyCount, 21 | ]); 22 | } 23 | } -------------------------------------------------------------------------------- /frontend/widgets/NewestPost.php: -------------------------------------------------------------------------------- 1 | where(['status' => 1]) 21 | ->orderBy(['order' => SORT_ASC, 'created_at' => SORT_DESC]) 22 | ->limit(3)->all(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /frontend/widgets/Node.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/25 下午1:42 5 | * description: 6 | */ 7 | 8 | namespace frontend\widgets; 9 | 10 | use common\models\PostMeta; 11 | 12 | class Node extends \yii\bootstrap\Widget 13 | { 14 | public function run() 15 | { 16 | $nodes = PostMeta::getNodes(); 17 | 18 | return $this->render('node', [ 19 | 'nodes' => $nodes 20 | ]); 21 | } 22 | } -------------------------------------------------------------------------------- /frontend/widgets/Panel.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/18 下午4:13 5 | * description: 6 | */ 7 | 8 | namespace frontend\widgets; 9 | 10 | class Panel extends \yii\bootstrap\Widget 11 | { 12 | public $items = []; 13 | public $title = ''; 14 | 15 | public function run() 16 | { 17 | $model = [ 18 | 'items' => $this->items, 19 | 'title' => $this->title, 20 | ]; 21 | 22 | return $this->render('panel', [ 23 | 'model' => $model, 24 | ]); 25 | } 26 | } -------------------------------------------------------------------------------- /frontend/widgets/views/node.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/25 下午1:44 5 | * description: 6 | */ 7 | /** @var \common\models\PostMeta[] $nodes */ 8 | ?> 9 | 10 |
    11 |
    12 |

    节点导航

    13 |
    14 | 15 |
    16 |
    17 | $value): ?> 18 |
    name ?>
    19 |
    20 |
      21 | children as $node): ?> 22 |
    • name, ['/topic/default/index', 'node' => $node->alias]) ?>
    • 23 | 24 |
    25 |
    26 |
    27 | 28 |
    29 |
    30 |
    31 | 32 | -------------------------------------------------------------------------------- /frontend/widgets/views/panel.php: -------------------------------------------------------------------------------- 1 | 4 | * createTime : 15/4/18 下午4:16 5 | * description: 6 | */ 7 | use yii\helpers\Html; 8 | 9 | ?> 10 | 11 |
    12 |
    13 |

    14 |
    15 | 22 |
    23 | 24 | 25 | -------------------------------------------------------------------------------- /init.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem ------------------------------------------------------------- 4 | rem Yii command line init script for Windows. 5 | rem 6 | rem @author Qiang Xue 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 21 | -------------------------------------------------------------------------------- /tests/codeception.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - codeception/common 3 | - codeception/console 4 | - codeception/backend 5 | - codeception/frontend 6 | 7 | paths: 8 | log: codeception/_output 9 | 10 | settings: 11 | colors: true 12 | -------------------------------------------------------------------------------- /tests/codeception/_output/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/codeception/backend/.gitignore: -------------------------------------------------------------------------------- 1 | # these files are auto generated by codeception build 2 | /unit/UnitTester.php 3 | /functional/FunctionalTester.php 4 | /acceptance/AcceptanceTester.php 5 | -------------------------------------------------------------------------------- /tests/codeception/backend/_bootstrap.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure login page works'); 8 | 9 | $loginPage = LoginPage::openBy($I); 10 | 11 | $I->amGoingTo('submit login form with no data'); 12 | $loginPage->login('', ''); 13 | $I->expectTo('see validations errors'); 14 | $I->see('Username cannot be blank.', '.help-block'); 15 | $I->see('Password cannot be blank.', '.help-block'); 16 | 17 | $I->amGoingTo('try to login with wrong credentials'); 18 | $I->expectTo('see validations errors'); 19 | $loginPage->login('admin', 'wrong'); 20 | $I->expectTo('see validations errors'); 21 | $I->see('Incorrect username or password.', '.help-block'); 22 | 23 | $I->amGoingTo('try to login with correct credentials'); 24 | $loginPage->login('erau', 'password_0'); 25 | $I->expectTo('see that user is logged'); 26 | $I->seeLink('Logout (erau)'); 27 | $I->dontSeeLink('Login'); 28 | $I->dontSeeLink('Signup'); 29 | /** Uncomment if using WebDriver 30 | * $I->click('Logout (erau)'); 31 | * $I->dontSeeLink('Logout (erau)'); 32 | * $I->seeLink('Login'); 33 | */ 34 | -------------------------------------------------------------------------------- /tests/codeception/backend/acceptance/_bootstrap.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure login page works'); 8 | 9 | $loginPage = LoginPage::openBy($I); 10 | 11 | $I->amGoingTo('submit login form with no data'); 12 | $loginPage->login('', ''); 13 | $I->expectTo('see validations errors'); 14 | $I->see('Username cannot be blank.', '.help-block'); 15 | $I->see('Password cannot be blank.', '.help-block'); 16 | 17 | $I->amGoingTo('try to login with wrong credentials'); 18 | $I->expectTo('see validations errors'); 19 | $loginPage->login('admin', 'wrong'); 20 | $I->expectTo('see validations errors'); 21 | $I->see('Incorrect username or password.', '.help-block'); 22 | 23 | $I->amGoingTo('try to login with correct credentials'); 24 | $loginPage->login('erau', 'password_0'); 25 | $I->expectTo('see that user is logged'); 26 | $I->seeLink('Logout (erau)'); 27 | $I->dontSeeLink('Login'); 28 | $I->dontSeeLink('Signup'); 29 | -------------------------------------------------------------------------------- /tests/codeception/backend/functional/_bootstrap.php: -------------------------------------------------------------------------------- 1 | [ 21 | 'fixture' => [ 22 | 'class' => 'yii\faker\FixtureController', 23 | 'fixtureDataPath' => '@tests/codeception/common/fixtures/data', 24 | 'templatePath' => '@tests/codeception/common/templates/fixtures', 25 | ], 26 | ], 27 | ] 28 | ); 29 | 30 | $application = new yii\console\Application($config); 31 | $exitCode = $application->run(); 32 | exit($exitCode); 33 | -------------------------------------------------------------------------------- /tests/codeception/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 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%yii_acceptance" %* 19 | 20 | @endlocal 21 | -------------------------------------------------------------------------------- /tests/codeception/common/.gitignore: -------------------------------------------------------------------------------- 1 | # these files are auto generated by codeception build 2 | /unit/UnitTester.php 3 | /functional/FunctionalTester.php 4 | /acceptance/AcceptanceTester.php 5 | -------------------------------------------------------------------------------- /tests/codeception/common/_bootstrap.php: -------------------------------------------------------------------------------- 1 | actor->fillField('input[name="LoginForm[username]"]', $username); 22 | $this->actor->fillField('input[name="LoginForm[password]"]', $password); 23 | $this->actor->click('login-button'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/codeception/common/codeception.yml: -------------------------------------------------------------------------------- 1 | namespace: tests\codeception\common 2 | actor: Tester 3 | paths: 4 | tests: . 5 | log: _output 6 | data: _data 7 | helpers: _support 8 | settings: 9 | bootstrap: _bootstrap.php 10 | suite_class: \PHPUnit_Framework_TestSuite 11 | colors: true 12 | memory_limit: 1024M 13 | log: true 14 | -------------------------------------------------------------------------------- /tests/codeception/common/fixtures/UserFixture.php: -------------------------------------------------------------------------------- 1 | 'erau', 6 | 'auth_key' => 'tUu1qHcde0diwUol3xeI-18MuHkkprQI', 7 | // password_0 8 | 'password_hash' => '$2y$13$nJ1WDlBaGcbCdbNC5.5l4.sgy.OMEKCqtDQOdQ2OWpgiKRWYyzzne', 9 | 'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490', 10 | 'created_at' => '1392559490', 11 | 'updated_at' => '1392559490', 12 | 'email' => 'sfriesen@jenkins.info', 13 | ], 14 | ]; 15 | -------------------------------------------------------------------------------- /tests/codeception/common/templates/fixtures/user.php: -------------------------------------------------------------------------------- 1 | getSecurity(); 8 | 9 | return [ 10 | 'username' => $faker->userName, 11 | 'email' => $faker->email, 12 | 'auth_key' => $security->generateRandomString(), 13 | 'password_hash' => $security->generatePasswordHash('password_' . $index), 14 | 'password_reset_token' => $security->generateRandomString() . '_' . time(), 15 | 'created_at' => time(), 16 | 'updated_at' => time(), 17 | ]; 18 | -------------------------------------------------------------------------------- /tests/codeception/common/unit.suite.yml: -------------------------------------------------------------------------------- 1 | # Codeception Test Suite Configuration 2 | 3 | # suite for unit (internal) tests. 4 | # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. 5 | 6 | class_name: UnitTester 7 | -------------------------------------------------------------------------------- /tests/codeception/common/unit/DbTestCase.php: -------------------------------------------------------------------------------- 1 | 'bayer.hudson', 6 | 'auth_key' => 'HP187Mvq7Mmm3CTU80dLkGmni_FUH_lR', 7 | //password_0 8 | 'password_hash' => '$2y$13$EjaPFBnZOQsHdGuHI.xvhuDp1fHpo8hKRSk6yshqa9c5EG8s3C3lO', 9 | 'password_reset_token' => 'ExzkCOaYc1L8IOBs4wdTGGbgNiG3Wz1I_1402312317', 10 | 'created_at' => '1402312317', 11 | 'updated_at' => '1402312317', 12 | 'email' => 'nicole.paucek@schultz.info', 13 | ], 14 | ]; 15 | -------------------------------------------------------------------------------- /tests/codeception/config/acceptance.php: -------------------------------------------------------------------------------- 1 | 'app-common', 12 | 'basePath' => dirname(__DIR__), 13 | ] 14 | ); 15 | -------------------------------------------------------------------------------- /tests/codeception/config/config.php: -------------------------------------------------------------------------------- 1 | [ 13 | 'db' => [ 14 | 'class' => 'yii\db\Connection', 15 | 'dsn' => 'mysql:host='.$MYSQL_PORT_3306_TCP_ADDR.';dbname='.$MYSQL_TESTS_DB_NAME, 16 | 'username' => $MYSQL_USERNAME, 17 | 'password' => $MYSQL_PASSWORD, 18 | 'charset' => 'utf8mb4', 19 | ], 20 | 'mailer' => [ 21 | 'useFileTransport' => true, 22 | ], 23 | 'urlManager' => [ 24 | 'showScriptName' => true, 25 | ], 26 | ], 27 | ]; 28 | -------------------------------------------------------------------------------- /tests/codeception/config/console/unit.php: -------------------------------------------------------------------------------- 1 | $value) { 21 | $inputType = $field === 'body' ? 'textarea' : 'input'; 22 | $this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); 23 | } 24 | $this->actor->click('contact-button'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/codeception/frontend/_pages/SignupPage.php: -------------------------------------------------------------------------------- 1 | $value) { 22 | $inputType = $field === 'body' ? 'textarea' : 'input'; 23 | $this->actor->fillField($inputType . '[name="SignupForm[' . $field . ']"]', $value); 24 | } 25 | $this->actor->click('signup-button'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/codeception/frontend/acceptance.suite.yml: -------------------------------------------------------------------------------- 1 | # Codeception Test Suite Configuration 2 | 3 | # suite for acceptance tests. 4 | # perform tests in browser using the Selenium-like tools. 5 | # powered by Mink (http://mink.behat.org). 6 | # (tip: that's what your customer will see). 7 | # (tip: test your ajax and javascript by one of Mink drivers). 8 | 9 | # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. 10 | 11 | class_name: AcceptanceTester 12 | modules: 13 | enabled: 14 | - PhpBrowser 15 | - tests\codeception\common\_support\FixtureHelper 16 | # you can use WebDriver instead of PhpBrowser to test javascript and ajax. 17 | # This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium 18 | # "restart" option is used by the WebDriver to start each time per test-file new session and cookies, 19 | # it is useful if you want to login in your app in each test. 20 | # - WebDriver 21 | config: 22 | PhpBrowser: 23 | url: 'http://localhost:8080' 24 | # WebDriver: 25 | # url: 'http://localhost' 26 | # browser: firefox 27 | # restart: true 28 | -------------------------------------------------------------------------------- /tests/codeception/frontend/acceptance/AboutCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that about works'); 7 | AboutPage::openBy($I); 8 | $I->see('About', 'h1'); 9 | -------------------------------------------------------------------------------- /tests/codeception/frontend/acceptance/HomeCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that home page works'); 6 | $I->amOnPage(Yii::$app->homeUrl); 7 | $I->see('My Company'); 8 | $I->seeLink('About'); 9 | $I->click('About'); 10 | $I->see('This is the About page.'); 11 | -------------------------------------------------------------------------------- /tests/codeception/frontend/acceptance/LoginCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure login page works'); 7 | 8 | $loginPage = LoginPage::openBy($I); 9 | 10 | $I->amGoingTo('submit login form with no data'); 11 | $loginPage->login('', ''); 12 | $I->expectTo('see validations errors'); 13 | $I->see('Username cannot be blank.', '.help-block'); 14 | $I->see('Password cannot be blank.', '.help-block'); 15 | 16 | $I->amGoingTo('try to login with wrong credentials'); 17 | $I->expectTo('see validations errors'); 18 | $loginPage->login('admin', 'wrong'); 19 | $I->expectTo('see validations errors'); 20 | $I->see('Incorrect username or password.', '.help-block'); 21 | 22 | $I->amGoingTo('try to login with correct credentials'); 23 | $loginPage->login('erau', 'password_0'); 24 | $I->expectTo('see that user is logged'); 25 | $I->seeLink('Logout (erau)'); 26 | $I->dontSeeLink('Login'); 27 | $I->dontSeeLink('Signup'); 28 | /** Uncomment if using WebDriver 29 | * $I->click('Logout (erau)'); 30 | * $I->dontSeeLink('Logout (erau)'); 31 | * $I->seeLink('Login'); 32 | */ 33 | -------------------------------------------------------------------------------- /tests/codeception/frontend/acceptance/_bootstrap.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that about works'); 7 | AboutPage::openBy($I); 8 | $I->see('About', 'h1'); 9 | -------------------------------------------------------------------------------- /tests/codeception/frontend/functional/HomeCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that home page works'); 5 | $I->amOnPage(Yii::$app->homeUrl); 6 | $I->see('My Company'); 7 | $I->seeLink('About'); 8 | $I->click('About'); 9 | $I->see('This is the About page.'); 10 | -------------------------------------------------------------------------------- /tests/codeception/frontend/functional/LoginCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure login page works'); 7 | 8 | $loginPage = LoginPage::openBy($I); 9 | 10 | $I->amGoingTo('submit login form with no data'); 11 | $loginPage->login('', ''); 12 | $I->expectTo('see validations errors'); 13 | $I->see('Username cannot be blank.', '.help-block'); 14 | $I->see('Password cannot be blank.', '.help-block'); 15 | 16 | $I->amGoingTo('try to login with wrong credentials'); 17 | $I->expectTo('see validations errors'); 18 | $loginPage->login('admin', 'wrong'); 19 | $I->expectTo('see validations errors'); 20 | $I->see('Incorrect username or password.', '.help-block'); 21 | 22 | $I->amGoingTo('try to login with correct credentials'); 23 | $loginPage->login('erau', 'password_0'); 24 | $I->expectTo('see that user is logged'); 25 | $I->seeLink('Logout (erau)'); 26 | $I->dontSeeLink('Login'); 27 | $I->dontSeeLink('Signup'); 28 | -------------------------------------------------------------------------------- /tests/codeception/frontend/functional/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 'okirlin', 6 | 'auth_key' => 'iwTNae9t34OmnK6l4vT4IeaTk-YWI2Rv', 7 | 'password_hash' => '$2y$13$CXT0Rkle1EMJ/c1l5bylL.EylfmQ39O5JlHJVFpNn618OUS1HwaIi', 8 | 'password_reset_token' => 't5GU9NwpuGYSfb7FEZMAxqtuz2PkEvv_' . time(), 9 | 'created_at' => '1391885313', 10 | 'updated_at' => '1391885313', 11 | 'email' => 'brady.renner@rutherford.com', 12 | ], 13 | [ 14 | 'username' => 'troy.becker', 15 | 'auth_key' => 'EdKfXrx88weFMV0vIxuTMWKgfK2tS3Lp', 16 | 'password_hash' => '$2y$13$g5nv41Px7VBqhS3hVsVN2.MKfgT3jFdkXEsMC4rQJLfaMa7VaJqL2', 17 | 'password_reset_token' => '4BSNyiZNAuxjs5Mty990c47sVrgllIi_' . time(), 18 | 'created_at' => '1391885313', 19 | 'updated_at' => '1391885313', 20 | 'email' => 'nicolas.dianna@hotmail.com', 21 | 'status' => '0', 22 | ], 23 | ]; 24 | -------------------------------------------------------------------------------- /tests/codeception/frontend/unit/models/ResetPasswordFormTest.php: -------------------------------------------------------------------------------- 1 | user[0]['password_reset_token']); 31 | expect('password should be resetted', $form->resetPassword())->true(); 32 | } 33 | 34 | public function fixtures() 35 | { 36 | return [ 37 | 'user' => [ 38 | 'class' => UserFixture::className(), 39 | 'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php' 40 | ], 41 | ]; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /wechat-pay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiYii/getyii/f6c3f7f241cd852d9b756aeee5e2091a071f640d/wechat-pay.png -------------------------------------------------------------------------------- /yii.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem ------------------------------------------------------------- 4 | rem Yii command line bootstrap script for Windows. 5 | rem 6 | rem @author Qiang Xue 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%yii" %* 19 | 20 | @endlocal 21 | --------------------------------------------------------------------------------