Index: branches/unlabeled/unlabeled-1.37.2/kernel/startup.php =================================================================== diff -u -r4079 -r4178 --- branches/unlabeled/unlabeled-1.37.2/kernel/startup.php (.../startup.php) (revision 4079) +++ branches/unlabeled/unlabeled-1.37.2/kernel/startup.php (.../startup.php) (revision 4178) @@ -11,7 +11,9 @@ 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 + if (!defined('BASE_PATH')) { + define('BASE_PATH', $ps); // in case in-portal has defined it before + } # New path detection method: end // KENEL4 INIT: BEGIN @@ -31,7 +33,8 @@ $application =& kApplication::Instance(); $application->Init(); - + $application->ProcessRequest(); + // compatibility constants $g_TablePrefix = TABLE_PREFIX; $pathtoroot = FULL_PATH.'/'; Index: branches/unlabeled/unlabeled-1.21.2/core/kernel/globals.php =================================================================== diff -u -r4086 -r4178 --- branches/unlabeled/unlabeled-1.21.2/core/kernel/globals.php (.../globals.php) (revision 4086) +++ branches/unlabeled/unlabeled-1.21.2/core/kernel/globals.php (.../globals.php) (revision 4178) @@ -37,51 +37,51 @@ return $return; } - if (!function_exists('print_pre')) { - /** - * Same as print_r, budet designed for viewing in web page - * - * @param Array $data - * @param string $label - */ - function print_pre($data, $label='') + /** + * Same as print_r, budet designed for viewing in web page + * + * @param Array $data + * @param string $label + */ + function print_pre($data, $label='') + { + $is_debug = false; + if (class_exists('kApplication')) { + $application =& kApplication::Instance(); + $is_debug = $application->isDebugMode(); + } + + if ($is_debug) { + if ($label) $application->Debugger->appendHTML(''.$label.''); + $application->Debugger->dumpVars($data); + } + else { - if( constOn('DEBUG_MODE') ) - { - global $debugger; - if($label) $debugger->appendHTML(''.$label.''); - $debugger->dumpVars($data); - } - else - { - if($label) echo '',$label,'
'; - echo '
',print_r($data,true),'
'; - } + if ($label) echo '', $label, '
'; + echo '
', print_r($data, true), '
'; } } - if (!function_exists('getArrayValue')) { - /** - * Returns array value if key exists - * - * @param Array $array searchable array - * @param int $key array key - * @return string - * @access public - */ - // - function getArrayValue(&$array,$key) - { - $ret = isset($array[$key]) ? $array[$key] : false; - if ($ret && func_num_args() > 2) { - for ($i = 2; $i < func_num_args(); $i++) { - $cur_key = func_get_arg($i); - $ret = getArrayValue( $ret, $cur_key ); - if ($ret === false) break; - } + /** + * Returns array value if key exists + * + * @param Array $array searchable array + * @param int $key array key + * @return string + * @access public + */ + // + function getArrayValue(&$array, $key) + { + $ret = isset($array[$key]) ? $array[$key] : false; + if ($ret && func_num_args() > 2) { + for ($i = 2; $i < func_num_args(); $i++) { + $cur_key = func_get_arg($i); + $ret = getArrayValue( $ret, $cur_key ); + if ($ret === false) break; } - return $ret; } + return $ret; } /** @@ -101,19 +101,16 @@ $array = $new_array; } - 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) { - /** - * 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(!defined($const_name)) define($const_name,$const_value); } if( !function_exists('parse_portal_ini') ) @@ -393,18 +390,15 @@ return $result; } - if( !function_exists('constOn') ) + /** + * Checks if constant is defined and has positive value + * + * @param string $const_name + * @return bool + */ + function constOn($const_name) { - /** - * Checks if constant is defined and has positive value - * - * @param string $const_name - * @return bool - */ - function constOn($const_name) - { - return defined($const_name) && constant($const_name); - } + return defined($const_name) && constant($const_name); } function Kg2Pounds($kg) Index: branches/unlabeled/unlabeled-1.96.2/globals.php =================================================================== diff -u -r3962 -r4178 --- branches/unlabeled/unlabeled-1.96.2/globals.php (.../globals.php) (revision 3962) +++ branches/unlabeled/unlabeled-1.96.2/globals.php (.../globals.php) (revision 4178) @@ -1351,14 +1351,6 @@ return $x; } -if (!function_exists('print_pre')) { - function print_pre($str) - { - // no comments here :) - echo '
'.print_r($str, true).'
'; - } -} - function GetOptions($field) // by Alex { // get dropdown values from custom field @@ -1552,20 +1544,6 @@ if($SFValue == 1 || $SFValue == 2) $list->Clear(); } -if( !function_exists('getArrayValue') ) -{ - /** - * Returns array value if key exists - * - * @param Array $aArray - * @param int $aIndex - * @return string - */ - function getArrayValue(&$aArray, $aIndex) - { - return isset($aArray[$aIndex]) ? $aArray[$aIndex] : false; - } -} function MakeHTMLTag($element, $attrib_prefix) { $result = Array(); @@ -1947,21 +1925,6 @@ 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); - } - } /** * Builds up K4 url from data supplied by in-portal @@ -2013,20 +1976,6 @@ return $ret; } - if( !function_exists('constOn') ) - { - /** - * Checks if constant is defined and has positive value - * - * @param string $const_name - * @return bool - */ - function constOn($const_name) - { - return defined($const_name) && constant($const_name); - } - } - function &recallObject($var_name, $class_name) { if (!isset($GLOBALS[$var_name]) || !is_object($GLOBALS[$var_name])) Index: branches/unlabeled/unlabeled-1.11.20/admin/reviews.php =================================================================== diff -u -r3283 -r4178 --- branches/unlabeled/unlabeled-1.11.20/admin/reviews.php (.../reviews.php) (revision 3283) +++ branches/unlabeled/unlabeled-1.11.20/admin/reviews.php (.../reviews.php) (revision 4178) @@ -13,8 +13,6 @@ ## privileges along maximum prosecution allowed by law. ## ############################################################## -//KERNEL4 STARTUP - FOR ACTIONS HANDLING - function k4getmicrotime() { list($usec, $sec) = explode(" ", microtime()); @@ -23,22 +21,17 @@ $start = k4getmicrotime(); -define('ADMIN', 1); -define('FULL_PATH', realpath(dirname(__FILE__).'/..')); -define('APPLICATION_CLASS', 'MyApplication'); -include_once(FULL_PATH."/kernel/kernel4/startup.php"); +// 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 -$application =& kApplication::Instance(); -$application->Init(); -$application->ProcessRequest(); - -//KERNEL4 END - define('REQUIRE_LAYER_HEADER', 1); $b_topmargin = "0"; //$b_header_addon = "

"; -require_once FULL_PATH.'/kernel/startup.php'; require_login(); $indexURL = $rootURL."index.php"; Index: branches/unlabeled/unlabeled-1.35.2/kernel/units/general/cat_event_handler.php =================================================================== diff -u -r4070 -r4178 --- branches/unlabeled/unlabeled-1.35.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4070) +++ branches/unlabeled/unlabeled-1.35.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4178) @@ -1422,8 +1422,18 @@ $event->redirect = false; } } - + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnExportCancel(&$event) + { + $this->OnGoBack($event); + } + + /** * Sets correct available & export fields * * @param kEvent $event @@ -1730,6 +1740,15 @@ $event->redirect = false; $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); if ($items_info) { + list($id, $field_values) = each($items_info); + + $object =& $event->getObject( Array('skip_autoload' => true) ); + $object->SetFieldsFromHash($field_values); + $field_values['ImportFilename'] = $object->GetDBField('ImportFilename'); //if upload formatter has renamed the file during moving !!! + $field_values['ImportSource'] = 2; + $field_values['ImportLocalFilename'] = $object->GetDBField('ImportFilename'); + $items_info[$id] = $field_values; + $this->Application->StoreVar($event->getPrefixSpecial().'_ItemsInfo', serialize($items_info)); } } Index: branches/unlabeled/unlabeled-1.35.2/core/units/general/cat_event_handler.php =================================================================== diff -u -r4070 -r4178 --- branches/unlabeled/unlabeled-1.35.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4070) +++ branches/unlabeled/unlabeled-1.35.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4178) @@ -1422,8 +1422,18 @@ $event->redirect = false; } } - + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnExportCancel(&$event) + { + $this->OnGoBack($event); + } + + /** * Sets correct available & export fields * * @param kEvent $event @@ -1730,6 +1740,15 @@ $event->redirect = false; $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); if ($items_info) { + list($id, $field_values) = each($items_info); + + $object =& $event->getObject( Array('skip_autoload' => true) ); + $object->SetFieldsFromHash($field_values); + $field_values['ImportFilename'] = $object->GetDBField('ImportFilename'); //if upload formatter has renamed the file during moving !!! + $field_values['ImportSource'] = 2; + $field_values['ImportLocalFilename'] = $object->GetDBField('ImportFilename'); + $items_info[$id] = $field_values; + $this->Application->StoreVar($event->getPrefixSpecial().'_ItemsInfo', serialize($items_info)); } } Index: branches/unlabeled/unlabeled-1.11.10/kernel/admin_templates/incs/script.js =================================================================== diff -u -r4100 -r4178 --- branches/unlabeled/unlabeled-1.11.10/kernel/admin_templates/incs/script.js (.../script.js) (revision 4100) +++ branches/unlabeled/unlabeled-1.11.10/kernel/admin_templates/incs/script.js (.../script.js) (revision 4178) @@ -778,14 +778,23 @@ { var $src_html = $aSelect.options[$src_num].innerHTML; var $dst_html = $aSelect.options[$dst_num].innerHTML; - - var $src_option = new Option($aSelect.options[$src_num].innerHTML, $aSelect.options[$src_num].value); - $src_option.innerHTML = $src_html; - var $dst_option = new Option($aSelect.options[$dst_num].innerHTML, $aSelect.options[$dst_num].value); + var $src_value = $aSelect.options[$src_num].value; + var $dst_value = $aSelect.options[$dst_num].value; + + var $src_option = document.createElement('OPTION'); + var $dst_option = document.createElement('OPTION'); + + $aSelect.remove($src_num); + $aSelect.options.add($dst_option, $src_num); + $dst_option.innerText = $dst_html; + $dst_option.value = $dst_value; $dst_option.innerHTML = $dst_html; - - $aSelect.options[$src_num] = $dst_option; - $aSelect.options[$dst_num] = $src_option; + + $aSelect.remove($dst_num); + $aSelect.options.add($src_option, $dst_num); + $src_option.innerText = $src_html; + $src_option.value = $src_value; + $src_option.innerHTML = $src_html; } function getXMLHTTPObject() Index: branches/unlabeled/unlabeled-1.23.20/admin/advanced_view.php =================================================================== diff -u -r3185 -r4178 --- branches/unlabeled/unlabeled-1.23.20/admin/advanced_view.php (.../advanced_view.php) (revision 3185) +++ branches/unlabeled/unlabeled-1.23.20/admin/advanced_view.php (.../advanced_view.php) (revision 4178) @@ -13,8 +13,6 @@ ## privileges along maximum prosecution allowed by law. ## ############################################################## -//KERNEL4 STARTUP - FOR ACTIONS HANDLING - function k4getmicrotime() { list($usec, $sec) = explode(" ", microtime()); @@ -23,23 +21,17 @@ $start = k4getmicrotime(); -define('ADMIN', 1); -define('FULL_PATH', realpath(dirname(__FILE__).'/..')); -define('APPLICATION_CLASS', 'MyApplication'); -include_once(FULL_PATH."/kernel/kernel4/startup.php"); +// 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 -$application =& kApplication::Instance(); -$application->Init(); -$application->ProcessRequest(); - -//KERNEL4 END - define('REQUIRE_LAYER_HEADER', 1); $b_topmargin = "0"; //$b_header_addon = "

"; -require_once(FULL_PATH.'/kernel/startup.php'); - require_login(); $indexURL = $rootURL."index.php"; Index: branches/unlabeled/unlabeled-1.31.10/admin/browse.php =================================================================== diff -u -r3789 -r4178 --- branches/unlabeled/unlabeled-1.31.10/admin/browse.php (.../browse.php) (revision 3789) +++ branches/unlabeled/unlabeled-1.31.10/admin/browse.php (.../browse.php) (revision 4178) @@ -13,8 +13,6 @@ ## privileges along maximum prosecution allowed by law. ## ############################################################## -//KERNEL4 STARTUP - FOR ACTIONS HANDLING - function k4getmicrotime() { list($usec, $sec) = explode(" ", microtime()); @@ -23,24 +21,19 @@ $start = k4getmicrotime(); -define('ADMIN', 1); -define('FULL_PATH', realpath(dirname(__FILE__).'/..')); -define('APPLICATION_CLASS', 'MyApplication'); -include_once(FULL_PATH."/kernel/kernel4/startup.php"); +// 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 -$application =& kApplication::Instance(); -$application->Init(); -$application->ProcessRequest(); if($application->GetVar('Action') == 'm_paste') define('REDIRECT_REQUIRED',1); // this script can issue redirect header -//KERNEL4 END - define('REQUIRE_LAYER_HEADER', 1); $b_topmargin = "0"; //$b_header_addon = "

"; -require_once FULL_PATH.'/kernel/startup.php'; - require_login(); $indexURL = $rootURL."index.php";