summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-11-28 02:28:48 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-11-28 02:28:48 +0000
commit85a1cea720b80547d430430bd27b437ba6b27d25 (patch)
treef3cb2cfc92e19cbf75492b05dce43c0bb50e1338
parent437a49829500ce1847159035099d91be3e775244 (diff)
downloadbrdo-85a1cea720b80547d430430bd27b437ba6b27d25.tar.gz
brdo-85a1cea720b80547d430430bd27b437ba6b27d25.tar.bz2
#98391 by RobRoy. Don't show the file upload field if the files directory won't work.
-rw-r--r--modules/upload/upload.module18
1 files changed, 16 insertions, 2 deletions
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index a45a0fcf3..3bf59f139 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -377,8 +377,22 @@ function upload_form_alter($form_id, &$form) {
'#prefix' => '<div id="attach-wrapper">',
'#suffix' => '</div>',
);
- $form['attachments']['wrapper'] += _upload_form($node);
- $form['#attributes']['enctype'] = 'multipart/form-data';
+
+ // Make sure necessary directories for upload.module exist and are
+ // writable before displaying the attachment form.
+ if (!file_check_directory(file_directory_path(), FILE_CREATE_DIRECTORY) || !file_check_directory(file_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 <a href="@admin-file-system">file system configuration page</a>.', array('@admin-file-system' => url('admin/settings/file-system')));
+ }
+ else {
+ $form['attachments']['#description'] .= ' '. t('Please contact the site administrator.');
+ }
+ }
+ else {
+ $form['attachments']['wrapper'] += _upload_form($node);
+ $form['#attributes']['enctype'] = 'multipart/form-data';
+ }
}
}
}