Mage_Core_Modules - Version 1.9.2.0

Version Notes

1.9.2.0

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Core_Modules
Version 1.9.2.0
Comparing to
See all releases


Code changes from version 1.9.1.1 to 1.9.2.0

Files changed (223) hide show
  1. RELEASE_NOTES.txt +11 -0
  2. api.php +12 -4
  3. app/Mage.php +4 -4
  4. app/bootstrap.php +34 -0
  5. app/code/core/Mage/Admin/Helper/Rules/Fallback.php +74 -0
  6. app/code/core/Mage/Admin/Model/Resource/Rules/Collection.php +14 -0
  7. app/code/core/Mage/Admin/Model/Rules.php +45 -3
  8. app/code/core/Mage/Admin/Model/User.php +8 -2
  9. app/code/core/Mage/Api/Model/Server/Adapter/Soap.php +35 -11
  10. app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php +14 -4
  11. app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php +14 -4
  12. app/code/core/Mage/Api2/Block/Adminhtml/Roles/Buttons.php +1 -1
  13. app/code/core/Mage/Api2/Model/Request/Interpreter/Json.php +6 -1
  14. app/code/core/Mage/Api2/controllers/Adminhtml/Api2/AttributeController.php +10 -0
  15. app/code/core/Mage/Authorizenet/Model/Directpost.php +1 -0
  16. app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php +4 -0
  17. app/code/core/Mage/Authorizenet/etc/system.xml +1 -1
  18. app/code/core/Mage/Backup/Model/Db.php +4 -1
  19. app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php +30 -10
  20. app/code/core/Mage/Bundle/Model/Selection.php +3 -3
  21. app/code/core/Mage/Bundle/controllers/Adminhtml/Bundle/SelectionController.php +9 -1
  22. app/code/core/Mage/Captcha/controllers/Adminhtml/RefreshController.php +10 -0
  23. app/code/core/Mage/Catalog/Helper/Product/Compare.php +70 -22
  24. app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php +50 -5
  25. app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php +42 -5
  26. app/code/core/Mage/Catalog/Model/Observer.php +1 -1
  27. app/code/core/Mage/Catalog/Model/Product.php +17 -6
  28. app/code/core/Mage/Catalog/Model/Product/Compare/Item.php +13 -1
  29. app/code/core/Mage/Catalog/Model/Product/Status.php +28 -3
  30. app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php +9 -2
  31. app/code/core/Mage/Catalog/Model/Resource/Product.php +26 -0
  32. app/code/core/Mage/Catalog/Model/Resource/Product/Action.php +3 -0
  33. app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php +2 -2
  34. app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php +1 -1
  35. app/code/core/Mage/Catalog/etc/config.xml +1 -1
  36. app/code/core/Mage/Catalog/etc/wsdl.xml +4 -0
  37. app/code/core/Mage/Catalog/etc/wsi.xml +4 -0
  38. app/code/core/Mage/Catalog/sql/catalog_setup/upgrade-1.6.0.0.19.1.1-1.6.0.0.19.1.2.php +34 -0
  39. app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php +4 -0
  40. app/code/core/Mage/CatalogRule/Model/Observer.php +58 -7
  41. app/code/core/Mage/CatalogRule/etc/config.xml +8 -0
  42. app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php +1 -1
  43. app/code/core/Mage/CatalogSearch/Block/Autocomplete.php +8 -2
  44. app/code/core/Mage/CatalogSearch/Model/Query.php +1 -0
  45. app/code/core/Mage/CatalogSearch/etc/config.xml +1 -0
  46. app/code/core/Mage/CatalogSearch/etc/system.xml +9 -0
  47. app/code/core/Mage/Checkout/Block/Cart.php +10 -0
  48. app/code/core/Mage/Checkout/Block/Cart/Coupon.php +9 -0
  49. app/code/core/Mage/Checkout/Block/Cart/Shipping.php +20 -0
  50. app/code/core/Mage/Checkout/Block/Cart/Sidebar.php +21 -0
  51. app/code/core/Mage/Checkout/Block/Onepage/Billing.php +20 -2
  52. app/code/core/Mage/Checkout/Helper/Data.php +13 -13
  53. app/code/core/Mage/Checkout/Model/Type/Onepage.php +28 -0
  54. app/code/core/Mage/Checkout/controllers/CartController.php +1 -0
  55. app/code/core/Mage/Checkout/controllers/MultishippingController.php +24 -1
  56. app/code/core/Mage/Checkout/etc/jstranslator.xml +2 -2
  57. app/code/core/Mage/Cms/Block/Block.php +15 -0
  58. app/code/core/Mage/Cms/Block/Widget/Block.php +15 -0
  59. app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php +17 -4
  60. app/code/core/Mage/Cms/Model/Resource/Page.php +1 -1
  61. app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php +6 -3
  62. app/code/core/Mage/ConfigurableSwatches/Block/Catalog/Media/Js/Abstract.php +28 -6
  63. app/code/core/Mage/Connect/controllers/Adminhtml/Extension/LocalController.php +10 -0
  64. app/code/core/Mage/Contacts/controllers/IndexController.php +1 -1
  65. app/code/core/Mage/Core/Block/Abstract.php +10 -0
  66. app/code/core/Mage/Core/Controller/Front/Action.php +19 -0
  67. app/code/core/Mage/Core/Controller/Varien/Router/Admin.php +11 -0
  68. app/code/core/Mage/Core/Controller/Varien/Router/Standard.php +15 -1
  69. app/code/core/Mage/Core/Helper/Abstract.php +1 -1
  70. app/code/core/Mage/Core/Helper/Http.php +2 -2
  71. app/code/core/Mage/Core/Helper/Url.php +60 -0
  72. app/code/core/Mage/Core/Model/App.php +22 -6
  73. app/code/core/Mage/Core/Model/Email/Queue.php +0 -2
  74. app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php +1 -1
  75. app/code/core/Mage/Core/Model/Store.php +4 -4
  76. app/code/core/Mage/Core/Model/Translate/Inline.php +6 -6
  77. app/code/core/Mage/Core/Model/Url.php +6 -2
  78. app/code/core/Mage/Core/Model/Url/Rewrite/Request.php +6 -1
  79. app/code/core/Mage/Core/etc/config.xml +3 -0
  80. app/code/core/Mage/Core/etc/system.xml +23 -0
  81. app/code/core/Mage/Cron/Model/Observer.php +1 -0
  82. app/code/core/Mage/Cron/Model/Resource/Schedule/Collection.php +12 -0
  83. app/code/core/Mage/Customer/Block/Account/Dashboard/Info.php +4 -2
  84. app/code/core/Mage/Customer/Helper/Data.php +61 -0
  85. app/code/core/Mage/Customer/Model/Address/Abstract.php +1 -3
  86. app/code/core/Mage/Customer/Model/Customer.php +6 -3
  87. app/code/core/Mage/Customer/Model/Resource/Setup.php +2 -2
  88. app/code/core/Mage/Customer/controllers/AccountController.php +7 -2
  89. app/code/core/Mage/Customer/etc/config.xml +2 -2
  90. app/code/core/Mage/Customer/sql/customer_setup/upgrade-1.6.2.0.3-1.6.2.0.4.php +72 -0
  91. app/code/core/Mage/Dataflow/Model/Convert/Iterator.php +26 -17
  92. app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php +4 -0
  93. app/code/core/Mage/Directory/Model/Currency/Filter.php +1 -1
  94. app/code/core/Mage/Directory/data/directory_setup/data-upgrade-1.6.0.2-1.6.0.3.php +41 -0
  95. app/code/core/Mage/Directory/etc/config.xml +1 -1
  96. app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +3 -6
  97. app/code/core/Mage/Downloadable/Helper/Data.php +17 -1
  98. app/code/core/Mage/Downloadable/Helper/Download.php +14 -4
  99. app/code/core/Mage/Downloadable/Model/Link/Api.php +2 -1
  100. app/code/core/Mage/Eav/Model/Entity/Abstract.php +22 -10
  101. app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php +4 -0
  102. app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php +2 -1
  103. app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Collection.php +4 -4
  104. app/code/core/Mage/GoogleAnalytics/Block/Ga.php +11 -1
  105. app/code/core/Mage/GoogleBase/Block/Adminhtml/Types/Edit.php +5 -5
  106. app/code/core/Mage/ImportExport/Model/Abstract.php +1 -1
  107. app/code/core/Mage/ImportExport/Model/Export/Adapter/Abstract.php +9 -0
  108. app/code/core/Mage/ImportExport/Model/Export/Adapter/Csv.php +15 -5
  109. app/code/core/Mage/ImportExport/Model/Import/Adapter/Abstract.php +9 -0
  110. app/code/core/Mage/ImportExport/Model/Import/Adapter/Csv.php +2 -4
  111. app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php +20 -7
  112. app/code/core/Mage/Install/Controller/Router/Install.php +39 -0
  113. app/code/core/Mage/Install/Model/Installer/Config.php +4 -9
  114. app/code/core/Mage/Install/controllers/WizardController.php +2 -0
  115. app/code/core/Mage/Install/etc/config.xml +23 -1
  116. app/code/core/Mage/Install/etc/install.xml +2 -0
  117. app/code/core/Mage/Log/Helper/Data.php +42 -0
  118. app/code/core/Mage/Log/Model/Adminhtml/System/Config/Source/Loglevel.php +81 -0
  119. app/code/core/Mage/Log/Model/Resource/Visitor.php +37 -8
  120. app/code/core/Mage/Log/Model/Resource/Visitor/Collection.php +8 -7
  121. app/code/core/Mage/Log/Model/Resource/Visitor/Online/Collection.php +4 -3
  122. app/code/core/Mage/Log/Model/Visitor.php +53 -23
  123. app/code/core/Mage/Log/etc/config.xml +8 -2
  124. app/code/core/Mage/Log/etc/system.xml +18 -8
  125. app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-1.6.1.0-1.6.1.1.php +76 -0
  126. app/code/core/Mage/Newsletter/Helper/Data.php +1 -0
  127. app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php +24 -13
  128. app/code/core/Mage/Newsletter/Model/Subscriber.php +1 -1
  129. app/code/core/Mage/Newsletter/Model/Template.php +2 -2
  130. app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizeController.php +10 -0
  131. app/code/core/Mage/Page/Block/Html/Topmenu.php +6 -5
  132. app/code/core/Mage/Page/Block/Html/Welcome.php +16 -11
  133. app/code/core/Mage/Paygate/Model/Authorizenet.php +57 -14
  134. app/code/core/Mage/Paygate/controllers/Adminhtml/Paygate/Authorizenet/PaymentController.php +10 -0
  135. app/code/core/Mage/Paygate/etc/config.xml +1 -0
  136. app/code/core/Mage/Paygate/etc/system.xml +28 -20
  137. app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php +5 -2
  138. app/code/core/Mage/Paypal/Block/Express/Review/Billing.php +3 -0
  139. app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php +2 -1
  140. app/code/core/Mage/Persistent/Model/Observer.php +13 -4
  141. app/code/core/Mage/Persistent/etc/persistent.xml +7 -1
  142. app/code/core/Mage/Poll/Model/Resource/Poll.php +3 -5
  143. app/code/core/Mage/Poll/etc/config.xml +1 -1
  144. app/code/core/Mage/Poll/sql/poll_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php +45 -0
  145. app/code/core/Mage/ProductAlert/Model/Email.php +5 -2
  146. app/code/core/Mage/ProductAlert/Model/Observer.php +6 -0
  147. app/code/core/Mage/Rating/etc/config.xml +1 -1
  148. app/code/core/Mage/Rating/sql/rating_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php +54 -0
  149. app/code/core/Mage/Reports/Helper/Data.php +14 -0
  150. app/code/core/Mage/Reports/Model/Event/Observer.php +53 -13
  151. app/code/core/Mage/Reports/Model/Product/Index/Abstract.php +9 -4
  152. app/code/core/Mage/Reports/Model/Resource/Customer/Collection.php +4 -4
  153. app/code/core/Mage/Reports/Model/Resource/Order/Collection.php +5 -1
  154. app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php +22 -10
  155. app/code/core/Mage/Reports/Model/Resource/Review/Customer/Collection.php +30 -5
  156. app/code/core/Mage/Reports/etc/config.xml +3 -0
  157. app/code/core/Mage/Reports/etc/system.xml +20 -1
  158. app/code/core/Mage/Review/Block/Form.php +6 -2
  159. app/code/core/Mage/Rss/Helper/Data.php +27 -20
  160. app/code/core/Mage/Rss/controllers/CatalogController.php +3 -2
  161. app/code/core/Mage/Rss/controllers/OrderController.php +2 -1
  162. app/code/core/Mage/Rule/Block/Editable.php +10 -4
  163. app/code/core/Mage/Rule/Model/Condition/Abstract.php +71 -35
  164. app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php +6 -2
  165. app/code/core/Mage/Rule/Model/Resource/Rule/Condition/SqlBuilder.php +17 -6
  166. app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/Grid.php +7 -0
  167. app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View.php +4 -3
  168. app/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php +6 -1
  169. app/code/core/Mage/Sales/Block/Adminhtml/Recurring/Profile/View.php +7 -5
  170. app/code/core/Mage/Sales/Block/Billing/Agreements.php +1 -1
  171. app/code/core/Mage/Sales/Block/Order/Recent.php +29 -4
  172. app/code/core/Mage/Sales/Block/Recurring/Profile/View.php +16 -2
  173. app/code/core/Mage/Sales/Block/Widget/Guest/Form.php +1 -1
  174. app/code/core/Mage/Sales/Helper/Data.php +5 -0
  175. app/code/core/Mage/Sales/Model/Api2/Order.php +1 -0
  176. app/code/core/Mage/Sales/Model/Observer.php +18 -1
  177. app/code/core/Mage/Sales/Model/Order.php +9 -3
  178. app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Cost.php +1 -1
  179. app/code/core/Mage/Sales/Model/Order/Invoice.php +11 -1
  180. app/code/core/Mage/Sales/Model/Order/Invoice/Total/Cost.php +1 -1
  181. app/code/core/Mage/Sales/Model/Order/Item.php +6 -0
  182. app/code/core/Mage/Sales/Model/Quote/Item.php +3 -1
  183. app/code/core/Mage/Sales/Model/Resource/Billing/Agreement/Collection.php +14 -1
  184. app/code/core/Mage/Sales/Model/Resource/Order.php +8 -1
  185. app/code/core/Mage/Sales/Model/Resource/Order/Address.php +2 -1
  186. app/code/core/Mage/Sales/Model/Resource/Order/Collection.php +5 -0
  187. app/code/core/Mage/Sales/Model/Resource/Order/Creditmemo.php +11 -4
  188. app/code/core/Mage/Sales/Model/Resource/Order/Invoice.php +12 -5
  189. app/code/core/Mage/Sales/Model/Resource/Order/Shipment.php +11 -4
  190. app/code/core/Mage/Sales/Model/Resource/Quote.php +39 -16
  191. app/code/core/Mage/Sales/Model/Resource/Report/Bestsellers.php +67 -33
  192. app/code/core/Mage/Sales/Model/Resource/Report/Order/Createdat.php +3 -1
  193. app/code/core/Mage/Sales/Model/Service/Order.php +8 -3
  194. app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php +2 -1
  195. app/code/core/Mage/Sales/etc/config.xml +1 -1
  196. app/code/core/Mage/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php +40 -0
  197. app/code/core/Mage/Sendfriend/Block/Send.php +2 -1
  198. app/code/core/Mage/Sendfriend/etc/config.xml +1 -1
  199. app/code/core/Mage/Sendfriend/sql/sendfriend_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php +45 -0
  200. app/code/core/Mage/Tag/Block/Product/List.php +2 -1
  201. app/code/core/Mage/Tag/Model/Resource/Customer/Collection.php +1 -0
  202. app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php +11 -0
  203. app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php +33 -7
  204. app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php +7 -1
  205. app/code/core/Mage/Weee/Helper/Data.php +4 -2
  206. app/code/core/Mage/Widget/Block/Adminhtml/Widget/Chooser.php +2 -1
  207. app/code/core/Mage/Widget/controllers/Adminhtml/WidgetController.php +10 -0
  208. app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column/Remove.php +5 -1
  209. app/code/core/Mage/Wishlist/controllers/IndexController.php +7 -2
  210. app/code/core/Zend/Date.php +199 -183
  211. app/code/core/Zend/Db/Select.php +1396 -0
  212. app/code/core/Zend/Mime.php +1 -1
  213. app/code/core/Zend/XmlRpc/Request.php +0 -442
  214. app/code/core/Zend/XmlRpc/Response.php +0 -254
  215. app/etc/local.xml.additional +50 -48
  216. app/etc/local.xml.template +6 -6
  217. cron.php +1 -0
  218. cron.sh +25 -0
  219. errors/processor.php +2 -2
  220. get.php +3 -2
  221. index.php.sample +1 -4
  222. install.php +1 -0
  223. package.xml +5 -5
