Modified files:
/phpweb/include layout.inc shared-manual.inc
Log:
- Get rid of BASE_FOR_MANPAGE in favor of the more
generic _SERVER['BASE_HREF'], which we will use on all
pages
- Remove the old commented mirror switching part, which
was never used, and not going to be used
- Also employ BASE_HREF for the printed version, so the
right server name will be used, and XHTMLize the printed
page's header
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.169 phpweb/include/layout.inc:1.170
--- phpweb/include/layout.inc:1.169 Sun Jul 13 16:02:09 2003
+++ phpweb/include/layout.inc Sun Jul 20 09:44:36 2003
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.169 2003/07/13 20:02:09 goba Exp $ */
+/* $Id: layout.inc,v 1.170 2003/07/20 13:44:36 goba Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -185,7 +185,7 @@
function commonHeader($title="",$dont_enclose=0,$headers_gone=0) {
global $MYSITE, $base, $enclosed, $EXPL_LANG, $SIDEBAR_DATA,
- $SEARCH_BASE, $ONLOAD, $BASE_FOR_MANPAGE;
+ $SEARCH_BASE, $ONLOAD;
// If no onload event is specified, restore the last search
if (empty($ONLOAD)) { $ONLOAD = "searchHistory(); tocImages();"; }
@@ -194,7 +194,6 @@
// 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">
@@ -287,18 +286,13 @@
</table>
</td>
<td bgcolor="#cccccc" background="<?php echo $_SERVER['STATIC_ROOT']; ?>/images/checkerboard.gif" width="1"><?php spacer(); ?></td>
-<?php endif; ?>
+<?php endif; // sidebar printed ?>
<td>
<table cellpadding="10" cellspacing="0" width="100%">
<tr><td valign="top">
<?php
- endif;
-/* don't show this yet ... ?>
- <div class="mirror">
- You are using <?php echo $MYSITE; ?>. However, foo.php.net is closer. We would appreciate if you could use that mirror.
- </div>
-
-<?php */ }
+ endif; // enclosed in a multiple column layout
+}
# commonfooter()
Index: phpweb/include/shared-manual.inc
diff -u phpweb/include/shared-manual.inc:1.198 phpweb/include/shared-manual.inc:1.199
--- phpweb/include/shared-manual.inc:1.198 Sun Jul 13 15:46:05 2003
+++ phpweb/include/shared-manual.inc Sun Jul 20 09:44:36 2003
@@ -3,7 +3,7 @@
// Set variable defaults
$NEXT = $PREV = $UP = $HOME = $PGI = array(false, false);
-$TOC = array(); $SIDEBAR_DATA = ''; $BASE_FOR_MANPAGE = '';
+$TOC = array(); $SIDEBAR_DATA = '';
// If we don't know anything about printing, set it to false
if (!isset($PRINT_PAGE)) { $PRINT_PAGE = FALSE; }
@@ -74,7 +74,7 @@
// Print out manual navigation bar
function navigationBar($title,$id,$loc) {
global $NEXT, $PREV, $tstamp, $SERVER_NAME, $SERVER_PORT,
- $PHP_SELF, $LANGUAGES, $INACTIVE_ONLINE_LANGUAGES, $BASE_FOR_MANPAGE;
+ $PHP_SELF, $LANGUAGES, $INACTIVE_ONLINE_LANGUAGES;
echo '<!--UdmComment-->' . "\n" .
'<table border="0" width="100%" bgcolor="#e0e0e0" cellpadding="0" cellspacing="4">';
@@ -102,7 +102,7 @@
// Print out language switch on top of manual pages
if ($loc != 'bottom') {
$links = array();
- preg_match("!/manual/(.+)/!", $BASE_FOR_MANPAGE, $langcode);
+ preg_match("!/manual/(.+)/!", $_SERVER['BASE_HREF'], $langcode);
$links[] = array("$langcode[1]/print/$id", "printer friendly");
$links[] = array("$langcode[1]/printwn/$id", "printer friendly [+notes]");
// Disable all 'inactive' languages
@@ -278,7 +278,7 @@
// Send manual HTTP headers, provide accurate language data
function sendManualHeaders($charset,$lang) {
- global $LAST_UPDATED, $BASE_FOR_MANPAGE, $MYSITE;
+ global $LAST_UPDATED, $MYSITE;
header("Last-Modified: " . gmdate("D, d M Y H:i:s ", $LAST_UPDATED) . "GMT");
//header("Cache-Control: public, max-age=600");
@@ -286,34 +286,33 @@
header("Content-type: text/html;charset=$charset");
header("Content-language: $lang");
- // Set initial base for manual page
+ // Set initial base for this manual page
// [will be extended in manualHeader()!]
- $BASE_FOR_MANPAGE = $MYSITE . 'manual/' . language_convert($lang);
+ $_SERVER['BASE_HREF'] = $MYSITE . 'manual/' . language_convert($lang);
}
// Print out manual page header.
function manualHeader()
{
- global $PRINT_PAGE, $PGI, $BASE_FOR_MANPAGE;
+ global $PRINT_PAGE, $PGI;
// XSL [and new DSSSL] sheets provide params in the
// 'this' array element configured above, while old
// DSSSL sheets provide info via two parameters [title, id]
if (func_num_args() > 0) {
- list($title, $id) = func_get_args();
+ list($title, $filename) = func_get_args();
} else {
- list($id, $title) = $PGI;
+ list($filename, $title) = $PGI;
}
- // Finalize the manpage base with proper filename
- $BASE_FOR_MANPAGE .= '/' . $id;
-
if ($PRINT_PAGE) {
+ $_SERVER['BASE_HREF'] .= "/print/$filename";
manualPrintHeader($title);
} else {
- makeBorderTOC($id);
+ $_SERVER['BASE_HREF'] .= "/$filename";
+ makeBorderTOC($filename);
commonHeader ($title. " - Manual");
- navigationBar($title, $id, "top");
+ navigationBar($title, $filename, "top");
}
}
@@ -351,28 +350,29 @@
// =============================================================================
// "Printer optimized" header for manual pages
-function manualPrintHeader ($title = '') {
- global $REQUEST_URI, $SERVER_NAME, $NEXT, $PREV, $HOME;
- $pageurl = "http://$SERVER_NAME$REQUEST_URI";
+function manualPrintHeader($title = '') {
+ global $NEXT, $PREV, $HOME;
+
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>PHP<?php if ($title) echo ": $title";?></title>
- <link rel="prev" href="<?php echo $PREV[0]; ?>">
- <link rel="next" href="<?php echo $NEXT[0]; ?>">
- <link rel="start" href="<?php echo $HOME[0]; ?>">
+ <link rel="prev" href="<?php echo $PREV[0]; ?>" />
+ <link rel="next" href="<?php echo $NEXT[0]; ?>" />
+ <link rel="start" href="<?php echo $HOME[0]; ?>" />
+ <base href="<?php echo $_SERVER['BASE_HREF']; ?>" />
</head>
<body bgcolor="#ffffff" text="#000000" link="#000099" alink="#0000ff" vlink="#000099">
<table>
<tr>
<td><a href="/"><?php print_image('php.gif', 'PHP'); ?></a></td>
<td>
- This is a printer friendly version of the PHP Manual.<br>
- Original address of this page: <a href="<?php echo $pageurl; ?>"><?php echo $pageurl; ?></a><br>
- <small><?php echo make_link('copyright.php', 'Copyright © 1997-2003 The PHP Documentation Group'); ?><br />All rights reserved.</small>
+ This is a printer friendly version of the PHP Manual.<br />
+ Original address of this page: <?php print_link($_SERVER['BASE_HREF']); ?><br />
+ <small><?php print_link('copyright.php', 'Copyright © 1997-2003 The PHP Documentation Group'); ?><br />All rights reserved.</small>
</td>
</tr>
-</table><hr size="1" noshade>
+</table><hr size="1" noshade="noshade" />
<?php
}
Modified files:
/phpweb/include layout.inc shared-manual.inc
Log:
Also specify BASE_PAGE on manual pages, so it can
be used to print out the show source link properly on pages
accessed with shortcuts
Use the BASE_HREF on manual pages to provide a backlink
to the previous page after user note submissions, so thse
will work from shortcut accessed pages too
These two fixes hopefully close all the problems related to
manual URL shortcut page displays
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.170 phpweb/include/layout.inc:1.171
--- phpweb/include/layout.inc:1.170 Sun Jul 20 09:44:36 2003
+++ phpweb/include/layout.inc Mon Jul 21 09:14:33 2003
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.170 2003/07/20 13:44:36 goba Exp $ */
+/* $Id: layout.inc,v 1.171 2003/07/21 13:14:33 goba Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -302,6 +302,8 @@
function commonFooter() {
global $SCRIPT_NAME, $MYSITE, $LAST_UPDATED, $PHP_SELF,
$enclosed, $RSIDEBAR_DATA, $page_creation_start;
+
+ $URL = (isset($_SERVER['BASE_PAGE']) ? "/" . $_SERVER['BASE_PAGE'] : $SCRIPT_NAME);
if ($enclosed) {
echo "</td></tr></table></td>";
if (!empty($RSIDEBAR_DATA)) { ?>
@@ -323,7 +325,7 @@
<tr bgcolor="#9999cc">
<td align="right" valign="bottom">
<?php
- print_link('/source.php?url='.$SCRIPT_NAME, 'show source', false, 'class="small"');
+ print_link("/source.php?url=$URL", 'show source', false, 'class="small"');
echo delim();
print_link('/credits.php', 'credits', false, 'class="small"');
echo delim();
Index: phpweb/include/shared-manual.inc
diff -u phpweb/include/shared-manual.inc:1.199 phpweb/include/shared-manual.inc:1.200
--- phpweb/include/shared-manual.inc:1.199 Sun Jul 20 09:44:36 2003
+++ phpweb/include/shared-manual.inc Mon Jul 21 09:14:33 2003
@@ -221,18 +221,15 @@
// Print out all user notes for this manual page
function manualUserNotes($title, $id) {
- global $PHP_SELF, $MYSITE;
-
# don't want .php at the end of the id.
if (substr($id,-4) == '.php') $id = substr($id,0,-4);
$notes = manualGetUserNotes($title, $id);
- $back_url = substr($MYSITE, 0, -1) . $PHP_SELF;
-
// Link target to add a note to the current manual page,
// and it's extended form with a [+] image
- $addnotelink = '/manual/add-note.php?sect=' . $id . '&redirect=' . $back_url;
+ $addnotelink = '/manual/add-note.php?sect=' . $id .
+ '&redirect=' . $_SERVER['BASE_HREF'];
$addnotesnippet =
make_link($addnotelink, make_image('notes-add.gif', 'add a note')) .
' <small>' .
@@ -288,7 +285,8 @@
// Set initial base for this manual page
// [will be extended in manualHeader()!]
- $_SERVER['BASE_HREF'] = $MYSITE . 'manual/' . language_convert($lang);
+ $_SERVER['BASE_PAGE'] = 'manual/' . language_convert($lang);
+ $_SERVER['BASE_HREF'] = $MYSITE . $_SERVER['BASE_PAGE'];
}
// Print out manual page header.
@@ -306,9 +304,11 @@
}
if ($PRINT_PAGE) {
+ $_SERVER['BASE_PAGE'] .= "/print/$filename";
$_SERVER['BASE_HREF'] .= "/print/$filename";
manualPrintHeader($title);
} else {
+ $_SERVER['BASE_PAGE'] .= "/$filename";
$_SERVER['BASE_HREF'] .= "/$filename";