From 1854075a62c6ca0422040b4e5ebf89088b0d02b2 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 15 Feb 2011 00:32:19 +0000 Subject: added wiki - part 1 --- .../Application/Controllers/UsersController.php | 32 ++++++++++------------ 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'h-source/Application/Controllers/UsersController.php') diff --git a/h-source/Application/Controllers/UsersController.php b/h-source/Application/Controllers/UsersController.php index 1249647..7f42a2a 100644 --- a/h-source/Application/Controllers/UsersController.php +++ b/h-source/Application/Controllers/UsersController.php @@ -42,28 +42,20 @@ class UsersController extends BaseController $this->append($data); } - public function login($lang = 'en', $type = null,$the_action = null,$the_id = null) + public function login($lang = 'en') { $data = array(); if ( strcmp($this->_updating,'no') === 0 ) { $data['flag'] = isset($type) ? 'setted' : null; - $html['type'] = in_array($type,Hardware::$controllers) ? sanitizeAll($type) : 'notebooks'; - $html['the_action'] = sanitizeAlphanum($the_action); - $html['the_id'] = (int)$the_id; $html['lang'] = Lang::sanitize($lang); $data['title'] = 'Login - '.Website::$generalName; + + $redirect = $this->request->get('redirect','','sanitizeAll'); - if (isset($type)) - { - $data['action'] = Url::getRoot("users/login/".$html['lang']."/".$html['type']."/".$html['the_action']."/".$html['the_id']); - } - else - { - $data['action'] = Url::getRoot("users/login/".$html['lang']); - } + $data['action'] = Url::getRoot("users/login/".$this->lang."?redirect=$redirect"); $data['notice'] = null; @@ -82,11 +74,9 @@ class UsersController extends BaseController $this->redirect('home/index/'.Lang::$current,3,'You are already logged...'); break; case 'accepted': - if (isset($type)) + if (strcmp($redirect,'') !== 0) { - $address = strcmp($html['the_action'],'view') === 0 ? $html['type']."/view/".$html['lang']."/".$html['the_id'] : $html['type']."/catalogue/".$html['lang']; - - $this->redirect($address,0); + $this->redirect($redirect,0); } else { @@ -117,7 +107,15 @@ class UsersController extends BaseController } else if ($res === 'was-logged') { - $this->redirect('home/index/'.Lang::$current,0); + $redirect = $this->request->get('redirect','','sanitizeAll'); + if (strcmp($redirect,'') !== 0) + { + $this->redirect($redirect,0); + } + else + { + $this->redirect('home/index/'.Lang::$current,0); + } } else if ($res === 'error') { -- cgit v1.2.3