summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/image/image.field.inc4
-rw-r--r--modules/image/image.install40
-rw-r--r--modules/image/image.test10
-rw-r--r--modules/system/system.mail.inc65
4 files changed, 89 insertions, 30 deletions
diff --git a/modules/image/image.field.inc b/modules/image/image.field.inc
index 857e72ba8..3692ee2e8 100644
--- a/modules/image/image.field.inc
+++ b/modules/image/image.field.inc
@@ -404,7 +404,7 @@ function image_field_widget_process($element, &$form_state, $form) {
'#default_value' => isset($item['alt']) ? $item['alt'] : '',
'#description' => t('This text will be used by screen readers, search engines, or when the image cannot be loaded.'),
// @see http://www.gawds.org/show.php?contentid=28
- '#maxlength' => 128,
+ '#maxlength' => 512,
'#weight' => -2,
'#access' => (bool) $item['fid'] && $settings['alt_field'],
);
@@ -413,7 +413,7 @@ function image_field_widget_process($element, &$form_state, $form) {
'#title' => t('Title'),
'#default_value' => isset($item['title']) ? $item['title'] : '',
'#description' => t('The title is used as a tool tip when the user hovers the mouse over the image.'),
- '#maxlength' => 128,
+ '#maxlength' => 1024,
'#weight' => -1,
'#access' => (bool) $item['fid'] && $settings['title_field'],
);
diff --git a/modules/image/image.install b/modules/image/image.install
index 4edc32003..516555829 100644
--- a/modules/image/image.install
+++ b/modules/image/image.install
@@ -121,13 +121,13 @@ function image_field_schema($field) {
'alt' => array(
'description' => "Alternative image text, for the image's 'alt' attribute.",
'type' => 'varchar',
- 'length' => 128,
+ 'length' => 512,
'not null' => FALSE,
),
'title' => array(
'description' => "Image title text, for the image's 'title' attribute.",
'type' => 'varchar',
- 'length' => 128,
+ 'length' => 1024,
'not null' => FALSE,
),
'width' => array(
@@ -395,6 +395,42 @@ function image_update_7003() {
}
/**
+ * Use a large setting (512 and 1024 characters) for the length of the image alt
+ * and title fields.
+ */
+function image_update_7004() {
+ $alt_spec = array(
+ 'type' => 'varchar',
+ 'length' => 512,
+ 'not null' => FALSE,
+ );
+
+ $title_spec = array(
+ 'type' => 'varchar',
+ 'length' => 1024,
+ 'not null' => FALSE,
+ );
+
+ $fields = _update_7000_field_read_fields(array(
+ 'module' => 'image',
+ 'storage_type' => 'field_sql_storage',
+ ));
+
+ foreach ($fields as $field_name => $field) {
+ $tables = array(
+ _field_sql_storage_tablename($field),
+ _field_sql_storage_revision_tablename($field),
+ );
+ $alt_column = $field['field_name'] . '_alt';
+ $title_column = $field['field_name'] . '_title';
+ foreach ($tables as $table) {
+ db_change_field($table, $alt_column, $alt_column, $alt_spec);
+ db_change_field($table, $title_column, $title_column, $title_spec);
+ }
+ }
+}
+
+/**
* Implements hook_requirements() to check the PHP GD Library.
*
* @param $phase
diff --git a/modules/image/image.test b/modules/image/image.test
index 9cc06b935..d0946558b 100644
--- a/modules/image/image.test
+++ b/modules/image/image.test
@@ -746,7 +746,10 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
$widget_settings = array(
'preview_image_style' => 'medium',
);
- $this->createImageField($field_name, 'article', array(), $instance_settings, $widget_settings);
+ $field = $this->createImageField($field_name, 'article', array(), $instance_settings, $widget_settings);
+ $field['deleted'] = 0;
+ $table = _field_sql_storage_tablename($field);
+ $schema = drupal_get_schema($table, TRUE);
$instance = field_info_instance('node', $field_name, 'article');
$this->drupalGet('node/add/article');
@@ -789,18 +792,17 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
// Verify that alt/title longer than allowed results in a validation error.
$test_size = 2000;
- $max_size = 128;
$edit = array(
$field_name . '[' . LANGUAGE_NONE . '][0][alt]' => $this->randomName($test_size),
$field_name . '[' . LANGUAGE_NONE . '][0][title]' => $this->randomName($test_size),
);
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
$this->assertRaw(t('Alternate text cannot be longer than %max characters but is currently %length characters long.', array(
- '%max' => $max_size,
+ '%max' => $schema['fields'][$field_name .'_alt']['length'],
'%length' => $test_size,
)));
$this->assertRaw(t('Title cannot be longer than %max characters but is currently %length characters long.', array(
- '%max' => $max_size,
+ '%max' => $schema['fields'][$field_name .'_title']['length'],
'%length' => $test_size,
)));
}
diff --git a/modules/system/system.mail.inc b/modules/system/system.mail.inc
index ef50642c5..4e7544006 100644
--- a/modules/system/system.mail.inc
+++ b/modules/system/system.mail.inc
@@ -65,28 +65,49 @@ class DefaultMailSystem implements MailSystemInterface {
// For headers, PHP's API suggests that we use CRLF normally,
// but some MTAs incorrectly replace LF with CRLF. See #234403.
$mail_headers = join("\n", $mimeheaders);
- if (isset($message['Return-Path']) && !ini_get('safe_mode')) {
- $mail_result = mail(
- $message['to'],
- $mail_subject,
- $mail_body,
- $mail_headers,
- // Pass the Return-Path via sendmail's -f command.
- '-f ' . $message['Return-Path']
- );
- }
- else {
- // The optional $additional_parameters argument to mail() is not allowed
- // if safe_mode is enabled. Passing any value throws a PHP warning and
- // makes mail() return FALSE.
- $mail_result = mail(
- $message['to'],
- $mail_subject,
- $mail_body,
- $mail_headers
- );
- }
- return $mail_result;
+
+ // We suppress warnings and notices from mail() because of issues on some
+ // hosts. The return value of this method will still indicate whether mail
+ // was sent successfully.
+ if (!isset($_SERVER['WINDIR']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Win32') === FALSE) {
+ if (isset($message['Return-Path']) && !ini_get('safe_mode')) {
+ // On most non-Windows systems, the "-f" option to the sendmail command
+ // is used to set the Return-Path. There is no space between -f and
+ // the value of the return path.
+ $mail_result = @mail(
+ $message['to'],
+ $mail_subject,
+ $mail_body,
+ $mail_headers,
+ '-f' . $message['Return-Path']
+ );
+ }
+ else {
+ // The optional $additional_parameters argument to mail() is not
+ // allowed if safe_mode is enabled. Passing any value throws a PHP
+ // warning and makes mail() return FALSE.
+ $mail_result = @mail(
+ $message['to'],
+ $mail_subject,
+ $mail_body,
+ $mail_headers
+ );
+ }
+ }
+ else {
+ // On Windows, PHP will use the value of sendmail_from for the
+ // Return-Path header.
+ $old_from = ini_get('sendmail_from');
+ ini_set('sendmail_from', $message['Return-Path']);
+ $mail_result = @mail(
+ $message['to'],
+ $mail_subject,
+ $mail_body,
+ $mail_headers
+ );
+ ini_set('sendmail_from', $old_from);
+ }
+ return $mail_result;
}
}