PHP4 is dead \o/ \o/ \o/ (Part 1, make use of instanceof)
git-svn-id: file:///home/shish/svn/shimmie2/trunk@994 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
24a775678c
commit
09b2be6830
55 changed files with 211 additions and 211 deletions
|
@ -8,10 +8,10 @@
|
|||
|
||||
class AutoComplete extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index" || $event->page_name == "view")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "index" || $event->page_name == "view")) {
|
||||
$event->page->add_header("<script>autocomplete_url='".html_escape(make_link("autocomplete"))."';</script>");
|
||||
}
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "autocomplete")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "autocomplete")) {
|
||||
$event->page->set_mode("data");
|
||||
$event->page->set_type("text/plain");
|
||||
$event->page->set_data($this->get_completions($event->get_arg(0)));
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
class BanWords extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_string('banned_words', "
|
||||
viagra
|
||||
|
@ -16,7 +16,7 @@ porn
|
|||
");
|
||||
}
|
||||
|
||||
if(is_a($event, 'CommentPostingEvent')) {
|
||||
if($event instanceof CommentPostingEvent) {
|
||||
global $config;
|
||||
$banned = $config->get_string("banned_words");
|
||||
$comment = strtolower($event->comment);
|
||||
|
@ -44,7 +44,7 @@ porn
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Banned Phrases");
|
||||
$sb->add_label("One per line, lines that start with slashes are treated as regex<br/>");
|
||||
$sb->add_longtext_option("banned_words");
|
||||
|
|
|
@ -16,12 +16,12 @@ class BrowserSearch extends Extension {
|
|||
global $page;
|
||||
global $config;
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
$config->set_default_string("search_suggestions_results_order", 'a');
|
||||
}
|
||||
|
||||
// Add in header code to let the browser know that the search plugin exists
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
if($event instanceof PageRequestEvent) {
|
||||
// We need to build the data for the header
|
||||
global $config;
|
||||
$search_title = $config->get_string('title');
|
||||
|
@ -30,7 +30,7 @@ class BrowserSearch extends Extension {
|
|||
}
|
||||
|
||||
// The search.xml file that is generated on the fly
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "browser_search") && $event->get_arg(0) == "please_dont_use_this_tag_as_it_would_break_stuff__search.xml") {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "browser_search") && $event->get_arg(0) == "please_dont_use_this_tag_as_it_would_break_stuff__search.xml") {
|
||||
// First, we need to build all the variables we'll need
|
||||
|
||||
$search_title = $config->get_string('title');
|
||||
|
@ -58,7 +58,7 @@ class BrowserSearch extends Extension {
|
|||
$page->set_mode("data");
|
||||
$page->set_type("text/xml");
|
||||
$page->set_data($xml);
|
||||
} else if(is_a($event, 'PageRequestEvent') && ($event->page_name == "browser_search") && !$config->get_bool("disable_search_suggestions")) { // We need to return results!
|
||||
} else if(($event instanceof PageRequestEvent) && ($event->page_name == "browser_search") && !$config->get_bool("disable_search_suggestions")) { // We need to return results!
|
||||
global $database;
|
||||
|
||||
// We have to build some json stuff
|
||||
|
@ -93,8 +93,7 @@ class BrowserSearch extends Extension {
|
|||
$page->set_data($json_string);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sort_by = array();
|
||||
$sort_by['Alphabetical'] = 'a';
|
||||
$sort_by['Tag Count'] = 't';
|
||||
|
@ -105,10 +104,7 @@ class BrowserSearch extends Extension {
|
|||
$sb->add_choice_option("search_suggestions_results_order", $sort_by, "Sort the suggestions by:");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
add_event_listener(new BrowserSearch());
|
||||
?>
|
||||
|
|
|
@ -12,7 +12,7 @@ class BulkAdd extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("bulk_add", "BulkAddTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "bulk_add")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "bulk_add")) {
|
||||
if($event->user->is_admin() && isset($_POST['dir'])) {
|
||||
set_time_limit(0);
|
||||
|
||||
|
@ -21,7 +21,7 @@ class BulkAdd extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AdminBuildingEvent')) {
|
||||
if($event instanceof AdminBuildingEvent) {
|
||||
global $page;
|
||||
$this->theme->display_admin_block($page);
|
||||
}
|
||||
|
|
|
@ -44,12 +44,12 @@ class DanbooruApi extends Extension
|
|||
public function receive_event($event)
|
||||
{
|
||||
// Check if someone is accessing /api/danbooru (us)
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "api") && ($event->get_arg(0) == 'danbooru'))
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "api") && ($event->get_arg(0) == 'danbooru'))
|
||||
{
|
||||
// execute the danbooru processing code
|
||||
$this->api_danbooru($event);
|
||||
}
|
||||
if(is_a($event, 'SearchTermParseEvent'))
|
||||
if($event instanceof SearchTermParseEvent)
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match("/md5:([0-9a-fA-F]*)/i", $event->term, $matches))
|
||||
|
|
|
@ -12,14 +12,14 @@ class Downtime extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("downtime", "DowntimeTheme");
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Downtime");
|
||||
$sb->add_bool_option("downtime", "Disable non-admin access: ");
|
||||
$sb->add_longtext_option("downtime_message", "<br>");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
if($event instanceof PageRequestEvent) {
|
||||
global $config;
|
||||
if($config->get_bool("downtime")) {
|
||||
$this->check_downtime($event);
|
||||
|
@ -33,7 +33,7 @@ class Downtime extends Extension {
|
|||
global $config;
|
||||
|
||||
if($config->get_bool("downtime") && !$user->is_admin() &&
|
||||
is_a($event, 'PageRequestEvent') && !$this->is_safe_page($event)) {
|
||||
($event instanceof PageRequestEvent) && !$this->is_safe_page($event)) {
|
||||
$msg = $config->get_string("downtime_message");
|
||||
$this->theme->display_message($msg);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
class Emoticons extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'TextFormattingEvent')) {
|
||||
if($event instanceof TextFormattingEvent) {
|
||||
$event->formatted = $this->bbcode_to_html($event->formatted);
|
||||
$event->stripped = $this->bbcode_to_text($event->stripped);
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ class ET extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("et", "ETTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "system_info")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "system_info")) {
|
||||
if($event->user->is_admin()) {
|
||||
$this->theme->display_info_page($event->page, $this->get_info());
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_link("System Info", make_link("system_info"));
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ class EventLog extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("event_log", "EventLogTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
$this->setup();
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && $event->page_name == "event_log") {
|
||||
if(($event instanceof PageRequestEvent) && $event->page_name == "event_log") {
|
||||
global $database;
|
||||
if($event->user->is_admin()) {
|
||||
if(isset($_POST['action'])) {
|
||||
|
@ -59,32 +59,32 @@ class EventLog extends Extension {
|
|||
$this->theme->display_error($event->page, "Denied", "Only admins can see the event log");
|
||||
}
|
||||
}
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_link("Event Log", make_link("event_log"));
|
||||
}
|
||||
}
|
||||
|
||||
global $user; // bad
|
||||
if(is_a($event, 'UploadingImageEvent')) {
|
||||
if($event instanceof UploadingImageEvent) {
|
||||
$this->add_to_log($event->user, 'Uploading Image', "Uploaded a new image");
|
||||
}
|
||||
if(is_a($event, 'CommentPostingEvent')) {
|
||||
if($event instanceof CommentPostingEvent) {
|
||||
$this->add_to_log($event->user, 'Comment Posting', "Posted a comment on image #{$event->image_id}");
|
||||
}
|
||||
if(is_a($event, 'WikiUpdateEvent')) {
|
||||
if($event instanceof WikiUpdateEvent) {
|
||||
$this->add_to_log($event->user, 'Wiki Update', "Edited '{$event->wikipage->title}'");
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
if($event instanceof ConfigSaveEvent) {
|
||||
$this->add_to_log($user, 'Config Save', "Updated the board config");
|
||||
}
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
if($event instanceof ImageDeletionEvent) {
|
||||
$this->add_to_log($user, 'Image Deletion', "Deleted image {$event->image->id} (tags: {$event->image->get_tag_list()})");
|
||||
}
|
||||
if(is_a($event, 'SourceSetEvent')) {
|
||||
if($event instanceof SourceSetEvent) {
|
||||
$this->add_to_log($user, 'Source Set', "Source for image #{$event->image_id} set to '{$event->source}'");
|
||||
}
|
||||
if(is_a($event, 'TagSetEvent')) {
|
||||
if($event instanceof TagSetEvent) {
|
||||
$tags = implode($event->tags, ", ");
|
||||
$this->add_to_log($user, 'Tags Set', "Tags for image #{$event->image_id} set to '$tags'");
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ class Featured extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("featured", "FeaturedTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_int('featured_id', 0);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "set_feature")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "set_feature")) {
|
||||
global $user;
|
||||
if($user->is_admin() && isset($_POST['image_id'])) {
|
||||
global $config;
|
||||
|
@ -30,7 +30,7 @@ class Featured extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PostListBuildingEvent')) {
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
global $config, $database;
|
||||
$fid = $config->get_int("featured_id");
|
||||
if($fid > 0) {
|
||||
|
@ -42,14 +42,14 @@ class Featured extends Extension {
|
|||
}
|
||||
|
||||
/*
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if(($event instanceof SetupBuildingEvent)) {
|
||||
$sb = new SetupBlock("Featured Image");
|
||||
$sb->add_int_option("featured_id", "Image ID: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
*/
|
||||
|
||||
if(is_a($event, 'ImageAdminBlockBuildingEvent')) {
|
||||
if($event instanceof ImageAdminBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_part($this->theme->get_buttons_html($event->image->id));
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
|
||||
class ArchiveFileHandler extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_string('archive_extract_command', 'unzip -d "%d" "%f"');
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Archive Handler Options");
|
||||
$sb->add_text_option("archive_tmp_dir", "Temporary folder: ");
|
||||
$sb->add_text_option("archive_extract_command", "<br>Extraction command: ");
|
||||
|
@ -20,7 +20,7 @@ class ArchiveFileHandler extends Extension {
|
|||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type)) {
|
||||
if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type)) {
|
||||
global $config;
|
||||
$tmp = sys_get_temp_dir();
|
||||
$tmpdir = "$tmp/shimmie-archive-{$event->hash}";
|
||||
|
|
|
@ -11,7 +11,7 @@ class FlashFileHandler extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("handle_flash", "FlashFileHandlerTheme");
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!move_upload_to_archive($event)) return;
|
||||
|
@ -25,14 +25,14 @@ class FlashFileHandler extends Extension {
|
|||
send_event(new ImageAdditionEvent($event->user, $image));
|
||||
}
|
||||
|
||||
if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) {
|
||||
if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
// FIXME: scale image, as not all boards use 192x192
|
||||
copy("ext/handle_flash/thumb.jpg", "thumbs/$ha/$hash");
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) {
|
||||
if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) {
|
||||
$this->theme->display_image($event->page, $event->image);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class IcoFileHandler extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("handle_ico", "IcoFileHandlerTheme");
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!move_upload_to_archive($event)) return;
|
||||
|
@ -30,15 +30,15 @@ class IcoFileHandler extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) {
|
||||
if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) {
|
||||
$this->create_thumb($event->hash);
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) {
|
||||
if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) {
|
||||
$this->theme->display_image($event->page, $event->image);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "get_ico")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "get_ico")) {
|
||||
global $database;
|
||||
$id = int_escape($event->get_arg(0));
|
||||
$image = $database->get_image($id);
|
||||
|
|
|
@ -11,7 +11,7 @@ class MP3FileHandler extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("handle_mp3", "MP3FileHandlerTheme");
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!move_upload_to_archive($event)) return;
|
||||
|
@ -24,14 +24,14 @@ class MP3FileHandler extends Extension {
|
|||
send_event(new ImageAdditionEvent($event->user, $image));
|
||||
}
|
||||
|
||||
if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) {
|
||||
if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
// FIXME: scale image, as not all boards use 192x192
|
||||
copy("ext/handle_mp3/thumb.jpg", "thumbs/$ha/$hash");
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) {
|
||||
if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) {
|
||||
$this->theme->display_image($event->page, $event->image);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class SVGFileHandler extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("handle_svg", "SVGFileHandlerTheme");
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!move_upload_to_archive($event)) return;
|
||||
|
@ -24,7 +24,7 @@ class SVGFileHandler extends Extension {
|
|||
send_event(new ImageAdditionEvent($event->user, $image));
|
||||
}
|
||||
|
||||
if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) {
|
||||
if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
|
||||
|
@ -44,11 +44,11 @@ class SVGFileHandler extends Extension {
|
|||
// }
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) {
|
||||
if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) {
|
||||
$this->theme->display_image($event->page, $event->image);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "get_svg")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "get_svg")) {
|
||||
global $database;
|
||||
$id = int_escape($event->get_arg(0));
|
||||
$image = $database->get_image($id);
|
||||
|
|
|
@ -14,12 +14,12 @@ class Home extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("home", "HomeTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "home"))
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "home"))
|
||||
{
|
||||
// this is a request to display this page so output the page.
|
||||
$this->output_pages($event->page);
|
||||
}
|
||||
if(is_a($event, 'SetupBuildingEvent'))
|
||||
if($event instanceof SetupBuildingEvent)
|
||||
{
|
||||
$counters = array();
|
||||
foreach(glob("ext/home/counters/*") as $counter_dirname) {
|
||||
|
|
|
@ -36,14 +36,14 @@ class Image_Hash_Ban extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("Image_Hash_Ban", "ImageBanTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
if($config->get_int("ext_imageban_version") < 1) {
|
||||
$this->install();
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'DataUploadEvent')) {
|
||||
if($event instanceof DataUploadEvent) {
|
||||
global $database;
|
||||
|
||||
$row = $database->db->GetRow("SELECT * FROM image_bans WHERE hash = ?", $event->hash);
|
||||
|
@ -52,7 +52,7 @@ class Image_Hash_Ban extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "image_hash_ban")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "image_hash_ban")) {
|
||||
if($event->user->is_admin()) {
|
||||
if($event->get_arg(0) == "add") {
|
||||
if(isset($_POST['hash']) && isset($_POST['reason'])) {
|
||||
|
@ -84,20 +84,20 @@ class Image_Hash_Ban extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AdminBuildingEvent')) {
|
||||
if($event instanceof AdminBuildingEvent) {
|
||||
global $page;
|
||||
$this->theme->display_Image_hash_Bans($page, $this->get_image_hash_bans());
|
||||
}
|
||||
|
||||
if(is_a($event, 'AddImageHashBanEvent')) {
|
||||
if($event instanceof AddImageHashBanEvent) {
|
||||
$this->add_image_hash_ban($event->hash, $event->reason);
|
||||
}
|
||||
|
||||
if(is_a($event, 'RemoveImageHashBanEvent')) {
|
||||
if($event instanceof RemoveImageHashBanEvent) {
|
||||
$this->remove_image_hash_ban($event->hash);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageAdminBlockBuildingEvent')) {
|
||||
if($event instanceof ImageAdminBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_part($this->theme->get_buttons_html($event->image));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class IPBan extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("ipban", "IPBanTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
if($config->get_int("ext_ipban_version") < 5) {
|
||||
$this->install();
|
||||
|
@ -45,7 +45,7 @@ class IPBan extends Extension {
|
|||
$this->check_ip_ban();
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "ip_ban")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "ip_ban")) {
|
||||
global $user;
|
||||
if($user->is_admin()) {
|
||||
if($event->get_arg(0) == "add") {
|
||||
|
@ -71,18 +71,18 @@ class IPBan extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_link("IP Bans", make_link("ip_ban/list"));
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AddIPBanEvent')) {
|
||||
if($event instanceof AddIPBanEvent) {
|
||||
global $user;
|
||||
$this->add_ip_ban($event->ip, $event->reason, $event->end, $user);
|
||||
}
|
||||
|
||||
if(is_a($event, 'RemoveIPBanEvent')) {
|
||||
if($event instanceof RemoveIPBanEvent) {
|
||||
global $database;
|
||||
$database->Execute("DELETE FROM bans WHERE id = ?", array($event->id));
|
||||
}
|
||||
|
|
|
@ -9,19 +9,19 @@ class LinkImage extends Extension {
|
|||
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("link_image", "LinkImageTheme");
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if(($event instanceof DisplayingImageEvent)) {
|
||||
global $config;
|
||||
$data_href = get_base_href();
|
||||
$event->page->add_header("<link rel='stylesheet' href='$data_href/ext/link_image/_style.css' type='text/css'>",0);
|
||||
|
||||
$this->theme->links_block($event->page,$this->data($event->image));
|
||||
}
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Link to Image");
|
||||
$sb->add_text_option("ext_link-img_text-link_format", "Text Link Format: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
//just set default if empty.
|
||||
$config->set_default_string("ext_link-img_text-link_format",
|
||||
|
|
|
@ -12,14 +12,14 @@ class News extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("news", "NewsTheme");
|
||||
|
||||
if(is_a($event, 'PostListBuildingEvent')) {
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
global $config;
|
||||
if(strlen($config->get_string("news_text")) > 0) {
|
||||
$this->theme->display_news($event->page, $config->get_string("news_text"));
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("News");
|
||||
$sb->add_longtext_option("news_text");
|
||||
$event->panel->add_block($sb);
|
||||
|
|
|
@ -12,14 +12,14 @@ class Notes extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("notes", "NotesTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
if($config->get_int("ext_notes_version") < 1) {
|
||||
$this->install();
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $database;
|
||||
$notes = $database->get_all("SELECT * FROM image_notes WHERE image_id = ?", array($event->image->id));
|
||||
$this->theme->display_notes($event->page, $notes);
|
||||
|
|
|
@ -22,14 +22,14 @@ class NumericScore extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("numeric_score", "NumericScoreTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
if($config->get_int("ext_numeric_score_version", 0) < 1) {
|
||||
$this->install();
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $user;
|
||||
if(!$user->is_anonymous()) {
|
||||
$html = $this->theme->get_voter_html($event->image);
|
||||
|
@ -37,7 +37,7 @@ class NumericScore extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "numeric_score_vote")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "numeric_score_vote")) {
|
||||
if(!$event->user->is_anonymous()) {
|
||||
$image_id = int_escape($_POST['image_id']);
|
||||
$char = $_POST['vote'];
|
||||
|
@ -50,7 +50,7 @@ class NumericScore extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoSetEvent')) {
|
||||
if($event instanceof ImageInfoSetEvent) {
|
||||
global $user;
|
||||
$char = $_POST['numeric_score'];
|
||||
$score = 0;
|
||||
|
@ -59,20 +59,20 @@ class NumericScore extends Extension {
|
|||
if($score != 0) send_event(new NumericScoreSetEvent($event->image_id, $user, $score));
|
||||
}
|
||||
|
||||
if(is_a($event, 'NumericScoreSetEvent')) {
|
||||
if($event instanceof NumericScoreSetEvent) {
|
||||
$this->add_vote($event->image_id, $event->user->id, $event->score);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
if($event instanceof ImageDeletionEvent) {
|
||||
global $database;
|
||||
$database->execute("DELETE FROM numeric_score_votes WHERE image_id=?", array($event->image->id));
|
||||
}
|
||||
|
||||
if(is_a($event, 'ParseLinkTemplateEvent')) {
|
||||
if($event instanceof ParseLinkTemplateEvent) {
|
||||
$event->replace('$score', $event->image->numeric_score);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SearchTermParseEvent')) {
|
||||
if($event instanceof SearchTermParseEvent) {
|
||||
$matches = array();
|
||||
if(preg_match("/score(<|<=|=|>=|>)(\d+)/", $event->term, $matches)) {
|
||||
$cmp = $matches[1];
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*/
|
||||
class PicLens extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
if($event instanceof PageRequestEvent) {
|
||||
$event->page->add_header("<script type=\"text/javascript\" src=\"http://lite.piclens.com/current/piclens.js\"></script>");
|
||||
}
|
||||
if(is_a($event, 'PostListBuildingEvent')) {
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
$foo='
|
||||
<a href="javascript:PicLensLite.start();">Start Slideshow
|
||||
<img src="http://lite.piclens.com/images/PicLensButton.png"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
class RandomImage extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "random_image")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "random_image")) {
|
||||
global $database;
|
||||
|
||||
if($event->count_args() == 1) {
|
||||
|
|
|
@ -22,7 +22,7 @@ class Ratings extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("rating", "RatingsTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
if($config->get_int("ext_ratings2_version") < 2) {
|
||||
$this->install();
|
||||
|
@ -33,25 +33,25 @@ class Ratings extends Extension {
|
|||
$config->set_default_string("ext_rating_user_privs", 'sq');
|
||||
}
|
||||
|
||||
if(is_a($event, 'RatingSetEvent')) {
|
||||
if($event instanceof RatingSetEvent) {
|
||||
$this->set_rating($event->image_id, $event->rating);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoBoxBuildingEvent')) {
|
||||
if($event instanceof ImageInfoBoxBuildingEvent) {
|
||||
global $user;
|
||||
if($user->is_admin()) {
|
||||
$event->add_part($this->theme->get_rater_html($event->image->id, $event->image->rating), 80);
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoSetEvent')) {
|
||||
if($event instanceof ImageInfoSetEvent) {
|
||||
global $user;
|
||||
if($user->is_admin()) {
|
||||
send_event(new RatingSetEvent($event->image_id, $user, $_POST['rating']));
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$privs = array();
|
||||
$privs['Safe Only'] = 's';
|
||||
$privs['Safe and Questionable'] = 'sq';
|
||||
|
@ -63,11 +63,11 @@ class Ratings extends Extension {
|
|||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ParseLinkTemplateEvent')) {
|
||||
if($event instanceof ParseLinkTemplateEvent) {
|
||||
$event->replace('$rating', $this->theme->rating_to_name($event->image->rating));
|
||||
}
|
||||
|
||||
if(is_a($event, 'SearchTermParseEvent')) {
|
||||
if($event instanceof SearchTermParseEvent) {
|
||||
$matches = array();
|
||||
if(preg_match("/rating=([sqe]+)/", $event->term, $matches)) {
|
||||
$sqes = $matches[1];
|
||||
|
|
|
@ -12,7 +12,7 @@ class RegenThumb extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("regen_thumb", "RegenThumbTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "regen_thumb")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "regen_thumb")) {
|
||||
global $user;
|
||||
if($user->is_admin() && isset($_POST['image_id'])) {
|
||||
global $database;
|
||||
|
@ -22,7 +22,7 @@ class RegenThumb extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageAdminBlockBuildingEvent')) {
|
||||
if($event instanceof ImageAdminBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_part($this->theme->get_buttons_html($event->image->id));
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class ReportImage extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("report_image", "ReportImageTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
||||
$config->set_default_bool('report_image_show_thumbs', true);
|
||||
|
@ -45,7 +45,7 @@ class ReportImage extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "image_report")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "image_report")) {
|
||||
global $user;
|
||||
if($event->get_arg(0) == "add") {
|
||||
if(isset($_POST['image_id']) && isset($_POST['reason'])) {
|
||||
|
@ -71,7 +71,7 @@ class ReportImage extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AddReportedImageEvent')) {
|
||||
if($event instanceof AddReportedImageEvent) {
|
||||
global $database;
|
||||
$database->Execute(
|
||||
"INSERT INTO image_reports(image_id, reporter_id, reason)
|
||||
|
@ -79,12 +79,12 @@ class ReportImage extends Extension {
|
|||
array($event->image_id, $event->reporter_id, $event->reason));
|
||||
}
|
||||
|
||||
if(is_a($event, 'RemoveReportedImageEvent')) {
|
||||
if($event instanceof RemoveReportedImageEvent) {
|
||||
global $database;
|
||||
$database->Execute("DELETE FROM image_reports WHERE id = ?", array($event->id));
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $user;
|
||||
global $config;
|
||||
if($config->get_bool('report_image_anon') || !$user->is_anonymous()) {
|
||||
|
@ -92,20 +92,20 @@ class ReportImage extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Report Image Options");
|
||||
$sb->add_bool_option("report_image_anon", "Allow anonymous image reporting: ");
|
||||
$sb->add_bool_option("report_image_show_thumbs", "<br>Show thumbnails in admin panel: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_link("Reported Images", make_link("image_report/list"));
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
if($event instanceof ImageDeletionEvent) {
|
||||
global $database;
|
||||
$database->Execute("DELETE FROM image_reports WHERE image_id = ?", array($event->image->id));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
class ResolutionLimit extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'ImageAdditionEvent')) {
|
||||
if($event instanceof ImageAdditionEvent) {
|
||||
global $config;
|
||||
$min_w = $config->get_int("upload_min_width", -1);
|
||||
$min_h = $config->get_int("upload_min_height", -1);
|
||||
|
@ -40,7 +40,7 @@ class ResolutionLimit extends Extension {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Resolution Limits");
|
||||
|
||||
$sb->add_label("Min ");
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
class RSS_Comments extends Extension {
|
||||
// event handling {{{
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PostListBuildingEvent')) {
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
global $page;
|
||||
global $config;
|
||||
$title = $config->get_string('title');
|
||||
|
@ -17,7 +17,7 @@ class RSS_Comments extends Extension {
|
|||
$page->add_header("<link rel=\"alternate\" type=\"application/rss+xml\" ".
|
||||
"title=\"$title - Comments\" href=\"".make_link("rss/comments")."\" />");
|
||||
}
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "rss")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "rss")) {
|
||||
if($event->get_arg(0) == 'comments') {
|
||||
global $database;
|
||||
$this->do_rss($database);
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
* Description: Self explanitory
|
||||
*/
|
||||
|
||||
|
||||
class RSS_Images extends Extension {
|
||||
// event handling {{{
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PostListBuildingEvent')) {
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
global $page;
|
||||
global $config;
|
||||
$title = $config->get_string('title');
|
||||
|
@ -25,7 +24,8 @@ class RSS_Images extends Extension {
|
|||
"title=\"$title - Images\" href=\"".make_link("rss/images")."\" />");
|
||||
}
|
||||
}
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "rss")) {
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "rss")) {
|
||||
if($event->get_arg(0) == 'images') {
|
||||
global $database;
|
||||
if($event->count_args() >= 2) {
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
*/
|
||||
class SiteDescription extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
if($event instanceof PageRequestEvent) {
|
||||
global $config;
|
||||
if(strlen($config->get_string("site_description")) > 0) {
|
||||
$description = $config->get_string("site_description");
|
||||
$event->page->add_header("<meta name=\"description\" content=\"$description\">");
|
||||
}
|
||||
}
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Site Description");
|
||||
$sb->add_longtext_option("site_description");
|
||||
$event->panel->add_block($sb);
|
||||
|
|
|
@ -12,7 +12,7 @@ class SVNUpdate extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("svn_update", "SVNUpdateTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "update")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "update")) {
|
||||
if($event->user->is_admin()) {
|
||||
if($event->get_arg(0) == "view_changes") {
|
||||
$this->theme->display_update_todo($event->page,
|
||||
|
@ -31,7 +31,7 @@ class SVNUpdate extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AdminBuildingEvent')) {
|
||||
if($event instanceof AdminBuildingEvent) {
|
||||
global $page;
|
||||
$this->theme->display_form($page);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class Tag_History extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("tag_history", "Tag_HistoryTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if(($event instanceof InitExtEvent)) {
|
||||
// shimmie is being installed so call install to create the table.
|
||||
global $config;
|
||||
if($config->get_int("ext_tag_history_version") < 3) {
|
||||
|
@ -19,7 +19,7 @@ class Tag_History extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tag_history"))
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "tag_history"))
|
||||
{
|
||||
if($event->get_arg(0) == "revert")
|
||||
{
|
||||
|
@ -39,24 +39,24 @@ class Tag_History extends Extension {
|
|||
$this->theme->display_global_page($event->page, $this->get_global_tag_history());
|
||||
}
|
||||
}
|
||||
if(is_a($event, 'DisplayingImageEvent'))
|
||||
if(($event instanceof DisplayingImageEvent))
|
||||
{
|
||||
// handle displaying a link on the view page
|
||||
$this->theme->display_history_link($event->page, $event->image->id);
|
||||
}
|
||||
if(is_a($event, 'ImageDeletionEvent'))
|
||||
if(($event instanceof ImageDeletionEvent))
|
||||
{
|
||||
// handle removing of history when an image is deleted
|
||||
$this->delete_all_tag_history($event->image->id);
|
||||
}
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if(($event instanceof SetupBuildingEvent)) {
|
||||
$sb = new SetupBlock("Tag History");
|
||||
$sb->add_label("Limit to ");
|
||||
$sb->add_int_option("history_limit");
|
||||
$sb->add_label(" entires per image");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
if(is_a($event, 'TagSetEvent')) {
|
||||
if(($event instanceof TagSetEvent)) {
|
||||
$this->add_tag_history($event->image_id, $event->tags);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class Tagger extends Extension {
|
|||
if(is_null($this->theme))
|
||||
$this->theme = get_theme_object("tagger", "taggerTheme");
|
||||
|
||||
if(is_a($event,'DisplayingImageEvent')) {
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $page, $config, $user;
|
||||
|
||||
if($config->get_bool("tag_edit_anon")
|
||||
|
@ -23,7 +23,8 @@ class Tagger extends Extension {
|
|||
$this->theme->build_tagger($page,$event);
|
||||
}
|
||||
}
|
||||
if(is_a($event,'SetupBuildingEvent')) {
|
||||
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Tagger");
|
||||
$sb->add_bool_option("ext_tagger_enabled","Enable Tagger");
|
||||
$sb->add_int_option("ext_tagger_search_delay","<br/>Delay queries by ");
|
||||
|
@ -35,12 +36,14 @@ class Tagger extends Extension {
|
|||
$event->panel->add_block($sb);
|
||||
}
|
||||
}
|
||||
} add_event_listener( new tagger());
|
||||
}
|
||||
|
||||
add_event_listener(new Tagger());
|
||||
|
||||
// Tagger AJAX back-end
|
||||
class TaggerXML extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event,'PageRequestEvent')
|
||||
if(($event instanceof PageRequestEvent)
|
||||
&& $event->page_name == "tagger"
|
||||
&& $event->get_arg(0) == "tags")
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ class TextScore extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("text_score", "TextScoreTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if(($event instanceof InitExtEvent)) {
|
||||
global $config;
|
||||
if($config->get_int("ext_text_score_version", 0) < 1) {
|
||||
$this->install();
|
||||
|
@ -30,7 +30,7 @@ class TextScore extends Extension {
|
|||
$config->set_default_bool("text_score_anon", true);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoBoxBuildingEvent')) {
|
||||
if(($event instanceof ImageInfoBoxBuildingEvent)) {
|
||||
global $user;
|
||||
global $config;
|
||||
if(!$user->is_anonymous() || $config->get_bool("text_score_anon")) {
|
||||
|
@ -38,7 +38,7 @@ class TextScore extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoSetEvent')) {
|
||||
if($event instanceof ImageInfoSetEvent) {
|
||||
global $user;
|
||||
$i_score = int_escape($_POST['text_score__score']);
|
||||
|
||||
|
@ -47,24 +47,24 @@ class TextScore extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'TextScoreSetEvent')) {
|
||||
if(($event instanceof TextScoreSetEvent)) {
|
||||
if(!$event->user->is_anonymous() || $config->get_bool("text_score_anon")) {
|
||||
$this->add_vote($event->image_id, $event->user->id, $event->score);
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
if(($event instanceof ImageDeletionEvent)) {
|
||||
global $database;
|
||||
$database->execute("DELETE FROM text_score_votes WHERE image_id=?", array($event->image->id));
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if(($event instanceof SetupBuildingEvent)) {
|
||||
$sb = new SetupBlock("Text Score");
|
||||
$sb->add_bool_option("text_score_anon", "Allow anonymous votes: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ParseLinkTemplateEvent')) {
|
||||
if(($event instanceof ParseLinkTemplateEvent)) {
|
||||
$event->replace('$text_score', $this->theme->score_to_name($event->image->text_score));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,11 +57,11 @@ class Wiki extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("wiki", "WikiTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if(($event instanceof InitExtEvent)) {
|
||||
$this->setup();
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "wiki")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "wiki")) {
|
||||
if(is_null($event->get_arg(0)) || strlen(trim($event->get_arg(0))) == 0) {
|
||||
$title = "Index";
|
||||
}
|
||||
|
@ -118,11 +118,11 @@ class Wiki extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'WikiUpdateEvent')) {
|
||||
if(($event instanceof WikiUpdateEvent)) {
|
||||
$this->set_page($event->user, $event->wikipage);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if(($event instanceof SetupBuildingEvent)) {
|
||||
$sb = new SetupBlock("Wiki");
|
||||
$sb->add_bool_option("wiki_edit_anon", "Allow anonymous edits: ");
|
||||
$sb->add_bool_option("wiki_edit_user", "<br>Allow user edits: ");
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
class WordFilter extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'TextFormattingEvent')) {
|
||||
if($event instanceof TextFormattingEvent) {
|
||||
$event->formatted = $this->filter($event->formatted);
|
||||
$event->stripped = $this->filter($event->stripped);
|
||||
}
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if(($event instanceof SetupBuildingEvent)) {
|
||||
$sb = new SetupBlock("Word Filter");
|
||||
$sb->add_longtext_option("word_filter");
|
||||
$sb->add_label("<br>(each line should be search term and replace term, separated by a comma)");
|
||||
|
|
|
@ -12,12 +12,12 @@ class Zoom extends Extension {
|
|||
public function receive_event($event) {
|
||||
if($this->theme == null) $this->theme = get_theme_object("zoom", "ZoomTheme");
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $config;
|
||||
$this->theme->display_zoomer($event->page, $event->image, $config->get_bool("image_zoom", false));
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Image Zoom");
|
||||
$sb->add_bool_option("image_zoom", "Zoom by default: ");
|
||||
$event->panel->add_block($sb);
|
||||
|
|
|
@ -17,7 +17,7 @@ class AdminPage extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("admin", "AdminPageTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "admin")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "admin")) {
|
||||
if(!$event->user->is_admin()) {
|
||||
$this->theme->display_error($event->page, "Permission Denied", "This page is for admins only");
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class AdminPage extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "admin_utils")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "admin_utils")) {
|
||||
if($event->user->is_admin()) {
|
||||
set_time_limit(0);
|
||||
$redirect = false;
|
||||
|
@ -70,18 +70,18 @@ class AdminPage extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageAdminBlockBuildingEvent')) {
|
||||
if($event instanceof ImageAdminBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_part($this->theme->get_deleter_html($event->image->id));
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AdminBuildingEvent')) {
|
||||
if($event instanceof AdminBuildingEvent) {
|
||||
$this->theme->display_page($event->page);
|
||||
$this->theme->display_form($event->page);
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_link("Board Admin", make_link("admin"));
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class AliasEditor extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("alias_editor", "AliasEditorTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "alias")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "alias")) {
|
||||
if($event->get_arg(0) == "add") {
|
||||
if($event->user->is_admin()) {
|
||||
if(isset($_POST['oldtag']) && isset($_POST['newtag'])) {
|
||||
|
@ -76,7 +76,7 @@ class AliasEditor extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AddAliasEvent')) {
|
||||
if($event instanceof AddAliasEvent) {
|
||||
global $database;
|
||||
$pair = array($event->oldtag, $event->newtag);
|
||||
if($database->db->GetRow("SELECT * FROM aliases WHERE oldtag=? AND lower(newtag)=lower(?)", $pair)) {
|
||||
|
@ -87,7 +87,7 @@ class AliasEditor extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_link("Alias Editor", make_link("alias/list"));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class BBCode extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'TextFormattingEvent')) {
|
||||
if($event instanceof TextFormattingEvent) {
|
||||
$event->formatted = $this->bbcode_to_html($event->formatted);
|
||||
$event->stripped = $this->bbcode_to_text($event->stripped);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class CommentList extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("comment", "CommentListTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_bool('comment_anon', true);
|
||||
$config->set_default_int('comment_window', 5);
|
||||
|
@ -66,7 +66,7 @@ class CommentList extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "comment")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "comment")) {
|
||||
if($event->get_arg(0) == "add") {
|
||||
$cpe = new CommentPostingEvent($_POST['image_id'], $event->user, $_POST['comment']);
|
||||
send_event($cpe);
|
||||
|
@ -101,7 +101,7 @@ class CommentList extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PostListBuildingEvent')) {
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
global $config;
|
||||
$cc = $config->get_int("comment_count");
|
||||
if($cc > 0) {
|
||||
|
@ -109,7 +109,7 @@ class CommentList extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
$this->theme->display_comments(
|
||||
$event->page,
|
||||
$this->get_comments($event->image->id),
|
||||
|
@ -117,18 +117,18 @@ class CommentList extends Extension {
|
|||
$event->image->id);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
if($event instanceof ImageDeletionEvent) {
|
||||
$this->delete_comments($event->image->id);
|
||||
}
|
||||
// TODO: split akismet into a separate class, which can veto the event
|
||||
if(is_a($event, 'CommentPostingEvent')) {
|
||||
if($event instanceof CommentPostingEvent) {
|
||||
$this->add_comment_wrapper($event->image_id, $event->user, $event->comment, $event);
|
||||
}
|
||||
if(is_a($event, 'CommentDeletionEvent')) {
|
||||
if($event instanceof CommentDeletionEvent) {
|
||||
$this->delete_comment($event->comment_id);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Comment Options");
|
||||
$sb->add_bool_option("comment_anon", "Allow anonymous comments: ");
|
||||
$sb->add_label("<br>Limit to ");
|
||||
|
|
|
@ -59,7 +59,7 @@ class ExtManager extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("ext_manager", "ExtManagerTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "ext_manager")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "ext_manager")) {
|
||||
if($event->user->is_admin()) {
|
||||
if($event->get_arg(0) == "set") {
|
||||
if(is_writable("ext")) {
|
||||
|
@ -78,7 +78,7 @@ class ExtManager extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_link("Extension Manager", make_link("ext_manager"));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Handle404 extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
if($event instanceof PageRequestEvent) {
|
||||
$page = $event->page;
|
||||
// hax.
|
||||
if($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) {
|
||||
|
|
|
@ -11,7 +11,7 @@ class PixelFileHandler extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("handle_pixel", "PixelFileHandlerTheme");
|
||||
|
||||
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!move_upload_to_archive($event)) return;
|
||||
|
@ -30,11 +30,11 @@ class PixelFileHandler extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) {
|
||||
if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) {
|
||||
$this->create_thumb($event->hash);
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) {
|
||||
if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) {
|
||||
$this->theme->display_image($event->page, $event->image);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class ImageIO extends Extension {
|
||||
// event handling {{{
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_int('thumb_width', 192);
|
||||
$config->set_default_int('thumb_height', 192);
|
||||
|
@ -19,7 +19,7 @@ class ImageIO extends Extension {
|
|||
$config->set_default_string('upload_collision_handler', 'error');
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
if($event instanceof PageRequestEvent) {
|
||||
$num = $event->get_arg(0);
|
||||
$matches = array();
|
||||
if(!is_null($num) && preg_match("/(\d+)/", $num, $matches)) {
|
||||
|
@ -34,16 +34,16 @@ class ImageIO extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageAdditionEvent')) {
|
||||
if($event instanceof ImageAdditionEvent) {
|
||||
$error = $this->add_image($event->image);
|
||||
if(!empty($error)) $event->veto($error);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
if($event instanceof ImageDeletionEvent) {
|
||||
$this->remove_image($event->image);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Image Options");
|
||||
$sb->position = 30;
|
||||
$sb->add_text_option("image_ilink", "Image link: ");
|
||||
|
|
|
@ -16,14 +16,14 @@ class Index extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("index", "IndexTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_int("index_width", 3);
|
||||
$config->set_default_int("index_height", 4);
|
||||
$config->set_default_bool("index_tips", true);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && (($event->page_name == "index") ||
|
||||
if(($event instanceof PageRequestEvent) && (($event->page_name == "index") ||
|
||||
($event->page_name == "post" && $event->get_arg(0) == "list"))) {
|
||||
if($event->page_name == "post") array_shift($event->args);
|
||||
|
||||
|
@ -67,7 +67,7 @@ class Index extends Extension {
|
|||
$this->theme->display_page($event->page, $images);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Index Options");
|
||||
$sb->position = 20;
|
||||
|
||||
|
@ -80,7 +80,7 @@ class Index extends Extension {
|
|||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SearchTermParseEvent')) {
|
||||
if($event instanceof SearchTermParseEvent) {
|
||||
$matches = array();
|
||||
if(preg_match("/size(<|>|<=|>=|=)(\d+)x(\d+)/", $event->term, $matches)) {
|
||||
$cmp = $matches[1];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
class LoadExtData extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
if($event instanceof PageRequestEvent) {
|
||||
global $page, $config;
|
||||
|
||||
$data_href = get_base_href();
|
||||
|
|
|
@ -128,7 +128,7 @@ class Setup extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("setup", "SetupTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_string("title", "Shimmie");
|
||||
$config->set_default_string("front_page", "post/list");
|
||||
|
@ -137,7 +137,7 @@ class Setup extends Extension {
|
|||
$config->set_default_string("theme", "default");
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "setup")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "setup")) {
|
||||
global $user;
|
||||
if(!$user->is_admin()) {
|
||||
$this->theme->display_error($event->page, "Permission Denied", "This page is for admins only");
|
||||
|
@ -164,7 +164,7 @@ class Setup extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$themes = array();
|
||||
foreach(glob("themes/*") as $theme_dirname) {
|
||||
$name = str_replace("themes/", "", $theme_dirname);
|
||||
|
@ -181,7 +181,8 @@ class Setup extends Extension {
|
|||
$sb->add_choice_option("theme", $themes, "<br>Theme: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
||||
if($event instanceof ConfigSaveEvent) {
|
||||
foreach($_POST as $_name => $junk) {
|
||||
if(substr($_name, 0, 6) == "_type_") {
|
||||
$name = substr($_name, 6);
|
||||
|
@ -196,7 +197,7 @@ class Setup extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
if($event->user->is_admin()) {
|
||||
$event->add_link("Board Config", make_link("setup"));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ class TagEdit extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("tag_edit", "TagEditTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tag_edit")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "tag_edit")) {
|
||||
global $page;
|
||||
if($event->get_arg(0) == "replace") {
|
||||
global $user;
|
||||
|
@ -27,7 +27,7 @@ class TagEdit extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoSetEvent')) {
|
||||
if($event instanceof ImageInfoSetEvent) {
|
||||
if($this->can_tag()) {
|
||||
global $database;
|
||||
send_event(new TagSetEvent($event->image_id, $_POST['tag_edit__tags']));
|
||||
|
@ -40,36 +40,36 @@ class TagEdit extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'TagSetEvent')) {
|
||||
if($event instanceof TagSetEvent) {
|
||||
global $database;
|
||||
$database->set_tags($event->image_id, $event->tags);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SourceSetEvent')) {
|
||||
if($event instanceof SourceSetEvent) {
|
||||
global $database;
|
||||
$database->set_source($event->image_id, $event->source);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
if($event instanceof ImageDeletionEvent) {
|
||||
global $database;
|
||||
$database->delete_tags_from_image($event->image->id);
|
||||
}
|
||||
|
||||
if(is_a($event, 'AdminBuildingEvent')) {
|
||||
if($event instanceof AdminBuildingEvent) {
|
||||
$this->theme->display_mass_editor($event->page);
|
||||
}
|
||||
|
||||
// When an alias is added, oldtag becomes inaccessable
|
||||
if(is_a($event, 'AddAliasEvent')) {
|
||||
if($event instanceof AddAliasEvent) {
|
||||
$this->mass_tag_edit($event->oldtag, $event->newtag);
|
||||
}
|
||||
|
||||
if(is_a($event, 'ImageInfoBoxBuildingEvent')) {
|
||||
if($event instanceof ImageInfoBoxBuildingEvent) {
|
||||
global $user;
|
||||
$event->add_part($this->theme->get_editor_html($event->image, $user), 40);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Tag Editing");
|
||||
$sb->add_bool_option("tag_edit_anon", "Allow anonymous tag editing: ");
|
||||
$sb->add_bool_option("source_edit_anon", "<br>Allow anonymous source editing: ");
|
||||
|
|
|
@ -7,7 +7,7 @@ class TagList extends Extension {
|
|||
public function receive_event($event) {
|
||||
if($this->theme == null) $this->theme = get_theme_object("tag_list", "TagListTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_int("tag_list_length", 15);
|
||||
$config->set_default_int("tags_min", 3);
|
||||
|
@ -15,7 +15,7 @@ class TagList extends Extension {
|
|||
$config->set_default_string("tag_list_image_type", 'related');
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tags")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "tags")) {
|
||||
global $page;
|
||||
|
||||
$this->theme->set_navigation($this->build_navigation());
|
||||
|
@ -37,7 +37,7 @@ class TagList extends Extension {
|
|||
$this->theme->display_page($page);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PostListBuildingEvent')) {
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
global $config;
|
||||
if($config->get_int('tag_list_length') > 0) {
|
||||
if(!empty($event->search_terms)) {
|
||||
|
@ -49,7 +49,7 @@ class TagList extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $config;
|
||||
if($config->get_int('tag_list_length') > 0) {
|
||||
if($config->get_string('tag_list_image_type') == 'related') {
|
||||
|
@ -61,7 +61,7 @@ class TagList extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Tag Map Options");
|
||||
$sb->add_int_option("tags_min", "Only show tags used at least "); $sb->add_label(" times");
|
||||
$event->panel->add_block($sb);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Upgrade extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
$this->do_things();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ class Upload extends Extension {
|
|||
|
||||
$is_full = (disk_free_space("./images/") < 100*1024*1024);
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_int('upload_count', 3);
|
||||
$config->set_default_int('upload_size', '256KB');
|
||||
$config->set_default_bool('upload_anon', false);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PostListBuildingEvent')) {
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
global $user;
|
||||
if($this->can_upload($user)) {
|
||||
if($is_full) {
|
||||
|
@ -27,7 +27,7 @@ class Upload extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "upload")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "upload")) {
|
||||
if(count($_FILES) + count($_POST) > 0) {
|
||||
$tags = tag_explode($_POST['tags']);
|
||||
$source = isset($_POST['source']) ? $_POST['source'] : null;
|
||||
|
@ -71,7 +71,7 @@ class Upload extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Upload");
|
||||
$sb->position = 10;
|
||||
$sb->add_int_option("upload_count", "Max uploads: ");
|
||||
|
@ -86,7 +86,7 @@ class Upload extends Extension {
|
|||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, "DataUploadEvent")) {
|
||||
if($event instanceof DataUploadEvent) {
|
||||
global $config;
|
||||
if($is_full) {
|
||||
$event->veto("Upload failed; disk nearly full");
|
||||
|
|
|
@ -43,13 +43,13 @@ class UserPage extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("user", "UserPageTheme");
|
||||
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
$config->set_default_bool("login_signup_enabled", true);
|
||||
$config->set_default_int("login_memory", 365);
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "user_admin")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "user_admin")) {
|
||||
global $user;
|
||||
global $database;
|
||||
global $config;
|
||||
|
@ -97,7 +97,7 @@ class UserPage extends Extension {
|
|||
$this->set_more_wrapper($event->page);
|
||||
}
|
||||
}
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "user")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "user")) {
|
||||
global $user;
|
||||
global $database;
|
||||
$duser = ($event->count_args() == 0) ? $user : $database->get_user_by_name($event->get_arg(0));
|
||||
|
@ -111,7 +111,7 @@ class UserPage extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserPageBuildingEvent')) {
|
||||
if($event instanceof UserPageBuildingEvent) {
|
||||
global $user;
|
||||
global $config;
|
||||
$this->theme->display_user_page($event->page, $event->user, $user);
|
||||
|
@ -127,7 +127,7 @@ class UserPage extends Extension {
|
|||
}
|
||||
|
||||
// user info is shown on all pages
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
if($event instanceof PageRequestEvent) {
|
||||
global $user;
|
||||
global $page;
|
||||
|
||||
|
@ -142,23 +142,23 @@ class UserPage extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("User Options");
|
||||
$sb->add_bool_option("login_signup_enabled", "Allow new signups: ");
|
||||
$sb->add_longtext_option("login_tac", "<br>Terms & Conditions:<br>");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
if($event instanceof UserBlockBuildingEvent) {
|
||||
$event->add_link("User Config", make_link("user"));
|
||||
$event->add_link("Log Out", make_link("user_admin/logout"), 99);
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserCreationEvent')) {
|
||||
if($event instanceof UserCreationEvent) {
|
||||
if($this->check_user_creation($event)) $this->create_user($event);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SearchTermParseEvent')) {
|
||||
if($event instanceof SearchTermParseEvent) {
|
||||
$matches = array();
|
||||
if(preg_match("/(poster|user)=(.*)/i", $event->term, $matches)) {
|
||||
global $database;
|
||||
|
|
|
@ -45,7 +45,7 @@ class ViewImage extends Extension {
|
|||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("view", "ViewTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "post") && ($event->get_arg(0) == "view")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "post") && ($event->get_arg(0) == "view")) {
|
||||
$image_id = int_escape($event->get_arg(1));
|
||||
|
||||
global $database;
|
||||
|
@ -63,7 +63,7 @@ class ViewImage extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "post") && ($event->get_arg(0) == "set")) {
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "post") && ($event->get_arg(0) == "set")) {
|
||||
$image_id = int_escape($_POST['image_id']);
|
||||
|
||||
send_event(new ImageInfoSetEvent($image_id));
|
||||
|
@ -73,7 +73,7 @@ class ViewImage extends Extension {
|
|||
$event->page->set_redirect(make_link("post/view/$image_id", $query));
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $user;
|
||||
$iibbe = new ImageInfoBoxBuildingEvent($event->get_image(), $user);
|
||||
send_event($iibbe);
|
||||
|
|
Reference in a new issue