Changed {{core.ignorecase}} to false
// git config --unset-all core.ignorecase false
This commit is contained in:
59
www/protected/controllers/ApiController.php
Normal file
59
www/protected/controllers/ApiController.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
class APIController extends MSController
|
||||
{
|
||||
public $layout = false;
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the access control rules.
|
||||
* This method is used by the 'accessControl' filter.
|
||||
* @return array access control rules
|
||||
*/
|
||||
public function accessRules()
|
||||
{
|
||||
return array(
|
||||
array('allow',
|
||||
'users'=>array('*'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function actionUpdate()
|
||||
{
|
||||
if (! isset($_GET['Name'])) {
|
||||
throw new CHttpException(404,'Invalid Request - [Name] missing');
|
||||
return;
|
||||
}
|
||||
|
||||
$Name = $_GET['Name'];
|
||||
|
||||
$this->actionUpdate2($Name);
|
||||
}
|
||||
|
||||
public function actionUpdate2($Name)
|
||||
{
|
||||
$data = ProgramUpdates::model()->findByAttributes(['Name' => $Name]);
|
||||
|
||||
if (! isset($_GET['Name'])) {
|
||||
throw new CHttpException(404,'Invalid Request - [Name] not found');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->render('update', ['data' => $data]);
|
||||
}
|
||||
|
||||
public function actionTest()
|
||||
{
|
||||
$this->render('test', []);
|
||||
}
|
||||
}
|
||||
197
www/protected/controllers/BlogpostController.php
Normal file
197
www/protected/controllers/BlogpostController.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
class BlogPostController extends MSController
|
||||
{
|
||||
public $menu=array();
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the access control rules.
|
||||
* This method is used by the 'accessControl' filter.
|
||||
* @return array access control rules
|
||||
*/
|
||||
public function accessRules()
|
||||
{
|
||||
return array(
|
||||
array('allow', // allow all users to perform 'index' and 'view' actions
|
||||
'actions'=>array('index','view', 'ajaxMarkdownPreview'),
|
||||
'users'=>array('*'),
|
||||
),
|
||||
array('allow', // allow authenticated user to perform 'create' and 'update' actions
|
||||
'actions'=>array('create','update','admin','delete'),
|
||||
'users'=>array('@'),
|
||||
),
|
||||
// array('allow', // allow admin user to perform 'admin' and 'delete' actions
|
||||
// 'actions'=>array(),
|
||||
// 'users'=>array('admin'),
|
||||
// ),
|
||||
array('deny', // deny everythign else to all users
|
||||
'users'=>array('*'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a particular model.
|
||||
* @param integer $id the ID of the model to be displayed
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
$this->render('view',array(
|
||||
'model'=>$this->loadModel($id),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$this->layout = '//layouts/column2';
|
||||
|
||||
$model=new BlogPost;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['BlogPost'])) {
|
||||
$model->attributes=$_POST['BlogPost'];
|
||||
if ($model->save()) {
|
||||
$this->redirect(array('view','id'=>$model->ID));
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('create',array(
|
||||
'model'=>$model,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a particular model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id the ID of the model to be updated
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$this->layout = '//layouts/column2';
|
||||
|
||||
$model=$this->loadModel($id);
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['BlogPost'])) {
|
||||
$model->attributes=$_POST['BlogPost'];
|
||||
if ($model->save()) {
|
||||
$this->redirect(array('view','id'=>$model->ID));
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('update',array(
|
||||
'model'=>$model,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a particular model.
|
||||
* If deletion is successful, the browser will be redirected to the 'admin' page.
|
||||
* @param integer $id the ID of the model to be deleted
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->layout = '//layouts/column2';
|
||||
|
||||
$this->loadModel($id)->delete();
|
||||
|
||||
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
|
||||
if (!isset($_GET['ajax'])) {
|
||||
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$criteria = new CDbCriteria;
|
||||
$criteria->order = "Date DESC";
|
||||
|
||||
$all = BlogPost::model()->findAll($criteria);
|
||||
|
||||
$this->render('index',
|
||||
[
|
||||
'blogposts' => $all,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function actionAjaxMarkdownPreview() {
|
||||
if(Yii::app()->request->isAjaxRequest){
|
||||
$this->renderPartial('_ajaxMarkdownPreview',
|
||||
[
|
||||
'Content' => $_POST['Content'],
|
||||
],
|
||||
false, true);
|
||||
} else {
|
||||
throw new CHttpException(400,'Invalid request. This is a Ajax only action.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$this->layout = '//layouts/column2';
|
||||
|
||||
$model=new BlogPost('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['BlogPost'])) {
|
||||
$model->attributes=$_GET['BlogPost'];
|
||||
}
|
||||
|
||||
$this->render('admin',array(
|
||||
'model'=>$model,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data model based on the primary key given in the GET variable.
|
||||
* If the data model is not found, an HTTP exception will be raised.
|
||||
* @param integer $id the ID of the model to be loaded
|
||||
* @return BlogPost the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model=BlogPost::model()->findByPk($id);
|
||||
if ($model===null) {
|
||||
throw new CHttpException(404,'The requested page does not exist.');
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param BlogPost $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax']==='blog-post-form') {
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,5 @@ class MSMainController extends MSController
|
||||
$this->redirect(Yii::app()->homeUrl);
|
||||
}
|
||||
|
||||
public function actionLog($logid) {
|
||||
|
||||
}
|
||||
public function action
|
||||
}
|
||||
153
www/protected/controllers/MsmainController.php
Normal file
153
www/protected/controllers/MsmainController.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
class MSMainController extends MSController
|
||||
{
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the access control rules.
|
||||
* This method is used by the 'accessControl' filter.
|
||||
* @return array access control rules
|
||||
*/
|
||||
public function accessRules()
|
||||
{
|
||||
return array(
|
||||
array('allow',
|
||||
'actions'=>array('index', 'about', 'debugerror', 'error', 'login', 'logout'),
|
||||
'users'=>array('*'),
|
||||
),
|
||||
array('allow',
|
||||
'actions'=>array('admin'),
|
||||
'users'=>array('admin'),
|
||||
),
|
||||
array('deny',
|
||||
'users'=>array('*'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$criteria = new CDbCriteria;
|
||||
$criteria->order = "date DESC";
|
||||
|
||||
$all_log = Log::model()->findAll($criteria);
|
||||
/* @var $all_log Log[] */
|
||||
|
||||
$data = array();
|
||||
$data['program'] = ProgramHelper::GetDailyProg();
|
||||
$data['logs'] = $all_log;
|
||||
|
||||
$this->render('index', $data);
|
||||
}
|
||||
|
||||
public function actionError()
|
||||
{
|
||||
if($error=Yii::app()->errorHandler->error)
|
||||
{
|
||||
if(Yii::app()->request->isAjaxRequest)
|
||||
echo $error['message'];
|
||||
else
|
||||
$this->render('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionDebugError()
|
||||
{
|
||||
if($error=Yii::app()->errorHandler->error)
|
||||
{
|
||||
if(Yii::app()->request->isAjaxRequest)
|
||||
echo $error['message'];
|
||||
else
|
||||
$this->render('debugerror', $error);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionAbout()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->js_scripts[] = file_get_contents('protected/components/extendedGitGraph/script.js');
|
||||
|
||||
if(isset($_POST['SendMailForm']))
|
||||
{
|
||||
$model = new SendMailForm();
|
||||
|
||||
$model->attributes=$_POST['SendMailForm'];
|
||||
|
||||
if($model->validate()) {
|
||||
if ($model->send())
|
||||
{
|
||||
$data['alerts_success'][] = "Successfully send mail from " . $model->name;
|
||||
$data['model'] = new SendMailForm();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['alerts_error'][] = "Internal error while sending mail";
|
||||
$data['model'] = $model;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['model'] = $model;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['model'] = new SendMailForm();
|
||||
}
|
||||
|
||||
$this->render('about', $data);
|
||||
}
|
||||
|
||||
public function actionLogin()
|
||||
{
|
||||
$model = new LoginForm();
|
||||
|
||||
// if it is ajax validation request
|
||||
if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
|
||||
{
|
||||
echo TbActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
// collect user input data
|
||||
if(isset($_POST['LoginForm']))
|
||||
{
|
||||
$model->attributes=$_POST['LoginForm'];
|
||||
// validate user input and redirect to the previous page if valid
|
||||
if($model->validate() && $model->login())
|
||||
$this->redirect(Yii::app()->user->returnUrl);
|
||||
}
|
||||
// display the login form
|
||||
$this->render('login', array('model'=>$model));
|
||||
}
|
||||
|
||||
public function actionAdmin()
|
||||
{
|
||||
if (isset($_GET['do_egh_update']) && $_GET['do_egh_update'] == '1') {
|
||||
$this->layout = null;
|
||||
$this->render('admin_updateEGH', array());
|
||||
return;
|
||||
}
|
||||
|
||||
$this->render('admin', array());
|
||||
}
|
||||
|
||||
public function actionLogout()
|
||||
{
|
||||
Yii::app()->user->logout();
|
||||
$this->redirect(Yii::app()->homeUrl);
|
||||
}
|
||||
|
||||
public function action
|
||||
}
|
||||
127
www/protected/controllers/ProgramupdatesController.php
Normal file
127
www/protected/controllers/ProgramupdatesController.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
class ProgramUpdatesController extends MSController
|
||||
{
|
||||
public $menu=array();
|
||||
|
||||
public $layout='//layouts/column2';
|
||||
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
public function accessRules()
|
||||
{
|
||||
return array(
|
||||
array('allow', // allow admin user to perform 'admin' and 'delete' actions
|
||||
'actions'=>array('index','view','create','update','admin','delete'),
|
||||
'users'=>array('admin'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'users'=>array('*'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function actionView($id)
|
||||
{
|
||||
$this->render('view',array(
|
||||
'model'=>$this->loadModel($id),
|
||||
));
|
||||
}
|
||||
|
||||
public function actionCreate()
|
||||
{
|
||||
$model=new ProgramUpdates;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['ProgramUpdates'])) {
|
||||
$model->attributes=$_POST['ProgramUpdates'];
|
||||
if ($model->save()) {
|
||||
$this->redirect(array('view','id'=>$model->Name));
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('create',array(
|
||||
'model'=>$model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model=$this->loadModel($id);
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['ProgramUpdates'])) {
|
||||
$model->attributes=$_POST['ProgramUpdates'];
|
||||
if ($model->save()) {
|
||||
$this->redirect(array('view','id'=>$model->Name));
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('update',array(
|
||||
'model'=>$model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
if (Yii::app()->request->isPostRequest) {
|
||||
// we only allow deletion via POST request
|
||||
$this->loadModel($id)->delete();
|
||||
|
||||
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
|
||||
if (!isset($_GET['ajax'])) {
|
||||
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
|
||||
}
|
||||
} else {
|
||||
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
|
||||
}
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider=new CActiveDataProvider('ProgramUpdates');
|
||||
$this->render('index',array(
|
||||
'dataProvider'=>$dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model=new ProgramUpdates('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['ProgramUpdates'])) {
|
||||
$model->attributes=$_GET['ProgramUpdates'];
|
||||
}
|
||||
|
||||
$this->render('admin',array(
|
||||
'model'=>$model,
|
||||
));
|
||||
}
|
||||
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model=ProgramUpdates::model()->findByPk($id);
|
||||
if ($model===null) {
|
||||
throw new CHttpException(404,'The requested page does not exist.');
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax']==='program-updates-form') {
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user