From aa6d1016f670e602edfefd392c01c8636eaca038 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 14 Sep 2025 09:59:01 +0200 Subject: [PATCH] Fix apostrophes --- scripts/species_tools.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/scripts/species_tools.php b/scripts/species_tools.php index 8d6f15e..d990bce 100644 --- a/scripts/species_tools.php +++ b/scripts/species_tools.php @@ -151,7 +151,7 @@ if (isset($_GET['delete'])) { $lines_deleted = $db->changes(); if ($info['sci'] !== null && file_exists($confirm_file)) { - $identifier = str_replace("'", '', $info['sci']); + $identifier = $info['sci']; $lines = array_values(array_filter($confirmed_species, fn($l) => $l !== $identifier)); file_put_contents($confirm_file, implode("\n", $lines) . (empty($lines) ? "" : "\n")); } @@ -210,8 +210,8 @@ $result = $db->query($sql); $scient = htmlspecialchars($row['Sci_Name'], ENT_QUOTES); $count = (int)$row['Count']; $max_confidence = round((float)$row['MaxConfidence'] * 100, 1); - $identifier = str_replace("'", '', $row['Sci_Name'].'_'.$row['Com_Name']); - $identifier_sci = str_replace("'", '', $row['Sci_Name']); + $identifier = $row['Sci_Name'].'_'.$row['Com_Name']; + $identifier_sci = $row['Sci_Name']; $lastSeen = $row['LastSeen'] ?? ''; $lastSeenSort = $lastSeen ? (strtotime($lastSeen) ?: 0) : 0; @@ -226,17 +226,20 @@ $result = $db->query($sql); $comnamegraph = str_replace("'", "\'", $row['Com_Name']); $chart_cell = sprintf("", $comnamegraph); + $identifier_js = addslashes($identifier); + $identifier_sci_js = addslashes($identifier_sci); + $confirm_cell = $is_confirmed - ? "" - : ""; + ? "" + : ""; $excl_cell = $is_excluded - ? "" - : ""; + ? "" + : ""; $white_cell = $is_whitelisted - ? "" - : ""; + ? "" + : ""; $sciname_raw = $row['Sci_Name']; $info_url = get_info_url($sciname_raw); @@ -317,7 +320,7 @@ function addDiskCounts() { th.textContent = 'Files on Disk'; headerRow.insertBefore(th, deleteHeader); - const colIndex = headerRow.cells.length - 2; // new column index + const colIndex = headerRow.cells.length - 2; th.addEventListener('click', () => sortTable(colIndex)); const decoder = document.createElement('textarea'); @@ -329,7 +332,7 @@ function addDiskCounts() { const td = document.createElement('td'); td.textContent = count; td.dataset.sort = count; - tr.insertBefore(td, tr.lastElementChild); // before Delete cell + tr.insertBefore(td, tr.lastElementChild); }); }).catch(() => { console.warn('Disk counts load failed.');