From 5d86a5d0ddf95942c1eb4ff21e9fae6ba2df409e Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 01:16:41 -0700 Subject: [PATCH 01/24] Issue #1158596 by mr.baileys: Fixed clarification of node in hook_node_submit() doc. --- modules/node/node.api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/node/node.api.php b/modules/node/node.api.php index 3e8029cfc76..d7a98c6fb0c 100644 --- a/modules/node/node.api.php +++ b/modules/node/node.api.php @@ -758,7 +758,7 @@ function hook_node_validate($node, $form, &$form_state) { * properties. * * @param $node - * The node being updated in response to a form submission. + * The node object being updated in response to a form submission. * @param $form * The form being used to edit the node. * @param $form_state From 9da1531a7870b06613c004342f7564118437c4e1 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 01:19:02 -0700 Subject: [PATCH 02/24] Issue #1164862 by barbi: Fixed DatabaseTaskException has @class near top and shouldn't. --- includes/install.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/install.inc b/includes/install.inc index 6a37738e010..3634660e01c 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -570,7 +570,7 @@ abstract class DatabaseTasks { } /** - * @class Exception class used to throw error if the DatabaseInstaller fails. + * Exception thrown if the database installer fails. */ class DatabaseTaskException extends Exception { } From a7309fae9405cb020221a46dd0ef40df735f188a Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 01:22:34 -0700 Subject: [PATCH 03/24] Issue #1021064 by montesq: Fixed No Main Links causes error message in form description to set Secondary Links. --- modules/menu/menu.admin.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index de74d8cf7a9..ec073e5b803 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -678,7 +678,7 @@ function menu_configure() { '#empty_option' => t('No Secondary links'), '#options' => $menu_options, '#tree' => FALSE, - '#description' => t('Select the source for the Secondary links. An advanced option allows you to use the same source for both Main links (currently %main) and Secondary links: if your source menu has two levels of hierarchy, the top level menu links will appear in the Main links, and the children of the active link will appear in the Secondary links.', array('%main' => $menu_options[$main])), + '#description' => t('Select the source for the Secondary links. An advanced option allows you to use the same source for both Main links (currently %main) and Secondary links: if your source menu has two levels of hierarchy, the top level menu links will appear in the Main links, and the children of the active link will appear in the Secondary links.', array('%main' => $main ? $menu_options[$main] : 'none')), ); return system_settings_form($form); From af7b44189b31e492f14ded03d032fd5f93871d8e Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 01:24:48 -0700 Subject: [PATCH 04/24] Issue #1144848 by mr.baileys: Fixed node_type_form_submit() should not say it is implementation of hook_form_submit(). --- modules/node/content_types.inc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index 15f4fb14d3b..cadabca6b18 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -75,7 +75,15 @@ function theme_node_admin_overview($variables) { } /** - * Generates the node type editing form. + * Form constructor for the node type editing form. + * + * @param $type + * (optional) The machine name of the node type when editing an existing node + * type. + * + * @see node_type_form_validate() + * @see node_type_form_submit() + * @ingroup forms */ function node_type_form($form, &$form_state, $type = NULL) { if (!isset($type->type)) { @@ -241,7 +249,9 @@ function _node_characters($length) { } /** - * Validates the content type submission form generated by node_type_form(). + * Form validation handler for node_type_form(). + * + * @see node_type_form_submit() */ function node_type_form_validate($form, &$form_state) { $type = new stdClass(); @@ -269,7 +279,9 @@ function node_type_form_validate($form, &$form_state) { } /** - * Implements hook_form_submit(). + * Form submission handler for node_type_form(). + * + * @see node_type_form_validate() */ function node_type_form_submit($form, &$form_state) { $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : ''; From 01ac764a2dba5c8386d70c8cf8e257c266e74c49 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 01:27:15 -0700 Subject: [PATCH 05/24] Issue #1137848 by BrockBoland, tim.plunkett, jensimmons: Disallow /filter/tips page from search engines. --- robots.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/robots.txt b/robots.txt index 490fa59f87e..35ea42dbafa 100644 --- a/robots.txt +++ b/robots.txt @@ -40,6 +40,7 @@ Disallow: /xmlrpc.php # Paths (clean URLs) Disallow: /admin/ Disallow: /comment/reply/ +Disallow: /filter/tips/ Disallow: /node/add/ Disallow: /search/ Disallow: /user/register/ @@ -49,6 +50,7 @@ Disallow: /user/logout/ # Paths (no clean URLs) Disallow: /?q=admin/ Disallow: /?q=comment/reply/ +Disallow: /?q=filter/tips/ Disallow: /?q=node/add/ Disallow: /?q=search/ Disallow: /?q=user/password/ From ab9103bca255ccd5263edee3d751b24dd24e86c6 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 01:39:51 -0700 Subject: [PATCH 06/24] Issue #604902 by rschwab, drewish: Add documentation about Batch API success parameter. --- includes/form.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/form.inc b/includes/form.inc index c0e2ec7c155..8f2ee2632ea 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -4074,6 +4074,8 @@ function _form_set_class(&$element, $class = array()) { * Sample 'finished' callback: * @code * function batch_test_finished($success, $results, $operations) { + * // The 'success' parameter means no fatal PHP errors were detected. All + * // other error management should be handled using 'results'. * if ($success) { * $message = format_plural(count($results), 'One post processed.', '@count posts processed.'); * } From 3d299c4618ff771e8fbeda27e0000135faee4337 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 01:44:36 -0700 Subject: [PATCH 07/24] Issue #1161240 by barbi, jhodgdon: Added Need documentation of non-matching return value for taxonomy_term_load_multiple(), entity_load_multiple(), and DrupalEntityControlle. --- includes/common.inc | 3 ++- includes/entity.inc | 3 ++- modules/taxonomy/taxonomy.module | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index fbad97471d9..548018d6ce3 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7437,7 +7437,8 @@ function entity_create_stub_entity($entity_type, $ids) { * Whether to reset the internal cache for the requested entity type. * * @return - * An array of entity objects indexed by their ids. + * An array of entity objects indexed by their ids. When no results are + * found, an empty array is returned. * * @todo Remove $conditions in Drupal 8. */ diff --git a/includes/entity.inc b/includes/entity.inc index a3cdf741736..aaa39d871eb 100644 --- a/includes/entity.inc +++ b/includes/entity.inc @@ -39,7 +39,8 @@ interface DrupalEntityControllerInterface { * An array of conditions in the form 'field' => $value. * * @return - * An array of entity objects indexed by their ids. + * An array of entity objects indexed by their ids. When no results are + * found, an empty array is returned. */ public function load($ids = array(), $conditions = array()); } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 50d2fd60834..c171c06928b 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -1092,7 +1092,8 @@ class TaxonomyVocabularyController extends DrupalDefaultEntityController { * this function. * * @return - * An array of term objects, indexed by tid. + * An array of term objects, indexed by tid. When no results are found, an + * empty array is returned. * * @todo Remove $conditions in Drupal 8. */ From 8a9f7b6d4a75e52327180ab3b10d2fd73471469b Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 01:47:29 -0700 Subject: [PATCH 08/24] Issue #1079214 follow-up by pillarsdotnet: Adjustment to drupal_goto() doc example. --- includes/common.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 548018d6ce3..4ec37dc4441 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -632,8 +632,8 @@ function drupal_encode_path($path) { * user/login and override the default redirection so that the user is * redirected to a specific path after logging in: * @code - * $destination = array('destination' => "node/$node->nid"); - * l(t('Log in'), array('@login' => url('user/login', array('query' => array($destination))))); + * $query = array('destination' => "node/$node->nid"); + * $link = l(t('Log in'), 'user/login', array('query' => $query)); * @endcode * * Drupal will ensure that messages set by drupal_set_message() and other From a1fa6105b08672935ef5d6576e1baec5bd42a532 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 15:06:26 -0700 Subject: [PATCH 09/24] =?UTF-8?q?Issue=20#276174=20follow-up=20by=20G?= =?UTF-8?q?=C3=A1bor=20Hojtsy,=20TR:=20Fixed=20Document=20check=5Fplain()?= =?UTF-8?q?=20use=20in=20blog.module.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/blog/blog.module | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 98ebe5159a7..731bd2f64a5 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -26,6 +26,7 @@ function blog_user_view($account) { $account->content['summary']['blog'] = array( '#type' => 'user_profile_item', '#title' => t('Blog'), + // l() escapes the attributes, so we should not escape !username here. '#markup' => l(t('View recent blog entries'), "blog/$account->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => format_username($account)))))), '#attributes' => array('class' => array('blog')), ); @@ -67,7 +68,7 @@ function blog_form($node, $form_state) { */ function blog_view($node, $view_mode) { if ($view_mode == 'full' && node_is_page($node)) { - // Breadcrumb navigation. + // Breadcrumb navigation. l() escapes title, so we should not escape !name. drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("!name's blog", array('!name' => format_username($node))), 'blog/' . $node->uid))); } return $node; @@ -79,6 +80,7 @@ function blog_view($node, $view_mode) { function blog_node_view($node, $view_mode) { if ($view_mode != 'rss') { if ($node->type == 'blog' && (arg(0) != 'blog' || arg(1) != $node->uid)) { + // This goes to l(), which escapes !username in both title and attributes. $links['blog_usernames_blog'] = array( 'title' => t("!username's blog", array('!username' => format_username($node))), 'href' => "blog/$node->uid", From 858ba6eb570179eead6e2ab4af64ff4caf6541fb Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 1 Jun 2011 22:49:35 -0700 Subject: [PATCH 10/24] Roll-back of Issue #534594 by beejeebus, catch: This causes fatal errors from class loaders in certain modules (CTools, etc.) --- update.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/update.php b/update.php index 2e371710b10..a777920fa07 100644 --- a/update.php +++ b/update.php @@ -376,10 +376,6 @@ if (empty($op) && update_access_allowed()) { // Set up theme system for the maintenance page. drupal_maintenance_theme(); - // Rebuild the registry to ensure that removed hooks in modules do not result - // in undefined function errors and that newly defined hooks are called. - registry_rebuild(); - // Check the update requirements for Drupal. update_check_requirements(); From 4b5dfbc3bfd3724bf665b2325b4354f65d94af73 Mon Sep 17 00:00:00 2001 From: webchick Date: Sat, 4 Jun 2011 11:03:58 -0700 Subject: [PATCH 11/24] Issue #1007830 follow-up by bfroehle: Add more specificity to MySQL nested DDL transaction error check. --- includes/database/mysql/database.inc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc index 47ef8d52e5e..bc31feaafea 100644 --- a/includes/database/mysql/database.inc +++ b/includes/database/mysql/database.inc @@ -169,14 +169,17 @@ class DatabaseConnection_mysql extends DatabaseConnection { // savepoints which no longer exist. // // To avoid exceptions when no actual error has occurred, we silently - // succeed for PDOExceptions with error code 42000 ("Syntax error or - // access rule violation"). - if ($e->getCode() != '42000') { + // succeed for PDOExceptions with SQLSTATE 42000 ("Syntax error or + // access rule violation") and MySQL error code 1305 ("SAVEPOINT does + // not exist"). + if ($e->getCode() == '42000' && $e->errorInfo[1] == '1305') { + // If one SAVEPOINT was released automatically, then all were. + // Therefore, we keep just the topmost transaction. + $this->transactionLayers = array('drupal_transaction'); + } + else { throw $e; } - // If one SAVEPOINT was released automatically, then all were. - // Therefore, we keep just the topmost transaction. - $this->transactionLayers = array('drupal_transaction'); } break; } From 3588d0971f53a6bf942827fad37954e3fcfba4db Mon Sep 17 00:00:00 2001 From: webchick Date: Sat, 4 Jun 2011 11:10:20 -0700 Subject: [PATCH 12/24] Issue #1017850 by yched: Improve documentation for field_view_value(). --- modules/field/field.module | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/field/field.module b/modules/field/field.module index e9dbc659c21..b808e595691 100644 --- a/modules/field/field.module +++ b/modules/field/field.module @@ -825,6 +825,8 @@ function field_view_value($entity_type, $entity, $field_name, $item, $display = * render($content[FIELD_NAME]) instead. * - Do not use to display all fields in an entity, use * field_attach_prepare_view() and field_attach_view() instead. + * - The field_view_value() function can be used to output a single formatted + * field value, without label or wrapping field markup. * * The function takes care of invoking the prepare_view steps. It also respects * field access permissions. @@ -864,6 +866,8 @@ function field_view_value($entity_type, $entity, $field_name, $item, $display = * used. * @return * A renderable array for the field value. + * + * @see field_view_value() */ function field_view_field($entity_type, $entity, $field_name, $display = array(), $langcode = NULL) { $output = array(); From 94f3f368839b3aa9c37669e2543e9744a27723f4 Mon Sep 17 00:00:00 2001 From: webchick Date: Sat, 4 Jun 2011 11:13:35 -0700 Subject: [PATCH 13/24] Issue #1038030 by yched: Fixed More accurate error handling in EntityFieldQuery : non-existing field. --- includes/entity.inc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/entity.inc b/includes/entity.inc index aaa39d871eb..9ee7889cfb7 100644 --- a/includes/entity.inc +++ b/includes/entity.inc @@ -651,7 +651,11 @@ class EntityFieldQuery { */ public function fieldCondition($field, $column = NULL, $value = NULL, $operator = NULL, $delta_group = NULL, $language_group = NULL) { if (is_scalar($field)) { - $field = field_info_field($field); + $field_definition = field_info_field($field); + if (empty($field_definition)) { + throw new EntityFieldQueryException(t('Unknown field: @field_name', array('@field_name' => $field))); + } + $field = $field_definition; } // Ensure the same index is used for fieldConditions as for fields. $index = count($this->fields); @@ -753,7 +757,11 @@ class EntityFieldQuery { */ public function fieldOrderBy($field, $column, $direction = 'ASC') { if (is_scalar($field)) { - $field = field_info_field($field); + $field_definition = field_info_field($field); + if (empty($field_definition)) { + throw new EntityFieldQueryException(t('Unknown field: @field_name', array('@field_name' => $field))); + } + $field = $field_definition; } // Save the index used for the new field, for later use in field storage. $index = count($this->fields); From 27af98b06ddd73fd0e5998b89c64660294e03738 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 6 Jun 2011 05:55:16 -0400 Subject: [PATCH 14/24] - Patch #1162226 by mr.baileys: taxonomy_term_save() should document what is in a object. --- modules/taxonomy/taxonomy.module | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index c171c06928b..dc2847d3755 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -532,12 +532,35 @@ function taxonomy_check_vocabulary_hierarchy($vocabulary, $changed_term) { } /** - * Save a term object to the database. + * Saves a term object to the database. * * @param $term - * A term object. + * The taxonomy term object with the following properties: + * - vid: The ID of the vocabulary the term is assigned to. + * - name: The name of the term. + * - tid: (optional) The unique ID for the term being saved. If $term->tid is + * empty or omitted, a new term will be inserted. + * - description: (optional) The term's description. + * - format: (optional) The text format for the term's description. + * - weight: (optional) The weight of this term in relation to other terms + * within the same vocabulary. + * - parent: (optional) The parent term(s) for this term. This can be a single + * term ID or an array of term IDs. A value of 0 means this term does not + * have any parents. When omitting this variable during an update, the + * existing hierarchy for the term remains unchanged. + * - vocabulary_machine_name: (optional) The machine name of the vocabulary + * the term is assigned to. If not given, this value will be set + * automatically by loading the vocabulary based on $term->vid. + * - original: (optional) The original taxonomy term object before any changes + * were applied. When omitted, the unchanged taxonomy term object is + * loaded from the database and stored in this property. + * Since a taxonomy term is an entity, any fields contained in the term object + * are saved alongside the term object. + * * @return - * Status constant indicating if term was inserted or updated. + * Status constant indicating whether term was inserted (SAVED_NEW) or updated + * (SAVED_UPDATED). When inserting a new term, $term->tid will contain the + * term ID of the newly created term. */ function taxonomy_term_save($term) { // Prevent leading and trailing spaces in term names. From 664fd1dd09b811bb27da71493d472e3cb9a2feeb Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 6 Jun 2011 06:05:07 -0400 Subject: [PATCH 15/24] =?UTF-8?q?-=20Patch=20#1164828=20by=20tim.plunkett:?= =?UTF-8?q?=20color=20labels=20are=20not=20intuitive=20when=20searching=20?= =?UTF-8?q?for=20the=20keyword=20=E2=80=9Cbackground=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/bartik/color/color.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/bartik/color/color.inc b/themes/bartik/color/color.inc index 7c29f50bc1b..b4c813da0bd 100644 --- a/themes/bartik/color/color.inc +++ b/themes/bartik/color/color.inc @@ -6,8 +6,8 @@ drupal_add_js(array('color' => array('logo' => theme_get_setting('logo', 'bartik $info = array( // Available colors and color labels used in theme. 'fields' => array( - 'top' => t('Header top'), - 'bottom' => t('Header bottom'), + 'top' => t('Header background top'), + 'bottom' => t('Header background bottom'), 'bg' => t('Main background'), 'sidebar' => t('Sidebar background'), 'sidebarborders' => t('Sidebar borders'), From 0e5bc01b48c5f060632447766c8f98041a905def Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 6 Jun 2011 06:17:45 -0400 Subject: [PATCH 16/24] - Patch #576508 by Rob Loach, TR: require PHP 5.3. --- includes/bootstrap.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 984739ee25c..17c8e83926f 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -18,7 +18,7 @@ define('DRUPAL_CORE_COMPATIBILITY', '8.x'); /** * Minimum supported version of PHP. */ -define('DRUPAL_MINIMUM_PHP', '5.2.4'); +define('DRUPAL_MINIMUM_PHP', '5.3.2'); /** * Minimum recommended value of PHP memory_limit. From 333779124f645e61bea12651f84c66bd66f40755 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 8 Jun 2011 13:41:52 -0700 Subject: [PATCH 17/24] Issue #1179424 by aspilicious, Heine, pwolanin, scor: Fixed Color module security fixes from SA-CORE-2011-001 not yet applied to Drupal 8. --- modules/color/color.module | 13 +++++++++++++ modules/color/color.test | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/modules/color/color.module b/modules/color/color.module index ff6c70e6cb7..18954fe1fd3 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -42,6 +42,7 @@ function color_form_system_theme_settings_alter(&$form, &$form_state) { '#theme' => 'color_scheme_form', ); $form['color'] += color_scheme_form($form, $form_state, $theme); + $form['#validate'][] = 'color_scheme_form_validate'; $form['#submit'][] = 'color_scheme_form_submit'; } } @@ -270,6 +271,18 @@ function theme_color_scheme_form($variables) { return $output; } +/** + * Validation handler for color change form. + */ +function color_scheme_form_validate($form, &$form_state) { + // Only accept hexadecimal CSS color strings to avoid XSS upon use. + foreach ($form_state['values']['palette'] as $key => $color) { + if (!preg_match('/^#([a-f0-9]{3}){1,2}$/iD', $color)) { + form_set_error('palette][' . $key, t('You must enter a valid hexadecimal color value for %name.', array('%name' => $form['color']['palette'][$key]['#title']))); + } + } +} + /** * Submit handler for color change form. */ diff --git a/modules/color/color.test b/modules/color/color.test index 1ddfc0647da..897bd6cc01c 100644 --- a/modules/color/color.test +++ b/modules/color/color.test @@ -11,6 +11,7 @@ class ColorTestCase extends DrupalWebTestCase { protected $big_user; protected $themes; + protected $colorTests; public static function getInfo() { return array( @@ -40,6 +41,19 @@ class ColorTestCase extends DrupalWebTestCase { ), ); theme_enable(array_keys($this->themes)); + + // Array filled with valid and not valid color values + $this->colorTests = array( + '#000' => TRUE, + '#123456' => TRUE, + '#abcdef' => TRUE, + '#0' => FALSE, + '#00' => FALSE, + '#0000' => FALSE, + '#00000' => FALSE, + '123456' => FALSE, + '#00000g' => FALSE, + ); } /** @@ -93,4 +107,27 @@ class ColorTestCase extends DrupalWebTestCase { $this->assertTrue(strpos($stylesheet_content, 'public://') === FALSE, 'Make sure the color paths have been translated to local paths. (' . $theme . ')'); variable_set('preprocess_css', 0); } + + /** + * Test to see if the provided color is valid + */ + function testValidColor() { + variable_set('theme_default', 'bartik'); + $settings_path = 'admin/appearance/settings/bartik'; + + $this->drupalLogin($this->big_user); + $edit['scheme'] = ''; + + foreach ($this->colorTests as $color => $is_valid) { + $edit['palette[bg]'] = $color; + $this->drupalPost($settings_path, $edit, t('Save configuration')); + + if($is_valid) { + $this->assertText('The configuration options have been saved.'); + } + else { + $this->assertText('You must enter a valid hexadecimal color value for Main background.'); + } + } + } } From 252b747295843092248c1e443c9d797daf7b4098 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 8 Jun 2011 20:42:04 -0700 Subject: [PATCH 18/24] Issue #1179970 by kafitz, dinarcon: Fixed spelling mistake in Field API docs. --- modules/field/field.info.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc index 02707f6d3fc..6b172dd3417 100644 --- a/modules/field/field.info.inc +++ b/modules/field/field.info.inc @@ -458,7 +458,7 @@ function field_behaviors_widget($op, $instance) { * Returns information about field types from hook_field_info(). * * @param $field_type - * (optional) A field type name. If ommitted, all field types will be + * (optional) A field type name. If omitted, all field types will be * returned. * * @return @@ -482,7 +482,7 @@ function field_info_field_types($field_type = NULL) { * Returns information about field widgets from hook_field_widget_info(). * * @param $widget_type - * (optional) A widget type name. If ommitted, all widget types will be + * (optional) A widget type name. If omitted, all widget types will be * returned. * * @return @@ -507,7 +507,7 @@ function field_info_widget_types($widget_type = NULL) { * Returns information about field formatters from hook_field_formatter_info(). * * @param $formatter_type - * (optional) A formatter type name. If ommitted, all formatter types will be + * (optional) A formatter type name. If omitted, all formatter types will be * returned. * * @return @@ -532,7 +532,7 @@ function field_info_formatter_types($formatter_type = NULL) { * Returns information about field storage from hook_field_storage_info(). * * @param $storage_type - * (optional) A storage type name. If ommitted, all storage types will be + * (optional) A storage type name. If omitted, all storage types will be * returned. * * @return From b2cf5cc90b15480c765e52f09906e00919bbce9d Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 8 Jun 2011 20:48:51 -0700 Subject: [PATCH 19/24] Issue #996240 by David_Rothstein: Fixed Javascript error in node preview when there are unlimited value fields in overlay. --- modules/overlay/overlay.module | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/overlay/overlay.module b/modules/overlay/overlay.module index 84b75548458..44c230b64cb 100644 --- a/modules/overlay/overlay.module +++ b/modules/overlay/overlay.module @@ -832,11 +832,14 @@ function overlay_render_region($region) { // on the final rendered page. $original_js = drupal_add_js(); $original_css = drupal_add_css(); + $original_libraries = drupal_static('drupal_add_library'); $js = &drupal_static('drupal_add_js'); $css = &drupal_static('drupal_add_css'); + $libraries = &drupal_static('drupal_add_library'); $markup = drupal_render_page($page); $js = $original_js; $css = $original_css; + $libraries = $original_libraries; // Indicate that the main page content has not, in fact, been displayed, so // that future calls to drupal_render_page() will be able to render it // correctly. From 82419788d314ad698613a4f3748058beea065cb8 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 8 Jun 2011 20:55:21 -0700 Subject: [PATCH 20/24] =?UTF-8?q?Issue=20#504506=20by=20andypost,=20G?= =?UTF-8?q?=C3=A1bor=20Hojtsy:=20Fixed=20Drupal.formatPlural=20incorrectly?= =?UTF-8?q?=20handle=20complex=20plural=20rules.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/locale.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/locale.inc b/includes/locale.inc index 0ca9944f51b..3fb4707d255 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -1863,7 +1863,7 @@ function _locale_rebuild_js($langcode = NULL) { // Construct the array for JavaScript translations. // Only add strings with a translation to the translations array. - $result = db_query("SELECT s.lid, s.source, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.location LIKE '%.js%' AND s.textgroup = :textgroup AND t.translation IS NOT NULL", array(':language' => $language->language, ':textgroup' => 'default')); + $result = db_query("SELECT s.lid, s.source, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.location LIKE '%.js%' AND s.textgroup = :textgroup", array(':language' => $language->language, ':textgroup' => 'default')); $translations = array(); foreach ($result as $data) { From d3ed67240306bcb9ba34bf92f5708dae28b63c4a Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 8 Jun 2011 21:16:35 -0700 Subject: [PATCH 21/24] Issue #1149188 by fago: Fixed machine_name.js does not respect maxlength of target field. --- misc/machine-name.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/machine-name.js b/misc/machine-name.js index 00a648a1b54..2691c3b73a2 100644 --- a/misc/machine-name.js +++ b/misc/machine-name.js @@ -35,6 +35,8 @@ Drupal.behaviors.machineName = { if ($target.hasClass('error')) { return; } + // Figure out the maximum length for the machine name. + options.maxlength = $target.attr('maxlength'); // Hide the form item container of the machine name form element. $wrapper.hide(); // Determine the initial machine name value. Unless the machine name form @@ -103,13 +105,14 @@ Drupal.behaviors.machineName = { * disallowed characters in the machine name; e.g., '[^a-z0-9]+'. * - replace: A character to replace disallowed characters with; e.g., '_' * or '-'. + * - maxlength: The maximum length of the machine name. * * @return * The transliterated source string. */ transliterate: function (source, settings) { var rx = new RegExp(settings.replace_pattern, 'g'); - return source.toLowerCase().replace(rx, settings.replace); + return source.toLowerCase().replace(rx, settings.replace).substr(0, settings.maxlength); } }; From 75b8f880fc0213d8addd6160c09f988878dbbc20 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 8 Jun 2011 21:58:08 -0700 Subject: [PATCH 22/24] Issue #1168686 by barbi, Dave Reid: Fixed hook_menu() doc should say how to pass integer arg to callbacks. --- modules/system/system.api.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 18cd7fe7755..ec3f55aae1f 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -947,8 +947,11 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) { * called, the corresponding path components will be substituted for the * integers. That is, the integer 0 in an argument list will be replaced with * the first path component, integer 1 with the second, and so on (path - * components are numbered starting from zero). This substitution feature allows - * you to re-use a callback function for several different paths. For example: + * components are numbered starting from zero). To pass an integer without it + * being replaced with its respective path component, use the string value of + * the integer (e.g., '1') as the argument value. This substitution feature + * allows you to re-use a callback function for several different paths. For + * example: * @code * function mymodule_menu() { * $items['abc/def'] = array( From 002cf94d320b714640b3af5551a07bb5652c191b Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 8 Jun 2011 22:04:52 -0700 Subject: [PATCH 23/24] Issue #705892 follow-up by bfroehle, ELC: Safer method of instantiating the content variable in node.tpl.php. --- modules/node/node.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/node/node.module b/modules/node/node.module index 2dd1926f175..20fc37ec5e4 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1455,7 +1455,7 @@ function template_preprocess_node(&$variables) { $variables = array_merge((array) $node, $variables); // Helpful $content variable for templates. - $variables['content'] = array(); + $variables += array('content' => array()); foreach (element_children($variables['elements']) as $key) { $variables['content'][$key] = $variables['elements'][$key]; } From 352fdec02d33cea7e88114d39463debddc900318 Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 8 Jun 2011 22:34:15 -0700 Subject: [PATCH 24/24] Issue #1022416 by bfroehle, turboflash: Fixed Wrong use of db_transaction() in block module. --- modules/block/block.admin.inc | 112 +++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 50 deletions(-) diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index 7cf299c0e54..c91cc80fc89 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -170,21 +170,27 @@ function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_r * @see block_admin_display_form() */ function block_admin_display_form_submit($form, &$form_state) { - $txn = db_transaction(); - - foreach ($form_state['values']['blocks'] as $block) { - $block['status'] = (int) ($block['region'] != BLOCK_REGION_NONE); - $block['region'] = $block['status'] ? $block['region'] : ''; - db_update('block') - ->fields(array( - 'status' => $block['status'], - 'weight' => $block['weight'], - 'region' => $block['region'], - )) - ->condition('module', $block['module']) - ->condition('delta', $block['delta']) - ->condition('theme', $block['theme']) - ->execute(); + $transaction = db_transaction(); + try { + foreach ($form_state['values']['blocks'] as $block) { + $block['status'] = (int) ($block['region'] != BLOCK_REGION_NONE); + $block['region'] = $block['status'] ? $block['region'] : ''; + db_update('block') + ->fields(array( + 'status' => $block['status'], + 'weight' => $block['weight'], + 'region' => $block['region'], + )) + ->condition('module', $block['module']) + ->condition('delta', $block['delta']) + ->condition('theme', $block['theme']) + ->execute(); + } + } + catch (Exception $e) { + $transaction->rollback(); + watchdog_exception('block', $e); + throw $e; } drupal_set_message(t('The block settings have been updated.')); cache_clear_all(); @@ -460,46 +466,52 @@ function block_admin_configure_validate($form, &$form_state) { */ function block_admin_configure_submit($form, &$form_state) { if (!form_get_errors()) { - $txn = db_transaction(); - - db_update('block') - ->fields(array( - 'visibility' => (int) $form_state['values']['visibility'], - 'pages' => trim($form_state['values']['pages']), - 'custom' => (int) $form_state['values']['custom'], - 'title' => $form_state['values']['title'], - )) - ->condition('module', $form_state['values']['module']) - ->condition('delta', $form_state['values']['delta']) - ->execute(); - - db_delete('block_role') - ->condition('module', $form_state['values']['module']) - ->condition('delta', $form_state['values']['delta']) - ->execute(); - $query = db_insert('block_role')->fields(array('rid', 'module', 'delta')); - foreach (array_filter($form_state['values']['roles']) as $rid) { - $query->values(array( - 'rid' => $rid, - 'module' => $form_state['values']['module'], - 'delta' => $form_state['values']['delta'], - )); - } - $query->execute(); - - // Store regions per theme for this block - foreach ($form_state['values']['regions'] as $theme => $region) { - db_merge('block') - ->key(array('theme' => $theme, 'delta' => $form_state['values']['delta'], 'module' => $form_state['values']['module'])) + $transaction = db_transaction(); + try { + db_update('block') ->fields(array( - 'region' => ($region == BLOCK_REGION_NONE ? '' : $region), + 'visibility' => (int) $form_state['values']['visibility'], 'pages' => trim($form_state['values']['pages']), - 'status' => (int) ($region != BLOCK_REGION_NONE), + 'custom' => (int) $form_state['values']['custom'], + 'title' => $form_state['values']['title'], )) + ->condition('module', $form_state['values']['module']) + ->condition('delta', $form_state['values']['delta']) ->execute(); - } - module_invoke($form_state['values']['module'], 'block_save', $form_state['values']['delta'], $form_state['values']); + db_delete('block_role') + ->condition('module', $form_state['values']['module']) + ->condition('delta', $form_state['values']['delta']) + ->execute(); + $query = db_insert('block_role')->fields(array('rid', 'module', 'delta')); + foreach (array_filter($form_state['values']['roles']) as $rid) { + $query->values(array( + 'rid' => $rid, + 'module' => $form_state['values']['module'], + 'delta' => $form_state['values']['delta'], + )); + } + $query->execute(); + + // Store regions per theme for this block + foreach ($form_state['values']['regions'] as $theme => $region) { + db_merge('block') + ->key(array('theme' => $theme, 'delta' => $form_state['values']['delta'], 'module' => $form_state['values']['module'])) + ->fields(array( + 'region' => ($region == BLOCK_REGION_NONE ? '' : $region), + 'pages' => trim($form_state['values']['pages']), + 'status' => (int) ($region != BLOCK_REGION_NONE), + )) + ->execute(); + } + + module_invoke($form_state['values']['module'], 'block_save', $form_state['values']['delta'], $form_state['values']); + } + catch (Exception $e) { + $transaction->rollback(); + watchdog_exception('block', $e); + throw $e; + } drupal_set_message(t('The block configuration has been saved.')); cache_clear_all(); $form_state['redirect'] = 'admin/structure/block';