Permalink
Browse files

Merge Branch Master (oscommerce/osCommerce)

Conflict in configuration edit.php. The osCommerce master files cant handle dropdown fields in single editions.
Signed-off-by: Gergely <t-gely@freemail.hu>
  • Loading branch information...
2 parents ea44af1 + f41ea47 commit 1660b8fcd931f2c58814acbaed3a578581d80360 @tgely committed Mar 26, 2011
Showing with 2,862 additions and 1,361 deletions.
  1. +1 −0 .gitignore
  2. +0 −40 osCommerce/OM/Core/DatabasePDO.php
  3. +45 −5 osCommerce/OM/Core/DatabasePDO/MySQL/Standard.php
  4. +144 −0 osCommerce/OM/Core/DatabasePDO/MySQL/Standard/PDOStatement.php
  5. +1 −0 osCommerce/OM/Core/DatabasePDO/MySQL/V5.php
  6. +33 −0 osCommerce/OM/Core/DatabasePDO/SQLite3.php
  7. +1 −130 osCommerce/OM/Core/DatabasePDOStatement.php
  8. +46 −35 osCommerce/OM/Core/ErrorHandler.php
  9. +62 −0 osCommerce/OM/Core/HttpRequest.php
  10. +51 −0 osCommerce/OM/Core/HttpRequest/Curl.php
  11. +33 −0 osCommerce/OM/Core/HttpRequest/HttpRequest.php
  12. +41 −0 osCommerce/OM/Core/HttpRequest/Stream.php
  13. +9 −7 osCommerce/OM/Core/OSCOM.php
  14. +40 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Action/Apply.php
  15. +43 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Action/Apply/Process.php
  16. +28 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Controller.php
  17. +14 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/CoreUpdate.php
  18. +37 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/applyPackage.php
  19. +28 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/canApplyPackage.php
  20. +21 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/deletePackage.php
  21. +38 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/downloadPackage.php
  22. +30 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/findAvailablePackages.php
  23. +30 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/findPackageContents.php
  24. +30 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/getAvailablePackageInfo.php
  25. +60 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/getAvailablePackages.php
  26. +85 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/getPackageContents.php
  27. +41 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/getPackageInfo.php
  28. +22 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/getShortcutNotification.php
  29. +20 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/localPackageExists.php
  30. +28 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/Model/packageExists.php
  31. +33 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/RPC/GetAvailablePackages.php
  32. +33 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/RPC/GetPackageContents.php
  33. +100 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/pages/main.php
  34. +102 −0 osCommerce/OM/Core/Site/Admin/Application/CoreUpdate/pages/package_contents.php
  35. +0 −4 osCommerce/OM/Core/Site/Admin/Application/ServerInfo/pages/main.php
  36. +33 −0 osCommerce/OM/Core/Site/Admin/languages/en_US/CoreUpdate.php
  37. +4 −4 osCommerce/OM/Core/Site/Admin/templates/oscom.php
  38. +9 −15 osCommerce/OM/Core/Site/Admin/templates/oscom/header.php
  39. +5 −2 osCommerce/OM/Core/Site/Setup/Application/Install/RPC/DBCheck.php
  40. +5 −2 osCommerce/OM/Core/Site/Setup/Application/Install/RPC/DBImport.php
  41. +5 −2 osCommerce/OM/Core/Site/Setup/Application/Install/RPC/DBImportSample.php
  42. +25 −24 osCommerce/OM/Core/Site/Setup/Application/Install/pages/step_1.php
  43. +23 −14 osCommerce/OM/Core/Site/Setup/Application/Install/pages/step_2.php
  44. +3 −3 osCommerce/OM/Core/Site/Setup/templates/default.php
  45. +1 −1 osCommerce/OM/Core/Site/Shop/templates/oscom.php
  46. +6 −0 osCommerce/OM/Work/CoreUpdate/update.phar.pubkey
  47. +1 −0 osCommerce/OM/version.txt
  48. +0 −154 public/external/jquery/jquery-1.4.2.min.js
  49. +16 −0 public/external/jquery/jquery-1.5.1.min.js
  50. +4 −5 public/external/jquery/jquery.hoverIntent.minified.js
  51. +0 −37 public/external/jquery/jquery.json-1.3.min.js
  52. +31 −0 public/external/jquery/jquery.json-2.2.min.js
  53. +1 −8 public/external/jquery/jquery.tinysort.min.js
  54. +783 −0 public/external/jquery/ui/jquery-ui-1.8.11.custom.min.js
  55. +0 −374 public/external/jquery/ui/jquery-ui-1.8.custom.min.js
  56. BIN public/external/jquery/ui/themes/smoothness/images/ui-anim_basic_16x16.gif
  57. BIN public/external/jquery/ui/themes/smoothness/images/ui-icons_222222_256x240.png
  58. BIN public/external/jquery/ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png
  59. BIN public/external/jquery/ui/themes/smoothness/images/ui-icons_454545_256x240.png
  60. BIN public/external/jquery/ui/themes/smoothness/images/ui-icons_888888_256x240.png
  61. BIN public/external/jquery/ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png
  62. +573 −0 public/external/jquery/ui/themes/smoothness/jquery-ui-1.8.11.custom.css
  63. +0 −10 public/external/jquery/ui/themes/smoothness/jquery.ui.accordion.css
  64. +0 −2 public/external/jquery/ui/themes/smoothness/jquery.ui.all.css
  65. +0 −35 public/external/jquery/ui/themes/smoothness/jquery.ui.autocomplete.css
  66. +0 −10 public/external/jquery/ui/themes/smoothness/jquery.ui.base.css
  67. +0 −35 public/external/jquery/ui/themes/smoothness/jquery.ui.button.css
  68. +0 −37 public/external/jquery/ui/themes/smoothness/jquery.ui.core.css
  69. +0 −61 public/external/jquery/ui/themes/smoothness/jquery.ui.datepicker.css
  70. +0 −13 public/external/jquery/ui/themes/smoothness/jquery.ui.dialog.css
  71. +0 −4 public/external/jquery/ui/themes/smoothness/jquery.ui.progressbar.css
  72. +0 −13 public/external/jquery/ui/themes/smoothness/jquery.ui.resizable.css
  73. +0 −17 public/external/jquery/ui/themes/smoothness/jquery.ui.slider.css
  74. +0 −11 public/external/jquery/ui/themes/smoothness/jquery.ui.tabs.css
  75. +0 −247 public/external/jquery/ui/themes/smoothness/jquery.ui.theme.css
  76. BIN public/sites/Admin/images/applications/16/coreupdate.png
  77. BIN public/sites/Admin/images/applications/32/coreupdate.png
  78. BIN public/sites/Admin/templates/oscom/images/icons/16x16/folder_contents.png
  79. +4 −0 public/sites/Admin/templates/oscom/stylesheets/general.css