RELEASE_NOTES.txt CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
  ] NOTE: Current Release Notes are maintained at: [
1
+ ==== 1.9.2.0 ====
2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+ ] NOTE: Current Release Notes are maintained at: [
5
+ ] [
6
+ ] http://merch.docs.magento.com/ce/user_guide/Magento_Community_Edition_User_Guide.html#magento/release-notes-ce-1.9.2.html [
7
+ ] [
8
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
+
11
+ ==== 1.9.1.0 ====
12
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14
  ] NOTE: Current Release Notes are maintained at: [
api.php CHANGED
@@ -28,14 +28,20 @@ if (version_compare(phpversion(), '5.2.0', '<')) {
28
  echo 'It looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer';
29
  exit;
30
  }
31
- error_reporting(E_ALL | E_STRICT);
32
 
33
- $mageFilename = getcwd() . '/app/Mage.php';
 
 
34
 
 
 
 
 
35
  if (!file_exists($mageFilename)) {
36
  echo 'Mage file not found';
37
  exit;
38
  }
 
39
  require $mageFilename;
40
 
41
  if (!Mage::isInstalled()) {
@@ -49,8 +55,6 @@ if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
49
 
50
  #ini_set('display_errors', 1);
51
 
52
- // emulate index.php entry point for correct URLs generation in API
53
- Mage::register('custom_entry_point', true);
54
  Mage::$headersSentThrowsException = false;
55
  Mage::init('admin');
56
  Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
@@ -61,6 +65,8 @@ $apiAlias = Mage::app()->getRequest()->getParam('type');
61
 
62
  // check request could be processed by API2
63
  if (in_array($apiAlias, Mage_Api2_Model_Server::getApiTypes())) {
 
 
64
  /** @var $server Mage_Api2_Model_Server */
65
  $server = Mage::getSingleton('api2/server');
66
 
@@ -76,6 +82,8 @@ if (in_array($apiAlias, Mage_Api2_Model_Server::getApiTypes())) {
76
  }
77
  try {
78
  $server->initialize($adapterCode);
 
 
79
  $server->run();
80
 
81
  Mage::app()->getResponse()->sendResponse();
28
  echo 'It looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer';
29
  exit;
30
  }
 
31
 
32
+ $magentoRootDir = getcwd();
33
+ $bootstrapFilename = $magentoRootDir . '/app/bootstrap.php';
34
+ $mageFilename = $magentoRootDir . '/app/Mage.php';
35
 
36
+ if (!file_exists($bootstrapFilename)) {
37
+ echo 'Bootstrap file not found';
38
+ exit;
39
+ }
40
  if (!file_exists($mageFilename)) {
41
  echo 'Mage file not found';
42
  exit;
43
  }
44
+ require $bootstrapFilename;
45
  require $mageFilename;
46
 
47
  if (!Mage::isInstalled()) {
55
 
56
  #ini_set('display_errors', 1);
57
 
 
 
58
  Mage::$headersSentThrowsException = false;
59
  Mage::init('admin');
60
  Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
65
 
66
  // check request could be processed by API2
67
  if (in_array($apiAlias, Mage_Api2_Model_Server::getApiTypes())) {
68
+ // emulate index.php entry point for correct URLs generation in API
69
+ Mage::register('custom_entry_point', true);
70
  /** @var $server Mage_Api2_Model_Server */
71
  $server = Mage::getSingleton('api2/server');
72
 
82
  }
83
  try {
84
  $server->initialize($adapterCode);
85
+ // emulate index.php entry point for correct URLs generation in API
86
+ Mage::register('custom_entry_point', true);
87
  $server->run();
88
 
89
  Mage::app()->getResponse()->sendResponse();
app/Mage.php CHANGED
@@ -170,8 +170,8 @@ final class Mage
170
  return array(
171
  'major' => '1',
172
  'minor' => '9',
173
- 'revision' => '1',
174
- 'patch' => '1',
175
  'stability' => '',
176
  'number' => '',
177
  );
@@ -814,12 +814,12 @@ final class Mage
814
 
815
  if (!is_dir($logDir)) {
816
  mkdir($logDir);
817
- chmod($logDir, 0777);
818
  }
819
 
820
  if (!file_exists($logFile)) {
821
  file_put_contents($logFile, '');
822
- chmod($logFile, 0777);
823
  }
824
 
825
  $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
170
  return array(
171
  'major' => '1',
172
  'minor' => '9',
173
+ 'revision' => '2',
174
+ 'patch' => '0',
175
  'stability' => '',
176
  'number' => '',
177
  );
814
 
815
  if (!is_dir($logDir)) {
816
  mkdir($logDir);
817
+ chmod($logDir, 0750);
818
  }
819
 
820
  if (!file_exists($logFile)) {
821
  file_put_contents($logFile, '');
822
+ chmod($logFile, 0640);
823
  }
824
 
825
  $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
app/bootstrap.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Apply workaround for the libxml PHP bugs:
29
+ * @link https://bugs.php.net/bug.php?id=62577
30
+ * @link https://bugs.php.net/bug.php?id=64938
31
+ */
32
+ if (function_exists('libxml_disable_entity_loader')) {
33
+ libxml_disable_entity_loader(false);
34
+ }
app/code/core/Mage/Admin/Helper/Rules/Fallback.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Admin
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Admin Data Helper
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Admin
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Mage_Admin_Helper_Rules_Fallback extends Mage_Core_Helper_Abstract
36
+ {
37
+ /**
38
+ * Fallback to resource parent node
39
+ * @param $resourceId
40
+ *
41
+ * @return string
42
+ */
43
+ protected function _getParentResourceId($resourceId)
44
+ {
45
+ $resourcePathInfo = explode('/', $resourceId);
46
+ array_pop($resourcePathInfo);
47
+ return implode('/', $resourcePathInfo);
48
+ }
49
+
50
+
51
+ /**
52
+ * Fallback resource permissions similarly to zend_acl
53
+ * @param $resources
54
+ * @param $resourceId
55
+ * @param string $defaultValue
56
+ *
57
+ * @return string
58
+ */
59
+ public function fallbackResourcePermissions(
60
+ &$resources,
61
+ $resourceId,
62
+ $defaultValue = Mage_Admin_Model_Rules::RULE_PERMISSION_DENIED
63
+ ) {
64
+ if (empty($resourceId)) {
65
+ return $defaultValue;
66
+ }
67
+
68
+ if (!array_key_exists($resourceId, $resources)) {
69
+ return $this->fallbackResourcePermissions($resources, $this->_getParentResourceId($resourceId));
70
+ }
71
+
72
+ return $resources[$resourceId];
73
+ }
74
+ }
app/code/core/Mage/Admin/Model/Resource/Rules/Collection.php CHANGED
@@ -68,4 +68,18 @@ class Mage_Admin_Model_Resource_Rules_Collection extends Mage_Core_Model_Resourc
68
 
69
  return $this;
70
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
68
 
69
  return $this;
70
  }
71
+
72
+ /**
73
+ * Generate and retrieve a resource - permissions map
74
+ * @return array
75
+ */
76
+ public function getResourcesPermissionsArray()
77
+ {
78
+ $resourcesPermissionsArray = array();
79
+ foreach ($this as $item) {
80
+ $resourcesPermissionsArray[$item->getResourceId()] = $item->getPermission();
81
+ }
82
+
83
+ return $resourcesPermissionsArray;
84
+ }
85
  }
app/code/core/Mage/Admin/Model/Rules.php CHANGED
@@ -48,22 +48,64 @@
48
  */
49
  class Mage_Admin_Model_Rules extends Mage_Core_Model_Abstract
50
  {
 
 
 
 
 
 
 
 
 
 
51
  protected function _construct()
52
  {
53
  $this->_init('admin/rules');
54
  }
55
 
56
- public function update() {
 
 
 
 
 
57
  $this->getResource()->update($this);
58
  return $this;
59
  }
60
 
61
- public function getCollection() {
 
 
 
 
 
62
  return Mage::getResourceModel('admin/permissions_collection');
63
  }
64
 
65
- public function saveRel() {
 
 
 
 
 
66
  $this->getResource()->saveRel($this);
67
  return $this;
68
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
48
  */
49
  class Mage_Admin_Model_Rules extends Mage_Core_Model_Abstract
50
  {
51
+ /**
52
+ * Allowed permission code
53
+ */
54
+ const RULE_PERMISSION_ALLOWED = 'allow';
55
+
56
+ /**
57
+ * Denied permission code
58
+ */
59
+ const RULE_PERMISSION_DENIED = 'deny';
60
+
61
  protected function _construct()
62
  {
63
  $this->_init('admin/rules');
64
  }
65
 
66
+ /**
67
+ * Update rules
68
+ * @return $this
69
+ */
70
+ public function update()
71
+ {
72
  $this->getResource()->update($this);
73
  return $this;
74
  }
75
 
76
+ /**
77
+ * Initialize and retrieve permissions collection
78
+ * @return Object
79
+ */
80
+ public function getCollection()
81
+ {
82
  return Mage::getResourceModel('admin/permissions_collection');
83
  }
84
 
85
+ /**
86
+ * Save rules relations to the database
87
+ * @return $this
88
+ */
89
+ public function saveRel()
90
+ {
91
  $this->getResource()->saveRel($this);
92
  return $this;
93
  }
94
+
95
+ /**
96
+ * Check if the current rule is allowed
97
+ * @return bool
98
+ */
99
+ public function isAllowed()
100
+ {
101
+ return $this->getPermission() == self::RULE_PERMISSION_ALLOWED;
102
+ }
103
+
104
+ /**
105
+ * Check if the current rule is denied
106
+ */
107
+ public function isDenied()
108
+ {
109
+ return $this->getPermission() == self::RULE_PERMISSION_DENIED;
110
+ }
111
  }
app/code/core/Mage/Admin/Model/User.php CHANGED
@@ -131,11 +131,16 @@ class Mage_Admin_Model_User extends Mage_Core_Model_Abstract
131
  }
132
 
133
  if ($this->getNewPassword()) {
134
- // Change password
135
  $data['password'] = $this->_getEncodedPassword($this->getNewPassword());
 
136
  } elseif ($this->getPassword() && $this->getPassword() != $this->getOrigData('password')) {
137
  // New user password
138
  $data['password'] = $this->_getEncodedPassword($this->getPassword());
 
 
 
 
139
  }
140
 
141
  $this->cleanPasswordsValidationData();
@@ -639,12 +644,13 @@ class Mage_Admin_Model_User extends Mage_Core_Model_Abstract
639
  }
640
 
641
  /**
642
- * Clean password's validation data (password, new_password, password_confirmation)
643
  *
644
  * @return Mage_Admin_Model_User
645
  */
646
  public function cleanPasswordsValidationData()
647
  {
 
648
  $this->setData('current_password', null);
649
  $this->setData('new_password', null);
650
  $this->setData('password_confirmation', null);
131
  }
132
 
133
  if ($this->getNewPassword()) {
134
+ // Change user password
135
  $data['password'] = $this->_getEncodedPassword($this->getNewPassword());
136
+ $data['new_password'] = $data['password'];
137
  } elseif ($this->getPassword() && $this->getPassword() != $this->getOrigData('password')) {
138
  // New user password
139
  $data['password'] = $this->_getEncodedPassword($this->getPassword());
140
+ } elseif (!$this->getPassword() && $this->getOrigData('password') // Change user data
141
+ || $this->getPassword() == $this->getOrigData('password') // Retrieve user password
142
+ ) {
143
+ $data['password'] = $this->getOrigData('password');
144
  }
145
 
146
  $this->cleanPasswordsValidationData();
644
  }
645
 
646
  /**
647
+ * Clean password's validation data (password, current_password, new_password, password_confirmation)
648
  *
649
  * @return Mage_Admin_Model_User
650
  */
651
  public function cleanPasswordsValidationData()
652
  {
653
+ $this->setData('password', null);
654
  $this->setData('current_password', null);
655
  $this->setData('new_password', null);
656
  $this->setData('password_confirmation', null);
app/code/core/Mage/Api/Model/Server/Adapter/Soap.php CHANGED
@@ -35,6 +35,13 @@ class Mage_Api_Model_Server_Adapter_Soap
35
  extends Varien_Object
36
  implements Mage_Api_Model_Server_Adapter_Interface
37
  {
 
 
 
 
 
 
 
38
  /**
39
  * Soap server
40
  *
@@ -42,6 +49,33 @@ class Mage_Api_Model_Server_Adapter_Soap
42
  */
43
  protected $_soap = null;
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * Set handler class name for webservice
47
  *
@@ -114,17 +148,7 @@ class Mage_Api_Model_Server_Adapter_Soap
114
 
115
  $template = Mage::getModel('core/email_template_filter');
116
 
117
- $wsdlConfig = new Varien_Object();
118
- $queryParams = $this->getController()->getRequest()->getQuery();
119
- if (isset($queryParams['wsdl'])) {
120
- unset($queryParams['wsdl']);
121
- }
122
-
123
- $wsdlConfig->setUrl(htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams))));
124
- $wsdlConfig->setName('Magento');
125
- $wsdlConfig->setHandler($this->getHandler());
126
-
127
- $template->setVariables(array('wsdl' => $wsdlConfig));
128
 
129
  $this->getController()->getResponse()
130
  ->clearHeaders()
35
  extends Varien_Object
36
  implements Mage_Api_Model_Server_Adapter_Interface
37
  {
38
+ /**
39
+ * Wsdl config
40
+ *
41
+ * @var Varien_Object
42
+ */
43
+ protected $wsdlConfig = null;
44
+
45
  /**
46
  * Soap server
47
  *
49
  */
50
  protected $_soap = null;
51
 
52
+ /**
53
+ * Internal constructor
54
+ */
55
+ protected function _construct()
56
+ {
57
+ $this->wsdlConfig = $this->_getWsdlConfig();
58
+ }
59
+
60
+ /**
61
+ * Get wsdl config
62
+ *
63
+ * @return Varien_Object
64
+ */
65
+ protected function _getWsdlConfig()
66
+ {
67
+ $wsdlConfig = new Varien_Object();
68
+ $queryParams = $this->getController()->getRequest()->getQuery();
69
+ if (isset($queryParams['wsdl'])) {
70
+ unset($queryParams['wsdl']);
71
+ }
72
+
73
+ $wsdlConfig->setUrl(htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams))));
74
+ $wsdlConfig->setName('Magento');
75
+ $wsdlConfig->setHandler($this->getHandler());
76
+ return $wsdlConfig;
77
+ }
78
+
79
  /**
80
  * Set handler class name for webservice
81
  *
148
 
149
  $template = Mage::getModel('core/email_template_filter');
150
 
151
+ $template->setVariables(array('wsdl' => $this->wsdlConfig));
 
 
 
 
 
 
 
 
 
 
152
 
153
  $this->getController()->getResponse()
154
  ->clearHeaders()
app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php CHANGED
@@ -33,6 +33,19 @@
33
  */
