Website is working!
This commit is contained in:
1 parent
c978ba8e19
commit
2ed0710575
24 files changed
+644
-119
No files matched your search
@@ -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();
|
||||
|
||||
|
||||
Reference in new issue
Block a user