Small fixes and corrections

This commit is contained in:
Matthew Barbour 2019-10-10 10:25:11 -05:00 committed by Rogue Ralsha
parent c17c84f15f
commit 016fb6be65
5 changed files with 9 additions and 9 deletions

View File

@ -281,6 +281,7 @@ const MIME_TYPE_MAP = [
'mpg' => 'video/mpeg', 'mpg' => 'video/mpeg',
'mpeg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
'mov' => 'video/quicktime', 'mov' => 'video/quicktime',
'flv' => 'video/x-flv',
'php' => 'text/x-php', 'php' => 'text/x-php',
'mp4' => 'video/mp4', 'mp4' => 'video/mp4',
'ogv' => 'video/ogg', 'ogv' => 'video/ogg',
@ -502,7 +503,7 @@ function bool_escape($input): bool
*/ */
if (is_bool($input)) { if (is_bool($input)) {
return $input; return $input;
} elseif (is_int($input)) { } elseif (is_numeric($input)) {
return ($input === 1); return ($input === 1);
} else { } else {
$value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); $value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);

View File

@ -341,7 +341,7 @@ class Ratings extends Extension
$old = $_POST["rating_old"]; $old = $_POST["rating_old"];
$new = $_POST["rating_new"]; $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 ]); $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 private function can_rate(): bool
{ {
global $user; global $user;
if ($user->can("edit_image_rating")) { if ($user->can(Permissions::EDIT_IMAGE_RATING)) {
return true; return true;
} }
return false; return false;

View File

@ -35,9 +35,6 @@ class DataUploadEvent extends Event
assert(is_array($metadata["tags"])); assert(is_array($metadata["tags"]));
assert(is_string($metadata["source"]) || is_null($metadata["source"])); 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->metadata = $metadata;
$this->set_tmpname($tmpname); $this->set_tmpname($tmpname);

View File

@ -8,7 +8,7 @@ class CustomExtManagerTheme extends ExtManagerTheme
parent::display_table($page, $extensions, $editable); 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(); $page->disable_left();
parent::display_doc($page, $info); parent::display_doc($page, $info);

View File

@ -51,8 +51,10 @@ class CustomViewImageTheme extends ViewImageTheme
if ($image->rating == null || $image->rating == "?") { if ($image->rating == null || $image->rating == "?") {
$image->rating = "?"; $image->rating = "?";
} }
$h_rating = Ratings::rating_to_human($image->rating); if (Extension::is_enabled(RatingsInfo::KEY)) {
$html .= "<br>Rating: $h_rating"; $h_rating = Ratings::rating_to_human($image->rating);
$html .= "<br>Rating: $h_rating";
}
} }
return $html; return $html;