Browse code

includes/characterlist.php: PHP 8.x warning fix - from upstream

Clarissa Walker authored on 2026/11/12 10:26:59
Showing 1 changed files
... ...
@@ -25,7 +25,8 @@ function isNumber($num) {
25 25
 $catid = isset($_GET['catid']) ? explode(",", $_GET['catid']) : array(-1);
26 26
 $catid = array_filter($catid, "isNumber");
27 27
 $characters = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_characters WHERE ".(count($catid) > 1 ? "FIND_IN_SET(catid, '".implode(",", $catid)."') > 0" : "catid = '".$catid[0]."'")." ORDER BY charname");
28
-echo "var element = '".$_GET['element']."';\n";
28
+if(!isset($_GET['element']) || !preg_match('/^[A-Za-z_][A-Za-z0-9_.-]*$/', $_GET['element'])) $_GET['element'] = '';
29
+echo "var element = '".addslashes($_GET['element'])."';\n";
29 30
 $x = 0;
30 31
 $find = array ('"', chr(150), chr(147), chr(148), chr(146));
31 32
 $replace = array ('\"', "-", "\"", "\"", "'");