Index: trunk/admin/index.php =================================================================== diff -u -r3282 -r3866 --- trunk/admin/index.php (.../index.php) (revision 3282) +++ trunk/admin/index.php (.../index.php) (revision 3866) @@ -12,106 +12,31 @@ ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## -$pathtoroot = ""; -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; - } -} -if (!file_exists($pathtoroot."/config.php")) { - echo "In-Portal is probably not installed, or configuration file is missing.
"; - echo "Please use the installation script to fix the problem.

"; - echo "Go to installation script

"; - flush(); - die(); -} + // new startup: begin + define('REL_PATH', 'admin'); + $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 -$sub = substr($pathtoroot,strlen($pathchar)*-1); -if($sub!=$pathchar) -{ - $pathtoroot = $pathtoroot.$pathchar; -} + $objConfig->Set('AdminDirectory', $admin, 0, true); + $objConfig->Save(); -//echo "
"; print_r($_POST); echo "
"; -require_once($pathtoroot."/kernel/startup.php"); + if (!admin_login() || GetVar('logout') || GetVar('expired') ) { + if (!headers_sent()) { + set_cookie(SESSION_COOKIE_NAME, '', adodb_mktime() - 3600); + } + $objSession->Logout(); + require_once FULL_PATH.'/admin/login.php'; + } -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); -$admin = substr($path,strlen($pathtoroot)); -$objConfig->Set("AdminDirectory",$admin,0,TRUE); -$objConfig->Save(); + $envar = 'env='.BuildEnv(); -//echo "Setting admin to $admin
\n"; -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; -$browseURL = $adminURL."/browse"; -$cssURL = $adminURL."/include"; + require_once FULL_PATH.'/admin/include/elements.php'; + require_once FULL_PATH.'/kernel/admin/include/navmenu.php'; - -// !admin_login() - admin, but not logged in - -if (!admin_login() || GetVar('logout') || GetVar('expired') ) -{ - if( !headers_sent() ) set_cookie(SESSION_COOKIE_NAME, '', adodb_mktime() - 3600); - $objSession->Logout(); - require_once($pathtoroot.$admin.'/login.php'); -} - -$envar = "env=" . BuildEnv(); - -require_once ($pathtoroot.$admin."/include/elements.php"); -require_once ($pathtoroot."kernel/admin/include/navmenu.php"); - -$pathtolocal = $pathtoroot; -$charset = GetRegionalOption('Charset'); + $charset = GetRegionalOption('Charset'); ?> @@ -139,9 +64,8 @@ document.write(""); } - - - + + " name="main" marginwidth="0" marginheight="0" frameborder="NO" noresize scrolling="auto">