Index: trunk/core/kernel/startup.php =================================================================== diff -u -N -r2750 -r2853 --- trunk/core/kernel/startup.php (.../startup.php) (revision 2750) +++ trunk/core/kernel/startup.php (.../startup.php) (revision 2853) @@ -1,115 +1,106 @@ '; + echo 'Please use the installation script to fix the problem.

'; + if ( !preg_match('/admin/', __FILE__) ) $ins = '/admin'; + + echo 'Go to installation script

'; + flush(); + exit; + } -# /New method + define('SQL_TYPE', $vars['DBType']); + define('SQL_SERVER', $vars['DBHost']); + define('SQL_USER', $vars['DBUser']); + define('SQL_PASS', $vars['DBUserPassword']); + define('SQL_DB', $vars['DBName']); + define('TABLE_PREFIX', $vars['TablePrefix']); + define('DOMAIN', $vars['Domain']); -include_once(KERNEL_PATH.'/globals.php'); // non OOP functions used through kernel, e.g. print_pre + ini_set('memory_limit', '50M'); -safeDefine( 'INPORTAL_TAGS', true); -safeDefine( 'SERVER_NAME', $_SERVER['HTTP_HOST']); -safeDefine( 'KERNEL_PATH', FULL_PATH.'/kernel4'); -safeDefine( 'PROTOCOL', isset($_SERVER["HTTPS"]) ? 'https://' : 'http://'); + define('MODULES_PATH', FULL_PATH); + define('EXPORT_PATH', FULL_PATH.'/admin/export'); + define('GW_CLASS_PATH', MODULES_PATH.'/in-commerce/units/gateways/gw_classes'); // Payment Gateway Classes Path -$vars = parse_portal_ini(FULL_PATH.'/config.php'); + safeDefine('ENV_VAR_NAME','env'); + + k4_include_once(KERNEL_PATH.'/application.php'); + k4_include_once(MODULES_PATH.'/kernel/units/general/my_application.php'); -if($vars === false) -{ - global $rootURL; - echo 'In-Portal is probably not installed, or configuration file is missing.
'; - echo 'Please use the installation script to fix the problem.

'; - if ( !preg_match('/admin/', __FILE__) ) $ins = '/admin'; + if( file_exists(FULL_PATH.'/debug.php') ) + { + k4_include_once(FULL_PATH.'/debug.php'); + if( defined('DEBUG_MODE') && DEBUG_MODE ) include_once(KERNEL_PATH.'/utility/debugger.php'); + } - echo 'Go to installation script

'; - flush(); - exit; -} + k4_include_once(KERNEL_PATH.'/db/db_connection.php'); -define('SQL_TYPE', $vars['DBType']); -define('SQL_SERVER', $vars['DBHost']); -define('SQL_USER', $vars['DBUser']); -define('SQL_PASS', $vars['DBUserPassword']); -define('SQL_DB', $vars['DBName']); -define('TABLE_PREFIX', $vars['TablePrefix']); -define('DOMAIN', $vars['Domain']); + safeDefine('IMAGES_PATH', '/kernel/images/'); + safeDefine('IMAGES_PENDING_PATH', IMAGES_PATH.'pending/'); + safeDefine('CUSTOM_UPLOAD_PATH', '/templates/images/custom/'); + safeDefine('MAX_UPLOAD_SIZE', min(ini_get('upload_max_filesize'), ini_get('post_max_size'))*1024*1024); -ini_set('memory_limit', '50M'); + if( ini_get('safe_mode') ) define('SAFE_MODE', 1); -/*echo "FULL_PATH: ".FULL_PATH.'
'; -echo "BASE_PATH: ".BASE_PATH.'
';*/ + safeDefine('CACHE_CONFIGS_FILES', 1); + safeDefine('EXPERIMENTAL_PRE_PARSE', 1); + safeDefine('SILENT_LOG', 0); + + k4_include_once(KERNEL_PATH."/kbase.php"); + k4_include_once(KERNEL_PATH.'/utility/event.php'); + k4_include_once(KERNEL_PATH."/utility/factory.php"); + k4_include_once(KERNEL_PATH."/languages/phrases_cache.php"); + + // We should get rid of these includes: + k4_include_once(KERNEL_PATH."/db/dblist.php"); + k4_include_once(KERNEL_PATH."/db/dbitem.php"); + + k4_include_once(KERNEL_PATH.'/processors/tag_processor.php'); + k4_include_once(KERNEL_PATH."/db/db_tag_processor.php"); + + k4_include_once(KERNEL_PATH."/event_handler.php"); + k4_include_once(KERNEL_PATH.'/db/db_event_handler.php'); + k4_include_once(MODULES_PATH.'/kernel/units/general/inp_db_event_handler.php'); + + k4_include_once(KERNEL_PATH."/utility/temp_handler.php"); // needed because of static calls from kBase + // up to here -define('MODULES_PATH', FULL_PATH); -define('EXPORT_PATH', FULL_PATH.'/admin/export'); -define('GW_CLASS_PATH', MODULES_PATH.'/in-commerce/units/gateways/gw_classes'); // Payment Gateway Classes Path + // global constants + define('HAVING_FILTER', 1); + define('WHERE_FILTER', 2); + + define('FLT_TYPE_AND', 'AND'); + define('FLT_TYPE_OR', 'OR'); + + safeDefine('STATUS_DISABLED', 0); + safeDefine('STATUS_ACTIVE', 1); + safeDefine('STATUS_PENDING', 2); -safeDefine('ENV_VAR_NAME','env'); - -k4_include_once(KERNEL_PATH.'/application.php'); -k4_include_once(MODULES_PATH.'/kernel/units/general/my_application.php'); - -if( file_exists(FULL_PATH.'/debug.php') ) -{ - k4_include_once(FULL_PATH.'/debug.php'); - if( defined('DEBUG_MODE') && DEBUG_MODE ) include_once(KERNEL_PATH.'/utility/debugger.php'); -} - -k4_include_once(KERNEL_PATH.'/db/db_connection.php'); - -safeDefine('IMAGES_PATH', '/kernel/images/'); -safeDefine('IMAGES_PENDING_PATH', IMAGES_PATH.'pending/'); -safeDefine('CUSTOM_UPLOAD_PATH', '/templates/images/custom/'); -safeDefine('MAX_UPLOAD_SIZE', min(ini_get('upload_max_filesize'), ini_get('post_max_size'))*1024*1024); - -if( ini_get('safe_mode') ) define('SAFE_MODE', 1); - -safeDefine('CACHE_CONFIGS_FILES', 1); -safeDefine('EXPERIMENTAL_PRE_PARSE', 1); -safeDefine('SILENT_LOG', 0); - -k4_include_once(KERNEL_PATH."/kbase.php"); -k4_include_once(KERNEL_PATH.'/utility/event.php'); -k4_include_once(KERNEL_PATH."/utility/factory.php"); -k4_include_once(KERNEL_PATH."/languages/phrases_cache.php"); - -// We should get rid of these includes: -k4_include_once(KERNEL_PATH."/db/dblist.php"); -k4_include_once(KERNEL_PATH."/db/dbitem.php"); - -k4_include_once(KERNEL_PATH.'/processors/tag_processor.php'); -k4_include_once(KERNEL_PATH."/db/db_tag_processor.php"); - -k4_include_once(KERNEL_PATH."/event_handler.php"); -k4_include_once(KERNEL_PATH.'/db/db_event_handler.php'); -k4_include_once(MODULES_PATH.'/kernel/units/general/inp_db_event_handler.php'); - -k4_include_once(KERNEL_PATH."/utility/temp_handler.php"); // needed because of static calls from kBase -// up to here - -// global constants -define('HAVING_FILTER', 1); -define('WHERE_FILTER', 2); - -define('FLT_TYPE_AND', 'AND'); -define('FLT_TYPE_OR', 'OR'); - -safeDefine('STATUS_DISABLED', 0); -safeDefine('STATUS_ACTIVE', 1); -safeDefine('STATUS_PENDING', 2); - ?> \ No newline at end of file Index: trunk/admin/config/missing_label_edit.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/missing_label_edit.php (.../missing_label_edit.php) (revision 2569) +++ trunk/admin/config/missing_label_edit.php (.../missing_label_edit.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"; -//$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"); Index: trunk/admin/reviews.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/reviews.php (.../reviews.php) (revision 2772) +++ trunk/admin/reviews.php (.../reviews.php) (revision 2853) @@ -39,93 +39,13 @@ $b_topmargin = "0"; //$b_header_addon = "

