There is a call to a now deprecated function drupal_query_string_encode() on line 185 of mobile_tools.module. This function has now been replaced by drupal_http_build_query() with a requirement to run the $_GET array through another new module drupal_get_query_parameters(). This is detailed here: http://drupal.org/update/modules/6/7#get_querystring

So line 185 currently reads:

$query = drupal_query_string_encode($query, array('q'));

Is now:

$query = drupal_http_build_query(drupal_get_query_parameters($_GET, array('q', 'page')));

Paul

Comments

paul_gregory’s picture

My mistake, I messed up the replacement line. The function drupal_http_build_query() is called later by url() so isn't needed here and the 'q' part of the query string is removed by default by drupal_get_query_parameters() so the new line should really be:

$query = drupal_get_query_parameters($query);

Paul

mgifford’s picture

That allowed me to login.

So with this the whole function should be:


function mobile_tools_block_message() {
  $site = mobile_tools_site_type();
  if ($site  == 'mobile' ) {
    $output = variable_get('mobile_notification', MOBILE_NOTIFICATION);
    $query = $_GET;
    $query['device'] = 'desktop';
    $query = drupal_get_query_parameters($query);
    $url = url($_GET['q'], array('query' => $query));
    $desktop_url = variable_get('mobile_tools_desktop_url', '') . $url;
    $output = t($output, array('!desktop_url' => $desktop_url));
    return $output;
  }
  elseif($site == 'desktop') {
    $output = variable_get('desktop_notification', DESKTOP_NOTIFICATION);
    $query = $_GET;
    $query['device'] = 'mobile';
    $query = drupal_get_query_parameters($query);
    $url = url($_GET['q'], array('query' => $query));
    $mobile_url = variable_get('mobile_tools_mobile_url', '') . $url;
    $output = t($output, array('!mobile_url' => $mobile_url));
    return $output;
  }
}
minoroffense’s picture

Assigned: Unassigned » minoroffense
Status: Active » Needs work

The code works but needs a little tweak.

You should pass all the parts of the URL through url() and not just append the generated query path to the string. If someone is using url_outbound_alter (or whatever that hook is) they won't be able to properly rewrite the entire link.

An example usage would be if someone needed to rewrite all links to be https vs http instead. I've had to do that in the past with Drupal behind a reverse proxy with ssl termination.

Anyways, if you can update the code to ensure everything is passed through url() we'll be good to go.

Thanks!

devin carlson’s picture

Status: Needs work » Closed (won't fix)

The 7.x-2.x branch of Mobile Tools in now unsupported.