updated ubercart contrib module

This commit is contained in:
2019-10-14 10:35:12 +02:00
parent 26fadc74e4
commit 4e780cb6d4
55 changed files with 181 additions and 161 deletions

View File

@@ -22,10 +22,10 @@ define('UC_FILE_FORM_ACTION', 1 );
function uc_file_admin_files_form($form, &$form_state) {
if (isset($form_state['storage']['step']) && $form_state['storage']['step'] == UC_FILE_FORM_ACTION) {
return array(
'#validate' => array('uc_file_admin_files_form_action_validate'),
'#submit' => array('uc_file_admin_files_form_action_submit'),
) + $form + uc_file_admin_files_form_action($form, $form_state);
return array(
'#validate' => array('uc_file_admin_files_form_action_validate'),
'#submit' => array('uc_file_admin_files_form_action_submit'),
) + $form + uc_file_admin_files_form_action($form, $form_state);
}
else {
// Refresh our file list before display.
@@ -283,15 +283,31 @@ function uc_file_admin_files_form_action($form, &$form_state) {
break;
case 'uc_file_upload':
// Calculate the max size of uploaded files, in bytes.
$max_bytes = trim(ini_get('post_max_size'));
switch (strtolower($max_bytes{strlen($max_bytes) - 1})) {
case 'g':
$max_bytes *= 1024;
case 'm':
$max_bytes *= 1024;
case 'k':
$max_bytes *= 1024;
// Calculate the maximum size of uploaded files in bytes.
$post_max_size = ini_get('post_max_size');
if (is_numeric($post_max_size)) {
// Handle the case where 'post_max_size' has no suffix.
// An explicit cast is needed because floats are not allowed.
$max_bytes = (int) $post_max_size;
}
else {
// Handle the case where 'post_max_size' has a suffix of
// 'M', 'K', or 'G' (case insensitive).
$max_bytes = (int) substr($post_max_size, 0, -1);
$suffix = strtolower(substr($post_max_size, -1));
switch ($suffix) {
case 'k':
$max_bytes *= 1024;
break;
case 'm':
$max_bytes *= 1048576;
break;
case 'g':
$max_bytes *= 1073741824;
break;
}
}
// Gather list of directories under the selected one(s).
@@ -313,7 +329,9 @@ function uc_file_admin_files_form_action($form, &$form_state) {
$form['upload'] = array(
'#type' => 'file',
'#title' => t('File'),
'#description' => t('The maximum file size that can be uploaded is %size bytes. You will need to use a different method to upload the file to the directory (e.g. (S)FTP, SCP) if your file exceeds this size. Files you upload using one of these alternate methods will be automatically detected.', array('%size' => number_format($max_bytes))),
// Deliberately concatenate the strings to preserve backwards
// compatibility with existing translations.
'#description' => t('The maximum file size that can be uploaded is %size bytes. You will need to use a different method to upload the file to the directory (e.g. (S)FTP, SCP) if your file exceeds this size. Files you upload using one of these alternate methods will be automatically detected.', array('%size' => number_format($max_bytes))) . ' ' . t("Note: A value of '0' means there is no size limit."),
);
$form['#attributes']['class'][] = 'foo';
@@ -375,7 +393,6 @@ function uc_file_admin_files_form_action_validate($form, &$form_state) {
break;
default:
// This action isn't handled by us, so check if any
// hook_uc_file_action('validate', $args) are implemented.
foreach (module_implements('uc_file_action') as $module) {

View File

@@ -11,8 +11,8 @@ files[] = tests/uc_file.test
stylesheets[all][] = uc_file.css
scripts[] = uc_file.js
; Information added by Drupal.org packaging script on 2019-03-06
version = "7.x-3.12"
; Information added by Drupal.org packaging script on 2019-10-01
version = "7.x-3.13"
core = "7.x"
project = "ubercart"
datestamp = "1551862392"
datestamp = "1569942207"