cvs: phpweb /include layout.inc site.inc
| From: | Gabor Hojtsy | Date: | Sun, 13 Jul 2003 20:02:10 +0000 |
| Subject: | cvs: phpweb /include layout.inc site.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-19302@lists.php.net to get a copy of this message | ||
goba Sun Jul 13 16:02:10 2003 EDT
Modified files:
/phpweb/include layout.inc site.inc
Log:
Implement some more general handling of the base
parameter, to support the usage of webpage shortcuts
without redirections in the future
Also keep the two old base handling methods, until they
can be replaced by this general one
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.168 phpweb/include/layout.inc:1.169
--- phpweb/include/layout.inc:1.168 Sat Jun 14 14:28:56 2003
+++ phpweb/include/layout.inc Sun Jul 13 16:02:09 2003
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.168 2003/06/14 18:28:56 goba Exp $ */
+/* $Id: layout.inc,v 1.169 2003/07/13 20:02:09 goba Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -190,6 +190,13 @@
// If no onload event is specified, restore the last search
if (empty($ONLOAD)) { $ONLOAD = "searchHistory(); tocImages();"; }
+ // Guess what base to use for this page (the first two are just
+ // for BC reasons, until we migrate all the code to use the last one)
+ unset($PBASE);
+ if (!empty($SEARCH_BASE)) { $PBASE = $SEARCH_BASE; }
+ if (!empty($BASE_FOR_MANPAGE)) { $PBASE = $BASE_FOR_MANPAGE; }
+ if (!empty($_SERVER['BASE_HREF'])) { $PBASE = $_SERVER['BASE_HREF']; }
+
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
@@ -197,9 +204,7 @@
<link rel="stylesheet" href="<?php echo $_SERVER['STATIC_ROOT'];
?>/style.css" />
<link rel="shortcut icon" href="<?php echo $_SERVER['STATIC_ROOT'];
?>/favicon.ico" />
<script language="Javascript" type="text/javascript" src="<?php
echo $_SERVER['STATIC_ROOT']; ?>/userprefs.js"></script>
- <?php echo (isset($SEARCH_BASE) ? '<base href="' . $SEARCH_BASE .
'" />' : ''); ?>
- <?php echo (!empty($BASE_FOR_MANPAGE) ? '<base href="' . $BASE_FOR_MANPAGE .
'" />' : ''); ?>
-</head>
+<?php echo (isset($PBASE) ? ' <base href="' . $PBASE . '"
/>' : ''); ?></head>
<body bgcolor="#ffffff" text="#000000"
link="#000099" alink="#0000ff" vlink="#000099"
onload="<?php echo $ONLOAD; ?>">
Index: phpweb/include/site.inc
diff -u phpweb/include/site.inc:1.249 phpweb/include/site.inc:1.250
--- phpweb/include/site.inc:1.249 Sat May 24 15:50:37 2003
+++ phpweb/include/site.inc Sun Jul 13 16:02:10 2003
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: site.inc,v 1.249 2003/05/24 19:50:37 goba Exp $
+// $Id: site.inc,v 1.250 2003/07/13 20:02:10 goba Exp $
// Define $MIRRORS array, and some constants
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/mirrors.inc';
@@ -210,3 +210,9 @@
if (isset($_SERVER['MIRROR_STATS'])) {
$MIRRORS[$MYSITE][2] = TRUE;
}
+
+// Provide base href information to make relative links on
+// shortcut URL accessed pages work without redirection
+if (isset($_SERVER['BASE_PAGE'])) {
+ $_SERVER['BASE_HREF'] = $MYSITE . $_SERVER['BASE_PAGE'];
+} else { unset($_SERVER['BASE_HREF']); }
\ No newline at end of file