fix php8.2 warnings

This commit is contained in:
Shish 2023-02-19 11:24:33 +00:00
parent 7d7d555671
commit 077a5e7727
7 changed files with 22 additions and 21 deletions

View file

@ -360,10 +360,10 @@ class Database
$this->execute("UPDATE $table SET $column = ($column IN ('Y', 1))");
}
if ($d == DatabaseDriverID::PGSQL && $include_postgres) {
$this->execute("ALTER TABLE $table ADD COLUMN ${column}_b BOOLEAN DEFAULT FALSE NOT NULL");
$this->execute("UPDATE $table SET ${column}_b = ($column = 'Y')");
$this->execute("ALTER TABLE $table ADD COLUMN {$column}_b BOOLEAN DEFAULT FALSE NOT NULL");
$this->execute("UPDATE $table SET {$column}_b = ($column = 'Y')");
$this->execute("ALTER TABLE $table DROP COLUMN $column");
$this->execute("ALTER TABLE $table RENAME COLUMN ${column}_b TO $column");
$this->execute("ALTER TABLE $table RENAME COLUMN {$column}_b TO $column");
}
}
}

View file

@ -17,6 +17,7 @@ use GQLA\Query;
* image per se, but could be a video, sound file, or any
* other supported upload type.
*/
#[\AllowDynamicProperties]
#[Type(name: "Post")]
class Image
{

View file

@ -272,12 +272,12 @@ class Media extends Extension
{
if ($event->image->width && $event->image->height && $event->image->length) {
$s = ((int)($event->image->length / 100))/10;
$event->replace('$size', "{$event->image->width}x{$event->image->height}, ${s}s");
$event->replace('$size', "{$event->image->width}x{$event->image->height}, {$s}s");
} elseif ($event->image->width && $event->image->height) {
$event->replace('$size', "{$event->image->width}x{$event->image->height}");
} elseif ($event->image->length) {
$s = ((int)($event->image->length / 100))/10;
$event->replace('$size', "${s}s");
$event->replace('$size', "{$s}s");
}
}
@ -575,7 +575,7 @@ class Media extends Extension
$input_ext = self::determine_ext($input_mime);
$file_arg = "${input_ext}:\"${input_path}[0]\"";
$file_arg = "{$input_ext}:\"{$input_path}[0]\"";
if ($resize_type===Media::RESIZE_TYPE_FIT_BLUR_PORTRAIT) {
if ($new_height>$new_width) {
@ -588,16 +588,16 @@ class Media extends Extension
switch ($resize_type) {
case Media::RESIZE_TYPE_FIT:
case Media::RESIZE_TYPE_STRETCH:
$args .= "${file_arg} ${resize_arg} ${new_width}x${new_height}${resize_suffix} -background ${bg} -flatten ";
$args .= "{$file_arg} {$resize_arg} {$new_width}x{$new_height}{$resize_suffix} -background {$bg} -flatten ";
break;
case Media::RESIZE_TYPE_FILL:
$args .= "${file_arg} ${resize_arg} ${new_width}x${new_height}\^ -background ${bg} -flatten -gravity center -extent ${new_width}x${new_height} ";
$args .= "{$file_arg} {$resize_arg} {$new_width}x{$new_height}\^ -background {$bg} -flatten -gravity center -extent {$new_width}x{$new_height} ";
break;
case Media::RESIZE_TYPE_FIT_BLUR:
$blur_size = max(ceil(max($new_width, $new_height) / 25), 5);
$args .= "${file_arg} ".
"\( -clone 0 -auto-orient -resize ${new_width}x${new_height}\^ -background ${bg} -flatten -gravity center -fill black -colorize 50% -extent ${new_width}x${new_height} -blur 0x${blur_size} \) ".
"\( -clone 0 -auto-orient -resize ${new_width}x${new_height} \) ".
$args .= "{$file_arg} ".
"\( -clone 0 -auto-orient -resize {$new_width}x{$new_height}\^ -background {$bg} -flatten -gravity center -fill black -colorize 50% -extent {$new_width}x{$new_height} -blur 0x{$blur_size} \) ".
"\( -clone 0 -auto-orient -resize {$new_width}x{$new_height} \) ".
"-delete 0 -gravity center -compose over -composite";
break;
}
@ -613,7 +613,7 @@ class Media extends Extension
}
$args .= " -quality ${output_quality} ";
$args .= " -quality {$output_quality} ";
$output_ext = self::determine_ext($output_mime);

View file

@ -165,13 +165,13 @@ class TagEditCloud extends Extension
$precloud .= "</span><span class='tag-category'>\n";
}
$last_used_cat = $current_cat;
$precloud .= "&nbsp;<span onclick='{$js}' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>{$h_tag}</span>&nbsp;\n";
$precloud .= "&nbsp;<span onclick='{$js}' class='tag-selected' style='font-size: {$size}em$color' title='{$row['count']}'>{$h_tag}</span>&nbsp;\n";
continue;
} else {
$entry = "&nbsp;<span onclick='{$js}' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>{$h_tag}</span>&nbsp;\n";
$entry = "&nbsp;<span onclick='{$js}' class='tag-selected' style='font-size: {$size}em$color' title='{$row['count']}'>{$h_tag}</span>&nbsp;\n";
}
} else {
$entry = "&nbsp;<span onclick='{$js}' style='font-size: ${size}em$color' title='${row['count']}'>{$h_tag}</span>&nbsp;\n";
$entry = "&nbsp;<span onclick='{$js}' style='font-size: {$size}em$color' title='{$row['count']}'>{$h_tag}</span>&nbsp;\n";
}
if ($counter++ <= $def_count) {

View file

@ -282,7 +282,7 @@ class TagList extends Extension
if (class_exists('Shimmie2\TagCategories')) {
$h_tag_no_underscores = $this->tagcategories->getTagHtml($h_tag, $tag_category_dict);
}
$html .= "&nbsp;<a style='font-size: ${size}em' href='$link'>$h_tag_no_underscores</a>&nbsp;\n";
$html .= "&nbsp;<a style='font-size: {$size}em' href='$link'>$h_tag_no_underscores</a>&nbsp;\n";
}
if (SPEED_HAX) {

View file

@ -96,9 +96,9 @@ class UploadTheme extends Themelet
for ($i=0; $i<$upload_count; $i++) {
$upload_list->appendChild(
TR(
TD(["colspan"=>$tl_enabled ? 2 : 4], INPUT(["type"=>"file", "name"=>"data${i}[]", "accept"=>$accept, "multiple"=>true])),
$tl_enabled ? TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"url${i}"])) : emptyHTML(),
TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"tags${i}", "class"=>"autocomplete_tags", "autocomplete"=>"off"])),
TD(["colspan"=>$tl_enabled ? 2 : 4], INPUT(["type"=>"file", "name"=>"data{$i}[]", "accept"=>$accept, "multiple"=>true])),
$tl_enabled ? TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"url{$i}"])) : emptyHTML(),
TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"tags{$i}", "class"=>"autocomplete_tags", "autocomplete"=>"off"])),
)
);
}

View file

@ -430,10 +430,10 @@ class UserPage extends Extension
"Can't find the user named ".html_escape($matches[2])
);
}
$event->add_querylet(new Querylet("images.owner_id ${matches[1]}= {$duser->id}"));
$event->add_querylet(new Querylet("images.owner_id {$matches[1]}= {$duser->id}"));
} elseif (preg_match(self::USER_ID_SEARCH_REGEX, $event->term, $matches)) {
$user_id = int_escape($matches[2]);
$event->add_querylet(new Querylet("images.owner_id ${matches[1]}= $user_id"));
$event->add_querylet(new Querylet("images.owner_id {$matches[1]}= $user_id"));
} elseif ($user->can(Permissions::VIEW_IP) && preg_match("/^(?:poster|user)_ip[=|:]([0-9\.]+)$/i", $event->term, $matches)) {
$user_ip = $matches[1]; // FIXME: ip_escape?
$event->add_querylet(new Querylet("images.owner_ip = '$user_ip'"));