Skip to content

Instantly share code, notes, and snippets.

@Javlopez
Created November 10, 2011 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Javlopez/1354210 to your computer and use it in GitHub Desktop.
Save Javlopez/1354210 to your computer and use it in GitHub Desktop.
Backend controller access: localhost/kohana1/backend
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Controller_Backend
*
* Este es el backend de una aplicacion que esta usando A1 como metodo de autenticación
*
* @author Javier
* @package Backend
*
*/
class Controller_Backend extends Controller {
/**
*
* @var User $auth contains object a1 user
*/
public $auth;
/**
* (non-PHPdoc)
* @see system/classes/kohana/Kohana_Controller::before()
*/
public function before()
{
parent::before();
$this->auth = A1::instance();
$this->_prevent_back();
if($this->auth->logged_in()=== FALSE)
{
$this->request->redirect(Route::url('default',array('controller' => 'account', 'action' => 'login')));
return;
}
view::set_global('logout',Route::url('default',array('controller' => 'account', 'action' => 'logout')));
}
public function action_index()
{
$view = View::factory("backend/home")
->set("auth",$this->auth);
$this->response->body($view);
}
private function _prevent_back()
{
$this->response->headers("Cache-Control","no-store, no-cache, must-revalidate");
}
} // End Welcome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment