mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '3'
This commit is contained in:
commit
b11bbffb7d
@ -510,11 +510,9 @@ class Upload_Validator {
|
||||
if ($category && isset($this->allowedMaxFileSize['[' . $category . ']'])) {
|
||||
return $this->allowedMaxFileSize['[' . $category . ']'];
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return (isset($this->allowedMaxFileSize['*'])) ? $this->allowedMaxFileSize['*'] : false;
|
||||
}
|
||||
|
||||
return (isset($this->allowedMaxFileSize['*'])) ? $this->allowedMaxFileSize['*'] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,8 @@ class HeaderField extends DatalessField {
|
||||
array(
|
||||
'id' => $this->ID(),
|
||||
'class' => $this->extraClass(),
|
||||
'type' => null,
|
||||
'name' => null
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -13,8 +13,6 @@ use SilverStripe\Model\Relation;
|
||||
* of $dataClass). Unsaved objects are then written when the list is saved
|
||||
* into an instance of {@link RelationList}.
|
||||
*
|
||||
* Most methods that alter the list of objects throw LogicExceptions.
|
||||
*
|
||||
* @package framework
|
||||
* @subpackage model
|
||||
*/
|
||||
@ -51,6 +49,8 @@ class UnsavedRelationList extends ArrayList implements Relation {
|
||||
/**
|
||||
* Create a new UnsavedRelationList
|
||||
*
|
||||
* @param array $baseClass
|
||||
* @param string $relationName
|
||||
* @param string $dataClass The DataObject class used in the relation
|
||||
*/
|
||||
public function __construct($baseClass, $relationName, $dataClass) {
|
||||
@ -63,7 +63,8 @@ class UnsavedRelationList extends ArrayList implements Relation {
|
||||
/**
|
||||
* Add an item to this relationship
|
||||
*
|
||||
* @param $extraFields A map of additional columns to insert into the joinTable in the case of a many_many relation
|
||||
* @param mixed $item
|
||||
* @param array $extraFields A map of additional columns to insert into the joinTable in the case of a many_many relation
|
||||
*/
|
||||
public function add($item, $extraFields = null) {
|
||||
$this->push($item, $extraFields);
|
||||
@ -87,6 +88,7 @@ class UnsavedRelationList extends ArrayList implements Relation {
|
||||
* Pushes an item onto the end of this list.
|
||||
*
|
||||
* @param array|object $item
|
||||
* @param array $extraFields
|
||||
*/
|
||||
public function push($item, $extraFields = null) {
|
||||
if((is_object($item) && !$item instanceof $this->dataClass)
|
||||
@ -165,6 +167,8 @@ class UnsavedRelationList extends ArrayList implements Relation {
|
||||
* Remove the items from this list with the given IDs
|
||||
*
|
||||
* @param array $items
|
||||
* @param array $items
|
||||
* @return $this
|
||||
*/
|
||||
public function removeMany($items) {
|
||||
$this->items = array_diff($this->items, $items);
|
||||
@ -255,7 +259,7 @@ class UnsavedRelationList extends ArrayList implements Relation {
|
||||
|
||||
/**
|
||||
* Returns a copy of this list with the relationship linked to the given foreign ID.
|
||||
* @param $id An ID or an array of IDs.
|
||||
* @param int|array $id An ID or an array of IDs.
|
||||
*/
|
||||
public function forForeignID($id) {
|
||||
$class = singleton($this->baseClass);
|
||||
|
@ -275,9 +275,12 @@ class Security extends Controller implements TemplateGlobalProvider {
|
||||
$form = $me->LoginForm();
|
||||
$form->sessionMessage($message, 'warning');
|
||||
Session::set('MemberLoginForm.force_message',1);
|
||||
$formText = $me->login();
|
||||
$loginResponse = $me->login();
|
||||
if($loginResponse instanceof SS_HTTPResponse) {
|
||||
return $loginResponse;
|
||||
}
|
||||
|
||||
$response->setBody($formText);
|
||||
$response->setBody((string)$loginResponse);
|
||||
|
||||
$controller->extend('permissionDenied', $member);
|
||||
|
||||
@ -502,7 +505,7 @@ class Security extends Controller implements TemplateGlobalProvider {
|
||||
* For multiple authenticators, Security_MultiAuthenticatorLogin is used.
|
||||
* See getTemplatesFor and getIncludeTemplate for how to override template logic
|
||||
*
|
||||
* @return string Returns the "login" page as HTML code.
|
||||
* @return string|SS_HTTPResponse Returns the "login" page as HTML code.
|
||||
*/
|
||||
public function login() {
|
||||
// Check pre-login process
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
Name: emptyconfig
|
||||
---
|
@ -187,6 +187,13 @@ class UploadTest extends SapphireTest {
|
||||
$retrievedSize = $v->getAllowedMaxFileSize('txt');
|
||||
$this->assertEquals(4096, $retrievedSize, 'Max file size check on instance values failed (instance extension set check)');
|
||||
|
||||
// Check a wildcard max file size against a file with an extension
|
||||
$v = new UploadTest_Validator();
|
||||
$v->setAllowedMaxFileSize(2000);
|
||||
|
||||
$retrievedSize = $v->getAllowedMaxFileSize('.jpg');
|
||||
$this->assertEquals(2000, $retrievedSize, 'Max file size check on instance values failed (wildcard max file size)');
|
||||
|
||||
Config::unnest();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user