php - fix string escape deprecation warning:

- ${varname} should be written as {$varname}
This commit is contained in:
towards-a-new-leftypol 2023-12-07 03:09:18 +00:00
parent 6808f65ef7
commit 974af939f9
3 changed files with 17 additions and 17 deletions

View File

@ -88,18 +88,18 @@ function get_list_of_locales($locale) {
if ($modifier) { if ($modifier) {
if ($country) { if ($country) {
if ($charset) if ($charset)
array_push($locale_names, "${lang}_$country.$charset@$modifier"); array_push($locale_names, "{$lang}_$country.$charset@$modifier");
array_push($locale_names, "${lang}_$country@$modifier"); array_push($locale_names, "{$lang}_$country@$modifier");
} elseif ($charset) } elseif ($charset)
array_push($locale_names, "${lang}.$charset@$modifier"); array_push($locale_names, "{$lang}.$charset@$modifier");
array_push($locale_names, "$lang@$modifier"); array_push($locale_names, "$lang@$modifier");
} }
if ($country) { if ($country) {
if ($charset) if ($charset)
array_push($locale_names, "${lang}_$country.$charset"); array_push($locale_names, "{$lang}_$country.$charset");
array_push($locale_names, "${lang}_$country"); array_push($locale_names, "{$lang}_$country");
} elseif ($charset) } elseif ($charset)
array_push($locale_names, "${lang}.$charset"); array_push($locale_names, "{$lang}.$charset");
array_push($locale_names, $lang); array_push($locale_names, $lang);
} }

View File

