Fix apostrophes

This commit is contained in:
Alexandre
2025-09-14 09:59:01 +02:00
committed by Nachtzuster
parent 1ce9f4caa9
commit aa6d1016f6
+14 -11
View File
@@ -151,7 +151,7 @@ if (isset($_GET['delete'])) {
$lines_deleted = $db->changes(); $lines_deleted = $db->changes();
if ($info['sci'] !== null && file_exists($confirm_file)) { 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)); $lines = array_values(array_filter($confirmed_species, fn($l) => $l !== $identifier));
file_put_contents($confirm_file, implode("\n", $lines) . (empty($lines) ? "" : "\n")); 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); $scient = htmlspecialchars($row['Sci_Name'], ENT_QUOTES);
$count = (int)$row['Count']; $count = (int)$row['Count'];
$max_confidence = round((float)$row['MaxConfidence'] * 100, 1); $max_confidence = round((float)$row['MaxConfidence'] * 100, 1);
$identifier = str_replace("'", '', $row['Sci_Name'].'_'.$row['Com_Name']); $identifier = $row['Sci_Name'].'_'.$row['Com_Name'];
$identifier_sci = str_replace("'", '', $row['Sci_Name']); $identifier_sci = $row['Sci_Name'];
$lastSeen = $row['LastSeen'] ?? ''; $lastSeen = $row['LastSeen'] ?? '';
$lastSeenSort = $lastSeen ? (strtotime($lastSeen) ?: 0) : 0; $lastSeenSort = $lastSeen ? (strtotime($lastSeen) ?: 0) : 0;
@@ -226,17 +226,20 @@ $result = $db->query($sql);
$comnamegraph = str_replace("'", "\'", $row['Com_Name']); $comnamegraph = str_replace("'", "\'", $row['Com_Name']);
$chart_cell = sprintf("<img style='height: 1em;cursor:pointer;float:unset;display:inline' title='View species stats' onclick=\"generateMiniGraph(this, '%s', 180)\" width=25 src='images/chart.svg'>", $comnamegraph); $chart_cell = sprintf("<img style='height: 1em;cursor:pointer;float:unset;display:inline' title='View species stats' onclick=\"generateMiniGraph(this, '%s', 180)\" width=25 src='images/chart.svg'>", $comnamegraph);
$identifier_js = addslashes($identifier);
$identifier_sci_js = addslashes($identifier_sci);
$confirm_cell = $is_confirmed $confirm_cell = $is_confirmed
? "<img style='cursor:pointer;max-width:12px;max-height:12px' src='images/check.svg' onclick=\"toggleSpecies('confirmed','".str_replace("'", '', $identifier_sci)."','del')\">" ? "<img style='cursor:pointer;max-width:12px;max-height:12px' src='images/check.svg' onclick=\"toggleSpecies('confirmed','{$identifier_sci_js}','del')\">"
: "<span class='circle-icon' onclick=\"toggleSpecies('confirmed','".str_replace("'", '', $identifier_sci)."','add')\"></span>"; : "<span class='circle-icon' onclick=\"toggleSpecies('confirmed','{$identifier_sci_js}','add')\"></span>";
$excl_cell = $is_excluded $excl_cell = $is_excluded
? "<img style='cursor:pointer;max-width:12px;max-height:12px' src='images/check.svg' onclick=\"toggleSpecies('exclude','".str_replace("'", '', $identifier)."','del')\">" ? "<img style='cursor:pointer;max-width:12px;max-height:12px' src='images/check.svg' onclick=\"toggleSpecies('exclude','{$identifier_js}','del')\">"
: "<span class='circle-icon' onclick=\"toggleSpecies('exclude','".str_replace("'", '', $identifier)."','add')\"></span>"; : "<span class='circle-icon' onclick=\"toggleSpecies('exclude','{$identifier_js}','add')\"></span>";
$white_cell = $is_whitelisted $white_cell = $is_whitelisted
? "<img style='cursor:pointer;max-width:12px;max-height:12px' src='images/check.svg' onclick=\"toggleSpecies('whitelist','".str_replace("'", '', $identifier)."','del')\">" ? "<img style='cursor:pointer;max-width:12px;max-height:12px' src='images/check.svg' onclick=\"toggleSpecies('whitelist','{$identifier_js}','del')\">"
: "<span class='circle-icon' onclick=\"toggleSpecies('whitelist','".str_replace("'", '', $identifier)."','add')\"></span>"; : "<span class='circle-icon' onclick=\"toggleSpecies('whitelist','{$identifier_js}','add')\"></span>";
$sciname_raw = $row['Sci_Name']; $sciname_raw = $row['Sci_Name'];
$info_url = get_info_url($sciname_raw); $info_url = get_info_url($sciname_raw);
@@ -317,7 +320,7 @@ function addDiskCounts() {
th.textContent = 'Files on Disk'; th.textContent = 'Files on Disk';
headerRow.insertBefore(th, deleteHeader); headerRow.insertBefore(th, deleteHeader);
const colIndex = headerRow.cells.length - 2; // new column index const colIndex = headerRow.cells.length - 2;
th.addEventListener('click', () => sortTable(colIndex)); th.addEventListener('click', () => sortTable(colIndex));
const decoder = document.createElement('textarea'); const decoder = document.createElement('textarea');
@@ -329,7 +332,7 @@ function addDiskCounts() {
const td = document.createElement('td'); const td = document.createElement('td');
td.textContent = count; td.textContent = count;
td.dataset.sort = count; td.dataset.sort = count;
tr.insertBefore(td, tr.lastElementChild); // before Delete cell tr.insertBefore(td, tr.lastElementChild);
}); });
}).catch(() => { }).catch(() => {
console.warn('Disk counts load failed.'); console.warn('Disk counts load failed.');