consistency

git-svn-id: file:///home/shish/svn/shimmie2/trunk@312 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-17 07:45:35 +00:00
parent b782b3e970
commit 0c5f7244db
30 changed files with 81 additions and 92 deletions

View file

@ -13,7 +13,7 @@ class AdminUtils extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("admin_utils", "AdminUtilsTheme"); if(is_null($this->theme)) $this->theme = get_theme_object("admin_utils", "AdminUtilsTheme");
if(is_a($event, 'PageRequestEvent') && ($event->page == "admin_utils")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "admin_utils")) {
global $user; global $user;
if($user->is_admin()) { if($user->is_admin()) {
set_time_limit(0); set_time_limit(0);
@ -30,9 +30,8 @@ class AdminUtils extends Extension {
break; break;
} }
global $page; $event->page->set_mode("redirect");
$page->set_mode("redirect"); $event->page->set_redirect(make_link("admin"));
$page->set_redirect(make_link("admin"));
} }
} }

View file

@ -9,15 +9,13 @@
class AutoComplete extends Extension { class AutoComplete extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_a($event, 'PageRequestEvent') && ($event->page == "index" || $event->page == "view")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index" || $event->page_name == "view")) {
global $page; $event->page->add_header("<script>autocomplete_url='".html_escape(make_link("autocomplete"))."';</script>");
$page->add_header("<script>autocomplete_url='".html_escape(make_link("autocomplete"))."';</script>");
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "autocomplete")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "autocomplete")) {
global $page; $event->page->set_mode("data");
$page->set_mode("data"); $event->page->set_type("text/plain");
$page->set_type("text/plain"); $event->page->set_data($this->get_completions($event->get_arg(0)));
$page->set_data($this->get_completions($event->get_arg(0)));
} }
} }

View file

