-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Base appserver and appclient yii apps setup
- Loading branch information
Showing
85 changed files
with
3,901 additions
and
0 deletions.
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,6 @@ | ||
{ | ||
"require": { | ||
"yiisoft/yii": "1.1.*", | ||
"guzzle/guzzle": "~3.7" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
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 @@ | ||
deny from all |
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,23 @@ | ||
<?php | ||
/** | ||
* Controller is the customized base controller class. | ||
* All controller classes for this application should extend from this base class. | ||
*/ | ||
class Controller extends CController | ||
{ | ||
/** | ||
* @var string the default layout for the controller view. Defaults to '//layouts/column1', | ||
* meaning using a single column layout. See 'protected/views/layouts/column1.php'. | ||
*/ | ||
public $layout='//layouts/column1'; | ||
/** | ||
* @var array context menu items. This property will be assigned to {@link CMenu::items}. | ||
*/ | ||
public $menu=array(); | ||
/** | ||
* @var array the breadcrumbs of the current page. The value of this property will | ||
* be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links} | ||
* for more details on how to specify this property. | ||
*/ | ||
public $breadcrumbs=array(); | ||
} |
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,33 @@ | ||
<?php | ||
|
||
/** | ||
* UserIdentity represents the data needed to identity a user. | ||
* It contains the authentication method that checks if the provided | ||
* data can identity the user. | ||
*/ | ||
class UserIdentity extends CUserIdentity | ||
{ | ||
/** | ||
* Authenticates a user. | ||
* The example implementation makes sure if the username and password | ||
* are both 'demo'. | ||
* In practical applications, this should be changed to authenticate | ||
* against some persistent user identity storage (e.g. database). | ||
* @return boolean whether authentication succeeds. | ||
*/ | ||
public function authenticate() | ||
{ | ||
$users=array( | ||
// username => password | ||
'demo'=>'demo', | ||
'admin'=>'admin', | ||
); | ||
if(!isset($users[$this->username])) | ||
$this->errorCode=self::ERROR_USERNAME_INVALID; | ||
elseif($users[$this->username]!==$this->password) | ||
$this->errorCode=self::ERROR_PASSWORD_INVALID; | ||
else | ||
$this->errorCode=self::ERROR_NONE; | ||
return !$this->errorCode; | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
// This is the configuration for yiic console application. | ||
// Any writable CConsoleApplication properties can be configured here. | ||
return array( | ||
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', | ||
'name'=>'Demo app consuming APIs authorized by OAuth - Console', | ||
|
||
// preloading 'log' component | ||
'preload'=>array('log'), | ||
|
||
// application components | ||
'components'=>array( | ||
'db'=>array( | ||
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', | ||
), | ||
// uncomment the following to use a MySQL database | ||
/* | ||
'db'=>array( | ||
'connectionString' => 'mysql:host=localhost;dbname=testdrive', | ||
'emulatePrepare' => true, | ||
'username' => 'root', | ||
'password' => '', | ||
'charset' => 'utf8', | ||
), | ||
*/ | ||
'log'=>array( | ||
'class'=>'CLogRouter', | ||
'routes'=>array( | ||
array( | ||
'class'=>'CFileLogRoute', | ||
'levels'=>'error, warning', | ||
), | ||
), | ||
), | ||
), | ||
); |
Oops, something went wrong.