View
@@ -1,4 +1,5 @@
osCommerce/OM/Work/*
+!osCommerce/OM/Work/CoreUpdate/update.phar.pubkey
osCommerce/OM/Config/local_settings.ini
osCommerce/OM/Custom/*
!osCommerce/OM/Custom/README
@@ -22,8 +22,6 @@ class DatabasePDO extends PDO {
protected $_driver;
protected $_driver_options = array();
protected $_driver_parent;
- protected $_has_native_fk = false;
- protected $_fkeys = array();
public static function initialize($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $port = DB_SERVER_PORT, $driver = DB_DATABASE_CLASS, $driver_options = array()) {
if ( !isset($driver_options[PDO::ATTR_ERRMODE]) ) {
@@ -86,44 +84,6 @@ public function hasDriverParent() {
return isset($this->_driver_parent);
}
- public function hasNativeForeignKeys() {
- return $this->_has_native_fk;
- }
-
- public function hasForeignKeys() {
- return !empty($this->_fkeys);
- }
-
- public function getForeignKeys($table = null) {
- if ( isset($table) ) {
- return $this->_fkeys[$table];
- }
-
- return $this->_fkeys;
- }
-
- public function setupForeignKeys() {
- if ( empty($this->_fkeys) ) {
- $Qfk = self::prepare('select * from :table_fk_relationships');
-// $Qfk->setCache('fk_relationships');
- $Qfk->execute();
-
- while ( $Qfk->next() ) {
- $this->_fkeys[$Qfk->value('to_table')][] = array('from_table' => $Qfk->value('from_table'),
- 'from_field' => $Qfk->value('from_field'),
- 'to_field' => $Qfk->value('to_field'),
- 'on_update' => $Qfk->value('on_update'),
- 'on_delete' => $Qfk->value('on_delete'));
- }
-
-// $Qfk->freeResult();
- }
- }
-
- public function hasForeignKey($table) {
- return isset($this->_fkeys[$table]);
- }
-
protected function _autoPrefixTables($statement) {
return str_replace(':table_', DB_TABLE_PREFIX, $statement);
}
@@ -13,6 +13,9 @@
use \PDO;
class Standard extends \osCommerce\OM\Core\DatabasePDO {
+ protected $_has_native_fk = false;
+ protected $_fkeys = array();
+
public function __construct($server, $username, $password, $database, $port, $driver_options) {
$this->_server = $server;
$this->_username = $username;
@@ -21,12 +24,15 @@ public function __construct($server, $username, $password, $database, $port, $dr
$this->_port = $port;
$this->_driver_options = $driver_options;
+// Override ATTR_STATEMENT_CLASS to automatically handle foreign key constraints
+ if ( $this->_has_native_fk === false ) {
+ $this->_driver_options[PDO::ATTR_STATEMENT_CLASS] = array('osCommerce\\OM\\Core\\DatabasePDO\\MySQL\\Standard\\PDOStatement', array($this));
+ }
+
// Only one init command can be issued (see http://bugs.php.net/bug.php?id=48859)
$this->_driver_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'set session sql_mode="STRICT_ALL_TABLES", names utf8';
- if ( $this->_connected === false ) {
- $this->connect();
- }
+ return $this->connect();
}
public function connect() {
@@ -36,9 +42,43 @@ public function connect() {
$dsn .= ';port=' . $this->_port;
}
- parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
-
$this->_connected = true;
+
+ $dbh = parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
+
+ if ( $this->_has_native_fk === false ) {
+ $this->setupForeignKeys();
+ }
+
+ return $dbh;
+ }
+
+ public function getForeignKeys($table = null) {
+ if ( isset($table) ) {
+ return $this->_fkeys[$table];
+ }
+
+ return $this->_fkeys;
+ }
+
+ public function setupForeignKeys() {
+ $Qfk = $this->prepare('select * from :table_fk_relationships');
+// $Qfk->setCache('fk_relationships');
+ $Qfk->execute();
+
+ while ( $Qfk->next() ) {
+ $this->_fkeys[$Qfk->value('to_table')][] = array('from_table' => $Qfk->value('from_table'),
+ 'from_field' => $Qfk->value('from_field'),
+ 'to_field' => $Qfk->value('to_field'),
+ 'on_update' => $Qfk->value('on_update'),
+ 'on_delete' => $Qfk->value('on_delete'));
+ }
+
+// $Qfk->freeResult();
+ }
+
+ public function hasForeignKey($table) {
+ return isset($this->_fkeys[$table]);
}
}
?>
@@ -0,0 +1,144 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ namespace osCommerce\OM\Core\DatabasePDO\MySQL\Standard;
+
+ class PDOStatement extends \osCommerce\OM\Core\DatabasePDOStatement {
+ protected $_pdo;
+
+ protected function __construct($pdo) {
+ $this->_pdo = $pdo;
+ }
+
+ public function execute($input_parameters = array()) {
+ $query_action = strtolower(substr($this->queryString, 0, strpos($this->queryString, ' ')));
+
+ if ($query_action == 'delete') {
+ $query_data = explode(' ', $this->queryString, 4);
+ $query_table = substr($query_data[2], strlen(DB_TABLE_PREFIX));
+
+ if ( $this->_pdo->hasForeignKey($query_table) ) {
+// check for RESTRICT constraints first
+ foreach ( $this->_pdo->getForeignKeys($query_table) as $fk ) {
+ if ( $fk['on_delete'] == 'restrict' ) {
+ $Qchild = $this->_pdo->prepare('select ' . $fk['to_field'] . ' from ' . $query_data[2] . ' ' . $query_data[3]);
+
+ foreach ( $this->_binded_params as $key => $value ) {
+ $Qchild->bindValue($key, $value['value'], $value['data_type']);
+ }
+
+ $Qchild->execute();
+
+ while ( $Qchild->next() ) {
+ $Qcheck = $this->_pdo->prepare('select ' . $fk['from_field'] . ' from ' . DB_TABLE_PREFIX . $fk['from_table'] . ' where ' . $fk['from_field'] . ' = "' . $Qchild->value($fk['to_field']) . '" limit 1');
+ $Qcheck->execute();
+
+ if ( count($Qcheck->fetchAll()) === 1 ) {
+// $this->db_class->setError('RESTRICT constraint condition from table ' . DB_TABLE_PREFIX . $fk['from_table'], null, $this->sql_query);
+
+ return false;
+ }
+ }
+ }
+ }
+
+ foreach ( $this->_pdo->getForeignKeys($query_table) as $fk ) {
+ $Qparent = $this->_pdo->prepare('select * from ' . $query_data[2] . ' ' . $query_data[3]);
+
+ foreach ( $this->_binded_params as $key => $value ) {
+ $Qparent->bindValue($key, $value['value'], $value['data_type']);
+ }
+
+ $Qparent->execute();
+
+ while ( $Qparent->next() ) {
+ if ( $fk['on_delete'] == 'cascade' ) {
+ $Qdel = $this->_pdo->prepare('delete from ' . DB_TABLE_PREFIX . $fk['from_table'] . ' where ' . $fk['from_field'] . ' = :' . $fk['from_field']);
+ $Qdel->bindValue(':' . $fk['from_field'], $Qparent->value($fk['to_field']));
+ $Qdel->execute();
+ } elseif ( $fk['on_delete'] == 'set_null' ) {
+ $Qupdate = $this->_pdo->prepare('update ' . DB_TABLE_PREFIX . $fk['from_table'] . ' set ' . $fk['from_field'] . ' = null where ' . $fk['from_field'] . ' = :' . $fk['from_field']);
+ $Qupdate->bindValue(':' . $fk['from_field'], $Qparent->value($fk['to_field']));
+ $Qupdate->execute();
+ }
+ }
+ }
+ }
+ } elseif ($query_action == 'update') {
+ $query_data = explode(' ', $this->queryString, 3);
+ $query_table = substr($query_data[1], strlen(DB_TABLE_PREFIX));
+
+ if ( $this->_pdo->hasForeignKey($query_table) ) {
+// check for RESTRICT constraints first
+ foreach ( $this->_pdo->getForeignKeys($query_table) as $fk ) {
+ if ( $fk['on_update'] == 'restrict' ) {
+ $Qchild = $this->_pdo->prepare('select ' . $fk['to_field'] . ' from ' . $query_data[2] . ' ' . $query_data[3]);
+
+ foreach ( $this->_binded_params as $key => $value ) {
+ $Qchild->bindValue($key, $value['value'], $value['data_type']);
+ }
+
+ $Qchild->execute();
+
+ while ( $Qchild->next() ) {
+ $Qcheck = $this->_pdo->prepare('select ' . $fk['from_field'] . ' from ' . DB_TABLE_PREFIX . $fk['from_table'] . ' where ' . $fk['from_field'] . ' = "' . $Qchild->value($fk['to_field']) . '" limit 1');
+ $Qcheck->execute();
+
+ if ( count($Qcheck->fetchAll()) === 1 ) {
+// $this->db_class->setError('RESTRICT constraint condition from table ' . DB_TABLE_PREFIX . $fk['from_table'], null, $this->sql_query);
+
+ return false;
+ }
+ }
+ }
+ }
+
+ foreach ( $this->_pdo->getForeignKeys($query_table) as $fk ) {
+// check to see if foreign key column value is being changed
+ if ( strpos(substr($this->queryString, strpos($this->queryString, ' set ')+4, strpos($this->queryString, ' where ') - strpos($this->queryString, ' set ') - 4), ' ' . $fk['to_field'] . ' ') !== false ) {
+ $Qparent = $this->_pdo->prepare('select * from ' . $query_data[1] . substr($this->queryString, strrpos($this->queryString, ' where ')));
+
+ foreach ( $this->_binded_params as $key => $value ) {
+ if ( preg_match('/:\b' . substr($key, 1) . '\b/', $Qparent->queryString) ) {
+ $Qparent->bindValue($key, $value['value'], $value['data_type']);
+ }
+ }
+
+ $Qparent->execute();
+
+ while ( $Qparent->next() ) {
+ if ( ($fk['on_update'] == 'cascade') || ($fk['on_update'] == 'set_null') ) {
+ $on_update_value = '';
+
+ if ( $fk['on_update'] == 'cascade' ) {
+ $on_update_value = $this->_binded_params[':' . $fk['to_field']]['value'];
+ }
+
+ $Qupdate = $this->_pdo->prepare('update ' . DB_TABLE_PREFIX . $fk['from_table'] . ' set ' . $fk['from_field'] . ' = :' . $fk['from_field'] . ' where ' . $fk['from_field'] . ' = :' . $fk['from_field'] . '_orig');
+
+ if ( empty($on_update_value) ) {
+ $Qupdate->bindNull(':' . $fk['from_field']);
+ } else {
+ $Qupdate->bindValue(':' . $fk['from_field'], $on_update_value);
+ }
+
+ $Qupdate->bindValue(':' . $fk['from_field'] . '_orig', $Qparent->value($fk['to_field']));
+ $Qupdate->execute();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return parent::execute($input_parameters);
+ }
+ }
+?>
@@ -11,6 +11,7 @@
namespace osCommerce\OM\Core\DatabasePDO\MySQL;
class V5 extends \osCommerce\OM\Core\DatabasePDO\MySQL\Standard {
+ protected $_has_native_fk = true;
protected $_driver_parent = 'MySQL\\Standard';
}
?>
@@ -0,0 +1,33 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ namespace osCommerce\OM\Core\DatabasePDO;
+
+ class SQLite3 extends \osCommerce\OM\Core\DatabasePDO {
+ public function __construct($server, $username, $password, $database, $port, $driver_options) {
+ $this->_server = $server;
+ $this->_username = $username;
+ $this->_password = $password;
+ $this->_database = $database;
+ $this->_port = $port;
+ $this->_driver_options = $driver_options;
+
+ return $this->connect();
+ }
+
+ public function connect() {
+ $dsn = 'sqlite:' . $this->_server;
+
+ $this->_connected = true;
+
+ return parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
+ }
+ }
+?>
Oops, something went wrong.

0 comments on commit 1660b8f

Please sign in to comment.