get_col("SELECT image_id FROM numeric_score_votes WHERE user_id=?", array($user_id));
+ if(count($image_ids) == 0) return;
+
$database->execute(
"DELETE FROM numeric_score_votes WHERE user_id=? AND image_id IN (".implode(",", $image_ids).")",
array($user_id));
diff --git a/ext/pm/main.php b/ext/pm/main.php
index d33c975d..ad37b06a 100644
--- a/ext/pm/main.php
+++ b/ext/pm/main.php
@@ -28,7 +28,7 @@ class PM {
$this->sent_date = $a["sent_date"];
$this->subject = $a["subject"];
$this->message = $a["message"];
- $this->is_read = undb_bool($a["is_read"]);
+ $this->is_read = bool_escape($a["is_read"]);
}
else {
$this->id = -1;
diff --git a/ext/random_image/main.php b/ext/random_image/main.php
index 5a77bb25..ced59d67 100644
--- a/ext/random_image/main.php
+++ b/ext/random_image/main.php
@@ -41,7 +41,7 @@ class RandomImage extends Extension {
if($action === "download") {
if(!is_null($image)) {
$page->set_mode("data");
- $page->set_type("image/jpeg");
+ $page->set_type($image->get_mime_type());
$page->set_data(file_get_contents($image->get_image_filename()));
}
}
diff --git a/ext/setup/main.php b/ext/setup/main.php
index 195c0904..83f7c235 100644
--- a/ext/setup/main.php
+++ b/ext/setup/main.php
@@ -291,6 +291,10 @@ class Setup extends Extension {
}
}
log_warning("setup", "Configuration updated");
+ foreach(glob("data/cache/*.css") as $css_cache) {
+ unlink($css_cache);
+ }
+ log_warning("setup", "Cache cleared");
}
public function onUserBlockBuilding(UserBlockBuildingEvent $event) {
diff --git a/install.php b/install.php
index a08ac4d0..b177fd5d 100644
--- a/install.php
+++ b/install.php
@@ -300,6 +300,14 @@ function create_tables() { // {{{
try {
$db = new Database();
+ if ( $db->count_tables() > 0 ) {
+ echo "
+ Warning: The Database schema is not empty!
+ Please ensure that the database you are installing Shimmie with is empty before continuing.
+ Once you have emptied the database of any tables, please hit 'refresh' to continue.
";
+ exit;
+ }
+
$db->create_table("aliases", "
oldtag VARCHAR(128) NOT NULL PRIMARY KEY,
newtag VARCHAR(128) NOT NULL,
diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php
index 718e95cd..c5823dbd 100644
--- a/themes/danbooru/view.theme.php
+++ b/themes/danbooru/view.theme.php
@@ -42,8 +42,10 @@ class CustomViewImageTheme extends ViewImageTheme {
if($image->rating == null || $image->rating == "u"){
$image->rating = "u";
}
+ if(class_exists("Ratings")) {
$h_rating = Ratings::rating_to_human($image->rating);
$html .= "
Rating: $h_rating";
+ }
}
return $html;