From bfd4ddea17c945b038fa040c639bff4cf18f7a5d Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 23 May 2012 10:39:21 +0100 Subject: [PATCH] check for classes being loaded, not files existing --- ext/home/main.php | 4 ++-- ext/image/main.php | 2 +- ext/upload/main.php | 2 +- ext/upload/theme.php | 8 ++++---- themes/danbooru/layout.class.php | 8 ++++---- themes/danbooru/view.theme.php | 2 +- themes/lite/layout.class.php | 8 ++++---- themes/lite/view.theme.php | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ext/home/main.php b/ext/home/main.php index 548b8ea7..ca00a98d 100644 --- a/ext/home/main.php +++ b/ext/home/main.php @@ -70,8 +70,8 @@ class Home extends Extension { } else { $main_links = '[url=site://post/list]Posts[/url] [url=site://comment/list]Comments[/url] [url=site://tags]Tags[/url]'; - if(file_exists("ext/pools")) {$main_links .= ' [url=site://pools]Pools[/url]';} - if(file_exists("ext/wiki")) {$main_links .= ' [url=site://wiki]Wiki[/url]';} + if(class_exists("Pools")) {$main_links .= ' [url=site://pools]Pools[/url]';} + if(class_exists("Wiki")) {$main_links .= ' [url=site://wiki]Wiki[/url]';} $main_links .= ' [url=site://ext_doc]>>[/url]'; } $main_links = format_text($main_links); diff --git a/ext/image/main.php b/ext/image/main.php index 29f71dc5..6f72a557 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -295,7 +295,7 @@ class ImageIO extends Extension { if($handler == "merge" || isset($_GET['update'])) { $merged = array_merge($image->get_tag_array(), $existing->get_tag_array()); send_event(new TagSetEvent($existing, $merged)); - if(isset($_GET['rating']) && isset($_GET['update']) && file_exists("ext/rating")){ + if(isset($_GET['rating']) && isset($_GET['update']) && class_exists("Ratings")){ send_event(new RatingSetEvent($existing, $user, $_GET['rating'])); } if(isset($_GET['source']) && isset($_GET['update'])){ diff --git a/ext/upload/main.php b/ext/upload/main.php index 06723691..c836f03f 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -329,7 +329,7 @@ class Upload extends Extension { } // Checks if url contains rating, also checks if the rating extension is enabled. - if($config->get_string("transload_engine", "none") != "none" && file_exists("ext/rating") && !empty($_GET['rating'])) { + if($config->get_string("transload_engine", "none") != "none" && class_exists("Ratings") && !empty($_GET['rating'])) { // Rating event will validate that this is s/q/e/u $rating = strtolower($_GET['rating']); $rating = $rating[0]; diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 80494214..8fe5c3fe 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -215,10 +215,10 @@ class UploadTheme extends Themelet { // Bookmarklet checks if shimmie supports ext. If not, won't upload to site/shows alert saying not supported. $supported_ext = "jpg jpeg gif png"; - if(file_exists("ext/handle_flash")){$supported_ext .= " swf";} - if(file_exists("ext/handle_ico")){$supported_ext .= " ico ani cur";} - if(file_exists("ext/handle_mp3")){$supported_ext .= " mp3";} - if(file_exists("ext/handle_svg")){$supported_ext .= " svg";} + if(class_exists("FlashFileHandler")){$supported_ext .= " swf";} + if(class_exists("ICOFileHandler")){$supported_ext .= " ico ani cur";} + if(class_exists("MP3FileHandler")){$supported_ext .= " mp3";} + if(class_exists("SVGFileHandler")){$supported_ext .= " svg";} $title = "Booru to " . $config->get_string('title'); // CA=0: Ask to use current or new tags | CA=1: Always use current tags | CA=2: Always use new tags $html .= '

Day/Month/Year";} + if(class_exists("NumericScore")){ $custom_sublinks .= "

  • Popular by Day/Month/Year
  • ";} $custom_sublinks .= "
  • All
  • "; - if(file_exists("ext/favorites")){ $custom_sublinks .= "
  • My Favorites
  • ";} - if(file_exists("ext/rss_images")){ $custom_sublinks .= "
  • Feed
  • ";} - if(file_exists("ext/random_image")){ $custom_sublinks .= "
  • Random Image
  • ";} + if(class_exists("Favorites")){ $custom_sublinks .= "
  • My Favorites
  • ";} + if(class_exists("RSS_Images")){ $custom_sublinks .= "
  • Feed
  • ";} + if(class_exists("RandomImage")){ $custom_sublinks .= "
  • Random Image
  • ";} if($hw){ $custom_sublinks .= "
  • Help
  • "; }else{ $custom_sublinks .= "
  • Help
  • ";} break; diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php index c5823dbd..d7f0008b 100644 --- a/themes/danbooru/view.theme.php +++ b/themes/danbooru/view.theme.php @@ -38,7 +38,7 @@ class CustomViewImageTheme extends ViewImageTheme { $html .= "
    Source: link"; } - if(file_exists("ext/rating")) { + if(class_exists("Ratings")) { if($image->rating == null || $image->rating == "u"){ $image->rating = "u"; } diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php index 14ea1e88..39364bc4 100644 --- a/themes/lite/layout.class.php +++ b/themes/lite/layout.class.php @@ -94,11 +94,11 @@ class Layout { # the subnav links aren't shown, but it would # be nice to be correct case "post": - if(file_exists("ext/numeric_score")){ $cs .= "Popular by Day/Month/Year ";} + if(class_exists("NumericScore")){ $cs .= "Popular by Day/Month/Year ";} $cs .= "All"; - if(file_exists("ext/favorites")){ $cs .= "My Favorites";} - if(file_exists("ext/rss_images")){ $cs .= "Feed";} - if(file_exists("ext/random_image")){ $cs .= "Random Image";} + if(class_exists("Favorites")){ $cs .= "My Favorites";} + if(class_exists("RSS_Images")){ $cs .= "Feed";} + if(class_exists("Random_Image")){ $cs .= "Random Image";} if($hw){ $cs .= "Help"; }else{ $cs .= "Help";} break; diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php index a30c5b1d..c86ceb92 100644 --- a/themes/lite/view.theme.php +++ b/themes/lite/view.theme.php @@ -44,7 +44,7 @@ class CustomViewImageTheme extends ViewImageTheme { $html .= "
    Source: link"; } - if(file_exists("ext/rating")) { + if(class_exists("Ratings")) { if($image->rating == null || $image->rating == "u"){ $image->rating = "u"; }