This commit is contained in:
vladislav.khorev committed 2014-11-21 08:26:20 +00:00
1 parent 11cc1b9dd1
commit 7bc0e46305
162 files changed
+19744

No files matched your search

+1
View File
@@ -0,0 +1 @@
deny from all
+23
View File
@@ -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();
}
+37
View File
@@ -0,0 +1,37 @@
<?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()
{
$admin = User::model()->find('username=:username', array('username'=>$this->username));
if ($admin === null)
{
$this->errorCode=self::ERROR_USERNAME_INVALID;
return false;
}
if (crypt($this->password, $admin->password) == $admin->password)
{
$this->errorCode=self::ERROR_NONE;
return true;
}
$this->errorCode=self::ERROR_PASSWORD_INVALID;
return false;
}
}
+37
View File
@@ -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'=>'My Console Application',
// 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',
),
),
),
),
);
+87
View File
@@ -0,0 +1,87 @@
<?php
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
),
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'ChinaJournal55%%%echo',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
),
// application components
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
// uncomment the following to enable URLs in path-format
/*
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
*/
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=cjbase',
'emulatePrepare' => true,
'username' => 'cjbase',
'password' => 'sjbase&&LOL7',
'charset' => 'utf8',
),
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
*/
),
),
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'webmaster@example.com',
),
);
+17
View File
@@ -0,0 +1,17 @@
<?php
return CMap::mergeArray(
require(dirname(__FILE__).'/main.php'),
array(
'components'=>array(
'fixture'=>array(
'class'=>'system.test.CDbFixtureManager',
),
/* uncomment the following to provide test database connection
'db'=>array(
'connectionString'=>'DSN for test database',
),
*/
),
)
);
@@ -0,0 +1,185 @@
<?php
class SiteController extends Controller
{
/**
* Declares class-based actions.
*/
public function actions()
{
return array(
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha'=>array(
'class'=>'CCaptchaAction',
'backColor'=>0xFFFFFF,
),
// page action renders "static" pages stored under 'protected/views/site/pages'
// They can be accessed via: index.php?r=site/page&view=FileName
'page'=>array(
'class'=>'CViewAction',
),
);
}
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('Post', array(
'criteria'=>array(
'order'=>'date DESC, id DESC',
),
'pagination'=>array(
'pageSize'=>5,
),
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
/**
* This is the action to handle external exceptions.
*/
public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
}
/**
* Displays the login page
*/
public function actionLogin()
{
$model=new LoginForm;
// if it is ajax validation request
if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
{
echo CActiveForm::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 actionRegister()
{
$model=new RegisterForm('register');
if(isset($_POST['RegisterForm']))
{
$model->attributes=$_POST['RegisterForm'];
if($model->validate())
{
$password_hash = $this->better_crypt($model->password);
$user=new User;
$user->username= $model->username;
$user->email = $model->email;
$user->password= $password_hash;
$user->save();
$this->redirect(Yii::app()->user->returnUrl);
return;
}
}
$this->render('register',array('model'=>$model));
}
/**
* Logs out the current user and redirect to homepage.
*/
public function actionLogout()
{
Yii::app()->user->logout();
$this->redirect(Yii::app()->homeUrl);
}
public function actionAddPost()
{
$model=new AddPostForm('addPost');
// uncomment the following code to enable ajax-based validation
/*
if(isset($_POST['ajax']) && $_POST['ajax']==='add-post-form-addPost-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
*/
if(isset($_POST['AddPostForm']))
{
$model->attributes=$_POST['AddPostForm'];
$model->image=CUploadedFile::getInstance($model,'image');
if($model->validate())
{
$username = Yii::app()->user->name;
$user = User::model()->find('username=:username',array(':username'=>$username));
$imageFileName = 'uploaded/' . $username . '-' . ($user->postCount + 1) . '.' . $model->image->extensionName;
$model->image->saveAs('C:/Workplace/Apache2.4/htdocs/cj/' . $imageFileName);
$user->postCount = $user->postCount + 1;
$user->save();
$post = new Post;
$post->username = $username;
$post->title = $model->title;
$post->text = $model->text;
$post->imageFileName = $imageFileName;
$post->save();
$this->redirect(Yii::app()->homeUrl);
return;
}
}
$this->render('addPost',array('model'=>$model));
}
private function better_crypt($input)
{
$salt = "";
$salt_chars = array_merge(range('A','Z'), range('a','z'), range(0,9));
for($i=0; $i < 22; $i++)
{
$salt .= $salt_chars[array_rand($salt_chars)];
}
return crypt($input, '$2y$10$' . $salt);
}
}
+8
View File
@@ -0,0 +1,8 @@
CREATE TABLE `cjbase`.`tbl_user` (
`id` INT NOT NULL AUTO_INCREMENT,
`username` VARCHAR(45) NOT NULL,
`email` VARCHAR(45) NOT NULL,
`password` TEXT NOT NULL,
`level` INT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`));
+25
View File
@@ -0,0 +1,25 @@
<?php
class AddPostForm extends CFormModel
{
public $title;
public $text;
public $image;
/**
* Declares the validation rules.
* The rules state that username and password are required,
* and password needs to be authenticated.
*/
public function rules()
{
return array(
array('title, text, image', 'required'),
array('image', 'file', 'types'=>'jpg, gif, png'),
);
}
}
+77
View File
@@ -0,0 +1,77 @@
<?php
/**
* LoginForm class.
* LoginForm is the data structure for keeping
* user login form data. It is used by the 'login' action of 'SiteController'.
*/
class LoginForm extends CFormModel
{
public $username;
public $password;
public $rememberMe;
private $_identity;
/**
* Declares the validation rules.
* The rules state that username and password are required,
* and password needs to be authenticated.
*/
public function rules()
{
return array(
// username and password are required
array('username, password', 'required'),
// rememberMe needs to be a boolean
array('rememberMe', 'boolean'),
// password needs to be authenticated
array('password', 'authenticate'),
);
}
/**
* Declares attribute labels.
*/
public function attributeLabels()
{
return array(
'rememberMe'=>'Remember me next time',
);
}
/**
* Authenticates the password.
* This is the 'authenticate' validator as declared in rules().
*/
public function authenticate($attribute,$params)
{
if(!$this->hasErrors())
{
$this->_identity=new UserIdentity($this->username,$this->password);
if(!$this->_identity->authenticate())
$this->addError('password','Incorrect username or password.');
}
}
/**
* Logs in the user using the given username and password in the model.
* @return boolean whether login is successful
*/
public function login()
{
if($this->_identity===null)
{
$this->_identity=new UserIdentity($this->username,$this->password);
$this->_identity->authenticate();
}
if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
{
$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($this->_identity,$duration);
return true;
}
else
return false;
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
class Post extends CActiveRecord
{
public static function model($className=__CLASS__)
{
return parent::model($className);
}
public function tableName()
{
return 'tbl_post';
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
/**
* LoginForm class.
* LoginForm is the data structure for keeping
* user login form data. It is used by the 'login' action of 'SiteController'.
*/
class RegisterForm extends CFormModel
{
public $username;
public $password;
public $email;
/**
* Declares the validation rules.
* The rules state that username and password are required,
* and password needs to be authenticated.
*/
public function rules()
{
return array(
array('username, password, email', 'required'),
array('email', 'email'),
array('username', 'unique'),
);
}
public function unique($attribute,$params)
{
if(!$this->hasErrors())
{
$count = user::model()->count('username=:username', array('username'=>$this->username));
if ($count != 0)
$this->addError('username','Username already exists');
$count = user::model()->count('email=:email', array('email'=>$this->email));
if ($count != 0)
$this->addError('email','Email already exists');
}
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
class User extends CActiveRecord
{
public static function model($className=__CLASS__)
{
return parent::model($className);
}
public function tableName()
{
return 'tbl_user';
}
public function rules()
{
return array(
array('username, password, email', 'required'),
array('email', 'email'),
);
}
}
+323
View File
@@ -0,0 +1,323 @@
2014/11/20 18:53:47 [error] [exception.CException] exception 'CException' with message 'UserIdentity::authenticate() must be implemented.' in C:\Workplace\yii1.1.15\framework\web\auth\CUserIdentity.php:57
Stack trace:
#0 C:\Workplace\Apache2.4\htdocs\cj\protected\models\LoginForm.php(52): CUserIdentity->authenticate()
#1 C:\Workplace\yii1.1.15\framework\validators\CInlineValidator.php(42): LoginForm->authenticate('password', Array)
#2 C:\Workplace\yii1.1.15\framework\validators\CValidator.php(213): CInlineValidator->validateAttribute(Object(LoginForm), 'password')
#3 C:\Workplace\yii1.1.15\framework\base\CModel.php(159): CValidator->validate(Object(LoginForm), NULL)
#4 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(68): CModel->validate()
#5 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionLogin()
#6 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#7 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#8 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#9 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('login')
#10 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/login')
#11 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#12 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CApplication->run()
#13 {main}
REQUEST_URI=/cj/index.php?r=site/login
HTTP_REFERER=http://localhost/cj/index.php?r=site/login
---
2014/11/20 18:54:18 [error] [php] include(user.php): failed to open stream: No such file or directory (C:\Workplace\yii1.1.15\framework\YiiBase.php:427)
Stack trace:
#0 C:\Workplace\Apache2.4\htdocs\cj\protected\components\UserIdentity.php(20): spl_autoload_call()
#1 C:\Workplace\Apache2.4\htdocs\cj\protected\models\LoginForm.php(52): UserIdentity->authenticate()
#2 C:\Workplace\yii1.1.15\framework\validators\CInlineValidator.php(42): LoginForm->authenticate()
#3 C:\Workplace\yii1.1.15\framework\validators\CValidator.php(213): CInlineValidator->validateAttribute()
#4 C:\Workplace\yii1.1.15\framework\base\CModel.php(159): CInlineValidator->validate()
#5 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(68): LoginForm->validate()
#6 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionLogin()
#7 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams()
#8 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#9 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#10 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#11 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#12 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#13 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/login
in C:\Workplace\Apache2.4\htdocs\cj\protected\components\UserIdentity.php (20)
in C:\Workplace\Apache2.4\htdocs\cj\protected\models\LoginForm.php (52)
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (68)
2014/11/20 19:16:52 [error] [exception.CException] exception 'CException' with message 'SiteController cannot find the requested view "register".' in C:\Workplace\yii1.1.15\framework\web\CController.php:878
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\web\CController.php(782): CController->renderPartial('register', Array, true)
#1 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(97): CController->render('register', Array)
#2 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionRegister()
#3 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#4 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#5 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#6 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('register')
#7 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/register')
#8 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#9 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CApplication->run()
#10 {main}
REQUEST_URI=/cj/index.php?r=site/register
HTTP_REFERER=http://localhost/cj/index.php?r=site/login
---
2014/11/20 20:31:20 [error] [php] Undefined variable: rounds (C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php:127)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams()
#1 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#2 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#3 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#4 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#5 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#6 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/register
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (127)
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (94)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 20:31:43 [error] [php] Creating default object from empty value (C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php:97)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#1 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#2 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#3 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#4 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#5 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/register
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (97)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 20:32:20 [error] [php] Undefined variable: post (C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php:99)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#1 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#2 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#3 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#4 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#5 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/register
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (99)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 20:32:33 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[HY000]: General error: 1364 Field 'email' doesn't have a default value. The SQL statement executed was: INSERT INTO `tbl_user` (`level`, `username`, `password`) VALUES (:yp0, :yp1, :yp2).
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (99)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 20:32:33 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field 'email' doesn't have a default value. The SQL statement executed was: INSERT INTO `tbl_user` (`level`, `username`, `password`) VALUES (:yp0, :yp1, :yp2)' in C:\Workplace\yii1.1.15\framework\db\CDbCommand.php:358
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\db\ar\CActiveRecord.php(1077): CDbCommand->execute()
#1 C:\Workplace\yii1.1.15\framework\db\ar\CActiveRecord.php(806): CActiveRecord->insert(NULL)
#2 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(99): CActiveRecord->save()
#3 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionRegister()
#4 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#5 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#6 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#7 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('register')
#8 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/register')
#9 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#10 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CApplication->run()
#11 {main}
REQUEST_URI=/cj/index.php?r=site/register
HTTP_REFERER=http://localhost/cj/index.php?r=site/register
---
2014/11/20 20:59:07 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 20:59:14 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:00:03 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:00:30 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:01:35 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:08:03 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:09:03 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:11:09 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:11:16 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:11:16 [error] [exception.CException] exception 'CException' with message 'AddPostForm and its behaviors do not have a method or closure named "save".' in C:\Workplace\yii1.1.15\framework\base\CComponent.php:266
Stack trace:
#0 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(142): CComponent->__call('save', Array)
#1 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(142): AddPostForm->save()
#2 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionAddPost()
#3 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#4 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#5 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#6 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('addPost')
#7 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/addPost')
#8 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#9 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CApplication->run()
#10 {main}
REQUEST_URI=/cj/index.php?r=site/addPost
HTTP_REFERER=http://localhost/cj/index.php?r=site/addPost
---
2014/11/20 21:12:48 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 21:15:53 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:12:49 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:12:49 [error] [exception.CException] exception 'CException' with message 'Property "CWebUser.username" is not defined.' in C:\Workplace\yii1.1.15\framework\base\CComponent.php:130
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\web\auth\CWebUser.php(146): CComponent->__get('username')
#1 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(142): CWebUser->__get('username')
#2 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionAddPost()
#3 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#4 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#5 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#6 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('addPost')
#7 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/addPost')
#8 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#9 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CApplication->run()
#10 {main}
REQUEST_URI=/cj/index.php?r=site/addPost
HTTP_REFERER=http://localhost/cj/index.php?r=site/addPost
---
2014/11/20 23:26:09 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:26:10 [error] [exception.CException] exception 'CException' with message 'Property "Post.imageUrl" is not defined.' in C:\Workplace\yii1.1.15\framework\base\CComponent.php:173
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\db\ar\CActiveRecord.php(161): CComponent->__set('imageUrl', '1.jpg')
#1 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(159): CActiveRecord->__set('imageUrl', '1.jpg')
#2 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionAddPost()
#3 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#4 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#5 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#6 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('addPost')
#7 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/addPost')
#8 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#9 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CApplication->run()
#10 {main}
REQUEST_URI=/cj/index.php?r=site/addPost
HTTP_REFERER=http://localhost/cj/index.php?r=site/addPost
---
2014/11/20 23:26:49 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:28:13 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:28:35 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (135)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:40:52 [error] [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'update_time' in 'order clause'. The SQL statement executed was: SELECT * FROM `tbl_post` `t` ORDER BY update_time DESC LIMIT 5.
in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\index.php (14)
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (44)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:40:52 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'update_time' in 'order clause'. The SQL statement executed was: SELECT * FROM `tbl_post` `t` ORDER BY update_time DESC LIMIT 5' in C:\Workplace\yii1.1.15\framework\db\CDbCommand.php:543
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\db\CDbCommand.php(396): CDbCommand->queryInternal('fetchAll', Array, Array)
#1 C:\Workplace\yii1.1.15\framework\db\ar\CActiveRecord.php(1351): CDbCommand->queryAll()
#2 C:\Workplace\yii1.1.15\framework\db\ar\CActiveRecord.php(1470): CActiveRecord->query(Object(CDbCriteria), true)
#3 C:\Workplace\yii1.1.15\framework\web\CActiveDataProvider.php(199): CActiveRecord->findAll(Object(CDbCriteria))
#4 C:\Workplace\yii1.1.15\framework\web\CDataProvider.php(168): CActiveDataProvider->fetchData()
#5 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(111): CDataProvider->getData()
#6 C:\Workplace\yii1.1.15\framework\zii\widgets\CListView.php(211): CBaseListView->init()
#7 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(147): CListView->init()
#8 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(172): CBaseController->createWidget('zii.widgets.CLi...', Array)
#9 C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\index.php(14): CBaseController->widget('zii.widgets.CLi...', Array)
#10 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...')
#11 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true)
#12 C:\Workplace\yii1.1.15\framework\web\CController.php(869): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true)
#13 C:\Workplace\yii1.1.15\framework\web\CController.php(782): CController->renderPartial('index', Array, true)
#14 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(44): CController->render('index', Array)
#15 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionIndex()
#16 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#17 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#18 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#19 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('index')
#20 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/index')
#21 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#22 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CApplication->run()
#23 {main}
REQUEST_URI=/cj/index.php?r=site/index
HTTP_REFERER=http://localhost/cj/index.php?r=site/index
---
2014/11/20 23:41:12 [error] [php] require(): Filename cannot be empty (C:\Workplace\yii1.1.15\framework\web\CBaseController.php:130)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\zii\widgets\CListView.php(291): SiteController->renderFile()
#1 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(167): CListView->renderItems()
#2 unknown(0): CListView->renderSection()
#3 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(150): preg_replace_callback()
#4 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(135): CListView->renderContent()
#5 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(173): CListView->run()
#6 C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\index.php(14): SiteController->widget()
#7 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require()
#8 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal()
#9 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile()
#10 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial()
#11 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(40): SiteController->render()
#12 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionIndex()
#13 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams()
#14 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#15 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#16 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#17 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#18 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#19 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/index
in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\index.php (14)
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (40)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:41:59 [error] [php] require(): Filename cannot be empty (C:\Workplace\yii1.1.15\framework\web\CBaseController.php:130)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\zii\widgets\CListView.php(291): SiteController->renderFile()
#1 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(167): CListView->renderItems()
#2 unknown(0): CListView->renderSection()
#3 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(150): preg_replace_callback()
#4 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(135): CListView->renderContent()
#5 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(173): CListView->run()
#6 C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\index.php(14): SiteController->widget()
#7 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require()
#8 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal()
#9 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile()
#10 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial()
#11 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(40): SiteController->render()
#12 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionIndex()
#13 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams()
#14 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#15 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#16 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#17 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#18 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#19 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/index
in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\index.php (14)
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (40)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:52:47 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (148)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:54:09 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (148)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:55:01 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (148)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:55:24 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (148)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/20 23:55:40 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (148)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/21 10:46:51 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (148)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/21 10:46:52 [error] [php] Undefined variable: path (C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php:159)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#1 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#2 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#3 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#4 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#5 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/addPost
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (159)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
2014/11/21 10:49:26 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm".
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (148)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (13)
@@ -0,0 +1,5 @@
<?php
return array (
'template' => 'default',
'viewPath' => 'application.views',
);
+25
View File
@@ -0,0 +1,25 @@
<?php
/**
* Change the following URL based on your server configuration
* Make sure the URL ends with a slash so that we can use relative URLs in test cases
*/
define('TEST_BASE_URL','http://localhost/testdrive/index-test.php/');
/**
* The base class for functional test cases.
* In this class, we set the base URL for the test application.
* We also provide some common methods to be used by concrete test classes.
*/
class WebTestCase extends CWebTestCase
{
/**
* Sets up before each test method runs.
* This mainly sets the base URL for the test application.
*/
protected function setUp()
{
parent::setUp();
$this->setBrowserUrl(TEST_BASE_URL);
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
// change the following paths if necessary
$yiit=dirname(__FILE__).'/../../../../../yii1.1.15/framework/yiit.php';
$config=dirname(__FILE__).'/../config/test.php';
require_once($yiit);
require_once(dirname(__FILE__).'/WebTestCase.php');
Yii::createWebApplication($config);
@@ -0,0 +1,47 @@
<?php
class SiteTest extends WebTestCase
{
public function testIndex()
{
$this->open('');
$this->assertTextPresent('Welcome');
}
public function testContact()
{
$this->open('?r=site/contact');
$this->assertTextPresent('Contact Us');
$this->assertElementPresent('name=ContactForm[name]');
$this->type('name=ContactForm[name]','tester');
$this->type('name=ContactForm[email]','tester@example.com');
$this->type('name=ContactForm[subject]','test subject');
$this->click("//input[@value='Submit']");
$this->waitForTextPresent('Body cannot be blank.');
}
public function testLoginLogout()
{
$this->open('');
// ensure the user is logged out
if($this->isTextPresent('Logout'))
$this->clickAndWait('link=Logout (demo)');
// test login process, including validation
$this->clickAndWait('link=Login');
$this->assertElementPresent('name=LoginForm[username]');
$this->type('name=LoginForm[username]','demo');
$this->click("//input[@value='Login']");
$this->waitForTextPresent('Password cannot be blank.');
$this->type('name=LoginForm[password]','demo');
$this->clickAndWait("//input[@value='Login']");
$this->assertTextNotPresent('Password cannot be blank.');
$this->assertTextPresent('Logout');
// test logout process
$this->assertTextNotPresent('Login');
$this->clickAndWait('link=Logout (demo)');
$this->assertTextPresent('Login');
}
}
+13
View File
@@ -0,0 +1,13 @@
<phpunit bootstrap="bootstrap.php"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
<selenium>
<browser name="Internet Explorer" browser="*iexplore" />
<browser name="Firefox" browser="*firefox" />
</selenium>
</phpunit>
+6
View File
@@ -0,0 +1,6 @@
<?php /* @var $this Controller */ ?>
<?php $this->beginContent('//layouts/main'); ?>
<div id="content">
<?php echo $content; ?>
</div><!-- content -->
<?php $this->endContent(); ?>
+22
View File
@@ -0,0 +1,22 @@
<?php /* @var $this Controller */ ?>
<?php $this->beginContent('//layouts/main'); ?>
<div class="span-19">
<div id="content">
<?php echo $content; ?>
</div><!-- content -->
</div>
<div class="span-5 last">
<div id="sidebar">
<?php
$this->beginWidget('zii.widgets.CPortlet', array(
'title'=>'Operations',
));
$this->widget('zii.widgets.CMenu', array(
'items'=>$this->menu,
'htmlOptions'=>array('class'=>'operations'),
));
$this->endWidget();
?>
</div><!-- sidebar -->
</div>
<?php $this->endContent(); ?>
+59
View File
@@ -0,0 +1,59 @@
<?php /* @var $this Controller */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<!-- blueprint CSS framework -->
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" />
<title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>
<body>
<div class="container" id="page">
<div id="header">
<div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?></div>
</div><!-- header -->
<div id="mainmenu">
<?php $this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('label'=>'Home', 'url'=>array('/site/index')),
array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
array('label'=>'AddPost', 'url'=>array('/site/addPost'), 'visible'=>!Yii::app()->user->isGuest),
array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
),
)); ?>
</div><!-- mainmenu -->
<?php if(isset($this->breadcrumbs)):?>
<?php $this->widget('zii.widgets.CBreadcrumbs', array(
'links'=>$this->breadcrumbs,
)); ?><!-- breadcrumbs -->
<?php endif?>
<?php echo $content; ?>
<div class="clear"></div>
<div id="footer">
Copyright &copy; <?php echo date('Y'); ?> by My Company.<br/>
All Rights Reserved.<br/>
<?php echo Yii::powered(); ?>
</div><!-- footer -->
</div><!-- page -->
</body>
</html>
+13
View File
@@ -0,0 +1,13 @@
<?php
/* @var $this SiteController */
$this->pageTitle=Yii::app()->name;
?>
<hr>
<p><?php echo $data->title; ?></p>
<p><?php echo $data->username; ?></p>
<p><?php echo $data->text; ?></p>
<img src="<?php echo $data->imageFileName; ?>">
+47
View File
@@ -0,0 +1,47 @@
<?php
/* @var $this AddPostFormController */
/* @var $model AddPostForm */
/* @var $form CActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'add-post-form-addPost-form',
// Please note: When you enable ajax validation, make sure the corresponding
// controller action is handling ajax validation correctly.
// See class documentation of CActiveForm for details on this,
// you need to use the performAjaxValidation()-method described there.
'enableAjaxValidation'=>false,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'title'); ?>
<?php echo $form->textField($model,'title'); ?>
<?php echo $form->error($model,'title'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'text'); ?>
<?php echo $form->textArea($model,'text'); ?>
<?php echo $form->error($model,'text'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'image'); ?>
<?php echo $form->fileField($model,'image'); ?>
<?php echo $form->error($model,'image'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Submit'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
+15
View File
@@ -0,0 +1,15 @@
<?php
/* @var $this SiteController */
/* @var $error array */
$this->pageTitle=Yii::app()->name . ' - Error';
$this->breadcrumbs=array(
'Error',
);
?>
<h2>Error <?php echo $code; ?></h2>
<div class="error">
<?php echo CHtml::encode($message); ?>
</div>
+14
View File
@@ -0,0 +1,14 @@
<?php
/* @var $this SiteController */
$this->pageTitle=Yii::app()->name;
?>
<h1>Welcome to <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1>
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
'template'=>"{items}\n{pager}",
)); ?>
+52
View File
@@ -0,0 +1,52 @@
<?php
/* @var $this SiteController */
/* @var $model LoginForm */
/* @var $form CActiveForm */
$this->pageTitle=Yii::app()->name . ' - Login';
$this->breadcrumbs=array(
'Login',
);
?>
<h1>Login</h1>
<p>Please fill out the following form with your login credentials:</p>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
</div>
<div class="row rememberMe">
<?php echo $form->checkBox($model,'rememberMe'); ?>
<?php echo $form->label($model,'rememberMe'); ?>
<?php echo $form->error($model,'rememberMe'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Login'); ?>
</div>
<?php $this->endWidget(); ?>
<?php echo CHtml::link('Register',array('site/register')); ?>
</div><!-- form -->
+12
View File
@@ -0,0 +1,12 @@
<?php
/* @var $this SiteController */
$this->pageTitle=Yii::app()->name . ' - About';
$this->breadcrumbs=array(
'About',
);
?>
<h1>About</h1>
<p>This is a "static" page. You may change the content of this page
by updating the file <code><?php echo __FILE__; ?></code>.</p>
+47
View File
@@ -0,0 +1,47 @@
<?php
/* @var $this RegisterFormController */
/* @var $model RegisterForm */
/* @var $form CActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'register-form-register-form',
// Please note: When you enable ajax validation, make sure the corresponding
// controller action is handling ajax validation correctly.
// See class documentation of CActiveForm for details on this,
// you need to use the performAjaxValidation()-method described there.
'enableAjaxValidation'=>false,
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'email'); ?>
<?php echo $form->emailField($model,'email'); ?>
<?php echo $form->error($model,'email'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Submit'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env php
<?php
require_once(dirname(__FILE__).'/yiic.php');
+16
View File
@@ -0,0 +1,16 @@
@echo off
rem -------------------------------------------------------------
rem Yii command line script for Windows.
rem This is the bootstrap script for running yiic on Windows.
rem -------------------------------------------------------------
@setlocal
set BIN_PATH=%~dp0
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
"%PHP_COMMAND%" "%BIN_PATH%yiic.php" %*
@endlocal
+7
View File
@@ -0,0 +1,7 @@
<?php
// change the following paths if necessary
$yiic=dirname(__FILE__).'/../../../../yii1.1.15/framework/yiic.php';
$config=dirname(__FILE__).'/config/console.php';
require_once($yiic);