34
  class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
35
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Run webservice
38
  *
@@ -44,9 +57,6 @@ class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapte
44
  $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
45
 
46
  if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
47
- $wsdlConfig = Mage::getModel('api/wsdl_config');
48
- $wsdlConfig->setHandler($this->getHandler())
49
- ->init();
50
  $this->getController()->getResponse()
51
  ->clearHeaders()
52
  ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
@@ -54,7 +64,7 @@ class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapte
54
  preg_replace(
55
  '/<\?xml version="([^\"]+)"([^\>]+)>/i',
56
  '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
57
- $wsdlConfig->getWsdlContent()
58
  )
59
  );
60
  } else {
33
  */
34
  class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
35
  {
36
+ /**
37
+ * Get wsdl config
38
+ *
39
+ * @return Mage_Api_Model_Wsdl_Config
40
+ */
41
+ protected function _getWsdlConfig()
42
+ {
43
+ $wsdlConfig = Mage::getModel('api/wsdl_config');
44
+ $wsdlConfig->setHandler($this->getHandler())
45
+ ->init();
46
+ return $wsdlConfig;
47
+ }
48
+
49
  /**
50
  * Run webservice
51
  *
57
  $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
58
 
59
  if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
 
 
 
60
  $this->getController()->getResponse()
61
  ->clearHeaders()
62
  ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
64
  preg_replace(
65
  '/<\?xml version="([^\"]+)"([^\>]+)>/i',
66
  '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
67
+ $this->wsdlConfig->getWsdlContent()
68
  )
69
  );
70
  } else {
app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php CHANGED
@@ -33,6 +33,19 @@
33
  */
34
  class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
35
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Run webservice
38
  *
@@ -44,9 +57,6 @@ class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapt
44
  $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
45
 
46
  if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
47
- $wsdlConfig = Mage::getModel('api/wsdl_config');
48
- $wsdlConfig->setHandler($this->getHandler())
49
- ->init();
50
  $this->getController()->getResponse()
51
  ->clearHeaders()
52
  ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
@@ -63,7 +73,7 @@ class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapt
63
  preg_replace(
64
  '/<\?xml version="([^\"]+)"([^\>]+)>/i',
65
  '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
66
- $wsdlConfig->getWsdlContent()
67
  )
68
  )
69
  )
33
  */
34
  class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap
35
  {
36
+ /**
37
+ * Get wsdl config
38
+ *
39
+ * @return Mage_Api_Model_Wsdl_Config
40
+ */
41
+ protected function _getWsdlConfig()
42
+ {
43
+ $wsdlConfig = Mage::getModel('api/wsdl_config');
44
+ $wsdlConfig->setHandler($this->getHandler())
45
+ ->init();
46
+ return $wsdlConfig;
47
+ }
48
+
49
  /**
50
  * Run webservice
51
  *
57
  $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
58
 
59
  if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
 
 
 
60
  $this->getController()->getResponse()
61
  ->clearHeaders()
62
  ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
73
  preg_replace(
74
  '/<\?xml version="([^\"]+)"([^\>]+)>/i',
75
  '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
76
+ $this->wsdlConfig->getWsdlContent()
77
  )
78
  )
79
  )
app/code/core/Mage/Api2/Block/Adminhtml/Roles/Buttons.php CHANGED
@@ -125,7 +125,7 @@ class Mage_Api2_Block_Adminhtml_Roles_Buttons extends Mage_Adminhtml_Block_Templ
125
  }
126
 
127
  $this->getChild('deleteButton')->setData('onclick', sprintf("deleteConfirm('%s', '%s')",
128
- Mage::helper('adminhtml')->__('Are you sure you want to do this?'),
129
  $this->getUrl('*/*/delete', array('id' => $this->getRole()->getId()))
130
  ));
131
 
125
  }
126
 
127
  $this->getChild('deleteButton')->setData('onclick', sprintf("deleteConfirm('%s', '%s')",
128
+ Mage::helper('core')->jsQuoteEscape(Mage::helper('adminhtml')->__('Are you sure you want to do this?')),
129
  $this->getUrl('*/*/delete', array('id' => $this->getRole()->getId()))
130
  ));
131
 
app/code/core/Mage/Api2/Model/Request/Interpreter/Json.php CHANGED
@@ -46,7 +46,12 @@ class Mage_Api2_Model_Request_Interpreter_Json implements Mage_Api2_Model_Reques
46
  throw new Exception(sprintf('Invalid data type "%s". String expected.', gettype($body)));
47
  }
48
 
49
- $decoded = Zend_Json::decode($body);
 
 
 
 
 
50
 
51
  if ($body != 'null' && $decoded === null) {
52
  throw new Mage_Api2_Exception('Decoding error.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
46
  throw new Exception(sprintf('Invalid data type "%s". String expected.', gettype($body)));
47
  }
48
 
49
+ try {
50
+ $decoded = Zend_Json::decode($body);
51
+ } catch (Zend_Json_Exception $e) {
52
+ throw new Mage_Api2_Exception('Decoding error.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
53
+ }
54
+
55
 
56
  if ($body != 'null' && $decoded === null) {
57
  throw new Mage_Api2_Exception('Decoding error.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
app/code/core/Mage/Api2/controllers/Adminhtml/Api2/AttributeController.php CHANGED
@@ -145,4 +145,14 @@ class Mage_Api2_Adminhtml_Api2_AttributeController extends Mage_Adminhtml_Contro
145
 
146
  $this->_redirect('*/*/edit', array('type' => $type));
147
  }
 
 
 
 
 
 
 
 
 
 
148
  }
145
 
146
  $this->_redirect('*/*/edit', array('type' => $type));
147
  }
148
+
149
+ /**
150
+ * Check is allowed access to action
151
+ *
152
+ * @return bool
153
+ */
154
+ protected function _isAllowed()
155
+ {
156
+ return Mage::getSingleton('admin/session')->isAllowed('system/api');
157
+ }
158
  }
app/code/core/Mage/Authorizenet/Model/Directpost.php CHANGED
@@ -51,6 +51,7 @@ class Mage_Authorizenet_Model_Directpost extends Mage_Paygate_Model_Authorizenet
51
  protected $_canUseForMultishipping = false;
52
  protected $_canSaveCc = false;
53
  protected $_isInitializeNeeded = true;
 
54
 
55
  /**
56
  * Do not validate payment form using server methods
51
  protected $_canUseForMultishipping = false;
52
  protected $_canSaveCc = false;
53
  protected $_isInitializeNeeded = true;
54
+ protected $_canFetchTransactionInfo = false;
55
 
56
  /**
57
  * Do not validate payment form using server methods
app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php CHANGED
@@ -68,6 +68,8 @@ class Mage_Authorizenet_Directpost_PaymentController extends Mage_Core_Controlle
68
  public function responseAction()
69
  {
70
  $data = $this->getRequest()->getPost();
 
 
71
  /* @var $paymentMethod Mage_Authorizenet_Model_DirectPost */
72
  $paymentMethod = Mage::getModel('authorizenet/directpost');
73
 
@@ -113,6 +115,8 @@ class Mage_Authorizenet_Directpost_PaymentController extends Mage_Core_Controlle
113
  public function redirectAction()
114
  {
115
  $redirectParams = $this->getRequest()->getParams();
 
 
116
  $params = array();
117
  if (!empty($redirectParams['success'])
118
  && isset($redirectParams['x_invoice_num'])
68
  public function responseAction()
69
  {
70
  $data = $this->getRequest()->getPost();
71
+ unset($data['redirect_parent']);
72
+ unset($data['redirect']);
73
  /* @var $paymentMethod Mage_Authorizenet_Model_DirectPost */
74
  $paymentMethod = Mage::getModel('authorizenet/directpost');
75
 
115
  public function redirectAction()
116
  {
117
  $redirectParams = $this->getRequest()->getParams();
118
+ unset($redirectParams['redirect_parent']);
119
+ unset($redirectParams['redirect']);
120
  $params = array();
121
  if (!empty($redirectParams['success'])
122
  && isset($redirectParams['x_invoice_num'])
app/code/core/Mage/Authorizenet/etc/system.xml CHANGED
@@ -116,7 +116,7 @@
116
  <show_in_website>1</show_in_website>
117
  <show_in_store>0</show_in_store>
118
  </cgi_url>
119
- <currency translate="label">
120
  <label>Accepted Currency</label>
121
  <frontend_type>select</frontend_type>
122
  <source_model>adminhtml/system_config_source_currency</source_model>
116
  <show_in_website>1</show_in_website>
117
  <show_in_store>0</show_in_store>
118
  </cgi_url>
119
+ <currency translate="label">
120
  <label>Accepted Currency</label>
121
  <frontend_type>select</frontend_type>
122
  <source_model>adminhtml/system_config_source_currency</source_model>
app/code/core/Mage/Backup/Model/Db.php CHANGED
@@ -130,16 +130,19 @@ class Mage_Backup_Model_Db
130
  $backup->write($this->getResource()->getTableDataBeforeSql($table));
131
 
132
  if ($tableStatus->getDataLength() > self::BUFFER_LENGTH) {
133
- if ($tableStatus->getAvgRowLength() < self::BUFFER_LENGTH) {
 
134
  $limit = floor(self::BUFFER_LENGTH / $tableStatus->getAvgRowLength());
135
  $multiRowsLength = ceil($tableStatus->getRows() / $limit);
136
  }
137
  else {
 
138
  $limit = 1;
139
  $multiRowsLength = $tableStatus->getRows();
140
  }
141
  }
142
  else {
 
143
  $limit = $tableStatus->getRows();
144
  $multiRowsLength = 1;
145
  }
130
  $backup->write($this->getResource()->getTableDataBeforeSql($table));
131
 
132
  if ($tableStatus->getDataLength() > self::BUFFER_LENGTH) {
133
+ if ($tableStatus->getAvgRowLength() > 0 && $tableStatus->getAvgRowLength() < self::BUFFER_LENGTH) {
134
+ // Process rows in batches
135
  $limit = floor(self::BUFFER_LENGTH / $tableStatus->getAvgRowLength());
136
  $multiRowsLength = ceil($tableStatus->getRows() / $limit);
137
  }
138
  else {
139
+ // Process rows one by one
140
  $limit = 1;
141
  $multiRowsLength = $tableStatus->getRows();
142
  }
143
  }
144
  else {
145
+ // Process all rows at once
146
  $limit = $tableStatus->getRows();
147
  $multiRowsLength = 1;
148
  }
app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php CHANGED
@@ -36,11 +36,22 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
36
  /**
37
  * Draw item line
38
  *
 
39
  */
40
  public function draw()
41
  {
 
 
 
 
 
 
 
42
  $order = $this->getOrder();
 
 
43
  $item = $this->getItem();
 
44
  $pdf = $this->getPdf();
45
  $page = $this->getPage();
46
 
@@ -50,12 +61,13 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
50
  $_prevOptionId = '';
51
  $drawItems = array();
52
 
 
53
  foreach ($items as $_item) {
54
  $line = array();
55
 
56
  $attributes = $this->getSelectionAttributes($_item);
57
  if (is_array($attributes)) {
58
- $optionId = $attributes['option_id'];
59
  }
60
  else {
61
  $optionId = 0;
@@ -71,9 +83,9 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
71
  if ($_item->getOrderItem()->getParentItem()) {
72
  if ($_prevOptionId != $attributes['option_id']) {
73
  $line[0] = array(
74
- 'font' => 'italic',
75
- 'text' => Mage::helper('core/string')->str_split($attributes['option_label'], 45, true, true),
76
- 'feed' => 35
77
  );
78
 
79
  $drawItems[$optionId] = array(
@@ -96,14 +108,14 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
96
  $name = $_item->getName();
97
  }
98
  $line[] = array(
99
- 'text' => Mage::helper('core/string')->str_split($name, 35, true, true),
100
  'feed' => $feed
101
  );
102
 
103
  // draw SKUs
104
  if (!$_item->getOrderItem()->getParentItem()) {
105
  $text = array();
106
- foreach (Mage::helper('core/string')->str_split($item->getSku(), 17) as $part) {
107
  $text[] = $part;
108
  }
109
  $line[] = array(
@@ -114,7 +126,11 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
114
 
115
  // draw prices
116
  if ($this->canShowPriceInfo($_item)) {
117
- $price = $order->formatPriceTxt($_item->getPrice());
 
 
 
 
118
  $line[] = array(
119
  'text' => $price,
120
  'feed' => 395,
@@ -135,7 +151,11 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
135
  'align' => 'right'
136
  );
137
 
138
- $row_total = $order->formatPriceTxt($_item->getRowTotal());
 
 
 
 
139
  $line[] = array(
140
  'text' => $row_total,
141
  'feed' => 565,
@@ -154,7 +174,7 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
154
  foreach ($options['options'] as $option) {
155
  $lines = array();
156
  $lines[][] = array(
157
- 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, true, true),
158
  'font' => 'italic',
159
  'feed' => 35
160
  );
@@ -166,7 +186,7 @@ class Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice extends Mage_Bundle_Model_
166
  : strip_tags($option['value']);
167
  $values = explode(', ', $_printValue);
168
  foreach ($values as $value) {
169
- foreach (Mage::helper('core/string')->str_split($value, 30, true, true) as $_value) {
170
  $text[] = $_value;
171
  }
172
  }
36
  /**
37
  * Draw item line
38
  *
39
+ * @return void
40
  */
41
  public function draw()
42
  {
43
+ /** @var Mage_Tax_Helper_Data $taxHelper */
44
+ $taxHelper = Mage::helper('tax');
45
+
46
+ /** @var Mage_Core_Helper_String $stringHelper */
47
+ $stringHelper = Mage::helper('core/string');
48
+
49
+ /** @var Mage_Sales_Model_Order $order */
50
  $order = $this->getOrder();
51
+
52
+ /** @var Mage_Sales_Model_Order_Invoice_Item $item */
53
  $item = $this->getItem();
54
+
55
  $pdf = $this->getPdf();
56
  $page = $this->getPage();
57
 
61
  $_prevOptionId = '';
62
  $drawItems = array();
63
 
64
+ /** @var Mage_Sales_Model_Order_Invoice_Item $_item */
65
  foreach ($items as $_item) {
66
  $line = array();
67
 
68
  $attributes = $this->getSelectionAttributes($_item);
69
  if (is_array($attributes)) {
70
+ $optionId = $attributes['option_id'];
71
  }
72
  else {
73
  $optionId = 0;
83
  if ($_item->getOrderItem()->getParentItem()) {
84
  if ($_prevOptionId != $attributes['option_id']) {
85
  $line[0] = array(
86
+ 'font' => 'italic',
87
+ 'text' => $stringHelper->str_split($attributes['option_label'], 45, true, true),
88
+ 'feed' => 35
89
  );
90
 
91
  $drawItems[$optionId] = array(
108
  $name = $_item->getName();
109
  }
110
  $line[] = array(
111
+ 'text' => $stringHelper->str_split($name, 35, true, true),
112
  'feed' => $feed
113
  );
114
 
115
  // draw SKUs
116
  if (!$_item->getOrderItem()->getParentItem()) {
117
  $text = array();
118
+ foreach ($stringHelper->str_split($item->getSku(), 17) as $part) {
119
  $text[] = $part;
120
  }
121
  $line[] = array(
126
 
127
  // draw prices
128
  if ($this->canShowPriceInfo($_item)) {
129
+ if ($taxHelper->displaySalesPriceInclTax()) {
130
+ $price = $order->formatPriceTxt($_item->getPriceInclTax());
131
+ } else {
132
+ $price = $order->formatPriceTxt($_item->getPrice());
133
+ }
134
  $line[] = array(
135
  'text' => $price,
136
  'feed' => 395,
151
  'align' => 'right'
152
  );
153
 
154
+ if ($taxHelper->displaySalesPriceInclTax()) {
155
+ $row_total = $order->formatPriceTxt($_item->getRowTotalInclTax());
156
+ } else {
157
+ $row_total = $order->formatPriceTxt($_item->getRowTotal());
158
+ }
159
  $line[] = array(
160
  'text' => $row_total,
161
  'feed' => 565,
174
  foreach ($options['options'] as $option) {
175
  $lines = array();
176
  $lines[][] = array(
177
+ 'text' => $stringHelper->str_split(strip_tags($option['label']), 40, true, true),
178
  'font' => 'italic',
179
  'feed' => 35
180
  );
186
  : strip_tags($option['value']);
187
  $values = explode(', ', $_printValue);
188
  foreach ($values as $value) {
189
+ foreach ($stringHelper->str_split($value, 30, true, true) as $_value) {
190
  $text[] = $_value;
191
  }
192
  }
app/code/core/Mage/Bundle/Model/Selection.php CHANGED
@@ -64,11 +64,11 @@ class Mage_Bundle_Model_Selection extends Mage_Core_Model_Abstract
64
  }
65
 
66
  /**
67
- * Processing object before save data
68
  *
69
  * @return Mage_Bundle_Model_Selection
70
  */
71
- protected function _beforeSave()
72
  {
73
  $storeId = Mage::registry('product')->getStoreId();
74
  if (!Mage::helper('catalog')->isPriceGlobal() && $storeId) {
@@ -80,6 +80,6 @@ class Mage_Bundle_Model_Selection extends Mage_Core_Model_Abstract
80
  $this->unsSelectionPriceType();
81
  }
82
  }
83
- parent::_beforeSave();
84
  }
85
  }
64
  }
65
 
66
  /**
67
+ * Processing object after save data
68
  *
69
  * @return Mage_Bundle_Model_Selection
70
  */
71
+ protected function _afterSave()
72
  {
73
  $storeId = Mage::registry('product')->getStoreId();
74
  if (!Mage::helper('catalog')->isPriceGlobal() && $storeId) {
80
  $this->unsSelectionPriceType();
81
  }
82
  }
83
+ parent::_afterSave();
84
  }
85
  }
app/code/core/Mage/Bundle/controllers/Adminhtml/Bundle/SelectionController.php CHANGED
@@ -59,5 +59,13 @@ class Mage_Bundle_Adminhtml_Bundle_SelectionController extends Mage_Adminhtml_Co
59
  ->toHtml()
60
  );
61
  }
62
-
 
 
 
 
 
 
 
 
63
  }
59
  ->toHtml()
60
  );
61
  }
62
+ /**
63
+ * Check for is allowed
64
+ *
65
+ * @return boolean
66
+ */
67
+ protected function _isAllowed()
68
+ {
69
+ return Mage::getSingleton('admin/session')->isAllowed('catalog/products');
70
+ }
71
  }
app/code/core/Mage/Captcha/controllers/Adminhtml/RefreshController.php CHANGED
@@ -47,4 +47,14 @@ class Mage_Captcha_Adminhtml_RefreshController extends Mage_Adminhtml_Controller
47
  $this->getResponse()->setBody(json_encode(array('imgSrc' => $captchaModel->getImgSrc())));
48
  $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
49
  }
 
 
 
 
 
 
 
 
 
 
50
  }
47
  $this->getResponse()->setBody(json_encode(array('imgSrc' => $captchaModel->getImgSrc())));
48
  $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
49
  }
50
+
51
+ /**
52
+ * Check is allowed access to action
53
+ *
54
+ * @return bool
55
+ */
56
+ protected function _isAllowed()
57
+ {
58
+ return true;
59
+ }
60
  }
app/code/core/Mage/Catalog/Helper/Product/Compare.php CHANGED
@@ -62,6 +62,52 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
62
  */
63
  protected $_customerId = null;
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  /**
66
  * Retrieve Catalog Session instance
67
  *
@@ -69,7 +115,7 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
69
  */
70
  protected function _getSession()
71
  {
72
- return Mage::getSingleton('catalog/session');
73
  }
74
 
75
  /**
@@ -103,7 +149,7 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
103
  return array(
104
  'product' => $product->getId(),
105
  Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl(),
106
- Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
107
  );
108
  }
109
 
@@ -115,7 +161,10 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
115
  */
116
  public function getAddUrl($product)
117
  {
118
- return $this->_getUrl('catalog/product_compare/add', $this->_getUrlParams($product));
 
 
 
119
  }
120
 
121
  /**
@@ -126,11 +175,11 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
126
  */
127
  public function getAddToWishlistUrl($product)
128
  {
129
- $beforeCompareUrl = Mage::getSingleton('catalog/session')->getBeforeCompareUrl();
130
 
131
  $params = array(
132
  'product' => $product->getId(),
133
- Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey(),
134
  Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl)
135
  );
136
 
@@ -145,11 +194,11 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
145
  */
146
  public function getAddToCartUrl($product)
147
  {
148
- $beforeCompareUrl = $this->_getSingletonModel('catalog/session')->getBeforeCompareUrl();
149
  $params = array(
150
  'product' => $product->getId(),
151
  Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl),
152
- Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
153
  );
154
 
155
  return $this->_getUrl('checkout/cart/add', $params);
@@ -191,20 +240,20 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
191
  public function getItemCollection()
192
  {
193
  if (!$this->_itemCollection) {
 
194
  $this->_itemCollection = Mage::getResourceModel('catalog/product_compare_item_collection')
195
  ->useProductItem(true)
196
  ->setStoreId(Mage::app()->getStore()->getId());
197
 
198
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
199
- $this->_itemCollection->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId());
200
  } elseif ($this->_customerId) {
201
  $this->_itemCollection->setCustomerId($this->_customerId);
202
  } else {
203
- $this->_itemCollection->setVisitorId(Mage::getSingleton('log/visitor')->getId());
204
  }
205
 
206
- Mage::getSingleton('catalog/product_visibility')
207
- ->addVisibleInSiteFilterToCollection($this->_itemCollection);
208
 
209
  /* Price data is added to consider item stock status using price index */
210
  $this->_itemCollection->addPriceData();
@@ -214,7 +263,7 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
214
  ->load();
215
 
216
  /* update compare items count */
217
- $this->_getSession()->setCatalogCompareItemsCount(count($this->_itemCollection));
218
  }
219
 
220
  return $this->_itemCollection;
@@ -229,30 +278,29 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
229
  public function calculate($logout = false)
230
  {
231
  // first visit
232
- if (!$this->_getSession()->hasCatalogCompareItemsCount() && !$this->_customerId) {
233
  $count = 0;
234
  } else {
235
  /** @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection */
236
  $collection = Mage::getResourceModel('catalog/product_compare_item_collection')
237
  ->useProductItem(true);
238
- if (!$logout && Mage::getSingleton('customer/session')->isLoggedIn()) {
239
- $collection->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId());
240
  } elseif ($this->_customerId) {
241
  $collection->setCustomerId($this->_customerId);
242
  } else {
243
- $collection->setVisitorId(Mage::getSingleton('log/visitor')->getId());
244
  }
245
 
246
  /* Price data is added to consider item stock status using price index */
247
  $collection->addPriceData();
248
 
249
- Mage::getSingleton('catalog/product_visibility')
250
- ->addVisibleInSiteFilterToCollection($collection);
251
 
252
  $count = $collection->getSize();
253
  }
254
 
255
- $this->_getSession()->setCatalogCompareItemsCount($count);
256
 
257
  return $this;
258
  }
@@ -264,11 +312,11 @@ class Mage_Catalog_Helper_Product_Compare extends Mage_Core_Helper_Url
264
  */
265
  public function getItemCount()
266
  {
267
- if (!$this->_getSession()->hasCatalogCompareItemsCount()) {
268
  $this->calculate();
269
  }
270
 
271
- return $this->_getSession()->getCatalogCompareItemsCount();
272
  }
273
 
274
  /**
62
  */
63
  protected $_customerId = null;
64
 
65
+ /**
66
+ * @var Mage_Log_Helper_Data
67
+ */
68
+ protected $_logCondition;
69
+
70
+ /**
71
+ * @var Mage_Catalog_Model_Session
72
+ */
73
+ protected $_catalogSession;
74
+
75
+ /**
76
+ * @var Mage_Customer_Model_Session
77
+ */
78
+ protected $_customerSession;
79
+
80
+ /**
81
+ * @var Mage_Core_Model_Session
82
+ */
83
+ protected $_coreSession;
84
+
85
+ /**
86
+ * @var Mage_Log_Model_Visitor
87
+ */
88
+ protected $_logVisitor;
89
+
90
+ /**
91
+ * @var Mage_Catalog_Model_Product_Visibility
92
+ */
93
+ protected $_productVisibility;
94
+
95
+ public function __construct(array $data = array())
96
+ {
97
+ $this->_logCondition = isset($data['log_condition'])
98
+ ? $data['log_condition'] : Mage::helper('log');
99
+ $this->_catalogSession = isset($data['catalog_session'])
100
+ ? $data['catalog_session'] : Mage::getSingleton('catalog/session');
101
+ $this->_customerSession = isset($data['customer_session'])
102
+ ? $data['customer_session'] : Mage::getSingleton('customer/session');
103
+ $this->_coreSession = isset($data['core_session'])
104
+ ? $data['core_session'] : Mage::getSingleton('core/session');
105
+ $this->_productVisibility = isset($data['product_visibility'])
106
+ ? $data['product_visibility'] : Mage::getSingleton('catalog/product_visibility');
107
+ $this->_logVisitor = isset($data['log_visitor'])
108
+ ? $data['log_visitor'] : Mage::getSingleton('log/visitor');
109
+ }
110
+
111
  /**
112
  * Retrieve Catalog Session instance
113
  *
115
  */
116
  protected function _getSession()
117
  {
118
+ return $this->_catalogSession;
119
  }
120
 
121
  /**
149
  return array(
150
  'product' => $product->getId(),
151
  Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl(),
152
+ Mage_Core_Model_Url::FORM_KEY => $this->_coreSession->getFormKey()
153
  );
154
  }
155
 
161
  */
162
  public function getAddUrl($product)
163
  {
164
+ if ($this->_logCondition->isVisitorLogEnabled()) {
165
+ return $this->_getUrl('catalog/product_compare/add', $this->_getUrlParams($product));
166
+ }
167
+ return '';
168
  }
169
 
170
  /**
175
  */
176
  public function getAddToWishlistUrl($product)
177
  {
178
+ $beforeCompareUrl = $this->_catalogSession->getBeforeCompareUrl();
179
 
180
  $params = array(
181
  'product' => $product->getId(),
182
+ Mage_Core_Model_Url::FORM_KEY => $this->_coreSession->getFormKey(),
183
  Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl)
184
  );
185
 
194
  */
195
  public function getAddToCartUrl($product)
196
  {
197
+ $beforeCompareUrl = $this->_catalogSession->getBeforeCompareUrl();
198
  $params = array(
199
  'product' => $product->getId(),
200
  Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl),
201
+ Mage_Core_Model_Url::FORM_KEY => $this->_coreSession->getFormKey()
202
  );
203
 
204
  return $this->_getUrl('checkout/cart/add', $params);
240
  public function getItemCollection()
241
  {
242
  if (!$this->_itemCollection) {
243
+ /** @var Mage_Catalog_Model_Resource_Product_Compare_Item_Collection _itemCollection */
244
  $this->_itemCollection = Mage::getResourceModel('catalog/product_compare_item_collection')
245
  ->useProductItem(true)
246
  ->setStoreId(Mage::app()->getStore()->getId());
247
 
248
+ if ($this->_customerSession->isLoggedIn()) {
249
+ $this->_itemCollection->setCustomerId($this->_customerSession->getCustomerId());
250
  } elseif ($this->_customerId) {
251
  $this->_itemCollection->setCustomerId($this->_customerId);
252
  } else {
253
+ $this->_itemCollection->setVisitorId($this->_logVisitor->getId());
254
  }
255
 
256
+ $this->_productVisibility->addVisibleInSiteFilterToCollection($this->_itemCollection);
 
257
 
258
  /* Price data is added to consider item stock status using price index */
259
  $this->_itemCollection->addPriceData();
263
  ->load();
264
 
265
  /* update compare items count */
266
+ $this->_catalogSession->setCatalogCompareItemsCount(count($this->_itemCollection));
267
  }
268
 
269
  return $this->_itemCollection;
278
  public function calculate($logout = false)
279
  {
280
  // first visit
281
+ if (!$this->_catalogSession->hasCatalogCompareItemsCount() && !$this->_customerId) {
282
  $count = 0;
283
  } else {
284
  /** @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection */
285
  $collection = Mage::getResourceModel('catalog/product_compare_item_collection')
286
  ->useProductItem(true);
287
+ if (!$logout && $this->_customerSession->isLoggedIn()) {
288
+ $collection->setCustomerId($this->_customerSession->getCustomerId());
289
  } elseif ($this->_customerId) {
290
  $collection->setCustomerId($this->_customerId);
291
  } else {
292
+ $collection->setVisitorId($this->_logVisitor->getId());
293
  }
294
 
295
  /* Price data is added to consider item stock status using price index */
296
  $collection->addPriceData();
297
 
298
+ $this->_productVisibility->addVisibleInSiteFilterToCollection($collection);
 
299
 
300
  $count = $collection->getSize();
301
  }
302
 
303
+ $this->_catalogSession->setCatalogCompareItemsCount($count);
304
 
305
  return $this;
306
  }
312
  */
313
  public function getItemCount()
314
  {
315
+ if (!$this->_catalogSession->hasCatalogCompareItemsCount()) {
316
  $this->calculate();
317
  }
318
 
319
+ return $this->_catalogSession->getCatalogCompareItemsCount();
320
  }
321
 
322
  /**
app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php CHANGED
@@ -99,6 +99,13 @@ class Mage_Catalog_Model_Convert_Adapter_Product
99
 
100
  protected $_toNumber = array();
101
 
 
 
 
 
 
 
 
102
  /**
103
  * Retrieve event prefix for adapter
104
  *
@@ -424,6 +431,8 @@ class Mage_Catalog_Model_Convert_Adapter_Product
424
  if (!Mage::registry('Object_Cache_StockItem')) {
425
  $this->setStockItem(Mage::getModel('cataloginventory/stock_item'));
426
  }
 
 
427
  }
428
 
429
  /**
@@ -574,6 +583,38 @@ class Mage_Catalog_Model_Convert_Adapter_Product
574
  return $this;
575
  }
576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  /**
578
  * Save product (import)
579
  *
@@ -643,6 +684,12 @@ class Mage_Catalog_Model_Convert_Adapter_Product
643
  }
644
  }
645
 
 
 
 
 
 
 
646
  $this->setProductTypeInstance($product);
647
 
648
  if (isset($importData['category_ids'])) {
@@ -757,20 +804,18 @@ class Mage_Catalog_Model_Convert_Adapter_Product
757
  }
758
  $product->setStockData($stockData);
759
 
760
- $mediaGalleryBackendModel = $this->getAttribute('media_gallery')->getBackend();
761
-
762
  $arrayToMassAdd = array();
763
 
764
  foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) {
765
  if (isset($importData[$mediaAttributeCode])) {
766
  $file = trim($importData[$mediaAttributeCode]);
767
- if (!empty($file) && !$mediaGalleryBackendModel->getImage($product, $file)) {
768
  $arrayToMassAdd[] = array('file' => trim($file), 'mediaAttribute' => $mediaAttributeCode);
769
  }
770
  }
771
  }
772
 
773
- $addedFilesCorrespondence = $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes(
774
  $product,
775
  $arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import',
776
  false,
@@ -793,7 +838,7 @@ class Mage_Catalog_Model_Convert_Adapter_Product
793
  $addedFile = $product->getData($mediaAttributeCode);
794
  }
795
  if ($fileLabel && $addedFile) {
796
- $mediaGalleryBackendModel->updateImage($product, $addedFile, array('label' => $fileLabel));
797
  }
798
  }
799
  }
99
 
100
  protected $_toNumber = array();
101
 
102
+ /**
103
+ * Gallery backend model
104
+ *
105
+ * @var Mage_Catalog_Model_Product_Attribute_Backend_Media
106
+ */
107
+ protected $_galleryBackendModel;
108
+
109
  /**
110
  * Retrieve event prefix for adapter
111
  *
431
  if (!Mage::registry('Object_Cache_StockItem')) {
432
  $this->setStockItem(Mage::getModel('cataloginventory/stock_item'));
433
  }
434
+
435
+ $this->_galleryBackendModel = $this->getAttribute('media_gallery')->getBackend();
436
  }
437
 
438
  /**
583
  return $this;
584
  }
585
 
586
+ /**
587
+ * Save data row with gallery image info only
588
+ *
589
+ * @param Mage_Catalog_Model_Product $product
590
+ * @param array $importData
591
+ *
592
+ * @return Mage_Catalog_Model_Convert_Adapter_Product
593
+ */
594
+ public function saveImageDataRow($product, $importData)
595
+ {
596
+ $imageData = array(
597
+ 'label' => $importData['_media_lable'],
598
+ 'position' => $importData['_media_position'],
599
+ 'disabled' => $importData['_media_is_disabled']
600
+ );
601
+
602
+ $imageFile = trim($importData['_media_image']);
603
+ $imageFile = ltrim($imageFile, DS);
604
+ $imageFilePath = Mage::getBaseDir('media') . DS . 'import' . DS . $imageFile;
605
+
606
+ $updatedFileName = $this->_galleryBackendModel->addImage($product, $imageFilePath, null, false,
607
+ (bool) $importData['_media_is_disabled']);
608
+ $this->_galleryBackendModel->updateImage($product, $updatedFileName, $imageData);
609
+
610
+ $this->_addAffectedEntityIds($product->getId());
611
+ $product->setIsMassupdate(true)
612
+ ->setExcludeUrlRewrite(true)
613
+ ->save();
614
+
615
+ return $this;
616
+ }
617
+
618
  /**
619
  * Save product (import)
620
  *
684
  }
685
  }
686
 
687
+ // process row with media data only
688
+ if (isset($importData['_media_image']) && strlen($importData['_media_image'])) {
689
+ $this->saveImageDataRow($product, $importData);
690
+ return true;
691
+ }
692
+
693
  $this->setProductTypeInstance($product);
694
 
695
  if (isset($importData['category_ids'])) {
804
  }
805
  $product->setStockData($stockData);
806
 
 
 
807
  $arrayToMassAdd = array();
808
 
809
  foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) {
810
  if (isset($importData[$mediaAttributeCode])) {
811
  $file = trim($importData[$mediaAttributeCode]);
812
+ if (!empty($file) && !$this->_galleryBackendModel->getImage($product, $file)) {
813
  $arrayToMassAdd[] = array('file' => trim($file), 'mediaAttribute' => $mediaAttributeCode);
814
  }
815
  }
816
  }
817
 
818
+ $addedFilesCorrespondence = $this->_galleryBackendModel->addImagesWithDifferentMediaAttributes(
819
  $product,
820
  $arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import',
821
  false,
838
  $addedFile = $product->getData($mediaAttributeCode);
839
  }
840
  if ($fileLabel && $addedFile) {
841
+ $this->_galleryBackendModel->updateImage($product, $addedFile, array('label' => $fileLabel));
842
  }
843
  }
844
  }
app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php CHANGED
@@ -482,19 +482,56 @@ class Mage_Catalog_Model_Convert_Parser_Product
482
  }
483
  }
484
 
 
 
 
 
485
  foreach ($this->_imageFields as $field) {
486
- if (isset($row[$field]) && $row[$field] == 'no_selection') {
487
- $row[$field] = null;
 
 
 
 
488
  }
489
  }
 
490
 
491
- $batchExport = $this->getBatchExportModel()
 
492
  ->setId(null)
493
- ->setBatchId($this->getBatchModel()->getId())
494
  ->setBatchData($row)
495
  ->setStatus(1)
496
  ->save();
497
- $product->reset();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498
  }
499
 
500
  return $this;
482
  }
483
  }
484
 
485
+ $productMediaGallery = $product->getMediaGallery();
486
+ $product->reset();
487
+
488
+ $processedImageList = array();
489
  foreach ($this->_imageFields as $field) {
490
+ if (isset($row[$field])) {
491
+ if ($row[$field] == 'no_selection') {
492
+ $row[$field] = null;
493
+ } else {
494
+ $processedImageList[] = $row[$field];
495
+ }
496
  }
497
  }
498
+ $processedImageList = array_unique($processedImageList);
499
 
500
+ $batchModelId = $this->getBatchModel()->getId();
501
+ $this->getBatchExportModel()
502
  ->setId(null)
503
+ ->setBatchId($batchModelId)
504
  ->setBatchData($row)
505
  ->setStatus(1)
506
  ->save();
507
+
508
+ $baseRowData = array(
509
+ 'store' => $row['store'],
510
+ 'website' => $row['website'],
511
+ 'sku' => $row['sku']
512
+ );
513
+ unset($row);
514
+
515
+ foreach ($productMediaGallery['images'] as $image) {
516
+ if (in_array($image['file'], $processedImageList)) {
517
+ continue;
518
+ }
519
+
520
+ $rowMediaGallery = array(
521
+ '_media_image' => $image['file'],
522
+ '_media_lable' => $image['label'],
523
+ '_media_position' => $image['position'],
524
+ '_media_is_disabled' => $image['disabled']
525
+ );
526
+ $rowMediaGallery = array_merge($baseRowData, $rowMediaGallery);
527
+
528
+ $this->getBatchExportModel()
529
+ ->setId(null)
530
+ ->setBatchId($batchModelId)
531
+ ->setBatchData($rowMediaGallery)
532
+ ->setStatus(1)
533
+ ->save();
534
+ }
535
  }
536
 
537
  return $this;
app/code/core/Mage/Catalog/Model/Observer.php CHANGED
@@ -214,7 +214,7 @@ class Mage_Catalog_Model_Observer
214
  $block = $observer->getEvent()->getBlock();
215
  $block->addCacheTag(Mage_Catalog_Model_Category::CACHE_TAG);
216
  $this->_addCategoriesToMenu(
217
- Mage::helper('catalog/category')->getStoreCategories(), $observer->getMenu(), $block, true
218
  );
219
  }
220
 
214
  $block = $observer->getEvent()->getBlock();
215
  $block->addCacheTag(Mage_Catalog_Model_Category::CACHE_TAG);
216
  $this->_addCategoriesToMenu(
217
+ Mage::helper('catalog/category')->getStoreCategories(), $observer->getMenu(), $block
218
  );
219
  }
220
 
app/code/core/Mage/Catalog/Model/Product.php CHANGED
@@ -1889,19 +1889,30 @@ class Mage_Catalog_Model_Product extends Mage_Catalog_Model_Abstract
1889
  *
1890
  * @return array
1891
  */
1892
- public function getCacheIdTags()
1893
  {
1894
- $tags = parent::getCacheIdTags();
1895
- $affectedCategoryIds = $this->getAffectedCategoryIds();
1896
- if (!$affectedCategoryIds) {
1897
- $affectedCategoryIds = $this->getCategoryIds();
1898
- }
1899
  foreach ($affectedCategoryIds as $categoryId) {
1900
  $tags[] = Mage_Catalog_Model_Category::CACHE_TAG.'_'.$categoryId;
1901
  }
1902
  return $tags;
1903
  }
1904
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1905
  /**
1906
  * Check for empty SKU on each product
1907
  *
1889
  *
1890
  * @return array
1891
  */
1892
+ public function getCacheIdTagsWithCategories()
1893
  {
1894
+ $tags = $this->getCacheTags();
1895
+ $affectedCategoryIds = $this->_getResource()->getCategoryIdsWithAnchors($this);
 
 
 
1896
  foreach ($affectedCategoryIds as $categoryId) {
1897
  $tags[] = Mage_Catalog_Model_Category::CACHE_TAG.'_'.$categoryId;
1898
  }
1899
  return $tags;
1900
  }
1901
 
1902
+ /**
1903
+ * Remove model onject related cache
1904
+ *
1905
+ * @return Mage_Core_Model_Abstract
1906
+ */
1907
+ public function cleanModelCache()
1908
+ {
1909
+ $tags = $this->getCacheIdTagsWithCategories();
1910
+ if ($tags !== false) {
1911
+ Mage::app()->cleanCache($tags);
1912
+ }
1913
+ return $this;
1914
+ }
1915
+
1916
  /**
1917
  * Check for empty SKU on each product
1918
  *
app/code/core/Mage/Catalog/Model/Product/Compare/Item.php CHANGED
@@ -28,7 +28,6 @@
28
  /**
29
  * Catalog Compare Item Model
30
  *
31
- * @method Mage_Catalog_Model_Resource_Product_Compare_Item _getResource()
32
  * @method Mage_Catalog_Model_Resource_Product_Compare_Item getResource()
33
  * @method Mage_Catalog_Model_Product_Compare_Item setVisitorId(int $value)
34
  * @method Mage_Catalog_Model_Product_Compare_Item setCustomerId(int $value)
@@ -100,6 +99,19 @@ class Mage_Catalog_Model_Product_Compare_Item extends Mage_Core_Model_Abstract
100
  return $this;
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  /**
104
  * Add customer data from customer object
105
  *
28
  /**
29
  * Catalog Compare Item Model
30
  *
 
31
  * @method Mage_Catalog_Model_Resource_Product_Compare_Item getResource()
32
  * @method Mage_Catalog_Model_Product_Compare_Item setVisitorId(int $value)
33
  * @method Mage_Catalog_Model_Product_Compare_Item setCustomerId(int $value)
99
  return $this;
100
  }
101
 
102
+ /**
103
+ * Save object data
104
+ *
105
+ * @return Mage_Catalog_Model_Product_Compare_Item
106
+ */
107
+ public function save()
108
+ {
109
+ if ($this->hasCustomerId() || $this->hasVisitorId()) {
110
+ parent::save();
111
+ }
112
+ return $this;
113
+ }
114
+
115
  /**
116
  * Add customer data from customer object
117
  *
app/code/core/Mage/Catalog/Model/Product/Status.php CHANGED
@@ -248,7 +248,23 @@ class Mage_Catalog_Model_Product_Status extends Mage_Core_Model_Abstract
248
  */
249
  public function getFlatColums()
250
  {
251
- return array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  }
253
 
254
  /**
@@ -258,7 +274,15 @@ class Mage_Catalog_Model_Product_Status extends Mage_Core_Model_Abstract
258
  */
259
  public function getFlatIndexes()
260
  {
261
- return array();
 
 
 
 
 
 
 
 
262
  }
263
 
264
  /**
@@ -270,7 +294,8 @@ class Mage_Catalog_Model_Product_Status extends Mage_Core_Model_Abstract
270
  */
271
  public function getFlatUpdateSelect($store)
272
  {
273
- return null;
 
274
  }
275
 
276
  /**
248
  */
249
  public function getFlatColums()
250
  {
251
+ $attributeCode = $this->getAttribute()->getAttributeCode();
252
+ $column = array(
253
+ 'unsigned' => true,
254
+ 'default' => null,
255
+ 'extra' => null
256
+ );
257
+
258
+ if (Mage::helper('core')->useDbCompatibleMode()) {
259
+ $column['type'] = 'tinyint';
260
+ $column['is_null'] = true;
261
+ } else {
262
+ $column['type'] = Varien_Db_Ddl_Table::TYPE_SMALLINT;
263
+ $column['nullable'] = true;
264
+ $column['comment'] = 'Catalog Product Status ' . $attributeCode . ' column';
265
+ }
266
+
267
+ return array($attributeCode => $column);
268
  }
269
 
270
  /**
274
  */
275
  public function getFlatIndexes()
276
  {
277
+ $indexes = array();
278
+
279
+ $index = 'IDX_' . strtoupper($this->getAttribute()->getAttributeCode());
280
+ $indexes[$index] = array(
281
+ 'type' => 'index',
282
+ 'fields' => array($this->getAttribute()->getAttributeCode())
283
+ );
284
+
285
+ return $indexes;
286
  }
287
 
288
  /**
294
  */
295
  public function getFlatUpdateSelect($store)
296
  {
297
+ return Mage::getResourceSingleton('eav/entity_attribute')
298
+ ->getFlatUpdateSelect($this->getAttribute(), $store);
299
  }
300
 
301
  /**
app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php CHANGED
@@ -127,7 +127,12 @@ class Mage_Catalog_Model_Resource_Layer_Filter_Price extends Mage_Core_Model_Res
127
 
128
  // processing WHERE part
129
  $wherePart = $select->getPart(Zend_Db_Select::WHERE);
 
130
  foreach ($wherePart as $key => $wherePartItem) {
 
 
 
 
131
  $wherePart[$key] = $this->_replaceTableAlias($wherePartItem);
132
  }
133
  $select->setPart(Zend_Db_Select::WHERE, $wherePart);
@@ -225,9 +230,11 @@ class Mage_Catalog_Model_Resource_Layer_Filter_Price extends Mage_Core_Model_Res
225
  {
226
  $currencyRate = $filter->getLayer()->getProductCollection()->getCurrencyRate();
227
  if ($decrease) {
228
- return ($price - (self::MIN_POSSIBLE_PRICE / 2)) / $currencyRate;
 
 
229
  }
230
- return ($price + (self::MIN_POSSIBLE_PRICE / 2)) / $currencyRate;
231
  }
232
 
233
  /**
127
 
128
  // processing WHERE part
129
  $wherePart = $select->getPart(Zend_Db_Select::WHERE);
130
+ $excludedWherePart = Mage_Catalog_Model_Resource_Product_Collection::MAIN_TABLE_ALIAS . '.status';
131
  foreach ($wherePart as $key => $wherePartItem) {
132
+ if (strpos($wherePartItem, $excludedWherePart) !== false) {
133
+ $wherePart[$key] = new Zend_Db_Expr('1=1');
134
+ continue;
135
+ }
136
  $wherePart[$key] = $this->_replaceTableAlias($wherePartItem);
137
  }
138
  $select->setPart(Zend_Db_Select::WHERE, $wherePart);
230
  {
231
  $currencyRate = $filter->getLayer()->getProductCollection()->getCurrencyRate();
232
  if ($decrease) {
233
+ $result = ($price - (self::MIN_POSSIBLE_PRICE / 2)) / $currencyRate;
234
+ } else {
235
+ $result = ($price + (self::MIN_POSSIBLE_PRICE / 2)) / $currencyRate;
236
  }
237
+ return sprintf('%F', $result);
238
  }
239
 
240
  /**
app/code/core/Mage/Catalog/Model/Resource/Product.php CHANGED
@@ -702,4 +702,30 @@ class Mage_Catalog_Model_Resource_Product extends Mage_Catalog_Model_Resource_Ab
702
  $images = $read->fetchAll($select);
703
  return $images;
704
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
705
  }
702
  $images = $read->fetchAll($select);
703
  return $images;
704
  }
705
+
706
+ /**
707
+ * Retrieve product categories
708
+ *
709
+ * @param Mage_Catalog_Model_Product $object
710
+ * @return array
711
+ */
712
+ public function getCategoryIdsWithAnchors($object)
713
+ {
714
+ $selectRootCategories = $this->_getReadAdapter()->select()
715
+ ->from(
716
+ array($this->getTable('catalog/category')),
717
+ array('entity_id')
718
+ )
719
+ ->where('level <= 1');
720
+ $rootIds = $this->_getReadAdapter()->fetchCol($selectRootCategories);
721
+ $select = $this->_getReadAdapter()->select()
722
+ ->from(
723
+ array($this->getTable('catalog/category_product_index')),
724
+ array('category_id')
725
+ )
726
+ ->where('product_id = ?', (int)$object->getEntityId())
727
+ ->where('category_id NOT IN(?)', $rootIds);
728
+
729
+ return $this->_getReadAdapter()->fetchCol($select);
730
+ }
731
  }
app/code/core/Mage/Catalog/Model/Resource/Product/Action.php CHANGED
@@ -58,6 +58,9 @@ class Mage_Catalog_Model_Resource_Product_Action extends Mage_Catalog_Model_Reso
58