From 077a5e7727db57e63b9414ad50e9266255f37d26 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 19 Feb 2023 11:24:33 +0000 Subject: [PATCH] fix php8.2 warnings --- core/database.php | 6 +++--- core/imageboard/image.php | 1 + ext/media/main.php | 18 +++++++++--------- ext/tag_editcloud/main.php | 6 +++--- ext/tag_list/main.php | 2 +- ext/upload/theme.php | 6 +++--- ext/user/main.php | 4 ++-- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/core/database.php b/core/database.php index f83e1419..78f8cf80 100644 --- a/core/database.php +++ b/core/database.php @@ -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"); } } } diff --git a/core/imageboard/image.php b/core/imageboard/image.php index 84540254..139b6e40 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -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 { diff --git a/ext/media/main.php b/ext/media/main.php index d4ff5f32..f7451f41 100644 --- a/ext/media/main.php +++ b/ext/media/main.php @@ -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); diff --git a/ext/tag_editcloud/main.php b/ext/tag_editcloud/main.php index c704a49d..1b17bf3d 100644 --- a/ext/tag_editcloud/main.php +++ b/ext/tag_editcloud/main.php @@ -165,13 +165,13 @@ class TagEditCloud extends Extension $precloud .= "\n"; } $last_used_cat = $current_cat; - $precloud .= " {$h_tag} \n"; + $precloud .= " {$h_tag} \n"; continue; } else { - $entry = " {$h_tag} \n"; + $entry = " {$h_tag} \n"; } } else { - $entry = " {$h_tag} \n"; + $entry = " {$h_tag} \n"; } if ($counter++ <= $def_count) { diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 7ccb5c33..ec598443 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -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 .= " $h_tag_no_underscores \n"; + $html .= " $h_tag_no_underscores \n"; } if (SPEED_HAX) { diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 301408bd..d3e12630 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -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"])), ) ); } diff --git a/ext/user/main.php b/ext/user/main.php index 5e0ba224..84481aea 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -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'"));