From c55a10aa5c17f581788754b915f29a7164fc37d7 Mon Sep 17 00:00:00 2001 From: Magento Mirror Date: Sat, 17 Jan 2009 18:18:28 -0500 Subject: [PATCH] Import Magento Release 1.2.0.1 --- app/Mage.php | 2 +- .../controllers/DownloadController.php | 12 ++++++++- app/code/core/Mage/Eav/Model/Entity/Setup.php | 25 ++++++++----------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/app/Mage.php b/app/Mage.php index 01da359fee..c14f2ebe7e 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -82,7 +82,7 @@ final class Mage { public static function getVersion() { - return '1.2.0'; + return '1.2.0.1'; } /** diff --git a/app/code/core/Mage/Downloadable/controllers/DownloadController.php b/app/code/core/Mage/Downloadable/controllers/DownloadController.php index a9c1797583..92b612fe3e 100644 --- a/app/code/core/Mage/Downloadable/controllers/DownloadController.php +++ b/app/code/core/Mage/Downloadable/controllers/DownloadController.php @@ -150,8 +150,13 @@ public function linkAction() { $id = $this->getRequest()->getParam('id', 0); $linkPurchasedItem = Mage::getModel('downloadable/link_purchased_item')->load($id); + if ( $linkPurchasedItem->getId() != $id ) { + $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__("Requested link doesn't exist.")); + return $this->_redirect('*/customer/products'); + } if (!Mage::helper('downloadable')->getIsShareable($linkPurchasedItem)) { - if (!$this->_getCustomerSession()->getCustomerId()) { + $customerId = $this->_getCustomerSession()->getCustomerId(); + if (!$customerId) { $product = Mage::getModel('catalog/product')->load($linkPurchasedItem->getProductId()); if ($product->getId()) { $notice = Mage::helper('downloadable')->__( @@ -166,6 +171,11 @@ public function linkAction() $this->_getCustomerSession()->setBeforeAuthUrl(Mage::getUrl('downloadable/customer/products/'), array('_secure' => true)); return ; } + $linkPurchased = Mage::getModel('downloadable/link_purchased')->load($linkPurchasedItem->getPurchasedId()); + if ($linkPurchased->getCustomerId() != $customerId) { + $this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__("Requested link doesn't exist.")); + return $this->_redirect('*/customer/products'); + } } $downloadsLeft = $linkPurchasedItem->getNumberOfDownloadsBought() - $linkPurchasedItem->getNumberOfDownloadsUsed(); if ($linkPurchasedItem->getStatus() == Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_AVAILABLE diff --git a/app/code/core/Mage/Eav/Model/Entity/Setup.php b/app/code/core/Mage/Eav/Model/Entity/Setup.php index b6dc4c676e..6799175340 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Setup.php +++ b/app/code/core/Mage/Eav/Model/Entity/Setup.php @@ -483,30 +483,25 @@ public function getAttributeTable($entityTypeId, $id) $entityKeyName = is_numeric($entityTypeId) ? 'entity_type_id' : 'entity_type_code'; $attributeKeyName = is_numeric($id) ? 'attribute_id' : 'attribute_code'; - $select = $this->_conn->select() + $select = $this->getConnection()->select() ->from( array('e' => $this->getTable('eav/entity_type')), - array('e.entity_table') - ) - ->from( + array('entity_table')) + ->join( array('a' => $this->getTable('eav/attribute')), - array('a.backend_type') - ) - ->where('a.entity_type_id=e.entity_type_id') + 'a.entity_type_id=e.entity_type_id', + array('backend_type')) ->where("e.{$entityKeyName}=?", $entityTypeId) ->where("a.{$attributeKeyName}=?", $id) ->limit(1); - - $stmt = $this->_conn->query($select); - - if ($stmt->rowCount() == 1) { - $row = $stmt->fetchObject(); - $table = $this->getTable($row->entity_table); - if ($row->backend_type && $row->backend_type != 'static') { - $table .= '_' . $row->backend_type; + if ($result = $this->getConnection()->fetchRow($select)) { + $table = $this->getTable($result['entity_table']); + if ($result['backend_type'] != 'static') { + $table .= '_' . $result['backend_type']; } return $table; } + return false; }