@ -13,7 +13,7 @@ class Home extends Extension {
public function receive_event($event) { public function receive_event($event) {
global $page; global $page;
if(is_a($event, 'PageRequestEvent') && ($event->page == "home")) if(is_a($event, 'PageRequestEvent') && ($event->page_name == "home"))
{ {
// this is a request to display this page so output the page. // this is a request to display this page so output the page.
$this->output_pages(); $this->output_pages();

View file

@ -5,12 +5,11 @@ class LinkImage extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("link_image", "LinkImageTheme"); if(is_null($this->theme)) $this->theme = get_theme_object("link_image", "LinkImageTheme");
if(is_a($event, 'DisplayingImageEvent')) { if(is_a($event, 'DisplayingImageEvent')) {
global $page;
global $config; global $config;
$data_href = $config->get_string("data_href"); $data_href = get_base_href();
$page->add_header("<link rel='stylesheet' href='$data_href/ext/link_image/_style.css' type='text/css'>",0); $event->page->add_header("<link rel='stylesheet' href='$data_href/ext/link_image/_style.css' type='text/css'>",0);
$this->theme->links_block($page,$this->data($event->image)); $this->theme->links_block($event->page,$this->data($event->image));
} }
if(is_a($event, 'SetupBuildingEvent')) { if(is_a($event, 'SetupBuildingEvent')) {
$sb = new SetupBlock("Link to Image"); $sb = new SetupBlock("Link to Image");
@ -20,12 +19,10 @@ class LinkImage extends Extension {
if(is_a($event, 'InitExtEvent')) { if(is_a($event, 'InitExtEvent')) {
global $config; global $config;
//just set default if empty. //just set default if empty.
if ($config->get_string("ext_link-img_text-link_format") == "") { $config->set_default_string("ext_link-img_text-link_format",
$config->set_string("ext_link-img_text-link_format",
'$title - $id ($ext $size $filesize)'); '$title - $id ($ext $size $filesize)');
} }
} }
}
private function data($image) { private function data($image) {
global $config; global $config;

View file

@ -21,10 +21,9 @@ class Notes extends Extension {
} }
if(is_a($event, 'DisplayingImageEvent')) { if(is_a($event, 'DisplayingImageEvent')) {
global $page;
global $database; global $database;
$notes = $database->db->GetAll("SELECT * FROM image_notes WHERE image_id = ?", array($event->image->id)); $notes = $database->db->GetAll("SELECT * FROM image_notes WHERE image_id = ?", array($event->image->id));
$this->theme->display_notes($page, $notes); $this->theme->display_notes($event->page, $notes);
} }
} }

View file

@ -10,7 +10,7 @@
class RSS_Comments extends Extension { class RSS_Comments extends Extension {
// event handling {{{ // event handling {{{
public function receive_event($event) { public function receive_event($event) {
if(is_a($event, 'PageRequestEvent') && ($event->page == "index")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) {
global $page; global $page;
global $config; global $config;
$title = $config->get_string('title'); $title = $config->get_string('title');
@ -18,7 +18,7 @@ class RSS_Comments extends Extension {
$page->add_header("<link rel=\"alternate\" type=\"application/rss+xml\" ". $page->add_header("<link rel=\"alternate\" type=\"application/rss+xml\" ".
"title=\"$title - Comments\" href=\"".make_link("rss/comments")."\" />"); "title=\"$title - Comments\" href=\"".make_link("rss/comments")."\" />");
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "rss")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "rss")) {
if($event->get_arg(0) == 'comments') { if($event->get_arg(0) == 'comments') {
global $database; global $database;
$this->do_rss($database); $this->do_rss($database);

View file

@ -12,10 +12,10 @@
class SiteDescription extends Extension { class SiteDescription extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_a($event, 'PageRequestEvent')) { if(is_a($event, 'PageRequestEvent')) {
global $page, $config; global $config;
if(strlen($config->get_string("site_description")) > 0) { if(strlen($config->get_string("site_description")) > 0) {
$description = $config->get_string("site_description"); $description = $config->get_string("site_description");
$page->add_header("<meta name=\"description\" content=\"$description\">"); $event->page->add_header("<meta name=\"description\" content=\"$description\">");
} }
} }
if(is_a($event, 'SetupBuildingEvent')) { if(is_a($event, 'SetupBuildingEvent')) {

View file

@ -10,7 +10,7 @@ class Tag_History extends Extension {
} }
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "tag_history")) if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tag_history"))
{ {
if($event->get_arg(0) == "revert") if($event->get_arg(0) == "revert")
{ {

View file

@ -60,7 +60,7 @@ class Wiki extends Extension {
$this->setup(); $this->setup();
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "wiki")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "wiki")) {
global $page; global $page;
$page->add_block(new NavBlock()); $page->add_block(new NavBlock());

View file

@ -12,14 +12,14 @@
* Used for initial page generation triggers * Used for initial page generation triggers
*/ */
class PageRequestEvent extends Event { class PageRequestEvent extends Event {
var $page; var $page_name;
var $args; var $args;
var $page_object; var $page;
public function PageRequestEvent($page, $args, $page_object) { public function PageRequestEvent($page_name, $args, $page) {
$this->page = $page; $this->page_name = $page_name;
$this->args = $args; $this->args = $args;
$this->page_object = $page_object; $this->page = $page;
} }
public function get_arg($n) { public function get_arg($n) {

View file

@ -363,24 +363,24 @@ function _get_query_parts() {
return split('/', $path); return split('/', $path);
} }
function _get_page_request($page_object) { function _get_page_request($page) {
global $config; global $config;
$args = _get_query_parts(); $args = _get_query_parts();
if(count($args) == 0 || strlen($args[0]) == 0) { if(count($args) == 0 || strlen($args[0]) == 0) {
$page = $config->get_string('front_page', 'index'); $page_name = $config->get_string('front_page', 'index');
$args = array(); $args = array();
} }
else if(count($args) == 1) { else if(count($args) == 1) {
$page = $args[0]; $page_name = $args[0];
$args = array(); $args = array();
} }
else { else {
$page = $args[0]; $page_name = $args[0];
$args = array_slice($args, 1); $args = array_slice($args, 1);
} }
return new PageRequestEvent($page, $args, $page_object); return new PageRequestEvent($page_name, $args, $page);
} }
function _get_user() { function _get_user() {

View file

@ -11,7 +11,7 @@ class AdminBuildingEvent extends Event {
class AdminPage extends Extension { class AdminPage extends Extension {
// event handler {{{ // event handler {{{
public function receive_event($event) { public function receive_event($event) {
if(is_a($event, 'PageRequestEvent') && ($event->page == "admin")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "admin")) {
global $user; global $user;
if(!$user->is_admin()) { if(!$user->is_admin()) {
global $page; global $page;

View file

@ -16,12 +16,16 @@ class AliasEditor extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("alias_editor", "AliasEditorTheme"); if(is_null($this->theme)) $this->theme = get_theme_object("alias_editor", "AliasEditorTheme");
if(is_a($event, 'PageRequestEvent') && ($event->page == "alias")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "alias")) {
global $user; global $user;
if($event->get_arg(0) == "add") { if($event->get_arg(0) == "add") {
if($user->is_admin()) { if($user->is_admin()) {
if(isset($_POST['oldtag']) && isset($_POST['newtag'])) { if(isset($_POST['oldtag']) && isset($_POST['newtag'])) {
send_event(new AddAliasEvent($_POST['oldtag'], $_POST['newtag'])); send_event(new AddAliasEvent($_POST['oldtag'], $_POST['newtag']));
global $page;
$event->page->set_mode("redirect");
$event->page->set_redirect(make_link("alias/list"));
} }
} }
} }
@ -31,32 +35,25 @@ class AliasEditor extends Extension {
global $database; global $database;
$database->Execute("DELETE FROM aliases WHERE oldtag=?", array($_POST['oldtag'])); $database->Execute("DELETE FROM aliases WHERE oldtag=?", array($_POST['oldtag']));
global $page; $event->page->set_mode("redirect");
$page->set_mode("redirect"); $event->page->set_redirect(make_link("alias/list"));
$page->set_redirect(make_link("alias/list"));
} }
} }
} }
else if($event->get_arg(0) == "list") { else if($event->get_arg(0) == "list") {
global $page;
global $database; global $database;
$this->theme->display_aliases($page, $database->db->GetAssoc("SELECT oldtag, newtag FROM aliases"), $user->is_admin()); $this->theme->display_aliases($event->page, $database->db->GetAssoc("SELECT oldtag, newtag FROM aliases"), $user->is_admin());
} }
else if($event->get_arg(0) == "export") { else if($event->get_arg(0) == "export") {
global $page; $event->page->set_mode("data");
$page->set_mode("data"); $event->page->set_type("text/plain");
$page->set_type("text/plain"); $event->page->set_data($this->get_alias_csv());
$page->set_data($this->get_alias_csv());
} }
} }
if(is_a($event, 'AddAliasEvent')) { if(is_a($event, 'AddAliasEvent')) {
global $database; global $database;
$database->Execute("INSERT INTO aliases(oldtag, newtag) VALUES(?, ?)", array($event->oldtag, $event->newtag)); $database->Execute("INSERT INTO aliases(oldtag, newtag) VALUES(?, ?)", array($event->oldtag, $event->newtag));
global $page;
$page->set_mode("redirect");
$page->set_redirect(make_link("alias/list"));
} }
if(is_a($event, 'UserBlockBuildingEvent')) { if(is_a($event, 'UserBlockBuildingEvent')) {

View file

@ -6,13 +6,13 @@ class BulkAdd extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("bulk_add", "BulkAddTheme"); if(is_null($this->theme)) $this->theme = get_theme_object("bulk_add", "BulkAddTheme");
if(is_a($event, 'PageRequestEvent') && ($event->page == "bulk_add")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "bulk_add")) {
global $user; global $user;
if($user->is_admin() && isset($_POST['dir'])) { if($user->is_admin() && isset($_POST['dir'])) {
set_time_limit(0); set_time_limit(0);
$this->add_dir($_POST['dir']); $this->add_dir($_POST['dir']);
$this->theme->display_upload_results($event->page_object); $this->theme->display_upload_results($event->page);
} }
} }

View file

@ -69,7 +69,7 @@ class CommentList extends Extension {
} }
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "comment")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "comment")) {
if($event->get_arg(0) == "add") { if($event->get_arg(0) == "add") {
$this->add_comment_wrapper($_POST['image_id'], $_POST['comment']); $this->add_comment_wrapper($_POST['image_id'], $_POST['comment']);
} }
@ -79,8 +79,8 @@ class CommentList extends Extension {
// FIXME: post, not args // FIXME: post, not args
if($event->count_args() == 3) { if($event->count_args() == 3) {
send_event(new CommentDeletionEvent($event->get_arg(1))); send_event(new CommentDeletionEvent($event->get_arg(1)));
$event->page_object->set_mode("redirect"); $event->page->set_mode("redirect");
$event->page_object->set_redirect(make_link("post/view/".$event->get_arg(2))); $event->page->set_redirect(make_link("post/view/".$event->get_arg(2)));
} }
} }
else { else {
@ -91,11 +91,10 @@ class CommentList extends Extension {
$this->build_page($event->get_arg(1)); $this->build_page($event->get_arg(1));
} }
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "index")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) {
global $page;
global $config; global $config;
if($config->get_int("comment_count") > 0) { if($config->get_int("comment_count") > 0) {
$page->add_block(new Block("Comments", $this->build_recent_comments(), "left")); $event->page->add_block(new Block("Comments", $this->build_recent_comments(), "left"));
} }
} }

View file

@ -17,7 +17,7 @@ class Downtime extends Extension {
if(is_a($event, 'PageRequestEvent')) { if(is_a($event, 'PageRequestEvent')) {
global $config; global $config;
if($config->get_bool("downtime")) { if($config->get_bool("downtime")) {
$this->theme->display_notification($event->page_object); $this->theme->display_notification($event->page);
} }
} }
} }
@ -34,7 +34,7 @@ class Downtime extends Extension {
} }
private function is_safe_page($event) { private function is_safe_page($event) {
if($event->page == "user" && $event->get_arg(0) == "login") return true; if($event->page_name == "user" && $event->get_arg(0) == "login") return true;
else return false; else return false;
} }
} }

View file

@ -6,10 +6,10 @@ class ET extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("et", "ETTheme"); if(is_null($this->theme)) $this->theme = get_theme_object("et", "ETTheme");
if(is_a($event, 'PageRequestEvent') && ($event->page == "system_info")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "system_info")) {
global $user; global $user;
if($user->is_admin()) { if($user->is_admin()) {
$this->theme->display_info_page($event->page_object, $this->get_info()); $this->theme->display_info_page($event->page, $this->get_info());
} }
} }

View file

@ -3,7 +3,7 @@
class Handle404 extends Extension { class Handle404 extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_a($event, 'PageRequestEvent')) { if(is_a($event, 'PageRequestEvent')) {
$page = $event->page_object; $page = $event->page;
// hax. // hax.
if($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) { if($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) {
$h_pagename = html_escape($event->page); $h_pagename = html_escape($event->page);

View file

@ -20,10 +20,10 @@ class ImageIO extends Extension {
if(!is_null($num) && preg_match("/(\d+)/", $num, $matches)) { if(!is_null($num) && preg_match("/(\d+)/", $num, $matches)) {
$num = $matches[1]; $num = $matches[1];
if($event->page == "image") { if($event->page_name == "image") {
$this->send_file($num, "image"); $this->send_file($num, "image");
} }
else if($event->page == "thumb") { else if($event->page_name == "thumb") {
$this->send_file($num, "thumb"); $this->send_file($num, "thumb");
} }
} }

View file

@ -13,9 +13,9 @@ class Index extends Extension {
$config->set_default_bool("index_tips", true); $config->set_default_bool("index_tips", true);
} }
if(is_a($event, 'PageRequestEvent') && (($event->page == "index") || if(is_a($event, 'PageRequestEvent') && (($event->page_name == "index") ||
($event->page == "post" && $event->get_arg(0) == "list"))) { ($event->page_name == "post" && $event->get_arg(0) == "list"))) {
if($event->page == "post") array_shift($event->args); if($event->page_name == "post") array_shift($event->args);
$search_terms = array(); $search_terms = array();
$page_number = 1; $page_number = 1;
@ -42,7 +42,7 @@ class Index extends Extension {
$images = $database->get_images(($page_number-1)*$count, $count, $search_terms); $images = $database->get_images(($page_number-1)*$count, $count, $search_terms);
$this->theme->set_page($page_number, $total_pages, $search_terms); $this->theme->set_page($page_number, $total_pages, $search_terms);
$this->theme->display_page($event->page_object, $images); $this->theme->display_page($event->page, $images);
} }
if(is_a($event, 'SetupBuildingEvent')) { if(is_a($event, 'SetupBuildingEvent')) {

View file

@ -38,7 +38,7 @@ class IPBan extends Extension {
$this->check_ip_ban(); $this->check_ip_ban();
if(is_a($event, 'PageRequestEvent') && ($event->page == "ip_ban")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "ip_ban")) {
global $user; global $user;
if($user->is_admin()) { if($user->is_admin()) {
if($event->get_arg(0) == "add") { if($event->get_arg(0) == "add") {

View file

@ -6,10 +6,10 @@ class News extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("news", "NewsTheme"); if(is_null($this->theme)) $this->theme = get_theme_object("news", "NewsTheme");
if(is_a($event, 'PageRequestEvent') && ($event->page == "index")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) {
global $config; global $config;
if(strlen($config->get_string("news_text")) > 0) { if(strlen($config->get_string("news_text")) > 0) {
$this->theme->display_news($event->page_object, $config->get_string("news_text")); $this->theme->display_news($event->page, $config->get_string("news_text"));
} }
} }
if(is_a($event, 'SetupBuildingEvent')) { if(is_a($event, 'SetupBuildingEvent')) {

View file

@ -6,7 +6,7 @@ class RegenThumb extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("regen_thumb", "RegenThumbTheme"); if(is_null($this->theme)) $this->theme = get_theme_object("regen_thumb", "RegenThumbTheme");
if(is_a($event, 'PageRequestEvent') && ($event->page == "regen_thumb")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "regen_thumb")) {
global $user; global $user;
if($user->is_admin() && isset($_POST['program']) && isset($_POST['image_id'])) { if($user->is_admin() && isset($_POST['program']) && isset($_POST['image_id'])) {
$this->make_thumb($_POST['program'], $_POST['image_id']); $this->make_thumb($_POST['program'], $_POST['image_id']);

View file

@ -3,7 +3,7 @@
class RSS_Images extends Extension { class RSS_Images extends Extension {
// event handling {{{ // event handling {{{
public function receive_event($event) { public function receive_event($event) {
if(is_a($event, 'PageRequestEvent') && ($event->page == "index")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) {
global $page; global $page;
global $config; global $config;
$title = $config->get_string('title'); $title = $config->get_string('title');
@ -11,7 +11,7 @@ class RSS_Images extends Extension {
$page->add_header("<link rel=\"alternate\" type=\"application/rss+xml\" ". $page->add_header("<link rel=\"alternate\" type=\"application/rss+xml\" ".
"title=\"$title - Images\" href=\"".make_link("rss/images")."\" />"); "title=\"$title - Images\" href=\"".make_link("rss/images")."\" />");
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "rss")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "rss")) {
if($event->get_arg(0) == 'images') { if($event->get_arg(0) == 'images') {
global $database; global $database;
$this->do_rss($database->get_images(0, 12)); $this->do_rss($database->get_images(0, 12));

View file

@ -125,7 +125,7 @@ class SetupBlock extends Block {
class Setup extends Extension { class Setup extends Extension {
// event handling {{{ // event handling {{{
public function receive_event($event) { public function receive_event($event) {
if(is_a($event, 'PageRequestEvent') && ($event->page == "setup")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "setup")) {
global $user; global $user;
if(!$user->is_admin()) { if(!$user->is_admin()) {
global $page; global $page;

View file

@ -3,7 +3,7 @@
class TagEdit extends Extension { class TagEdit extends Extension {
// event handling {{{ // event handling {{{
public function receive_event($event) { public function receive_event($event) {
if(is_a($event, 'PageRequestEvent') && ($event->page == "tag_edit")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tag_edit")) {
global $page; global $page;
if($event->get_arg(0) == "set") { if($event->get_arg(0) == "set") {
if($this->can_tag()) { if($this->can_tag()) {

View file

@ -14,7 +14,7 @@ class TagList extends Extension {
$config->set_default_string("info_link", 'http://en.wikipedia.org/wiki/$tag'); $config->set_default_string("info_link", 'http://en.wikipedia.org/wiki/$tag');
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "tags")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tags")) {
global $page; global $page;
$this->theme->set_navigation($this->build_navigation()); $this->theme->set_navigation($this->build_navigation());
@ -35,7 +35,7 @@ class TagList extends Extension {
} }
$this->theme->display_page($page); $this->theme->display_page($page);
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "index")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) {
global $config; global $config;
global $page; global $page;
if($config->get_int('tag_list_length') > 0) { if($config->get_int('tag_list_length') > 0) {

View file

@ -13,12 +13,12 @@ class Upload extends Extension {
$config->set_default_bool('upload_anon', false); $config->set_default_bool('upload_anon', false);
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "index")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) {
if($this->can_upload()) { if($this->can_upload()) {
$this->theme->display_block($event->page_object); $this->theme->display_block($event->page);
} }
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "upload")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "upload")) {
if($this->can_upload()) { if($this->can_upload()) {
global $page; global $page;
@ -27,10 +27,10 @@ class Upload extends Extension {
$ok = $ok & $this->try_upload($file); $ok = $ok & $this->try_upload($file);
} }
$this->theme->display_upload_status($event->page_object, $ok); $this->theme->display_upload_status($event->page, $ok);
} }
else { else {
$this->theme->display_error($event->page_object, "Upload Denied", "Anonymous posting is disabled"); $this->theme->display_error($event->page, "Upload Denied", "Anonymous posting is disabled");
} }
} }

View file

@ -37,7 +37,7 @@ class UserPage extends Extension {
$config->set_default_int("login_memory", 365); $config->set_default_int("login_memory", 365);
} }
if(is_a($event, 'PageRequestEvent') && ($event->page == "user")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "user")) {
global $page; global $page;
global $user; global $user;
global $database; global $database;
@ -81,7 +81,7 @@ class UserPage extends Extension {
global $page; global $page;
if($user->is_anonymous()) { if($user->is_anonymous()) {
$this->theme->display_login_block($event->page_object); $this->theme->display_login_block($event->page);
} }
else { else {
$page->add_block(new Block("User Links", $this->build_links_block(), "left", 90)); $page->add_block(new Block("User Links", $this->build_links_block(), "left", 90));

View file

@ -6,17 +6,17 @@ class ViewImage extends Extension {
public function receive_event($event) { public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("view", "ViewTheme"); if(is_null($this->theme)) $this->theme = get_theme_object("view", "ViewTheme");
if(is_a($event, 'PageRequestEvent') && ($event->page == "post") && ($event->get_arg(0) == "view")) { if(is_a($event, 'PageRequestEvent') && ($event->page_name == "post") && ($event->get_arg(0) == "view")) {
$image_id = int_escape($event->get_arg(1)); $image_id = int_escape($event->get_arg(1));
global $database; global $database;
$image = $database->get_image($image_id); $image = $database->get_image($image_id);
if(!is_null($image)) { if(!is_null($image)) {
send_event(new DisplayingImageEvent($image, $event->page_object)); send_event(new DisplayingImageEvent($image, $event->page));
} }
else { else {
$this->theme->display_image_not_found($event->page_object, $image_id); $this->theme->display_image_not_found($event->page, $image_id);
} }
} }