Updated bootstrap and many other items
This commit is contained in:
@@ -56,13 +56,7 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _auth_required() {
|
||||
// If our global configurable is disabled, then continue
|
||||
if (! Kohana::$config->load('config')->method_security)
|
||||
return FALSE;
|
||||
|
||||
return (($this->auth_required !== FALSE && Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__) === FALSE) ||
|
||||
(is_array($this->secure_actions) && array_key_exists($this->request->action(),$this->secure_actions) &&
|
||||
! Auth::instance()->logged_in($this->secure_actions[$this->request->action()],get_class($this).'|'.__METHOD__)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,16 +66,6 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
* @uses meta
|
||||
*/
|
||||
public function before() {
|
||||
if ($this->auth_required) {
|
||||
if (! count($this->secure_actions) OR (! isset($this->secure_actions[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();
|
||||
|
||||
if (! is_null($this->ao) AND (is_string($this->ao) OR ! $this->ao->loaded()))
|
||||
throw HTTP_Exception::factory(501,'Account doesnt exist :account ?',array(':account'=>(is_string($this->ao) OR is_null($this->ao)) ? $this->ao : Auth::instance()->get_user()->id));
|
||||
}
|
||||
|
||||
// Actions that start with ajax, should only be ajax
|
||||
if (! Kohana::$config->load('debug')->ajax AND preg_match('/^ajax/',Request::current()->action()) AND ! Request::current()->is_ajax())
|
||||
throw HTTP_Exception::factory(412,_('Unable to fulfil request.'));
|
||||
@@ -94,6 +78,9 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->ao AND $this->ao->loaded() AND ! $this->ao->activated() AND ($this->request->controller() != 'Account' OR $this->request->action() != 'activate'))
|
||||
HTTP::redirect('login/activate');
|
||||
|
||||
// Check user auth and role
|
||||
if ($this->_auth_required()) {
|
||||
if (PHP_SAPI === 'cli')
|
||||
@@ -187,30 +174,18 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
$this->check_cache(sha1($this->response->body()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a view path to help View::factory() calls
|
||||
*
|
||||
* The purpose of this method is to ensure that we have a consistant
|
||||
* layout for our view files, including those that are needed by
|
||||
* plugins
|
||||
*
|
||||
* @param string Plugin Name (optional)
|
||||
* @deprecated
|
||||
*/
|
||||
public function viewpath($plugin='') {
|
||||
$request = Request::current();
|
||||
protected function save(Model $o) {
|
||||
try {
|
||||
return $o->save();
|
||||
|
||||
$path = $request->controller();
|
||||
} catch (ORM_Validation_Exception $e) {
|
||||
SystemMessage::factory()
|
||||
->title('Record NOT updated')
|
||||
->type('danger')
|
||||
->body(join('<br/>',array_values($e->errors('models'))));
|
||||
|
||||
if ($request->directory())
|
||||
$path .= ($path ? '/' : '').$request->directory();
|
||||
|
||||
if ($plugin)
|
||||
$path .= ($path ? '/' : '').$plugin;
|
||||
|
||||
$path .= ($path ? '/' : '').$request->action();
|
||||
|
||||
return strtolower($path);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user