Link sources directly instad of through the list at the bottom

This commit is contained in:
Markus Koch 2020-01-02 22:38:41 +01:00
parent faaa3a8ecb
commit 58900e3d60

View File

@ -156,9 +156,11 @@
*/
$meta['sources'] = array();
$counters['sources'] = 1;
function addSource($url) {
function addSource($url, $text="") {
global $counters;
global $meta;
if ("$text" != "")
$text .= " ";
if (is_numeric($url)) {
echo "<a href=\"#src$url\">[" . $url . "]</a>";
return $url;
@ -168,14 +170,14 @@
$i = 1;
foreach ($meta['sources'] as $v) {
if ($v == $url) {
echo "<a href=\"#src$i\">[" . $i . "]</a>";
echo "<a href=\"$url\">" . $text . "[" . $i . "]</a>";
return $i;
}
$i++;
}
// If not found, then add
$meta['sources'][$counters['sources']] = $url;
echo "<a href=\"#src$i\">[" . $counters['sources'] . "]</a>";
echo "<a href=\"$url\">" . $text . "[" . $counters['sources'] . "]</a>";
return $counters['sources']++;
}
}