Index: branches/unlabeled/unlabeled-1.2.2/core/units/custom_data/custom_data_event_handler.php =================================================================== diff -u -r6786 -r8242 --- branches/unlabeled/unlabeled-1.2.2/core/units/custom_data/custom_data_event_handler.php (.../custom_data_event_handler.php) (revision 6786) +++ branches/unlabeled/unlabeled-1.2.2/core/units/custom_data/custom_data_event_handler.php (.../custom_data_event_handler.php) (revision 8242) @@ -2,6 +2,139 @@ class CustomDataEventHandler extends kDBEventHandler { + /** + * [HOOK] Allows to apply custom fields functionality to specific config + * When main item is created, then cdata config is cloned + * + * @param kEvent $event + */ + function OnDefineCustomFields(&$event) + { + // 1. clone customdata table + $clones = $this->Application->getUnitOption('cdata', 'Clones'); + $clones[$event->MasterEvent->Prefix.'-cdata'] = Array ( + 'ParentPrefix' => $event->MasterEvent->Prefix, + 'TableName' => $this->Application->getUnitOption($event->MasterEvent->Prefix, 'TableName').'CustomData', + ); + $this->Application->setUnitOption('cdata', 'Clones', $clones); + + // 2. add custom field information to main item + $this->createCustomFields($event->MasterEvent->Prefix); + } + + function scanCustomFields($prefix) + { + if (defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound('CustomField')) { + return false; + } + + if (!$prefix) { + // prefix not specified + return false; + } + + $item_type = $this->Application->getUnitOption($prefix, 'ItemType'); + if (!$item_type) { + // no main config of such type + return false; + } + // get custom field information + $sql = 'SELECT * + FROM '.TABLE_PREFIX.'CustomField + WHERE Type = '.$item_type.' + ORDER BY CustomFieldId'; + $custom_fields = $this->Conn->Query($sql, 'CustomFieldId'); + if (!$custom_fields) { + // config doesn't have custom fields + return false; + } + + return $custom_fields; + } + + /** + * Fills cloned cdata config with data from it's parent + * + * @param kEvent $event + */ + function OnAfterConfigRead(&$event) + { + $main_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix'); + + $custom_fields = $this->scanCustomFields($main_prefix); + if (!$custom_fields) { + return false; + } + + // 2. create fields (for customdata item) + $fields = $this->Application->getUnitOption($event->Prefix, 'Fields', Array()); + $field_options = Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'db_type' => 'text', 'default' => ''); + foreach ($custom_fields as $custom_id => $custom_params) { + if (isset($fields['cust_'.$custom_id])) continue; + $fields['cust_'.$custom_id] = $field_options; + } + $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); + } + + /** + * Creates "cust_" virtual fields for main item + * + * @param string $prefix + */ + function createCustomFields($prefix) + { + $custom_fields = $this->scanCustomFields($prefix); + if (!$custom_fields) { + return false; + } + + $calculated_fields = Array(); + $virtual_fields = $this->Application->getUnitOption($prefix, 'VirtualFields', Array()); + + $cf_helper =& $this->Application->recallObject('InpCustomFieldsHelper'); + $field_options = Array('type' => 'string', 'not_null' => 1, 'default' => ''); + $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); + + foreach ($custom_fields as $custom_id => $custom_params) { + switch ($custom_params['ElementType']) { + case 'date': + case 'datetime': + unset($field_options['options']); + $field_options['formatter'] = 'kDateFormatter'; + break; + + case 'select': + case 'multiselect': + case 'radio': + if ($custom_params['ValueList']) { + $field_options['options'] = $cf_helper->GetValuesHash($custom_params['ValueList']); + $field_options['formatter'] = 'kOptionsFormatter'; + } + break; + + default: + unset($field_options['options'], $field_options['formatter']); + break; + } + + $custom_name = $custom_params['FieldName']; + $calculated_fields['cust_'.$custom_name] = 'cust.'.$ml_formatter->LangFieldName('cust_'.$custom_id); + if (!isset($virtual_fields['cust_'.$custom_name])) { + $virtual_fields['cust_'.$custom_name] = Array(); + } + $virtual_fields['cust_'.$custom_name] = array_merge_recursive2($field_options, $virtual_fields['cust_'.$custom_name]); + $custom_fields[$custom_id] = $custom_name; + } + + $config_calculated_fields = $this->Application->getUnitOption($prefix, 'CalculatedFields', Array()); + foreach ($config_calculated_fields as $special => $special_fields) { + $config_calculated_fields[$special] = array_merge_recursive2($config_calculated_fields[$special], $calculated_fields); + } + $this->Application->setUnitOption($prefix, 'CalculatedFields', $config_calculated_fields); + + $this->Application->setUnitOption($prefix, 'CustomFields', $custom_fields); + $this->Application->setUnitOption($prefix, 'VirtualFields', $virtual_fields); + } } ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/inportal_upgrade_v4.1.0.sql =================================================================== diff -u -r8154 -r8242 --- branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/inportal_upgrade_v4.1.0.sql (.../inportal_upgrade_v4.1.0.sql) (revision 8154) +++ branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/inportal_upgrade_v4.1.0.sql (.../inportal_upgrade_v4.1.0.sql) (revision 8242) @@ -7,7 +7,7 @@ ALTER TABLE EmailQueue CHANGE `Subject` `Subject` TEXT, CHANGE toaddr toaddr TEXT, CHANGE fromaddr fromaddr TEXT; ALTER TABLE Category DROP Pop; -ALTER TABLE PortalUser CHANGE CreatedOn CreatedOn INT NOT NULL DEFAULT '0', CHANGE dob dob INT(11) NULL DEFAULT NULL, CHANGE PassResetTime PassResetTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE PwRequestTime PwRequestTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE `Password` `Password` VARCHAR(255) NULL DEFAULT 'd41d8cd98f00b204e9800998ecf8427e'; +ALTER TABLE PortalUser CHANGE CreatedOn CreatedOn INT DEFAULT NULL, CHANGE dob dob INT(11) NULL DEFAULT NULL, CHANGE PassResetTime PassResetTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE PwRequestTime PwRequestTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE `Password` `Password` VARCHAR(255) NULL DEFAULT 'd41d8cd98f00b204e9800998ecf8427e'; ALTER TABLE Modules CHANGE BuildDate BuildDate INT UNSIGNED NULL DEFAULT NULL, CHANGE Version Version VARCHAR(10) NOT NULL DEFAULT '0.0.0', CHANGE `Var` `Var` VARCHAR(100) NOT NULL DEFAULT ''; ALTER TABLE Language CHANGE Enabled Enabled INT(11) NOT NULL DEFAULT '1', CHANGE InputDateFormat InputDateFormat VARCHAR(50) NOT NULL DEFAULT 'm/d/Y', CHANGE InputTimeFormat InputTimeFormat VARCHAR(50) NOT NULL DEFAULT 'g:i:s A', CHANGE DecimalPoint DecimalPoint VARCHAR(10) NOT NULL DEFAULT '', CHANGE ThousandSep ThousandSep VARCHAR(10) NOT NULL DEFAULT ''; Index: branches/unlabeled/unlabeled-1.60.2/core/units/categories/categories_config.php =================================================================== diff -u -r8083 -r8242 --- branches/unlabeled/unlabeled-1.60.2/core/units/categories/categories_config.php (.../categories_config.php) (revision 8083) +++ branches/unlabeled/unlabeled-1.60.2/core/units/categories/categories_config.php (.../categories_config.php) (revision 8242) @@ -11,6 +11,20 @@ Array('pseudo' => 'kPermCacheUpdater','class' => 'kPermCacheUpdater', 'file' => 'cache_updater.php','build_event'=>''), ), + 'ConfigPriority' => 0, + 'Hooks' => Array ( + Array ( + 'Mode' => hBEFORE, + 'Conditional' => false, + 'HookToPrefix' => '', + 'HookToSpecial' => '*', + 'HookToEvent' => Array('OnAfterConfigRead'), + 'DoPrefix' => 'cdata', + 'DoSpecial' => '*', + 'DoEvent' => 'OnDefineCustomFields', + ), + ), + 'AutoLoad' => true, 'CatalogItem' => true, 'AdminTemplatePath' => 'categories', Index: branches/unlabeled/unlabeled-1.76.2/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -r8184 -r8242 --- branches/unlabeled/unlabeled-1.76.2/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8184) +++ branches/unlabeled/unlabeled-1.76.2/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8242) @@ -203,6 +203,7 @@ */ function ParseConfigs() { + // 1. process normal configs and their dependencies $prioritized_configs = array(); foreach ($this->configData as $prefix => $config) { if (isset($config['ConfigPriority'])) { @@ -218,10 +219,15 @@ $clones = $this->postProcessConfig($prefix, 'Clones', 'prefix'); } + // 2. process prioritized configs and their dependencies asort($prioritized_configs); foreach ($prioritized_configs as $prefix => $priority) { $this->parseConfig($prefix); } + + foreach ($prioritized_configs as $prefix => $priority) { + $this->ProcessDependencies($prefix); + } } function AfterConfigRead() @@ -233,10 +239,49 @@ $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') ); $this->AfterConfigProcessed[] = $prefix; } - if ($this->StoreCache) $this->CacheParsedData(); + + if ($this->StoreCache) { + $this->processDynamicClones(); + $this->CacheParsedData(); + } } /** + * Re-reads all configs + * + */ + function ReReadConfigs() + { + $this->includeConfigFiles(MODULES_PATH); + $this->ParseConfigs(); + $this->AfterConfigRead(); + $this->processDynamicClones(); + } + + /** + * Process clones, that were defined via OnAfterConfigRead event + * + */ + function processDynamicClones() + { + $new_clones = Array(); + foreach ($this->configData as $prefix => $config) { + $clones = $this->postProcessConfig($prefix, 'Clones', 'prefix'); + if ($clones) { + $new_clones = array_merge($new_clones, $clones); + } + } + + // call OnAfterConfigRead for cloned configs + $new_clones = array_unique($new_clones); + foreach ($new_clones as $prefix) { + if (in_array($prefix, $this->AfterConfigProcessed)) continue; + $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') ); + $this->AfterConfigProcessed[] = $prefix; + } + } + + /** * Register nessasary classes * This method should only process the data which is cached! * @@ -475,7 +520,7 @@ function postProcessConfig($prefix, $config_key, $dst_prefix_var) { $main_config =& $this->configData[$prefix]; - $sub_configs = getArrayValue($main_config, $config_key); + $sub_configs = isset($main_config[$config_key]) && $main_config[$config_key] ? $main_config[$config_key] : false; // getArrayValue($main_config, $config_key); if (!$sub_configs) { return array(); } Index: branches/unlabeled/unlabeled-1.6.2/core/admin_templates/tools/system_tools.tpl =================================================================== diff -u -r8211 -r8242 --- branches/unlabeled/unlabeled-1.6.2/core/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 8211) +++ branches/unlabeled/unlabeled-1.6.2/core/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 8242) @@ -14,14 +14,14 @@ } - + "> : - ');" value="Go"> + ', '');" value="Go">   @@ -34,6 +34,7 @@ + "> Index: branches/unlabeled/unlabeled-1.10.2/core/units/custom_data/custom_data_config.php =================================================================== diff -u -r8106 -r8242 --- branches/unlabeled/unlabeled-1.10.2/core/units/custom_data/custom_data_config.php (.../custom_data_config.php) (revision 8106) +++ branches/unlabeled/unlabeled-1.10.2/core/units/custom_data/custom_data_config.php (.../custom_data_config.php) (revision 8242) @@ -1,83 +1,37 @@ 'cdata', + $config = Array ( + 'Prefix' => 'cdata', - 'Clones' => Array( - 'u-cdata' => Array( - 'TableName' => TABLE_PREFIX.'PortalUserCustomData', - 'ParentPrefix' => 'u', - ), + 'QueryString' => Array ( + 1 => 'id', + 2 => 'event', + ), - 'c-cdata' => Array( - 'TableName' => TABLE_PREFIX.'CategoryCustomData', - 'ParentPrefix' => 'c', - ), + 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), + 'ListClass' => Array('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), + 'EventHandlerClass' => Array('class' => 'CustomDataEventHandler', 'file' => 'custom_data_event_handler.php', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'), + 'AutoLoad' => true, - 'l-cdata' => Array( - 'TableName' => TABLE_PREFIX.'LinkCustomData', - 'ParentPrefix' => 'l', - ), + 'IDField' => 'CustomDataId', - 'n-cdata' => Array( - 'TableName' => TABLE_PREFIX.'NewsCustomData', - 'ParentPrefix' => 'n', - ), + 'ParentTableKey' => 'ResourceId', + 'ForeignKey' => 'ResourceId', + 'AutoDelete' => true, + 'AutoClone' => false, - 'bb-cdata' => Array( - 'TableName' => TABLE_PREFIX.'TopicCustomData', - 'ParentPrefix' => 'bb', - ), + 'CalculatedFields' => Array ( + '' => Array(), + ), - 'p-cdata' => Array( - 'TableName' => TABLE_PREFIX.'ProductsCustomData', - 'ParentPrefix' => 'p', - ), - ), + 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), + 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), - 'QueryString' => Array( - 1 => 'id', - 2 => 'event', - ), + 'Fields' => Array ( + 'CustomDataId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), + 'ResourceId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), + ), + ); - 'ItemClass' => Array('class' => 'kDBItem', 'file' => '','build_event' => 'OnItemBuild'), - 'ListClass' => Array('class' => 'kDBList', 'file' => '','build_event' => 'OnListBuild'), - 'EventHandlerClass' => Array('class' => 'kDBEventHandler', 'file' => '', 'build_event' => 'OnBuild'), - 'TagProcessorClass' => Array('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'), - 'AutoLoad' => true, - - 'Hooks' => Array( - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => '#PARENT#', //self - 'HookToSpecial' => '*', - 'HookToEvent' => Array('OnAfterConfigRead'), - 'DoPrefix' => '', - 'DoSpecial' => '', - 'DoEvent' => 'OnCreateCustomFields', - ), - ), - - 'IDField' => 'CustomDataId', - - 'ParentTableKey' => 'ResourceId', - 'ForeignKey' => 'ResourceId', - 'AutoDelete' => true, - 'AutoClone' => false, - - 'CalculatedFields' => Array( - '' => Array(), - ), - - 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), - 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'), - - 'Fields' => Array( - 'CustomDataId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'ResourceId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - ), - ); - - ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.13.2/core/units/general/helpers/multilanguage.php =================================================================== diff -u -r8183 -r8242 --- branches/unlabeled/unlabeled-1.13.2/core/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 8183) +++ branches/unlabeled/unlabeled-1.13.2/core/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 8242) @@ -88,8 +88,10 @@ */ function createFields($prefix, $refresh = false) { - if ($refresh) { - $this->Application->HandleEvent( new kEvent($prefix.':OnCreateCustomFields') ); + if ($refresh && preg_match('/(.*)-cdata$/', $prefix, $regs)) { + // call main item config to clone cdata table + $this->Application->UnitConfigReader->loadConfig($regs[1]); + $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') ); } $table_name = $this->Application->getUnitOption($prefix, 'TableName'); Index: branches/unlabeled/unlabeled-1.85.2/core/kernel/db/db_event_handler.php =================================================================== diff -u -r8237 -r8242 --- branches/unlabeled/unlabeled-1.85.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 8237) +++ branches/unlabeled/unlabeled-1.85.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 8242) @@ -1795,93 +1795,6 @@ } /** - * Dynamically fills customdata config - * - * @param kEvent $event - */ - function OnCreateCustomFields(&$event) - { - if (defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound('CustomField')) { - return false; - } - $main_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix'); - if (!$main_prefix) return false; - $item_type = $this->Application->getUnitOption($main_prefix, 'ItemType'); - if (!$item_type) { - // no main config of such type - return false; - } - - // 1. get custom field information - $sql = 'SELECT * - FROM '.TABLE_PREFIX.'CustomField - WHERE Type = '.$item_type.' - ORDER BY CustomFieldId'; - $custom_fields = $this->Conn->Query($sql, 'CustomFieldId'); - if (!$custom_fields) { - // config doesn't have custom fields - return false; - } - - // 2. create fields (for customdata item) - $fields = $this->Application->getUnitOption($event->Prefix, 'Fields', Array()); - $field_options = Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'db_type' => 'text', 'default' => ''); - foreach ($custom_fields as $custom_id => $custom_params) { - if (isset($fields['cust_'.$custom_id])) continue; - $fields['cust_'.$custom_id] = $field_options; - } - $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); - - // 3. create virtual & calculated fields (for main item) - $calculated_fields = Array(); - $virtual_fields = $this->Application->getUnitOption($main_prefix, 'VirtualFields', Array()); - - $cf_helper =& $this->Application->recallObject('InpCustomFieldsHelper'); - $field_options = Array('type' => 'string', 'not_null' => 1, 'default' => ''); - $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - - foreach ($custom_fields as $custom_id => $custom_params) { - switch ($custom_params['ElementType']) { - case 'date': - case 'datetime': - unset($field_options['options']); - $field_options['formatter'] = 'kDateFormatter'; - break; - - case 'select': - case 'multiselect': - case 'radio': - if ($custom_params['ValueList']) { - $field_options['options'] = $cf_helper->GetValuesHash($custom_params['ValueList']); - $field_options['formatter'] = 'kOptionsFormatter'; - } - break; - - default: - unset($field_options['options'], $field_options['formatter']); - break; - } - - $custom_name = $custom_params['FieldName']; - $calculated_fields['cust_'.$custom_name] = 'cust.'.$ml_formatter->LangFieldName('cust_'.$custom_id); - if (!isset($virtual_fields['cust_'.$custom_name])) { - $virtual_fields['cust_'.$custom_name] = Array(); - } - $virtual_fields['cust_'.$custom_name] = array_merge_recursive2($field_options, $virtual_fields['cust_'.$custom_name]); - $custom_fields[$custom_id] = $custom_name; - } - - $config_calculated_fields = $this->Application->getUnitOption($main_prefix, 'CalculatedFields', Array()); - foreach ($config_calculated_fields as $special => $special_fields) { - $config_calculated_fields[$special] = array_merge_recursive2($config_calculated_fields[$special], $calculated_fields); - } - $this->Application->setUnitOption($main_prefix, 'CalculatedFields', $config_calculated_fields); - - $this->Application->setUnitOption($main_prefix, 'CustomFields', $custom_fields); - $this->Application->setUnitOption($main_prefix, 'VirtualFields', $virtual_fields); - } - - /** * Saves selected user in needed field * * @param kEvent $event Index: branches/unlabeled/unlabeled-1.1.2/core/units/skins/skins_config.php =================================================================== diff -u -r8229 -r8242 --- branches/unlabeled/unlabeled-1.1.2/core/units/skins/skins_config.php (.../skins_config.php) (revision 8229) +++ branches/unlabeled/unlabeled-1.1.2/core/units/skins/skins_config.php (.../skins_config.php) (revision 8242) @@ -27,7 +27,7 @@ 4 => 'mode', ), 'IDField' => 'SkinId', - 'StatusField' => Array('Status', 'IsPrimary'), + 'StatusField' => Array('IsPrimary'), 'TableName' => TABLE_PREFIX.'Skins', /* @@ -92,43 +92,45 @@ ) ), 'Fields' => Array ( - 'SkinId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), - 'Name' => Array ('type' => 'string', 'max_len' => 255, 'default' => NULL), - 'CSS' => Array ('type' => 'string', 'default' => NULL), - 'Logo' => Array( - 'type'=>'string', 'formatter'=>'kUploadFormatter', - 'max_size'=>MAX_UPLOAD_SIZE, // in Bytes ! - 'file_types'=>'*.jpg;*.gif;*.png', 'files_description'=>'!la_ImageFiles!', + 'SkinId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + 'Name' => Array ('type' => 'string', 'max_len' => 255, 'default' => NULL), + 'CSS' => Array ('type' => 'string', 'default' => NULL), + 'Logo' => Array( + 'type'=>'string', 'formatter'=>'kUploadFormatter', + 'max_size'=>MAX_UPLOAD_SIZE, // in Bytes ! + 'file_types'=>'*.jpg;*.gif;*.png', 'files_description'=>'!la_ImageFiles!', 'upload_dir'=>'/system/user_files/', // relative to project's home 'as_image'=>true, 'thumb_width'=>100, 'thumb_height'=>100, 'multiple'=>false, // false or max number of files - will be stored as serialized array of paths 'direct_links'=>false, // use direct file urls or send files through wrapper (requires mod_mime_magic) - ), - 'Options' => Array( - 'type' => 'string', 'default' => NULL, - 'formatter' => 'kSerializedFormatter', - 'default'=>serialize( - array( - 'HeadBgColor' => array('Description'=>'Head frame background color', 'Value'=>'#1961B8'), - 'HeadColor' => array('Description'=>'Head frame text color', 'Value'=>'#000000'), - 'SectionBgColor' => array('Description'=>'Section bar background color', 'Value'=>'#2D79D6'), - 'SectionColor' => array('Description'=>'Section bar text color', 'Value'=>'#000000'), - ) - ), - ), - 'IsPrimary' => Array( - 'type' => 'int', 'formatter' => 'kOptionsFormatter', - 'options' => Array(1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, - 'not_null' => 1, 'default' => 0 - ), + 'default' => null, + ), + 'Options' => Array( + 'type' => 'string', 'default' => NULL, + 'formatter' => 'kSerializedFormatter', + 'default'=>serialize( + array( + 'HeadBgColor' => array('Description'=>'Head frame background color', 'Value'=>'#1961B8'), + 'HeadColor' => array('Description'=>'Head frame text color', 'Value'=>'#000000'), + 'SectionBgColor' => array('Description'=>'Section bar background color', 'Value'=>'#2D79D6'), + 'SectionColor' => array('Description'=>'Section bar text color', 'Value'=>'#000000'), + ) + ), + ), + 'LastCompiled' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + 'IsPrimary' => Array( + 'type' => 'int', 'formatter' => 'kOptionsFormatter', + 'options' => Array(1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, + 'not_null' => 1, 'default' => 0 + ), ), 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default'=>'icon16_test.gif'), 'Fields' => Array( 'SkinId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_checkbox_td', 'width'=>50, 'filter_block' => 'grid_range_filter' ), - 'Name' => Array( 'title'=>'la_col_SkinName', 'width'=>200), + 'Name' => Array( 'title'=>'la_col_SkinName', 'width'=>200, 'filter_block' => 'grid_like_filter'), 'IsPrimary' => Array( 'title'=>'la_col_IsPrimary', 'width'=>150, 'filter_block' => 'grid_options_filter'), ), ), Index: branches/unlabeled/unlabeled-1.48.2/admin/install/install_lib.php =================================================================== diff -u -r7654 -r8242 --- branches/unlabeled/unlabeled-1.48.2/admin/install/install_lib.php (.../install_lib.php) (revision 7654) +++ branches/unlabeled/unlabeled-1.48.2/admin/install/install_lib.php (.../install_lib.php) (revision 8242) @@ -325,7 +325,7 @@ } $sqls = str_replace("\r\n", "\n", $sqls); // convert to linux line endings - $sqls = preg_replace("/#(.*?)\n/", '', $sqls); // remove all comments + $sqls = preg_replace("/#([^;]*?)\n/", '', $sqls); // remove all comments $sqls = explode(";\n", $sqls); foreach ($sqls as $sql) { Index: branches/unlabeled/unlabeled-1.31.2/core/units/languages/languages_event_handler.php =================================================================== diff -u -r7858 -r8242 --- branches/unlabeled/unlabeled-1.31.2/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 7858) +++ branches/unlabeled/unlabeled-1.31.2/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 8242) @@ -22,16 +22,16 @@ } /** - * Updates table structure on new language adding/removing language + * [HOOK] Updates table structure on new language adding/removing language * * @param kEvent $event */ - function OnReflectMultiLingualFields($event) + function OnReflectMultiLingualFields(&$event) { $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); - - $this->Application->UnitConfigReader->includeConfigFiles(MODULES_PATH); //make sure to re-read all configs - $this->Application->UnitConfigReader->AfterConfigRead(); + /* @var $ml_helper kMultiLanguageHelper */ + + $this->Application->UnitConfigReader->ReReadConfigs(); foreach ($this->Application->UnitConfigReader->configData as $prefix => $config_data) { $ml_helper->createFields($prefix); } Index: branches/unlabeled/unlabeled-1.16.2/core/units/custom_fields/custom_fields_event_handler.php =================================================================== diff -u -r6627 -r8242 --- branches/unlabeled/unlabeled-1.16.2/core/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 6627) +++ branches/unlabeled/unlabeled-1.16.2/core/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 8242) @@ -82,6 +82,10 @@ $main_prefix = $this->getPrefixByItemType($object->GetDBField('Type')); $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ + + // call main item config to clone cdata table + $this->Application->getUnitOption($main_prefix, 'TableName'); $ml_helper->deleteField($main_prefix.'-cdata', $event->getEventParam('id')); } @@ -113,9 +117,11 @@ $object =& $event->getObject(); $main_prefix = $this->getPrefixByItemType($object->GetDBField('Type')); - $this->Application->HandleEvent( new kEvent($main_prefix.'-cdata:OnCreateCustomFields') ); - $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ + + // call main item config to clone cdata table + $this->Application->getUnitOption($main_prefix, 'TableName'); $ml_helper->createFields($main_prefix.'-cdata'); } Index: branches/unlabeled/unlabeled-1.105.2/kernel/parser.php =================================================================== diff -u -r8010 -r8242 --- branches/unlabeled/unlabeled-1.105.2/kernel/parser.php (.../parser.php) (revision 8010) +++ branches/unlabeled/unlabeled-1.105.2/kernel/parser.php (.../parser.php) (revision 8242) @@ -287,8 +287,7 @@ $e = $attribs["_errortemplate"]; if(!strlen($e)) $e = $t; - if(strlen($attribs["_langtext"])) - { + if(isset($attribs['_langtext']) && strlen($attribs['_langtext'])) { $txt = language($attribs["_langtext"]); } else Index: branches/unlabeled/unlabeled-1.38.2/core/units/users/users_config.php =================================================================== diff -u -r8236 -r8242 --- branches/unlabeled/unlabeled-1.38.2/core/units/users/users_config.php (.../users_config.php) (revision 8236) +++ branches/unlabeled/unlabeled-1.38.2/core/units/users/users_config.php (.../users_config.php) (revision 8242) @@ -11,31 +11,42 @@ ), 'AutoLoad' => true, - 'Hooks' => Array( - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => 'u', - 'HookToSpecial' => '*', - 'HookToEvent' => Array('OnAfterItemLoad', 'OnBeforeItemCreate', 'OnBeforeItemUpdate', 'OnUpdateAddress'), - 'DoPrefix' => '', - 'DoSpecial' => '*', - 'DoEvent' => 'OnPrepareStates', - ), + 'ConfigPriority' => 0, + 'Hooks' => Array ( + Array ( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'u', + 'HookToSpecial' => '*', + 'HookToEvent' => Array('OnAfterItemLoad', 'OnBeforeItemCreate', 'OnBeforeItemUpdate', 'OnUpdateAddress'), + 'DoPrefix' => '', + 'DoSpecial' => '*', + 'DoEvent' => 'OnPrepareStates', + ), - Array( - 'Mode' => hBEFORE, - 'Conditional' => false, - 'HookToPrefix' => 'affil', - 'HookToSpecial' => '*', - 'HookToEvent' => Array('OnCheckAffiliateAgreement'), - 'DoPrefix' => '', - 'DoSpecial' => '*', - 'DoEvent' => 'OnSubstituteSubscriber', - ), + Array ( + 'Mode' => hBEFORE, + 'Conditional' => false, + 'HookToPrefix' => 'affil', + 'HookToSpecial' => '*', + 'HookToEvent' => Array('OnCheckAffiliateAgreement'), + 'DoPrefix' => '', + 'DoSpecial' => '*', + 'DoEvent' => 'OnSubstituteSubscriber', + ), + + Array ( + 'Mode' => hBEFORE, + 'Conditional' => false, + 'HookToPrefix' => '', + 'HookToSpecial' => '*', + 'HookToEvent' => Array('OnAfterConfigRead'), + 'DoPrefix' => 'cdata', + 'DoSpecial' => '*', + 'DoEvent' => 'OnDefineCustomFields', + ), + ), - ), - 'QueryString' => Array( 1 => 'id', 2 => 'Page',