Index: trunk/admin/install.php =================================================================== diff -u -N -r4590 -r4790 --- trunk/admin/install.php (.../install.php) (revision 4590) +++ trunk/admin/install.php (.../install.php) (revision 4790) @@ -161,7 +161,7 @@ //require_once ($pathtoroot."kernel/admin/include/navmenu.php"); require_once ($pathtolocal."admin/include/navmenu.php"); require_once($pathtoroot.$admin."/toolbar.php"); - + set_cookie(SESSION_COOKIE_NAME, '', adodb_mktime() - 3600, rtrim(BASE_PATH, '/') ); } @@ -365,33 +365,36 @@ $login_err_mesg = ''; // always init vars before use if( !isset($g_License) ) $g_License = ''; $lic = base64_decode($g_License); - if(strlen($lic)) - { - a83570933e44bc66b31dd7127cf3f23a($lic); - $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); - } + if(strlen($lic)) + { + a83570933e44bc66b31dd7127cf3f23a($lic); + $ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0)); + } - $LoggedIn = FALSE; - if($_POST["UserName"]=="root") - { - $ado =& inst_GetADODBConnection(); - $sql = "SELECT * FROM ".$g_TablePrefix."ConfigurationValues WHERE VariableName='RootPass'"; + $LoggedIn = FALSE; + if($_POST["UserName"]=="root") + { + $ado =& inst_GetADODBConnection(); + $sql = "SELECT * FROM ".$g_TablePrefix."ConfigurationValues WHERE VariableName='RootPass'"; - $rs = $ado->Execute($sql); - if($rs && !$rs->EOF) - { - $RootPass = $rs->fields["VariableValue"]; + $rs = $ado->Execute($sql); + if($rs && !$rs->EOF) + { + $RootPass = $rs->fields["VariableValue"]; - if(strlen($RootPass)>0) - $LoggedIn = ($RootPass==md5($_POST["UserPass"])); - } - } - else - { - $act = ''; - if (ConvertVersion($g_InPortal) >= ConvertVersion("1.0.5")) { - $act = 'check'; - } + if(strlen($RootPass)>0) + $LoggedIn = ($RootPass==md5($_POST["UserPass"])); + } + else { + $login_err_mesg = 'Invalid username or password'; + } + } + else + { + $act = ''; + if (ConvertVersion($g_InPortal) >= ConvertVersion("1.0.5")) { + $act = 'check'; + } $rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&action=$act&license_code=".base64_encode($g_LicenseCode)."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_SERVER['HTTP_HOST']), "r"); if (!$rfile) { $login_err_mesg = "Unable to connect to the Intechnic server!"; @@ -413,79 +416,79 @@ $LoggedIn = true; } } - //$LoggedIn = ($i_User == $_POST["UserName"] && ($i_Pswd == $_POST["UserPass"]) && strlen($i_User)>0) || strlen($i_User)==0; - } + //$LoggedIn = ($i_User == $_POST["UserName"] && ($i_Pswd == $_POST["UserPass"]) && strlen($i_User)>0) || strlen($i_User)==0; + } - if($LoggedIn) - { - if (!(int)$_POST["inp_opt"]) { - $state="reinstall"; - $inst_error = "Please select one of the options above!"; - } - else { - switch((int)$_POST["inp_opt"]) - { - case 0: - $inst_error = "Please select an option above"; - break; - case 1: - /* clean out all tables */ - $install_type = 4; - $ado =& inst_GetADODBConnection(); - $filename = $pathtoroot.$admin."/install/inportal_remove.sql"; - RunSchemaFile($ado,$filename); + if($LoggedIn) + { + if (!(int)$_POST["inp_opt"]) { + $state="reinstall"; + $inst_error = "Please select one of the options above!"; + } + else { + switch((int)$_POST["inp_opt"]) + { + case 0: + $inst_error = "Please select an option above"; + break; + case 1: + /* clean out all tables */ + $install_type = 4; + $ado =& inst_GetADODBConnection(); + $filename = $pathtoroot.$admin."/install/inportal_remove.sql"; + RunSchemaFile($ado,$filename); - // removing other tables - $tables = $ado->MetaTables(); + // removing other tables + $tables = $ado->MetaTables(); - foreach($tables as $tab_name) { - if (stristr($tab_name, $g_TablePrefix."ses_")) { - $sql = "DROP TABLE IF EXISTS $tab_name"; - $ado->Execute($sql); - } - } + foreach($tables as $tab_name) { + if (stristr($tab_name, $g_TablePrefix."ses_")) { + $sql = "DROP TABLE IF EXISTS $tab_name"; + $ado->Execute($sql); + } + } - /* run install again */ - $state="license"; - break; - case 2: - $install_type = 3; - $state="dbinfo"; - break; - case 3: - $install_type = 5; - $state="license"; - break; - case 4: - $install_type = 6; - /* clean out all tables */ - $ado =& inst_GetADODBConnection(); - //$filename = $pathtoroot.$admin."/install/inportal_remove.sql"; - //RunSchemaFile($ado,$filename); - /* run install again */ - $state="restore_select"; - break; - case 5: - $install_type = 7; - /* change DB config */ - $state="db_reconfig"; - break; - case 6: - $install_type = 8; - $state = "upgrade"; - break; - case 7: - $install_type = 9; - $state = "fix_paths"; - break; - } - } - } - else - { - $state="reinstall"; - $login_error = $login_err_mesg;//"Invalid Username or Password - Try Again"; - } + /* run install again */ + $state="license"; + break; + case 2: + $install_type = 3; + $state="dbinfo"; + break; + case 3: + $install_type = 5; + $state="license"; + break; + case 4: + $install_type = 6; + /* clean out all tables */ + $ado =& inst_GetADODBConnection(); + //$filename = $pathtoroot.$admin."/install/inportal_remove.sql"; + //RunSchemaFile($ado,$filename); + /* run install again */ + $state="restore_select"; + break; + case 5: + $install_type = 7; + /* change DB config */ + $state="db_reconfig"; + break; + case 6: + $install_type = 8; + $state = "upgrade"; + break; + case 7: + $install_type = 9; + $state = "fix_paths"; + break; + } + } + } + else + { + $state="reinstall"; + $login_error = $login_err_mesg;//"Invalid Username or Password - Try Again"; + } } if ($state == "upgrade") { @@ -594,10 +597,10 @@ $rs->MoveNext(); } - + $sql = 'DELETE FROM '.$g_TablePrefix.'Cache WHERE VarName = "config_files"'; $ado->Execute($sql); - + $include_file = $pathtoroot.$admin."/install/upgrade.php"; } } @@ -608,15 +611,15 @@ define('FULL_PATH', realpath(dirname(__FILE__).'/..')); define('APPLICATION_CLASS', 'MyApplication'); } - + include_once(FULL_PATH.'/kernel/kernel4/startup.php'); $application =& kApplication::Instance(); $application->Init(); - + // force rereading of configs $unit_config_reader =& $application->recallObject('kUnitConfigReader'); - $unit_config_reader->scanModules(MODULES_PATH); - + $unit_config_reader->scanModules(MODULES_PATH); + $ado =& inst_GetADODBConnection(); $mod_arr = $_POST['modules']; @@ -704,7 +707,7 @@ $application->Init(); $objThemes->CreateMissingThemes(false); - + $css_hash = $application->Conn->GetCol('SELECT LOWER(Name) AS Name, StylesheetId FROM '.TABLE_PREFIX.'Stylesheets', 'StylesheetId'); $application->setUnitOption('css', 'AutoLoad', false); @@ -722,7 +725,7 @@ $css_item->Compile(); $application->Conn->Query( sprintf($theme_update_sql, $stylesheet_id, $application->Conn->qstr( getArrayValue($css_hash,$stylesheet_id) ) ) ); } - + // do redirect, because upgrade scripts can eat a lot or memory used for language pack upgrade operation $application->Redirect('install', Array('state' => 'languagepack_upgrade'), '', 'install.php'); // compile stylesheets: end @@ -1134,7 +1137,7 @@ if( preg_match('/inportal_upgrade_v(.*).(php|sql)$/', $file, $rets) ) { if($p == '') $p = 'in-portal'; - + $sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = '".$p."'"; $rs = $ado->Execute($sql); Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r4782 -r4790 --- trunk/core/kernel/application.php (.../application.php) (revision 4782) +++ trunk/core/kernel/application.php (.../application.php) (revision 4790) @@ -138,6 +138,9 @@ var $Application = null; + var $CompilationCache = array(); //used when compiling templates + var $CachedProcessors = array(); //used when running compiled templates + /** * Returns kApplication instance anywhere in the script. * @@ -337,10 +340,14 @@ } $this->SetVar('lang.current_id', $language_id ); $this->SetVar('m_lang', $language_id ); + + $lang_mode = $this->GetVar('lang_mode'); + $this->SetVar('lang_mode', ''); $lang =& $this->recallObject('lang.current'); if ( !$lang->IsLoaded() || (!$this->Application->IsAdmin() && !$lang->GetDBField('Enabled')) ) { if (!defined('IS_INSTALL')) die ('Unknown or disabled language'); } + $this->SetVar('lang_mode',$lang_mode); } /** @@ -2095,6 +2102,16 @@ } } + function CheckProcessors($processors) + { + foreach ($processors as $a_processor) + { + if (!isset($this->CachedProcessors[$a_processor])) { + $this->CachedProcessors[$a_processor] =& $this->recallObject($a_processor.'_TagProcessor'); + } + } + } + } ?> \ No newline at end of file Index: trunk/core/units/user_groups/user_groups_config.php =================================================================== diff -u -N -r4612 -r4790 --- trunk/core/units/user_groups/user_groups_config.php (.../user_groups_config.php) (revision 4612) +++ trunk/core/units/user_groups/user_groups_config.php (.../user_groups_config.php) (revision 4790) @@ -1,49 +1,50 @@ 'ug', 'Clones' => Array( 'g-ug' => Array( 'ParentPrefix' => 'g', 'ForeignKey' => 'GroupId', 'ParentTableKey' => 'GroupId', ), - + 'u-ug' => Array( 'ParentPrefix' => 'u', 'ForeignKey' => 'PortalUserId', 'ParentTableKey' => 'PortalUserId', ), - + ), - + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'InpDBEventHandler','file'=>'','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), 'AutoLoad' => true, - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', ), - + 'IDField' => 'GroupId', 'StatusField' => Array('UserStatus'), - + 'TableName' => TABLE_PREFIX.'UserGroup', - + 'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PortalGroup g ON %1$s.GroupId = g.GroupId AND %1$s.PrimaryGroup = 1 LEFT JOIN '.TABLE_PREFIX.'PortalUser u ON u.PortalUserId = %1$s.PortalUserId'), - + 'ItemSQLs' => Array( ''=>' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PortalGroup g ON %1$s.GroupId = g.GroupId AND %1$s.PrimaryGroup = 1 LEFT JOIN '.TABLE_PREFIX.'PortalUser u ON u.PortalUserId = %1$s.PortalUserId'), - + 'AutoDelete' => true, 'AutoClone' => true, - + 'CalculatedFields' => Array( '' => Array( 'Login' => 'u.Login', @@ -55,15 +56,15 @@ 'UserStatus' => 'u.Status' ), ), - + 'Fields' => Array( 'PortalUserId' => Array('type' => 'int','not_null' => '1','default' => '0'), 'GroupId' => Array(), 'MembershipExpires' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => ''), 'PrimaryGroup' => Array('type' => 'int','not_null' => '1','default' => '1'), 'ExpirationReminderSent' => Array('type' => 'int','not_null' => '1','default' => '0'), ), - + 'VirtualFields' => Array( 'Login' => Array('type' => 'string'), 'FirstName' => Array('type' => 'string'), @@ -73,8 +74,8 @@ 'CreatedOn' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'not_null' => 1, 'default' => '#NOW#'), 'UserStatus' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled', 2 => 'la_Pending'), 'use_phrases' => 1, 'not_null' => '1','default' => 2), ), - - + + 'Grids' => Array( 'Default' => Array( 'Icons' => Array(0 => 'icon16_user_disabled.gif', 1 => 'icon16_user.gif', 2 => 'icon16_user_pending.gif'), @@ -88,7 +89,7 @@ ), ), ), - + ); ?> \ No newline at end of file Index: trunk/core/units/category_items/category_items_config.php =================================================================== diff -u -N -r4314 -r4790 --- trunk/core/units/category_items/category_items_config.php (.../category_items_config.php) (revision 4314) +++ trunk/core/units/category_items/category_items_config.php (.../category_items_config.php) (revision 4790) @@ -1,13 +1,13 @@ 'ci', + 'Prefix' => 'ci', 'ItemClass' => Array('class'=>'CategoryItems_DBItem','file'=>'category_items_dbitem.php','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'CategoryItemsEventHander','file'=>'category_items_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'CategoryItemsTagProcessor','file'=>'category_items_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - + 'Clones' => Array( 'l-ci' => Array('ParentPrefix' => 'l'), 'n-ci' => Array('ParentPrefix' => 'n'), @@ -22,14 +22,14 @@ ), 'IDField' => 'CategoryId', // in this case idfield doesn't exit in destination table 'StatusField' => Array('CategoryStatus'), // field, that is affected by Approve/Decline events - + 'TableName' => TABLE_PREFIX.'CategoryItems', 'ParentTableKey'=> 'ResourceId', 'ForeignKey' => 'ItemResourceId', // 'ParentPrefix' => 'p', 'AutoDelete' => true, 'AutoClone' => false, - + 'CalculatedFields' => Array( '' => Array ( 'CategoryName' => 'c.CachedNavbar', @@ -42,8 +42,8 @@ LEFT JOIN '.TABLE_PREFIX.'Category AS c ON c.CategoryId = %1$s.CategoryId', ), // key - special, value - list select sql 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', - ), - 'ListSortings' => Array( + ), + 'ListSortings' => Array( '' => Array( 'Sorting' => Array('CategoryName' => 'asc'), ) @@ -55,18 +55,18 @@ 'PrimaryCat' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), ), 'VirtualFields' => Array( - 'CategoryName' => Array(), + 'CategoryName' => Array(), 'DummyId' => Array(), 'CategoryStatus' => Array(), ), - + 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default' => 'icon16_cat.gif', 0 => 'icon16_cat_disabled.gif', 1 => 'icon16_cat.gif', 2 => 'icon16_cat_pending.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used 'Fields' => Array( 'CategoryName' => Array( 'title'=>'la_col_Category', 'data_block' => 'grid_checkbox_category_td'), ), - + ), ), ); Index: trunk/kernel/units/user_groups/user_groups_config.php =================================================================== diff -u -N -r4612 -r4790 --- trunk/kernel/units/user_groups/user_groups_config.php (.../user_groups_config.php) (revision 4612) +++ trunk/kernel/units/user_groups/user_groups_config.php (.../user_groups_config.php) (revision 4790) @@ -1,49 +1,50 @@ 'ug', 'Clones' => Array( 'g-ug' => Array( 'ParentPrefix' => 'g', 'ForeignKey' => 'GroupId', 'ParentTableKey' => 'GroupId', ), - + 'u-ug' => Array( 'ParentPrefix' => 'u', 'ForeignKey' => 'PortalUserId', 'ParentTableKey' => 'PortalUserId', ), - + ), - + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'InpDBEventHandler','file'=>'','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), 'AutoLoad' => true, - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', ), - + 'IDField' => 'GroupId', 'StatusField' => Array('UserStatus'), - + 'TableName' => TABLE_PREFIX.'UserGroup', - + 'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PortalGroup g ON %1$s.GroupId = g.GroupId AND %1$s.PrimaryGroup = 1 LEFT JOIN '.TABLE_PREFIX.'PortalUser u ON u.PortalUserId = %1$s.PortalUserId'), - + 'ItemSQLs' => Array( ''=>' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PortalGroup g ON %1$s.GroupId = g.GroupId AND %1$s.PrimaryGroup = 1 LEFT JOIN '.TABLE_PREFIX.'PortalUser u ON u.PortalUserId = %1$s.PortalUserId'), - + 'AutoDelete' => true, 'AutoClone' => true, - + 'CalculatedFields' => Array( '' => Array( 'Login' => 'u.Login', @@ -55,15 +56,15 @@ 'UserStatus' => 'u.Status' ), ), - + 'Fields' => Array( 'PortalUserId' => Array('type' => 'int','not_null' => '1','default' => '0'), 'GroupId' => Array(), 'MembershipExpires' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => ''), 'PrimaryGroup' => Array('type' => 'int','not_null' => '1','default' => '1'), 'ExpirationReminderSent' => Array('type' => 'int','not_null' => '1','default' => '0'), ), - + 'VirtualFields' => Array( 'Login' => Array('type' => 'string'), 'FirstName' => Array('type' => 'string'), @@ -73,8 +74,8 @@ 'CreatedOn' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'not_null' => 1, 'default' => '#NOW#'), 'UserStatus' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled', 2 => 'la_Pending'), 'use_phrases' => 1, 'not_null' => '1','default' => 2), ), - - + + 'Grids' => Array( 'Default' => Array( 'Icons' => Array(0 => 'icon16_user_disabled.gif', 1 => 'icon16_user.gif', 2 => 'icon16_user_pending.gif'), @@ -88,7 +89,7 @@ ), ), ), - + ); ?> \ No newline at end of file Index: trunk/kernel/units/category_items/category_items_config.php =================================================================== diff -u -N -r4314 -r4790 --- trunk/kernel/units/category_items/category_items_config.php (.../category_items_config.php) (revision 4314) +++ trunk/kernel/units/category_items/category_items_config.php (.../category_items_config.php) (revision 4790) @@ -1,13 +1,13 @@ 'ci', + 'Prefix' => 'ci', 'ItemClass' => Array('class'=>'CategoryItems_DBItem','file'=>'category_items_dbitem.php','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'CategoryItemsEventHander','file'=>'category_items_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'CategoryItemsTagProcessor','file'=>'category_items_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - + 'Clones' => Array( 'l-ci' => Array('ParentPrefix' => 'l'), 'n-ci' => Array('ParentPrefix' => 'n'), @@ -22,14 +22,14 @@ ), 'IDField' => 'CategoryId', // in this case idfield doesn't exit in destination table 'StatusField' => Array('CategoryStatus'), // field, that is affected by Approve/Decline events - + 'TableName' => TABLE_PREFIX.'CategoryItems', 'ParentTableKey'=> 'ResourceId', 'ForeignKey' => 'ItemResourceId', // 'ParentPrefix' => 'p', 'AutoDelete' => true, 'AutoClone' => false, - + 'CalculatedFields' => Array( '' => Array ( 'CategoryName' => 'c.CachedNavbar', @@ -42,8 +42,8 @@ LEFT JOIN '.TABLE_PREFIX.'Category AS c ON c.CategoryId = %1$s.CategoryId', ), // key - special, value - list select sql 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', - ), - 'ListSortings' => Array( + ), + 'ListSortings' => Array( '' => Array( 'Sorting' => Array('CategoryName' => 'asc'), ) @@ -55,18 +55,18 @@ 'PrimaryCat' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), ), 'VirtualFields' => Array( - 'CategoryName' => Array(), + 'CategoryName' => Array(), 'DummyId' => Array(), 'CategoryStatus' => Array(), ), - + 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default' => 'icon16_cat.gif', 0 => 'icon16_cat_disabled.gif', 1 => 'icon16_cat.gif', 2 => 'icon16_cat_pending.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used 'Fields' => Array( 'CategoryName' => Array( 'title'=>'la_col_Category', 'data_block' => 'grid_checkbox_category_td'), ), - + ), ), ); Index: trunk/admin/install/inportal_remove.sql =================================================================== diff -u -N -r4777 -r4790 --- trunk/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 4777) +++ trunk/admin/install/inportal_remove.sql (.../inportal_remove.sql) (revision 4790) @@ -205,4 +205,6 @@ DROP TABLE ProductsCustomData # -------------------------------------------------------- DROP TABLE TopicCustomData +# -------------------------------------------------------- +DROP TABLE ImportCache # \ No newline at end of file Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r4788 -r4790 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4788) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4790) @@ -160,44 +160,6 @@ } } - /** - * Read configs from all directories - * on path specified - * - * @param string $folderPath - * @access public - */ - /*function processFolder($folderPath, $cached) - { - $fh = opendir($folderPath); - while (($sub_folder = readdir($fh))) { - $full_path = $folderPath.'/'.$sub_folder; - if( $this->isDir($full_path) && file_exists($this->getConfigName($full_path)) ) - { - if (filemtime($full_path) > $cached) { - $this->CacheExpired = true; - - $file = $this->getConfigName($full_path); - if ( $this->Application->isDebugMode() && constOn('DBG_PROFILE_INCLUDES') ) - { - - if ( in_array($file, get_required_files()) ) return; - global $debugger; - include_once(FULL_PATH.$file); - } - else { - include_once($file); - } - - if ( !isset($config) || !$config ) continue; - $prefix = $config['Prefix']; - $config['BasePath'] = $full_path; - $this->configData[$prefix] = $config; - } - } - } - }*/ - function includeConfigFiles() { $this->Application->refreshModuleInfo(); @@ -206,6 +168,7 @@ $data = $conn->GetRow('SELECT Data, Cached FROM '.TABLE_PREFIX.'Cache WHERE VarName = "config_files"'); if ($data && $data['Cached'] > 0 ) { $this->configFiles = unserialize($data['Data']); + sort($this->configFiles); $files_cached = $data['Cached']; } else { @@ -214,16 +177,28 @@ foreach ($this->configFiles as $filename) { - $this->loadConfigFile($filename); + $prefix = $this->PreloadConfigFile($filename); + if (!$prefix) { + trigger_error('Prefix not defined in config file '.$filename, E_USER_ERROR); + } } } + /** + * Process all read config files - called ONLY when there is no cache! + * + */ function ParseConfigs() { // $this->parseConfig('formatters'); // !TEMPORARY!, until config dependecy is created foreach ($this->configData as $prefix => $config) { $this->parseConfig($prefix); } + + foreach ($this->configData as $prefix => $config) { + $this->postProcessConfig($prefix, 'AggregateConfigs', 'sub_prefix'); + $clones = $this->postProcessConfig($prefix, 'Clones', 'prefix'); + } } function AfterConfigRead() @@ -236,6 +211,7 @@ /** * Register nessasary classes + * This method should only process the data which is cached! * * @param string $prefix * @access private @@ -291,11 +267,11 @@ if (isset($config['ParentPrefix'])) { // new: allow to set hook to parent prefix what ever it is if ($hook['HookToPrefix'] == '#PARENT#') { - $hook['HookToPrefix'] = $config['ParentPrefix']; + $hook['HookToPrefix'] = $config['ParentPrefix']; } - + if ($hook['DoPrefix'] == '#PARENT#') { - $hook['DoPrefix'] = $config['ParentPrefix']; + $hook['DoPrefix'] = $config['ParentPrefix']; } } @@ -385,6 +361,9 @@ if ($config_key == 'AggregateConfigs') { $this->postProcessConfig($sub_prefix, 'Clones', 'prefix'); } + else { + $this->parseConfig($sub_prefix); + } array_push($processed, $sub_prefix); } @@ -395,7 +374,7 @@ return $processed; } - function loadConfigFile($filename) + function PreloadConfigFile($filename) { $config_found = file_exists(FULL_PATH.$filename) && ($this->configAllowed($filename) || defined('IS_INSTALL')); @@ -416,7 +395,6 @@ if($config_found) include_once(FULL_PATH.$filename); } - $clones = array(); if($config_found && isset($config) && $config) { $prefix = isset($config['Prefix']) ? $config['Prefix'] : ''; @@ -426,11 +404,9 @@ $config['BasePath'] = dirname(FULL_PATH.$filename); $this->configData[$prefix] = $config; $this->prefixFiles[$prefix] = $filename; - - $this->postProcessConfig($prefix, 'AggregateConfigs', 'sub_prefix'); - $clones = $this->postProcessConfig($prefix, 'Clones', 'prefix'); + return $prefix; } - return $clones; + return 'dummy'; } function loadConfig($prefix) @@ -440,7 +416,11 @@ return ; } $file = $this->prefixFiles[$prefix]; - $clones = $this->loadConfigFile($file); + $prefix = $this->PreloadConfigFile($file); + + $this->postProcessConfig($prefix, 'AggregateConfigs', 'sub_prefix'); + $clones = $this->postProcessConfig($prefix, 'Clones', 'prefix'); + array_unshift($clones, $prefix); foreach ($clones as $a_prefix) { $this->Application->HandleEvent( new kEvent($a_prefix.':OnAfterConfigRead') ); Index: trunk/core/units/permissions/permissions_config.php =================================================================== diff -u -N -r4612 -r4790 --- trunk/core/units/permissions/permissions_config.php (.../permissions_config.php) (revision 4612) +++ trunk/core/units/permissions/permissions_config.php (.../permissions_config.php) (revision 4790) @@ -1,13 +1,14 @@ 'perm', 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'PermissionsEventHandler','file'=>'permissions_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'PermissionsTagProcessor','file'=>'permissions_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - - 'Hooks' => Array( + + 'Hooks' => Array( Array( 'Mode' => hAFTER, 'Conditional' => true, @@ -19,48 +20,48 @@ 'DoEvent' => 'OnSavePermissions', ), ), - + 'Clones' => Array( 'c-perm' => Array( 'Constrain' => 'Type = 0', // non-system 'ParentPrefix' => 'c', 'ForeignKey' => 'CatId', 'ParentTableKey' => 'CategoryId', ), - + 'g-perm' => Array( 'Constrain' => 'Type = 1', // system 'ParentPrefix' => 'g', 'ForeignKey' => 'GroupId', 'ParentTableKey' => 'GroupId', ), ), - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', ), - + 'IDField' => 'PermissionId', - + 'StatusField' => Array('PermissionValue'), - + 'TitleField' => 'Permission', - + 'TableName' => TABLE_PREFIX.'Permissions', - + 'AutoDelete' => true, 'AutoClone' => true, - + 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), - - 'ListSortings' => Array( + + 'ListSortings' => Array( '' => Array( 'Sorting' => Array('Permission' => 'asc'), ) - ), + ), 'Fields' => Array( 'PermissionId' => Array(), 'Permission' => Array('type' => 'string','not_null' => '1','default' => ''), Index: trunk/kernel/units/permissions/permissions_config.php =================================================================== diff -u -N -r4612 -r4790 --- trunk/kernel/units/permissions/permissions_config.php (.../permissions_config.php) (revision 4612) +++ trunk/kernel/units/permissions/permissions_config.php (.../permissions_config.php) (revision 4790) @@ -1,13 +1,14 @@ 'perm', 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), 'EventHandlerClass' => Array('class'=>'PermissionsEventHandler','file'=>'permissions_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'PermissionsTagProcessor','file'=>'permissions_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - - 'Hooks' => Array( + + 'Hooks' => Array( Array( 'Mode' => hAFTER, 'Conditional' => true, @@ -19,48 +20,48 @@ 'DoEvent' => 'OnSavePermissions', ), ), - + 'Clones' => Array( 'c-perm' => Array( 'Constrain' => 'Type = 0', // non-system 'ParentPrefix' => 'c', 'ForeignKey' => 'CatId', 'ParentTableKey' => 'CategoryId', ), - + 'g-perm' => Array( 'Constrain' => 'Type = 1', // system 'ParentPrefix' => 'g', 'ForeignKey' => 'GroupId', 'ParentTableKey' => 'GroupId', ), ), - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', ), - + 'IDField' => 'PermissionId', - + 'StatusField' => Array('PermissionValue'), - + 'TitleField' => 'Permission', - + 'TableName' => TABLE_PREFIX.'Permissions', - + 'AutoDelete' => true, 'AutoClone' => true, - + 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), - - 'ListSortings' => Array( + + 'ListSortings' => Array( '' => Array( 'Sorting' => Array('Permission' => 'asc'), ) - ), + ), 'Fields' => Array( 'PermissionId' => Array(), 'Permission' => Array('type' => 'string','not_null' => '1','default' => ''),