From 56d2664a904119f73e7df4fb355e4c525e040b70 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 14 Apr 2008 17:48:46 +0000 Subject: - Patch #245115 by kkaefer, John Morahan, JohnAlbin et al: after a long discussion we've decided to make the concatenation operator consistent with the other operators. --- modules/upload/upload.admin.inc | 32 ++++++++++++++++---------------- modules/upload/upload.module | 26 +++++++++++++------------- 2 files changed, 29 insertions(+), 29 deletions(-) (limited to 'modules/upload') diff --git a/modules/upload/upload.admin.inc b/modules/upload/upload.admin.inc index d9371909a..ae0cee19f 100644 --- a/modules/upload/upload.admin.inc +++ b/modules/upload/upload.admin.inc @@ -14,7 +14,7 @@ function upload_admin_settings_validate($form, &$form_state) { $default_uploadsize = $form_state['values']['upload_uploadsize_default']; $default_usersize = $form_state['values']['upload_usersize_default']; - $exceed_max_msg = t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))) .'
'; + $exceed_max_msg = t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))) . '
'; $more_info = t("Depending on your server environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory."); if (!is_numeric($default_uploadsize) || ($default_uploadsize <= 0)) { @@ -32,21 +32,21 @@ function upload_admin_settings_validate($form, &$form_state) { } foreach ($form_state['values']['roles'] as $rid => $role) { - $uploadsize = $form_state['values']['upload_uploadsize_'. $rid]; - $usersize = $form_state['values']['upload_usersize_'. $rid]; + $uploadsize = $form_state['values']['upload_uploadsize_' . $rid]; + $usersize = $form_state['values']['upload_usersize_' . $rid]; if (!is_numeric($uploadsize) || ($uploadsize <= 0)) { - form_set_error('upload_uploadsize_'. $rid, t('The %role file size limit must be a number and greater than zero.', array('%role' => $role))); + form_set_error('upload_uploadsize_' . $rid, t('The %role file size limit must be a number and greater than zero.', array('%role' => $role))); } if (!is_numeric($usersize) || ($usersize <= 0)) { - form_set_error('upload_usersize_'. $rid, t('The %role file size limit must be a number and greater than zero.', array('%role' => $role))); + form_set_error('upload_usersize_' . $rid, t('The %role file size limit must be a number and greater than zero.', array('%role' => $role))); } if ($uploadsize * 1024 * 1024 > file_upload_max_size()) { - form_set_error('upload_uploadsize_'. $rid, $exceed_max_msg . $more_info); + form_set_error('upload_uploadsize_' . $rid, $exceed_max_msg . $more_info); $more_info = ''; } if ($uploadsize > $usersize) { - form_set_error('upload_uploadsize_'. $rid, t('The %role maximum file size per upload is greater than the total file size allowed per user', array('%role' => $role))); + form_set_error('upload_uploadsize_' . $rid, t('The %role maximum file size per upload is greater than the total file size allowed per user', array('%role' => $role))); } } } @@ -71,7 +71,7 @@ function upload_admin_settings() { '#size' => 15, '#maxlength' => 10, '#description' => t('The maximum allowed image size (e.g. 640x480). Set to 0 for no restriction. If an image toolkit is installed, files exceeding this value will be scaled down to fit.', array('!image-toolkit-link' => url('admin/settings/image-toolkit'))), - '#field_suffix' => ''. t('WIDTHxHEIGHT') .'' + '#field_suffix' => '' . t('WIDTHxHEIGHT') . '' ); $form['settings_general']['upload_list_default'] = array( '#type' => 'select', @@ -107,38 +107,38 @@ function upload_admin_settings() { '#field_suffix' => t('MB'), ); - $form['settings_general']['upload_max_size'] = array('#value' => '

'. t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))) .'

'); + $form['settings_general']['upload_max_size'] = array('#value' => '

' . t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))) . '

'); $roles = user_roles(FALSE, 'upload files'); $form['roles'] = array('#type' => 'value', '#value' => $roles); foreach ($roles as $rid => $role) { - $form['settings_role_'. $rid] = array( + $form['settings_role_' . $rid] = array( '#type' => 'fieldset', '#title' => t('Settings for @role', array('@role' => $role)), '#collapsible' => TRUE, '#collapsed' => TRUE, ); - $form['settings_role_'. $rid]['upload_extensions_'. $rid] = array( + $form['settings_role_' . $rid]['upload_extensions_' . $rid] = array( '#type' => 'textfield', '#title' => t('Permitted file extensions'), - '#default_value' => variable_get('upload_extensions_'. $rid, $upload_extensions_default), + '#default_value' => variable_get('upload_extensions_' . $rid, $upload_extensions_default), '#maxlength' => 255, '#description' => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.'), ); - $form['settings_role_'. $rid]['upload_uploadsize_'. $rid] = array( + $form['settings_role_' . $rid]['upload_uploadsize_' . $rid] = array( '#type' => 'textfield', '#title' => t('Maximum file size per upload'), - '#default_value' => variable_get('upload_uploadsize_'. $rid, $upload_uploadsize_default), + '#default_value' => variable_get('upload_uploadsize_' . $rid, $upload_uploadsize_default), '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of a file a user can upload. If an image is uploaded and a maximum resolution is set, the size will be checked after the file has been resized.'), '#field_suffix' => t('MB'), ); - $form['settings_role_'. $rid]['upload_usersize_'. $rid] = array( + $form['settings_role_' . $rid]['upload_usersize_' . $rid] = array( '#type' => 'textfield', '#title' => t('Total file size per user'), - '#default_value' => variable_get('upload_usersize_'. $rid, $upload_usersize_default), + '#default_value' => variable_get('upload_usersize_' . $rid, $upload_usersize_default), '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of all files a user can have on the site.'), diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 117333793..d300a13d3 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -13,12 +13,12 @@ function upload_help($path, $arg) { switch ($path) { case 'admin/help#upload': - $output = '

'. t('The upload module allows users to upload files to the site. The ability to upload files is important for members of a community who want to share work. It is also useful to administrators who want to keep uploaded files connected to posts.') .'

'; - $output .= '

'. t('Users with the upload files permission can upload attachments to posts. Uploads may be enabled for specific content types on the content types settings page. Each user role can be customized to limit or control the file size of uploads, or the maximum dimension of image files.') .'

'; - $output .= '

'. t('For more information, see the online handbook entry for Upload module.', array('@upload' => 'http://drupal.org/handbook/modules/upload/')) .'

'; + $output = '

' . t('The upload module allows users to upload files to the site. The ability to upload files is important for members of a community who want to share work. It is also useful to administrators who want to keep uploaded files connected to posts.') . '

'; + $output .= '

' . t('Users with the upload files permission can upload attachments to posts. Uploads may be enabled for specific content types on the content types settings page. Each user role can be customized to limit or control the file size of uploads, or the maximum dimension of image files.') . '

'; + $output .= '

' . t('For more information, see the online handbook entry for Upload module.', array('@upload' => 'http://drupal.org/handbook/modules/upload/')) . '

'; return $output; case 'admin/settings/upload': - return '

'. t('Users with the upload files permission can upload attachments. Users with the view uploaded files permission can view uploaded attachments. You can choose which post types can take attachments on the content types settings page.', array('@permissions' => url('admin/user/permissions'), '@types' => url('admin/settings/types'))) .'

'; + return '

' . t('Users with the upload files permission can upload attachments. Users with the view uploaded files permission can view uploaded attachments. You can choose which post types can take attachments on the content types settings page.', array('@permissions' => url('admin/user/permissions'), '@types' => url('admin/settings/types'))) . '

'; } } @@ -155,8 +155,8 @@ function upload_file_download($file) { $result = db_query("SELECT f.* FROM {files} f INNER JOIN {upload} u ON f.fid = u.fid WHERE filepath = '%s'", $file); if ($file = db_fetch_object($result)) { return array( - 'Content-Type: '. $file->filemime, - 'Content-Length: '. $file->filesize, + 'Content-Type: ' . $file->filemime, + 'Content-Length: ' . $file->filesize, ); } } @@ -213,14 +213,14 @@ function upload_form_alter(&$form, $form_state, $form_id) { $form['workflow']['upload'] = array( '#type' => 'radios', '#title' => t('Attachments'), - '#default_value' => variable_get('upload_'. $form['#node_type']->type, 1), + '#default_value' => variable_get('upload_' . $form['#node_type']->type, 1), '#options' => array(t('Disabled'), t('Enabled')), ); } if (isset($form['type']) && isset($form['#node'])) { $node = $form['#node']; - if ($form['type']['#value'] .'_node_form' == $form_id && variable_get("upload_$node->type", TRUE)) { + if ($form['type']['#value'] . '_node_form' == $form_id && variable_get("upload_$node->type", TRUE)) { // Attachments fieldset $form['attachments'] = array( '#type' => 'fieldset', @@ -248,10 +248,10 @@ function upload_form_alter(&$form, $form_state, $form_id) { if (!file_check_directory($path, FILE_CREATE_DIRECTORY) || !file_check_directory($temp, FILE_CREATE_DIRECTORY)) { $form['attachments']['#description'] = t('File attachments are disabled. The file directories have not been properly configured.'); if (user_access('administer site configuration')) { - $form['attachments']['#description'] .= ' '. t('Please visit the file system configuration page.', array('@admin-file-system' => url('admin/settings/file-system'))); + $form['attachments']['#description'] .= ' ' . t('Please visit the file system configuration page.', array('@admin-file-system' => url('admin/settings/file-system'))); } else { - $form['attachments']['#description'] .= ' '. t('Please contact the site administrator.'); + $form['attachments']['#description'] .= ' ' . t('Please contact the site administrator.'); } } else { @@ -483,7 +483,7 @@ function _upload_form($node) { foreach ($node->files as $key => $file) { $file = (object)$file; $description = file_create_url($file->filepath); - $description = "". check_plain($description) .""; + $description = "" . check_plain($description) . ""; $form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => !empty($file->description) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description ); $form['files'][$key]['size'] = array('#value' => format_size($file->filesize)); $form['files'][$key]['remove'] = array('#type' => 'checkbox', '#default_value' => !empty($file->remove)); @@ -580,7 +580,7 @@ function upload_load($node) { */ function upload_js() { // Load the form from the Form API cache. - $cache = cache_get('form_'. $_POST['form_build_id'], 'cache_form'); + $cache = cache_get('form_' . $_POST['form_build_id'], 'cache_form'); // We only do the upload.module part of the node validation process. $node = (object)$_POST; @@ -616,7 +616,7 @@ function upload_js() { // Add the new element to the stored form state and resave. $cache->data['attachments']['wrapper'] = array_merge($cache->data['attachments']['wrapper'], $form); - cache_set('form_'. $_POST['form_build_id'], $cache->data, 'cache_form', $cache->expire); + cache_set('form_' . $_POST['form_build_id'], $cache->data, 'cache_form', $cache->expire); // Render the form for output. $form += array( -- cgit v1.2.3