cvs: phpweb /include layout.inc shared-manual.inc
| From: | Gabor Hojtsy | Date: | Fri, 23 May 2003 20:45:40 +0000 |
| Subject: | cvs: phpweb /include layout.inc shared-manual.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-17980@lists.php.net to get a copy of this message | ||
goba Fri May 23 16:45:40 2003 EDT
Modified files:
/phpweb/include layout.inc shared-manual.inc
Log:
Add $BASE_FOR_MANPAGE which will always contain
the correct URI of a manual page which is currently served.
The code uses no external calls, it is based on config params
provided by sendmanualheaders() and manualheaders(), which
are always properly parameterized on all manpages and are
always called.
The <base> printout is added with a comment now,
so we can see if it works correcly. If yes, that the
comment signs can be removed, making that effective.
Then all the manual shortcuts can be changed to include()
manual pages instead of redirecting to them. Relative
links will work.
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.159 phpweb/include/layout.inc:1.160
--- phpweb/include/layout.inc:1.159 Tue May 20 18:08:51 2003
+++ phpweb/include/layout.inc Fri May 23 16:45:39 2003
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.159 2003/05/20 22:08:51 jacques Exp $ */
+/* $Id: layout.inc,v 1.160 2003/05/23 20:45:39 goba Exp $ */
$www_static_root = ($HTTP_SERVER_VARS['SERVER_NAME'] == 'www.php.net') ?
'http://static.php.net/www.php.net'
: '';
@@ -197,7 +197,8 @@
#
function commonHeader($title="",$dont_enclose=0,$headers_gone=0) {
- global $MYSITE, $base, $enclosed, $EXPL_LANG, $SIDEBAR_DATA, $SEARCH_BASE, $ONLOAD,
$www_static_root;
+ global $MYSITE, $base, $enclosed, $EXPL_LANG, $SIDEBAR_DATA,
+ $SEARCH_BASE, $ONLOAD, $www_static_root, $BASE_FOR_MANPAGE;
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
@@ -207,6 +208,7 @@
<link rel="shortcut icon" href="<?php echo $www_static_root;
?>/favicon.ico" />
<script language="Javascript" type="text/javascript" src="<?php
echo $www_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>
<body bgcolor="#ffffff" text="#000000"
link="#000099" alink="#0000ff" vlink="#000099"
Index: phpweb/include/shared-manual.inc
diff -u phpweb/include/shared-manual.inc:1.188 phpweb/include/shared-manual.inc:1.189
--- phpweb/include/shared-manual.inc:1.188 Wed May 21 04:51:24 2003
+++ phpweb/include/shared-manual.inc Fri May 23 16:45:39 2003
@@ -3,7 +3,7 @@
// Set variable defaults
$NEXT = $PREV = $UP = $HOME = $PGI = array(false, false);
-$TOC = array(); $SIDEBAR_DATA = '';
+$TOC = array(); $SIDEBAR_DATA = ''; $BASE_FOR_MANPAGE = '';
// If we don't know anything about printing, set it to false
if (!isset($PRINT_PAGE)) { $PRINT_PAGE = FALSE; }
@@ -270,18 +270,23 @@
// Send manual HTTP headers, provide accurate language data
function sendManualHeaders($charset,$lang) {
- global $LAST_UPDATED;
+ global $LAST_UPDATED, $BASE_FOR_MANPAGE, $MYSITE;
+
header("Last-Modified: " . gmdate("D, d M Y H:i:s ", $LAST_UPDATED) .
"GMT");
//header("Cache-Control: public, max-age=600");
header("Vary: Cookie");
header("Content-type: text/html;charset=$charset");
header("Content-language: $lang");
+
+ // Set initial base for manual page
+ // [will be extended in manualHeader()!]
+ $BASE_FOR_MANPAGE = $MYSITE . 'manual/' . language_convert($lang);
}
// Print out manual page header.
function manualHeader()
{
- global $PRINT_PAGE, $PGI;
+ global $PRINT_PAGE, $PGI, $BASE_FOR_MANPAGE;
// XSL sheets provide params in the 'this' array
// element configured above, while old DSSSL sheets
@@ -291,6 +296,9 @@
} else {
list($id, $title) = $PGI;
}
+
+ // Finalize the manpage base with proper filename
+ $BASE_FOR_MANPAGE .= '/' . $id;
if ($PRINT_PAGE) {
manualPrintHeader($title);