Port the code to PHP 8.5.

Replace the short open tags and the removed functions (mcrypt, mysql_error,
salt-less crypt). Decode the reCAPTCHA reply as JSON, turn off mysqli
exceptions, drop stripslashes(), and default missing input values.
Fix the misplaced continue in prune_images().
This commit is contained in:
tim
2026-09-25 21:18:58 +02:00
parent 15e81e17cc
commit 00829a0c0d
23 changed files with 145 additions and 130 deletions
+11 -11
View File
@@ -1,4 +1,4 @@
<?
<?php
$id = get_id();
$search = get_search_args();
@@ -51,13 +51,13 @@ if (count($validate) !== 0) {
</div>
<div class="textarea rightcolumn">
<div id="textparent">
<textarea name="story" id="story" rows="20" cols="50"><?
<textarea name="story" id="story" rows="20" cols="50"><?php
echo (isset($story) ? $story : '')
?></textarea>
<div class="note">(To get line-breaks&mdash;as in poetry&mdash;instead of paragraph breaks, hit shift-enter instead of enter.)</div>
</div>
<div class="upload" id="uploadparent" style="display: none;"><div>
<?
<?php
if (isset($file_src) || isset($img)) {
if (isset($file_src)) {
echo ' <input type="hidden" id="uploaded" name="uploaded" value="'.$file_src.'" />';
@@ -70,7 +70,7 @@ if (isset($file_src) || isset($img)) {
}
?>
<input type="file" name="upload" id="upload" />
<?
<?php
if (isset($file_src) || isset($img)) {
echo ' <div>';
echo ' <div class="remove">';
@@ -86,22 +86,22 @@ if (isset($file_src) || isset($img)) {
</div></div>
</div>
<? if ($is_admin) { ?>
<label<? isset($validate['comments']) ? ' class="red"' : '' ?> for="comments">Comments:</label>
<?php if ($is_admin) { ?>
<label<?php isset($validate['comments']) ? ' class="red"' : '' ?> for="comments">Comments:</label>
<div class="rightcolumn">
<input type="text" name="comments" id="comments" maxlength="150" value="<?= isset($comments) ? $comments : '' ?>" />
</div>
<input type="hidden" id="editor" name="editor" value="<?= $username ?>" />
<? } else { ?>
<?php } else { ?>
<input type="hidden" id="editor" name="editor" value="original author" />
<? } ?>
<?php } ?>
<div style="display: none;">
<input type="hidden" id="date" name="date" value="<?= isset($date) ? $date : '' ?>" />
<input type="hidden" id="id" name="id" value="<?= isset($id) ? $id : '' ?>" />
</div>
<?
<?php
if (!$is_admin && (($action == "") || isset($validate['captcha']))) {
echo '<div class="g-recaptcha" data-sitekey="'.htmlspecialchars(config('RECAPTCHA_SITE_KEY')).'"></div>';
}
@@ -116,7 +116,7 @@ if (isset($file_src) || isset($img)) {
?>
<div class="leftcolumn"></div>
<div class="submission rightcolumn">
<?
<?php
if (isset($queue) && $is_admin) {
echo '<button type="submit" id="preview" name="action" value="save">Save in queue</button>';
} else {
@@ -138,7 +138,7 @@ if (isset($file_src) || isset($img)) {
</form>
<?
<?php
echo '<script type="text/javascript">'."\n";
if (isset($file_src) || isset($img) || isset($validate['upload'])) {
echo " showHide('upload')\n";