less passing of $page

This commit is contained in:
Shish 2012-02-15 08:59:24 +00:00
parent c70d81c97d
commit c2bf42ef5a
15 changed files with 33 additions and 17 deletions

View file

@ -41,7 +41,7 @@ class AdminPage extends Extension {
if($event->page_matches("admin")) { if($event->page_matches("admin")) {
if(!$user->is_admin()) { if(!$user->is_admin()) {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} }
else { else {
send_event(new AdminBuildingEvent($page)); send_event(new AdminBuildingEvent($page));

View file

@ -66,7 +66,7 @@ class Blotter extends Extension {
* Displays the blotter editor. * Displays the blotter editor.
*/ */
if(!$user->is_admin()) { if(!$user->is_admin()) {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} else { } else {
$entries = $database->get_all("SELECT * FROM blotter ORDER BY id DESC"); $entries = $database->get_all("SELECT * FROM blotter ORDER BY id DESC");
$this->theme->display_editor($entries); $this->theme->display_editor($entries);
@ -77,7 +77,7 @@ class Blotter extends Extension {
* Adds an entry * Adds an entry
*/ */
if(!$user->is_admin() || !$user->check_auth_token()) { if(!$user->is_admin() || !$user->check_auth_token()) {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} else { } else {
$entry_text = $_POST['entry_text']; $entry_text = $_POST['entry_text'];
if($entry_text == "") { die("No entry message!"); } if($entry_text == "") { die("No entry message!"); }
@ -95,7 +95,7 @@ class Blotter extends Extension {
* Removes an entry * Removes an entry
*/ */
if(!$user->is_admin() || !$user->check_auth_token()) { if(!$user->is_admin() || !$user->check_auth_token()) {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} else { } else {
$id = int_escape($_POST['id']); $id = int_escape($_POST['id']);
if(!isset($id)) { die("No ID!"); } if(!isset($id)) { die("No ID!"); }

View file

@ -73,7 +73,7 @@ class IPBan extends Extension {
} }
} }
else { else {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} }
} }
} }

View file

@ -11,7 +11,7 @@ class Oekaki extends Extension {
if($event->page_matches("oekaki")) { if($event->page_matches("oekaki")) {
if(!$this->can_upload($user)) { if(!$this->can_upload($user)) {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} }
if($event->get_arg(0) == "create") { if($event->get_arg(0) == "create") {

View file

@ -126,7 +126,7 @@ class Wiki extends Extension {
} }
} }
else { else {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} }
} }
else if($event->page_matches("wiki_admin/delete_revision")) { else if($event->page_matches("wiki_admin/delete_revision")) {

View file

@ -142,7 +142,7 @@ class CommentList extends Extension {
} }
} }
else { else {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} }
} }
else if($event->get_arg(0) === "list") { else if($event->get_arg(0) === "list") {

View file

@ -188,7 +188,7 @@ class Setup extends Extension {
if($event->page_matches("setup")) { if($event->page_matches("setup")) {
if(!$user->can("change_setting")) { if(!$user->can("change_setting")) {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} }
else { else {
if($event->get_arg(0) == "save" && $user->check_auth_token()) { if($event->get_arg(0) == "save" && $user->check_auth_token()) {

View file

@ -124,7 +124,7 @@ class Upload extends Extension {
// check if the user is an administrator and can upload files. // check if the user is an administrator and can upload files.
if(!$user->can("replace_image")) { if(!$user->can("replace_image")) {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} }
else { else {
if($this->is_full) { if($this->is_full) {
@ -182,7 +182,7 @@ class Upload extends Extension {
} }
else if($event->page_matches("upload")) { else if($event->page_matches("upload")) {
if(!$this->can_upload($user)) { if(!$this->can_upload($user)) {
$this->theme->display_permission_denied($page); $this->theme->display_permission_denied();
} }
else { else {
/* Regular Upload Image */ /* Regular Upload Image */

View file

@ -9,7 +9,8 @@ class Themelet {
} }
public function display_permission_denied(Page $page) { public function display_permission_denied() {
global $page;
$page->add_http_header("HTTP/1.0 403 Permission Denied"); $page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page"); $this->display_error($page, "Permission Denied", "You do not have permission to access this page");
} }

View file

@ -17,7 +17,8 @@ class Themelet {
/** /**
* A specific, common error message * A specific, common error message
*/ */
public function display_permission_denied(Page $page) { public function display_permission_denied() {
global $page;
$page->add_http_header("HTTP/1.0 403 Permission Denied"); $page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page"); $this->display_error($page, "Permission Denied", "You do not have permission to access this page");
} }

View file

@ -17,7 +17,8 @@ class Themelet {
/** /**
* A specific, common error message * A specific, common error message
*/ */
public function display_permission_denied(Page $page) { public function display_permission_denied() {
global $page;
$page->add_http_header("HTTP/1.0 403 Permission Denied"); $page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page"); $this->display_error($page, "Permission Denied", "You do not have permission to access this page");
} }

View file

@ -12,6 +12,16 @@ class Themelet {
} }
/**
* A specific, common error message
*/
public function display_permission_denied() {
global $page;
$page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page");
}
/** /**
* Generic thumbnail code; returns HTML rather than adding * Generic thumbnail code; returns HTML rather than adding
* a block since thumbs tend to go inside blocks... * a block since thumbs tend to go inside blocks...

View file

@ -17,7 +17,8 @@ class Themelet {
/** /**
* A specific, common error message * A specific, common error message
*/ */
public function display_permission_denied(Page $page) { public function display_permission_denied() {
global $page;
$page->add_http_header("HTTP/1.0 403 Permission Denied"); $page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page"); $this->display_error($page, "Permission Denied", "You do not have permission to access this page");
} }

View file

@ -15,7 +15,8 @@ class Themelet {
/** /**
* A specific, common error message * A specific, common error message
*/ */
public function display_permission_denied(Page $page) { public function display_permission_denied() {
global $page;
$page->add_http_header("HTTP/1.0 403 Permission Denied"); $page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page"); $this->display_error($page, "Permission Denied", "You do not have permission to access this page");
} }

View file

@ -17,7 +17,8 @@ class Themelet {
/** /**
* A specific, common error message * A specific, common error message
*/ */
public function display_permission_denied(Page $page) { public function display_permission_denied() {
global $page;
$page->add_http_header("HTTP/1.0 403 Permission Denied"); $page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page"); $this->display_error($page, "Permission Denied", "You do not have permission to access this page");
} }