From 2ed0710575ed5ca7902f2cd4a16afbf87a5bc7fd Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Sat, 22 Nov 2014 13:14:22 +0000 Subject: [PATCH] Website is working! --- yii/index.php | 16 +- .../components/ApplicationConfigBehavior.php | 30 ++ yii/protected/components/LangBox.php | 10 + yii/protected/components/UserIdentity.php | 1 + yii/protected/config/main.php | 9 +- yii/protected/controllers/SiteController.php | 36 +- yii/protected/data/schema.mysql.sql | 12 +- yii/protected/messages/cn/app.php | 35 ++ yii/protected/messages/ru/app.php | 35 ++ yii/protected/models/AddPostForm.php | 15 +- yii/protected/models/LoginForm.php | 24 +- yii/protected/models/RegisterForm.php | 45 --- yii/protected/models/User.php | 30 +- yii/protected/runtime/application.log | 340 ++++++++++++++++++ yii/protected/views/layouts/main.php | 24 +- yii/protected/views/site/_view.php | 10 +- yii/protected/views/site/addPost.php | 12 +- yii/protected/views/site/index.php | 4 +- yii/protected/views/site/langBox.php | 7 + yii/protected/views/site/login.php | 21 +- yii/protected/views/site/pages/about.php | 13 +- yii/protected/views/site/pages/cn/about.php | 9 + yii/protected/views/site/pages/ru/about.php | 9 + yii/protected/views/site/register.php | 16 +- 24 files changed, 644 insertions(+), 119 deletions(-) create mode 100644 yii/protected/components/ApplicationConfigBehavior.php create mode 100644 yii/protected/components/LangBox.php create mode 100644 yii/protected/messages/cn/app.php create mode 100644 yii/protected/messages/ru/app.php delete mode 100644 yii/protected/models/RegisterForm.php create mode 100644 yii/protected/views/site/langBox.php create mode 100644 yii/protected/views/site/pages/cn/about.php create mode 100644 yii/protected/views/site/pages/ru/about.php diff --git a/yii/index.php b/yii/index.php index d512b7c..c769452 100644 --- a/yii/index.php +++ b/yii/index.php @@ -1,13 +1,25 @@ run(); diff --git a/yii/protected/components/ApplicationConfigBehavior.php b/yii/protected/components/ApplicationConfigBehavior.php new file mode 100644 index 0000000..509a144 --- /dev/null +++ b/yii/protected/components/ApplicationConfigBehavior.php @@ -0,0 +1,30 @@ +'beginRequest', + )); + } + + /** + * Load configuration that cannot be put in config/main + */ + public function beginRequest() + { + if (isset(Yii::app()->request->cookies['pref_lang'])) + $this->owner->language= Yii::app()->request->cookies['pref_lang']->value; //set a language for each request + else + $this->owner->language='en'; + } +} diff --git a/yii/protected/components/LangBox.php b/yii/protected/components/LangBox.php new file mode 100644 index 0000000..d8612a4 --- /dev/null +++ b/yii/protected/components/LangBox.php @@ -0,0 +1,10 @@ +language; + $this->render('application.views.site.langBox', array('currentLang' => $currentLang)); + } +} +?> diff --git a/yii/protected/components/UserIdentity.php b/yii/protected/components/UserIdentity.php index 52f648e..304060a 100644 --- a/yii/protected/components/UserIdentity.php +++ b/yii/protected/components/UserIdentity.php @@ -34,4 +34,5 @@ class UserIdentity extends CUserIdentity $this->errorCode=self::ERROR_PASSWORD_INVALID; return false; } + } \ No newline at end of file diff --git a/yii/protected/config/main.php b/yii/protected/config/main.php index 7295e85..48249d6 100644 --- a/yii/protected/config/main.php +++ b/yii/protected/config/main.php @@ -7,7 +7,11 @@ // CWebApplication properties can be configured here. return array( 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', - 'name'=>'My Web Application', + 'name'=>'Hello China!', + 'sourceLanguage'=>'en', + 'language'=>'en', + 'timeZone' => 'Europe/Moscow', + 'behaviors' => array('ApplicationConfigBehavior'), // preloading 'log' component 'preload'=>array('log'), @@ -21,12 +25,13 @@ return array( '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'), - ), + ),*/ ), diff --git a/yii/protected/controllers/SiteController.php b/yii/protected/controllers/SiteController.php index c7f2b35..63c06a3 100644 --- a/yii/protected/controllers/SiteController.php +++ b/yii/protected/controllers/SiteController.php @@ -27,6 +27,12 @@ class SiteController extends Controller */ public function actionIndex() { + + if(isset($_POST['lang'])) + { + Yii::app()->request->cookies['pref_lang'] = new CHttpCookie('pref_lang', $_POST['lang']); + Yii::app()->language = $_POST['lang']; + } $dataProvider=new CActiveDataProvider('Post', array( 'criteria'=>array( @@ -86,24 +92,20 @@ class SiteController extends Controller public function actionRegister() { - $model=new RegisterForm('register'); + $model=new User('register'); - if(isset($_POST['RegisterForm'])) + if(isset($_POST['User'])) { - $model->attributes=$_POST['RegisterForm']; + $model->attributes=$_POST['User']; 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(); + + $model->password = $this->better_crypt($model->password); - $this->redirect(Yii::app()->user->returnUrl); + $model->save(); + //$this->redirect(Yii::app()->user->returnUrl); + $this->redirect(array("site/login")); return; } @@ -148,7 +150,14 @@ class SiteController extends Controller $imageFileName = 'uploaded/' . $username . '-' . ($user->postCount + 1) . '.' . $model->image->extensionName; - $model->image->saveAs('C:/Workplace/Apache2.4/htdocs/cj/' . $imageFileName); + if (strncasecmp(PHP_OS, 'WIN', 3) == 0) + { + $model->image->saveAs('C:/Workplace/Apache2.4/htdocs/cj/' . $imageFileName); + } + else + { + $model->image->saveAs('/home/fishrungames-http/fishrungames.ru/http/cj/' . $imageFileName); + } $user->postCount = $user->postCount + 1; @@ -160,6 +169,7 @@ class SiteController extends Controller $post->title = $model->title; $post->text = $model->text; $post->imageFileName = $imageFileName; + $post->date = date('Y-m-d H:i:s'); $post->save(); diff --git a/yii/protected/data/schema.mysql.sql b/yii/protected/data/schema.mysql.sql index 901f80b..472f496 100644 --- a/yii/protected/data/schema.mysql.sql +++ b/yii/protected/data/schema.mysql.sql @@ -1,8 +1,18 @@ -CREATE TABLE `cjbase`.`tbl_user` ( +CREATE TABLE `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, + `postCount` INT NOT NULL DEFAULT 0, PRIMARY KEY (`id`)); + +CREATE TABLE `tbl_post` ( + `id` INT NOT NULL AUTO_INCREMENT, + `username` VARCHAR(45) NOT NULL, + `title` VARCHAR(45) NOT NULL, + `text` TEXT NOT NULL, + `imageFileName` TEXT NOT NULL, + `date` DATETIME NOT NULL, + PRIMARY KEY (`id`)); diff --git a/yii/protected/messages/cn/app.php b/yii/protected/messages/cn/app.php new file mode 100644 index 0000000..f9f6451 --- /dev/null +++ b/yii/protected/messages/cn/app.php @@ -0,0 +1,35 @@ + '主页', + 'About journal' => '关于日报', + 'Add post' => '添加动态', + 'Login' => '登录', + 'Register' => '注册', + 'Logout' => '退出', + 'All rights reserved.' => '版权所有.', + 'New posts' => '新动态', + 'Fields with {*} are required.' => '请注意正确填写 {*} 部分', + 'Please, fix following errors:' => '请修正下述错误:', + 'Please fill out the following form with your login credentials:' => '请正确输入您的注册身份信息', + 'Field should not be blank' => '不得输入空格', + 'Line is too long' => '字数符号过长', + 'Login or password is incorrect' => '登录名或密码错误', + 'Username:' => '用户名:', + 'Password:' => '密码:', + 'Remember me' => '记住我', + 'Please fill out the registation form' => '请填写注册信息表格', + 'Email address is not correct' => '电子邮件格式错误', + 'Confirmation code is not correct' => '验证码错误', + 'User {attribute} is already registered in system' => '用户名 {属性} 已被注册', + 'Email:' => '电子邮件:', + 'Confirmation code:' => '验证码:', + 'Image must be jpg, gif or png, and its size should not exceed 8 megabytes' => '图片必须是jpg,gif或png格式,且图片大小不得超过8MB', + 'Title:' => '标题:', + 'Text:' => '文本:', + 'Image:' => '图片:', + 'Send' => '发送', + 'Posted by: ' => '作者: ', + 'Published at: ' => '发表于: ', + 'Hello China!' => '你好,中国!', + ); +?> \ No newline at end of file diff --git a/yii/protected/messages/ru/app.php b/yii/protected/messages/ru/app.php new file mode 100644 index 0000000..6fd004c --- /dev/null +++ b/yii/protected/messages/ru/app.php @@ -0,0 +1,35 @@ + 'Главная', + 'About journal' => 'О журнале', + 'Add post' => 'Добавить пост', + 'Login' => 'Вход', + 'Register' => 'Регистрация', + 'Logout' => 'Выйти', + 'All rights reserved.' => 'Все права сохранены.', + 'New posts' => 'Свежие посты', + 'Fields with {*} are required.' => 'Поля, отмеченные символом {*} обязательны для заполнения', + 'Please, fix following errors:' => 'Пожалуйста, исправьте ошибки:', + 'Please fill out the following form with your login credentials:' => 'Пожалуйста, введите логин и пароль для входа в систему', + 'Field should not be blank' => 'Поле не должно быть пустым', + 'Line is too long' => 'Строка слишком длинная', + 'Login or password is incorrect' => 'Логин или пароль введен неверно', + 'Username:' => 'Имя пользователя:', + 'Password:' => 'Пароль:', + 'Remember me' => 'Запомнить меня', + 'Please fill out the registation form' => 'Пожалуйста, заполните анкету для регистрации', + 'Email address is not correct' => 'Email-адрес введен некорректно', + 'Confirmation code is not correct' => 'Код подтверждения введен некорректно', + 'User {attribute} is already registered in system' => 'Пользователь {attribute} уже зарегистрирован в системе', + 'Email:' => 'Email:', + 'Confirmation code:' => 'Код подтверждения:', + 'Image must be jpg, gif or png, and its size should not exceed 8 megabytes' => 'Изображение должно быть в формате jpg, gif или png и иметь размер не более 8 мегабайт', + 'Title:' => 'Заголовок:', + 'Text:' => 'Текст:', + 'Image:' => 'Изображение:', + 'Send' => 'Отправить', + 'Posted by: ' => 'Автор поста: ', + 'Published at: ' => 'Опубликовано: ', + 'Hello China!' => 'Привет, Китай!', + ); +?> \ No newline at end of file diff --git a/yii/protected/models/AddPostForm.php b/yii/protected/models/AddPostForm.php index 8ffebc8..6daab3c 100644 --- a/yii/protected/models/AddPostForm.php +++ b/yii/protected/models/AddPostForm.php @@ -6,6 +6,7 @@ class AddPostForm extends CFormModel public $title; public $text; public $image; + public $date; /** @@ -16,10 +17,20 @@ class AddPostForm extends CFormModel public function rules() { return array( - array('title, text, image', 'required'), - array('image', 'file', 'types'=>'jpg, gif, png'), + array('title, text, image', 'required', 'message'=>'{attribute} ' . Yii::t('app', 'Field should not be blank')), + array('title', 'length', 'max'=>45, 'tooLong'=>'{attribute} ' . Yii::t('app', 'Line is too long')), + array('image', 'file', 'types'=>'jpg, gif, png', 'maxSize'=>8388608, 'message'=>'{attribute} ' . Yii::t('app', 'Image must be jpg, gif or png, and its size should not exceed 8 megabytes')), ); } + + + function attributeLabels(){ + return array( + 'title' => Yii::t('app', 'Title:'), + 'text' => Yii::t('app', 'Text:'), + 'image' => Yii::t('app', 'Image:'), + ); + } } diff --git a/yii/protected/models/LoginForm.php b/yii/protected/models/LoginForm.php index eb36e4a..5b3b222 100644 --- a/yii/protected/models/LoginForm.php +++ b/yii/protected/models/LoginForm.php @@ -22,7 +22,9 @@ class LoginForm extends CFormModel { return array( // username and password are required - array('username, password', 'required'), + array('username, password', 'required', 'message'=>'{attribute} ' . Yii::t('app', 'Field should not be blank')), + array('username, password', 'length', 'max'=>45, 'tooLong'=>'{attribute} ' . Yii::t('app', 'Line is too long')), + // rememberMe needs to be a boolean array('rememberMe', 'boolean'), // password needs to be authenticated @@ -30,15 +32,7 @@ class LoginForm extends CFormModel ); } - /** - * Declares attribute labels. - */ - public function attributeLabels() - { - return array( - 'rememberMe'=>'Remember me next time', - ); - } + /** * Authenticates the password. @@ -50,7 +44,7 @@ class LoginForm extends CFormModel { $this->_identity=new UserIdentity($this->username,$this->password); if(!$this->_identity->authenticate()) - $this->addError('password','Incorrect username or password.'); + $this->addError('password', Yii::t('app', 'Login or password is incorrect')); } } @@ -74,4 +68,12 @@ class LoginForm extends CFormModel else return false; } + + function attributeLabels(){ + return array( + 'username' => Yii::t('app', 'Username:'), + 'password' => Yii::t('app', 'Password:'), + 'rememberMe' => Yii::t('app', 'Remember me'), + ); + } } diff --git a/yii/protected/models/RegisterForm.php b/yii/protected/models/RegisterForm.php deleted file mode 100644 index 7bf87e1..0000000 --- a/yii/protected/models/RegisterForm.php +++ /dev/null @@ -1,45 +0,0 @@ -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'); - } - - } - - -} diff --git a/yii/protected/models/User.php b/yii/protected/models/User.php index bf0f78a..2e1ddf6 100644 --- a/yii/protected/models/User.php +++ b/yii/protected/models/User.php @@ -2,6 +2,9 @@ class User extends CActiveRecord { + + public $verifyCode; + public static function model($className=__CLASS__) { return parent::model($className); @@ -15,9 +18,32 @@ class User extends CActiveRecord public function rules() { return array( - array('username, password, email', 'required'), - array('email', 'email'), + array('username, password, email', 'required', 'message'=>'{attribute} ' . Yii::t('app', 'Field should not be blank')), + array('username, password, email', 'length', 'max'=>45, 'tooLong'=>'{attribute} ' . Yii::t('app', 'Line is too long')), + array('email', 'email', 'message'=>Yii::t('app', 'Email address is not correct')), + array('username, email', 'unique'), + array('verifyCode', 'captcha', 'allowEmpty'=>false, 'message'=>Yii::t('app', 'Confirmation code is not correct')), ); } + + public function unique($attribute,$params) + { + + if(!$this->hasErrors()) + { + $count = user::model()->count($attribute . '=:attribute', array('attribute'=>$this->attributes[$attribute])); + if ($count != 0) + $this->addError($attribute, Yii::t('app', 'User {attribute} is already registered in system'), array('{attribute}' => $this->attributes[$attribute])); + } + } + + function attributeLabels(){ + return array( + 'username' => Yii::t('app', 'Username:'), + 'password' => Yii::t('app', 'Password:'), + 'email' => Yii::t('app', 'Email:'), + 'verifyCode' => Yii::t('app', 'Confirmation code:'), + ); + } } diff --git a/yii/protected/runtime/application.log b/yii/protected/runtime/application.log index 0e7d71d..31b5686 100644 --- a/yii/protected/runtime/application.log +++ b/yii/protected/runtime/application.log @@ -321,3 +321,343 @@ 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) +2014/11/21 11:35:50 [error] [php] Missing argument 1 for CActiveRecord::getAttribute(), called in C:\Workplace\yii1.1.15\framework\base\CComponent.php on line 111 and defined (C:\Workplace\yii1.1.15\framework\db\ar\CActiveRecord.php:691) +Stack trace: +#0 C:\Workplace\Apache2.4\htdocs\cj\protected\models\User.php(29): User->__get() +#1 C:\Workplace\yii1.1.15\framework\validators\CInlineValidator.php(42): User->unique() +#2 C:\Workplace\yii1.1.15\framework\validators\CValidator.php(213): CInlineValidator->validateAttribute() +#3 C:\Workplace\yii1.1.15\framework\base\CModel.php(159): CInlineValidator->validate() +#4 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(94): User->validate() +#5 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionRegister() +#6 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams() +#7 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction() +#8 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters() +#9 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run() +#10 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController() +#11 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest() +#12 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\models\User.php (29) +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (94) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/21 23:23:28 [error] [exception.CException] exception 'CException' with message 'GD with FreeType or ImageMagick PHP extensions are required.' in C:\Workplace\yii1.1.15\framework\web\widgets\captcha\CCaptcha.php:88 +Stack trace: +#0 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(173): CCaptcha->run() +#1 C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\register.php(45): CBaseController->widget('CCaptcha') +#2 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#3 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#4 C:\Workplace\yii1.1.15\framework\web\CController.php(869): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#5 C:\Workplace\yii1.1.15\framework\web\CController.php(782): CController->renderPartial('register', Array, true) +#6 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(106): CController->render('register', Array) +#7 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionRegister() +#8 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array) +#9 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction)) +#10 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array) +#11 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('register') +#12 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/register') +#13 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest() +#14 C:\Workplace\Apache2.4\htdocs\cj\index.php(13): CApplication->run() +#15 {main} +REQUEST_URI=/cj/index.php?r=site/register +HTTP_REFERER=http://localhost/cj/index.php?r=site/login +--- +2014/11/21 23:46:07 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/21 23:53:18 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:05:41 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:05:48 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:05:48 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'CURRENT_TIMESTAMP' for column 'date' at row 1. The SQL statement executed was: INSERT INTO `tbl_post` (`date`, `username`, `title`, `text`, `imageFileName`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4). +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (160) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:05:48 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'CURRENT_TIMESTAMP' for column 'date' at row 1. The SQL statement executed was: INSERT INTO `tbl_post` (`date`, `username`, `title`, `text`, `imageFileName`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)' 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(160): CActiveRecord->save() +#3 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionAddPost() +#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('addPost') +#8 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/addPost') +#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/addPost +HTTP_REFERER=http://localhost/cj/index.php?r=site/addPost +--- +2014/11/22 00:09:56 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:09:57 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'CURRENT_TIMESTAMP' for column 'date' at row 1. The SQL statement executed was: INSERT INTO `tbl_post` (`date`, `username`, `title`, `text`, `imageFileName`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4). +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (160) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:09:57 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'CURRENT_TIMESTAMP' for column 'date' at row 1. The SQL statement executed was: INSERT INTO `tbl_post` (`date`, `username`, `title`, `text`, `imageFileName`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)' 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(160): CActiveRecord->save() +#3 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionAddPost() +#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('addPost') +#8 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/addPost') +#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/addPost +HTTP_REFERER=http://localhost/cj/index.php?r=site/addPost +--- +2014/11/22 00:11:53 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:11:53 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'CURRENT_TIMESTAMP' for column 'date' at row 1. The SQL statement executed was: INSERT INTO `tbl_post` (`date`, `username`, `title`, `text`, `imageFileName`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4). +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (160) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:11:53 [error] [exception.CDbException] exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'CURRENT_TIMESTAMP' for column 'date' at row 1. The SQL statement executed was: INSERT INTO `tbl_post` (`date`, `username`, `title`, `text`, `imageFileName`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)' 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(160): CActiveRecord->save() +#3 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionAddPost() +#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('addPost') +#8 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/addPost') +#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/addPost +HTTP_REFERER=http://localhost/cj/index.php?r=site/addPost +--- +2014/11/22 00:15:31 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:16:01 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 00:18:12 [warning] [application] Failed to set unsafe attribute "image" of "AddPostForm". +in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (134) +in C:\Workplace\Apache2.4\htdocs\cj\index.php (13) +2014/11/22 02:45:13 [error] [php] Missing argument 2 for YiiBase::t(), called in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\login.php on line 26 and defined (C:\Workplace\yii1.1.15\framework\YiiBase.php:577) +Stack trace: +#0 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal() +#1 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile() +#2 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial() +#3 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(84): SiteController->render() +#4 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionLogin() +#5 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams() +#6 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction() +#7 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters() +#8 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run() +#9 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController() +#10 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest() +#11 C:\Workplace\Apache2.4\htdocs\cj\index.php(19): CWebApplication->run() +REQUEST_URI=/cj/index.php?r=site/login +2014/11/22 02:58:17 [error] [exception.CException] exception 'CException' with message 'Alias "components.LangBox" is invalid. Make sure it points to an existing directory or file.' in C:\Workplace\yii1.1.15\framework\YiiBase.php:347 +Stack trace: +#0 C:\Workplace\yii1.1.15\framework\web\CWidgetFactory.php(146): YiiBase::import('components.Lang...', true) +#1 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(146): CWidgetFactory->createWidget(Object(SiteController), 'components.Lang...', Array) +#2 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(189): CBaseController->createWidget('components.Lang...', Array) +#3 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\main.php(30): CBaseController->beginWidget('components.Lang...') +#4 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#5 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#6 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(76): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#7 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(54): CContentDecorator->decorate('
run() +#10 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(300): CBaseController->endWidget('CContentDecorat...') +#11 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\column1.php(6): CBaseController->endContent() +#12 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#13 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#14 C:\Workplace\yii1.1.15\framework\web\CController.php(784): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#15 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(43): CController->render('index', Array) +#16 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionIndex() +#17 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams(Array) +#18 C:\Workplace\yii1.1.15\framework\web\CController.php(286): CController->runAction(Object(CInlineAction)) +#19 C:\Workplace\yii1.1.15\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array) +#20 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): CController->run('index') +#21 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController('site/index') +#22 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest() +#23 C:\Workplace\Apache2.4\htdocs\cj\index.php(19): CApplication->run() +#24 {main} +REQUEST_URI=/cj/index.php?r=site/index +HTTP_REFERER=http://localhost/cj/index.php?r=site/index +--- +2014/11/22 02:58:30 [error] [exception.CException] exception 'CException' with message 'LangBox cannot find the view "langBox".' in C:\Workplace\yii1.1.15\framework\web\widgets\CWidget.php:246 +Stack trace: +#0 C:\Workplace\Apache2.4\htdocs\cj\protected\components\LangBox.php(7): CWidget->render('langBox', Array) +#1 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(206): LangBox->run() +#2 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\main.php(31): CBaseController->endWidget() +#3 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#4 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#5 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(76): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#6 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(54): CContentDecorator->decorate('
run() +#9 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(300): CBaseController->endWidget('CContentDecorat...') +#10 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\column1.php(6): CBaseController->endContent() +#11 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#12 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#13 C:\Workplace\yii1.1.15\framework\web\CController.php(784): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#14 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(43): 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(19): CApplication->run() +#23 {main} +REQUEST_URI=/cj/index.php?r=site/index +--- +2014/11/22 02:58:52 [error] [exception.CException] exception 'CException' with message 'LangBox cannot find the view "views.langBox".' in C:\Workplace\yii1.1.15\framework\web\widgets\CWidget.php:246 +Stack trace: +#0 C:\Workplace\Apache2.4\htdocs\cj\protected\components\LangBox.php(7): CWidget->render('views.langBox', Array) +#1 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(206): LangBox->run() +#2 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\main.php(31): CBaseController->endWidget() +#3 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#4 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#5 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(76): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#6 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(54): CContentDecorator->decorate('
run() +#9 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(300): CBaseController->endWidget('CContentDecorat...') +#10 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\column1.php(6): CBaseController->endContent() +#11 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#12 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#13 C:\Workplace\yii1.1.15\framework\web\CController.php(784): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#14 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(43): 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(19): CApplication->run() +#23 {main} +REQUEST_URI=/cj/index.php?r=site/index +--- +2014/11/22 03:00:26 [error] [exception.CException] exception 'CException' with message 'LangBox cannot find the view "views.site.langBox".' in C:\Workplace\yii1.1.15\framework\web\widgets\CWidget.php:246 +Stack trace: +#0 C:\Workplace\Apache2.4\htdocs\cj\protected\components\LangBox.php(7): CWidget->render('views.site.lang...', Array) +#1 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(206): LangBox->run() +#2 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\main.php(31): CBaseController->endWidget() +#3 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#4 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#5 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(76): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#6 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(54): CContentDecorator->decorate('
run() +#9 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(300): CBaseController->endWidget('CContentDecorat...') +#10 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\column1.php(6): CBaseController->endContent() +#11 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#12 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#13 C:\Workplace\yii1.1.15\framework\web\CController.php(784): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#14 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(43): 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(19): CApplication->run() +#23 {main} +REQUEST_URI=/cj/index.php?r=site/index +--- +2014/11/22 03:00:33 [error] [exception.CException] exception 'CException' with message 'LangBox cannot find the view "langBox".' in C:\Workplace\yii1.1.15\framework\web\widgets\CWidget.php:246 +Stack trace: +#0 C:\Workplace\Apache2.4\htdocs\cj\protected\components\LangBox.php(7): CWidget->render('langBox', Array) +#1 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(206): LangBox->run() +#2 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\main.php(31): CBaseController->endWidget() +#3 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#4 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#5 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(76): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#6 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(54): CContentDecorator->decorate('
run() +#9 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(300): CBaseController->endWidget('CContentDecorat...') +#10 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\column1.php(6): CBaseController->endContent() +#11 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#12 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#13 C:\Workplace\yii1.1.15\framework\web\CController.php(784): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#14 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(43): 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(19): CApplication->run() +#23 {main} +REQUEST_URI=/cj/index.php?r=site/index +--- +2014/11/22 03:01:14 [error] [exception.CException] exception 'CException' with message 'LangBox cannot find the view "langBox".' in C:\Workplace\yii1.1.15\framework\web\widgets\CWidget.php:246 +Stack trace: +#0 C:\Workplace\Apache2.4\htdocs\cj\protected\components\LangBox.php(7): CWidget->render('langBox', Array) +#1 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(206): LangBox->run() +#2 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\main.php(31): CBaseController->endWidget() +#3 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#4 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#5 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(76): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#6 C:\Workplace\yii1.1.15\framework\web\widgets\CContentDecorator.php(54): CContentDecorator->decorate('
run() +#9 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(300): CBaseController->endWidget('CContentDecorat...') +#10 C:\Workplace\Apache2.4\htdocs\cj\protected\views\layouts\column1.php(6): CBaseController->endContent() +#11 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require('C:\\Workplace\\Ap...') +#12 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): CBaseController->renderInternal('C:\\Workplace\\Ap...', Array, true) +#13 C:\Workplace\yii1.1.15\framework\web\CController.php(784): CBaseController->renderFile('C:\\Workplace\\Ap...', Array, true) +#14 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(43): 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(19): CApplication->run() +#23 {main} +REQUEST_URI=/cj/index.php?r=site/index +HTTP_REFERER=http://localhost/cj/index.php?r=site/page&view=about +--- +2014/11/22 03:11:38 [error] [php] Indirect modification of overloaded element of CCookieCollection has no effect (C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php:33) +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(19): CWebApplication->run() +REQUEST_URI=/cj/index.php?r=site/index +2014/11/22 03:11:48 [error] [php] Undefined variable: lang (C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php:34) +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(19): CWebApplication->run() +REQUEST_URI=/cj/index.php?r=site/index +2014/11/22 03:11:51 [error] [php] Undefined variable: lang (C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php:34) +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(19): CWebApplication->run() +REQUEST_URI=/cj/index.php?r=site/index diff --git a/yii/protected/views/layouts/main.php b/yii/protected/views/layouts/main.php index 909d2e2..9ed4931 100644 --- a/yii/protected/views/layouts/main.php +++ b/yii/protected/views/layouts/main.php @@ -23,23 +23,31 @@
+ +
+ beginWidget('LangBox'); ?> + endWidget(); ?> +
+ breadcrumbs)):?> widget('zii.widgets.CBreadcrumbs', array( 'links'=>$this->breadcrumbs, + 'homeLink' => CHtml::link(Yii::t('app', 'Main'), Yii::app()->homeUrl), )); ?> @@ -48,8 +56,8 @@
diff --git a/yii/protected/views/site/_view.php b/yii/protected/views/site/_view.php index a9af29f..61783dc 100644 --- a/yii/protected/views/site/_view.php +++ b/yii/protected/views/site/_view.php @@ -1,13 +1,13 @@ pageTitle=Yii::app()->name; +$this->pageTitle=Yii::t('app', Yii::app()->name); ?>
-

