diff --git a/modules/upload.module b/modules/upload.module
index 4c862f84e34..f3039996f7a 100644
--- a/modules/upload.module
+++ b/modules/upload.module
@@ -43,17 +43,17 @@ function upload_menu() {
function upload_admin() {
system_settings_save();
- $group .= form_textfield(t("Maximum total file size"), "upload_maxsize_total", variable_get("upload_maxsize_total", 0), 5, 5, t("The maximum size of a file a user can upload in megabytes. Enter 0 for unlimited."));
+ $group .= form_textfield(t('Maximum total file size'), 'upload_maxsize_total', variable_get('upload_maxsize_total', 0), 5, 5, t('The maximum size of a file a user can upload in megabytes. Enter 0 for unlimited.'));
$output = form_group(t('General settings'), $group);
$roles = user_roles(0, 'upload files');
foreach ($roles as $rid => $role) {
- $group = form_textfield(t("Permitted file extensions"), "upload_extensions_$rid", variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"), 60, 255, t("Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot."));
- $group .= form_textfield(t("Maximum file size per upload"), "upload_uploadsize_$rid", variable_get("upload_uploadsize_$rid", 1), 5, 5, t("The maximum size of a file a user can upload (in megabytes)."));
- $group .= form_textfield(t("Total file size per user"), "upload_usersize_$rid", variable_get("upload_usersize_$rid", 10), 5, 5, t("The maximum size of all files a user can have on the site (in megabytes)."));
- $output .= form_group(t("Settings for '%role'", array('%role' => $role)), $group);
+ $group = form_textfield(t('Permitted file extensions'), "upload_extensions_$rid", variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"), 60, 255, t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.'));
+ $group .= form_textfield(t('Maximum file size per upload'), "upload_uploadsize_$rid", variable_get("upload_uploadsize_$rid", 1), 5, 5, t('The maximum size of a file a user can upload (in megabytes).'));
+ $group .= form_textfield(t('Total file size per user'), "upload_usersize_$rid", variable_get("upload_usersize_$rid", 10), 5, 5, t('The maximum size of all files a user can have on the site (in megabytes).'));
+ $output .= form_group(t('Settings for %role', array('%role' => "$role")), $group);
}
print theme('page', system_settings_form($output));
@@ -121,14 +121,14 @@ function upload_nodeapi(&$node, $op, $arg) {
if ($maxsize && $total_size > $maxsize) {
- drupal_set_message(t("Error attaching file '%name': total file size exceeded", array('%name' => $file->filename)), 'error');
+ form_set_error('upload', t('Error attaching file %name: total file size exceeded', array('%name' => "$file->filename")));
break;
}
// Validate file against all users roles. Only denies an upload when
// all roles prevent it.
foreach ($user->roles as $rid => $name) {
- $extensions = variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps");
+ $extensions = variable_get("upload_extensions_$rid", 'jpg jpeg gif png txt html doc xls pdf ppt pps');
$uploadsize = variable_get("upload_uploadsize_$rid", 1);
$usersize = variable_get("upload_usersize_$rid", 1);
@@ -148,13 +148,13 @@ function upload_nodeapi(&$node, $op, $arg) {
}
if ($error['extension'] == count($user->roles)) {
- drupal_set_message(t("error attaching file '%name': invalid extension", array('%name' => $file->filename)), 'error');
+ form_set_error('upload', t('Error attaching file %name: invalid extension', array('%name' => "$file->filename")));
}
elseif ($error['uploadsize'] == count($user->roles)) {
- drupal_set_message(t("error attaching file '%name': exceeds maximum file size", array('%name' => $file->filename)), 'error');
+ form_set_error('upload', t('Error attaching file %name: exceeds maximum file size', array('%name' => "$file->filename")));
}
elseif ($error['usersize'] == count($user->roles)) {
- drupal_set_message(t("error attaching file '%name': exceeds maximum file size", array('%name' => $file->filename)), 'error');
+ form_set_error('upload', t('Error attaching file %name: exceeds maximum file size', array('%name' => "$file->filename")));
}
else {
$key = 'upload_'. count($_SESSION['file_uploads']);
@@ -177,7 +177,7 @@ function upload_nodeapi(&$node, $op, $arg) {
break;
case 'view':
if ($node->files) {
- $header = array(t('Attachment'), t('Size'));
+ $header = array(t('attachment'), t('size'));
$rows = array();
$previews = array();
@@ -204,7 +204,7 @@ function upload_nodeapi(&$node, $op, $arg) {
foreach ($previews as $file) {
$old = file_create_filename($file->filename, file_create_path());
$new = url($old);
- drupal_set_message("debug: $old $new");
+ //drupal_set_message("debug: $old $new");
$node->body = str_replace($old, $new, $node->body);
$node->teaser = str_replace($old, $new, $node->teaser);
}
@@ -312,15 +312,4 @@ function upload_load($node) {
return $files;
}
-function theme_upload_attached($file, $temp = 0) {
- if ($temp) {
- $file = variable_get('file_directory_path', 'files') . FILE_SEPARATOR . $file->filename .' ('. format_size($file->filesize) .')
';
- }
- else {
- $file = file_create_path($file->filepath) .' ('. format_size($file->filesize) .")
";
- }
-
- return $file;
-}
-
?>
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index 4c862f84e34..f3039996f7a 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -43,17 +43,17 @@ function upload_menu() {
function upload_admin() {
system_settings_save();
- $group .= form_textfield(t("Maximum total file size"), "upload_maxsize_total", variable_get("upload_maxsize_total", 0), 5, 5, t("The maximum size of a file a user can upload in megabytes. Enter 0 for unlimited."));
+ $group .= form_textfield(t('Maximum total file size'), 'upload_maxsize_total', variable_get('upload_maxsize_total', 0), 5, 5, t('The maximum size of a file a user can upload in megabytes. Enter 0 for unlimited.'));
$output = form_group(t('General settings'), $group);
$roles = user_roles(0, 'upload files');
foreach ($roles as $rid => $role) {
- $group = form_textfield(t("Permitted file extensions"), "upload_extensions_$rid", variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"), 60, 255, t("Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot."));
- $group .= form_textfield(t("Maximum file size per upload"), "upload_uploadsize_$rid", variable_get("upload_uploadsize_$rid", 1), 5, 5, t("The maximum size of a file a user can upload (in megabytes)."));
- $group .= form_textfield(t("Total file size per user"), "upload_usersize_$rid", variable_get("upload_usersize_$rid", 10), 5, 5, t("The maximum size of all files a user can have on the site (in megabytes)."));
- $output .= form_group(t("Settings for '%role'", array('%role' => $role)), $group);
+ $group = form_textfield(t('Permitted file extensions'), "upload_extensions_$rid", variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"), 60, 255, t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.'));
+ $group .= form_textfield(t('Maximum file size per upload'), "upload_uploadsize_$rid", variable_get("upload_uploadsize_$rid", 1), 5, 5, t('The maximum size of a file a user can upload (in megabytes).'));
+ $group .= form_textfield(t('Total file size per user'), "upload_usersize_$rid", variable_get("upload_usersize_$rid", 10), 5, 5, t('The maximum size of all files a user can have on the site (in megabytes).'));
+ $output .= form_group(t('Settings for %role', array('%role' => "$role")), $group);
}
print theme('page', system_settings_form($output));
@@ -121,14 +121,14 @@ function upload_nodeapi(&$node, $op, $arg) {
if ($maxsize && $total_size > $maxsize) {
- drupal_set_message(t("Error attaching file '%name': total file size exceeded", array('%name' => $file->filename)), 'error');
+ form_set_error('upload', t('Error attaching file %name: total file size exceeded', array('%name' => "$file->filename")));
break;
}
// Validate file against all users roles. Only denies an upload when
// all roles prevent it.
foreach ($user->roles as $rid => $name) {
- $extensions = variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps");
+ $extensions = variable_get("upload_extensions_$rid", 'jpg jpeg gif png txt html doc xls pdf ppt pps');
$uploadsize = variable_get("upload_uploadsize_$rid", 1);
$usersize = variable_get("upload_usersize_$rid", 1);
@@ -148,13 +148,13 @@ function upload_nodeapi(&$node, $op, $arg) {
}
if ($error['extension'] == count($user->roles)) {
- drupal_set_message(t("error attaching file '%name': invalid extension", array('%name' => $file->filename)), 'error');
+ form_set_error('upload', t('Error attaching file %name: invalid extension', array('%name' => "$file->filename")));
}
elseif ($error['uploadsize'] == count($user->roles)) {
- drupal_set_message(t("error attaching file '%name': exceeds maximum file size", array('%name' => $file->filename)), 'error');
+ form_set_error('upload', t('Error attaching file %name: exceeds maximum file size', array('%name' => "$file->filename")));
}
elseif ($error['usersize'] == count($user->roles)) {
- drupal_set_message(t("error attaching file '%name': exceeds maximum file size", array('%name' => $file->filename)), 'error');
+ form_set_error('upload', t('Error attaching file %name: exceeds maximum file size', array('%name' => "$file->filename")));
}
else {
$key = 'upload_'. count($_SESSION['file_uploads']);
@@ -177,7 +177,7 @@ function upload_nodeapi(&$node, $op, $arg) {
break;
case 'view':
if ($node->files) {
- $header = array(t('Attachment'), t('Size'));
+ $header = array(t('attachment'), t('size'));
$rows = array();
$previews = array();
@@ -204,7 +204,7 @@ function upload_nodeapi(&$node, $op, $arg) {
foreach ($previews as $file) {
$old = file_create_filename($file->filename, file_create_path());
$new = url($old);
- drupal_set_message("debug: $old $new");
+ //drupal_set_message("debug: $old $new");
$node->body = str_replace($old, $new, $node->body);
$node->teaser = str_replace($old, $new, $node->teaser);
}
@@ -312,15 +312,4 @@ function upload_load($node) {
return $files;
}
-function theme_upload_attached($file, $temp = 0) {
- if ($temp) {
- $file = variable_get('file_directory_path', 'files') . FILE_SEPARATOR . $file->filename .' ('. format_size($file->filesize) .')
';
- }
- else {
- $file = file_create_path($file->filepath) .' ('. format_size($file->filesize) .")
";
- }
-
- return $file;
-}
-
?>