"; -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; - } -} +require_once FULL_PATH.'/kernel/startup.php'; +require_login(); -$sub = substr($pathtoroot,strlen($pathchar)*-1); -if($sub!=$pathchar) -{ - $pathtoroot = $pathtoroot.$pathchar; -} -//echo $pathtoroot; - -require_once($pathtoroot."kernel/startup.php"); - -if (!admin_login()) -{ - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); -} - -$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"; -$browseURL = $adminURL."/browse"; -$cssURL = $adminURL."/include"; - $indexURL = $rootURL."index.php"; +$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');"; $m_var_list_update["cat"] = 0; -$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');"; unset($m_var_list_update["cat"]); //admin only util @@ -158,19 +78,9 @@ $$a_var = $application->ParseBlock(Array('name'=>$a_template), 0, true); } -if(!defined('IS_INSTALL'))define('IS_INSTALL',0); -if(!IS_INSTALL) -{ - if (!admin_login()) - { - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); - } -} +if( !defined('IS_INSTALL') ) define('IS_INSTALL', 0); +if( !IS_INSTALL ) require_login(); + //Set Section $section = 'in-portal:reviews'; Index: trunk/admin/config/edit_customfields.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/config/edit_customfields.php (.../edit_customfields.php) (revision 2772) +++ trunk/admin/config/edit_customfields.php (.../edit_customfields.php) (revision 2853) @@ -12,87 +12,16 @@ ## 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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"); +require_login(); -if (!admin_login()) -{ - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.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"; -//$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"); Index: trunk/admin/save_redirect.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/save_redirect.php (.../save_redirect.php) (revision 2772) +++ trunk/admin/save_redirect.php (.../save_redirect.php) (revision 2853) @@ -15,76 +15,15 @@ define('REDIRECT_REQUIRED', 1); - 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'); + $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'); + require_login(); - if( !admin_login() ) - { - if( !headers_sent() ) setcookie('sid',' ',time() - 3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - exit; - - } - /*$m = GetModuleArray(); foreach($m as $key=>$value) { Index: trunk/admin/relation_select.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/relation_select.php (.../relation_select.php) (revision 2569) +++ trunk/admin/relation_select.php (.../relation_select.php) (revision 2853) @@ -48,82 +48,8 @@ $b_header_addon = "
"; -//$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; - } -} +require_once(FULL_PATH.'/kernel/startup.php'); -$sub = substr($pathtoroot,strlen($pathchar)*-1); -if($sub!=$pathchar) -{ - $pathtoroot = $pathtoroot.$pathchar; -} -//echo $pathtoroot; - -require_once($pathtoroot."kernel/startup.php"); - -$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"; -$browseURL = $adminURL."/browse"; -$cssURL = $adminURL."/include"; - $m_var_list_update["cat"] = 0; $homeURL = $_SERVER["PHP_SELF"]."?env=".BuildEnv(); @@ -139,8 +65,6 @@ else $upURL = $_SERVER["PHP_SELF"]."?".$envar; - - //admin only util $pathtolocal = $pathtoroot."kernel/"; Index: trunk/core/units/phrases/phrases_event_handler.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/core/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 2772) +++ trunk/core/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 2853) @@ -67,7 +67,8 @@ $object->SetDBField('LastChangeIP', $ip_address); } - setcookie('last_module', $object->GetDBField('Module'), '', SERVER_NAME); + $cookie_path = $this->Application->IsAdmin() ? BASE_PATH.'/admin' : BASE_PATH; + setcookie('last_module', $object->GetDBField('Module'), $cookie_path, '.'.SERVER_NAME); } } Index: trunk/admin/users/adduser.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/adduser.php (.../adduser.php) (revision 2569) +++ trunk/admin/users/adduser.php (.../adduser.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/admin/config/edit_banlist.php =================================================================== diff -u -N -r2581 -r2853 --- trunk/admin/config/edit_banlist.php (.../edit_banlist.php) (revision 2581) +++ trunk/admin/config/edit_banlist.php (.../edit_banlist.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"; -//$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"); Index: trunk/admin/import/step1.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/import/step1.php (.../step1.php) (revision 2569) +++ trunk/admin/import/step1.php (.../step1.php) (revision 2853) @@ -1,74 +1,12 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/logs/searchlog.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/logs/searchlog.php (.../searchlog.php) (revision 2569) +++ trunk/admin/logs/searchlog.php (.../searchlog.php) (revision 2853) @@ -12,79 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/logs'); +$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"); - -$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"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); Index: trunk/admin/import/step2.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/import/step2.php (.../step2.php) (revision 2569) +++ trunk/admin/import/step2.php (.../step2.php) (revision 2853) @@ -1,76 +1,12 @@ Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$localURL=$rootURL."kernel/"; -$adminURL=$rootURL.$admin; -$imagesURL = $adminURL."/images"; -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/import/step3.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/import/step3.php (.../step3.php) (revision 2569) +++ trunk/admin/import/step3.php (.../step3.php) (revision 2853) @@ -1,76 +1,12 @@ Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$localURL=$rootURL."kernel/"; -$adminURL=$rootURL.$admin; -$imagesURL = $adminURL."/images"; - //admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); Index: trunk/admin/include/elements.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/include/elements.php (.../elements.php) (revision 2772) +++ trunk/admin/include/elements.php (.../elements.php) (revision 2853) @@ -13,20 +13,8 @@ ## privileges along maximum prosecution allowed by law. ## ############################################################## -if(!defined('IS_INSTALL'))define('IS_INSTALL',0); -if(!IS_INSTALL) -{ - if (!admin_login()) - { - if(!headers_sent()) { - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - } - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); - } -} +if( !defined('IS_INSTALL') ) define('IS_INSTALL', 0); +if( !IS_INSTALL ) require_login(); global $admin,$pathtoroot, $objConfig; Index: trunk/admin/import/step4.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/import/step4.php (.../step4.php) (revision 2569) +++ trunk/admin/import/step4.php (.../step4.php) (revision 2853) @@ -1,75 +1,12 @@ Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; //admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); Index: trunk/admin/users/group_addpermission.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/group_addpermission.php (.../group_addpermission.php) (revision 2569) +++ trunk/admin/users/group_addpermission.php (.../group_addpermission.php) (revision 2853) @@ -12,77 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/admin/users/user_select.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/users/user_select.php (.../user_select.php) (revision 2772) +++ trunk/admin/users/user_select.php (.../user_select.php) (revision 2853) @@ -12,94 +12,18 @@ ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## - define('IS_POPUP', 1); -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; - } -} +// new startup: begin +define('REL_PATH', 'admin/users'); +$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; -} -//echo $pathtoroot; +require_login(); -require_once($pathtoroot."kernel/startup.php"); - -if (!admin_login()) -{ - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); -} - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); - -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/logs/email_log.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/logs/email_log.php (.../email_log.php) (revision 2569) +++ trunk/admin/logs/email_log.php (.../email_log.php) (revision 2853) @@ -12,79 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/logs'); +$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"); - -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$adminURL = $rootURL.$admin; -$localURL=$rootURL."kernel/"; - -$imagesURL = $adminURL."/images"; - //admin only includes require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/config/edit_template.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/edit_template.php (.../edit_template.php) (revision 2569) +++ trunk/admin/config/edit_template.php (.../edit_template.php) (revision 2853) @@ -13,76 +13,13 @@ ## 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; - } -} +// new startup: begin +define('REL_PATH', 'admin/config'); +$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; -} -//echo $pathtoroot; - -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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/config/edit_label.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/edit_label.php (.../edit_label.php) (revision 2569) +++ trunk/admin/config/edit_label.php (.../edit_label.php) (revision 2853) @@ -12,77 +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; - } -} +// new startup: begin +define('REL_PATH', 'admin/config'); +$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; -} -//echo $pathtoroot; - -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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/config/addlang.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/addlang.php (.../addlang.php) (revision 2569) +++ trunk/admin/config/addlang.php (.../addlang.php) (revision 2853) @@ -1,5 +1,4 @@ Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; -$browseURL = $adminURL."/browse"; - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/config/addtheme_templates.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/addtheme_templates.php (.../addtheme_templates.php) (revision 2569) +++ trunk/admin/config/addtheme_templates.php (.../addtheme_templates.php) (revision 2853) @@ -13,80 +13,13 @@ ## 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; - } -} +// new startup: begin +define('REL_PATH', 'admin/config'); +$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; -} -//echo $pathtoroot; - - -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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/tree/tree.php =================================================================== diff -u -N -r2811 -r2853 --- trunk/admin/tree/tree.php (.../tree.php) (revision 2811) +++ trunk/admin/tree/tree.php (.../tree.php) (revision 2853) @@ -1,103 +1,22 @@ Get("Site_Path"); + include_once($pathtoroot.$admin."/include/sections.php"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$localURL=$rootURL."/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; - -$pathtolocal = $pathtoroot; - -$envar = "env=" . BuildEnv(); - -//include section data; create Section hash - -//main In-portal sections -//require_once ($pathtoroot."admin/include/navmenu.php"); - -//All modules -/*if(!isset($SysData)) - $SysData=new SystemConfiguration(); - -$ModuleList=$SysData->GetModuleList();*/ -//$sections = array(); - -//foreach($mod_prefix as $key => $value) -//{ -// $mod = $pathtoroot . $value . "admin/include/navmenu.php"; -// include_once($mod); -//} -include_once($pathtoroot.$admin."/include/sections.php"); - -$ServerName = $objConfig->Get("Site_Name"); -$rootLink = $adminURL."/subitems.php?env=".BuildEnv()."§ion=in-portal:root"; -$charset = GetRegionalOption('Charset'); + $ServerName = $objConfig->Get("Site_Name"); + $rootLink = $adminURL."/subitems.php?env=".BuildEnv()."§ion=in-portal:root"; + $charset = GetRegionalOption('Charset'); ?> Index: trunk/globals.php =================================================================== diff -u -N -r2320 -r2853 --- trunk/globals.php (.../globals.php) (revision 2320) +++ trunk/globals.php (.../globals.php) (revision 2853) @@ -56,7 +56,7 @@ } } -$vars = parse_portal_ini($pathtoroot."config.php"); +$vars = parse_portal_ini(FULL_PATH.'/config.php'); while($key = key($vars)) { @@ -1679,15 +1679,26 @@ } /** - * @return int - * @desc Checks for debug mode -*/ + * Checks if debug mode is active + * + * @return bool + */ function IsDebugMode() { return defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 ? 1 : 0; } /** + * Checks if we are in admin + * + * @return bool + */ +function IsAdmin() +{ + return defined('ADMIN') && constant('ADMIN') == 1 ? 1 : 0; +} + +/** * Two strings in-case-sensitive compare. * Returns >0, when string1 > string2, * <0, when string1 > string2, @@ -1851,5 +1862,66 @@ return 0; } } + + 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; + } + /** + * Sets in-portal cookies, that will not harm K4 to breath free :) + * + * @param string $name + * @param mixed $value + * @param int $expire + * @author Alex + */ + function set_cookie($name, $value, $expire = 0) + { + $cookie_path = IsAdmin() ? BASE_PATH.'/admin' : BASE_PATH; + setcookie($name, $value, $expire, $cookie_path, $_SERVER['HTTP_HOST']); + } + + /** + * If we are on login required template, but we are not logged in, then logout user + * + * @return bool + */ + function require_login($condition = null, $redirect_params = 'logout=1', $pass_env = false) + { + if( !isset($condition) ) $condition = !admin_login(); + if(!$condition) return false; + + global $objSession, $adminURL; + if( !headers_sent() ) set_cookie('sid', ' ', time() - 3600); + $objSession->Logout(); + if($pass_env) $redirect_params = 'env='.BuildEnv().'&'.$redirect_params; + + header('Location: '.$adminURL.'/index.php?'.$redirect_params); + exit; + } + + if( !function_exists('safeDefine') ) + { + /** + * Define constant if it was not already defined before + * + * @param string $const_name + * @param string $const_value + * @access public + */ + function safeDefine($const_name, $const_value) + { + if(!defined($const_name)) define($const_name,$const_value); + } + } + ?> Index: trunk/admin/config/edit_config.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/config/edit_config.php (.../edit_config.php) (revision 2772) +++ trunk/admin/config/edit_config.php (.../edit_config.php) (revision 2853) @@ -1,86 +1,14 @@ Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); -} +require_login(); -$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"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); //require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/users/adduser_custom.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/adduser_custom.php (.../adduser_custom.php) (revision 2569) +++ trunk/admin/users/adduser_custom.php (.../adduser_custom.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/category/addrelation.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addrelation.php (.../addrelation.php) (revision 2569) +++ trunk/admin/category/addrelation.php (.../addrelation.php) (revision 2853) @@ -12,80 +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; -} -//echo $pathtoroot; -require_once($pathtoroot."kernel/startup.php"); -//admin only util -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); +// 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 -$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."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); //require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/tools/server_info.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/tools/server_info.php (.../server_info.php) (revision 2569) +++ trunk/admin/tools/server_info.php (.../server_info.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/tools'); +$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"; -//$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"); Index: trunk/admin/config/module_email.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/config/module_email.php (.../module_email.php) (revision 2772) +++ trunk/admin/config/module_email.php (.../module_email.php) (revision 2853) @@ -1,5 +1,4 @@ Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/kernel/frontaction.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/kernel/frontaction.php (.../frontaction.php) (revision 2772) +++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 2853) @@ -34,7 +34,7 @@ $pw = $_POST["login_password"]; if(strlen($pw) < 31) $pw = md5($pw); $c .= $pw; - setcookie("login",$c,time()+2592000, '', $_SERVER['HTTP_HOST']); + set_cookie('login', $c, time() + 2592000); } // set new destination template if passed @@ -373,13 +373,7 @@ } break; - case "m_logout": -// $objSession->Logout(); - //unset($objSession); - //$objSession = new clsUserSession(); -// $var_list_update["t"] = "index"; -// setcookie("login","",time()-3600, '', $_SERVER['HTTP_HOST']); - break; + case "m_register": $_POST=inp_escape($_POST); $MissingCount = SetMissingDataErrors("m_register"); Index: trunk/kernel/include/modules.php =================================================================== diff -u -N -r2850 -r2853 --- trunk/kernel/include/modules.php (.../modules.php) (revision 2850) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 2853) @@ -3,7 +3,7 @@ Copyright 2002, Intechnic Corporation, All rights reserved */ -setcookie('cookies_on', '1', time()+31104000, '', $_SERVER['HTTP_HOST']); +set_cookie('cookies_on', '1', time() + 31104000); // if branches that uses if($mod_prefix) or like that will never be executed // due global variable $mod_prefix is never defined @@ -834,19 +834,19 @@ /*setup action variable*/ $Action = isset($_REQUEST['Action']) ? $_REQUEST['Action'] : ''; -if($Action=="m_logout") +if($Action == 'm_logout') { - $u = new clsUserSession($var_list["sid"] ,($SessionQueryString && $FrontEnd==1)); + $u = new clsUserSession($var_list['sid'] ,($SessionQueryString && $FrontEnd==1)); $u->Logout(); unset($u); - $var_list_update["t"] = "index"; - $var_list["t"] = ""; - $var_list["sid"]=""; - setcookie("login","",time()-3600, '', $_SERVER['HTTP_HOST']); - setcookie("sid","",time()-3600, '', $_SERVER['HTTP_HOST']); + $var_list_update['t'] = 'index'; + $var_list['t'] = ''; + $var_list['sid'] = ''; + set_cookie('login', '', time() - 3600); + set_cookie('sid', '', time() - 3600); } -$CookieTest = isset($_COOKIE["cookies_on"]) ? $_COOKIE["cookies_on"] : ''; +$CookieTest = isset($_COOKIE['cookies_on']) ? $_COOKIE['cookies_on'] : ''; $HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; if ( ($CookieTest == 1) /*|| !strstr($HTTP_REFERER, $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path"))*/) { @@ -872,7 +872,9 @@ if(is_numeric($m_var_list["theme"])) $objSession->SetThemeName($m_var_list["theme"]); if($objConfig->Get("CookieSessions")>0 && !$SessionQueryString && !headers_sent()) - setcookie("sid",$var_list["sid"], 0, '', $_SERVER['HTTP_HOST']); + { + set_cookie('sid', $var_list['sid'], 0); + } //echo "New Session: ".$objSession->GetSessionKey()."
\n"; if(isset($_COOKIE["login"]) && $Action != "m_logout" && $FrontEnd==1) { Index: trunk/admin/category/addcategory.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addcategory.php (.../addcategory.php) (revision 2569) +++ trunk/admin/category/addcategory.php (.../addcategory.php) (revision 2853) @@ -1,89 +1,12 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; -//$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"); Index: trunk/admin/config/missing_label_search.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/missing_label_search.php (.../missing_label_search.php) (revision 2569) +++ trunk/admin/config/missing_label_search.php (.../missing_label_search.php) (revision 2853) @@ -12,69 +12,16 @@ ## 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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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 + $FrontEnd=2; -require_once($pathtoroot."kernel/startup.php"); - class clsLangParser extends clsTemplateList { function clsLangParser($TemplateRoot) @@ -111,15 +58,7 @@ } } -//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"; -//$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"); Index: trunk/admin/config/config_theme.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/config_theme.php (.../config_theme.php) (revision 2569) +++ trunk/admin/config/config_theme.php (.../config_theme.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"; -//$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"); Index: trunk/core/kernel/session/session.php =================================================================== diff -u -N -r2841 -r2853 --- trunk/core/kernel/session/session.php (.../session.php) (revision 2841) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 2853) @@ -360,7 +360,7 @@ function CheckIfCookiesAreOn() { - $this->CheckDuplicateCookies(); +// $this->CheckDuplicateCookies(); if ($this->Mode == smGET_ONLY || (defined('INPORTAL_ENV')&&INPORTAL_ENV && defined('ADMIN')&&ADMIN && !$this->Application->GetVar('front')) ) { //we don't need to bother checking if we would not use it Index: trunk/admin/category/addcategory_customfields.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addcategory_customfields.php (.../addcategory_customfields.php) (revision 2569) +++ trunk/admin/category/addcategory_customfields.php (.../addcategory_customfields.php) (revision 2853) @@ -12,77 +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; -} -//echo $pathtoroot; +// 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"; -//$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"); Index: trunk/admin/users/adduser_images.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/adduser_images.php (.../adduser_images.php) (revision 2569) +++ trunk/admin/users/adduser_images.php (.../adduser_images.php) (revision 2853) @@ -12,77 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/email/sendmail.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/email/sendmail.php (.../sendmail.php) (revision 2569) +++ trunk/admin/email/sendmail.php (.../sendmail.php) (revision 2853) @@ -12,83 +12,14 @@ ## 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; - } -} -$sub = substr($pathtoroot,strlen($pathchar)*-1); -if($sub!=$pathchar) -{ - $pathtoroot = $pathtoroot.$pathchar; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/email'); +$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"); - -//echo "
"; print_r($_POST); echo "
"; - -$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"; -$browseURL = $adminURL."/browse"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); //require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/config/importlang.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/importlang.php (.../importlang.php) (revision 2569) +++ trunk/admin/config/importlang.php (.../importlang.php) (revision 2853) @@ -12,84 +12,17 @@ ## 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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// new startup: begin +define('REL_PATH', 'admin/config'); +$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 /* set the destination of the image upload, relative to the root path */ $DestDir = "kernel/images/"; -$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"; -$browseURL = $adminURL."/browse"; - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/modules/mod_status.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/modules/mod_status.php (.../mod_status.php) (revision 2569) +++ trunk/admin/modules/mod_status.php (.../mod_status.php) (revision 2853) @@ -12,79 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/modules'); +$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"); - -$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"; - -//admin only util require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/category/addcategory_custom.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addcategory_custom.php (.../addcategory_custom.php) (revision 2569) +++ trunk/admin/category/addcategory_custom.php (.../addcategory_custom.php) (revision 2853) @@ -12,79 +12,15 @@ ## 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; -} -//echo $pathtoroot; +// 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"; - -//$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"); Index: trunk/admin/logs/session_list.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/logs/session_list.php (.../session_list.php) (revision 2569) +++ trunk/admin/logs/session_list.php (.../session_list.php) (revision 2853) @@ -12,79 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/logs'); +$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"); - -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$adminURL = $rootURL.$admin; -$localURL=$rootURL."kernel/"; - -$imagesURL = $adminURL."/images"; - //admin only includes require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/category/addpermission.php =================================================================== diff -u -N -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"); Index: trunk/admin/category/addcategory_images.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addcategory_images.php (.../addcategory_images.php) (revision 2569) +++ trunk/admin/category/addcategory_images.php (.../addcategory_images.php) (revision 2853) @@ -12,77 +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; -} -//echo $pathtoroot; +// 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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/users/user_list.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/users/user_list.php (.../user_list.php) (revision 2772) +++ trunk/admin/users/user_list.php (.../user_list.php) (revision 2853) @@ -12,87 +12,16 @@ ## 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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"); +require_login(); -if (!admin_login()) -{ - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); -} - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); - -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); Index: trunk/admin/backup/backup1.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/backup/backup1.php (.../backup1.php) (revision 2569) +++ trunk/admin/backup/backup1.php (.../backup1.php) (revision 2853) @@ -1,76 +1,12 @@ -Get("Site_Path"); +// new startup: begin +define('REL_PATH', 'admin/backup'); +$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 -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; -$adminURL = $rootURL.$admin; - -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/backup/backup2.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/backup/backup2.php (.../backup2.php) (revision 2569) +++ trunk/admin/backup/backup2.php (.../backup2.php) (revision 2853) @@ -1,75 +1,12 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; - -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; +// new startup: begin +define('REL_PATH', 'admin/backup'); +$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 -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/users/group_select.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/group_select.php (.../group_select.php) (revision 2569) +++ trunk/admin/users/group_select.php (.../group_select.php) (revision 2853) @@ -12,80 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"); - -$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"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); Index: trunk/admin/users/user_addpermission.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/user_addpermission.php (.../user_addpermission.php) (revision 2569) +++ trunk/admin/users/user_addpermission.php (.../user_addpermission.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/admin/backup/backup3.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/backup/backup3.php (.../backup3.php) (revision 2569) +++ trunk/admin/backup/backup3.php (.../backup3.php) (revision 2853) @@ -1,72 +1,12 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; +// new startup: begin +define('REL_PATH', 'admin/backup'); +$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 -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/core/kernel/globals.php =================================================================== diff -u -N -r2604 -r2853 --- trunk/core/kernel/globals.php (.../globals.php) (revision 2604) +++ trunk/core/kernel/globals.php (.../globals.php) (revision 2853) @@ -101,19 +101,21 @@ $array = $new_array; } - /** - * Define constant if it was not already defined before - * - * @param string $const_name - * @param string $const_value - * @access public - */ - function safeDefine($const_name, $const_value) + if( !function_exists('safeDefine') ) { - if(!defined($const_name)) define($const_name,$const_value); + /** + * Define constant if it was not already defined before + * + * @param string $const_name + * @param string $const_value + * @access public + */ + function safeDefine($const_name, $const_value) + { + if(!defined($const_name)) define($const_name,$const_value); + } } - if( !function_exists('parse_portal_ini') ) { function parse_portal_ini($file, $parse_section = false) @@ -184,7 +186,7 @@ { function k4_include_once($file) { - if ( defined('DEBUG_MODE') && DEBUG_MODE && dbg_ConstOn('DBG_PROFILE_INCLUDES') ) + if ( defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_PROFILE_INCLUDES') && DBG_PROFILE_INCLUDES ) { if ( in_array($file, get_required_files()) ) return; Index: trunk/admin/relations/item_type.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/relations/item_type.php (.../item_type.php) (revision 2569) +++ trunk/admin/relations/item_type.php (.../item_type.php) (revision 2853) @@ -1,4 +1,4 @@ - Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; - -//echo "[".$_GET["mod"]."]
\n"; - -$localURL=$rootURL.$m[$_GET["mod"]]; - -//admin only util - - $pathtolocal = $pathtoroot.$m[$_GET["mod"]]; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/users/user_editgroup.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/user_editgroup.php (.../user_editgroup.php) (revision 2569) +++ trunk/admin/users/user_editgroup.php (.../user_editgroup.php) (revision 2853) @@ -12,83 +12,17 @@ ## 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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// new startup: begin +define('REL_PATH', 'admin/users'); +$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 /* set the destination of the image upload, relative to the root path */ $DestDir = "kernel/images/"; -$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."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php");; Index: trunk/admin/users/addgroup_permissions.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/addgroup_permissions.php (.../addgroup_permissions.php) (revision 2569) +++ trunk/admin/users/addgroup_permissions.php (.../addgroup_permissions.php) (revision 2853) @@ -12,80 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -$browseURL = $adminURL."/browse"; -$cssURL = $adminURL."/include"; - -//$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"); Index: trunk/admin/users/addrule.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/addrule.php (.../addrule.php) (revision 2569) +++ trunk/admin/users/addrule.php (.../addrule.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/admin/addreview_direct.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/addreview_direct.php (.../addreview_direct.php) (revision 2569) +++ trunk/admin/addreview_direct.php (.../addreview_direct.php) (revision 2853) @@ -12,76 +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'); +$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"); -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; -$cssURL = $adminURL."/include"; -$browseURL = $adminURL."/browse"; - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/modules/upgrade_lic.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/modules/upgrade_lic.php (.../upgrade_lic.php) (revision 2569) +++ trunk/admin/modules/upgrade_lic.php (.../upgrade_lic.php) (revision 2853) @@ -1,75 +1,12 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/config/addlang_labels.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/addlang_labels.php (.../addlang_labels.php) (revision 2569) +++ trunk/admin/config/addlang_labels.php (.../addlang_labels.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"; -//$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"); Index: trunk/admin/config/config_search.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/config/config_search.php (.../config_search.php) (revision 2772) +++ trunk/admin/config/config_search.php (.../config_search.php) (revision 2853) @@ -12,88 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"); - -if (!admin_login()) -{ - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.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"; -//$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"); Index: trunk/admin/advanced_view.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/advanced_view.php (.../advanced_view.php) (revision 2772) +++ trunk/admin/advanced_view.php (.../advanced_view.php) (revision 2853) @@ -39,97 +39,16 @@ $b_topmargin = "0"; //$b_header_addon = "

"; -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; - } -} +require_once(FULL_PATH.'/kernel/startup.php'); -$sub = substr($pathtoroot,strlen($pathchar)*-1); -if($sub!=$pathchar) -{ - $pathtoroot = $pathtoroot.$pathchar; -} -//echo $pathtoroot; +require_login(); -require_once($pathtoroot."kernel/startup.php"); - -if (!admin_login()) -{ - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); -} - -$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"; -$browseURL = $adminURL."/browse"; -$cssURL = $adminURL."/include"; - $indexURL = $rootURL."index.php"; +$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');"; $m_var_list_update["cat"] = 0; -$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');"; unset($m_var_list_update["cat"]); -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); //require_once ($pathtoroot."kernel/admin/include/navmenu.php"); @@ -158,19 +77,9 @@ $$a_var = $application->ParseBlock(Array('name'=>$a_template), 0, true); } -if(!defined('IS_INSTALL'))define('IS_INSTALL',0); -if(!IS_INSTALL) -{ - if (!admin_login()) - { - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); - } -} +if (!defined('IS_INSTALL') ) define('IS_INSTALL', 0); +if( !IS_INSTALL ) require_login(); + //Set Section $section = 'in-portal:advanced_view'; Index: trunk/admin/tools/sql_query.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/tools/sql_query.php (.../sql_query.php) (revision 2569) +++ trunk/admin/tools/sql_query.php (.../sql_query.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/tools'); +$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"; -//$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"); Index: trunk/admin/users/user_mail.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/user_mail.php (.../user_mail.php) (revision 2569) +++ trunk/admin/users/user_mail.php (.../user_mail.php) (revision 2853) @@ -12,75 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"); -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $rootURL."/images"; -//$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"); Index: trunk/admin/users/adduser_items.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/adduser_items.php (.../adduser_items.php) (revision 2569) +++ trunk/admin/users/adduser_items.php (.../adduser_items.php) (revision 2853) @@ -12,77 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/config/config_lang.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/config_lang.php (.../config_lang.php) (revision 2569) +++ trunk/admin/config/config_lang.php (.../config_lang.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"; -//$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"); Index: trunk/admin/users/adduser_permissions.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/adduser_permissions.php (.../adduser_permissions.php) (revision 2569) +++ trunk/admin/users/adduser_permissions.php (.../adduser_permissions.php) (revision 2853) @@ -12,6 +12,7 @@ ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## +define('REL_PATH', 'admin/users'); if( !(isset($pathtoroot) && $pathtoroot) ) { $path=dirname(realpath(__FILE__)); Index: trunk/admin/cat_select.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/cat_select.php (.../cat_select.php) (revision 2569) +++ trunk/admin/cat_select.php (.../cat_select.php) (revision 2853) @@ -17,81 +17,13 @@ $b_header_addon = "
"; -$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; - } -} +// 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; -} - -require_once($pathtoroot."kernel/startup.php"); - -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$localURL=$rootURL."kernel/"; - -$adminURL = $rootURL.$admin; -$cssURL = $adminURL."/include"; -$imagesURL = $adminURL."/images"; -$browseURL = $adminURL."/browse"; - $destform = $_GET["destform"]; $destfield = $_GET["destfield"]; Index: trunk/admin/logs/summary.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/logs/summary.php (.../summary.php) (revision 2569) +++ trunk/admin/logs/summary.php (.../summary.php) (revision 2853) @@ -12,79 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/logs'); +$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"); - -$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"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); Index: trunk/admin/category/addcategory_relations.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addcategory_relations.php (.../addcategory_relations.php) (revision 2569) +++ trunk/admin/category/addcategory_relations.php (.../addcategory_relations.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; +// 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"; -//$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"); Index: trunk/admin/editor/editor_new.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/editor/editor_new.php (.../editor_new.php) (revision 2569) +++ trunk/admin/editor/editor_new.php (.../editor_new.php) (revision 2853) @@ -1,85 +1,25 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/browse.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/browse.php (.../browse.php) (revision 2772) +++ trunk/admin/browse.php (.../browse.php) (revision 2853) @@ -12,9 +12,7 @@ ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## -//$pathtoroot=""; - //KERNEL4 STARTUP - FOR ACTIONS HANDLING function k4getmicrotime() @@ -42,93 +40,14 @@ $b_topmargin = "0"; //$b_header_addon = "

