Permalink
Browse files

Merge branch 'master' of git://github.com/osCommerce/oscommerce

Conflicts:
	osCommerce/OM/Core/Site/Admin/Application/Administrators/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/Countries/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/ErrorLog/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/Languages/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/ServerInfo/Model/getAll.php
	osCommerce/OM/Core/Site/Admin/Application/ServerInfo/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/TaxClasses/pages/main.php
	osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/main.php
	osCommerce/OM/Core/Site/Admin/languages/en_US.php

Signed-off-by: Gergely <t-gely@freemail.hu>
  • Loading branch information...
2 parents d33118c + 40ba947 commit bd6fe5c4a84cb3f33bd43964bde201b8e1fa5a78 @tgely committed Apr 14, 2011
Showing with 205 additions and 151 deletions.
  1. +0 −7 osCommerce/OM/Config/settings.ini
  2. +1 −0 osCommerce/OM/Core/ErrorHandler.php
  3. +5 −1 osCommerce/OM/Core/HttpRequest/HttpRequest.php
  4. +34 −12 osCommerce/OM/Core/OSCOM.php
  5. +23 −8 osCommerce/OM/Core/Session/Database.php
  6. +28 −0 osCommerce/OM/Core/Session/Database/SQL/MySQL/Standard/Check.php
  7. +21 −8 osCommerce/OM/Core/Session/File.php
  8. +29 −31 osCommerce/OM/Core/SessionAbstract.php
  9. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Administrators/pages/main.php
  10. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/entries.php
  11. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/main.php
  12. +1 −1 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/pages/main.php
  13. +1 −1 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/pages/package_contents.php
  14. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/main.php
  15. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/zones.php
  16. +1 −1 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/main.php
  17. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/main.php
  18. +1 −1 osCommerce/OM/Core/Site/Admin/Application/ErrorLog/pages/main.php
  19. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/definitions.php
  20. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/groups.php
  21. +1 −1 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/main.php
  22. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/install.php
  23. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/main.php
  24. +2 −5 osCommerce/OM/Core/Site/Admin/Application/ServerInfo/Model/getAll.php
  25. +1 −1 osCommerce/OM/Core/Site/Admin/Application/ServerInfo/pages/main.php
  26. +1 −1 osCommerce/OM/Core/Site/Admin/Application/TaxClasses/pages/entries.php
  27. +1 −1 osCommerce/OM/Core/Site/Admin/Application/TaxClasses/pages/main.php
  28. +1 −1 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries.php
  29. +1 −1 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/main.php
  30. +3 −3 osCommerce/OM/Core/Site/Admin/languages/en_US.php
  31. +1 −0 osCommerce/OM/Core/Site/Admin/templates/oscom.php
  32. +9 −2 osCommerce/OM/Core/Site/Admin/templates/oscom/header.php
  33. +10 −24 osCommerce/OM/Core/Site/Setup/Application/Install/pages/step_3.php
  34. +1 −1 osCommerce/OM/Core/Site/Shop/ShoppingCart.php
  35. +6 −0 public/external/jquery/jquery.placeholder.min.js
  36. +4 −18 public/sites/Admin/javascript/general.js
  37. BIN public/sites/Admin/templates/oscom/images/adminmenubg.png
  38. +5 −10 public/sites/Admin/templates/oscom/stylesheets/general.css
  39. BIN public/sites/Shop/images/worldflags/fx.png
  40. +3 −1 public/sites/Shop/javascript/products/info.js
