summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2004-08-24 19:21:30 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2004-08-24 19:21:30 +0000
commit44f341bebc125b7b1b53177e7f858e4ccf55e3df (patch)
tree391c80ae444ed4a9d062fefe7e3c8beb63e98af6 /modules
parentcdff29b0ab45123edab24a51f2258171aa9ae348 (diff)
downloadbrdo-44f341bebc125b7b1b53177e7f858e4ccf55e3df.tar.gz
brdo-44f341bebc125b7b1b53177e7f858e4ccf55e3df.tar.bz2
Patch by me and Kjartan.
Upload.module - Fixing a bug caused by the PHP5 patches. Beware: PHP4's array_merge() will silently accept objects and convert them to arrays. We should not depend on this behaviour in the future. File.inc / file-using modules: - Removing the constant FILE_SEPARATOR: forward slashes work fine on Windows, and it was being used incorrectly as an URL separator sometimes. - Adding @ to mkdir and chmod to supress ugly PHP errors. They are already reported with drupal_set_message(). - Fixing default for variable 'file_directory_temp'. - Clarifying the help tip for 'file_directory_temp' in admin > settings.
Diffstat (limited to 'modules')
-rw-r--r--modules/blogapi.module2
-rw-r--r--modules/blogapi/blogapi.module2
-rw-r--r--modules/system.module4
-rw-r--r--modules/system/system.module4
-rw-r--r--modules/upload.module3
-rw-r--r--modules/upload/upload.module3
-rw-r--r--modules/user.module6
-rw-r--r--modules/user/user.module6
8 files changed, 14 insertions, 16 deletions
diff --git a/modules/blogapi.module b/modules/blogapi.module
index ef902edb8..0e472aa46 100644
--- a/modules/blogapi.module
+++ b/modules/blogapi.module
@@ -539,7 +539,7 @@ function blogapi_blogapi() {
function blogapi_rsd() {
global $base_url;
- $xmlrpc = $base_url . FILE_SEPARATOR . 'xmlrpc.php';
+ $xmlrpc = $base_url .'/'. 'xmlrpc.php';
$base = url('', NULL, NULL, TRUE);
$blogid = 1; # until we figure out how to handle multiple bloggers
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index ef902edb8..0e472aa46 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -539,7 +539,7 @@ function blogapi_blogapi() {
function blogapi_rsd() {
global $base_url;
- $xmlrpc = $base_url . FILE_SEPARATOR . 'xmlrpc.php';
+ $xmlrpc = $base_url .'/'. 'xmlrpc.php';
$base = url('', NULL, NULL, TRUE);
$blogid = 1; # until we figure out how to handle multiple bloggers
diff --git a/modules/system.module b/modules/system.module
index a2ec2f332..f985e88af 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -202,11 +202,11 @@ function system_view_general() {
$directory_path = variable_get('file_directory_path', 'files');
file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
- $directory_temp = variable_get('file_directory_temp', 'temp');
+ $directory_temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP);
file_check_directory(file_create_path($directory_temp), FILE_CREATE_DIRECTORY, 'file_directory_temp');
$group = form_textfield(t('File system path'), 'file_directory_path', $directory_path, 70, 255, t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'));
- $group .= form_textfield(t('Temporary directory'), 'file_directory_temp', $directory_temp, 70, 255, t('Location where uploaded files will be placed for preview purposes. This directory should be relative to the file system path.'));
+ $group .= form_textfield(t('Temporary directory'), 'file_directory_temp', $directory_temp, 70, 255, t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.'));
$group .= form_radios(t('Download method'), 'file_downloads', variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are be transferred by Drupal.')), t('This setting can be changed at any time, however, all download URLs will change and there may be unexpected problems so it is not recommended.'));
$output .= form_group(t('File system settings'), $group);
diff --git a/modules/system/system.module b/modules/system/system.module
index a2ec2f332..f985e88af 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -202,11 +202,11 @@ function system_view_general() {
$directory_path = variable_get('file_directory_path', 'files');
file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
- $directory_temp = variable_get('file_directory_temp', 'temp');
+ $directory_temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP);
file_check_directory(file_create_path($directory_temp), FILE_CREATE_DIRECTORY, 'file_directory_temp');
$group = form_textfield(t('File system path'), 'file_directory_path', $directory_path, 70, 255, t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'));
- $group .= form_textfield(t('Temporary directory'), 'file_directory_temp', $directory_temp, 70, 255, t('Location where uploaded files will be placed for preview purposes. This directory should be relative to the file system path.'));
+ $group .= form_textfield(t('Temporary directory'), 'file_directory_temp', $directory_temp, 70, 255, t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.'));
$group .= form_radios(t('Download method'), 'file_downloads', variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are be transferred by Drupal.')), t('This setting can be changed at any time, however, all download URLs will change and there may be unexpected problems so it is not recommended.'));
$output .= form_group(t('File system settings'), $group);
diff --git a/modules/upload.module b/modules/upload.module
index 58e9f2d56..a1ac58ef9 100644
--- a/modules/upload.module
+++ b/modules/upload.module
@@ -177,7 +177,7 @@ function upload_nodeapi(&$node, $op, $arg) {
break;
case 'load':
if (variable_get("upload_$node->type", 1) == 1 && user_access('upload files')) {
- $output->files = upload_load($node);
+ $output['files'] = upload_load($node);
}
break;
case 'view':
@@ -209,7 +209,6 @@ 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");
$node->body = str_replace($old, $new, $node->body);
$node->teaser = str_replace($old, $new, $node->teaser);
}
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index 58e9f2d56..a1ac58ef9 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -177,7 +177,7 @@ function upload_nodeapi(&$node, $op, $arg) {
break;
case 'load':
if (variable_get("upload_$node->type", 1) == 1 && user_access('upload files')) {
- $output->files = upload_load($node);
+ $output['files'] = upload_load($node);
}
break;
case 'view':
@@ -209,7 +209,6 @@ 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");
$node->body = str_replace($old, $new, $node->body);
$node->teaser = str_replace($old, $new, $node->teaser);
}
diff --git a/modules/user.module b/modules/user.module
index bb77c128f..11ac79d00 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -205,7 +205,7 @@ function user_validate_picture($file, &$edit, $user) {
else if ($size[0] > $maxwidth || $size[1] > $maxheight) {
form_set_error('picture', t('The uploaded image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'))));
}
- else if ($file = file_save_upload('picture', variable_get('user_picture_path', 'pictures') . FILE_SEPARATOR .'picture-'. $user->uid . $extension, 1)) {
+ else if ($file = file_save_upload('picture', variable_get('user_picture_path', 'pictures') .'/picture-'. $user->uid . $extension, 1)) {
$edit['picture'] = $file->filepath;
}
else {
@@ -361,7 +361,7 @@ function user_perm() {
* Ensure that user pictures (avatars) are always downloadable.
*/
function user_file_download($file) {
- if (strpos($file, variable_get('user_picture_path', 'pictures') . FILE_SEPARATOR . 'picture-') === 0) {
+ if (strpos($file, variable_get('user_picture_path', 'pictures') .'/picture-') === 0) {
list($width, $height, $type, $attr) = @getimagesize(file_create_path($file));
$types = array(
IMAGETYPE_GIF => 'image/gif',
@@ -1245,7 +1245,7 @@ function user_configure_settings() {
file_check_directory(file_create_path(variable_get('user_picture_path', 'pictures')), 1, 'user_picture_path');
$group = form_radios(t('Picture support'), 'user_pictures', variable_get('user_pictures', 0), array(t('Disabled'), t('Enabled')), t('Enable picture support.'));
- $group .= form_textfield(t('Picture image path'), 'user_picture_path', variable_get('user_picture_path', 'pictures'), 45, 255, t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') . FILE_SEPARATOR)));
+ $group .= form_textfield(t('Picture image path'), 'user_picture_path', variable_get('user_picture_path', 'pictures'), 45, 255, t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/')));
$group .= form_textfield(t('Default picture'), 'user_picture_default', variable_get('user_picture_default', ''), 45, 255, t('URL of picture to display for users with no custom picture selected. Leave blank for none.'));
$group .= form_textfield(t('Picture maximum dimensions'), 'user_picture_dimensions', variable_get('user_picture_dimensions', '85x85'), 10, 10, t('Maximum dimensions for pictures.'));
$group .= form_textfield(t('Picture maximum file size'), 'user_picture_file_size', variable_get('user_picture_file_size', '30'), 10, 10, t('Maximum file size for pictures, in kB.'));
diff --git a/modules/user/user.module b/modules/user/user.module
index bb77c128f..11ac79d00 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -205,7 +205,7 @@ function user_validate_picture($file, &$edit, $user) {
else if ($size[0] > $maxwidth || $size[1] > $maxheight) {
form_set_error('picture', t('The uploaded image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'))));
}
- else if ($file = file_save_upload('picture', variable_get('user_picture_path', 'pictures') . FILE_SEPARATOR .'picture-'. $user->uid . $extension, 1)) {
+ else if ($file = file_save_upload('picture', variable_get('user_picture_path', 'pictures') .'/picture-'. $user->uid . $extension, 1)) {
$edit['picture'] = $file->filepath;
}
else {
@@ -361,7 +361,7 @@ function user_perm() {
* Ensure that user pictures (avatars) are always downloadable.
*/
function user_file_download($file) {
- if (strpos($file, variable_get('user_picture_path', 'pictures') . FILE_SEPARATOR . 'picture-') === 0) {
+ if (strpos($file, variable_get('user_picture_path', 'pictures') .'/picture-') === 0) {
list($width, $height, $type, $attr) = @getimagesize(file_create_path($file));
$types = array(
IMAGETYPE_GIF => 'image/gif',
@@ -1245,7 +1245,7 @@ function user_configure_settings() {
file_check_directory(file_create_path(variable_get('user_picture_path', 'pictures')), 1, 'user_picture_path');
$group = form_radios(t('Picture support'), 'user_pictures', variable_get('user_pictures', 0), array(t('Disabled'), t('Enabled')), t('Enable picture support.'));
- $group .= form_textfield(t('Picture image path'), 'user_picture_path', variable_get('user_picture_path', 'pictures'), 45, 255, t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') . FILE_SEPARATOR)));
+ $group .= form_textfield(t('Picture image path'), 'user_picture_path', variable_get('user_picture_path', 'pictures'), 45, 255, t('Subdirectory in the directory "%dir" where pictures will be stored.', array('%dir' => variable_get('file_directory_path', 'files') .'/')));
$group .= form_textfield(t('Default picture'), 'user_picture_default', variable_get('user_picture_default', ''), 45, 255, t('URL of picture to display for users with no custom picture selected. Leave blank for none.'));
$group .= form_textfield(t('Picture maximum dimensions'), 'user_picture_dimensions', variable_get('user_picture_dimensions', '85x85'), 10, 10, t('Maximum dimensions for pictures.'));
$group .= form_textfield(t('Picture maximum file size'), 'user_picture_file_size', variable_get('user_picture_file_size', '30'), 10, 10, t('Maximum file size for pictures, in kB.'));