Index: trunk/kernel/startup.php =================================================================== diff -u -r2772 -r2853 --- trunk/kernel/startup.php (.../startup.php) (revision 2772) +++ trunk/kernel/startup.php (.../startup.php) (revision 2853) @@ -1,25 +1,55 @@ $v) -// $a[$k]=is_array($v)?stripSlashesA($v):stripslashes($v); -// return $a; -// } -// foreach(Array( -// 'HTTP_GET_VARS','HTTP_POST_VARS','HTTP_COOKIE_VARS','HTTP_SESSION_VARS','HTTP_SERVER_VARS','$HTTP_POST_FILES', -// '_POST','_GET','_COOKIE','_SESSION','_SERVER','_FILES','_REQUEST') as $_) -// if(isset($GLOBALS[$_])) -// $GLOBALS[$_]=stripSlashesA($GLOBALS[$_]); -//} + if( !defined('FULL_PATH') ) define('FULL_PATH', realpath(dirname(__FILE__).'/..') ); + + require_once FULL_PATH.'/globals.php'; + + if( !isset($FrontEnd) ) $FrontEnd = 0; + # New path detection method: begin +// safeDefine('REL_PATH', '/admin'); + $k4_path_detection = false; + if( defined('REL_PATH') ) + { + $ps = preg_replace("/".preg_quote(rtrim(REL_PATH, '/'), '/')."$/", '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))); + safeDefine('BASE_PATH', $ps); // in case in-portal has defined it before + # New path detection method: end + + // KENEL4 INIT: BEGIN + if($FrontEnd != 1 && !defined('ADMIN') ) define('ADMIN', 1); + + + define('APPLICATION_CLASS', 'MyApplication'); + include_once(FULL_PATH.'/kernel/kernel4/startup.php'); + + // just to make sure that this is correctly detected + if( defined('DEBUG_MODE') && DEBUG_MODE ) $debugger->appendHTML('FULL_PATH: '.FULL_PATH.''); + + $application =& kApplication::Instance(); + $application->Init(); + + // compatibility constants + $g_TablePrefix = TABLE_PREFIX; + $pathtoroot = FULL_PATH.'/'; + + $admin = 'admin'; + $rootURL = PROTOCOL.SERVER_NAME.(defined('PORT')?':'.PORT : '').BASE_PATH.'/'; + $localURL = $rootURL.'kernel/'; + $adminURL = $rootURL.$admin; + $imagesURL = $adminURL.'/images'; + $browseURL = $adminURL.'/browse'; + $cssURL = $adminURL.'/include'; + // KERNEL4 INIT: END + $k4_path_detection = true; + } + if(!get_magic_quotes_gpc()) { function addSlashesA($a) { - foreach($a as $k=>$v) - $a[$k]=is_array($v)?addSlashesA($v):addslashes($v); + foreach($a as $k => $v) + { + $a[$k] = is_array($v) ? addSlashesA($v) : addslashes($v); + } return $a; } foreach(Array( @@ -28,19 +58,11 @@ if(isset($GLOBALS[$_])) $GLOBALS[$_]=addSlashesA($GLOBALS[$_]); } -function inp_htmlize($var,$strip=0) -{ - if(is_array($var)) - foreach($var as $k=>$v) - $var[$k]=inp_htmlize($v,$strip); - else - $var=htmlspecialchars($strip?stripslashes($var):$var); - return $var; -} /* startup.php: this is the primary startup sequence for in-portal services */ + if( file_exists($pathtoroot.'debug.php') && !defined('DEBUG_MODE') ) include_once($pathtoroot.'debug.php'); if( !defined('DEBUG_MODE') ) error_reporting(0); @@ -53,7 +75,7 @@ /* include PHP version compatibility functions */ require_once($pathtoroot."compat.php"); /* set global variables and module lists */ -require_once($pathtoroot."globals.php"); + include_once($pathtoroot.'kernel/include/'.( IsDebugMode() ? 'debugger.php' : 'debugger_dummy.php') ); // put all non-checked checkboxes in $_POST & $_REQUEST with 0 values @@ -181,16 +203,7 @@ if (strstr(__FILE__, $adminDir) && !GetVar('logout') && !strstr(__FILE__, "install") && !strstr(__FILE__, "index")) { //echo "testz [".admin_login()."]
"; - - if (!admin_login()) - { - if( !headers_sent() ) setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - $url_add = isset($_GET['expired']) && $_GET['expired'] ? '?expired=1' : ''; - header("Location: ".$adminURL.'/index.php'.$url_add); - die(); - //require_once($pathtoroot."admin/login.php"); - } + require_login(null, 'expired='.(int)GetVar('expired') ); } ?> \ No newline at end of file