====== Biblioteca on-line ====== $INDEX = '/var/www/html/www.rigacci.org/docs/biblio/bibliolist.txt'; $URL_PREFIX = 'https://www.rigacci.org/docs/biblio/'; setlocale(LC_ALL, 'it_IT.UTF-8'); $last_change = strftime('%A %d %B %Y', filemtime($INDEX)); echo "Ultime modifiche: $last_change.\n

\n"; echo "

\n"; if ($fp = fopen($INDEX, 'r')) { $list_open = false; unset($record); while (!feof($fp)) { $line = trim(fgets($fp, 4096)); // Skip comments. if (preg_match('/^\s*#/', $line)) next; // A blank line: output the record. if (preg_match('/^\s*$/', $line) and is_array($record)) { print_record($record, $URL_PREFIX); unset($record); } if (preg_match('/=/', $line)) { list($tag, $val) = explode('=', $line, 2); switch ($tag) { case 'section': if (isset($record)) { print_record($record, $URL_PREFIX); unset($record); } if ($list_open) echo "\n\n"; echo "

" . htmlentities($val, ENT_COMPAT, 'UTF-8') . "

\n"; echo "
\n"; echo "\n
\n"; } //------------------------------------------------------------------------ // Print a list entry with the contents of $record[] array. //------------------------------------------------------------------------ function print_record($record, $URL_PREFIX) { if (isset($record['title']) and isset($record['online'])) { echo '
  • '; echo ''; echo htmlentities($record['title']); echo ''; if (isset($record['lang'])) { $image = $record['lang'] . '.png'; $alt = $record['lang']; $width = 21; $height = 14; echo ' '; echo_image ($image, $URL_PREFIX, $alt, $width, $height); } if (isset($record['src'])) { echo ' '; echo 'doc'; echo ''; } if (isset($record['offline'])) { echo ' '; echo 'zip'; echo ''; } if (isset($record['pdf'])) { echo ' '; echo 'pdf'; echo ''; } if (isset($record['web'])) { echo ' '; echo 'web'; echo ''; } echo "
  • \n"; } } //------------------------------------------------------------------------ // Echo an tag. //------------------------------------------------------------------------ function echo_image($file_name, $URL_PREFIX, $alt_text = '', $width = '', $height = '') { echo '' . htmlentities($alt_text, ENT_COMPAT, 'UTF-8') . ''; }