Merge branch '3.6' into 3

This commit is contained in:
Daniel Hensby 2017-06-14 12:02:27 +01:00
commit 6f2b08b962
No known key found for this signature in database
GPG Key ID: 229831A941962E26
9 changed files with 29 additions and 12 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

@ -176,7 +176,7 @@ to the translator.
// Simple string translation // Simple string translation
_t('LeftAndMain.FILESIMAGES','Files & Images'); _t('LeftAndMain.FILESIMAGES','Files & Images');
// Using the natural languate comment parameter to supply additional context information to translators // Using the natural language comment parameter to supply additional context information to translators
_t('LeftAndMain.HELLO','Site content','Menu title'); _t('LeftAndMain.HELLO','Site content','Menu title');
// Using injection to add variables into the translated strings. // Using injection to add variables into the translated strings.
@ -203,7 +203,7 @@ the PHP version of the function.
// Simple string translation // Simple string translation
<%t Namespace.Entity "String to translate" %> <%t Namespace.Entity "String to translate" %>
// Using the natural languate comment parameter to supply additional context information to translators // Using the natural language comment parameter to supply additional context information to translators
<%t SearchResults.NoResult "There are no results matching your query." is "A message displayed to users when the search produces no results." %> <%t SearchResults.NoResult "There are no results matching your query." is "A message displayed to users when the search produces no results." %>
// Using injection to add variables into the translated strings (note that $Name and $Greeting must be available in the current template scope). // Using injection to add variables into the translated strings (note that $Name and $Greeting must be available in the current template scope).

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")) {
// Default settings $tempFolder = TEMP_FOLDER . '/tinymce-cache';
if (!file_exists($tempFolder)) {
mkdir($tempFolder);
}
// 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)) {
selection.getSel().setBaseAndExtent(e, 0, e, 1); try {
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')) {