@ -1270,7 +1270,7 @@ function mod_move_reply($originBoard, $postID) {
// trigger themes // trigger themes
rebuildThemes('post', $targetBoard); rebuildThemes('post', $targetBoard);
// mod log // mod log
modLog("Moved post #${postID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#${newID})", $originBoard); modLog("Moved post #{$postID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#{$newID})", $originBoard);
// return to original board // return to original board
openBoard($originBoard); openBoard($originBoard);
@ -1450,7 +1450,7 @@ function mod_move($originBoard, $postID) {
} }
} }
modLog("Moved thread #${postID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#${newID})", $originBoard); modLog("Moved thread #{$postID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#{$newID})", $originBoard);
// build new thread // build new thread
buildThread($newID); buildThread($newID);
@ -1582,7 +1582,7 @@ function mod_merge($originBoard, $postID) {
// trigger themes // trigger themes
rebuildThemes('post', $targetBoard); rebuildThemes('post', $targetBoard);
modLog("Merged thread with #${sourceOp} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#${targetOp})", $originBoard); modLog("Merged thread with #{$sourceOp} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#{$targetOp})", $originBoard);
// redirect // redirect
header('Location: ?/' . sprintf($config['board_path'], $board['uri']) . $config['dir']['res'] . link_for($newpost) . '#' . $targetOp, true, $config['redirect_http']); header('Location: ?/' . sprintf($config['board_path'], $board['uri']) . $config['dir']['res'] . link_for($newpost) . '#' . $targetOp, true, $config['redirect_http']);
@ -1707,7 +1707,7 @@ function mod_merge($originBoard, $postID) {
} }
} }
modLog("Moved thread #${postID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#${newID})", $originBoard); modLog("Moved thread #{$postID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#{$newID})", $originBoard);
// build new thread // build new thread
buildThread($newID); buildThread($newID);
@ -1741,7 +1741,7 @@ function mod_merge($originBoard, $postID) {
// trigger themes // trigger themes
rebuildThemes('post', $targetBoard); rebuildThemes('post', $targetBoard);
modLog("Merged thread with #${newID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#${targetOp})", $targetBoard); modLog("Merged thread with #{$newID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#{$targetOp})", $targetBoard);
// redirect // redirect
header('Location: ?/' . sprintf($config['board_path'], $board['uri']) . $config['dir']['res'] . link_for($newpost) . '#' . $targetOp, true, $config['redirect_http']); header('Location: ?/' . sprintf($config['board_path'], $board['uri']) . $config['dir']['res'] . link_for($newpost) . '#' . $targetOp, true, $config['redirect_http']);
@ -1901,7 +1901,7 @@ function mod_ban_post(string $board, $delete, $post_num, $token = false) {
$dt = new DateTime("@$time"); $dt = new DateTime("@$time");
$autotag = ""; $autotag = "";
$autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post . "\r\n"; $autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post . "\r\n";
$autotag .= "/${board}/" . " " . $filehash . " " . $filename ."\r\n"; $autotag .= "/{$board}/" . " " . $filehash . " " . $filename ."\r\n";
$autotag .= $body . "\r\n"; $autotag .= $body . "\r\n";
$autotag = escape_markup_modifiers($autotag); $autotag = escape_markup_modifiers($autotag);
markup($autotag); markup($autotag);
@ -2015,7 +2015,7 @@ function mod_warning_post($board,$post, $token = false) {
$dt = new DateTime("@$time"); $dt = new DateTime("@$time");
$autotag = "Post warned\r\n"; $autotag = "Post warned\r\n";
$autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post . "\r\n"; $autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post . "\r\n";
$autotag .= "/${board}/" . " " . $filehash . " " . $filename ."\r\n"; $autotag .= "/{$board}/" . " " . $filehash . " " . $filename ."\r\n";
$autotag .= $body . "\r\n"; $autotag .= $body . "\r\n";
$autotag = escape_markup_modifiers($autotag); $autotag = escape_markup_modifiers($autotag);
markup($autotag); markup($autotag);
@ -2169,7 +2169,7 @@ function mod_delete($board, $post) {
$dt = new DateTime("@$time"); $dt = new DateTime("@$time");
$autotag = ""; $autotag = "";
$autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post . "\r\n"; $autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post . "\r\n";
$autotag .= "/${board}/" . " " . $filehash . " " . $filename ."\r\n"; $autotag .= "/{$board}/" . " " . $filehash . " " . $filename ."\r\n";
$autotag .= $body . "\r\n"; $autotag .= $body . "\r\n";
$autotag = escape_markup_modifiers($autotag); $autotag = escape_markup_modifiers($autotag);
markup($autotag); markup($autotag);
@ -2337,7 +2337,7 @@ function mod_deletebyip($boardName, $post, $global = false) {
$dt = new DateTime("@$time"); $dt = new DateTime("@$time");
$autotag = ""; $autotag = "";
$autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post['id'] . "\r\n"; $autotag .= $name . " " . $subject . " " . $dt->format('Y-m-d H:i:s') . " No.". $post['id'] . "\r\n";
$autotag .= "/${post['board']}/" . " " . $filehash . " " . $filename ."\r\n"; $autotag .= "/{$post['board']}/" . " " . $filehash . " " . $filename ."\r\n";
$autotag .= $body . "\r\n"; $autotag .= $body . "\r\n";
$autotag = escape_markup_modifiers($autotag); $autotag = escape_markup_modifiers($autotag);
markup($autotag); markup($autotag);

View File

@ -60,7 +60,7 @@ function Element($templateFile, array $options) {
} }
// Read the template file // Read the template file
if (@file_get_contents("{$config['dir']['template']}/${templateFile}")) { if (@file_get_contents("{$config['dir']['template']}/{$templateFile}")) {
$body = $twig->render($templateFile, $options); $body = $twig->render($templateFile, $options);
if ($config['minify_html'] && preg_match('/\.html$/', $templateFile)) { if ($config['minify_html'] && preg_match('/\.html$/', $templateFile)) {
@ -69,7 +69,7 @@ function Element($templateFile, array $options) {
return $body; return $body;
} else { } else {
throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!"); throw new Exception("Template file '{$templateFile}' does not exist or is empty in '{$config['dir']['template']}'!");
} }
} }