Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.613
diff -u -p -r1.613 common.inc
--- includes/common.inc	24 Jan 2007 14:48:35 -0000	1.613
+++ includes/common.inc	27 Jan 2007 23:42:40 -0000
@@ -2228,3 +2228,49 @@ function int2vancode($i = 0) {
   $length = strlen($num);
   return chr($length + ord('0') - 1) . $num;
 }
+
+/**
+ * Set a variable in the page context, which is a bucket of information Drupal
+ * keeps about the currently viewed page.
+ *
+ * @param $variable
+ *   The variable name to set. If this is NULL the cached context will be
+ *   returned.
+ * @param $value
+ *   The value to set the variable to.
+ *
+ * @see drupal_get_page_context()
+ *
+ */
+function drupal_set_page_context($variable = NULL, $value = NULL) {
+  static $context = array();
+  if ($variable === NULL) {
+    return $context;
+  }
+
+  $context[$variable] = $value;
+  return TRUE;
+}
+
+/**
+ * Get a variable from the page context.
+ *
+ * Drupal defines the following context systems:
+ * 'node' -- if the current page is viewing, editing or directly
+ *   dealing with a node, this will be the node object.
+ * 'user' -- if the current page is viewing or editing a user, user's
+ *   profile, this will contain the user object.
+ *
+ * @param $variable
+ *   The variable name to set. If this is NULL the cached context will be
+ *   returned.
+ */
+function drupal_get_page_context($variable = NULL) {
+  $context = drupal_get_page_context();
+
+  if ($variable === NULL) {
+    return $context;
+  }
+  
+  return $context[$variable];
+}
