diff -r e3f92ea19d16 -r e5f1af644b30 drupal-module-misc/drupal-module-misc.patch --- a/drupal-module-misc/drupal-module-misc.patch Tue Aug 28 18:28:55 2012 +0200 +++ b/drupal-module-misc/drupal-module-misc.patch Tue Aug 28 18:29:00 2012 +0200 @@ -1,296 +1,12 @@ - -Activate the Drupal glue code for the FCKeditor filemanager. - -Index: sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php ---- sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php.orig 2008-03-25 16:28:24 +0100 -+++ sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php 2008-05-02 23:02:23 +0200 -@@ -39,6 +39,9 @@ - // Attention: The above 'UserFilesPath' must point to the same directory. - $Config['UserFilesAbsolutePath'] = '' ; - -+// activate Drupal glue code for filemanager -+require_once "../../../../../filemanager.config.php"; -+ - // Due to security issues with Apache modules, it is recommended to leave the - // following setting enabled. - $Config['ForceSingleExtension'] = true ; - ------------------------------------------------------------------------------ - -1. Fix content validation in "xmlcontent" module in case - one has enabled multiple filters on a particular input format. -2. Additionally, allow absolute paths to support .xsd/.xsl files - in arbitrary directories. -3. Finally, do not create a new DOM and output it as XML. Instead directly - output the transformed XML in order to get rid of the declaration. -4. Additionally, support an optional XML content template (mainly - for loading ENTITY definitions which cannot be done via XSD and XSLT) - -Index: sites/all/modules/xmlcontent/xmlcontent.module ---- sites/all/modules/xmlcontent/xmlcontent.module.orig 2007-03-14 22:59:59 +0100 -+++ sites/all/modules/xmlcontent/xmlcontent.module 2008-05-30 21:13:16 +0200 -@@ -39,8 +39,22 @@ - return t('Allows users to post XML node content and get it transformed through a configured XSLT script'); - - case 'process': -- $xslt_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_xslt_path_$format", ''); -- return _xmlcontent_transform($text, $xslt_path); -+ $tpl_path = variable_get("xmlcontent_tpl_path_$format", ''); -+ if ($tpl_path) { -+ if (substr($tpl_path, 0, 1) != "/") -+ $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path; -+ $tpl = file_get_contents($tpl_path); -+ $text = preg_replace("/&template_body;/", $text, $tpl); -+ $cwd = getcwd(); -+ chdir(preg_replace("/\\/[^\\/]+\$/", "", $tpl_path)); -+ } -+ $xslt_path = variable_get("xmlcontent_xslt_path_$format", ''); -+ if (substr($xslt_path, 0, 1) != "/") -+ $xslt_path = drupal_get_path('module', 'xmlcontent') . '/' . $xslt_path; -+ $result = _xmlcontent_transform($text, $xslt_path); -+ if ($tpl_path) -+ chdir($cwd); -+ return $result; - - case 'settings': - return _xmlcontent_filter_settings($format); -@@ -72,7 +86,7 @@ - } - // Does the input format of this node use XML Content filter? - $format = filter_resolve_format($node->format); -- $module = db_result(db_query('SELECT module FROM {filters} WHERE format = %d', $format)); -+ $module = db_result(db_query("SELECT module FROM {filters} WHERE format = %d AND module = 'xmlcontent'", $format)); - if ($module != 'xmlcontent') { - return; - } -@@ -83,7 +97,10 @@ - return; - } - -- $schema_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_schema_path_$format",''); -+ $schema_path = variable_get("xmlcontent_schema_path_$format", ''); -+ if (substr($schema_path, 0, 1) != "/") -+ $schema_path = drupal_get_path('module', 'xmlcontent') . '/' . $schema_path; -+ - if (!is_file($schema_path) && ($validation == 'xsd' or $validation == 'rng')) { - $schema_path = null; - watchdog( 'xmlcontent', t('Validation required but no schema file'), WATCHDOG_WARNING ); -@@ -93,7 +110,23 @@ - libxml_clear_errors(); - libxml_use_internal_errors(true); - -- if (!_xmlcontent_validate($node->body, $validation, $schema_path)) { -+ $text = $node->body; -+ $tpl_path = variable_get("xmlcontent_tpl_path_$format", ''); -+ if ($tpl_path) { -+ if (substr($tpl_path, 0, 1) != "/") -+ $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path; -+ $tpl = file_get_contents($tpl_path); -+ $text = preg_replace("/&template_body;/", $text, $tpl); -+ $cwd = getcwd(); -+ chdir(preg_replace("/\\/[^\\/]+\$/", "", $tpl_path)); -+ } -+ -+ $result = _xmlcontent_validate($text, $validation, $schema_path); -+ -+ if ($tpl_path) -+ chdir($cwd); -+ -+ if (!$result) { - form_set_error('body', t('XML Content: Invalid XML') . libxml_errors_string()); - } - -@@ -156,6 +189,13 @@ - '#collapsible' => TRUE, - '#collapsed' => FALSE, - ); -+ $form['xmlcontent']["xmlcontent_tpl_path_$format"] = array( -+ '#type' => 'textfield', -+ '#title' => t('Optional XML Template File Path'), -+ '#default_value' => variable_get("xmlcontent_tpl_path_$format", ''), -+ '#field_prefix' => drupal_get_path('module', 'xmlcontent'). '/', -+ '#description' => t('The file path to the optional XML template, wrapper around the XML content before processing.'), -+ ); - $form['xmlcontent']["xmlcontent_xslt_path_$format"] = array( - '#type' => 'textfield', - '#title' => t('XSLT Script File Path'), -@@ -218,6 +258,8 @@ - - // Load the XML document - $dom = new DomDocument('1.0', 'UTF-8'); -+ $dom->resolveExternals = true; -+ $dom->substituteEntities = true; - $valid = $dom->loadXML($xml); - if (!$valid) { - watchdog('xmlcontent', "Invalid XML Content", WATCHDOG_WARNING); -@@ -227,6 +269,8 @@ - // Load the XSLT script - // TODO: is there a way to cache it, or not necessary - $xsl = new DomDocument('1.0', 'UTF-8'); -+ $xsl->resolveExternals = true; -+ $xsl->substituteEntities = true; - $xsl->load($path_to_xslt); - - // Create the XSLT processor -@@ -242,10 +286,8 @@ - } - - // Transform -- $newdom = $proc->transformToDoc($dom); -- -- // Return the output as XML text (in fact subset of XHTML, depending on the XSLT script) -- return $newdom->saveXML(); -+ $xml = $proc->transformToXML($dom); -+ return $xml; - } - - ------------------------------------------------------------------------------ - -Fix upgrading in "simplefeed" module if PostgreSQL is used. -Fix modules as Drupal 6.2 does not provide db_num_rows() anymore. - -Index: sites/all/modules/simplefeed/simplefeed.install ---- sites/all/modules/simplefeed/simplefeed.install.orig 2008-06-11 07:22:28 +0200 -+++ sites/all/modules/simplefeed/simplefeed.install 2008-06-14 15:09:53 +0200 -@@ -31,8 +31,17 @@ - - function simplefeed_update_2() { - $ret = array(); -- $ret[] = update_sql("ALTER TABLE {simplefeed_feed} DROP INDEX url"); -- $ret[] = update_sql("ALTER TABLE {simplefeed_feed} CHANGE url url text"); -+ switch ($GLOBALS['db_type']) { -+ case 'mysql': -+ case 'mysqli': -+ $ret[] = update_sql("ALTER TABLE {simplefeed_feed} DROP INDEX url"); -+ $ret[] = update_sql("ALTER TABLE {simplefeed_feed} CHANGE url url text"); -+ break; -+ case 'pgsql': -+ $ret[] = update_sql("DROP INDEX {simplefeed_feed}_url_idx"); -+ $ret[] = update_sql("ALTER TABLE {simplefeed_feed} ALTER COLUMN url TYPE text"); -+ break; -+ } - return $ret; - } - -Index: sites/all/modules/simplefeed/simplefeed_item.install ---- sites/all/modules/simplefeed/simplefeed_item.install.orig 2008-06-11 07:22:28 +0200 -+++ sites/all/modules/simplefeed/simplefeed_item.install 2008-06-14 16:23:01 +0200 -@@ -60,8 +62,18 @@ - - function simplefeed_item_update_3() { - $ret = array(); -- $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE url url text"); -- $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE iid iid varchar(32) NOT NULL"); -+ switch ($GLOBALS['db_type']) { -+ case 'mysql': -+ case 'mysqli': -+ $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE url url text"); -+ $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE iid iid varchar(32) NOT NULL"); -+ break; -+ case 'pgsql': -+ $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN url TYPE text"); -+ $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN iid TYPE VARCHAR(32)"); -+ $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN iid SET NOT NULL"); -+ break; -+ } - return $ret; - } - ------------------------------------------------------------------------------ - -Fix helpers module for PostgreSQL usage. - -Index: sites/all/modules/helpers/helpers_database.module ---- sites/all/modules/helpers/helpers_database.module.orig 2008-04-23 04:38:34 +0200 -+++ sites/all/modules/helpers/helpers_database.module 2008-06-16 18:06:41 +0200 -@@ -16,7 +16,7 @@ - * - * NOTE: This is open code - do not put a function declaration on it. - */ -- $db_types = array('mysql', 'mysqli', 'postgres'); -+ $db_types = array('mysql', 'mysqli', 'pgsql'); - $dbtype = $GLOBALS['db_type']; - if (in_array($dbtype, $db_types)) { - // Using include because the site may not be using this so we don't want a fatal error. -Index: sites/all/modules/helpers/includes/dra_pgsql.inc ---- sites/all/modules/helpers/includes/dra_pgsql.inc.orig 2008-06-16 17:49:43 +0200 -+++ sites/all/modules/helpers/includes/dra_pgsql.inc 2008-06-16 18:05:19 +0200 -@@ -0,0 +1,40 @@ -+ value -+ * 2 columns 1st value => 2nd value -+ * 3 or more 1st value => array(2nd value, 3rd value, ...) -+ */ -+function db_result_array($result) { -+ $array = array(); -+ while ($row = pg_fetch_array($result, NULL, PGSQL_NUM)) { -+ $y = count($row); -+ switch ($y) { -+ case 0: -+ drupal_set_message(t('Db_result_array found no columns in the result set.'), 'error'); -+ return false; -+ -+ case 1: -+ $array[$row[0]] = $row[0]; -+ break; -+ -+ case 2: -+ $array[$row[0]] = $row[1]; -+ break; -+ -+ default: -+ $array[$row[0]] = array_slice($row, 1); -+ break; -+ } -+ } -+ return $array; -+} - ------------------------------------------------------------------------------ - -Fix PostgreSQL usage. - -Index: sites/all/modules/nodeupdates/nodeupdates.install ---- sites/all/modules/nodeupdates/nodeupdates.install.orig 2007-12-31 15:11:57 +0100 -+++ sites/all/modules/nodeupdates/nodeupdates.install 2008-06-18 18:00:08 +0200 -@@ -15,10 +15,10 @@ - - case 'pgsql': - db_query("CREATE TABLE {nodeupdates} ( -- nid integer(10) NOT NULL default '0', -+ nid integer NOT NULL default '0', - title varchar(128) NOT NULL default '', -- message longtext NOT NULL default '', -- timestamp integer(11) NOT NULL default '0' -+ message text NOT NULL default '', -+ timestamp integer NOT NULL default '0' - )"); - break; - } - ------------------------------------------------------------------------------ - Since PHP 5.3 calling functions with objects and having the function -declare the object parameter as a reference causes a run-time error. -The "call-by-reference" indicator "&" has to be removed from parameters -which are known to be passed as objects (by reference). +declare the object parameter as a reference causes a runtime error. +The "call by reference" indicator "&" has to be removed from parameters +which are known to be passed as objects (by reference.) Index: sites/all/modules/diff/diff.module --- sites/all/modules/diff/diff.module.orig 2010-08-12 18:34:08.000000000 +0200 +++ sites/all/modules/diff/diff.module 2010-08-13 14:18:26.000000000 +0200 -@@ -87,7 +87,7 @@ +@@ -78,7 +78,7 @@ /** * Implementation of hook_menu_alter(). */ @@ -299,34 +15,43 @@ // Overwrite the default 'Revisions' page $callbacks['node/%node/revisions']['page callback'] = 'diff_diffs_overview'; $callbacks['node/%node/revisions']['module'] = 'diff'; -@@ -133,7 +133,7 @@ +@@ -128,7 +128,7 @@ /** * Implementation of hook_nodeapi(). */ --function diff_nodeapi(&$node, $op, $teaser, $page) { -+function diff_nodeapi($node, $op, $teaser, $page) { - if ($page && $op == 'view' && user_access('view revisions') && variable_get('show_diff_inline_'. $node->type, FALSE)) { +-function diff_node_view_alter(&$build) { ++function diff_node_view_alter($build) { + $node = $build['#node']; + if (user_access('view revisions') && variable_get('show_diff_inline_'. $node->type, FALSE)) { // Ugly but cheap way to check that we are viewing a node's revision page. - if (arg(2) === 'revisions' && arg(3) === $node->vid) { -@@ -149,7 +149,7 @@ +@@ -146,7 +146,7 @@ /** - * Implementation of hook_form_alter(). + * Implements hook_form_alter(). */ -function diff_form_alter(&$form, $form_state, $form_id) { +function diff_form_alter($form, $form_state, $form_id) { - if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) { + if (!empty($form['#node_edit_form'])) { // Add a 'View changes' button on the node edit form. if (variable_get('show_preview_changes_'. $form['type']['#value'], TRUE) && $form['nid']['#value'] > 0) { -@@ -194,7 +194,7 @@ +@@ -163,7 +163,7 @@ + /** + * Implements hook_form_alter() for node_type_form. + */ +-function diff_form_node_type_form_alter(&$form, $form_state) { ++function diff_form_node_type_form_alter($form, $form_state) { + if (isset($form['type'])) { + // Node type edit form. + // Add checkbox to activate 'View changes' button per node type. +@@ -198,7 +198,7 @@ /** * Callback if 'View changes' is pressed. */ -function diff_node_form_build_preview_changes($form, &$form_state) { +function diff_node_form_build_preview_changes($form, $form_state) { module_load_include('inc', 'diff', 'diff.pages'); + $old_node = clone node_load($form_state['values']['nid']); $node = node_form_submit_build_node($form, $form_state); - -@@ -323,7 +323,7 @@ +@@ -342,7 +342,7 @@ /** * Form submission handler for diff_inline_form() for JS-disabled clients. */ @@ -335,4 +60,3 @@ if (isset($form_state['values']['revision'], $form_state['values']['node'])) { $node = $form_state['values']['node']; $vid = $form_state['values']['revision']; -