Merge branch '3.5' into 3.6

This commit is contained in:
Daniel Hensby 2017-06-14 12:02:06 +01:00
commit ecc88b2cbe
No known key found for this signature in database
GPG Key ID: 229831A941962E26
8 changed files with 27 additions and 10 deletions

View File

@ -92,7 +92,10 @@
fields.not(':radio,:checkbox').bind('change.changetracker', onchange); fields.not(':radio,:checkbox').bind('change.changetracker', onchange);
fields.each(function() { fields.each(function() {
if($(this).is(':radio,:checkbox')) { if($(this).is(':radio,:checkbox')) {
origVal = self.find(':input[name=' + $(this).attr('name') + ']:checked').val(); origVal = self.find(':input[name="' + $(this).attr('name') + '"]:checked').val();
if("undefined" === typeof origVal){
origVal = 0;
}
} else { } else {
origVal = $(this).val(); origVal = $(this).val();
} }

View File

@ -396,7 +396,7 @@ class Upload_Validator {
if (empty($this->allowedMaxFileSize)) { if (empty($this->allowedMaxFileSize)) {
// Set default max file sizes if there isn't // Set default max file sizes if there isn't
$fileSize = Config::inst()->get('Upload_Validator', 'default_max_file_size'); $fileSize = Config::inst()->get('Upload_Validator', 'default_max_file_size');
if (isset($fileSize)) { if (!empty($fileSize)) {
$this->setAllowedMaxFileSize($fileSize); $this->setAllowedMaxFileSize($fileSize);
} else { } else {
// When no default is present, use maximum set by PHP // When no default is present, use maximum set by PHP

View File

@ -47,11 +47,11 @@ class MemberAuthenticator extends Authenticator {
} }
// Check default login (see Security::setDefaultAdmin()) // Check default login (see Security::setDefaultAdmin())
$asDefaultAdmin = $email === Security::default_admin_username(); $asDefaultAdmin = Security::has_default_admin() && $email === Security::default_admin_username();
if($asDefaultAdmin) { if($asDefaultAdmin) {
// If logging is as default admin, ensure record is setup correctly // If logging is as default admin, ensure record is setup correctly
$member = Member::default_admin(); $member = Member::default_admin();
$success = !$member->isLockedOut() && Security::check_default_admin($email, $data['Password']); $success = Security::check_default_admin($email, $data['Password']) && $member && !$member->isLockedOut();
//protect against failed login //protect against failed login
if($success) { if($success) {
return $member; return $member;

View File

@ -886,9 +886,9 @@ class Security extends Controller implements TemplateGlobalProvider {
*/ */
public static function check_default_admin($username, $password) { public static function check_default_admin($username, $password) {
return ( return (
self::$default_username === $username self::has_default_admin()
&& self::$default_username === $username
&& self::$default_password === $password && self::$default_password === $password
&& self::has_default_admin()
); );
} }

View File

@ -134,6 +134,12 @@ class UploadTest extends SapphireTest {
} }
public function testGetAllowedMaxFileSize() { public function testGetAllowedMaxFileSize() {
// Check the max file size defaults to PHP settings
$maxPhpSize = min(File::ini2bytes(ini_get('upload_max_filesize')), File::ini2bytes(ini_get('post_max_size')));
$v = new UploadTest_Validator();
$retrievedSize = $v->getAllowedMaxFileSize('[image]');
$this->assertEquals($maxPhpSize, $retrievedSize, 'Max file size did not default to PHP value');
// Check the max file size uses the config values // Check the max file size uses the config values
$configMaxFileSizes = array( $configMaxFileSizes = array(
'[image]' => '1k', '[image]' => '1k',

File diff suppressed because one or more lines are too long

View File

@ -16,10 +16,14 @@ require_once $frameworkPath . '/core/Constants.php';
// Handle incoming request if it's a script call // Handle incoming request if it's a script call
if (TinyMCE_Compressor::getParam("js")) { if (TinyMCE_Compressor::getParam("js")) {
$tempFolder = TEMP_FOLDER . '/tinymce-cache';
if (!file_exists($tempFolder)) {
mkdir($tempFolder);
}
// Default settings // Default settings
$tinyMCECompressor = new TinyMCE_Compressor(array( $tinyMCECompressor = new TinyMCE_Compressor(array(
// CUSTOM SilverStripe // CUSTOM SilverStripe
'cache_dir' => TEMP_FOLDER 'cache_dir' => $tempFolder
// CUSTOM END // CUSTOM END
)); ));

View File

@ -1317,7 +1317,11 @@ tinymce.util.Quirks = function(editor) {
// WebKit can't even do simple things like selecting an image // WebKit can't even do simple things like selecting an image
// Needs tobe the setBaseAndExtend or it will fail to select floated images // Needs tobe the setBaseAndExtend or it will fail to select floated images
if (/^(IMG|HR)$/.test(e.nodeName)) { if (/^(IMG|HR)$/.test(e.nodeName)) {
try {
selection.getSel().setBaseAndExtent(e, 0, e, 1); selection.getSel().setBaseAndExtent(e, 0, e, 1);
} catch (error) {
selection.select(e);
}
} }
if (e.nodeName == 'A' && dom.hasClass(e, 'mceItemAnchor')) { if (e.nodeName == 'A' && dom.hasClass(e, 'mceItemAnchor')) {