cvs diff: Diffing .
? .project
Index: dropbox.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/dropbox/dropbox.info,v
retrieving revision 1.3
diff -u -p -r1.3 dropbox.info
--- dropbox.info	20 Jul 2009 19:01:32 -0000	1.3
+++ dropbox.info	31 Jul 2009 01:37:08 -0000
@@ -2,3 +2,4 @@
 name = Dropbox Integration
 description = Allows users have files sent to their Dropbox account.
 core=6.x
+dependencies[] = securepages
Index: dropbox.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/dropbox/dropbox.module,v
retrieving revision 1.7
diff -u -p -r1.7 dropbox.module
--- dropbox.module	20 Jul 2009 19:01:32 -0000	1.7
+++ dropbox.module	31 Jul 2009 01:37:08 -0000
@@ -168,9 +168,9 @@ function dropbox_settings_form(&$edit) {
   }
   else {
     $no_ssl = t('You must connect over an SSL connection to view or change your Dropbox account settings.');
-    if (dropbox_securepages_test()) {
+    if (securepages_test()) {
       $path = !empty($_REQUEST['q']) ? $_REQUEST['q'] : '';
-      $secure_version = dropbox_securepages_url($path, array('secure' => TRUE));
+      $secure_version = securepages_url($path, array('secure' => TRUE));
       $no_ssl .= ' ' . t('Try <a href="@secure">connecting securely</a> to view these settings.', array('@secure' => $secure_version));
     }
     else {
@@ -422,155 +422,3 @@ function _dropbox_send_enabled($destinat
   }
   return FALSE;
 }
-
-/**
- * Secure Pages SSL Test (from securepages.module)
- */
-function dropbox_securepages_test() {
-  $url = 'https://'. preg_replace(';^http[s]?://;s', '', url('admin', array('absolute' => TRUE)));
-  $response = drupal_http_request($url);
-  return $response->code == 200 ? TRUE : FALSE;
-}
-
-/**
- * Generate a URL from a Drupal menu path. Will also pass-through existing URLs.
- *
- * @param $path
- *   The Drupal path being linked to, such as "admin/content/node", or an
- *   existing URL like "http://drupal.org/".  The special path
- *   '<front>' may also be given and will generate the site's base URL.
- * @param $options
- *   An associative array of additional options, with the following keys:
- *   - 'query'
- *       A query string to append to the link, or an array of query key/value
- *       properties.
- *   - 'fragment'
- *       A fragment identifier (or named anchor) to append to the link.
- *       Do not include the '#' character.
- *   - 'alias' (default FALSE)
- *       Whether the given path is an alias already.
- *   - 'external'
- *       Whether the given path is an external URL.
- *   - 'language'
- *       An optional language object. Used to build the URL to link to and
- *       look up the proper alias for the link.
- *   - 'base_url'
- *       Only used internally, to modify the base URL when a language dependent
- *       URL requires so.
- *   - 'prefix'
- *       Only used internally, to modify the path when a language dependent URL
- *       requires so.
- *   - 'secure'
- *       Specifies if the secure or insecure url should be returned.
- * @return
- *   A string containing a URL to the given path.
- *
- * When creating links in modules, consider whether l() could be a better
- * alternative than url().
- */
-function dropbox_securepages_url($path = NULL, $options = array()) {
-  // Merge in defaults.
-  $options += array(
-    'fragment' => '',
-    'query' => '',
-    'alias' => FALSE,
-    'prefix' => '',
-    'secure' => TRUE,
-  );
-  if (!isset($options['external'])) {
-    // Return an external link if $path contains an allowed absolute URL.
-    // Only call the slow filter_xss_bad_protocol if $path contains a ':' before
-    // any / ? or #.
-    $colonpos = strpos($path, ':');
-    $options['external'] = ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && filter_xss_bad_protocol($path, FALSE) == check_plain($path));
-  }
-
-  // May need language dependent rewriting if language.inc is present.
-  if (function_exists('language_url_rewrite')) {
-    language_url_rewrite($path, $options);
-  }
-  if ($options['fragment']) {
-    $options['fragment'] = '#'. $options['fragment'];
-  }
-  if (is_array($options['query'])) {
-    $options['query'] = drupal_query_string_encode($options['query']);
-  }
-
-  if ($options['external']) {
-    // Split off the fragment.
-    if (strpos($path, '#') !== FALSE) {
-      list($path, $old_fragment) = explode('#', $path, 2);
-      if (isset($old_fragment) && !$options['fragment']) {
-        $options['fragment'] = '#'. $old_fragment;
-      }
-    }
-    // Append the query.
-    if ($options['query']) {
-      $path .= (strpos($path, '?') !== FALSE ? '&' : '?') . $options['query'];
-    }
-    // Reassemble.
-    return $path . $options['fragment'];
-  }
-
-  global $base_url;
-  static $script;
-  static $clean_url;
-
-  if (!isset($script)) {
-    // On some web servers, such as IIS, we can't omit "index.php". So, we
-    // generate "index.php?q=foo" instead of "?q=foo" on anything that is not
-    // Apache.
-    $script = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE) ? 'index.php' : '';
-  }
-
-  // Cache the clean_url variable to improve performance.
-  if (!isset($clean_url)) {
-    $clean_url = (bool)variable_get('clean_url', '0');
-  }
-
-  if (!isset($options['base_url'])) {
-    // The base_url might be rewritten from the language rewrite in domain mode.
-    $options['base_url'] = securepages_baseurl($options['secure']);
-  }
-
-  // Preserve the original path before aliasing.
-  $original_path = $path;
-
-  // The special path '<front>' links to the default front page.
-  if ($path == '<front>') {
-    $path = '';
-  }
-  elseif (!empty($path) && !$options['alias'] && function_exists('drupal_get_path_alias')) {
-    $path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
-  }
-
-  $base = $options['base_url'] .'/';
-  $prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix'];
-  $path = securepages_urlencode($prefix . $path);
-
-  if ($clean_url) {
-    // With Clean URLs.
-    if ($options['query']) {
-      return $base . $path .'?'. $options['query'] . $options['fragment'];
-    }
-    else {
-      return $base . $path . $options['fragment'];
-    }
-  }
-  else {
-    // Without Clean URLs.
-    $variables = array();
-    if (!empty($path)) {
-      $variables[] = 'q='. $path;
-    }
-    if (!empty($options['query'])) {
-      $variables[] = $options['query'];
-    }
-    if ($query = join('&', $variables)) {
-      return $base . $script .'?'. $query . $options['fragment'];
-    }
-    else {
-      return $base . $options['fragment'];
-    }
-  }
-}
