From 8e92abac218a7419b4a4f0826b32daba46cfa926 Mon Sep 17 00:00:00 2001 From: Seb Sauvage Date: Tue, 27 Sep 2011 13:35:00 +0200 Subject: [PATCH] Version 0.0.19 beta: - Corrected: Patch by Emilien to remove the update notification after the update. - New: ATOM fee --- index.php | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 15582051..276deb84 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ filterFulltext($_GET['searchterm']); + elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); + else $linksToDisplay = $LINKSDB; + + header('Content-Type: application/xhtml+xml; charset=utf-8'); + $pageaddr=htmlspecialchars(serverUrl().$_SERVER["SCRIPT_NAME"]); + $latestDate = ''; + $entries=''; + $i=0; + $keys=array(); foreach($linksToDisplay as $key=>$value) { $keys[]=$key; } // No, I can't use array_keys(). + while ($i<50 && $i'.htmlspecialchars($link['url']).''; + if (!HIDE_TIMESTAMPS || isLoggedIn()) $entries.=''.htmlspecialchars($iso8601date).''; + $entries.=''.nl2br(htmlspecialchars($link['description'])).''."\n"; + $i++; + } + $feed=''; + $feed.=''.htmlspecialchars($GLOBALS['title']).''; + if (!HIDE_TIMESTAMPS || isLoggedIn()) $feed.=''.htmlspecialchars($latestDate).''; + $feed.=''; + $feed.=''.htmlspecialchars($pageaddr).''; + $feed.=''.htmlspecialchars($pageaddr).''."\n\n"; // Yes, I know I should use a real IRI (RFC3987), but the site URL will do. + $feed.=$entries; + $feed.=''; + echo $feed; + exit; +} + // ------------------------------------------------------------------------------------------ // Render HTML page: function renderPage() @@ -1284,7 +1331,7 @@ $(document).ready(function() JS; } - $feedurl=htmlspecialchars(serverUrl().$_SERVER['SCRIPT_NAME'].'?do=rss'); + $feedurl=htmlspecialchars(serverUrl().$_SERVER['SCRIPT_NAME']); if (!empty($_GET['searchtags'])) $feedurl.='&searchtags='.$_GET['searchtags']; elseif (!empty($_GET['searchterm'])) $feedurl.='&searchterm='.$_GET['searchterm']; @@ -1299,7 +1346,7 @@ JS; {$newversion} @@ -1486,5 +1533,6 @@ $LINKSDB=new linkdb(isLoggedIn() || OPEN_SHAARLI); // Read links from database if (startswith($_SERVER["QUERY_STRING"],'ws=')) { processWS(); exit; } // Webservices (for jQuery/jQueryUI) if (!isset($_SESSION['LINKS_PER_PAGE'])) $_SESSION['LINKS_PER_PAGE']=LINKS_PER_PAGE; if (startswith($_SERVER["QUERY_STRING"],'do=rss')) { showRSS(); exit; } +if (startswith($_SERVER["QUERY_STRING"],'do=atom')) { showATOM(); exit; } renderPage(); ?> \ No newline at end of file -- 2.41.0