Index: branches/5.3.x/core/kernel/application.php =================================================================== diff -u -N -r15677 -r15698 --- branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15677) +++ branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15698) @@ -1,6 +1,6 @@ getUnitOption('lang', 'TableName'); - $id_field = $this->getUnitOption('lang', 'IDField'); + $language_config = $this->getUnitConfig('lang'); + $table = $language_config->getTableName(); + $id_field = $language_config->getIDField(); + $this->Conn->nextQueryCachable = true; $sql = 'SELECT ' . $id_field . ', IF(AdminInterfaceLang, "Admin", "Front") AS LanguageKey FROM ' . $table . ' @@ -622,8 +624,10 @@ if ( $theme_id === false ) { $this->Conn->nextQueryCachable = true; - $sql = 'SELECT ' . $this->getUnitOption('theme', 'IDField') . ' - FROM ' . $this->getUnitOption('theme', 'TableName') . ' + $theme_config = $this->getUnitConfig('theme'); + + $sql = 'SELECT ' . $theme_config->getIDField() . ' + FROM ' . $theme_config->getTableName() . ' WHERE (PrimaryTheme = 1) AND (Enabled = 1)'; $theme_id = $this->Conn->GetOne($sql); @@ -654,7 +658,7 @@ $currency_id = $this->siteDomainField('PrimaryCurrencyId'); $sql = 'SELECT ISO - FROM ' . $this->getUnitOption('curr', 'TableName') . ' + FROM ' . $this->getUnitConfig('curr')->getTableName() . ' WHERE ' . ($currency_id > 0 ? 'CurrencyId = ' . $currency_id : 'IsPrimary = 1'); $currency_iso = $this->Conn->GetOne($sql); } @@ -728,6 +732,7 @@ $this->registerClass('kOpenerStack', KERNEL_PATH . '/utility/opener_stack.php'); $this->registerClass('kLogger', KERNEL_PATH . '/utility/logger.php'); + $this->registerClass('kUnitConfig', KERNEL_PATH . '/utility/unit_config.php'); $this->registerClass('kUnitConfigReader', KERNEL_PATH . '/utility/unit_config_reader.php'); $this->registerClass('PasswordHash', KERNEL_PATH . '/utility/php_pass.php'); @@ -2308,46 +2313,19 @@ } /** - * Reads unit (specified by $prefix) - * option specified by $option + * Returns unit config for given prefix * * @param string $prefix - * @param string $option - * @param mixed $default - * @return string + * @return kUnitConfig * @access public */ - public function getUnitOption($prefix, $option, $default = false) + public function getUnitConfig($prefix) { - return $this->UnitConfigReader->getUnitOption($prefix, $option, $default); + return $this->UnitConfigReader->getUnitConfig($prefix); } - /** - * Set's new unit option value - * - * @param string $prefix - * @param string $option - * @param string $value - * @access public - */ - public function setUnitOption($prefix, $option, $value) - { - $this->UnitConfigReader->setUnitOption($prefix,$option,$value); - } /** - * Read all unit with $prefix options - * - * @param string $prefix - * @return Array - * @access public - */ - public function getUnitOptions($prefix) - { - return $this->UnitConfigReader->getUnitOptions($prefix); - } - - /** * Returns true if config exists and is allowed for reading * * @param string $prefix @@ -2438,7 +2416,7 @@ { // 1. get genealogical tree of $current_prefix $prefixes = Array ($current_prefix); - while ($parent_prefix = $this->getUnitOption($current_prefix, 'ParentPrefix')) { + while ($parent_prefix = $this->getUnitConfig($current_prefix)->getParentPrefix()) { if ( !$this->prefixRegistred($parent_prefix) ) { // stop searching, when parent prefix is not registered break;