? modules/comment/comment-node-type-form.js
? sites/default/files
? sites/default/settings.php
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 06:18:29 -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 in the case of 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'];
+}
Index: modules/simpletest/tests/path.test
===================================================================
RCS file: modules/simpletest/tests/path.test
diff -N modules/simpletest/tests/path.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/path.test	26 Apr 2009 06:18:29 -0000
@@ -0,0 +1,46 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Provides SimpleTests for core path handling functionality.
+ */
+
+class PathsTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  public static function getInfo() {
+    return array (
+      'name'=>t('Path'),
+      'description'=>t('Test overall functionality of the path system.'),
+      'group'=>t('Path'),
+    );
+  }
+
+  /**
+   * Test integrity of current_path() function
+   */
+  function testCurrentPath() {
+    // Initialize series of comparisons between current_path and $_GET['q'] for various paths
+    $_GET['q'] = "/";
+    $this->assertEqual(current_path(), $_GET['q'], t('Test integrity of current_path() compared with backslash'));
+    $_GET['q'] = "";
+    $this->assertEqual(current_path(), $_GET['q'], t('Test integrity of current_path() compared with empty string'));
+    $_GET['q'] = "node/".rand(5, 15);
+    $this->assertEqual(current_path(), $_GET['q'], t('Test integrity of current_path() compared with random node path'));
+
+    // Generate a random string for comparison
+    $rand_str = "";
+    $possible = "0123456789bcdfghjkmnpqrstvwxyz";
+    for ($count = 0; $count < 10; $count++) {
+      $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
+      $rand_str .= $char;
+    }
+
+    $_GET['q'] = $rand_str;
+    $this->assertEqual(current_path(), $_GET['q'], t('Test integrity of current_path() compared with random string path'));
+  }
+
+}
+
