Commit 7ec36e33 authored by Kasper Skårhøj's avatar Kasper Skårhøj
Browse files

Updated copyright notices to show "2004"


git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@127 709f56b5-9817-0410-a4d7-c38de5d9e867
parent 895a8efe
......@@ -32,6 +32,11 @@ class t3lib_div {
/**
* Abstraction method which returns System Environment Variables regardless of server OS, CGI/MODULE version etc. Basically this is SERVER variables for most of them.
* This should be used instead of getEnv() and HTTP_SERVER_VARS/ENV_VARS to get reliable values for all situations.
*
* Usage: 226
*
* @param string Name of the "environment variable"/"server variable" you wish to use. Valid values are SCRIPT_NAME, SCRIPT_FILENAME, REQUEST_URI, PATH_INFO, REMOTE_ADDR, REMOTE_HOST, HTTP_REFERER, HTTP_HOST, HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE, QUERY_STRING, TYPO3_DOCUMENT_ROOT, TYPO3_HOST_ONLY, TYPO3_HOST_ONLY, TYPO3_REQUEST_HOST, TYPO3_REQUEST_URL, TYPO3_REQUEST_SCRIPT, TYPO3_REQUEST_DIR, TYPO3_SITE_URL, _ARRAY
* @return string Value based on the input key, independent of server/os environment.
*/
function getIndpEnv($getEnvName) {
global $HTTP_SERVER_VARS;
......@@ -59,7 +64,7 @@ class t3lib_div {
URI______:
REQUEST_URI = [path]?[query] = /typo3/32/temp/phpcheck/index.php/arg1/arg2/arg3/?arg1,arg2,arg3&p1=parameter1&p2[key]=value
HTTP_HOST = [host][:[port]] = 192.168.1.4:8080
SCRIPT_NAME = [path_script]++ = /typo3/32/temp/phpcheck/index.php // NOTICE THAT SCRIPT_NAME will return the php-script name ALSO. [path_script] may not do that (eg. "/somedir/" may result in SCRIPT_NAME "/somedir/index.php")!
SCRIPT_NAME = [path_script]++ = /typo3/32/temp/phpcheck/index.php // NOTICE THAT SCRIPT_NAME will return the php-script name ALSO. [path_script] may not do that (eg. '/somedir/' may result in SCRIPT_NAME '/somedir/index.php')!
PATH_INFO = [path_info] = /arg1/arg2/arg3/
QUERY_STRING = [query] = arg1,arg2,arg3&p1=parameter1&p2[key]=value
HTTP_REFERER = [scheme]://[host][:[port]][path] = http://192.168.1.4:8080/typo3/32/temp/phpcheck/index.php/arg1/arg2/arg3/?arg1,arg2,arg3&p1=parameter1&p2[key]=value
......@@ -72,16 +77,16 @@ class t3lib_div {
HTTP_ACCEPT_LANGUAGE = (client accept language)
SERVER____:
SCRIPT_FILENAME = Absolute filename of script (Differs between windows/unix). On windows "C:\\blabla\\blabl\\" will be converted to "C:/blabla/blabl/"
SCRIPT_FILENAME = Absolute filename of script (Differs between windows/unix). On windows 'C:\\blabla\\blabl\\' will be converted to 'C:/blabla/blabl/'
Special extras:
TYPO3_HOST_ONLY = [host] = 192.168.1.4
TYPO3_PORT = [port] = 8080 (blank if 80, taken from host value)
TYPO3_REQUEST_HOST = [scheme]://[host][:[port]]
TYPO3_REQUEST_URL = [scheme]://[host][:[port]][path]?[query] (sheme will by default be "http" until we can detect if it's https -
TYPO3_REQUEST_URL = [scheme]://[host][:[port]][path]?[query] (sheme will by default be 'http' until we can detect if it's https -
TYPO3_REQUEST_SCRIPT = [scheme]://[host][:[port]][path_script]
TYPO3_REQUEST_DIR = [scheme]://[host][:[port]][path_dir]
TYPO3_SITE_URL = [scheme]://[host][:[port]][path_dir] of the Typo3 website
TYPO3_SITE_URL = [scheme]://[host][:[port]][path_dir] of the TYPO3 website
TYPO3_DOCUMENT_ROOT = Absolute path of root of documents: TYPO3_DOCUMENT_ROOT.SCRIPT_NAME = SCRIPT_FILENAME (typically)
Notice: [fragment] is apparently NEVER available to the script!
......@@ -90,94 +95,95 @@ class t3lib_div {
Testing suggestions:
- Output all the values.
- In the script, make a link to the script it self, maybe add some parameters and click the link a few times so HTTP_REFERER is seen
- ALSO TRY the script from the ROOT of a site (like "http://www.mytest.com/" and not "http://www.mytest.com/test/" !!)
- ALSO TRY the script from the ROOT of a site (like 'http://www.mytest.com/' and not 'http://www.mytest.com/test/' !!)
*/
# if ($getEnvName=='HTTP_REFERER') return '';
switch((string)$getEnvName) {
case "SCRIPT_NAME":
return php_sapi_name()=="cgi" ? $HTTP_SERVER_VARS["PATH_INFO"] : $HTTP_SERVER_VARS["SCRIPT_NAME"];
case 'SCRIPT_NAME':
return php_sapi_name()=='cgi' ? $HTTP_SERVER_VARS['PATH_INFO'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
break;
case "SCRIPT_FILENAME":
return str_replace('//','/', str_replace('\\','/', php_sapi_name()=="cgi"||php_sapi_name()=="isapi" ? $HTTP_SERVER_VARS["PATH_TRANSLATED"]:$HTTP_SERVER_VARS["SCRIPT_FILENAME"]));
case 'SCRIPT_FILENAME':
return str_replace('//','/', str_replace('\\','/', php_sapi_name()=='cgi'||php_sapi_name()=='isapi' ? $HTTP_SERVER_VARS['PATH_TRANSLATED']:$HTTP_SERVER_VARS['SCRIPT_FILENAME']));
break;
case "REQUEST_URI":
// Typical application of REQUEST_URI is return urls, forms submitting to itselt etc. Eg: returnUrl=".rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI"))
if (!$HTTP_SERVER_VARS["REQUEST_URI"]) { // This is for ISS/CGI which does not have the REQUEST_URI available.
return "/".ereg_replace("^/","",t3lib_div::getIndpEnv("SCRIPT_NAME")).
($HTTP_SERVER_VARS["QUERY_STRING"]?"?".$HTTP_SERVER_VARS["QUERY_STRING"]:"");
} else return $HTTP_SERVER_VARS["REQUEST_URI"];
case 'REQUEST_URI':
// Typical application of REQUEST_URI is return urls, forms submitting to itselt etc. Eg: returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))
if (!$HTTP_SERVER_VARS['REQUEST_URI']) { // This is for ISS/CGI which does not have the REQUEST_URI available.
return '/'.ereg_replace('^/','',t3lib_div::getIndpEnv('SCRIPT_NAME')).
($HTTP_SERVER_VARS['QUERY_STRING']?'?'.$HTTP_SERVER_VARS['QUERY_STRING']:'');
} else return $HTTP_SERVER_VARS['REQUEST_URI'];
break;
case "PATH_INFO":
// $HTTP_SERVER_VARS["PATH_INFO"]!=$HTTP_SERVER_VARS["SCRIPT_NAME"] is necessary because some servers (Windows/CGI) are seen to set PATH_INFO equal to script_name
// Further, there must be at least one "/" in the path - else the PATH_INFO value does not make sense.
// IF "PATH_INFO" never works for our purpose in Typo3 with CGI-servers, then 'php_sapi_name()=="cgi"' might be a better check. Right now strcmp($HTTP_SERVER_VARS["PATH_INFO"],t3lib_div::getIndpEnv("SCRIPT_NAME")) will always return false for CGI-versions, but that is only as long as SCRIPT_NAME is set equal to PATH_INFO because of php_sapi_name()=="cgi" (see above)
// if (strcmp($HTTP_SERVER_VARS["PATH_INFO"],t3lib_div::getIndpEnv("SCRIPT_NAME")) && count(explode("/",$HTTP_SERVER_VARS["PATH_INFO"]))>1) {
if (php_sapi_name()!="cgi") {
return $HTTP_SERVER_VARS["PATH_INFO"];
} else return "";
case 'PATH_INFO':
// $HTTP_SERVER_VARS['PATH_INFO']!=$HTTP_SERVER_VARS['SCRIPT_NAME'] is necessary because some servers (Windows/CGI) are seen to set PATH_INFO equal to script_name
// Further, there must be at least one '/' in the path - else the PATH_INFO value does not make sense.
// IF 'PATH_INFO' never works for our purpose in TYPO3 with CGI-servers, then 'php_sapi_name()=='cgi'' might be a better check. Right now strcmp($HTTP_SERVER_VARS['PATH_INFO'],t3lib_div::getIndpEnv('SCRIPT_NAME')) will always return false for CGI-versions, but that is only as long as SCRIPT_NAME is set equal to PATH_INFO because of php_sapi_name()=='cgi' (see above)
// if (strcmp($HTTP_SERVER_VARS['PATH_INFO'],t3lib_div::getIndpEnv('SCRIPT_NAME')) && count(explode('/',$HTTP_SERVER_VARS['PATH_INFO']))>1) {
if (php_sapi_name()!='cgi') {
return $HTTP_SERVER_VARS['PATH_INFO'];
} else return '';
break;
// These are let through without modification
case "REMOTE_ADDR":
case "REMOTE_HOST":
case "HTTP_REFERER":
case "HTTP_HOST":
case "HTTP_USER_AGENT":
case "HTTP_ACCEPT_LANGUAGE":
case "QUERY_STRING":
case 'REMOTE_ADDR':
case 'REMOTE_HOST':
case 'HTTP_REFERER':
case 'HTTP_HOST':
case 'HTTP_USER_AGENT':
case 'HTTP_ACCEPT_LANGUAGE':
case 'QUERY_STRING':
return $HTTP_SERVER_VARS[$getEnvName];
break;
case "TYPO3_DOCUMENT_ROOT":
// Some CGI-versions (LA13CGI) and mod-rewrite rules on MODULE versions will deliver a "wrong" DOCUMENT_ROOT (according to our description). Further various aliases/mod_rewrite rules can disturb this as well.
case 'TYPO3_DOCUMENT_ROOT':
// Some CGI-versions (LA13CGI) and mod-rewrite rules on MODULE versions will deliver a 'wrong' DOCUMENT_ROOT (according to our description). Further various aliases/mod_rewrite rules can disturb this as well.
// Therefore the DOCUMENT_ROOT is now always calculated as the SCRIPT_FILENAME minus the end part shared with SCRIPT_NAME.
$SFN = t3lib_div::getIndpEnv("SCRIPT_FILENAME");
$SN_A = explode("/",strrev(t3lib_div::getIndpEnv("SCRIPT_NAME")));
$SFN_A = explode("/",strrev($SFN));
$SFN = t3lib_div::getIndpEnv('SCRIPT_FILENAME');
$SN_A = explode('/',strrev(t3lib_div::getIndpEnv('SCRIPT_NAME')));
$SFN_A = explode('/',strrev($SFN));
$acc=array();
while(list($kk,$vv)=each($SN_A)) {
if (!strcmp($SFN_A[$kk],$vv)) {
$acc[]=$vv;
} else break;
}
$commonEnd=strrev(implode("/",$acc));
if (strcmp($commonEnd,"")) $DR = substr($SFN,0,-(strlen($commonEnd)+1));
$commonEnd=strrev(implode('/',$acc));
if (strcmp($commonEnd,'')) $DR = substr($SFN,0,-(strlen($commonEnd)+1));
return $DR;
break;
case "TYPO3_HOST_ONLY":
$p=explode(":",$HTTP_SERVER_VARS["HTTP_HOST"]);
case 'TYPO3_HOST_ONLY':
$p=explode(':',$HTTP_SERVER_VARS['HTTP_HOST']);
return $p[0];
break;
case "TYPO3_PORT":
$p=explode(":",$HTTP_SERVER_VARS["HTTP_HOST"]);
case 'TYPO3_PORT':
$p=explode(':',$HTTP_SERVER_VARS['HTTP_HOST']);
return $p[1];
break;
case "TYPO3_REQUEST_HOST":
return "http".($HTTP_SERVER_VARS["SSL_SESSION_ID"]?"s":"")."://". // I hope this: ($HTTP_SERVER_VARS["SSL_SESSION_ID"]?"s":"") - is sufficient to detect https...
$HTTP_SERVER_VARS["HTTP_HOST"];
case 'TYPO3_REQUEST_HOST':
return 'http'.($HTTP_SERVER_VARS['SSL_SESSION_ID']?'s':'').'://'. // I hope this: ($HTTP_SERVER_VARS['SSL_SESSION_ID']?'s':'') - is sufficient to detect https...
$HTTP_SERVER_VARS['HTTP_HOST'];
break;
case "TYPO3_REQUEST_URL":
return t3lib_div::getIndpEnv("TYPO3_REQUEST_HOST").t3lib_div::getIndpEnv("REQUEST_URI");
case 'TYPO3_REQUEST_URL':
return t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST').t3lib_div::getIndpEnv('REQUEST_URI');
break;
case "TYPO3_REQUEST_SCRIPT":
return t3lib_div::getIndpEnv("TYPO3_REQUEST_HOST").t3lib_div::getIndpEnv("SCRIPT_NAME");
case 'TYPO3_REQUEST_SCRIPT':
return t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST').t3lib_div::getIndpEnv('SCRIPT_NAME');
break;
case "TYPO3_REQUEST_DIR":
return t3lib_div::getIndpEnv("TYPO3_REQUEST_HOST").t3lib_div::dirname(t3lib_div::getIndpEnv("SCRIPT_NAME"))."/";
case 'TYPO3_REQUEST_DIR':
return t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST').t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
break;
case "TYPO3_SITE_URL":
if (defined("PATH_thisScript") && defined("PATH_site")) {
$lPath = substr(dirname(PATH_thisScript),strlen(PATH_site))."/";
$url = t3lib_div::getIndpEnv("TYPO3_REQUEST_DIR");
case 'TYPO3_SITE_URL':
if (defined('PATH_thisScript') && defined('PATH_site')) {
$lPath = substr(dirname(PATH_thisScript),strlen(PATH_site)).'/';
$url = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR');
$siteUrl = substr($url,0,-strlen($lPath));
if (substr($siteUrl,-1)!="/") $siteUrl.="/";
if (substr($siteUrl,-1)!='/') $siteUrl.='/';
return $siteUrl;
} else return "";
} else return '';
break;
case "_ARRAY":
case '_ARRAY':
$out=array();
// Here, list ALL possible keys to this function for debug display.
$envTestVars = t3lib_div::trimExplode(",","
$envTestVars = t3lib_div::trimExplode(',','
HTTP_HOST,
TYPO3_HOST_ONLY,
TYPO3_PORT,
......@@ -196,7 +202,7 @@ class t3lib_div {
REMOTE_ADDR,
REMOTE_HOST,
HTTP_USER_AGENT,
HTTP_ACCEPT_LANGUAGE",1);
HTTP_ACCEPT_LANGUAGE',1);
reset($envTestVars);
while(list(,$v)=each($envTestVars)) {
$out[$v]=t3lib_div::getIndpEnv($v);
......@@ -206,6 +212,7 @@ class t3lib_div {
break;
}
}
}
function view_array($array_in) {
......@@ -261,7 +268,7 @@ define("PATH_thisScript",
*/
define("PATH_thisScript",str_replace('//','/', str_replace('\\','/', php_sapi_name()=="cgi"||php_sapi_name()=="isapi" ? $HTTP_SERVER_VARS["PATH_TRANSLATED"]:$HTTP_SERVER_VARS["SCRIPT_FILENAME"])));
define('PATH_site', dirname(PATH_thisScript).'/');
if (count($HTTP_GET_VARS) || $HTTP_SERVER_VARS["HTTP_REFERER"]) {
......@@ -317,12 +324,11 @@ if (count($HTTP_GET_VARS) || $HTTP_SERVER_VARS["HTTP_REFERER"]) {
echo "Cookie 'test_script_cookie': '<strong>".$HTTP_COOKIE_VARS["test_script_cookie"]."</strong>'<BR>";
echo '<HR><a name="link1"></a>';
echo '<div style="border: 1px solid black; padding: 10px 10px 10px 10px;"><h3>What to do now?</h3>
<p>1) Click this link above once more: <a href="index.php?arg1,arg2,arg3&p1=parameter1&p2[key]='.substr(md5(time()),0,4).'#link1">Go to this page again.</a><BR>
2) Then save this HTML-page and send it to kasper@typo3.com with information about 1) which webserver (Apache/ISS), 2) Unix/Windows, 3) CGI or module (ISAPI)<br>
2a) You might help us find any differences in your values to this <a href="reference.html" target="_blank">reference example</a> by comparing the values before you send the result (thanks).
<br>
3) If you are really advanced you try and click the link below here. With CGI-versions of servers it will most likely give an error page. If it does not, please send the output to me as well (save HTML-page and send to kasper@typo3.com). If you do this PATH_INFO test, please let me know.<br><br>
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 2003-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2002-2003 Ren Fritz (r.fritz@colorcube.de)
* (c) 2002-2004 Ren Fritz (r.fritz@colorcube.de)
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2002 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
......@@ -2,7 +2,7 @@
/***************************************************************
* Copyright notice
*
* (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment