Minor issues when in printing links at bottom of page

jdmquin - March 11, 2005 - 02:10
Project:Printer, e-mail and PDF versions
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:peterjohnhartman
Status:closed
Description

There a two minor issues when printing links at the bottom of the page.

1. mailto links get the base_url in front of them
2. If your not using clean urls then the ?q= is printed twice.

I'm no programmer, but I made the following changes to the print_friendly_urls function to fix these issues.

Original code

  if ($url) {
    $urls[] = strpos($url, '://') ? $url : $base_url. '/'. url($url);
    return count($urls);
  }

New code
  if ($url) {
/*   $urls[] = strpos($url, '://') ? $url : $base_url. '/'. url($url); */
     if (strpos($url, '://') | strpos($url, 'to:')) {
        $urls[] = $url;
        } else {
        $urls[] = $base_url. '/'. $url;
        }
    return count($urls);
  }

Thanks

#1

deekayen - December 20, 2005 - 20:04
Version:<none>» 7.x-1.x-dev
Status:active» needs review

function print_friendly_urls($url = 0) {
  global $base_url;
  static $urls = array();
  if ($url) {
    if(strpos($url, '://') || preg_match("/^mailto:.*?@.*?\..*?$/iu", $url)) {
      $urls[] = $url;
    } else {
      $base_url. '/'. url($url);
    }
    return count($urls);
  }
  return $urls;
}

#2

deekayen - December 20, 2005 - 20:23
Status:needs review» fixed

committed to cvs

#3

peterjohnhartman - December 30, 2005 - 18:21
Assigned to:Anonymous» peterjohnhartman

commited to DRUPAL-4-7.

#4

Anonymous - January 13, 2006 - 18:41
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.