drupal-module-misc/drupal-module-misc.patch

changeset 531
e3f92ea19d16
child 532
e5f1af644b30
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/drupal-module-misc/drupal-module-misc.patch	Tue Aug 28 18:28:55 2012 +0200
     1.3 @@ -0,0 +1,338 @@
     1.4 +
     1.5 +Activate the Drupal glue code for the FCKeditor filemanager.
     1.6 +
     1.7 +Index: sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php
     1.8 +--- sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php.orig	2008-03-25 16:28:24 +0100
     1.9 ++++ sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php	2008-05-02 23:02:23 +0200
    1.10 +@@ -39,6 +39,9 @@
    1.11 + // Attention: The above 'UserFilesPath' must point to the same directory.
    1.12 + $Config['UserFilesAbsolutePath'] = '' ;
    1.13 + 
    1.14 ++// activate Drupal glue code for filemanager
    1.15 ++require_once "../../../../../filemanager.config.php";
    1.16 ++
    1.17 + // Due to security issues with Apache modules, it is recommended to leave the
    1.18 + // following setting enabled.
    1.19 + $Config['ForceSingleExtension'] = true ;
    1.20 +
    1.21 +-----------------------------------------------------------------------------
    1.22 +
    1.23 +1. Fix content validation in "xmlcontent" module in case
    1.24 +   one has enabled multiple filters on a particular input format.
    1.25 +2. Additionally, allow absolute paths to support .xsd/.xsl files
    1.26 +   in arbitrary directories.
    1.27 +3. Finally, do not create a new DOM and output it as XML. Instead directly
    1.28 +   output the transformed XML in order to get rid of the <?xml...?> declaration.
    1.29 +4. Additionally, support an optional XML content template (mainly
    1.30 +   for loading ENTITY definitions which cannot be done via XSD and XSLT)
    1.31 +
    1.32 +Index: sites/all/modules/xmlcontent/xmlcontent.module
    1.33 +--- sites/all/modules/xmlcontent/xmlcontent.module.orig	2007-03-14 22:59:59 +0100
    1.34 ++++ sites/all/modules/xmlcontent/xmlcontent.module	2008-05-30 21:13:16 +0200
    1.35 +@@ -39,8 +39,22 @@
    1.36 +       return t('Allows users to post XML node content and get it transformed through a configured XSLT script');
    1.37 + 
    1.38 +     case 'process':
    1.39 +-      $xslt_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_xslt_path_$format", '');
    1.40 +-      return _xmlcontent_transform($text, $xslt_path);
    1.41 ++      $tpl_path = variable_get("xmlcontent_tpl_path_$format", '');
    1.42 ++      if ($tpl_path) {
    1.43 ++          if (substr($tpl_path, 0, 1) != "/")
    1.44 ++              $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path;
    1.45 ++          $tpl = file_get_contents($tpl_path);
    1.46 ++          $text = preg_replace("/&template_body;/", $text, $tpl);
    1.47 ++          $cwd = getcwd();
    1.48 ++          chdir(preg_replace("/\\/[^\\/]+\$/", "", $tpl_path));
    1.49 ++      }
    1.50 ++      $xslt_path = variable_get("xmlcontent_xslt_path_$format", '');
    1.51 ++      if (substr($xslt_path, 0, 1) != "/")
    1.52 ++          $xslt_path = drupal_get_path('module', 'xmlcontent') . '/' . $xslt_path;
    1.53 ++      $result = _xmlcontent_transform($text, $xslt_path);
    1.54 ++      if ($tpl_path)
    1.55 ++          chdir($cwd);
    1.56 ++      return $result;
    1.57 + 
    1.58 +     case 'settings':
    1.59 +       return _xmlcontent_filter_settings($format);
    1.60 +@@ -72,7 +86,7 @@
    1.61 +       }
    1.62 +       // Does the input format of this node use XML Content filter?
    1.63 +       $format = filter_resolve_format($node->format);
    1.64 +-      $module = db_result(db_query('SELECT module FROM {filters} WHERE format = %d', $format));
    1.65 ++      $module = db_result(db_query("SELECT module FROM {filters} WHERE format = %d AND module = 'xmlcontent'", $format));
    1.66 +       if ($module != 'xmlcontent') {
    1.67 +         return;
    1.68 +       }
    1.69 +@@ -83,7 +97,10 @@
    1.70 +         return;
    1.71 +       }      
    1.72 +       
    1.73 +-      $schema_path = drupal_get_path('module', 'xmlcontent'). '/' . variable_get("xmlcontent_schema_path_$format",'');        
    1.74 ++      $schema_path = variable_get("xmlcontent_schema_path_$format", '');
    1.75 ++      if (substr($schema_path, 0, 1) != "/")
    1.76 ++          $schema_path = drupal_get_path('module', 'xmlcontent') . '/' . $schema_path;
    1.77 ++
    1.78 +       if (!is_file($schema_path) && ($validation == 'xsd' or $validation == 'rng')) {
    1.79 +         $schema_path = null;
    1.80 +         watchdog( 'xmlcontent', t('Validation required but no schema file'), WATCHDOG_WARNING );
    1.81 +@@ -93,7 +110,23 @@
    1.82 +       libxml_clear_errors();
    1.83 +       libxml_use_internal_errors(true);
    1.84 + 
    1.85 +-      if (!_xmlcontent_validate($node->body, $validation, $schema_path)) {
    1.86 ++      $text = $node->body;
    1.87 ++      $tpl_path = variable_get("xmlcontent_tpl_path_$format", '');
    1.88 ++      if ($tpl_path) {
    1.89 ++          if (substr($tpl_path, 0, 1) != "/")
    1.90 ++              $tpl_path = drupal_get_path('module', 'xmlcontent') . '/' . $tpl_path;
    1.91 ++          $tpl = file_get_contents($tpl_path);
    1.92 ++          $text = preg_replace("/&template_body;/", $text, $tpl);
    1.93 ++          $cwd = getcwd();
    1.94 ++          chdir(preg_replace("/\\/[^\\/]+\$/", "", $tpl_path));
    1.95 ++      }
    1.96 ++
    1.97 ++      $result = _xmlcontent_validate($text, $validation, $schema_path);
    1.98 ++
    1.99 ++      if ($tpl_path)
   1.100 ++          chdir($cwd);
   1.101 ++
   1.102 ++      if (!$result) {
   1.103 +         form_set_error('body', t('XML Content: Invalid XML') . libxml_errors_string());
   1.104 +       }
   1.105 +       
   1.106 +@@ -156,6 +189,13 @@
   1.107 +     '#collapsible' => TRUE,
   1.108 +     '#collapsed' => FALSE,
   1.109 +   );
   1.110 ++  $form['xmlcontent']["xmlcontent_tpl_path_$format"] = array(
   1.111 ++    '#type'    => 'textfield',
   1.112 ++    '#title'   => t('Optional XML Template File Path'),
   1.113 ++    '#default_value' => variable_get("xmlcontent_tpl_path_$format", ''),
   1.114 ++    '#field_prefix'  => drupal_get_path('module', 'xmlcontent'). '/',
   1.115 ++    '#description'  => t('The file path to the optional XML template, wrapper around the XML content before processing.'),
   1.116 ++  );
   1.117 +   $form['xmlcontent']["xmlcontent_xslt_path_$format"] = array(
   1.118 +     '#type'    => 'textfield',
   1.119 +     '#title'   => t('XSLT Script File Path'),
   1.120 +@@ -218,6 +258,8 @@
   1.121 +   
   1.122 +   // Load the XML document
   1.123 +   $dom = new DomDocument('1.0', 'UTF-8');
   1.124 ++  $dom->resolveExternals = true;
   1.125 ++  $dom->substituteEntities = true;
   1.126 +   $valid = $dom->loadXML($xml);
   1.127 +   if (!$valid) {
   1.128 +     watchdog('xmlcontent', "Invalid XML Content", WATCHDOG_WARNING);
   1.129 +@@ -227,6 +269,8 @@
   1.130 +   // Load the XSLT script
   1.131 +   // TODO: is there a way to cache it, or not necessary
   1.132 +   $xsl = new DomDocument('1.0', 'UTF-8');
   1.133 ++  $xsl->resolveExternals = true;
   1.134 ++  $xsl->substituteEntities = true;
   1.135 +   $xsl->load($path_to_xslt);   
   1.136 + 
   1.137 +   // Create the XSLT processor
   1.138 +@@ -242,10 +286,8 @@
   1.139 +   }
   1.140 + 
   1.141 +   // Transform
   1.142 +-  $newdom = $proc->transformToDoc($dom);
   1.143 +-  
   1.144 +-  // Return the output as XML text (in fact subset of XHTML, depending on the XSLT script)
   1.145 +-  return $newdom->saveXML();
   1.146 ++  $xml = $proc->transformToXML($dom);
   1.147 ++  return $xml;
   1.148 + }
   1.149 + 
   1.150 + 
   1.151 +-----------------------------------------------------------------------------
   1.152 +
   1.153 +Fix upgrading in "simplefeed" module if PostgreSQL is used.
   1.154 +Fix modules as Drupal 6.2 does not provide db_num_rows() anymore.
   1.155 +
   1.156 +Index: sites/all/modules/simplefeed/simplefeed.install
   1.157 +--- sites/all/modules/simplefeed/simplefeed.install.orig	2008-06-11 07:22:28 +0200
   1.158 ++++ sites/all/modules/simplefeed/simplefeed.install	2008-06-14 15:09:53 +0200
   1.159 +@@ -31,8 +31,17 @@
   1.160 + 
   1.161 + function simplefeed_update_2() {
   1.162 +   $ret = array();
   1.163 +-  $ret[] = update_sql("ALTER TABLE {simplefeed_feed} DROP INDEX url");
   1.164 +-  $ret[] = update_sql("ALTER TABLE {simplefeed_feed} CHANGE url url text");  
   1.165 ++  switch ($GLOBALS['db_type']) {
   1.166 ++    case 'mysql':
   1.167 ++    case 'mysqli':
   1.168 ++      $ret[] = update_sql("ALTER TABLE {simplefeed_feed} DROP INDEX url");
   1.169 ++      $ret[] = update_sql("ALTER TABLE {simplefeed_feed} CHANGE url url text");  
   1.170 ++      break;
   1.171 ++    case 'pgsql':
   1.172 ++      $ret[] = update_sql("DROP INDEX {simplefeed_feed}_url_idx");
   1.173 ++      $ret[] = update_sql("ALTER TABLE {simplefeed_feed} ALTER COLUMN url TYPE text");  
   1.174 ++      break;
   1.175 ++  }
   1.176 +   return $ret;
   1.177 + }
   1.178 + 
   1.179 +Index: sites/all/modules/simplefeed/simplefeed_item.install
   1.180 +--- sites/all/modules/simplefeed/simplefeed_item.install.orig	2008-06-11 07:22:28 +0200
   1.181 ++++ sites/all/modules/simplefeed/simplefeed_item.install	2008-06-14 16:23:01 +0200
   1.182 +@@ -60,8 +62,18 @@
   1.183 + 
   1.184 + function simplefeed_item_update_3() {
   1.185 +   $ret = array();
   1.186 +-  $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE url url text");
   1.187 +-  $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE iid iid varchar(32) NOT NULL");  
   1.188 ++  switch ($GLOBALS['db_type']) {
   1.189 ++    case 'mysql':
   1.190 ++    case 'mysqli':
   1.191 ++      $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE url url text");
   1.192 ++      $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} CHANGE iid iid varchar(32) NOT NULL");  
   1.193 ++      break;
   1.194 ++    case 'pgsql':
   1.195 ++      $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN url TYPE text");  
   1.196 ++      $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN iid TYPE VARCHAR(32)");  
   1.197 ++      $ret[] = update_sql("ALTER TABLE {simplefeed_feed_item} ALTER COLUMN iid SET NOT NULL");  
   1.198 ++      break;
   1.199 ++  }
   1.200 +   return $ret;
   1.201 + }
   1.202 + 
   1.203 +-----------------------------------------------------------------------------
   1.204 +
   1.205 +Fix helpers module for PostgreSQL usage.
   1.206 +
   1.207 +Index: sites/all/modules/helpers/helpers_database.module
   1.208 +--- sites/all/modules/helpers/helpers_database.module.orig	2008-04-23 04:38:34 +0200
   1.209 ++++ sites/all/modules/helpers/helpers_database.module	2008-06-16 18:06:41 +0200
   1.210 +@@ -16,7 +16,7 @@
   1.211 +  *
   1.212 +  * NOTE: This is open code - do not put a function declaration on it.
   1.213 +  */
   1.214 +-  $db_types = array('mysql', 'mysqli', 'postgres');
   1.215 ++  $db_types = array('mysql', 'mysqli', 'pgsql');
   1.216 +   $dbtype = $GLOBALS['db_type'];
   1.217 +   if (in_array($dbtype, $db_types)) {
   1.218 +     // Using include because the site may not be using this so we don't want a fatal error.
   1.219 +Index: sites/all/modules/helpers/includes/dra_pgsql.inc
   1.220 +--- sites/all/modules/helpers/includes/dra_pgsql.inc.orig	2008-06-16 17:49:43 +0200
   1.221 ++++ sites/all/modules/helpers/includes/dra_pgsql.inc	2008-06-16 18:05:19 +0200
   1.222 +@@ -0,0 +1,40 @@
   1.223 ++<?php
   1.224 ++/* $Id */
   1.225 ++ /**
   1.226 ++ * Return a result array from the previous query. PostgreSql version.
   1.227 ++ * This is very handy for building an option list for a form element.
   1.228 ++ *
   1.229 ++ * @param $result
   1.230 ++ *   A database query result resource, as returned from db_query().
   1.231 ++ * @return
   1.232 ++ *   The resulting array or FALSE.
   1.233 ++ *   If the query contains -- the result array would be 
   1.234 ++ *        0 columns             (bool)FALSE
   1.235 ++ *        1 column              value => value
   1.236 ++ *        2 columns             1st value => 2nd value
   1.237 ++ *        3 or more             1st value => array(2nd value, 3rd value, ...)
   1.238 ++ */
   1.239 ++function db_result_array($result) {
   1.240 ++  $array = array();
   1.241 ++  while ($row = pg_fetch_array($result, NULL, PGSQL_NUM)) {
   1.242 ++    $y = count($row);
   1.243 ++    switch ($y) {
   1.244 ++      case 0:
   1.245 ++        drupal_set_message(t('Db_result_array found no columns in the result set.'), 'error');
   1.246 ++        return false;
   1.247 ++
   1.248 ++      case 1:
   1.249 ++        $array[$row[0]] = $row[0];
   1.250 ++        break;
   1.251 ++
   1.252 ++      case 2:
   1.253 ++        $array[$row[0]] = $row[1];
   1.254 ++        break;
   1.255 ++
   1.256 ++      default:
   1.257 ++        $array[$row[0]] = array_slice($row, 1);
   1.258 ++        break;
   1.259 ++    }
   1.260 ++  }
   1.261 ++  return $array;
   1.262 ++}
   1.263 +
   1.264 +-----------------------------------------------------------------------------
   1.265 +
   1.266 +Fix PostgreSQL usage.
   1.267 +
   1.268 +Index: sites/all/modules/nodeupdates/nodeupdates.install
   1.269 +--- sites/all/modules/nodeupdates/nodeupdates.install.orig	2007-12-31 15:11:57 +0100
   1.270 ++++ sites/all/modules/nodeupdates/nodeupdates.install	2008-06-18 18:00:08 +0200
   1.271 +@@ -15,10 +15,10 @@
   1.272 + 
   1.273 +     case 'pgsql':
   1.274 +       db_query("CREATE TABLE {nodeupdates} (
   1.275 +-        nid integer(10) NOT NULL default '0',
   1.276 ++        nid integer NOT NULL default '0',
   1.277 +         title varchar(128) NOT NULL default '',
   1.278 +-        message longtext NOT NULL default '',
   1.279 +-        timestamp integer(11) NOT NULL default '0'
   1.280 ++        message text NOT NULL default '',
   1.281 ++        timestamp integer NOT NULL default '0'
   1.282 +       )");
   1.283 +       break;
   1.284 +   }
   1.285 +
   1.286 +-----------------------------------------------------------------------------
   1.287 +
   1.288 +Since PHP 5.3 calling functions with objects and having the function
   1.289 +declare the object parameter as a reference causes a run-time error.
   1.290 +The "call-by-reference" indicator "&" has to be removed from parameters
   1.291 +which are known to be passed as objects (by reference).
   1.292 +
   1.293 +Index: sites/all/modules/diff/diff.module
   1.294 +--- sites/all/modules/diff/diff.module.orig	2010-08-12 18:34:08.000000000 +0200
   1.295 ++++ sites/all/modules/diff/diff.module	2010-08-13 14:18:26.000000000 +0200
   1.296 +@@ -87,7 +87,7 @@
   1.297 + /**
   1.298 +  * Implementation of hook_menu_alter().
   1.299 +  */
   1.300 +-function diff_menu_alter(&$callbacks) {
   1.301 ++function diff_menu_alter($callbacks) {
   1.302 +   // Overwrite the default 'Revisions' page
   1.303 +   $callbacks['node/%node/revisions']['page callback'] = 'diff_diffs_overview';
   1.304 +   $callbacks['node/%node/revisions']['module'] = 'diff';
   1.305 +@@ -133,7 +133,7 @@
   1.306 + /**
   1.307 +  * Implementation of hook_nodeapi().
   1.308 +  */
   1.309 +-function diff_nodeapi(&$node, $op, $teaser, $page) {
   1.310 ++function diff_nodeapi($node, $op, $teaser, $page) {
   1.311 +   if ($page && $op == 'view' && user_access('view revisions') && variable_get('show_diff_inline_'. $node->type, FALSE)) {
   1.312 +     // Ugly but cheap way to check that we are viewing a node's revision page.
   1.313 +     if (arg(2) === 'revisions' && arg(3) === $node->vid) {
   1.314 +@@ -149,7 +149,7 @@
   1.315 + /**
   1.316 +  * Implementation of hook_form_alter().
   1.317 +  */
   1.318 +-function diff_form_alter(&$form, $form_state, $form_id) {
   1.319 ++function diff_form_alter($form, $form_state, $form_id) {
   1.320 +   if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) {
   1.321 +     // Add a 'View changes' button on the node edit form.
   1.322 +     if (variable_get('show_preview_changes_'. $form['type']['#value'], TRUE) && $form['nid']['#value'] > 0) {
   1.323 +@@ -194,7 +194,7 @@
   1.324 + /**
   1.325 +  * Callback if 'View changes' is pressed.
   1.326 +  */
   1.327 +-function diff_node_form_build_preview_changes($form, &$form_state) {
   1.328 ++function diff_node_form_build_preview_changes($form, $form_state) {
   1.329 +   module_load_include('inc', 'diff', 'diff.pages');
   1.330 +   $node = node_form_submit_build_node($form, $form_state);
   1.331 + 
   1.332 +@@ -323,7 +323,7 @@
   1.333 + /**
   1.334 +  * Form submission handler for diff_inline_form() for JS-disabled clients.
   1.335 +  */
   1.336 +-function diff_inline_form_submit(&$form, &$form_state) {
   1.337 ++function diff_inline_form_submit($form, $form_state) {
   1.338 +   if (isset($form_state['values']['revision'], $form_state['values']['node'])) {
   1.339 +     $node = $form_state['values']['node'];
   1.340 +     $vid = $form_state['values']['revision'];
   1.341 +

mercurial