Index: install.php =================================================================== --- install.php (revision 14817) +++ install.php (working copy) @@ -74,6 +74,7 @@ 'upgrade' => Array ('check_paths', 'install_setup', 'upgrade_modules', 'skin_upgrade', 'security', 'finish'), 'update_license' => Array ('check_paths', 'install_setup', 'select_license', /*'download_license',*/ 'select_domain', 'security', 'finish'), + 'sys_config' => Array ('check_paths', 'install_setup', 'sys_config', 'security', 'finish'), 'db_reconfig' => Array ('check_paths', 'install_setup', 'db_reconfig', 'security', 'finish'), 'fix_paths' => Array ('check_paths', 'install_setup', 'fix_paths', 'security', 'finish'), ); @@ -169,18 +170,10 @@ $this->writeableFolders[] = $this->toolkit->defaultWritablePath . '/config.php'; } - if ( !$this->toolkit->getSystemConfig('Misc', 'WriteablePath') ) { - $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $this->toolkit->defaultWritablePath); - } - if ( !$this->toolkit->getSystemConfig('Misc', 'RestrictedPath') ) { $this->toolkit->setSystemConfig('Misc', 'RestrictedPath', $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . '.restricted'); } - if ( !$this->toolkit->getSystemConfig('Misc', 'WebsitePath') ) { - $this->toolkit->setSystemConfig('Misc', 'WebsitePath', $base_path); - } - if ( $this->toolkit->systemConfigChanged ) { // immediately save, because this paths will be used in kApplication class later $this->toolkit->SaveConfig(true); @@ -278,6 +271,11 @@ switch ($this->currentStep) { case 'check_paths': $writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath'); + + if (!$writeable_base) { + $writeable_base = $this->toolkit->defaultWritablePath; + } + foreach ($this->writeableFolders as $folder_path) { $file_path = FULL_PATH . str_replace('$1', $writeable_base, $folder_path); if (file_exists($file_path) && !is_writable($file_path)) { @@ -801,6 +799,82 @@ } break; + case 'sys_config': + $website_path = $this->GetVar('website_path'); + + if (!$website_path || $website_path == $this->toolkit->defaultWebsitePath) { + unset($website_path); + } + + $this->toolkit->setSystemConfig('Misc', 'WebsitePath', $website_path); + + $writeable_path = $this->GetVar('writeable_path'); + + if (!$writeable_path || $writeable_path == $this->toolkit->defaultWritablePath) { + unset($writeable_path); + } + + $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $writeable_path); + + $admin_directory = $this->GetVar('admin_directory'); + + if (!$admin_directory || $admin_directory == '/admin') { + unset($admin_directory); + } + + $this->toolkit->setSystemConfig('Misc', 'AdminDirectory', $admin_directory); + + $admin_presets_directory = $this->GetVar('admin_directory'); + + if (!$admin_presets_directory || $admin_presets_directory == '/admin') { + unset($admin_presets_directory); + } + + $this->toolkit->setSystemConfig('Misc', 'AdminPresetsDirectory', $admin_presets_directory); + + $application_class = $this->GetVar('application_class'); + + if (!$application_class || $application_class == 'kApplication') { + unset($application_class); + } + + $this->toolkit->setSystemConfig('Misc', 'ApplicationClass', $application_class); + + $application_path = $this->GetVar('application_path'); + + if (!$application_path || $application_path == '/core/kernel/application.php') { + unset($application_path); + } + + $this->toolkit->setSystemConfig('Misc', 'ApplicationPath', $application_path); + + $cache_handler = $this->GetVar('cache_handler'); + + if (!$cache_handler) { + unset($cache_handler); + } + + $this->toolkit->setSystemConfig('Misc', 'CacheHandler', $cache_handler); + + $memcache_servers = $this->GetVar('memcache_servers'); + + if (!$memcache_servers || $memcache_servers == 'localhost:11211') { + unset($memcache_servers); + } + + $this->toolkit->setSystemConfig('Misc', 'MemcacheServers', $memcache_servers); + + $compression_engine = $this->GetVar('compression_engine'); + + if (!$compression_engine) { + unset($compression_engine); + } + + $this->toolkit->setSystemConfig('Misc', 'CompressionEngine', $compression_engine); + + $this->toolkit->SaveConfig(); + break; + case 'root_password': // update root password in database $password = md5( md5($this->Application->GetVar('root_password')) . 'b38'); @@ -1008,11 +1082,11 @@ return ; } + $this->InitApplication(); + $this->currentStep = $this->GetNextStep(); $this->InitStep(); // init next step (that will be shown now) - $this->InitApplication(); - if ($this->currentStep == -1) { // step after last step -> redirect to admin $this->Application->Redirect('index', Array (), '', 'index.php'); @@ -1225,6 +1299,12 @@ $this->Conn =& $this->Application->GetADODBConnection(); $this->toolkit->Conn =& $this->Application->GetADODBConnection(); } + + if ($this->Application && $this->Application->isDebugMode()) { + // add "System Configuration" installation step + $this->steps['fresh_install'] = Array ('check_paths', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'); + $this->steps['clean_reinstall'] = Array ('check_paths', 'clean_db', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'); + } } /** Index: install/install_toolkit.php =================================================================== --- install/install_toolkit.php (revision 14817) +++ install/install_toolkit.php (working copy) @@ -90,6 +90,12 @@ var $defaultWritablePath = ''; /** + * + * @var string + */ + var $defaultWebsitePath = ''; + + /** * Installator instance * * @var kInstallator @@ -99,6 +105,7 @@ function kInstallToolkit() { $this->defaultWritablePath = DIRECTORY_SEPARATOR . 'system'; + $this->defaultWebsitePath = rtrim(preg_replace('/'.preg_quote(rtrim(REL_PATH, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); if ( class_exists('kApplication') ) { // auto-setup in case of separate module install Index: install/step_templates/check_paths.tpl =================================================================== --- install/step_templates/check_paths.tpl (revision 14817) +++ install/step_templates/check_paths.tpl (working copy) @@ -9,6 +9,11 @@ $folder_tpl = ob_get_clean(); $writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath'); + + if (!$writeable_base) { + $writeable_base = $this->toolkit->defaultWritablePath; + } + foreach ($this->writeableFolders as $folder_path) { $file_path = str_replace('$1', $writeable_base, $folder_path); if (file_exists(FULL_PATH . $file_path)) { Index: install/step_templates/install_setup.tpl =================================================================== --- install/step_templates/install_setup.tpl (revision 14817) +++ install/step_templates/install_setup.tpl (working copy) @@ -36,6 +36,7 @@ 'clean_reinstall' => 'Reinstall In-Portal', 'fresh_install' => 'Install In-Portal to a New Database', 'update_license' => 'Update License Information', + 'sys_config' => 'Update System Configuration', 'db_reconfig' => 'Update Database Configuration', 'fix_paths' => 'Update Installation Paths', ); Index: install/step_templates/sys_config.tpl =================================================================== --- install/step_templates/sys_config.tpl (revision 0) +++ install/step_templates/sys_config.tpl (revision 0) @@ -0,0 +1,172 @@ +toolkit->getSystemConfig('Misc', 'WebsitePath'); + + if (!$website_path) { + $website_path = $this->toolkit->defaultWebsitePath; + } + + $writeable_path = $this->toolkit->getSystemConfig('Misc', 'WriteablePath'); + + if (!$writeable_path) { + $writeable_path = $this->toolkit->defaultWritablePath; + } + + $admin_directory = $this->toolkit->getSystemConfig('Misc', 'AdminDirectory'); + + if (!$admin_directory) { + $admin_directory = '/admin'; + } + + $admin_presets_directory = $this->toolkit->getSystemConfig('Misc', 'AdminPresetsDirectory'); + + if (!$admin_presets_directory) { + $admin_presets_directory = '/admin'; + } + + $application_class = $this->toolkit->getSystemConfig('Misc', 'ApplicationClass'); + + if (!$application_class) { + $application_class = 'kApplication'; + } + + $application_path = $this->toolkit->getSystemConfig('Misc', 'ApplicationPath'); + + if (!$application_path) { + $application_path = '/core/kernel/application.php'; + } + + $cache_handler = $this->toolkit->getSystemConfig('Misc', 'CacheHandler'); + + $cache_handlers = Array('Memcache' => 1, 'XCache' => 1, 'Apc' => 1); + + foreach ($cache_handlers AS $current_cache_handler => $is_enabled) { + $handler_class = $current_cache_handler.'CacheHandler'; + $handler = new $handler_class(); + if (!$handler->isWorking()) { + $cache_handlers[$current_cache_handler] = 0; + } else { + if (!$cache_handler) { + $cache_handler = $current_cache_handler; + } + } + } + + $memcache_servers = $this->toolkit->getSystemConfig('Misc', 'MemcacheServers'); + + if (!$memcache_servers) { + $memcache_servers = 'localhost:11211'; + } + + $compression_engine = $this->toolkit->getSystemConfig('Misc', 'CompressionEngine'); + + $comprecssion_engines = Array('PHP-based' => 1, 'YUICompressor (Java)' => 1); + + if (function_exists('gzencode') && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) { + $compression_engine = 'PHP-based'; + } else { + $compression_engines['PHP-based'] = 0; + } + + exec('java -version', $output); + + if (strpos($output, 'Java Version') !== false) { + $compression_engine = 'YUICompressor (Java)'; + } else { + $compression_engines['YUICompressor (Java)'] = 0; + } + + +?> + + + + WebsitePath: + + + + + + + + WriteablePath: + + + + + + + + AdminDirectory: + + + + + + + + AdminPresetsDirectory: + + + + + + + + ApplicationClass: + + + + + + + + ApplicationPath: + + + + + + + + CacheHandler: + + + + + + + + MemcacheServers: + + + + + + + + CompressionEngine: + + + + + Index: install/steps_db.xml =================================================================== --- install/steps_db.xml (revision 14817) +++ install/steps_db.xml (working copy) @@ -100,6 +100,14 @@ ]]> + + These are system advanced settings and must be changed with caution.

+
+

It's not recommended to change these settings unless you know what you are doing.

+
+

These settings will be stored in system/config.php file and can be changed manually if needed.

+ ]]> +
Selected theme will be used as a default in your In-Portal website.

