Index: core/editor/editor/filemanager/connectors/php/config.php =================================================================== --- core/editor/editor/filemanager/connectors/php/config.php (revision 14653) +++ core/editor/editor/filemanager/connectors/php/config.php (working copy) @@ -24,7 +24,6 @@ define('DBG_SKIP_REPORTING', 1); define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../..') ); -define('REL_PATH', 'core/editor/editor/filemanager/connectors/php'); include_once(FULL_PATH.'/core/kernel/startup.php'); Index: core/install.php =================================================================== --- core/install.php (revision 14671) +++ core/install.php (working copy) @@ -63,7 +63,7 @@ var $stepsPreset = ''; /** - * Installtion steps to be done + * Installation steps to be done * * @var Array */ @@ -170,13 +170,19 @@ } if ( !$this->toolkit->getSystemConfig('Misc', 'WriteablePath') ) { - // set global writable folder when such setting is missing $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $this->toolkit->defaultWritablePath); - $this->toolkit->SaveConfig(true); // immediately save, because this path will be used in Application later } 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); } @@ -801,7 +807,6 @@ $config_values = Array ( 'RootPass' => $password, - 'Site_Path' => BASE_PATH.'/', // set Site_Path (for SSL & old in-portal code) 'Backup_Path' => FULL_PATH . $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . 'backupdata', 'Smtp_AdminMailFrom' => 'portal@' . $this->toolkit->getSystemConfig('Misc', 'Domain') ); @@ -876,7 +881,7 @@ FROM ' . $theme_table . ' WHERE ' . $theme_idfield . ' = ' . $theme_id; $theme_name = $this->Conn->GetOne($sql); - $site_path = $this->Application->ConfigValue('Site_Path'); + $site_path = $this->toolkit->getSystemConfig('Misc', 'WebsitePath') . '/'; $file_helper =& $this->Application->recallObject('FileHelper'); /* @var $file_helper FileHelper */ @@ -1242,16 +1247,18 @@ /** * Show next step screen * + * @param string $error_message + * @return void */ function Done($error_message = null) { - if (isset($error_message)) { + if ( isset($error_message) ) { $this->errorMessage = $error_message; } - include_once (FULL_PATH.'/'.REL_PATH.'/install/incs/install.tpl'); + include_once (FULL_PATH . '/' . REL_PATH . '/install/incs/install.tpl'); - if (isset($this->Application)) { + if ( isset($this->Application) ) { $this->Application->Done(); } @@ -1662,9 +1669,9 @@ * @param string $errstr * @param string $errfile * @param int $errline - * @param Array $errcontext + * @param Array|string $errcontext */ - function ErrorHandler($errno, $errstr, $errfile = '', $errline = '', $errcontext = '') + function ErrorHandler($errno, $errstr, $errfile = '', $errline = 0, $errcontext = '') { if ($errno == E_USER_ERROR) { // only react on user fatal errors Index: core/install/install_data.sql =================================================================== --- core/install/install_data.sql (revision 14685) +++ core/install/install_data.sql (working copy) @@ -29,19 +29,18 @@ # Section "in-portal:configure_advanced": INSERT INTO ConfigurationValues VALUES(DEFAULT, 'PageHitCounter', '0', 'In-Portal', 'in-portal:configure_advanced', '', '', '', NULL, NULL, 0, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Site_Path', '/', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PathToWebsite', 'text', '', '', 10.01, 0, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseModRewrite', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_use_modrewrite', 'checkbox', '', '', 10.02, 0, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ModRewriteUrlEnding', '.html', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ModRewriteUrlEnding', 'select', '', '=+||/=+/||.html=+.html', 10.021, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ForceModRewriteUrlEnding', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceModRewriteUrlEnding', 'checkbox', '', NULL, 10.022, 0, 0, 'la_hint_ForceModRewriteUrlEnding'); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseContentLanguageNegotiation', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseContentLanguageNegotiation', 'checkbox', '', '', 10.023, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'cms_DefaultDesign', '#default_design#', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultDesignTemplate', 'text', NULL, NULL, 10.03, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ErrorTemplate', 'error_notfound', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_error_template', 'text', '', '', 10.04, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'NoPermissionTemplate', 'no_permission', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_nopermission_template', 'text', '', '', 10.05, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UsePageHitCounter', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UsePageHitCounter', 'checkbox', '', '', 10.06, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ForceImageMagickResize', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceImageMagickResize', 'checkbox', '', '', 10.07, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_CheckStopWords', 'checkbox', '', '', 10.08, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseVisitorTracking', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseVisitorTracking', 'checkbox', '', '', 10.09, 0, 0, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'cms_DefaultTrackingCode', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultTrackingCode', 'textarea', NULL, 'COLS=40 ROWS=5', 10.10, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseModRewrite', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_use_modrewrite', 'checkbox', '', '', 10.01, 0, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ModRewriteUrlEnding', '.html', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ModRewriteUrlEnding', 'select', '', '=+||/=+/||.html=+.html', 10.011, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ForceModRewriteUrlEnding', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceModRewriteUrlEnding', 'checkbox', '', NULL, 10.012, 0, 0, 'la_hint_ForceModRewriteUrlEnding'); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseContentLanguageNegotiation', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseContentLanguageNegotiation', 'checkbox', '', '', 10.013, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'cms_DefaultDesign', '#default_design#', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultDesignTemplate', 'text', NULL, NULL, 10.02, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ErrorTemplate', 'error_notfound', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_error_template', 'text', '', '', 10.03, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'NoPermissionTemplate', 'no_permission', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_nopermission_template', 'text', '', '', 10.04, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UsePageHitCounter', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UsePageHitCounter', 'checkbox', '', '', 10.05, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ForceImageMagickResize', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceImageMagickResize', 'checkbox', '', '', 10.06, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_CheckStopWords', 'checkbox', '', '', 10.07, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseVisitorTracking', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseVisitorTracking', 'checkbox', '', '', 10.08, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'cms_DefaultTrackingCode', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultTrackingCode', 'textarea', NULL, 'COLS=40 ROWS=5', 10.09, 0, 0, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CookieSessions', '2', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_prompt_session_management', 'select', NULL, '0=lu_opt_QueryString||1=lu_opt_Cookies||2=lu_opt_AutoDetect', 20.01, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'SessionCookieName', 'sid', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_prompt_session_cookie_name', 'text', '', '', 20.02, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'SessionCookieDomains', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_SessionCookieDomains', 'textarea', '', 'rows="5" cols="40"', 20.021, 0, 0, NULL); Index: core/install/install_toolkit.php =================================================================== --- core/install/install_toolkit.php (revision 14653) +++ core/install/install_toolkit.php (working copy) @@ -75,6 +75,14 @@ var $systemConfig = Array (); /** + * Tells, that system config was changed + * + * @var bool + * @access public + */ + public $systemConfigChanged = false; + + /** * Path, used by system to store data on filesystem * * @var string @@ -197,8 +205,8 @@ * Sets module version to passed * * @param string $module_name - * @param string $module_path - * @param string $version + * @param string|bool $module_path + * @param string|bool $version */ function SetModuleVersion($module_name, $module_path = false, $version = false) { @@ -229,7 +237,7 @@ * Sets module root category to passed * * @param string $module_name - * @param string $category_id + * @param int $category_id */ function SetModuleRootCategory($module_name, $category_id = 0) { @@ -249,7 +257,7 @@ /** * Returns maximal version of given module by scanning it's upgrade scripts * - * @param string $module_name + * @param string $module_path * @return string */ function GetMaxModuleVersion($module_path) @@ -306,6 +314,8 @@ * @param string $sqls * @param mixed $replace_from * @param mixed $replace_to + * @param int $start_from + * @return bool */ function RunSQLText(&$sqls, $replace_from = null, $replace_to = null, $start_from = 0) { @@ -534,6 +544,8 @@ } fclose($fp); + + $this->systemConfigChanged = false; } /** @@ -545,6 +557,8 @@ */ function setSystemConfig($section, $key, $value = null) { + $this->systemConfigChanged = true; + if (isset($value)) { if (!array_key_exists($section, $this->systemConfig)) { // create section, when missing @@ -562,15 +576,17 @@ /** * Returns information from system config * - * @return string + * @param string $section + * @param string $key + * @return string|bool */ function getSystemConfig($section, $key) { - if (!array_key_exists($section, $this->systemConfig)) { + if ( !array_key_exists($section, $this->systemConfig) ) { return false; } - if (!array_key_exists($key, $this->systemConfig[$section])) { + if ( !array_key_exists($key, $this->systemConfig[$section]) ) { return false; } @@ -781,6 +797,7 @@ * Link custom field records with search config records + create custom field columns * * @param string $module_folder + * @param string $prefix * @param int $item_type */ function linkCustomFields($module_folder, $prefix, $item_type) @@ -822,6 +839,8 @@ /** * Deletes cache, useful after separate module install and installator last step * + * @param bool $refresh_permissions + * @return void */ function deleteCache($refresh_permissions = false) { Index: core/install/step_templates/fix_paths.tpl =================================================================== --- core/install/step_templates/fix_paths.tpl (revision 14653) +++ core/install/step_templates/fix_paths.tpl (working copy) @@ -1,5 +1,5 @@ ConfigValue('Site_Path'), '/') . $prefix . '/'; + return 'http://' . $domain . ($add_port && defined('PORT') ? ':' . PORT : '') . BASE_PATH . $prefix . '/'; } function Redirect($t = '', $params = Array(), $prefix = '', $index_file = null) Index: core/kernel/startup.php =================================================================== --- core/kernel/startup.php (revision 14653) +++ core/kernel/startup.php (working copy) @@ -29,21 +29,6 @@ $admin_Presets_directory = isset($vars['AdminPresetsDirectory']) ? $vars['AdminPresetsDirectory'] : ADMIN_DIRECTORY; define('ADMIN_PRESETS_DIRECTORY', $admin_Presets_directory); - # New path detection method: begin - 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; - } - - $ps = rtrim(preg_replace('/' . preg_quote(rtrim($relative_path, '/'), '/') . '$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); - define('BASE_PATH', $ps); - # New path detection method: end - $https_mark = getArrayValue($_SERVER, 'HTTPS'); define('PROTOCOL', ($https_mark == 'on') || ($https_mark == '1') ? 'https://' : 'http://'); @@ -73,11 +58,16 @@ if (!$vars) { echo 'In-Portal is probably not installed, or configuration file is missing.
'; echo 'Please use the installation script to fix the problem.

'; - echo 'Go to installation script

'; + + $base_path = rtrim(preg_replace('/'.preg_quote(rtrim($admin_directory, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); + echo 'Go to installation script

'; flush(); exit; } + // variable WebsitePath is auto-detected once during installation/upgrade + 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'); Index: tools/cron.php =================================================================== --- tools/cron.php (revision 14653) +++ tools/cron.php (working copy) @@ -20,7 +20,6 @@ define('CRON', 1); define('ADMIN', 1); - define('REL_PATH', 'tools'); define('FULL_PATH', realpath(dirname(__FILE__) . '/..')); define('CMD_MODE', isset($argv) && count($argv) ? 1 : 0); Index: tools/run_event.php =================================================================== --- tools/run_event.php (revision 14653) +++ tools/run_event.php (working copy) @@ -18,7 +18,6 @@ define('CRON', 1); define('ADMIN', 1); -define('REL_PATH', 'tools'); define('FULL_PATH', realpath(dirname(__FILE__) . '/..')); define('DBG_SKIP_REPORTING', 1); Index: tools/show_cache.php =================================================================== --- tools/show_cache.php (revision 14653) +++ tools/show_cache.php (working copy) @@ -17,9 +17,8 @@ $start = microtime(true); -define('FULL_PATH', realpath(dirname(__FILE__).'/..')); -define('REL_PATH', 'tools/'); define('ADMIN', 0); +define('FULL_PATH', realpath(dirname(__FILE__).'/..')); include_once(FULL_PATH.'/core/kernel/startup.php'); @@ -49,7 +48,7 @@ $var_names = $application->Conn->GetCol($sql); foreach ($var_names as $index => $var_name) { - $var_names[$index] = '' . $var_name . ''; + $var_names[$index] = '' . $var_name . ''; } kUtil::print_r( $var_names, 'Cache variable names:', true);