savannah-hackers-public
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-hackers-public] Bugfix for clean reload


From: Sergey Poznyakoff
Subject: [Savannah-hackers-public] Bugfix for clean reload
Date: Sat, 05 May 2012 11:40:17 +0300

Hello,

The clean reload link does not work with scripts that take their
arguments in a path-like form, e.g. <http://sv.gnu.org/projects/emacs>
or <http://sv.gnu.org/users/gray>. A fix is attached.

Regards,
Sergey

>From 5e19235fb0b0937b7bd06d06b0fd6dc62fa7581f Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <address@hidden>
Date: Sat, 5 May 2012 11:23:25 +0300
Subject: [PATCH] Fix clean reload

The clean reload function did not work with scripts that take their
arguments in a path-like form, such as /projects or /users.

* frontend/php/include/sitemenu.php (sitemenu_thispage): preserve
arguments supplied as path.
---
 frontend/php/include/sitemenu.php |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/frontend/php/include/sitemenu.php 
b/frontend/php/include/sitemenu.php
index 459abba..e73afb0 100644
--- a/frontend/php/include/sitemenu.php
+++ b/frontend/php/include/sitemenu.php
@@ -201,13 +201,17 @@ function sitemenu_thispage($page_title, $page_toptab=0, 
$page_group=0)
   global $HTML, $sys_group_id, $group_id;

   $HTML->menuhtml_top(_("This Page"));
+  // Cannot use $_SERVER['SCRIPT_NAME'], because several scripts take
+  // their arguments as path, e.g.:
+  //   /projects/emacs
+  //   /users/gray
+  $scriptname = ereg_replace("\?.*", "", $_SERVER['REQUEST_URI']);
   $extraurl = sitemenu_extraurl();
-
-  $HTML->menu_entry($_SERVER['SCRIPT_NAME']."?reload=1".$extraurl,
+  $HTML->menu_entry($scriptname."?reload=1".$extraurl,
                    _("Clean Reload"),
                    1,
                    _("Reload the page without risk of reposting data"));
-  $HTML->menu_entry($_SERVER['SCRIPT_NAME']."?printer=1".$extraurl,
+  $HTML->menu_entry($scriptname."?printer=1".$extraurl,
                    _("Printer Version"),
                    1,
                    _("Show this page with a style adapted to printers"));
--
1.7.0.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]