You can manage your themes in Admin Console under Configuration -> Website -> Themes section.

Index: kernel/startup.php =================================================================== --- kernel/startup.php (revision 14817) +++ kernel/startup.php (working copy) @@ -65,17 +65,31 @@ exit; } - // variable WebsitePath is auto-detected once during installation/upgrade + // variable WebsitePath may be set once during installation/upgrade + if (!isset($vars['WebsitePath'])) { + if (defined('REL_PATH')) { + // location of index.php relatively to site base folder + $relative_path = preg_replace('/^[\/]{0,1}admin(.*)/', $admin_directory . '\\1', REL_PATH); + } + else { + // default index.php relative location is administrative console folder + define('REL_PATH', $admin_directory); + $relative_path = REL_PATH; + } + $vars['WebsitePath'] = rtrim(preg_replace('/' . preg_quote(rtrim($relative_path, '/'), '/') . '$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); + } define('BASE_PATH', $vars['WebsitePath']); define('APPLICATION_CLASS', isset($vars['ApplicationClass']) ? $vars['ApplicationClass'] : 'kApplication'); define('APPLICATION_PATH', isset($vars['ApplicationPath']) ? $vars['ApplicationPath'] : '/core/kernel/application.php'); - if (isset($vars['WriteablePath'])) { - define('WRITEABLE', FULL_PATH . $vars['WriteablePath']); - define('WRITEBALE_BASE', $vars['WriteablePath']); + if (!isset($vars['WriteablePath'])) { + $vars['WriteablePath'] = DIRECTORY_SEPARATOR . 'system'; } + define('WRITEABLE', FULL_PATH . $vars['WriteablePath']); + define('WRITEBALE_BASE', $vars['WriteablePath']); + if ( isset($vars['RestrictedPath']) ) { define('RESTRICTED', FULL_PATH . $vars['RestrictedPath']); }