Index: /trunk/include/category_default.inc.php
===================================================================
--- /trunk/include/category_default.inc.php	(revision 3125)
+++ /trunk/include/category_default.inc.php	(revision 3126)
@@ -28,6 +28,4 @@
  */
 
-$page['rank_of'] = array_flip($page['items']);
-
 $pictures = array();
 
@@ -40,4 +38,6 @@
 if (count($selection) > 0)
 {
+  $rank_of = array_flip($page['items']);
+
   $query = '
 SELECT *
@@ -54,4 +54,5 @@
 
   usort($pictures, 'rank_compare');
+  unset($rank_of);
 }
 
Index: /trunk/include/common.inc.php
===================================================================
--- /trunk/include/common.inc.php	(revision 3125)
+++ /trunk/include/common.inc.php	(revision 3126)
@@ -234,5 +234,8 @@
 // default event handlers
 add_event_handler('render_category_literal_description', 'render_category_literal_description');
-add_event_handler('render_category_description', 'render_category_description');
+if ( !$conf['allow_html_descriptions'] )
+{
+  add_event_handler('render_category_description', 'nl2br');
+}
 add_event_handler('render_comment_content', 'htmlspecialchars');
 add_event_handler('render_comment_content', 'parse_comment_content');
Index: /trunk/include/functions_html.inc.php
===================================================================
--- /trunk/include/functions_html.inc.php	(revision 3125)
+++ /trunk/include/functions_html.inc.php	(revision 3126)
@@ -24,5 +24,5 @@
 function get_icon($date, $is_child_date = false)
 {
-  global $page, $user;
+  global $cache, $user;
 
   if (empty($date))
@@ -31,23 +31,23 @@
   }
 
-  if (isset($page['get_icon_cache'][$date]))
-  {
-    if (! $page['get_icon_cache'][$date] )
+  if (isset($cache['get_icon'][$date]))
+  {
+    if (! $cache['get_icon'][$date] )
       return '';
-    return $page['get_icon_cache']['_icons_'][$is_child_date];
-  }
-
-  if (!isset($page['get_icon_cache']['sql_recent_date']))
+    return $cache['get_icon']['_icons_'][$is_child_date];
+  }
+
+  if (!isset($cache['get_icon']['sql_recent_date']))
   {
     // Use MySql date in order to standardize all recent "actions/queries"
-    list($page['get_icon_cache']['sql_recent_date']) =
+    list($cache['get_icon']['sql_recent_date']) =
       mysql_fetch_array(pwg_query('select SUBDATE(
       CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'));
   }
 
-  $page['get_icon_cache'][$date] = false;
-  if ( $date > $page['get_icon_cache']['sql_recent_date'] )
-  {
-    if ( !isset($page['get_icon_cache']['_icons_'] ) )
+  $cache['get_icon'][$date] = false;
+  if ( $date > $cache['get_icon']['sql_recent_date'] )
+  {
+    if ( !isset($cache['get_icon']['_icons_'] ) )
     {
       $icons = array(false => 'recent', true => 'recent_by_child' );
@@ -63,13 +63,13 @@
         $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;';
         $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />';
-        $page['get_icon_cache']['_icons_'][$key] = $output;
+        $cache['get_icon']['_icons_'][$key] = $output;
       }
     }
-    $page['get_icon_cache'][$date] = true;
-  }
-
-  if (! $page['get_icon_cache'][$date] )
+    $cache['get_icon'][$date] = true;
+  }
+
+  if (! $cache['get_icon'][$date] )
     return '';
-  return $page['get_icon_cache']['_icons_'][$is_child_date];
+  return $cache['get_icon']['_icons_'][$is_child_date];
 }
 
@@ -777,17 +777,4 @@
 }
 
-/** returns the category comment for rendering in html.
- * this is an event handler. don't call directly
- */
-function render_category_description($desc)
-{
-  global $conf;
-  if ( !$conf['allow_html_descriptions'] )
-  {
-    $desc = nl2br($desc);
-  }
-  return $desc;
-}
-
 /** returns the category comment for rendering in html textual mode (subcatify)
  * this is an event handler. don't call directly
Index: /trunk/include/functions_url.inc.php
===================================================================
--- /trunk/include/functions_url.inc.php	(revision 3125)
+++ /trunk/include/functions_url.inc.php	(revision 3126)
@@ -39,5 +39,5 @@
     $root_url = PHPWG_ROOT_PATH;
   }
-  if ( dirname($root_url)!='.' )
+  if ( strncmp($root_url, './', 2) != 0 )
   {
     return $root_url;
@@ -171,19 +171,9 @@
   global $page;
 
-  if (count($removed) > 0)
-  {
-    $params = array();
-
-    foreach ($page as $page_item_key => $page_item_value)
-    {
-      if (!in_array($page_item_key, $removed))
-      {
-        $params[$page_item_key] = $page_item_value;
-      }
-    }
-  }
-  else
-  {
-    $params = $page;
+  $params = $page;
+
+  foreach ($removed as $param_key)
+  {
+    unset($params[$param_key]);
   }
 
@@ -723,5 +713,16 @@
 function embellish_url($url)
 {
-  return str_replace('/./', '/', $url);
+  $url = str_replace('/./', '/', $url);
+  while ( ($dotdot = strpos($url, '/../', 1) ) !== false )
+  {
+    $before = strrpos($url, '/', -(strlen($url)-$dotdot+1) );
+    if ($before !== false)
+    {
+      $url = substr_replace($url, '', $before, $dotdot-$before+3);
+    }
+    else
+      break;
+  }
+  return $url;
 }
 
Index: /trunk/include/functions_user.inc.php
===================================================================
--- /trunk/include/functions_user.inc.php	(revision 3125)
+++ /trunk/include/functions_user.inc.php	(revision 3126)
@@ -761,26 +761,26 @@
 function get_default_user_info($convert_str = true)
 {
-  global $page, $conf;
-
-  if (!isset($page['cache_default_user']))
-  {
-    $query = 'select * from '.USER_INFOS_TABLE.
-            ' where user_id = '.$conf['default_user_id'].';';
+  global $cache, $conf;
+
+  if (!isset($cache['default_user']))
+  {
+    $query = 'SELECT * FROM '.USER_INFOS_TABLE.
+            ' WHERE user_id = '.$conf['default_user_id'].';';
 
     $result = pwg_query($query);
-    $page['cache_default_user'] = mysql_fetch_assoc($result);
-
-    if ($page['cache_default_user'] !== false)
-    {
-      unset($page['cache_default_user']['user_id']);
-      unset($page['cache_default_user']['status']);
-      unset($page['cache_default_user']['registration_date']);
-    }
-  }
-
-  if (is_array($page['cache_default_user']) and $convert_str)
+    $cache['default_user'] = mysql_fetch_assoc($result);
+
+    if ($cache['default_user'] !== false)
+    {
+      unset($cache['default_user']['user_id']);
+      unset($cache['default_user']['status']);
+      unset($cache['default_user']['registration_date']);
+    }
+  }
+
+  if (is_array($cache['default_user']) and $convert_str)
   {
     $default_user = array();
-    foreach ($page['cache_default_user'] as $name => $value)
+    foreach ($cache['default_user'] as $name => $value)
     {
       // If the field is true or false, the variable is transformed into a
@@ -799,5 +799,5 @@
   else
   {
-    return $page['cache_default_user'];
+    return $cache['default_user'];
   }
 }
