Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.33
diff -u -p -r1.33 path.inc
--- includes/path.inc	3 Apr 2009 17:41:32 -0000	1.33
+++ includes/path.inc	26 Apr 2009 04:13:22 -0000
@@ -262,3 +262,31 @@ function drupal_match_path($path, $patte
   }
   return (bool)preg_match($regexps[$patterns], $path);
 }
+ 
+/**
+ * Returns the current URL path of the page being viewed.
+ *
+ * Example #1: For a user viewing http://example.com/node/306 this function
+ * would return "node/306".
+ *
+ * Example #2: When viewing http://example.com/drupalfolder/node/306 this
+ * function would still return "node/306" and base_path() would return
+ * "/drupalfolder/".
+ *
+ * Example #3: When viewing "http://example.com/path/alias" and is a path
+ * alias for "http://example.com/node/306", then on viewing
+ * "http://example.com/path/alias", this function would still return
+ * "node/306".
+ *
+ * NOTE: This function is not available in hook_boot and you should use
+ * $_GET['q'] instead. Also, be careful for Example #3 if you use it
+ * in hook_boot as it will contain "path/alias". Calling
+ * drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH) makes this
+ * function available with a return value of "node/306".
+ *
+ * @return
+ *   The current Drupal path.
+ */
+function current_path() {
+  return $_GET['q'];
+}