@@ -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 = ""
@@ -17,6 +17,7 @@ class ErrorHandler {
public static function initialize() {
ini_set('display_errors', false);
+ ini_set('html_errors', false);
if ( is_writable(OSCOM::BASE_DIRECTORY . 'Work/Logs') ) {
ini_set('log_errors', true);
@@ -16,7 +16,11 @@ public static function execute($parameters) {
$h = new \HttpRequest($parameters['server']['scheme'] . '://' . $parameters['server']['host'] . $parameters['server']['path'] . (isset($parameters['server']['query']) ? '?' . $parameters['server']['query'] : ''), static::$_methods[$parameters['method']], array('redirect' => 5));
if ( $parameters['method'] == 'post' ) {
- $h->setRawPostData($parameters['parameters']);
+ $post_params = array();
+
+ parse_str($parameters['parameters'], $post_params);
+
+ $h->setPostFields($post_params);
}
$h->send();
@@ -55,28 +55,47 @@ 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() {
return static::$_site;
}
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') . '?';
@@ -12,6 +12,8 @@
/**
* The Session\Database class stores the session data in the database
+ *
+ * @since v3.0.0
*/
class Database extends \osCommerce\OM\Core\SessionAbstract {
@@ -20,7 +22,7 @@ class Database extends \osCommerce\OM\Core\SessionAbstract {
* Initialize database based session storage handler
*
* @param string $name The name of the session
- * @access public
+ * @since v3.0.0
*/
public function __construct($name) {
@@ -35,9 +37,22 @@ public function __construct($name) {
}
/**
+ * Checks if a session exists
+ *
+ * @param string $id The ID of the session
+ * @since v3.0.2
+ */
+
+ public function exists($id) {
+ $data = array('id' => $id);
+
+ return OSCOM::callDB('Session\Database\Check', $data, 'Core');
+ }
+
+/**
* Opens the database based session storage handler
*
- * @access public
+ * @since v3.0.0
*/
public function handlerOpen() {
@@ -47,7 +62,7 @@ public function handlerOpen() {
/**
* Closes the database based session storage handler
*
- * @access public
+ * @since v3.0.0
*/
public function handlerClose() {
@@ -58,7 +73,7 @@ public function handlerClose() {
* Read session data from the database based session storage handler
*
* @param string $id The ID of the session
- * @access public
+ * @since v3.0.0
*/
public function handlerRead($id) {
@@ -82,7 +97,7 @@ public function handlerRead($id) {
*
* @param string $id The ID of the session
* @param string $value The session data to store
- * @access public
+ * @since v3.0.0
*/
public function handlerWrite($id, $value) {
@@ -97,7 +112,7 @@ public function handlerWrite($id, $value) {
* Destroys the session data from the database based session storage handler
*
* @param string $id The ID of the session
- * @access public
+ * @since v3.0.0
*/
public function handlerDestroy($id) {
@@ -108,7 +123,7 @@ public function handlerDestroy($id) {
* Garbage collector for the database based session storage handler
*
* @param string $max_life_time The maxmimum time a session should exist
- * @access public
+ * @since v3.0.0
*/
public function handlerClean($max_life_time) {
@@ -123,7 +138,7 @@ public function handlerClean($max_life_time) {
* Deletes the session data from the database based session storage handler
*
* @param string $id The ID of the session
- * @access public
+ * @since v3.0.0
*/
public function delete($id = null) {
@@ -0,0 +1,28 @@
+<?php
+/**
+ * osCommerce Online Merchant
+ *
+ * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
+ * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+ */
+
+ namespace osCommerce\OM\Core\Session\Database\SQL\MySQL\Standard;
+
+ use osCommerce\OM\Core\Registry;
+
+/**
+ * @since v3.0.2
+ */
+
+ class Check {
+ public static function execute($data) {
+ $OSCOM_PDO = Registry::get('PDO');
+
+ $Qsession = $OSCOM_PDO->prepare('select 1 from :table_sessions where id = :id');
+ $Qsession->bindValue(':id', $data['id']);
+ $Qsession->execute();
+
+ return $Qsession->fetch() !== false;
+ }
+ }
+?>
@@ -12,6 +12,8 @@
/**
* The Session\File class stores the session data in files
+ *
+ * @since v3.0.0
*/
class File extends \osCommerce\OM\Core\SessionAbstract {
@@ -20,7 +22,7 @@ class File extends \osCommerce\OM\Core\SessionAbstract {
* Holds the file system path where sessions are saved.
*
* @var string
- * @access protected
+ * @since v3.0.0
*/
protected $_save_path;
@@ -29,7 +31,7 @@ class File extends \osCommerce\OM\Core\SessionAbstract {
* Initialize file based session storage handler
*
* @param string $name The name of the session
- * @access public
+ * @since v3.0.0
*/
public function __construct($name) {
@@ -38,9 +40,20 @@ public function __construct($name) {
}
/**
+ * Checks if a session exists
+ *
+ * @param string $id The ID of the session
+ * @since v3.0.2
+ */
+
+ public function exists($id) {
+ return file_exists($this->_save_path . '/' . $id);
+ }
+
+/**
* Deletes an existing session
*
- * @access public
+ * @since v3.0.0
*/
public function destroy() {
@@ -53,24 +66,24 @@ public function destroy() {
* Deletes an existing session from the storage handler
*
* @param string $id The ID of the session
- * @access public
+ * @since v3.0.0
*/
public function delete($id = null) {
if ( empty($id) ) {
$id = $this->_id;
}
- if ( file_exists($this->_save_path . '/' . $id) ) {
- @unlink($this->_save_path . '/' . $id);
+ if ( $this->exists($id) ) {
+ unlink($this->_save_path . '/' . $id);
}
}
/**
* Return the session file based storage location
*
- * @access public
* @return string
+ * @since v3.0.0
*/
public function getSavePath() {
@@ -81,7 +94,7 @@ public function getSavePath() {
* Sets the storage location for the file based storage handler
*
* @param string $path The file path to store the session data in
- * @access public
+ * @since v3.0.0
*/
public function setSavePath($path) {
Oops, something went wrong.

0 comments on commit bd6fe5c

Please sign in to comment.