Index: trunk/admin/category/addpermission.php
===================================================================
diff -u -r2569 -r2853
--- trunk/admin/category/addpermission.php	(.../addpermission.php)	(revision 2569)
+++ trunk/admin/category/addpermission.php	(.../addpermission.php)	(revision 2853)
@@ -12,82 +12,14 @@
 ##	   result in revocation of the license and support		##
 ##	 privileges along maximum prosecution allowed by law.	##
 ##############################################################
-if( !(isset($pathtoroot) && $pathtoroot) )
-{
-  $path=dirname(realpath(__FILE__));
-  if(strlen($path))
-  {
-    /* determine the OS type for path parsing */
-    $pos = strpos($path,":");
-    if ($pos === false)
-    {
-      $gOS_TYPE="unix";
-      $pathchar = "/";
-    }
-    else
-    {
-      $gOS_TYPE="win";
-      $pathchar="\\";
-    }
-    $p = $path.$pathchar;
-    /*Start looking for the root flag file */
-    if( !isset($pathtoroot) ) $pathtoroot = '';
-    while(!strlen($pathtoroot) && strlen($p))
-    {
-      $sub = substr($p,strlen($pathchar)*-1);
-      if($sub==$pathchar)
-      {
-        $filename = $p."root.flg";
-      }
-      else
-        $filename = $p.$pathchar."root.flg";
-      if(file_exists($filename))
-      {
-        $pathtoroot = $p;
-      }
-      else
-      {
-        $parent = realpath($p.$pathchar."..".$pathchar);
-	if($parent!=$p)
-	{
-	  $p = $parent;
-	}
-	else
-	  $p = "";
-      }
-    }
-    if( !(isset($pathtoroot) && $pathtoroot) )
-      $pathtoroot = ".".$pathchar;
-  }
-  else
-  {
-    $pathtoroot = ".".$pathchar;
-  }
-}
 
-$sub = substr($pathtoroot,strlen($pathchar)*-1);
-if($sub!=$pathchar)
-{
-  $pathtoroot = $pathtoroot.$pathchar;
-}
+// new startup: begin
+define('REL_PATH', 'admin/category');
+$relation_level = count( explode('/', REL_PATH) );
+define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
+require_once FULL_PATH.'/kernel/startup.php';
+// new startup: end
 
-require_once($pathtoroot."kernel/startup.php");
-
-//admin only util
-$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
-$admin = $objConfig->Get("AdminDirectory");
-if(!strlen($admin))
-    $admin = "admin";
-
-$localURL=$rootURL."kernel/";
-$adminURL = $rootURL.$admin;
-
-$imagesURL = $adminURL."/images"; 
-$cssURL = $adminURL."/include";
-
-$browseURL = $adminURL."/browse";
-
-//$pathtolocal = $pathtoroot."in-news/";
 require_once ($pathtoroot.$admin."/include/elements.php"); 
 require_once ($pathtoroot."kernel/admin/include/navmenu.php"); 
 //require_once ($pathtolocal."admin/include/navmenu.php");