Index: branches/5.2.x/core/install/step_templates/fix_paths.tpl
===================================================================
diff -u -N -r14244 -r14692
--- branches/5.2.x/core/install/step_templates/fix_paths.tpl (.../fix_paths.tpl) (revision 14244)
+++ branches/5.2.x/core/install/step_templates/fix_paths.tpl (.../fix_paths.tpl) (revision 14692)
@@ -1,5 +1,5 @@
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: branches/5.2.x/core/install/install_data.sql
===================================================================
diff -u -N -r14685 -r14692
--- branches/5.2.x/core/install/install_data.sql (.../install_data.sql) (revision 14685)
+++ branches/5.2.x/core/install/install_data.sql (.../install_data.sql) (revision 14692)
@@ -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: branches/5.2.x/core/kernel/startup.php
===================================================================
diff -u -N -r14609 -r14692
--- branches/5.2.x/core/kernel/startup.php (.../startup.php) (revision 14609)
+++ branches/5.2.x/core/kernel/startup.php (.../startup.php) (revision 14692)
@@ -1,6 +1,6 @@
';
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: branches/5.2.x/core/install.php
===================================================================
diff -u -N -r14671 -r14692
--- branches/5.2.x/core/install.php (.../install.php) (revision 14671)
+++ branches/5.2.x/core/install.php (.../install.php) (revision 14692)
@@ -1,6 +1,6 @@
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: branches/5.2.x/core/kernel/application.php
===================================================================
diff -u -N -r14665 -r14692
--- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14665)
+++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14692)
@@ -1,6 +1,6 @@
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: branches/5.2.x/core/install/upgrades.sql
===================================================================
diff -u -N -r14671 -r14692
--- branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14671)
+++ branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14692)
@@ -2187,3 +2187,9 @@
KEY ResponseHttpCode (ResponseHttpCode),
KEY CurlError (CurlError)
);
+
+DELETE FROM ConfigurationValues WHERE VariableName = 'Site_Path';
+
+UPDATE ConfigurationValues
+SET DisplayOrder = DisplayOrder + 0.01
+WHERE `Section` = 'in-portal:configure_advanced' AND Heading = 'la_section_SettingsWebsite';
Index: branches/5.2.x/tools/run_event.php
===================================================================
diff -u -N -r14585 -r14692
--- branches/5.2.x/tools/run_event.php (.../run_event.php) (revision 14585)
+++ branches/5.2.x/tools/run_event.php (.../run_event.php) (revision 14692)
@@ -1,6 +1,6 @@
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);