Skip to content

Commit

Permalink
Base appserver and appclient yii apps setup
Browse files Browse the repository at this point in the history
  • Loading branch information
fillup committed Jul 4, 2014
1 parent 555b35b commit 190cd85
Show file tree
Hide file tree
Showing 85 changed files with 3,901 additions and 0 deletions.
6 changes: 6 additions & 0 deletions appclient/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"require": {
"yiisoft/yii": "1.1.*",
"guzzle/guzzle": "~3.7"
}
}
261 changes: 261 additions & 0 deletions appclient/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added appclient/composer.phar
Binary file not shown.
1 change: 1 addition & 0 deletions appclient/protected/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deny from all
23 changes: 23 additions & 0 deletions appclient/protected/components/Controller.php
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();
}
33 changes: 33 additions & 0 deletions appclient/protected/components/UserIdentity.php
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;
}
}
37 changes: 37 additions & 0 deletions appclient/protected/config/console.php
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',
),
),
),
),
);
Loading

0 comments on commit 190cd85

Please sign in to comment.