-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3,400 changed files
with
527,552 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory" : "vendor/bower" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# phpstorm project files | ||
.idea | ||
|
||
# netbeans project files | ||
nbproject | ||
|
||
# zend studio for eclipse project files | ||
.buildpath | ||
.project | ||
.settings | ||
|
||
# windows thumbnail cache | ||
Thumbs.db | ||
|
||
# composer vendor dir | ||
|
||
|
||
# composer itself is not needed | ||
composer.phar | ||
|
||
# Mac DS_Store Files | ||
.DS_Store | ||
|
||
# phpunit itself is not needed | ||
phpunit.phar | ||
# local phpunit config | ||
/phpunit.xml | ||
|
||
/runtime | ||
/backend/runtime | ||
/frontend/runtime | ||
/static/assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
// NOTE: Make sure this file is not accessible when deployed to production | ||
if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) { | ||
die('You are not allowed to access this file.'); | ||
} | ||
|
||
defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
defined('YII_ENV') or define('YII_ENV', 'test'); | ||
|
||
require(__DIR__ . '/../vendor/autoload.php'); | ||
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); | ||
|
||
$config = require(__DIR__ . '/../tests/codeception/config/acceptance.php'); | ||
|
||
(new yii\web\Application($config))->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
use source\core\back\BaseBackApplication; | ||
use source\LuLu; | ||
|
||
|
||
// comment out the following two lines when deployed to production | ||
defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
defined('YII_ENV') or define('YII_ENV', 'dev'); | ||
|
||
require (__DIR__ . '/vendor/autoload.php'); | ||
require (__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); | ||
|
||
require (__DIR__ . '/source/config/bootstrap.php'); | ||
require (__DIR__ . '/backend/config/bootstrap.php'); | ||
|
||
|
||
$config = yii\helpers\ArrayHelper::merge( | ||
require(__DIR__ . '/source/config/main.php'), | ||
require(__DIR__ . '/source/config/main-local.php'), | ||
require(__DIR__ . '/backend/config/main.php'), | ||
require(__DIR__ . '/backend/config/main-local.php') | ||
); | ||
|
||
$app = new BaseBackApplication($config); | ||
$app->run(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
$config = [ | ||
'components' => [ | ||
'request' => [ | ||
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation | ||
'cookieValidationKey' => '41SCN-vryMrrUOuOzXXcGo0GP4zBgMhr', | ||
], | ||
], | ||
]; | ||
|
||
if (!YII_ENV_TEST) { | ||
// configuration adjustments for 'dev' environment | ||
$config['bootstrap'][] = 'debug'; | ||
$config['modules']['debug'] = 'yii\debug\Module'; | ||
|
||
$config['bootstrap'][] = 'gii'; | ||
$config['modules']['gii'] = 'yii\gii\Module'; | ||
} | ||
|
||
return $config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
$params = array_merge( | ||
require(__DIR__ . '/../../source/config/params.php'), | ||
require(__DIR__ . '/../../source/config/params-local.php'), | ||
require(__DIR__ . '/params.php'), | ||
require(__DIR__ . '/params-local.php') | ||
); | ||
|
||
return [ | ||
'id' => 'app-backend', | ||
'language' => 'zh-CN', | ||
'basePath' => dirname(__DIR__), | ||
'controllerNamespace' => 'backend\controllers', | ||
'bootstrap' => ['log'], | ||
'modules' => [], | ||
'components' => [ | ||
'user' => [ | ||
'identityClass' => 'source\models\User', | ||
'enableAutoLogin' => true, | ||
'loginUrl' => ['admin/login'], | ||
], | ||
'log' => [ | ||
'traceLevel' => YII_DEBUG ? 3 : 0, | ||
'targets' => [ | ||
[ | ||
'class' => 'yii\log\FileTarget', | ||
'levels' => ['error', 'warning'], | ||
], | ||
], | ||
], | ||
'errorHandler' => [ | ||
'errorAction' => 'admin/error', | ||
], | ||
'view' => [ | ||
'class' => 'source\core\back\BaseBackView', | ||
], | ||
|
||
|
||
], | ||
'modules' => [ | ||
// 'comment' => [ | ||
// 'class' => 'source\modules\comment\AdminModule', | ||
// ], | ||
// 'post' => [ | ||
// 'class' => 'source\modules\post\AdminModule', | ||
// ], | ||
// 'page' => [ | ||
// 'class' => 'source\modules\page\AdminModule', | ||
// ], | ||
// 'takonomy' => [ | ||
// 'class' => 'source\modules\takonomy\AdminModule', | ||
// ], | ||
'menu' => [ | ||
'class' => 'source\modules\menu\AdminModule', | ||
], | ||
'system' => [ | ||
'class' => 'source\modules\system\AdminModule', | ||
], | ||
'modularity' => [ | ||
'class' => 'source\modules\modularity\AdminModule', | ||
], | ||
], | ||
'params' => $params, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
return [ | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
return [ | ||
'adminEmail' => 'admin@example.com', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?php | ||
namespace backend\controllers; | ||
|
||
use Yii; | ||
use source\models\Content; | ||
use source\models\search\ContentSearch; | ||
use source\core\back\BaseBackController; | ||
use yii\web\NotFoundHttpException; | ||
use yii\filters\VerbFilter; | ||
use source\libs\Common; | ||
use source\helpers\StringHelper; | ||
|
||
abstract class BaseContentController extends BaseBackController | ||
{ | ||
|
||
protected $content_type; | ||
|
||
protected $bodyModel; | ||
|
||
public function actionIndex() | ||
{ | ||
$searchModel = new ContentSearch(); | ||
$dataProvider = $searchModel->search([]); | ||
$dataProvider->query->andWhere([ | ||
'content_type' => $this->content_type | ||
]); | ||
$dataProvider->query->orderBy('created_at desc'); | ||
|
||
return $this->render('index', [ | ||
'searchModel' => $searchModel, | ||
'dataProvider' => $dataProvider | ||
]); | ||
} | ||
|
||
public function saveContent($model, $bodyModel) | ||
{ | ||
$postDatas = Yii::$app->request->post(); | ||
|
||
if ($model->load($postDatas) && $bodyModel->load($postDatas) && $model->validate() && $bodyModel->validate()) | ||
{ | ||
if ($model->summary === null || $model->summary === '') | ||
{ | ||
if ($bodyModel->hasAttribute('body')) | ||
{ | ||
$content = strip_tags($bodyModel->body); | ||
$pattern = '/\s/'; // 去除空白 | ||
$content = preg_replace($pattern, '', $content); | ||
$model->summary = StringHelper::subStr($content, 250); | ||
} | ||
} | ||
if ($model->save()) | ||
{ | ||
$bodyModel->content_id = $model->id; | ||
$bodyModel->save(); | ||
|
||
return $this->redirect([ | ||
'index' | ||
]); | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public function actionCreate() | ||
{ | ||
$model = new Content(); | ||
$model->user_id = 1; | ||
$model->content_type = $this->content_type; | ||
$model->loadDefaultValues(); | ||
|
||
$bodyModel = $this->findBodyModel(); | ||
$bodyModel->loadDefaultValues(); | ||
|
||
if (($r = $this->saveContent($model, $bodyModel)) !== false) | ||
{ | ||
return $r; | ||
} | ||
|
||
return $this->render('create', [ | ||
'model' => $model, | ||
'bodyModel' => $bodyModel | ||
]); | ||
} | ||
|
||
public function actionUpdate($id) | ||
{ | ||
$model = $this->findModel($id); | ||
$bodyModel = $this->findBodyModel($id); | ||
|
||
if (($r = $this->saveContent($model, $bodyModel)) !== false) | ||
{ | ||
return $r; | ||
} | ||
return $this->render('update', [ | ||
'model' => $model, | ||
'bodyModel' => $bodyModel | ||
]); | ||
} | ||
|
||
public function actionDelete($id) | ||
{ | ||
$this->findModel($id)->delete(); | ||
|
||
$this->deleteBodyModel($id); | ||
|
||
return $this->redirect([ | ||
'index' | ||
]); | ||
} | ||
|
||
protected function findModel($id) | ||
{ | ||
if (($model = Content::findOne($id)) !== null) | ||
{ | ||
return $model; | ||
} | ||
else | ||
{ | ||
throw new NotFoundHttpException('The requested page does not exist.'); | ||
} | ||
} | ||
|
||
public function findBodyModel($contentId = null) | ||
{ | ||
} | ||
|
||
public function deleteBodyModel($contentId) | ||
{ | ||
$bodyModel = $this->findBodyModel($contentId); | ||
if ($bodyModel != null) | ||
{ | ||
$bodyModel->delete(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
namespace backend\controllers; | ||
|
||
use Yii; | ||
use source\models\Config; | ||
use source\models\search\ConfigSearch; | ||
use source\core\back\BaseBackController; | ||
use yii\base\InvalidParamException; | ||
use source\models\ConfigForm; | ||
|
||
abstract class BaseSettingController extends BaseBackController | ||
{ | ||
|
||
public function doConfig($model, $view = null) | ||
{ | ||
if (! ($model instanceof ConfigForm)) | ||
{ | ||
throw new InvalidParamException('model must be instance of ConfigForm'); | ||
} | ||
|
||
if (Yii::$app->request->isPost && $model->load(Yii::$app->request->post()) && $model->saveAll()) | ||
{ | ||
return $this->refresh(); | ||
} | ||
else | ||
{ | ||
if ($view === null) | ||
{ | ||
$view = $this->action->id; | ||
} | ||
|
||
$model->initAll(); | ||
return $this->render($view, [ | ||
'model' => $model | ||
]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
namespace backend\controllers; | ||
|
||
use yii\web\Controller; | ||
|
||
class SiteController extends Controller | ||
{ | ||
|
||
public function actionIndex() | ||
{ | ||
$this->layout = 'container'; | ||
return $this->render('index'); | ||
} | ||
|
||
public function actionWelcome() | ||
{ | ||
return $this->render('welcome'); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.