mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Fixed line lengths
This commit is contained in:
parent
9e2e050f20
commit
92458d9f43
@ -288,7 +288,8 @@ class HTTP {
|
||||
$responseHeaders["Cache-Control"] = "max-age=" . self::$cache_age . ", must-revalidate, no-transform";
|
||||
$responseHeaders["Pragma"] = "";
|
||||
|
||||
// To do: User-Agent should only be added in situations where you *are* actually varying according to user-agent.
|
||||
// To do: User-Agent should only be added in situations where you *are* actually
|
||||
// varying according to user-agent.
|
||||
$responseHeaders['Vary'] = 'Cookie, X-Forwarded-Protocol, User-Agent, Accept';
|
||||
|
||||
} else {
|
||||
@ -298,13 +299,12 @@ class HTTP {
|
||||
if(self::$modification_date && self::$cache_age > 0) {
|
||||
$responseHeaders["Last-Modified"] = self::gmt_date(self::$modification_date);
|
||||
|
||||
/* Chrome ignores Varies when redirecting back (http://code.google.com/p/chromium/issues/detail?id=79758)
|
||||
which means that if you log out, you get redirected back to a page which Chrome then checks against last-modified (which passes, getting a 304)
|
||||
when it shouldn't be trying to use that page at all because it's the "logged in" version.
|
||||
|
||||
By also using and etag that includes both the modification date and all the varies values which we also check against we can catch
|
||||
this and not return a 304
|
||||
*/
|
||||
// Chrome ignores Varies when redirecting back (http://code.google.com/p/chromium/issues/detail?id=79758)
|
||||
// which means that if you log out, you get redirected back to a page which Chrome then checks against
|
||||
// last-modified (which passes, getting a 304)
|
||||
// when it shouldn't be trying to use that page at all because it's the "logged in" version.
|
||||
// By also using and etag that includes both the modification date and all the varies
|
||||
// values which we also check against we can catch this and not return a 304
|
||||
$etagParts = array(self::$modification_date, serialize($_COOKIE));
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) $etagParts[] = $_SERVER['HTTP_X_FORWARDED_PROTOCOL'];
|
||||
if (isset($_SERVER['HTTP_USER_AGENT'])) $etagParts[] = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
@ -151,7 +151,8 @@ class SS_HTTPResponse {
|
||||
public function setBody($body) {
|
||||
$this->body = $body;
|
||||
|
||||
// Set content-length in bytes. Use mbstring to avoid problems with mb_internal_encoding() and mbstring.func_overload
|
||||
// Set content-length in bytes. Use mbstring to avoid problems with
|
||||
// mb_internal_encoding() and mbstring.func_overload
|
||||
$this->headers['Content-Length'] = mb_strlen($this->body,'8bit');
|
||||
}
|
||||
|
||||
@ -232,7 +233,11 @@ class SS_HTTPResponse {
|
||||
} else {
|
||||
// It's critical that these status codes are sent; we need to report a failure if not.
|
||||
if($this->statusCode >= 300) {
|
||||
user_error("Couldn't set response type to $this->statusCode because of output on line $line of $file", E_USER_WARNING);
|
||||
user_error(
|
||||
"Couldn't set response type to $this->statusCode because " .
|
||||
"of output on line $line of $file",
|
||||
E_USER_WARNING
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,15 @@ class Debug {
|
||||
ini_set('display_errors', 0);
|
||||
|
||||
if(self::$send_warnings_to) {
|
||||
return self::emailError(self::$send_warnings_to, $errno, $errstr, $errfile, $errline, $errcontext, "Warning");
|
||||
return self::emailError(
|
||||
self::$send_warnings_to,
|
||||
$errno,
|
||||
$errstr,
|
||||
$errfile,
|
||||
$errline,
|
||||
$errcontext,
|
||||
"Warning"
|
||||
);
|
||||
}
|
||||
|
||||
// Send out the error details to the logger for writing
|
||||
|
@ -715,7 +715,9 @@ class Form extends RequestHandler {
|
||||
$needsCacheDisabled = false;
|
||||
if ($this->getSecurityToken()->isEnabled()) $needsCacheDisabled = true;
|
||||
if ($this->FormMethod() != 'get') $needsCacheDisabled = true;
|
||||
if (!($this->validator instanceof RequiredFields) || count($this->validator->getRequired())) $needsCacheDisabled = true;
|
||||
if (!($this->validator instanceof RequiredFields) || count($this->validator->getRequired())) {
|
||||
$needsCacheDisabled = true;
|
||||
}
|
||||
|
||||
// If we need to disable cache, do it
|
||||
if ($needsCacheDisabled) HTTP::set_cache_age(0);
|
||||
|
@ -144,11 +144,21 @@ class HTMLText extends Text {
|
||||
*/
|
||||
public function exists() {
|
||||
// If it's blank, it's blank
|
||||
if(!parent::exists()) return false;
|
||||
if(!parent::exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If it's got a content tag
|
||||
if(preg_match('/<(img|embed|object|iframe)[^>]*>/i', $this->value)) return true;
|
||||
// If it's just one or two tags on its own (and not the above) it's empty. This might be <p></p> or <h1></h1> or whatever.
|
||||
if(preg_match('/^[\\s]*(<[^>]+>[\\s]*){1,2}$/', $this->value)) return false;
|
||||
if(preg_match('/<(img|embed|object|iframe)[^>]*>/i', $this->value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If it's just one or two tags on its own (and not the above) it's empty.
|
||||
// This might be <p></p> or <h1></h1> or whatever.
|
||||
if(preg_match('/^[\\s]*(<[^>]+>[\\s]*){1,2}$/', $this->value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise its content is genuine content
|
||||
return true;
|
||||
}
|
||||
|
@ -426,7 +426,8 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
Cookie::set('alc_enc', null); // // Clear the Remember Me cookie
|
||||
Cookie::forceExpiry('alc_enc');
|
||||
|
||||
// Switch back to live in order to avoid infinite loops when redirecting to the login screen (if this login screen is versioned)
|
||||
// Switch back to live in order to avoid infinite loops when
|
||||
// redirecting to the login screen (if this login screen is versioned)
|
||||
Session::clear('readingMode');
|
||||
|
||||
$this->write();
|
||||
|
Loading…
x
Reference in New Issue
Block a user