Bug #18126 » bug_7397_v2.diff
t3lib/config_default.php (working copy) | ||
---|---|---|
'maxFileNameLength' => 60, // Integer, This is the maximum file name length. The value will be taken into account by basic file operations like renaming or creation of files and folders.
|
||
'UTF8filesystem' => 0, // Boolean: If true and [BE][forceCharset] is set to utf-8, then TYPO3 uses utf-8 to store file names. This allows for accented Latin letters as well as any other non-latin characters like Cyrillic and Chinese.
|
||
'lockingMode' => 'simple', // String: Define which locking mode is used to control requests to pages being generated. Can be one of either "disable" (no locking), "simple" (checks for file existance), "flock" (using PHPs flock() function), "semaphore" (using PHPs sem_acquire() function). Default is "disable".
|
||
'proxyIP' => '', // String: list of IP addresses. If TYPO3 is behind one or more (intransparent) reverese proxies the IP addresses must be added here.
|
||
'proxyPrefix' => '', // String: optional prefix to be added to the internal URL (SCRIPT_NAME and REQUEST_URI).
|
||
'proxySSL' => '', // String: '*' or list of IP addresses of proxies that use SSL (https) for the connection to the client, but an unencrypted connection (http) to the server. If '*' all proxies defined in SYS[proxyIP] use SSL.
|
||
'proxyPrefixSSL' => '', // String: prefix to be added to the internal URL (SCRIPT_NAME and REQUEST_URI) when SSL accessing the server via an SSL proxy. This setting overrides SYS[proxyPrefix].
|
||
),
|
||
'EXT' => Array ( // Options related to the Extension Management
|
||
'noEdit' => 1, // Boolean: If set, the Extension Manager does NOT allow extension files to be edited! (Otherwise both local and global extensions can be edited.)
|
t3lib/class.t3lib_div.php (working copy) | ||
---|---|---|
}
|
||
/**
|
||
* Validate a given IP address.
|
||
*
|
||
* Possible format are IPv4 and IPv6.
|
||
*
|
||
* @param string IP address to be tested
|
||
* @return boolean True if $ip is either of IPv4 or IPv6 format.
|
||
*/
|
||
public static function validIP($ip) {
|
||
if (strpos($ip, ':') === false) {
|
||
return t3lib_div::validIPv4($ip);
|
||
} else {
|
||
return t3lib_div::validIPv6($ip);
|
||
}
|
||
}
|
||
/**
|
||
* Validate a given IP address to the IPv4 address format.
|
||
*
|
||
* Example for possible format: 10.0.45.99
|
||
*
|
||
* @param string IP address to be tested
|
||
* @return boolean True if $ip is of IPv4 format.
|
||
*/
|
||
public static function validIPv4($ip) {
|
||
$parts = explode('.', $ip);
|
||
if (count($parts)==4 &&
|
||
t3lib_div::testInt($parts[0]) && $parts[0]>=1 && $parts[0]<256 &&
|
||
t3lib_div::testInt($parts[1]) && $parts[0]>=0 && $parts[0]<256 &&
|
||
t3lib_div::testInt($parts[2]) && $parts[0]>=0 && $parts[0]<256 &&
|
||
t3lib_div::testInt($parts[3]) && $parts[0]>=0 && $parts[0]<256) {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
/**
|
||
* Validate a given IP address to the IPv6 address format.
|
||
*
|
||
* Example for possible format: 43FB::BB3F:A0A0:0 | ::1
|
||
... | ... | |
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_HOST = [scheme]://[host][:[port]]
|
||
TYPO3_REQUEST_URL = [scheme]://[host][:[port]][path]?[query] (scheme will by default be "http" until we can detect something different)
|
||
TYPO3_REQUEST_SCRIPT = [scheme]://[host][:[port]][path_script]
|
||
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 frontend
|
||
TYPO3_SITE_SCRIPT = [script / Speaking URL] of the TYPO3 website
|
||
TYPO3_DOCUMENT_ROOT = Absolute path of root of documents: TYPO3_DOCUMENT_ROOT.SCRIPT_NAME = SCRIPT_FILENAME (typically)
|
||
TYPO3_SSL = Returns TRUE if this session uses SSL (HTTPS)
|
||
TYPO3_SITE_SCRIPT = [script / Speaking URL] of the TYPO3 website
|
||
TYPO3_DOCUMENT_ROOT = Absolute path of root of documents: TYPO3_DOCUMENT_ROOT.SCRIPT_NAME = SCRIPT_FILENAME (typically)
|
||
TYPO3_SSL = Returns TRUE if this session uses SSL/TLS (https)
|
||
TYPO3_PROXY = Returns TRUE if this session runs over a well known proxy
|
||
Notice: [fragment] is apparently NEVER available to the script!
|
||
... | ... | |
switch ((string)$getEnvName) {
|
||
case 'SCRIPT_NAME':
|
||
$retVal = (php_sapi_name()=='cgi'||php_sapi_name()=='cgi-fcgi')&&($_SERVER['ORIG_PATH_INFO']?$_SERVER['ORIG_PATH_INFO']:$_SERVER['PATH_INFO']) ? ($_SERVER['ORIG_PATH_INFO']?$_SERVER['ORIG_PATH_INFO']:$_SERVER['PATH_INFO']) : ($_SERVER['ORIG_SCRIPT_NAME']?$_SERVER['ORIG_SCRIPT_NAME']:$_SERVER['SCRIPT_NAME']);
|
||
// add a prefix if TYPO3 is behind a proxy: ext-domain.com => int-server.com/prefix
|
||
if (t3lib_div::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyIP'])) {
|
||
if (t3lib_div::getIndpEnv('TYPO3_SSL') && $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyPrefixSSL']) {
|
||
$retVal = $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyPrefixSSL'].$retVal;
|
||
} elseif ($GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyPrefix']) {
|
||
$retVal = $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyPrefix'].$retVal;
|
||
}
|
||
}
|
||
break;
|
||
case 'SCRIPT_FILENAME':
|
||
$retVal = str_replace('//','/', str_replace('\\','/', (php_sapi_name()=='cgi'||php_sapi_name()=='isapi' ||php_sapi_name()=='cgi-fcgi')&&($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME'])));
|
||
... | ... | |
} elseif (!$_SERVER['REQUEST_URI']) { // This is for ISS/CGI which does not have the REQUEST_URI available.
|
||
$retVal = '/'.ereg_replace('^/','',t3lib_div::getIndpEnv('SCRIPT_NAME')).
|
||
($_SERVER['QUERY_STRING']?'?'.$_SERVER['QUERY_STRING']:'');
|
||
} else $retVal = $_SERVER['REQUEST_URI'];
|
||
} else {
|
||
$retVal = $_SERVER['REQUEST_URI'];
|
||
}
|
||
// add a prefix if TYPO3 is behind a proxy: ext-domain.com => int-server.com/prefix
|
||
if (t3lib_div::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyIP'])) {
|
||
if (t3lib_div::getIndpEnv('TYPO3_SSL') && $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyPrefixSSL']) {
|
||
$retVal = $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyPrefixSSL'].$retVal;
|
||
} elseif ($GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyPrefix']) {
|
||
$retVal = $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyPrefix'].$retVal;
|
||
}
|
||
}
|
||
break;
|
||
case 'PATH_INFO':
|
||
// $_SERVER['PATH_INFO']!=$_SERVER['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($_SERVER['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($_SERVER['PATH_INFO'],t3lib_div::getIndpEnv('SCRIPT_NAME')) && count(explode('/',$_SERVER['PATH_INFO']))>1) {
|
||
if (php_sapi_name()!='cgi'&&php_sapi_name()!='cgi-fcgi') {
|
||
if (php_sapi_name()!='cgi' && php_sapi_name()!='cgi-fcgi') {
|
||
$retVal = $_SERVER['PATH_INFO'];
|
||
}
|
||
break;
|
||
case 'TYPO3_PROXY':
|
||
$retVal = t3lib_div::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyIP']);
|
||
break;
|
||
case 'REMOTE_ADDR':
|
||
$retVal = $_SERVER['REMOTE_ADDR'];
|
||
if (t3lib_div::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyIP'])) {
|
||
// use first IP found in list
|
||
$ip = t3lib_div::trimExplode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
||
$ip = array_pop($ip);
|
||
if (t3lib_div::validIP($ip)) {
|
||
$retVal = $ip;
|
||
}
|
||
}
|
||
break;
|
||
case 'HTTP_HOST':
|
||
$retVal = $_SERVER['HTTP_HOST'];
|
||
if (t3lib_div::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyIP'])) {
|
||
// use first host found in list
|
||
$host = t3lib_div::trimExplode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
|
||
$host = array_pop($host);
|
||
if ($host) {
|
||
$retVal = $host;
|
||
}
|
||
}
|
||
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_ENCODING':
|
||
case 'HTTP_ACCEPT_LANGUAGE':
|
||
case 'REMOTE_HOST':
|
||
case 'QUERY_STRING':
|
||
$retVal = $_SERVER[$getEnvName];
|
||
break;
|
||
... | ... | |
$retVal = $DR;
|
||
break;
|
||
case 'TYPO3_HOST_ONLY':
|
||
$p = explode(':',$_SERVER['HTTP_HOST']);
|
||
$p = explode(':',t3lib_div::getIndpEnv('HTTP_HOST'));
|
||
$retVal = $p[0];
|
||
break;
|
||
case 'TYPO3_PORT':
|
||
$p = explode(':',$_SERVER['HTTP_HOST']);
|
||
$p = explode(':',t3lib_div::getIndpEnv('HTTP_HOST'));
|
||
$retVal = $p[1];
|
||
break;
|
||
case 'TYPO3_REQUEST_HOST':
|
||
$retVal = (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').
|
||
$_SERVER['HTTP_HOST'];
|
||
t3lib_div::getIndpEnv('HTTP_HOST');
|
||
break;
|
||
case 'TYPO3_REQUEST_URL':
|
||
$retVal = t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST').t3lib_div::getIndpEnv('REQUEST_URI');
|
||
... | ... | |
$retVal = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
|
||
break;
|
||
case 'TYPO3_SSL':
|
||
$retVal = $_SERVER['SSL_SESSION_ID'] || !strcmp($_SERVER['HTTPS'],'on') || !strcmp($_SERVER['HTTPS'],'1') ? TRUE : FALSE; // see http://bugs.typo3.org/view.php?id=3909
|
||
$proxySSL = $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxySSL'];
|
||
if ($proxySSL == '*') {
|
||
$proxySSL = $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyIP'];
|
||
}
|
||
if ($proxySSL && t3lib_div::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['proxyIP'])) {
|
||
$retVal = true;
|
||
} else {
|
||
$retVal = $_SERVER['SSL_SESSION_ID'] || !strcmp($_SERVER['HTTPS'],'on') || !strcmp($_SERVER['HTTPS'],'1') ? true : false; // see http://bugs.typo3.org/view.php?id=3909
|
||
}
|
||
break;
|
||
case '_ARRAY':
|
||
$out = array();
|
||
... | ... | |
return '\''.$value.'\'';
|
||
}
|
||
}
|
||
?>
|
||
?>
|