Index: branches/5.3.x/core/kernel/utility/http_query.php =================================================================== diff -u -N -r15974 -r15999 --- branches/5.3.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 15974) +++ branches/5.3.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 15999) @@ -1,6 +1,6 @@ Application->recallObject('SiteHelper'); /* @var $site_helper SiteHelper */ - $found = false; - $http_referer = $_SERVER['HTTP_REFERER']; - preg_match('/^(.*?):\/\/(.*?)(\/|$)/', $http_referer, $regs); // 1 - protocol, 2 - domain + $parsed_url = parse_url($_SERVER['HTTP_REFERER']); - if ($regs[1] == 'https') { - $found = $site_helper->getDomainByName('SSLUrl', $http_referer) > 0; - - if (!$found) { - // check if referer starts with our ssl url - $ssl_url = $this->Application->ConfigValue('SSL_URL'); - $found = $ssl_url && preg_match('/^' . preg_quote($ssl_url, '/') . '/', $http_referer); - } + if ( $parsed_url['scheme'] == 'https' ) { + $found = $site_helper->compare($parsed_url['host'], 'SSLDomainName', $this->Application->ConfigValue('SSLDomain')); } else { - $found = $site_helper->getDomainByName('DomainName', $regs[2]) > 0; - - if (!$found) { - $found = $regs[2] == DOMAIN; - } + $found = $site_helper->compare($parsed_url['host'], 'DomainName', DOMAIN); } return $found; @@ -770,4 +758,4 @@ return $headers; } -} +} \ No newline at end of file Index: branches/5.3.x/core/units/helpers/skin_helper.php =================================================================== diff -u -N -r15928 -r15999 --- branches/5.3.x/core/units/helpers/skin_helper.php (.../skin_helper.php) (revision 15928) +++ branches/5.3.x/core/units/helpers/skin_helper.php (.../skin_helper.php) (revision 15999) @@ -1,6 +1,6 @@ Application->BaseURL( str_replace(DIRECTORY_SEPARATOR, '/', WRITEBALE_BASE) ) . 'user_files'; + $sub_folder = str_replace(DIRECTORY_SEPARATOR, '/', WRITEBALE_BASE) . '/user_files'; + + return $this->Application->BaseURL() . ltrim($sub_folder, '/'); } return WRITEABLE . DIRECTORY_SEPARATOR . 'user_files'; Index: branches/5.3.x/core/kernel/managers/url_manager.php =================================================================== diff -u -N -r15974 -r15999 --- branches/5.3.x/core/kernel/managers/url_manager.php (.../url_manager.php) (revision 15974) +++ branches/5.3.x/core/kernel/managers/url_manager.php (.../url_manager.php) (revision 15999) @@ -1,6 +1,6 @@ Application->recallObject('Session'); /* @var $session Session */ - $target_url = rtrim($this->Application->BaseURL('', $ssl, false), '/'); + $target_url = rtrim($this->Application->BaseURL('', $ssl), '/'); $cookie_url = trim($session->CookieDomain . $session->CookiePath, '/.'); // set session to GET_ONLY, to pass sid only if sid is REAL AND session is set @@ -190,6 +190,12 @@ unset($params['__NO_SID__']); } + $domain = ''; + if ( isset($params['domain']) ) { + $domain = $params['domain']; + unset($params['domain']); + } + // append pass through variables to each link to be build $params = array_merge($this->getPassThroughVariables($params), $params); @@ -213,7 +219,11 @@ $url = $index_file . '?' . $this->plain->build($t, $params, $pass, $pass_events); } - return $this->Application->BaseURL($prefix, $ssl) . $url . $map_link; + if ( $prefix ) { + $prefix = trim($prefix, '/') . '/'; + } + + return $this->Application->BaseURL($domain, $ssl) . $prefix . $url . $map_link; } /** @@ -235,8 +245,13 @@ $ssl = isset($params['__SSL__']) ? $params['__SSL__'] : null; list($index_file, $env) = explode('|', $opener_stack->get(kOpenerStack::LAST_ELEMENT, true)); - $ret = $this->Application->BaseURL($prefix, $ssl) . $index_file . '?' . ENV_VAR_NAME . '=' . $env; + if ( $prefix ) { + $prefix = trim($prefix, '/') . '/'; + } + + $ret = $this->Application->BaseURL('', $ssl) . $prefix . $index_file . '?' . ENV_VAR_NAME . '=' . $env; + if ( isset($params['m_opener']) && $params['m_opener'] == 'u' ) { $opener_stack->pop(); $opener_stack->save(true); Index: branches/5.3.x/core/units/helpers/file_helper.php =================================================================== diff -u -N -r15902 -r15999 --- branches/5.3.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 15902) +++ branches/5.3.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 15999) @@ -1,6 +1,6 @@ Application->BaseURL(), '/') . $url; + return rtrim($this->Application->BaseURL($domain), '/') . $path; } /** * Transforms given url to path to it * - * @param string $url + * @param string $url Url. + * @param string|null $domain Alternative domain to use in url. + * * @return string - * @access public */ - public function urlToPath($url) + public function urlToPath($url, $domain = null) { - $base_url = rtrim($this->Application->BaseURL(), '/'); + $base_url = rtrim($this->Application->BaseURL($domain), '/'); // escape replacement patterns, like "\" $full_path = preg_replace('/(\\\[\d]+)/', '\\\\\1', FULL_PATH); Index: branches/5.3.x/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r15974 -r15999 --- branches/5.3.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 15974) +++ branches/5.3.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 15999) @@ -1,6 +1,6 @@ Application->isAdmin ? $this->Application->ConfigValue('AdminSSL_URL') : false; + $ssl_domain = $this->Application->getSecureDomain(); - if ( !$ssl ) { - // not in admin or admin ssl url is empty - $ssl_url = $this->Application->siteDomainField('SSLUrl'); - $ssl = $ssl_url !== false ? $ssl_url : $this->Application->ConfigValue('SSL_URL'); - } - - if ( !$ssl || ($this->Application->TemplatesCache->forceThemeName !== false) ) { + if ( !$ssl_domain || ($this->Application->TemplatesCache->forceThemeName !== false) ) { // SSL URL is not set - no way to require SSL // internal parsing (e.g. "TemplateParser::_parseTemplate") -> don't redirect return; Index: branches/5.3.x/core/units/helpers/fck_helper.php =================================================================== diff -u -N -r15974 -r15999 --- branches/5.3.x/core/units/helpers/fck_helper.php (.../fck_helper.php) (revision 15974) +++ branches/5.3.x/core/units/helpers/fck_helper.php (.../fck_helper.php) (revision 15999) @@ -1,6 +1,6 @@ config = Array ( 'toolbar' => $toolbar, - 'baseHref' => $this->Application->BaseURL( rtrim(EDITOR_PATH, '/') ), + 'baseHref' => $this->Application->BaseURL() . trim(EDITOR_PATH, '/') . '/', 'customConfig' => $this->getJavaScriptConfig(), 'stylesSet' => 'portal:' . $styles_js, 'contentsCss' => $styles_css, @@ -523,18 +523,18 @@ */ protected function getStyles() { - $theme_path = $this->Application->GetFrontThemePath() . '/inc'; + $theme_path = ltrim($this->Application->GetFrontThemePath(), '/') . '/inc'; - if ( file_exists(FULL_PATH . $theme_path . '/style.css') ) { + if ( file_exists(FULL_PATH . '/' . $theme_path . '/style.css') ) { $url_params = Array ('events[fck]' => 'OnGetsEditorStyles', 'no_pass_through' => 1, 'pass' => 'm'); $styles_css = $this->Application->HREF('index', '_FRONT_END_', $url_params, 'index.php'); } else { - $theme_path = rtrim(EDITOR_PATH, '/'); - $styles_css = $this->Application->BaseURL($theme_path) . 'style.css'; + $theme_path = trim(EDITOR_PATH, '/'); + $styles_css = $this->Application->BaseURL() . $theme_path . '/style.css'; } - $styles_js = $this->Application->BaseURL($theme_path) . 'styles.js'; + $styles_js = $this->Application->BaseURL() . $theme_path . '/styles.js'; return array($styles_css, $styles_js); } Index: branches/5.3.x/core/install/upgrades.php =================================================================== diff -u -N -r15956 -r15999 --- branches/5.3.x/core/install/upgrades.php (.../upgrades.php) (revision 15956) +++ branches/5.3.x/core/install/upgrades.php (.../upgrades.php) (revision 15999) @@ -1,6 +1,6 @@ updateDeploymentLog(); + $this->migrateSSLSettings(); + $this->migrateSSLSiteDomains(); } } @@ -2444,4 +2446,56 @@ $sql = 'ALTER TABLE ' . $table_name . ' DROP AppliedDBRevisions'; $this->Conn->Query($sql); } + + /** + * Migrates SSL settings to new format. + * + * @return void + */ + protected function migrateSSLSettings() + { + $mapping = array( + 'SSL_URL' => 'SSLDomain', + 'AdminSSL_URL' => 'AdminSSLDomain', + ); + + foreach ( $mapping as $old_setting => $new_setting ) { + $old_value = $this->Application->ConfigValue($old_setting); + + if ( $old_value ) { + $this->Application->SetConfigValue($new_setting, parse_url($old_value, PHP_URL_HOST)); + } + + $sql = 'DELETE FROM ' . $this->Application->getUnitConfig('conf')->getTableName() . ' + WHERE VariableName = ' . $this->Conn->qstr($old_setting); + $this->Conn->Query($sql); + } + } + + /** + * Migrates SSL site domains. + * + * @return void + */ + protected function migrateSSLSiteDomains() + { + /** @var kDBItem $object */ + $object = $this->Application->recallObject('site-domain.migrate', null, array('skip_autoload' => true)); + + $sql = 'SELECT * + FROM ' . $this->Application->getUnitConfig('site-domain')->getTableName() . ' + WHERE SSLDomainName <> ""'; + $site_domains = $this->Conn->Query($sql); + + foreach ( $site_domains as $site_domain ) { + if ( strpos($site_domain['SSLDomainName'], '//') === false ) { + continue; + } + + // use object to reset domain cache as well + $object->LoadFromHash($site_domain); + $object->SetDBField('SSLDomainName', parse_url($site_domain['SSLDomainName'], PHP_URL_HOST)); + $object->Update(); + } + } } \ No newline at end of file Index: branches/5.3.x/core/install/step_templates/security.tpl =================================================================== diff -u -N -r15962 -r15999 --- branches/5.3.x/core/install/step_templates/security.tpl (.../security.tpl) (revision 15962) +++ branches/5.3.x/core/install/step_templates/security.tpl (.../security.tpl) (revision 15999) @@ -48,7 +48,7 @@ $curl_helper = $this->Application->recallObject('CurlHelper'); /* @var $curl_helper kCurlHelper */ - $result = $curl_helper->Send($this->Application->BaseURL(WRITEBALE_BASE) . 'install_check.php'); + $result = $curl_helper->Send($this->Application->BaseURL() . ltrim(WRITEBALE_BASE, '/') . '/install_check.php'); unlink(WRITEABLE . '/install_check.php'); $execute_check = ($result !== 'OK'); Index: branches/5.3.x/core/install/install_schema.sql =================================================================== diff -u -N -r15986 -r15999 --- branches/5.3.x/core/install/install_schema.sql (.../install_schema.sql) (revision 15986) +++ branches/5.3.x/core/install/install_schema.sql (.../install_schema.sql) (revision 15999) @@ -1346,8 +1346,8 @@ DomainId int(11) NOT NULL AUTO_INCREMENT, DomainName varchar(255) NOT NULL DEFAULT '', DomainNameUsesRegExp tinyint(4) NOT NULL DEFAULT '0', - SSLUrl varchar(255) NOT NULL DEFAULT '', - SSLUrlUsesRegExp tinyint(4) NOT NULL DEFAULT '0', + SSLDomainName varchar(255) NOT NULL DEFAULT '', + SSLDomainNameUsesRegExp tinyint(4) NOT NULL DEFAULT '0', AdminEmail varchar(255) NOT NULL DEFAULT '', DefaultEmailRecipients text, Country varchar(3) NOT NULL DEFAULT '', @@ -1362,8 +1362,8 @@ PRIMARY KEY (DomainId), KEY DomainName (DomainName), KEY DomainNameUsesRegExp (DomainNameUsesRegExp), - KEY SSLUrl (SSLUrl), - KEY SSLUrlUsesRegExp (SSLUrlUsesRegExp), + KEY SSLDomainName (SSLDomainName), + KEY SSLDomainNameUsesRegExp (SSLDomainNameUsesRegExp), KEY AdminEmail (AdminEmail), KEY Country (Country), KEY PrimaryLanguageId (PrimaryLanguageId), Index: branches/5.3.x/core/units/site_domains/site_domains_config.php =================================================================== diff -u -N -r15659 -r15999 --- branches/5.3.x/core/units/site_domains/site_domains_config.php (.../site_domains_config.php) (revision 15659) +++ branches/5.3.x/core/units/site_domains/site_domains_config.php (.../site_domains_config.php) (revision 15999) @@ -1,6 +1,6 @@ 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0 ), - 'SSLUrl' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''), - 'SSLUrlUsesRegExp' => Array ( + 'SSLDomainName' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''), + 'SSLDomainNameUsesRegExp' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0 @@ -146,7 +146,7 @@ 'Fields' => Array ( 'DomainId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 70, ), 'DomainName' => Array ('filter_block' => 'grid_like_filter', 'width' => 250, ), - 'SSLUrl' => Array ('filter_block' => 'grid_like_filter', 'width' => 250, ), + 'SSLDomainName' => Array ('filter_block' => 'grid_like_filter', 'width' => 250, ), 'Country' => Array ('filter_block' => 'grid_options_filter', 'width' => 250, ), 'PrimaryLanguageId' => Array ('title' => 'column:la_fld_Language', 'filter_block' => 'grid_options_filter', 'width' => 250, ), 'PrimaryThemeId' => Array ('title' => 'column:la_fld_Theme', 'filter_block' => 'grid_options_filter', 'width' => 250, ), Index: branches/5.3.x/core/install/english.lang =================================================================== diff -u -N -r15963 -r15999 --- branches/5.3.x/core/install/english.lang (.../english.lang) (revision 15963) +++ branches/5.3.x/core/install/english.lang (.../english.lang) (revision 15999) @@ -144,7 +144,7 @@ QXNjZW5kaW5n RGVzY2VuZGluZw== QWRtaW4gQ29uc29sZSBJbnRlcmZhY2U= - U1NMIEZ1bGwgVVJMIGZvciBBZG1pbmlzdHJhdGl2ZSBDb25zb2xlIChodHRwczovL3d3dy5kb21haW4uY29tL3BhdGgpIA== + U1NMIERvbWFpbiBmb3IgQWRtaW5pc3RyYXRpdmUgQ29uc29sZSAod3d3LmRvbWFpbi5jb20p QWxsb3cgdG8gc2VsZWN0IG1lbWJlcnNoaXAgZ3JvdXAgb24gRnJvbnQtZW5k TGlzdCBhdXRvbWF0aWMgcmVmcmVzaCBpbnRlcnZhbHMgKGluIG1pbnV0ZXMp QmFja3VwIFBhdGg= @@ -211,7 +211,7 @@ V2Vic2l0ZSBTdWJ0aXRsZQ== VGltZSB6b25lIG9mIHRoZSBzaXRl VGVtcGxhdGUgZm9yIFNvZnQgTWFpbnRlbmFuY2U= - U1NMIEZ1bGwgVVJMIChodHRwczovL3d3dy5kb21haW4uY29tL3BhdGgp + U1NMIERvbWFpbiAod3d3LmRvbWFpbi5jb20p VXNlIFN0aWNreSBHcmlkIFNlbGVjdGlvbg== U2VuZCBVc2VyLWRlZmluZWQgIlN5c3RlbSBMb2ciIG1lc3NhZ2VzIHRv S2VlcCAiU3lzdGVtIExvZyIgZm9y @@ -680,7 +680,7 @@ U291cmNlIFRleHQgVmVyc2lvbiAoZnJvbSAlcyk= U291cmNlIFN1YmplY3QgKGZyb20gJXMp U291cmNlIFBocmFzZSAoZnJvbSAlcyk= - U1NMIEZ1bGwgVVJM + U1NMIERvbWFpbiBOYW1l U3RhcnQgRGF0ZQ== U3RhdGU= U3RhdGUgQ291bnRyeQ== Index: branches/5.3.x/core/admin_templates/site_domains/site_domain_edit.tpl =================================================================== diff -u -N -r15902 -r15999 --- branches/5.3.x/core/admin_templates/site_domains/site_domain_edit.tpl (.../site_domain_edit.tpl) (revision 15902) +++ branches/5.3.x/core/admin_templates/site_domains/site_domain_edit.tpl (.../site_domain_edit.tpl) (revision 15999) @@ -75,8 +75,8 @@ - - + + Index: branches/5.3.x/core/install/install_data.sql =================================================================== diff -u -N -r15976 -r15999 --- branches/5.3.x/core/install/install_data.sql (.../install_data.sql) (revision 15976) +++ branches/5.3.x/core/install/install_data.sql (.../install_data.sql) (revision 15999) @@ -56,8 +56,8 @@ INSERT INTO SystemSettings VALUES(DEFAULT, 'SessionBrowserSignatureCheck', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_SessionBrowserSignatureCheck', 'checkbox', NULL, NULL, 20.04, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'SessionIPAddressCheck', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_SessionIPAddressCheck', 'checkbox', NULL, NULL, 20.05, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'UseJSRedirect', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_use_js_redirect', 'checkbox', '', '', 20.06, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'SSL_URL', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_ssl_url', 'text', '', '', 30.01, 0, 1, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'AdminSSL_URL', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_AdminSSL_URL', 'text', '', '', 30.02, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'SSLDomain', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_SSLDomain', 'text', '', '', 30.01, 0, 1, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'AdminSSLDomain', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_AdminSSLDomain', 'text', '', '', 30.02, 0, 0, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'Require_SSL', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_require_ssl', 'checkbox', '', '', 30.03, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'Require_AdminSSL', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_RequireSSLAdmin', 'checkbox', '', '', 30.04, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'Force_HTTP_When_SSL_Not_Required', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_force_http', 'checkbox', '', '', 30.05, 0, 1, NULL); Index: branches/5.3.x/core/install.php =================================================================== diff -u -N -r15962 -r15999 --- branches/5.3.x/core/install.php (.../install.php) (revision 15962) +++ branches/5.3.x/core/install.php (.../install.php) (revision 15999) @@ -1,6 +1,6 @@ Application->recallObject('CurlHelper'); /* @var $curl_helper kCurlHelper */ - $output = $curl_helper->Send($this->Application->BaseURL(WRITEBALE_BASE) . 'install_check.php'); + $output = $curl_helper->Send($this->Application->BaseURL() . ltrim(WRITEBALE_BASE, '/') . '/install_check.php'); unlink(WRITEABLE . '/install_check.php'); $execute_check = ($output !== 'OK'); Index: branches/5.3.x/core/units/helpers/site_helper.php =================================================================== diff -u -N -r15698 -r15999 --- branches/5.3.x/core/units/helpers/site_helper.php (.../site_helper.php) (revision 15698) +++ branches/5.3.x/core/units/helpers/site_helper.php (.../site_helper.php) (revision 15999) @@ -1,6 +1,6 @@ getSiteDomains(); - $name_fields = Array ('DomainName', 'SSLUrl'); + $name_fields = Array ('DomainName', 'SSLDomainName'); foreach ($site_domains as $id => $site_domain) { if ( in_array($field, $name_fields) ) { @@ -115,7 +115,7 @@ $site_domain[$field] = preg_quote($site_domain[$field], '/'); } - if ( $site_domain[$field] && preg_match('/^' . $site_domain[$field] . ($field == 'DomainName' ? '$' : '') . '/', $value) ) { + if ( $site_domain[$field] && preg_match('/^' . $site_domain[$field] . '$/', $value) ) { return $id; } } @@ -144,4 +144,20 @@ return false; } + + /** + * Compares 2 domains. + * + * @param string $match_domain Domain to compare with. + * @param string $domain_field Site domain field to search within. + * @param string $primary_domain Primary domain to use in case if no site domain matches. + * + * @return boolean + */ + public function compare($match_domain, $domain_field, $primary_domain) + { + $domain_id = $this->getDomainByName($domain_field, $match_domain); + + return $domain_id > 0 ? true : ($match_domain == $primary_domain); + } } Index: branches/5.3.x/core/kernel/application.php =================================================================== diff -u -N -r15980 -r15999 --- branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15980) +++ branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15999) @@ -1,6 +1,6 @@ isAdmin ? $this->ConfigValue('AdminSSL_URL') : false; + $protocol = 'https://'; + $domain = $this->getSecureDomain(); + } + else { + // going from https:// to http:// + $protocol = 'http://'; + $domain = $this->siteDomainField('DomainName'); - if ( !$base_url ) { - $ssl_url = $this->siteDomainField('SSLUrl'); - $base_url = $ssl_url !== false ? $ssl_url : $this->ConfigValue('SSL_URL'); + if ( $domain === false ) { + $domain = DOMAIN; // not on site domain } - - return rtrim($base_url, '/') . $prefix . '/'; } - // going from https:// to http:// - $domain = $this->siteDomainField('DomainName'); + return $protocol . $domain . (defined('PORT') ? ':' . PORT : '') . BASE_PATH . '/'; + } - if ( $domain === false ) { - $domain = DOMAIN; + /** + * Returns secure domain. + * + * @return string + */ + public function getSecureDomain() + { + $ret = $this->isAdmin ? $this->ConfigValue('AdminSSLDomain') : false; + + if ( !$ret ) { + $ssl_domain = $this->siteDomainField('SSLDomainName'); + + return strlen($ssl_domain) ? $ssl_domain : $this->ConfigValue('SSLDomain'); } - return 'http://' . $domain . ($add_port && defined('PORT') ? ':' . PORT : '') . BASE_PATH . $prefix . '/'; + return $ret; } /** @@ -3044,4 +3057,4 @@ { return $this->HttpQuery->getClientIp(); } -} +} \ No newline at end of file Index: branches/5.3.x/core/units/site_domains/site_domain_eh.php =================================================================== diff -u -N -r15902 -r15999 --- branches/5.3.x/core/units/site_domains/site_domain_eh.php (.../site_domain_eh.php) (revision 15902) +++ branches/5.3.x/core/units/site_domains/site_domain_eh.php (.../site_domain_eh.php) (revision 15999) @@ -1,6 +1,6 @@ setEventParam('raise_warnings', 0); } else { - if ( PROTOCOL == 'https://' ) { - return $this->querySiteDomain('SSLUrl', rtrim($this->Application->BaseURL(), '/')); - } + $domain_field = PROTOCOL == 'https://' ? 'SSLDomainName' : 'DomainName'; - return $this->querySiteDomain('DomainName', $_SERVER['HTTP_HOST']); + return $this->querySiteDomain($domain_field, $_SERVER['HTTP_HOST']); } } @@ -85,10 +83,8 @@ } elseif (($redirect_mode == SITE_DOMAIN_REDIRECT_CURRENT) && ($domain_by_ip != $domain_by_name)) { // redirect to a domain detected by IP (when not already on it) - if ((PROTOCOL == 'https://') && !$site_domain['SSLUrlUsesRegExp'] && $site_domain['SSLUrl']) { - // need to remove sub folder from ssl url - $ssl_url = preg_replace('/^(https:\/\/[^\/]*)(\/.*){0,1}$/', '\\1', $site_domain['SSLUrl']); - $this->Application->Redirect('external:' . $ssl_url . $_SERVER['REQUEST_URI']); + if ((PROTOCOL == 'https://') && !$site_domain['SSLDomainNameUsesRegExp'] && $site_domain['SSLDomainName']) { + $this->Application->Redirect('external:https://' . $site_domain['SSLDomainName'] . $_SERVER['REQUEST_URI']); } elseif ((PROTOCOL == 'http://') && !$site_domain['DomainNameUsesRegExp']) { $this->Application->Redirect('external:http://' . $site_domain['DomainName'] . $_SERVER['REQUEST_URI']); Index: branches/5.3.x/core/install/upgrades.sql =================================================================== diff -u -N -r15986 -r15999 --- branches/5.3.x/core/install/upgrades.sql (.../upgrades.sql) (revision 15986) +++ branches/5.3.x/core/install/upgrades.sql (.../upgrades.sql) (revision 15999) @@ -2994,3 +2994,12 @@ ALTER TABLE UserGroupRelations DROP PRIMARY KEY; ALTER TABLE UserGroupRelations ADD Id int(11) NOT NULL auto_increment FIRST, ADD PRIMARY KEY (Id), ADD UNIQUE KEY UserGroup (PortalUserId, GroupId); ALTER TABLE SpamControl ADD Id int(11) NOT NULL auto_increment FIRST, ADD PRIMARY KEY (Id); + +INSERT INTO SystemSettings VALUES(DEFAULT, 'SSLDomain', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_SSLDomain', 'text', '', '', 30.01, 0, 1, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'AdminSSLDomain', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSSL', 'la_config_AdminSSLDomain', 'text', '', '', 30.02, 0, 0, NULL); +DELETE FROM LanguageLabels WHERE PhraseKey IN ('LA_CONFIG_SSL_URL', 'LA_CONFIG_ADMINSSL_URL', 'LA_FLD_SSLURL'); + +ALTER TABLE SiteDomains + CHANGE SSLUrl SSLDomainName VARCHAR(255) NOT NULL DEFAULT '', + CHANGE SSLUrlUsesRegExp SSLDomainNameUsesRegExp TINYINT(4) NOT NULL DEFAULT '0'; +DELETE FROM UserPersistentSessionData WHERE VariableName = 'site-domain[Default]columns_.'; Index: branches/5.3.x/core/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r15988 -r15999 --- branches/5.3.x/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 15988) +++ branches/5.3.x/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 15999) @@ -1,6 +1,6 @@ Application->SetConfigValue($variable_name, $object->GetDBField('VariableValue'), true); } - if ( $variable_name == 'Require_AdminSSL' || $variable_name == 'AdminSSL_URL' ) { + if ( $variable_name == 'Require_AdminSSL' || $variable_name == 'AdminSSLDomain' ) { // when administrative console is moved to SSL mode, then delete skin if ( in_array($variable_name, $changed) && !$skin_deleted ) { $skin_helper = $this->Application->recallObject('SkinHelper'); Index: branches/5.3.x/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r15988 -r15999 --- branches/5.3.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 15988) +++ branches/5.3.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 15999) @@ -1,6 +1,6 @@ Application->recallObject('CatItemExportHelper'); /*list ($index_file, $env) = explode('|', $this->Application->RecallVar('last_template')); - $finish_url = $this->Application->BaseURL('/admin') . $index_file . '?' . ENV_VAR_NAME . '=' . $env; + $finish_url = $this->Application->BaseURL() . 'admin/' . $index_file . '?' . ENV_VAR_NAME . '=' . $env; $this->Application->StoreVar('export_finish_url', $finish_url);*/ $redirect_params = Array ( Index: branches/5.3.x/admin/system_presets/simple/site_domains_site-domain.php =================================================================== diff -u -N -r15902 -r15999 --- branches/5.3.x/admin/system_presets/simple/site_domains_site-domain.php (.../site_domains_site-domain.php) (revision 15902) +++ branches/5.3.x/admin/system_presets/simple/site_domains_site-domain.php (.../site_domains_site-domain.php) (revision 15999) @@ -23,7 +23,7 @@ // fields to hide $hidden_fields = Array ( - /*'DomainId', 'DomainName', 'SSLUrl', 'AdminEmail', 'Country', 'PrimaryLanguageId', 'Languages', 'PrimaryThemeId', 'PrimaryThemeId', 'Themes', 'DomainIPRange', 'ExternalUrl', 'RedirectOnIPMatch', 'Priority', */ + /*'DomainId', 'DomainName', 'SSLDomainName', 'AdminEmail', 'Country', 'PrimaryLanguageId', 'Languages', 'PrimaryThemeId', 'PrimaryThemeId', 'Themes', 'DomainIPRange', 'ExternalUrl', 'RedirectOnIPMatch', 'Priority', */ ); // virtual fields to hide @@ -33,7 +33,7 @@ // fields to make required $required_fields = Array ( - /*'DomainId',*/ 'DomainName', /* 'SSLUrl', 'AdminEmail', 'Country', 'PrimaryLanguageId', 'Languages', 'PrimaryThemeId', 'PrimaryThemeId', 'Themes', 'DomainIPRange', 'ExternalUrl', 'RedirectOnIPMatch', 'Priority', */ + /*'DomainId',*/ 'DomainName', /* 'SSLDomainName', 'AdminEmail', 'Country', 'PrimaryLanguageId', 'Languages', 'PrimaryThemeId', 'PrimaryThemeId', 'Themes', 'DomainIPRange', 'ExternalUrl', 'RedirectOnIPMatch', 'Priority', */ ); // virtual fields to make required @@ -48,5 +48,5 @@ // hide columns in grids $hide_columns = Array ( -// 'Default' => Array ('DomainId', 'DomainName', 'SSLUrl', 'Country', 'PrimaryLanguageId', 'PrimaryThemeId', 'Priority', ), +// 'Default' => Array ('DomainId', 'DomainName', 'SSLDomainName', 'Country', 'PrimaryLanguageId', 'PrimaryThemeId', 'Priority', ), );