--- common.inc	2005-08-31 15:00:03.000000000 -0500
+++ common.new	2005-09-12 14:02:27.000000000 -0500
@@ -1568,68 +1568,52 @@
  * @param $absolute
  *   Whether to force the output to be an absolute link (beginning with http:).
  *   Useful for links that will be displayed outside the site, such as in an RSS feed.
+ * @param $external
+ *   Whether to render $path as is.
+ *   Useful for module developers who need to link to extenal sites.
  * @return
- *   an HTML string containing a link to the given path.
+ *   an string which is a link to the given path.
  *
  * When creating links in modules, consider whether l() could be a better
  * alternative than url().
  */
-function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
+function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE, $external = FALSE) {
   global $base_url;
 
-  static $script;
-
-  if (empty($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' : '';
-  }
-
-  $path = drupal_get_path_alias($path);
-
-  if (isset($fragment)) {
-    $fragment = '#'. $fragment;
+  if ($external) {
+    //set the url
+    $url = $path;
   }
+  else {
 
-  $base = ($absolute ? $base_url .'/' : '');
+    // return value for clean urls
+    $clean = variable_get('clean_url', '0');
 
-  if (variable_get('clean_url', '0') == '0') {
-    if (isset($path)) {
-      if (isset($query)) {
-        return $base . $script .'?q='. $path .'&'. $query . $fragment;
-      }
-      else {
-        return $base . $script .'?q='. $path . $fragment;
-      }
+   // test webserver and set script
+    static $script;
+    if (empty($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?q=' : '?q=';
     }
-    else {
-      if (isset($query)) {
-        return $base . $script .'?'. $query . $fragment;
-      }
-      else {
-        return $base . $fragment;
-      }
-    }
-  }
-  else {
-    if (isset($path)) {
-      if (isset($query)) {
-        return $base . $path .'?'. $query . $fragment;
-      }
-      else {
-        return $base . $path . $fragment;
-      }
-    }
-    else {
-      if (isset($query)) {
-        return $base . $script .'?'. $query . $fragment;
-      }
-      else {
-        return $base . $fragment;
-      }
+    
+    // set base
+    $base = $absolute ? $base_url . '/' : '';
+
+    // set the fragment
+    $fragment = isset($fragment) ? '#'.$fragment : '';
+
+    // set the query
+    if (isset($query)) {
+      $query = $clean ? '?'. $query : '&'. $query ;
     }
+
+    $url = $clean ? $base . $path : $base . $script . $path;
+
   }
+
+return $url.$query.$fragment;
 }
 
 /**
@@ -1671,12 +1655,15 @@
  * @param $absolute
  *   Whether to force the output to be an absolute link (beginning with http:).
  *   Useful for links that will be displayed outside the site, such as in an RSS feed.
+ * @param $external
+ *   Whether to render $path as is.
+ *   Useful for module developers who need to link to extenal sites.
  * @param $html
  *   Whether the title is HTML, or just plain-text.
  * @return
  *   an HTML string containing a link to the given path.
  */
-function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE) {
+function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE, $external = FALSE) {
   if ($path == $_GET['q']) {
     if (isset($attributes['class'])) {
       $attributes['class'] .= ' active';
@@ -1685,7 +1672,7 @@
       $attributes['class'] = 'active';
     }
   }
-  return '<a href="'. check_url(url($path, $query, $fragment, $absolute)) .'"'. drupal_attributes($attributes) .'>'. ($html ? $text : check_plain($text)) .'</a>';
+  return '<a href="'. check_url(url($path, $query, $fragment, $absolute, $external)) .'"'. drupal_attributes($attributes) .'>'. ($html ? $text : check_plain($text)) .'</a>';
 }
 
 /**
