<?php
/*------------------------------------------------------------------------------
$Id$
AbanteCart, Ideal OpenSource Ecommerce Solution
http://www.AbanteCart.com
Copyright © 2011 Belavier Commerce LLC
Released under the GNU General Public License
Lincence details is bundled with this package in the file LICENSE.txt.
It is also available at this URL:
<http://www.gnu.org/licenses/>
UPGRADE NOTE:
Do not edit or add to this file if you wish to upgrade AbanteCart to newer
versions in the future. If you wish to customize AbanteCart for your
needs please refer to http://www.AbanteCart.com for more information.
------------------------------------------------------------------------------*/
if (! defined ( 'DIR_CORE' ) || !IS_ADMIN) {
header ( 'Location: static_pages/' );
}
class ControllerCommonHome extends AController {
public function login() {
if (isset($this->request->get['rt']) && !isset($this->request->get['token'])) {
$route = '';
$part = explode('/', $this->request->get['rt']);
if (isset($part[0])) {
$route .= $part[0];
}
if (isset($part[1])) {
$route .= '/' . $part[1];
}
$ignore = array(
'index/login',
'index/logout',
'index/forgot_password',
'error/not_found',
'error/permission'
);
if (!in_array($route, $ignore)) {
return $this->dispatch('pages/index/login');
}
} else {
if (!isset($this->request->get['token']) || !isset($this->session->data['token']) || ($this->request->get['token'] != $this->session->data['token'])) {
return $this->dispatch('pages/index/login');
}
}
}
public function permission() {
//init controller data
$this->extensions->hk_InitData($this);
if (isset($this->request->get['rt'])) {
$route = '';
$part = explode('/', $this->request->get['rt']);
if (isset($part[0])) {
$route .= $part[0];
}
if (isset($part[1])) {
$route .= '/' . $part[1];
}
$ignore = array(
'index/home',
'index/login',
'index/logout',
'index/forgot_password',
'index/edit_details',
'error/not_found',
'error/permission',
'error/token'
);
if (!in_array($route, $ignore)) {
if (!$this->user->hasPermission('access', $route)) {
return $this->dispatch('pages/error/permission');
}
}
}
//update controller data
$this->extensions->hk_UpdateData($this);
}
}
?>