Corrects indentation and line length

This commit is contained in:
Simon Welsh 2013-01-24 19:56:02 +13:00
parent 1f1b115ef9
commit 3439e30ac1
5 changed files with 17 additions and 14 deletions

View File

@ -282,7 +282,7 @@ 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 it.
$responseHeaders['Vary'] = 'Cookie, X-Forwarded-Protocol, User-Agent, Accept';
} else {
@ -293,11 +293,12 @@ class HTTP {
$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.
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
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'];

View File

@ -655,7 +655,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);

View File

@ -369,11 +369,11 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
$form->loadDataFrom($this->record, $this->record->ID == 0 ? Form::MERGE_IGNORE_FALSEISH : Form::MERGE_DEFAULT);
if($this->record->ID && !$canEdit) {
// Restrict editing of existing records
$form->makeReadonly();
// Restrict editing of existing records
$form->makeReadonly();
} elseif(!$this->record->ID && !$canCreate) {
// Restrict creation of new records
$form->makeReadonly();
// Restrict creation of new records
$form->makeReadonly();
}
// Load many_many extraData for record.

View File

@ -91,7 +91,7 @@ class DB {
$key = md5($key); // Ensure key is correct length for chosen cypher
$ivSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CFB);
$iv = mcrypt_create_iv($ivSize);
$iv = mcrypt_create_iv($ivSize);
$encrypted = mcrypt_encrypt(
MCRYPT_RIJNDAEL_256, $key, $name, MCRYPT_MODE_CFB, $iv
);

View File

@ -136,7 +136,7 @@ class Versioned extends DataExtension {
* @todo Should this all go into VersionedDataQuery?
*/
public function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
$baseTable = ClassInfo::baseDataClass($dataQuery->dataClass());
$baseTable = ClassInfo::baseDataClass($dataQuery->dataClass());
switch($dataQuery->getQueryParam('Versioned.mode')) {
// Noop
@ -281,8 +281,8 @@ class Versioned extends DataExtension {
*/
function augmentLoadLazyFields(SQLQuery &$query, DataQuery &$dataQuery = null, $record) {
$dataClass = $dataQuery->dataClass();
if (isset($record['Version'])){
$dataQuery->where("\"$dataClass\".\"RecordID\" = " . $record['ID']);
if (isset($record['Version'])){
$dataQuery->where("\"$dataClass\".\"RecordID\" = " . $record['ID']);
$dataQuery->where("\"$dataClass\".\"Version\" = " . $record['Version']);
$dataQuery->setQueryParam('Versioned.mode', 'all_versions');
}