changeset 96:c7de7a4641d7

Generate humanreadable urls for sitemap.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 18 Oct 2012 21:48:58 +0200
parents 8a9bfbe220ca
children ba11b1c1b881
files Sitemap.inc filters.inc
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Sitemap.inc	Thu Oct 18 17:40:21 2012 +0200
+++ b/Sitemap.inc	Thu Oct 18 21:48:58 2012 +0200
@@ -51,7 +51,9 @@
 ';
 
     $base = 'http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
-    $base = substr($base, 0, strrpos($base, '/'));
+    $l = strrpos($base, '/');
+    if ($l)
+      $base = substr($base, 0, $l);
 
     $acceptedLanguages = $this->options->getAcceptedLanguages();
 
@@ -79,9 +81,10 @@
 		  $opts['name'] = $name;
 		}
 
-		$optstring = opttostring($opts);
+		$optstring = genUrl($opts, array(), array('lang', 'name'));
 
-		$location = "${base}/${optstring}";
+		$location = "${base}${optstring}/";
+
 		$headers = Http::getHeaders($location, 5);
 
 		$location = htmlentities($location);
--- a/filters.inc	Thu Oct 18 17:40:21 2012 +0200
+++ b/filters.inc	Thu Oct 18 21:48:58 2012 +0200
@@ -56,7 +56,6 @@
     if ($active)
       $langbar .= '<a href="'.genUrl($options->getUrlParams(), array( 'lang' => $l), array('lang', 'name') ) . '">';
 
-    //$flagUrl = "http://dev.bfginvest.no/php/flag.php";
     $flagUrl = $options->getFlagUrl();
 
     $langbar .= "