Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support Site subdomains

Remove RPC settings (RPC uses the Site settings it is performing an action on)
  • Loading branch information...
commit c8d8ea528a9b01643a3a605149eb3c5e39878b4b 1 parent 55e5183
@haraldpdl haraldpdl authored
View
7 osCommerce/OM/Config/settings.ini
@@ -3,13 +3,6 @@ bootstrap_file = "index.php"
default_site = "Setup"
time_zone = "UTC"
-[RPC]
-enable_ssl = "false"
-http_server = ""
-dir_ws_http_server = ""
-http_cookie_domain = ""
-http_cookie_path = ""
-
[Setup]
enable_ssl = "false"
http_server = ""
View
46 osCommerce/OM/Core/OSCOM.php
@@ -55,20 +55,20 @@ public static function setSite($site = null) {
$site = static::getDefaultSite();
}
} else {
- $site = static::getDefaultSite();
-
if ( !empty($_GET) ) {
$requested_site = HTML::sanitize(basename(key(array_slice($_GET, 0, 1, true))));
if ( static::siteExists($requested_site) ) {
$site = $requested_site;
+ } else {
+ $site = static::getDefaultSite();
}
+ } else {
+ $site = static::getDefaultSite();
}
}
- if ( !empty($site) ) {
- static::$_site = $site;
- }
+ static::$_site = $site;
}
public static function getSite() {
@@ -76,7 +76,26 @@ public static function getSite() {
}
public static function getDefaultSite() {
- return static::getConfig('default_site', 'OSCOM');
+ $site = static::getConfig('default_site', 'OSCOM');
+ $server = HTML::sanitize($_SERVER['SERVER_NAME']);
+
+ $sites = array();
+
+ foreach ( static::$_config as $group => $key ) {
+ if ( isset($key['http_server']) && isset($key['https_server']) ) {
+ if ( ('http://' . $server == $key['http_server']) || ('https://' . $server == $key['https_server']) ) {
+ $sites[] = $group;
+ }
+ }
+ }
+
+ if ( count($sites) > 0 ) {
+ if ( !in_array($site, $sites) ) {
+ $site = $sites[0];
+ }
+ }
+
+ return $site;
}
public static function siteApplicationExists($application) {
@@ -213,16 +232,19 @@ public static function getLink($site = null, $application = null, $parameters =
$search_engine_safe = true;
}
+// Wrapper for RPC links; RPC cannot perform cross domain requests
+ $real_site = ($site == 'RPC') ? $application : $site;
+
if ( $connection == 'AUTO' ) {
- if ( (static::getRequestType() == 'SSL') && (static::getConfig('enable_ssl', $site) == 'true') ) {
- $link = static::getConfig('https_server', $site) . static::getConfig('dir_ws_https_server', $site);
+ if ( (static::getRequestType() == 'SSL') && (static::getConfig('enable_ssl', $real_site) == 'true') ) {
+ $link = static::getConfig('https_server', $real_site) . static::getConfig('dir_ws_https_server', $real_site);
} else {
- $link = static::getConfig('http_server', $site) . static::getConfig('dir_ws_http_server', $site);
+ $link = static::getConfig('http_server', $real_site) . static::getConfig('dir_ws_http_server', $real_site);
}
- } elseif ( ($connection == 'SSL') && (static::getConfig('enable_ssl', $site) == 'true') ) {
- $link = static::getConfig('https_server', $site) . static::getConfig('dir_ws_https_server', $site);
+ } elseif ( ($connection == 'SSL') && (static::getConfig('enable_ssl', $real_site) == 'true') ) {
+ $link = static::getConfig('https_server', $real_site) . static::getConfig('dir_ws_https_server', $real_site);
} else {
- $link = static::getConfig('http_server', $site) . static::getConfig('dir_ws_http_server', $site);
+ $link = static::getConfig('http_server', $real_site) . static::getConfig('dir_ws_http_server', $real_site);
}
$link .= static::getConfig('bootstrap_file', 'OSCOM') . '?';
View
20 osCommerce/OM/Core/Site/Setup/Application/Install/pages/step_3.php
@@ -118,26 +118,6 @@
db_table_prefix = "{$_POST['DB_TABLE_PREFIX']}"
db_server_persistent_connections = "false"
store_sessions = "Database"
-
-[RPC]
-enable_ssl = "false"
-http_server = "$http_server"
-https_server = "$http_server"
-http_cookie_domain = ""
-https_cookie_domain = ""
-http_cookie_path = "$http_dir_ws"
-https_cookie_path = "$http_dir_ws"
-dir_ws_http_server = "$http_dir_ws"
-dir_ws_https_server = "$http_dir_ws"
-db_server = "{$_POST['DB_SERVER']}"
-db_server_username = "{$_POST['DB_SERVER_USERNAME']}"
-db_server_password = "{$_POST['DB_SERVER_PASSWORD']}"
-db_server_port = "{$_POST['DB_SERVER_PORT']}"
-db_database = "{$_POST['DB_DATABASE']}"
-db_driver = "$db_class"
-db_table_prefix = "{$_POST['DB_TABLE_PREFIX']}"
-db_server_persistent_connections = "false"
-store_sessions = "Database"
EOT;
if ( is_writable(OSCOM::BASE_DIRECTORY . 'Config/settings.ini') ) {
Please sign in to comment.
Something went wrong with that request. Please try again.