diff --git a/core/polyfills.php b/core/polyfills.php index 87e739e3..c39ec13a 100644 --- a/core/polyfills.php +++ b/core/polyfills.php @@ -281,6 +281,7 @@ const MIME_TYPE_MAP = [ 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mov' => 'video/quicktime', + 'flv' => 'video/x-flv', 'php' => 'text/x-php', 'mp4' => 'video/mp4', 'ogv' => 'video/ogg', @@ -502,7 +503,7 @@ function bool_escape($input): bool */ if (is_bool($input)) { return $input; - } elseif (is_int($input)) { + } elseif (is_numeric($input)) { return ($input === 1); } else { $value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); diff --git a/ext/rating/main.php b/ext/rating/main.php index 66778d91..2386c3b0 100644 --- a/ext/rating/main.php +++ b/ext/rating/main.php @@ -341,7 +341,7 @@ class Ratings extends Extension $old = $_POST["rating_old"]; $new = $_POST["rating_new"]; - if ($user->can("bulk_edit_image_rating")) { + if($user->can(Permissions::BULK_EDIT_IMAGE_RATING)) { $database->execute("UPDATE images SET rating = :new WHERE rating = :old", ["new"=>$new, "old"=>$old ]); } @@ -506,7 +506,7 @@ class Ratings extends Extension private function can_rate(): bool { global $user; - if ($user->can("edit_image_rating")) { + if ($user->can(Permissions::EDIT_IMAGE_RATING)) { return true; } return false; diff --git a/ext/upload/main.php b/ext/upload/main.php index 25a0daf9..9c7879ad 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -35,9 +35,6 @@ class DataUploadEvent extends Event assert(is_array($metadata["tags"])); assert(is_string($metadata["source"]) || is_null($metadata["source"])); - // DB limits to 64 char filenames - $metadata['filename'] = substr($metadata['filename'], 0, 63); - $this->metadata = $metadata; $this->set_tmpname($tmpname); diff --git a/themes/danbooru2/ext_manager.theme.php b/themes/danbooru2/ext_manager.theme.php index 247406c8..270ec929 100644 --- a/themes/danbooru2/ext_manager.theme.php +++ b/themes/danbooru2/ext_manager.theme.php @@ -8,7 +8,7 @@ class CustomExtManagerTheme extends ExtManagerTheme parent::display_table($page, $extensions, $editable); } - public function display_doc(Page $page, ExtensionInfo $info) + public function display_doc(Page $page, ExtensionManagerInfo $info) { $page->disable_left(); parent::display_doc($page, $info); diff --git a/themes/danbooru2/view.theme.php b/themes/danbooru2/view.theme.php index c655ecb6..89266795 100644 --- a/themes/danbooru2/view.theme.php +++ b/themes/danbooru2/view.theme.php @@ -51,8 +51,10 @@ class CustomViewImageTheme extends ViewImageTheme if ($image->rating == null || $image->rating == "?") { $image->rating = "?"; } - $h_rating = Ratings::rating_to_human($image->rating); - $html .= "
Rating: $h_rating"; + if (Extension::is_enabled(RatingsInfo::KEY)) { + $h_rating = Ratings::rating_to_human($image->rating); + $html .= "
Rating: $h_rating"; + } } return $html;