mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-06-22 17:29:57 -04:00
Move security into the constructor. Protecting the index() call is easily bypassed.
This commit is contained in:
@@ -20,16 +20,16 @@
|
||||
class Scaffold_Controller extends Template_Controller {
|
||||
public $template = "scaffold.html";
|
||||
|
||||
function index() {
|
||||
try {
|
||||
$session = Session::instance();
|
||||
} catch (Exception $e) {
|
||||
public function __construct($theme=null) {
|
||||
if (!(user::active()->admin)) {
|
||||
throw new Exception("@todo UNAUTHORIZED", 401);
|
||||
}
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index() {
|
||||
$session = Session::instance();
|
||||
|
||||
if (!user::active()->admin) {
|
||||
throw new Exception("@todo FORBIDDEN", 503);
|
||||
}
|
||||
|
||||
set_error_handler(array("Scaffold_Controller", "_error_handler"));
|
||||
try {
|
||||
$this->template->album_count = ORM::factory("item")->where("type", "album")->count_all();
|
||||
|
||||
Reference in New Issue
Block a user