title; ?>

-

username; ?>

+

title; ?>

text; ?>

- - \ No newline at end of file +
+username; ?>
+date; ?>
\ No newline at end of file diff --git a/yii/protected/views/site/addPost.php b/yii/protected/views/site/addPost.php index add432e..dfc161c 100644 --- a/yii/protected/views/site/addPost.php +++ b/yii/protected/views/site/addPost.php @@ -2,6 +2,8 @@ /* @var $this AddPostFormController */ /* @var $model AddPostForm */ /* @var $form CActiveForm */ + +$this->pageTitle=Yii::t('app', Yii::app()->name) . ' - ' . Yii::t('app', 'Add post'); ?>
@@ -16,10 +18,10 @@ 'htmlOptions' => array('enctype' => 'multipart/form-data'), )); ?> -

Fields with * are required.

- - errorSummary($model); ?> - +

'*'))?>

+ + errorSummary($model, Yii::t('app', 'Please, fix following errors:')); ?> +
labelEx($model,'title'); ?> textField($model,'title'); ?> @@ -39,7 +41,7 @@
- +
endWidget(); ?> diff --git a/yii/protected/views/site/index.php b/yii/protected/views/site/index.php index d94c660..3c8a1e4 100644 --- a/yii/protected/views/site/index.php +++ b/yii/protected/views/site/index.php @@ -1,10 +1,10 @@ pageTitle=Yii::app()->name; +$this->pageTitle=Yii::t('app', Yii::app()->name); ?> -

Welcome to name); ?>

+

widget('zii.widgets.CListView', array( diff --git a/yii/protected/views/site/langBox.php b/yii/protected/views/site/langBox.php new file mode 100644 index 0000000..a920e19 --- /dev/null +++ b/yii/protected/views/site/langBox.php @@ -0,0 +1,7 @@ + + +
+ 'English', 'ru' => 'Русский', 'cn' => '中文'), array('submit' => array('site/index'))); ?> +
+ diff --git a/yii/protected/views/site/login.php b/yii/protected/views/site/login.php index 75463f8..1311f24 100644 --- a/yii/protected/views/site/login.php +++ b/yii/protected/views/site/login.php @@ -3,15 +3,13 @@ /* @var $model LoginForm */ /* @var $form CActiveForm */ -$this->pageTitle=Yii::app()->name . ' - Login'; -$this->breadcrumbs=array( - 'Login', -); +$this->pageTitle=Yii::t('app', Yii::app()->name) . ' - ' . Yii::t('app', 'Login'); + ?> -

Login

+

-

Please fill out the following form with your login credentials:

+

beginWidget('CActiveForm', array( @@ -22,8 +20,11 @@ $this->breadcrumbs=array( ), )); ?> -

Fields with * are required.

+

'*'))?>

+ + errorSummary($model, Yii::t('app', 'Please, fix following errors:')); ?> +
labelEx($model,'username'); ?> textField($model,'username'); ?> @@ -43,10 +44,10 @@ $this->breadcrumbs=array(
- +
endWidget(); ?> - - +
+
diff --git a/yii/protected/views/site/pages/about.php b/yii/protected/views/site/pages/about.php index d8aa3c5..bdf340c 100644 --- a/yii/protected/views/site/pages/about.php +++ b/yii/protected/views/site/pages/about.php @@ -1,12 +1,9 @@ pageTitle=Yii::app()->name . ' - About'; -$this->breadcrumbs=array( - 'About', -); -?> -

About

+$this->pageTitle=Yii::app()->name . ' - About journal'; -

This is a "static" page. You may change the content of this page -by updating the file .

+?> +

About journal

+ +

This journal is devoted to China and Chinese language

diff --git a/yii/protected/views/site/pages/cn/about.php b/yii/protected/views/site/pages/cn/about.php new file mode 100644 index 0000000..d2824e6 --- /dev/null +++ b/yii/protected/views/site/pages/cn/about.php @@ -0,0 +1,9 @@ +pageTitle=Yii::app()->name . ' - 关于日报'; + +?> +

关于日报

+ +

本日报适用于学习中国文化及中文学习者.

diff --git a/yii/protected/views/site/pages/ru/about.php b/yii/protected/views/site/pages/ru/about.php new file mode 100644 index 0000000..198b799 --- /dev/null +++ b/yii/protected/views/site/pages/ru/about.php @@ -0,0 +1,9 @@ +pageTitle=Yii::app()->name . ' - О журнале'; + +?> +

О журнале

+ +

Это журнал, посвященный Китаю и изучению Китайского языка.

diff --git a/yii/protected/views/site/register.php b/yii/protected/views/site/register.php index cf62dcd..e01c17e 100644 --- a/yii/protected/views/site/register.php +++ b/yii/protected/views/site/register.php @@ -2,6 +2,8 @@ /* @var $this RegisterFormController */ /* @var $model RegisterForm */ /* @var $form CActiveForm */ + +$this->pageTitle=Yii::t('app', Yii::app()->name) . ' - ' . Yii::t('app', 'Register'); ?>
@@ -14,10 +16,13 @@ // you need to use the performAjaxValidation()-method described there. 'enableAjaxValidation'=>false, )); ?> +

-

Fields with * are required.

+

- errorSummary($model); ?> +

'*'))?>

+ + errorSummary($model, Yii::t('app', 'Please, fix following errors:')); ?>
labelEx($model,'username'); ?> @@ -37,9 +42,14 @@ error($model,'email'); ?>
+
+ + widget('CCaptcha'); ?>
+ +
- +
endWidget(); ?>