"; -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; - } -} +require_once FULL_PATH.'/kernel/startup.php'; -$sub = substr($pathtoroot,strlen($pathchar)*-1); -if($sub!=$pathchar) -{ - $pathtoroot = $pathtoroot.$pathchar; -} -//echo $pathtoroot; +require_login(); -require_once($pathtoroot."kernel/startup.php"); - -if (!admin_login()) -{ - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); -} - -$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"; -$browseURL = $adminURL."/browse"; -$cssURL = $adminURL."/include"; - $indexURL = $rootURL."index.php"; +$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');"; $m_var_list_update["cat"] = 0; -$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');"; unset($m_var_list_update["cat"]); $envar = "env=" . BuildEnv(); @@ -173,19 +92,9 @@ //$application->SetVar('t', 'in-commerce/products/products_catalog'); -if(!defined('IS_INSTALL'))define('IS_INSTALL',0); -if(!IS_INSTALL) -{ - if (!admin_login()) - { - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL."/index.php?logout=1"); - die(); - //require_once($pathtoroot."admin/login.php"); - } -} +if( !defined('IS_INSTALL') ) define('IS_INSTALL', 0); +if( !IS_INSTALL ) require_login(); + //Set Section $section = 'in-portal:browse'; Index: trunk/admin/config/addlang_export_result.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/addlang_export_result.php (.../addlang_export_result.php) (revision 2569) +++ trunk/admin/config/addlang_export_result.php (.../addlang_export_result.php) (revision 2853) @@ -12,77 +12,17 @@ ## 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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// new startup: begin +define('REL_PATH', 'admin/config'); +$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 /* set the destination of the image upload, relative to the root path */ $DestDir = "kernel/images/"; - -$localURL=$rootURL."kernel/"; -$browseURL = $adminURL."/browse"; -//$pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); //require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/config/addtheme.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/addtheme.php (.../addtheme.php) (revision 2569) +++ trunk/admin/config/addtheme.php (.../addtheme.php) (revision 2853) @@ -12,84 +12,17 @@ ## 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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// new startup: begin +define('REL_PATH', 'admin/config'); +$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 /* set the destination of the image upload, relative to the root path */ $DestDir = "kernel/images/"; -$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"; - -$browseURL = $adminURL."/browse"; - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/help/credits.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/help/credits.php (.../credits.php) (revision 2569) +++ trunk/admin/help/credits.php (.../credits.php) (revision 2853) @@ -12,83 +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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); +// new startup: begin +define('REL_PATH', 'admin/help'); +$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 -$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."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); //require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/config/importlang_progress.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/importlang_progress.php (.../importlang_progress.php) (revision 2569) +++ trunk/admin/config/importlang_progress.php (.../importlang_progress.php) (revision 2853) @@ -12,78 +12,16 @@ ## 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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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 + $FrontEnd=2; -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"; -// $pathtolocal = $pathtoroot."in-link/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); //require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/config/email_edit.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/email_edit.php (.../email_edit.php) (revision 2569) +++ trunk/admin/config/email_edit.php (.../email_edit.php) (revision 2853) @@ -12,86 +12,17 @@ ## 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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// new startup: begin +define('REL_PATH', 'admin/config'); +$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 /* set the destination of the image upload, relative to the root path */ $DestDir = "kernel/images/"; -$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."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); //require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/category/addcategory_permissions.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addcategory_permissions.php (.../addcategory_permissions.php) (revision 2569) +++ trunk/admin/category/addcategory_permissions.php (.../addcategory_permissions.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; +// 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"; -//$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"); Index: trunk/admin/users/user_groups.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/user_groups.php (.../user_groups.php) (revision 2569) +++ trunk/admin/users/user_groups.php (.../user_groups.php) (revision 2853) @@ -12,77 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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 = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); Index: trunk/kernel/units/phrases/phrases_event_handler.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/kernel/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 2772) +++ trunk/kernel/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 2853) @@ -67,7 +67,8 @@ $object->SetDBField('LastChangeIP', $ip_address); } - setcookie('last_module', $object->GetDBField('Module'), '', SERVER_NAME); + $cookie_path = $this->Application->IsAdmin() ? BASE_PATH.'/admin' : BASE_PATH; + setcookie('last_module', $object->GetDBField('Module'), $cookie_path, '.'.SERVER_NAME); } } Index: trunk/admin/modules/addmodule.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/modules/addmodule.php (.../addmodule.php) (revision 2569) +++ trunk/admin/modules/addmodule.php (.../addmodule.php) (revision 2853) @@ -12,80 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/modules'); +$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"); - -$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"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); @@ -134,9 +68,9 @@ { if($file !="." && $file !=".." && substr($file,0,1)!="_") { - if(is_dir($path.$pathchar.$file)) + if(is_dir($path.'/'.$file)) { - $inst_file = $path.$pathchar.$file.$pathchar.$admin."/install.php"; + $inst_file = $path.'/'.$file.'/'.$admin."/install.php"; if(file_exists($inst_file)) { if(!$objModules->ModuleInstalled($file)) Index: trunk/admin/users/user_addimage.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/user_addimage.php (.../user_addimage.php) (revision 2569) +++ trunk/admin/users/user_addimage.php (.../user_addimage.php) (revision 2853) @@ -12,83 +12,17 @@ ## 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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// new startup: begin +define('REL_PATH', 'admin/users'); +$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 /* set the destination of the image upload, relative to the root path */ $DestDir = "kernel/images/"; -$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."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php");; Index: trunk/admin/users/group_mail.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/group_mail.php (.../group_mail.php) (revision 2569) +++ trunk/admin/users/group_mail.php (.../group_mail.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/kernel/action.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/kernel/action.php (.../action.php) (revision 2772) +++ trunk/kernel/action.php (.../action.php) (revision 2853) @@ -25,15 +25,7 @@ // Session expiration related -if (!admin_login() && strlen($Action) > 0) -{ - if(!headers_sent()) - setcookie("sid"," ",time()-3600, '', $_SERVER['HTTP_HOST']); - $objSession->Logout(); - header("Location: ".$adminURL.'/index.php?env='.BuildEnv().'&expired=1'); - die(); - //require_once($pathtoroot."admin/login.php"); -} +require_login( !admin_login() && $Action, 'expired=1', true ); // End session exipration related Index: trunk/admin/config/addlang_email.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/addlang_email.php (.../addlang_email.php) (revision 2569) +++ trunk/admin/config/addlang_email.php (.../addlang_email.php) (revision 2853) @@ -12,77 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"; - require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/email/do_send.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/email/do_send.php (.../do_send.php) (revision 2569) +++ trunk/admin/email/do_send.php (.../do_send.php) (revision 2853) @@ -12,82 +12,14 @@ ## 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; - } -} -$sub = substr($pathtoroot,strlen($pathchar)*-1); -if($sub!=$pathchar) -{ - $pathtoroot = $pathtoroot.$pathchar; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/email'); +$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"); - -$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"; -$browseURL = $adminURL."/browse"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); //require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/head.php =================================================================== diff -u -N -r2566 -r2853 --- trunk/admin/head.php (.../head.php) (revision 2566) +++ trunk/admin/head.php (.../head.php) (revision 2853) @@ -1,77 +1,13 @@ Get("Site_Path"); - -$localURL=$rootURL."kernel/"; - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; $pathtolocal = $pathtoroot; //require_once ($pathtoroot."admin/include/elements.php"); //require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/category/addimage.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addimage.php (.../addimage.php) (revision 2569) +++ trunk/admin/category/addimage.php (.../addimage.php) (revision 2853) @@ -12,85 +12,17 @@ ## 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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// 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 /* set the destination of the image upload, relative to the root path */ $DestDir = "kernel/images/"; -$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."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); //require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/category/category_maint.php =================================================================== diff -u -N -r2611 -r2853 --- trunk/admin/category/category_maint.php (.../category_maint.php) (revision 2611) +++ trunk/admin/category/category_maint.php (.../category_maint.php) (revision 2853) @@ -13,57 +13,15 @@ ## privileges along maximum prosecution allowed by law. ## ############################################################## if(!defined('CACHE_PERM_CHUNK_SIZE'))define('CACHE_PERM_CHUNK_SIZE',30); - -if( !(isset($pathtoroot) && $pathtoroot) ) -{ - $path = dirname(realpath(__FILE__)); - if( strlen($path) ) - { - // determine the OS type for path parsing - $pos = strpos($path, ':'); - $gOS_TYPE = ($pos === false) ? 'unix' : 'win'; - $pathchar = ($gOS_TYPE == 'unix') ? '/' : "\\"; - $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); - $filename = $p.( ($sub == $pathchar) ? '' : $pathchar).'root.flg'; - if( !file_exists($filename) ) - { - $parent = realpath($p.$pathchar."..".$pathchar); - $p = ($parent != $p) ? $parent : ''; - } - else - $pathtoroot = $p; - } - if( !strlen($pathtoroot) ) $pathtoroot = '.'.$pathchar; - } - else - $pathtoroot = '.'.$pathchar; -} - -$sub = substr($pathtoroot,strlen($pathchar)*-1); -if( $sub != $pathchar) $pathtoroot = $pathtoroot.$pathchar; - -//echo $pathtoroot; -//$FrontEnd=2; - define('REDIRECT_REQUIRED',1); // this script can issue redirect header -require_once($pathtoroot."kernel/startup.php"); +// 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 -//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"; -//$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"); Index: trunk/admin/index4.php =================================================================== diff -u -N -r2604 -r2853 --- trunk/admin/index4.php (.../index4.php) (revision 2604) +++ trunk/admin/index4.php (.../index4.php) (revision 2853) @@ -3,7 +3,7 @@ $start = getmicrotime(); define('ADMIN', 1); -define('FULL_PATH', realpath(dirname(__FILE__).'/..')); +define('FULL_PATH', realpath(dirname(__FILE__).'/..') ); define('APPLICATION_CLASS', 'MyApplication'); define('ADMINS_LIST','/in-portal/users/users.php'); include_once(FULL_PATH.'/kernel/kernel4/startup.php'); Index: trunk/admin/tools/sql_result.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/tools/sql_result.php (.../sql_result.php) (revision 2569) +++ trunk/admin/tools/sql_result.php (.../sql_result.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/tools'); +$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"; -//$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"); Index: trunk/admin/editor/FCKeditor/fckeditor.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/editor/FCKeditor/fckeditor.php (.../fckeditor.php) (revision 2569) +++ trunk/admin/editor/FCKeditor/fckeditor.php (.../fckeditor.php) (revision 2853) @@ -17,64 +17,14 @@ // The editor base path // You have to update it with you web site configuration -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/editor/FCKEditor'); +$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 + //echo $pathtoroot; $FCKeditorBasePath = $rootURL.$admin."/editor/FCKeditor/" ; Index: trunk/admin/help/help.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/help/help.php (.../help.php) (revision 2569) +++ trunk/admin/help/help.php (.../help.php) (revision 2853) @@ -1,80 +1,12 @@ Get("Site_Path"); - -$baseURL = $pathtoroot; //.$objConfig->Get("Site_Path"); - -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$localURL=$rootURL."kernel/"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; - -//admin only util - $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); //require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/editor/editor.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/editor/editor.php (.../editor.php) (revision 2569) +++ trunk/admin/editor/editor.php (.../editor.php) (revision 2853) @@ -1,85 +1,25 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; -$imagesURL = $adminURL."/images"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); Index: trunk/admin/users/addgroup.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/addgroup.php (.../addgroup.php) (revision 2569) +++ trunk/admin/users/addgroup.php (.../addgroup.php) (revision 2853) @@ -12,81 +12,16 @@ ## 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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); require_once($pathtoroot.$admin."/toolbar.php"); unset($objEditItems); Index: trunk/admin/backup/restore1.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/backup/restore1.php (.../restore1.php) (revision 2569) +++ trunk/admin/backup/restore1.php (.../restore1.php) (revision 2853) @@ -1,75 +1,12 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/category/addpermission_modules.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/category/addpermission_modules.php (.../addpermission_modules.php) (revision 2569) +++ trunk/admin/category/addpermission_modules.php (.../addpermission_modules.php) (revision 2853) @@ -12,81 +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"); Index: trunk/admin/backup/restore2.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/backup/restore2.php (.../restore2.php) (revision 2569) +++ trunk/admin/backup/restore2.php (.../restore2.php) (revision 2853) @@ -1,72 +1,12 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/config/addlang_export.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/addlang_export.php (.../addlang_export.php) (revision 2569) +++ trunk/admin/config/addlang_export.php (.../addlang_export.php) (revision 2853) @@ -12,77 +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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// new startup: begin +define('REL_PATH', 'admin/config'); +$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 -/* set the destination of the image upload, relative to the root path */ -$DestDir = "kernel/images/"; - -$localURL=$rootURL."kernel/"; -$browseURL = $adminURL."/browse"; - -//$pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); //require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/backup/restore3.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/backup/restore3.php (.../restore3.php) (revision 2569) +++ trunk/admin/backup/restore3.php (.../restore3.php) (revision 2853) @@ -1,75 +1,12 @@ Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; -//admin only util +// new startup: begin +define('REL_PATH', 'admin/backup'); +$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 + $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/index.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/admin/index.php (.../index.php) (revision 2772) +++ trunk/admin/index.php (.../index.php) (revision 2853) @@ -100,12 +100,9 @@ if (!admin_login() || GetVar('logout') || GetVar('expired') ) { - if( !headers_sent() ) - { - setcookie('sid"','', time()-3600, $objConfig->Get("Site_Path").'/'.$admin, $_SERVER['HTTP_HOST'] ); - } + if( !headers_sent() ) set_cookie('sid', '', time() - 3600); $objSession->Logout(); - require_once($pathtoroot.$admin."/login.php"); + require_once($pathtoroot.$admin.'/login.php'); } $envar = "env=" . BuildEnv(); @@ -143,10 +140,10 @@ } - + - - " name="main" marginwidth="0" marginheight="0" frameborder="NO" noresize scrolling="auto"> + + " name="main" marginwidth="0" marginheight="0" frameborder="NO" noresize scrolling="auto"> Index: trunk/admin/backup/restore4.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/backup/restore4.php (.../restore4.php) (revision 2569) +++ trunk/admin/backup/restore4.php (.../restore4.php) (revision 2853) @@ -1,71 +1,12 @@ <?php -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; -} -require_once($pathtoroot."kernel/startup.php"); -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; -$adminURL = $rootURL.$admin; -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; -//admin only util +// new startup: begin +define('REL_PATH', 'admin/backup'); +$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 + $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/users/banuser.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/banuser.php (.../banuser.php) (revision 2569) +++ trunk/admin/users/banuser.php (.../banuser.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/kernel/startup.php =================================================================== diff -u -N -r2772 -r2853 --- trunk/kernel/startup.php (.../startup.php) (revision 2772) +++ trunk/kernel/startup.php (.../startup.php) (revision 2853) @@ -1,25 +1,55 @@ <?php -//if(get_magic_quotes_gpc()) -//{ -// function stripSlashesA($a) -// { -// foreach($a as $k=>$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: <b>'.FULL_PATH.'</b>'); + + $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()."]<br>"; - - 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 Index: trunk/admin/config/addcustomfield.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/config/addcustomfield.php (.../addcustomfield.php) (revision 2569) +++ trunk/admin/config/addcustomfield.php (.../addcustomfield.php) (revision 2853) @@ -12,85 +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; -} -//echo $pathtoroot; -//print_r($_GET); -//print_r($_POST); -require_once($pathtoroot."kernel/startup.php"); -//admin only util +// new startup: begin +define('REL_PATH', 'admin/config'); +$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 -/* set the destination of the image upload, relative to the root path */ -$DestDir = "kernel/images/"; - -$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."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); Index: trunk/admin/users/banlist_apply.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/banlist_apply.php (.../banlist_apply.php) (revision 2569) +++ trunk/admin/users/banlist_apply.php (.../banlist_apply.php) (revision 2853) @@ -12,78 +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; -} -//echo $pathtoroot; -$FrontEnd=2; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/admin/users/addgroup_users.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/addgroup_users.php (.../addgroup_users.php) (revision 2569) +++ trunk/admin/users/addgroup_users.php (.../addgroup_users.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/admin/users/adduser_groups.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/users/adduser_groups.php (.../adduser_groups.php) (revision 2569) +++ trunk/admin/users/adduser_groups.php (.../adduser_groups.php) (revision 2853) @@ -12,76 +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; -} -//echo $pathtoroot; +// new startup: begin +define('REL_PATH', 'admin/users'); +$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"; -//$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"); Index: trunk/admin/config/config_general.php =================================================================== diff -u -N -r534 -r2853 --- trunk/admin/config/config_general.php (.../config_general.php) (revision 534) +++ trunk/admin/config/config_general.php (.../config_general.php) (revision 2853) @@ -1,24 +1,12 @@ <?php -$pathtoroot=""; -for ($i=0;$i+1<(count(explode("/",$GLOBALS["SCRIPT_NAME"]))-2);$i++) - $pathtoroot.="../"; -$pathtoroot = realpath($pathtoroot)."/"; +// new startup: begin +define('REL_PATH', 'admin/config'); +$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"); - -$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"; - -//admin only util - -//$pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot.$admin."/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php"); //require_once ($pathtolocal."admin/include/navmenu.php"); Index: trunk/admin/backup/export1.php =================================================================== diff -u -N -r2569 -r2853 --- trunk/admin/backup/export1.php (.../export1.php) (revision 2569) +++ trunk/admin/backup/export1.php (.../export1.php) (revision 2853) @@ -1,76 +1,12 @@ <?php -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; -} -//echo $pathtoroot; -//echo $pathtoroot; -require_once($pathtoroot."kernel/startup.php"); -$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); +// new startup: begin +define('REL_PATH', 'admin/backup'); +$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 -$admin = $objConfig->Get("AdminDirectory"); -if(!strlen($admin)) - $admin = "admin"; - -$localURL=$rootURL."kernel/"; -$imagesURL = $rootURL."admin/images"; -$adminURL = $rootURL.$admin; - -//admin only util $pathtolocal = $pathtoroot."kernel/"; require_once ($pathtoroot."admin/include/elements.php"); require_once ($pathtoroot."kernel/admin/include/navmenu.php");