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',
'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);

View file

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

View file

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

View file

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

View file

@ -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 .= "<br>Rating: $h_rating";
if (Extension::is_enabled(RatingsInfo::KEY)) {
$h_rating = Ratings::rating_to_human($image->rating);
$html .= "<br>Rating: $h_rating";
}
}
return $html;