check for classes being loaded, not files existing

This commit is contained in:
Shish 2012-05-23 10:39:21 +01:00
parent 2e76add61b
commit bfd4ddea17
8 changed files with 18 additions and 18 deletions

View file

@ -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);

View file

@ -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'])){

View file

@ -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];

View file

@ -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 .= '<p><a href="javascript:

View file

@ -140,11 +140,11 @@ class Layout {
# be nice to be correct
case "post":
case "upload":
if(file_exists("ext/numeric_score")){ $custom_sublinks .= "<li><b>Popular by </b><a href='".make_link('popular_by_day')."'>Day</a>/<a href='".make_link('popular_by_month')."'>Month</a>/<a href='".make_link('popular_by_year')."'>Year</a></li>";}
if(class_exists("NumericScore")){ $custom_sublinks .= "<li><b>Popular by </b><a href='".make_link('popular_by_day')."'>Day</a>/<a href='".make_link('popular_by_month')."'>Month</a>/<a href='".make_link('popular_by_year')."'>Year</a></li>";}
$custom_sublinks .= "<li><a href='".make_link('post/list')."'>All</a></li>";
if(file_exists("ext/favorites")){ $custom_sublinks .= "<li><a href='".make_link("post/list/favorited_by=$username/1")."'>My Favorites</a></li>";}
if(file_exists("ext/rss_images")){ $custom_sublinks .= "<li><a href='".make_link('rss/images')."'>Feed</a></li>";}
if(file_exists("ext/random_image")){ $custom_sublinks .= "<li><a href='".make_link("random_image/view")."'>Random Image</a></li>";}
if(class_exists("Favorites")){ $custom_sublinks .= "<li><a href='".make_link("post/list/favorited_by=$username/1")."'>My Favorites</a></li>";}
if(class_exists("RSS_Images")){ $custom_sublinks .= "<li><a href='".make_link('rss/images')."'>Feed</a></li>";}
if(class_exists("RandomImage")){ $custom_sublinks .= "<li><a href='".make_link("random_image/view")."'>Random Image</a></li>";}
if($hw){ $custom_sublinks .= "<li><a href='".make_link("wiki/posts")."'>Help</a></li>";
}else{ $custom_sublinks .= "<li><a href='".make_link("ext_doc/index")."'>Help</a></li>";}
break;

View file

@ -38,7 +38,7 @@ class CustomViewImageTheme extends ViewImageTheme {
$html .= "<br>Source: <a href='$h_source'>link</a>";
}
if(file_exists("ext/rating")) {
if(class_exists("Ratings")) {
if($image->rating == null || $image->rating == "u"){
$image->rating = "u";
}

View file

@ -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 .= "<b>Popular by </b><a href='".make_link('popular_by_day')."'>Day</a><b>/</b><a href='".make_link('popular_by_month')."'>Month</a><b>/</b><a href='".make_link('popular_by_year')."'>Year</a> ";}
if(class_exists("NumericScore")){ $cs .= "<b>Popular by </b><a href='".make_link('popular_by_day')."'>Day</a><b>/</b><a href='".make_link('popular_by_month')."'>Month</a><b>/</b><a href='".make_link('popular_by_year')."'>Year</a> ";}
$cs .= "<a class='tab' href='".make_link('post/list')."'>All</a>";
if(file_exists("ext/favorites")){ $cs .= "<a class='tab' href='".make_link("post/list/favorited_by=$username/1")."'>My Favorites</a>";}
if(file_exists("ext/rss_images")){ $cs .= "<a class='tab' href='".make_link('rss/images')."'>Feed</a>";}
if(file_exists("ext/random_image")){ $cs .= "<a class='tab' href='".make_link("random_image/view")."'>Random Image</a>";}
if(class_exists("Favorites")){ $cs .= "<a class='tab' href='".make_link("post/list/favorited_by=$username/1")."'>My Favorites</a>";}
if(class_exists("RSS_Images")){ $cs .= "<a class='tab' href='".make_link('rss/images')."'>Feed</a>";}
if(class_exists("Random_Image")){ $cs .= "<a class='tab' href='".make_link("random_image/view")."'>Random Image</a>";}
if($hw){ $cs .= "<a class='tab' href='".make_link("wiki/posts")."'>Help</a>";
}else{ $cs .= "<a class='tab' href='".make_link("ext_doc/index")."'>Help</a>";}
break;

View file

@ -44,7 +44,7 @@ class CustomViewImageTheme extends ViewImageTheme {
$html .= "<br>Source: <a href='$h_source'>link</a>";
}
if(file_exists("ext/rating")) {
if(class_exists("Ratings")) {
if($image->rating == null || $image->rating == "u"){
$image->rating = "u";
}