Application cleanup

This commit is contained in:
Deon George
2013-05-10 20:48:10 +10:00
parent 970b2ef4f0
commit c0ba6d4e98
36 changed files with 284 additions and 544 deletions

View File

@@ -10,7 +10,7 @@
* @license http://dev.osbill.net/license.html
*/
class Controller_Account extends Controller_TemplateDefault {
public function action_group() {
protected function group() {
// List all available groups for this user.
$output = '';

View File

@@ -11,7 +11,6 @@
*/
class Controller_Admin_Account extends Controller_Account {
protected $secure_actions = array(
'group'=>FALSE, // @todo Testing
);
}
?>

View File

@@ -72,22 +72,21 @@ class Controller_Login extends lnApp_Controller_Login {
// Show our token screen even if the email was invalid.
if (isset($_POST['username']))
Block::add(array(
'title'=>_('Reset your password'),
'body'=>View::factory('login_reset_sent'),
'style'=>array('css/login.css'=>'screen'),
));
Block::factory()
->body(View::factory('pages/login_reset_sent'));
else
HTTP::redirect('login');
} else {
Block::add(array(
'title'=>_('Reset your password'),
'body'=>View::factory('login_reset'),
'style'=>array('css/login.css'=>'screen'),
));
Block::factory()
->body(View::factory('pages/login_reset'));
}
Style::factory()
->type('file')
->data('media/theme/baseadmin/css/pages/login.css');
$this->template->shownavbar = FALSE;
}
}

View File

@@ -28,7 +28,7 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
if ($this->auth_required) {
if (! count($this->secure_actions) OR (! isset($this->secure_actions[Request::current()->action()])))
throw new Kohana_Exception('Class has no security defined :class, or no security configured for :method',array(':class'=>get_class($this),':method'=>Request::current()->action()));
throw HTTP_Exception::factory(403,'Class has no security defined :class, or no security configured for :method',array(':class'=>get_class($this),':method'=>Request::current()->action()));
$this->ao = Auth::instance()->get_user();
@@ -39,8 +39,9 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
parent::before();
}
// @todo To rework
public function after() {
$dc = Kohana::$config->load('config','user_default_method');
$dc = 'u/welcome/index';
$m = sprintf('%s/%s',Request::current()->directory(),Request::current()->controller());
BreadCrumb::URL(Request::current()->directory(),sprintf('%s/%s',Request::current()->directory(),$dc),FALSE);
@@ -51,21 +52,14 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
/**
* This will filter a search query to only return those accounts for a reseller
* @todo Swap the order of these params and make flid necessary
*/
protected function filter($o,$af,$sort=NULL,$afid=NULL) {
protected function filter($o,array $fl,$sort=NULL,$flid=NULL) {
$result = array();
foreach ($o as $x) {
if (! is_null($afid) AND isset($x->$afid)) {
if ((is_array($af) AND in_array($x->$afid,$af)) OR ($x->$afid == $af))
array_push($result,$x);
} elseif (method_exists($x,'list_reseller')) {
if (in_array($af,$x->list_reseller()))
array_push($result,$x);
}
}
foreach ($o as $x)
if (! is_null($flid) AND isset($x->$flid) AND in_array($x->$flid,$fl))
array_push($result,$x);
if ($sort)
Sort::MAsort($result,$sort);

View File

@@ -12,6 +12,12 @@
class Controller_Welcome extends Controller_TemplateDefault {
protected $auth_required = FALSE;
public function action_breadcrumb() {
$this->auto_render = FALSE;
$this->response->body(Session::instance()->get_once('breadcrumb'));
}
public function action_index() {
if (! Kohana::$config->load('config')->appname)
HTTP::redirect('guide/app');
@@ -25,11 +31,5 @@ class Controller_Welcome extends Controller_TemplateDefault {
$this->template->content = $output;
}
public function action_breadcrumb() {
$this->auto_render = FALSE;
$this->response->body(Session::instance()->get_once('breadcrumb'));
}
}
?>