Index: trunk/core/kernel/startup.php =================================================================== diff -u -N -r3132 -r3210 --- trunk/core/kernel/startup.php (.../startup.php) (revision 3132) +++ trunk/core/kernel/startup.php (.../startup.php) (revision 3210) @@ -3,7 +3,7 @@ define('KERNEL_PATH', FULL_PATH.'/kernel/kernel4'); include_once(KERNEL_PATH.'/globals.php'); // non OOP functions used through kernel, e.g. print_pre - if( defined('ADMIN') && ADMIN ) define('SPECIAL_TEMPLATES_FOLDER', '/kernel/admin_templates'); + if( constOn('ADMIN') ) define('SPECIAL_TEMPLATES_FOLDER', '/kernel/admin_templates'); define('INPORTAL_ENV', 1); @@ -56,7 +56,7 @@ 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'); + if( constOn('DEBUG_MODE') ) include_once(KERNEL_PATH.'/utility/debugger.php'); } k4_include_once(KERNEL_PATH.'/db/db_connection.php'); Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r3183 -r3210 --- trunk/core/kernel/application.php (.../application.php) (revision 3183) +++ trunk/core/kernel/application.php (.../application.php) (revision 3210) @@ -117,7 +117,7 @@ if(!$instance) { - if (!defined('APPLICATION_CLASS')) define('APPLICATION_CLASS', 'kApplication'); + safeDefine('APPLICATION_CLASS', 'kApplication'); $class = APPLICATION_CLASS; $instance = new $class(); } @@ -163,25 +163,27 @@ $GLOBALS['debugger']->appendMemoryUsage('Application before Init:'); } - if( !$this->isDebugMode() ) + if( !$this->isDebugMode() && !constOn('DBG_ZEND_PRESENT') ) { error_reporting(0); ini_set('display_errors', 0); } - $error_handler = set_error_handler( Array(&$this,'handleError') ); - if($error_handler) $this->errorHandlers[] = $error_handler; - + if( !constOn('DBG_ZEND_PRESENT') ) + { + $error_handler = set_error_handler( Array(&$this,'handleError') ); + if($error_handler) $this->errorHandlers[] = $error_handler; + } + $this->DB = new kDBConnection(SQL_TYPE, Array(&$this,'handleSQLError') ); $this->DB->Connect(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB); $this->DB->debugMode = $this->isDebugMode(); $this->ModuleInfo = $this->DB->Query('SELECT * FROM '.TABLE_PREFIX.'Modules ORDER BY LoadOrder', 'Name'); - $cms_on = defined('CMS') && CMS; $rewrite_on = $this->ConfigValue('UseModRewrite'); $admin_on = getArrayValue($_REQUEST, 'admin') || $this->IsAdmin(); - define('MOD_REWRITE', ($rewrite_on || $cms_on) && !$admin_on ? 1 : 0); + define('MOD_REWRITE', ($rewrite_on || constOn('CMS') ) && !$admin_on ? 1 : 0); $this->Factory = new kFactory(); @@ -292,7 +294,7 @@ if($theme_id > 0) return $theme_id; - if (defined('DBG_FORCE_THEME') && DBG_FORCE_THEME) + if ( constOn('DBG_FORCE_THEME') ) { $theme_id = DBG_FORCE_THEME; } @@ -391,7 +393,7 @@ */ function SetDefaultConstants() { - if (!defined('SERVER_NAME')) define('SERVER_NAME', $_SERVER['HTTP_HOST']); + safeDefine('SERVER_NAME', $_SERVER['HTTP_HOST']); $admin_dir = $this->ConfigValue('AdminDirectory'); if(!$admin_dir) $admin_dir = 'admin'; @@ -452,7 +454,7 @@ $template_cache =& $this->recallObject('TemplatesCache'); $t = $this->GetVar('t'); - if(defined('CMS') && CMS) + if( constOn('CMS') ) { $cms_handler =& $this->recallObject('cms_EventHandler'); if( !$template_cache->TemplateExists($t) ) @@ -520,7 +522,7 @@ function SaveBlocksCache() { - /*if (defined('EXPERIMENTAL_PRE_PARSE')) { + /*if (constOn('EXPERIMENTAL_PRE_PARSE')) { $data = serialize($this->PreParsedCache); $this->DB->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("blocks_cache", '.$this->DB->qstr($data).', '.time().')'); @@ -943,7 +945,7 @@ if ($env_var) { $ret = ENV_VAR_NAME.'='; } - $ret .= defined('INPORTAL_ENV') ? $sid.'-'.$t : $sid.':'.$t; + $ret .= constOn('INPORTAL_ENV') ? $sid.'-'.$t : $sid.':'.$t; $encode = false; if (isset($params['__URLENCODE__'])) { @@ -1241,13 +1243,19 @@ /** * Checks if application is in debug mode * + * @param bool $check_debugger check if kApplication debugger is initialized too, not only for defined DEBUG_MODE constant * @return bool - * @access public * @author Alex + * @access public */ - function isDebugMode() + function isDebugMode($check_debugger = true) { - return defined('DEBUG_MODE') && DEBUG_MODE && is_object($this->Debugger); + $debug_mode = constOn('DEBUG_MODE'); + if($check_debugger) + { + $debug_mode = $debug_mode && is_object($this->Debugger); + } + return $debug_mode; } /** @@ -1258,7 +1266,7 @@ */ function IsAdmin() { - return defined('ADMIN') && ADMIN; + return constOn('ADMIN'); } /** @@ -1268,7 +1276,7 @@ */ function RewriteURLs() { - return defined('MOD_REWRITE') && MOD_REWRITE; + return constOn('MOD_REWRITE'); } /** @@ -1372,7 +1380,7 @@ global $debugger; if($debugger) { - $errorLevel=defined('DBG_SQL_FAILURE') && DBG_SQL_FAILURE ? E_USER_ERROR : E_USER_WARNING; + $errorLevel = constOn('DBG_SQL_FAILURE') ? E_USER_ERROR : E_USER_WARNING; $debugger->dumpVars($_REQUEST); $debugger->appendTrace(); @@ -1383,7 +1391,7 @@ } else { - //$errorLevel = defined('IS_INSTALL') && IS_INSTALL ? E_USER_WARNING : E_USER_ERROR; + //$errorLevel = constOn('IS_INSTALL') ? E_USER_WARNING : E_USER_ERROR; $errorLevel = E_USER_WARNING; trigger_error('SQL Error in sql: '.$sql.', code '.$code.' ('.$msg.')', $errorLevel); /*echo 'xProcessing SQL: '.$sql.'
'; @@ -1403,7 +1411,7 @@ */ function handleError($errno, $errstr, $errfile = '', $errline = '', $errcontext = '') { - if( defined('SILENT_LOG') && SILENT_LOG ) + if( constOn('SILENT_LOG') ) { $fp = fopen(FULL_PATH.'/silent_log.txt','a'); $time = date('d/m/Y H:i:s'); Index: trunk/core/kernel/globals.php =================================================================== diff -u -N -r3137 -r3210 --- trunk/core/kernel/globals.php (.../globals.php) (revision 3137) +++ trunk/core/kernel/globals.php (.../globals.php) (revision 3210) @@ -368,4 +368,15 @@ eval("\$result =& {$call}({$argumentString});"); return $result; } + + /** + * 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); + } ?> \ No newline at end of file Index: trunk/core/kernel/utility/debugger.php =================================================================== diff -u -N -r3066 -r3210 --- trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 3066) +++ trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 3210) @@ -996,7 +996,10 @@ function memory_get_usage(){ return -1; } } - $debugger = new Debugger(); + if( !dbg_ConstOn('DBG_ZEND_PRESENT') ) + { + $debugger = new Debugger(); + } if( dbg_ConstOn('DBG_HANDLE_ERRORS') ) { Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -N -r3207 -r3210 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3207) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3210) @@ -278,7 +278,15 @@ function finalizeParsing($passed, $module_params = Array() ) { - if( is_array($passed) ) $passed = implode(',', $passed); + if( !is_array($passed) ) $passed = explode(',', $passed); + $prev_passed = $this->Get('passed'); + if($prev_passed) + { + $prev_passed = explode(',', $prev_passed); + $passed = array_unique( array_merge_recursive2($prev_passed, $passed) ); + } + $passed = implode(',', $passed); + $this->Set('passed', $passed); $env = $this->Application->BuildEnv( $this->Get('t'), $module_params, $passed, false, false ); $this->Set(ENV_VAR_NAME, $env); Index: trunk/core/kernel/db/dbitem.php =================================================================== diff -u -N -r3162 -r3210 --- trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 3162) +++ trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 3210) @@ -870,6 +870,15 @@ $this->FieldErrors = Array(); return $this->Loaded; } + + function Query($force = false) + { + if( $this->Application->isDebugMode() ) + { + $this->Application->Debugger->appendTrace(); + } + trigger_error('Query method is called in class '.get_class($this).' for prefix '.$this->getPrefixSpecial().'', E_USER_ERROR); + } } Index: trunk/kernel/units/custom_values/custom_values_config.php =================================================================== diff -u -N -r2899 -r3210 --- trunk/kernel/units/custom_values/custom_values_config.php (.../custom_values_config.php) (revision 2899) +++ trunk/kernel/units/custom_values/custom_values_config.php (.../custom_values_config.php) (revision 3210) @@ -112,12 +112,13 @@ 'Value' => Array('not_null' => true, 'formatter' => 'kMultiLanguage', 'default' => ''), ), 'VirtualFields' => Array( - 'FieldName' => Array(), - 'Prompt' => Array(), - 'ElementType' => Array(), - 'ValueList' => Array(), + 'FieldName' => Array(), + 'Prompt' => Array(), + 'ElementType' => Array(), + 'ValueList' => Array(), + 'DisplayOrder' => Array('type' => 'float', 'default' => 0), - ), + ), 'Grids' => Array( 'Default' => Array( Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N -r3187 -r3210 --- trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 3187) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 3210) @@ -79,7 +79,7 @@ - + "> error"> @@ -193,7 +193,7 @@ name="" id="_" value="" onclick="">  - + "> @@ -203,13 +203,13 @@ - + "> " name="" value=""> " type="checkbox" id="_cb_" name="_cb_" class="" onclick="update_checkbox(this, document.getElementById(''))" onchange=""> - +