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??
please don't be mad that I want to help php.
I moved this part up, just because I don't think I was mad in any way, or that I looked mad. I have asked you why you have changed the header. You have added several language parts to the manual page header codes, en and [en] was printed out at many unusual places, and I obviously was unable to understand why was that good...
Second I think it would be nice from you to have some preconceptions that I am here to help, and this is what I am trying to do now. I am trying to help you not to spend useless time on the website, before thinking about what you do.
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..
That commented out part was there for the geoip stuff Jim tried months ago. It is not needed anymore. It is also not cache friendly, etc. So I'll remove that part.
So here comes the patches:
// ============================================================================
+// Did we request /manual?
+if ($URI == 'manual/') {
+ mirror_redirect('/manual/' . $LANG);
+}
Hm, it was interesting that this was working on mirror sites I have tested without any fix. I have tested my local mirror site too, and it was not working there. So I have fixed the problem. But there was a better place to fix it, so I have added a fix there. Thanks for the report.
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;
- if (isset($EXPL_LANG)) {
- echo '<input type="hidden" name="lang" value="'. $EXPL_LANG . '" />';
+ if (isset($LANG)) {
+ echo '<input type="hidden" name="lang" value="'. $LANG . '" />';
}
It is vital not to pass on the user's language setting everytime. It is very important to only pass on explicitly specified language values. Otherwise caching would be seriously hurt. And anyway, we can calculate the user's language anytime. This parameter can modify it. This parameter is not to pass on the user's language. Not a bug.
- 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);
}
}
Note that $LANG does not contain the current language viewed. It contains the user's preferred language. There is no bug here, and your changes are not fixing anything, but would lead to a very wrong misbehaviour of the language chooser.
- 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;
Yes, there are many places to fix this. This is an ongoing effort. And we tried to do this sistematicallly not 'fix one when you see one'. So I am sorry, but I don't feel committing this fix.
+ global $LANG;
+ //$cur = substr(dirname($_SERVER['PHP_SELF']),-2);
+ $cur = $LANG;
+ $org_id = $id;
The same error as before. $LANG is not the current language.
+ $back_url = 'http://' . $_SERVER['SERVER_NAME'] .
+ (($_SERVER['SERVER_PORT'] == 80) ? '' : ':'.$_SERVER['SERVER_PORT']) . + '/manual/'.$LANG."/".$org_id;
+ // $_SERVER['PHP_SELF'];
The same.
+// global $REQUEST_URI, $SERVER_NAME,
+ global $NEXT, $PREV, $HOME;
+ $pageurl = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
Here the usage of $MYSITE would be much better instead of SERVER_NAME.
- $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;
Same problem.
- $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;
Same problem.
I would suggest you to first examine the code, check what means what, and then work on it. It would save you many time to see if you are fixing anything before starting to apply changes.
Goba