Re: something goes wrong.. I'm missing files

From: Date: Tue, 27 May 2003 09:44:08 +0000
Subject: Re: something goes wrong.. I'm missing files
References: 1 2 3  Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-18127@lists.php.net to get a copy of this message
> I really don't know what you are talking about. Both /manual and > /manual/ and /manual/en shows me the english manual perfectly. > > BTW I have seen you have modified the header code. Why was that needed?? > > Goba hehe.. I'm not for nothing on this list... I did a little PHP myself... btw the header? you mean the "you are now using foo. however, foo.php.net is closer" something like that... I tried to get that working, but it didn't want to work.. I've attached the diffs for the /manual checking, the messed up shortcuts and a very little bug, which i'm not sure about, for the lang value used for the right top search box. please don't be mad that I want to help php. .: Allowee

--- phpweb/error/index.php 2003-05-25 20:08:03.000000000 +0200 +++ phpweb2/error/index.php 2003-05-26 19:48:44.000000000 +0200 @@ -25,6 +25,12 @@ if (preg_match("!\\.(pdf|gif|jpg|png)$!i", $URI)) { make404(); } // ============================================================================ +// Did we request /manual? +if ($URI == 'manual/') { + mirror_redirect('/manual/' . $LANG); +} + +// ============================================================================ // BC: handle .php3 files that were renamed to .php if (preg_match("!(.*\\.php)3$!", $URI, $array)) { mirror_redirect("/$array[1]"); --- phpweb/include/layout.inc 2003-05-24 14:10:35.000000000 +0200 +++ phpweb2/include/layout.inc 2003-05-27 11:23:18.000000000 +0200 @@ -197,8 +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, $BASE_FOR_MANPAGE; + global $MYSITE, $base, $enclosed, $EXPL_LANG, $SIDEBAR_DATA, $murl, + $SEARCH_BASE, $ONLOAD, $www_static_root, $BASE_FOR_MANPAGE, $LANG; ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> @@ -249,8 +249,8 @@ <td align="right" valign="top" colspan="2" class="quicksearch"> <form method="post" action="/search.php" class="thin"> <?php - if (isset($EXPL_LANG)) { - echo '<input type="hidden" name="lang" value="'. $EXPL_LANG . '" />'; + if (isset($LANG)) { + echo '<input type="hidden" name="lang" value="'. $LANG . '" />'; } if (isset($base) && $base != $MYSITE) { --- phpweb/include/shared-manual.inc 2003-05-23 23:08:43.000000000 +0200 +++ phpweb2/include/shared-manual.inc 2003-05-27 11:16:12.000000000 +0200 @@ -67,7 +67,8 @@ // Print out manual navigation bar function navigationBar($title,$id,$loc) { global $NEXT, $PREV, $tstamp, $SERVER_NAME, $SERVER_PORT, - $PHP_SELF, $LANGUAGES, $REQUEST_URI, $www_static_root; + $PHP_SELF, $LANGUAGES, $REQUEST_URI, $www_static_root, + $LANG; echo '<table border="0" width="100%" bgcolor="#e0e0e0" cellpadding="0" cellspacing="4">'; @@ -94,11 +95,12 @@ // Print out language switch on top of manual pages if ($loc != 'bottom') { $links = array(); - preg_match("!^/manual/(.+)/!", $REQUEST_URI, $langcode); + //preg_match("!^/manual/(.+)/!", $REQUEST_URI, $langcode); + $langcode[1] = $LANG; $links[] = array("$langcode[1]/print/$id", "printer friendly"); $links[] = array("$langcode[1]/printwn/$id", "printer friendly [+notes]"); foreach ($LANGUAGES as $code => $name) { - if (!preg_match("!/$code/!", $PHP_SELF) && file_exists("../$code/$id")) { + if ($code != $LANG && file_exists($_SERVER['DOCUMENT_ROOT'] . "/manual/".$code."/".$id)) { $links[] = array("$code/$id", $name); } } @@ -182,11 +184,11 @@ // Get user notes from the appropriate text dump function manualGetUserNotes($title, $id) { - global $DOCUMENT_ROOT; +// global $DOCUMENT_ROOT; $notes = array(); $hash = substr(md5($id),0,16); - $notes_file = "$DOCUMENT_ROOT/backend/notes/".substr($hash,0,2)."/$hash"; + $notes_file = $_SERVER['DOCUMENT_ROOT']."/backend/notes/".substr($hash,0,2)."/".$hash; if ($fp = @fopen($notes_file,"r")) { while (!feof($fp)) { $line = chop(fgets($fp,8096)); @@ -209,8 +211,11 @@ // Print out all user notes for this manual page function manualUserNotes($title, $id) { - global $PHP_SELF, $SERVER_NAME, $SERVER_PORT; - $cur = substr(dirname($PHP_SELF),-2); +// global $PHP_SELF, $SERVER_NAME, $SERVER_PORT; + global $LANG; + //$cur = substr(dirname($_SERVER['PHP_SELF']),-2); + $cur = $LANG; + $org_id = $id; if($cur=='al') $cur='en'; # don't want .php at the end of the id. @@ -218,9 +223,10 @@ $notes = manualGetUserNotes($title, $id); - $back_url = 'http://' . $SERVER_NAME . - (($SERVER_PORT==80) ? '' : ':'.$SERVER_PORT ) . - $PHP_SELF; + $back_url = 'http://' . $_SERVER['SERVER_NAME'] . + (($_SERVER['SERVER_PORT'] == 80) ? '' : ':'.$_SERVER['SERVER_PORT']) . + '/manual/'.$LANG."/".$org_id; + // $_SERVER['PHP_SELF']; // Link target to add a note to the current manual page, // and it's extended form with a [+] image @@ -344,8 +350,9 @@ // "Printer optimized" header for manual pages function manualPrintHeader ($title = '') { - global $REQUEST_URI, $SERVER_NAME, $NEXT, $PREV, $HOME; - $pageurl = "http://$SERVER_NAME$REQUEST_URI"; +// global $REQUEST_URI, $SERVER_NAME, + global $NEXT, $PREV, $HOME; + $pageurl = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> @@ -375,9 +382,11 @@ // Print out all user notes for this manual page function manualPrintUserNotes($title, $id) { - - global $PHP_SELF, $SERVER_NAME, $SERVER_PORT; - $cur = substr(dirname($PHP_SELF),-2); + global $LANG; +// global $PHP_SELF, $SERVER_NAME, $SERVER_PORT; +// $cur = substr(dirname($PHP_SELF),-2); + $cur = $LANG; + $org_id = $id; if ($cur=='al') $cur='en'; # don't want .php at the end of the id. @@ -385,9 +394,8 @@ $notes = manualGetUserNotes($title, $id); - $back_url = 'http://' . $SERVER_NAME . - (($SERVER_PORT==80) ? '' : ':'.$SERVER_PORT ) . - $PHP_SELF; + $back_url = 'http://' . $_SERVER['SERVER_NAME'] . + (($_SERVER['SERVER_PORT'] == 80) ? '' : ':'.$_SERVER['SERVER_PORT'] ) . '/manual/'.$LANG.'/'.$id; echo "<hr size=\"1\" noshade><h2>User Contributed Notes</h2>";
« previous php.mirrors (#18127) next »