Index: branches/5.2.x/core/install.php =================================================================== diff -u -N -r14428 -r14572 --- branches/5.2.x/core/install.php (.../install.php) (revision 14428) +++ branches/5.2.x/core/install.php (.../install.php) (revision 14572) @@ -1,6 +1,6 @@ Application->recallObject('ModulesHelper'); /* @var $modules_helper kModulesHelper */ + // get domain name as entered by user on the form + $domain = $this->GetVar('domain') == 1 ? $_SERVER['HTTP_HOST'] : str_replace(' ', '', $this->GetVar('other')); + $license_hash = $this->toolkit->getSystemConfig('Intechnic', 'License'); if ($license_hash) { // when license present, then extract domain from it @@ -750,12 +753,10 @@ $license_domain = $license_keys[0]['domain']; } else { - // when license missing, then use current domain - $license_domain = $_SERVER['HTTP_HOST']; + // when license missing, then use current domain or domain entered by user + $license_domain = $domain; } - $domain = $this->GetVar('domain') == 1 ? $_SERVER['HTTP_HOST'] : str_replace(' ', '', $this->GetVar('other')); - if ($domain != '') { if (strstr($domain, $license_domain) || $modules_helper->_IsLocalSite($domain)) { $this->toolkit->setSystemConfig('Misc', 'Domain', $domain); @@ -852,13 +853,21 @@ FROM ' . $theme_table . ' WHERE ' . $theme_idfield . ' = ' . $theme_id; $theme_name = $this->Conn->GetOne($sql); + $site_path = $this->Application->ConfigValue('Site_Path'); + $file_helper =& $this->Application->recallObject('FileHelper'); + /* @var $file_helper FileHelper */ + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { if ($module_name == 'In-Portal') { continue; } - $this->toolkit->RunSQL('/themes' . '/' . $theme_name . '/' . $module_info['TemplatePath'] . '_install/install_data.sql', '{ThemeId}', $theme_id); + $template_path = '/themes' . '/' . $theme_name . '/' . $module_info['TemplatePath']; + $this->toolkit->RunSQL( $template_path . '_install/install_data.sql', Array('{ThemeId}', '{SitePath}'), Array($theme_id, $site_path) ); + + // copy theme demo images into writable path accessible by FCKEditor + $file_helper->copyFolderRecursive(FULL_PATH . $template_path . '_install/images' . DIRECTORY_SEPARATOR, WRITEABLE . '/user_files/Images'); } } break; @@ -1180,6 +1189,7 @@ $this->Application =& kApplication::Instance(); $this->toolkit->Application =& kApplication::Instance(); + $this->includeModuleConstants(); $this->Application->Init(); $this->Conn =& $this->Application->GetADODBConnection(); @@ -1188,6 +1198,23 @@ } /** + * When no modules installed, then pre-include all modules contants, since they are used in unit configs + * + */ + function includeModuleConstants() + { + $modules = $this->ScanModules(); + + foreach ($modules as $module_path) { + $contants_file = MODULES_PATH . '/' . $module_path . '/constants.php'; + + if ( file_exists($contants_file) ) { + k4_include_once($contants_file); + } + } + } + + /** * Show next step screen * */